| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- /**
- * author xtj
- * createtime 2020/6/3 0003 上午 9:25
- * return array obj json bool
- * param
- */
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Db;
- use think\Where;
- //油墨指令书
- class InkBook extends Backend{
- //订单列表页
- public function index(){
- //设置过滤方法
- $this->request->filter(['strip_tags']);
- if ($this->request->isAjax()) {
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $total = Db::name('formula_book')
- ->where($where)
- ->order($sort, $order)
- ->count();
- $list = Db::name('formula_book')
- ->where($where)
- ->order($sort, $order)
- ->limit($offset, $limit)
- ->select();
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
- //详情
- public function read(){
- //设置过滤方法
- $this->request->filter(['strip_tags']);
- if ($this->request->isAjax()) {
- $params = $this->request->request();
- $filter = json_decode($params['filter'],true);
- $pid = $filter['id'];
- $limit = $params['limit'];
- $offset = $params['offset'];
- $total = Db::name('formula_book_detail')
- ->where('pid',$pid)
- ->count();
- $list = Db::name('formula_book_detail')
- ->where('pid',$pid)
- ->limit($offset, $limit)
- ->field('id,create,formula,big_number,small_number')
- ->select();
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
- //查看,渲染基础数据
- public function detail(){
- $params = input('ids');
- if (empty($params)){
- $this->error('未知数据格式');
- }
- $result = Db::name('formula_book_detail')->where('id',$params)->find();
- return $this->view->fetch('',compact('result'));
- }
- //渲染表格里配方和大小盒计划数据
- public function doDetail(){
- $params = input('id');
- if (empty($params)){
- $this->error('未知数据格式');
- }
- $result = Db::name('formula_book_detail')->where('id',$params)->find();
- $formula = json_decode($result['warehousing'],true);
- $consume = json_decode($result['consume'],true);
- $formulaSpan = json_decode($result['formula_span'],true);
- $formulaSpanData = [];
- $i = 0;
- foreach ($formulaSpan as $key=>$value){
- $formulaSpanData[$key]['beginRow'] = $i;
- $count = $value;
- $formulaSpanData[$key]['rowSpan'] = $value;
- $i = $count + $i;
- }
- return array('status'=>1,'data'=>$formula,'consume'=>$consume,'formulaSpanData'=>$formulaSpanData,'consumeSpan'=>$result['consume_span']);
- }
- }
|