Browse Source

first commit

liuhairui 7 months ago
parent
commit
7b5f0d46bf
30 changed files with 3017 additions and 161 deletions
  1. 248 0
      application/admin/controller/Command.php
  2. 232 43
      application/admin/controller/Deliver.php
  3. 114 0
      application/admin/controller/Finishedproduct.php
  4. 69 0
      application/admin/controller/Inventorydetails.php
  5. 85 17
      application/admin/controller/QcodeAdd.php
  6. 16 0
      application/admin/lang/zh-cn/command.php
  7. 15 0
      application/admin/lang/zh-cn/finishedproduct.php
  8. 15 0
      application/admin/lang/zh-cn/inventorydetails.php
  9. 59 0
      application/admin/model/Command.php
  10. 57 0
      application/admin/model/Finishedproduct.php
  11. 57 0
      application/admin/model/Inventorydetails.php
  12. 27 0
      application/admin/validate/Command.php
  13. 27 0
      application/admin/validate/Finishedproduct.php
  14. 27 0
      application/admin/validate/Inventorydetails.php
  15. 420 0
      application/admin/view/command/add.html
  16. 42 0
      application/admin/view/command/detail.html
  17. 25 0
      application/admin/view/command/index.html
  18. 3 0
      application/admin/view/deliver/index.html
  19. 21 21
      application/admin/view/deliver/lager.html
  20. 63 0
      application/admin/view/finishedproduct/add.html
  21. 63 0
      application/admin/view/finishedproduct/edit.html
  22. 380 0
      application/admin/view/finishedproduct/index.html
  23. 4 1
      application/admin/view/index/login.html
  24. 63 0
      application/admin/view/inventorydetails/add.html
  25. 63 0
      application/admin/view/inventorydetails/edit.html
  26. 330 0
      application/admin/view/inventorydetails/index.html
  27. 368 53
      application/admin/view/qcode_add/index.html
  28. 71 18
      application/admin/view/qcode_bach/index.html
  29. 2 2
      application/admin/view/qcode_bach/print_l.html
  30. 51 6
      application/database.php

+ 248 - 0
application/admin/controller/Command.php

@@ -0,0 +1,248 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Config;
+use think\console\Input;
+use think\Db;
+use think\Exception;
+
+/**
+ * 在线命令管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Command extends Backend
+{
+
+    /**
+     * Command模型对象
+     */
+    protected $model = null;
+    protected $noNeedRight = ['get_controller_list', 'get_field_list'];
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Command;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+
+    /**
+     * 添加
+     */
+    public function add()
+    {
+
+        $tableList = [];
+        $list = \think\Db::query("SHOW TABLES");
+        foreach ($list as $key => $row) {
+            $tableList[reset($row)] = reset($row);
+        }
+
+        $this->view->assign("tableList", $tableList);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 获取字段列表
+     * @internal
+     */
+    public function get_field_list()
+    {
+        $dbname = Config::get('database.database');
+        $prefix = Config::get('database.prefix');
+        $table = $this->request->request('table');
+        //从数据库中获取表字段信息
+        $sql = "SELECT * FROM `information_schema`.`columns` "
+            . "WHERE TABLE_SCHEMA = ? AND table_name = ? "
+            . "ORDER BY ORDINAL_POSITION";
+        //加载主表的列
+        $columnList = Db::query($sql, [$dbname, $table]);
+        $fieldlist = [];
+        foreach ($columnList as $index => $item) {
+            $fieldlist[] = $item['COLUMN_NAME'];
+        }
+        $this->success("", null, ['fieldlist' => $fieldlist]);
+    }
+
+    /**
+     * 获取控制器列表
+     * @internal
+     */
+    public function get_controller_list()
+    {
+        //搜索关键词,客户端输入以空格分开,这里接收为数组
+        $word = (array)$this->request->request("q_word/a");
+        $word = implode('', $word);
+
+        $adminPath = dirname(__DIR__) . DS;
+        $controllerDir = $adminPath . 'controller' . DS;
+        $files = new \RecursiveIteratorIterator(
+            new \RecursiveDirectoryIterator($controllerDir), \RecursiveIteratorIterator::LEAVES_ONLY
+        );
+        $list = [];
+        foreach ($files as $name => $file) {
+            if (!$file->isDir()) {
+                $filePath = $file->getRealPath();
+                $name = str_replace($controllerDir, '', $filePath);
+                $name = str_replace(DS, "/", $name);
+                if (!preg_match("/(.*)\.php\$/", $name)) {
+                    continue;
+                }
+                if (!$word || stripos($name, $word) !== false) {
+                    $list[] = ['id' => $name, 'name' => $name];
+                }
+            }
+        }
+        $pageNumber = $this->request->request("pageNumber");
+        $pageSize = $this->request->request("pageSize");
+        return json(['list' => array_slice($list, ($pageNumber - 1) * $pageSize, $pageSize), 'total' => count($list)]);
+    }
+
+    /**
+     * 详情
+     */
+    public function detail($ids)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 执行
+     */
+    public function execute($ids)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $result = $this->doexecute($row['type'], json_decode($row['params'], true));
+        $this->success("", null, ['result' => $result]);
+    }
+
+    /**
+     * 生成命令
+     */
+    public function command($action = '')
+    {
+        $commandtype = $this->request->request("commandtype");
+        $params = $this->request->request();
+        $allowfields = [
+            'crud' => 'table,controller,model,fields,force,local,delete,menu',
+            'menu' => 'controller,delete,force',
+            'min'  => 'module,resource,optimize',
+            'api'  => 'url,module,output,template,force,title,author,class,language,addon',
+        ];
+        $argv = [];
+        $allowfields = isset($allowfields[$commandtype]) ? explode(',', $allowfields[$commandtype]) : [];
+        $allowfields = array_filter(array_intersect_key($params, array_flip($allowfields)));
+        if (isset($params['local']) && !$params['local']) {
+            $allowfields['local'] = $params['local'];
+        } else {
+            unset($allowfields['local']);
+        }
+        foreach ($allowfields as $key => $param) {
+            $argv[] = "--{$key}=" . (is_array($param) ? implode(',', $param) : $param);
+        }
+        if ($commandtype == 'crud') {
+            $extend = 'setcheckboxsuffix,enumradiosuffix,imagefield,filefield,intdatesuffix,switchsuffix,citysuffix,selectpagesuffix,selectpagessuffix,ignorefields,sortfield,editorsuffix,headingfilterfield,tagsuffix,jsonsuffix,fixedcolumns';
+            $extendArr = explode(',', $extend);
+            foreach ($params as $index => $item) {
+                if (in_array($index, $extendArr)) {
+                    foreach (explode(',', $item) as $key => $value) {
+                        if ($value) {
+                            $argv[] = "--{$index}={$value}";
+                        }
+                    }
+                }
+            }
+            $isrelation = (int)$this->request->request('isrelation');
+            if ($isrelation && isset($params['relation'])) {
+                foreach ($params['relation'] as $index => $relation) {
+                    foreach ($relation as $key => $value) {
+                        $argv[] = "--{$key}=" . (is_array($value) ? implode(',', $value) : $value);
+                    }
+                }
+            }
+        } else {
+            if ($commandtype == 'menu') {
+                if (isset($params['allcontroller']) && $params['allcontroller']) {
+                    $argv[] = "--controller=all-controller";
+                } else {
+                    foreach (explode(',', $params['controllerfile']) as $index => $param) {
+                        if ($param) {
+                            $argv[] = "--controller=" . substr($param, 0, -4);
+                        }
+                    }
+                }
+            } else {
+                if ($commandtype == 'min') {
+
+                } else {
+                    if ($commandtype == 'api') {
+
+                    } else {
+
+                    }
+                }
+            }
+        }
+        if ($action == 'execute') {
+            if (stripos(implode(' ', $argv), '--controller=all-controller') !== false) {
+                $this->error("只允许在命令行执行该命令,执行前请做好菜单规则备份!!!");
+            }
+            if (config('app_debug')) {
+                $result = $this->doexecute($commandtype, $argv);
+                $this->success("", null, ['result' => $result]);
+            } else {
+                $this->error("只允许在开发环境下执行命令");
+            }
+        } else {
+            $this->success("", null, ['command' => "php think {$commandtype} " . implode(' ', $argv)]);
+        }
+
+        return;
+    }
+
+    protected function doexecute($commandtype, $argv)
+    {
+        if (!config('app_debug')) {
+            $this->error("只允许在开发环境下执行命令");
+        }
+        if (preg_match("/([;\|&]+)/", implode(' ', $argv))) {
+            $this->error("不支持的命令参数");
+        }
+        $commandName = "\\app\\admin\\command\\" . ucfirst($commandtype);
+        $input = new Input($argv);
+        $output = new \addons\command\library\Output();
+        $command = new $commandName($commandtype);
+        $data = [
+            'type'        => $commandtype,
+            'params'      => json_encode($argv),
+            'command'     => "php think {$commandtype} " . implode(' ', $argv),
+            'executetime' => time(),
+        ];
+        $this->model->save($data);
+        try {
+            $command->run($input, $output);
+            $result = implode("\n", $output->getMessage());
+            $this->model->status = 'successed';
+        } catch (Exception $e) {
+            $result = implode("\n", $output->getMessage()) . "\n";
+            $result .= $e->getMessage();
+            $this->model->status = 'failured';
+        }
+        $result = trim($result);
+        $this->model->content = $result;
+        $this->model->save();
+        return $result;
+    }
+
+}

+ 232 - 43
application/admin/controller/Deliver.php

@@ -38,6 +38,129 @@ class Deliver extends Backend
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
+//    public function lager()
+//    {
+//        $company = new QcodeCompany();
+//        $product = new QcodeProduct();
+//        $large = new QcodeLarge();
+//        $bach = new QcodeBach();
+//        $small = new QcodeSmall();
+//        $this->request->filter(['strip_tags', 'trim']);
+//        if (false === $this->request->isAjax()) {
+//            return $this->view->fetch();
+//        }
+//        if ($this->request->request('keyField')) {
+//            return $this->selectpage();
+//        }
+//        // 接收参数
+//        $userInfo = Session::get('admin');
+//        $where = [
+//            'delete_time'=> '',
+//        ];
+//        $filter = input('filter');
+//        $filter = json_decode($filter,true);
+//        $whereList = [
+//            'delete_time'=>'',
+//        ];
+//        //样品编号查询
+//        if (isset($filter['matter_name'])){
+//            $whereList['matter_no'] =$filter['matter_name'];
+//        }
+//        if (isset($filter['bach'])){
+//            $whereList['bach_num'] = $filter['bach'];
+//        }
+//        if (isset($filter['manufacture_date'])){
+//            $begin = substr($filter['manufacture_date'],0,19);
+//            $end = substr($filter['manufacture_date'],22);
+//            $begin = (int)date('ymd',strtotime($begin));
+//            $end = (int)date('ymd',strtotime($end));
+//            $whereList['manufacture_date'] = ['between',[$begin,$end]];
+//        }
+//
+//        $bach_list = $bach->name($userInfo['company'].'_'.'qcode_bach')->where($whereList)->column('_id');
+//        $bach_id = [];
+//        foreach ($bach_list as $v){
+//            $id = substr(json_encode($v),9,-2);
+//            array_push($bach_id,$id);
+//        }
+//        $order = input('order');
+////        $offset = input('offset');
+////        $limit = input('limit');
+////        $limit = input('limit', 10); // 每页数量,默认10条
+//
+//        $offset = input('offset', 0);
+//        $limit = input('limit', 10);
+//        $skip = $offset;
+//
+//        $total = $large->name($userInfo['company'].'_'.'qcode_large')
+//            ->where('l_status', 0)
+//            ->where($where)
+//            ->whereIn('bach_id', $bach_id)
+//            ->count();
+//
+//        $large_list = $large->name($userInfo['company'].'_'.'qcode_large')
+//            ->order('l_flow')
+//            ->where($where)
+//            ->where('l_status', 0)
+//            ->whereIn('bach_id', $bach_id)
+//            ->skip($skip)
+//            ->limit($limit)
+//            ->select();
+//
+//        $list=[];
+//        foreach ($large_list as $k=>$v) {
+//            $bach_detail = $bach
+//                ->name($userInfo['company'].'_qcode_bach')
+//                ->where('_id', $v['bach_id'])
+//                ->find();
+//            //新增取 $bach 字段
+//            $list[$k]['num'] = $bach_detail['num'];
+//            $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
+//            $list[$k]['tray_num'] = $bach_detail['tray_num'];
+//            $list[$k]['box_num'] = $bach_detail['box_num'];
+//            $list[$k]['small_num'] = $bach_detail['small_num'];
+//            $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
+//            $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
+//            $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
+//            $list[$k]['small_num'] = $bach_detail['small_num'];
+//            $list[$k]['larger_num'] = $bach_detail['larger_num'];
+//
+//            $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
+//            $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
+//            $list[$k]['bach'] = $bach_detail['bach_num'];
+//            $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
+//            $list[$k]['matter_name'] = $bach_detail['matter_name'];
+//            $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
+//            $list[$k]['code'] = $v['code'];
+//            $small_num = $small->name($userInfo['company'].'_'.'qcode_small')->where('large_id',substr(json_encode($v['_id']),9,-2))->count();
+//            $list[$k]['small_num'] = $small_num;
+//        }
+//
+////        $result = ['total'=>$total,'rows'=>$list];
+//        // 分组
+//        $grouped = [];
+//        foreach ($list as $item) {
+//            $grouped[$item['matter_name']][] = $item;
+//        }
+//
+//        // 每组排序
+//        foreach ($grouped as &$items) {
+//            usort($items, function ($a, $b) {
+//                return intval($a['l_flow']) <=> intval($b['l_flow']);
+//            });
+//        }
+//        unset($items);
+//
+//        // 合并
+//        $sortedList = array_merge(...array_values($grouped));
+//
+//        // 输出
+////        echo "<pre>";
+////        print_r($sortedList);
+////        echo "</pre>";
+//        return json(['total'=>$total,'rows'=>$sortedList]);
+//    }
+
     public function lager()
     {
         $company = new QcodeCompany();
@@ -45,72 +168,95 @@ class Deliver extends Backend
         $large = new QcodeLarge();
         $bach = new QcodeBach();
         $small = new QcodeSmall();
+
         $this->request->filter(['strip_tags', 'trim']);
+
         if (false === $this->request->isAjax()) {
             return $this->view->fetch();
         }
+
         if ($this->request->request('keyField')) {
             return $this->selectpage();
         }
-        // 接收参数
+
         $userInfo = Session::get('admin');
-        $where = [
-            'delete_time'=> '',
-        ];
+        $where = ['delete_time'=> ''];
         $filter = input('filter');
-        $filter = json_decode($filter,true);
-        $whereList = [
-            'delete_time'=>'',
-        ];
-        //样品编号查询
+        $filter = json_decode($filter, true);
+        $whereList = ['delete_time'=>''];
+
         if (isset($filter['matter_name'])){
-            $whereList['matter_no'] =$filter['matter_name'];
+            $whereList['matter_no'] = $filter['matter_name'];
         }
         if (isset($filter['bach'])){
             $whereList['bach_num'] = $filter['bach'];
         }
         if (isset($filter['manufacture_date'])){
-            $begin = substr($filter['manufacture_date'],0,19);
-            $end = substr($filter['manufacture_date'],22);
-            $begin = (int)date('ymd',strtotime($begin));
-            $end = (int)date('ymd',strtotime($end));
-            $whereList['manufacture_date'] = ['between',[$begin,$end]];
+            $begin = substr($filter['manufacture_date'], 0, 19);
+            $end = substr($filter['manufacture_date'], 22);
+            $begin = (int)date('ymd', strtotime($begin));
+            $end = (int)date('ymd', strtotime($end));
+            $whereList['manufacture_date'] = ['between', [$begin, $end]];
         }
 
-        $bach_list = $bach->name($userInfo['company'].'_'.'qcode_bach')->where($whereList)->column('_id');
+        // 查出相关 bach_id
+        $bach_list = $bach->name($userInfo['company'].'_qcode_bach')->where($whereList)->column('_id');
         $bach_id = [];
         foreach ($bach_list as $v){
-            $id = substr(json_encode($v),9,-2);
-            array_push($bach_id,$id);
+            $id = substr(json_encode($v), 9, -2);
+            $bach_id[] = $id;
         }
-        $order = input('order');
-        $offset = input('offset');
-        $limit = input('limit');
-        $total = $large->name($userInfo['company'].'_'.'qcode_large')->where('l_status',0)->where($where)->whereIn('bach_id',$bach_id)->count();
-        $large_list = $large->name($userInfo['company'].'_'.'qcode_large')
-            ->order('create_time')
+
+        // 获取分页参数
+        $offset = input('offset', 0);
+        $limit = input('limit', 10);
+        $skip = $offset;
+        // 总数量
+        $total = $large->name($userInfo['company'].'_qcode_large')
+            ->where('l_status', 0)
             ->where($where)
-            ->where('l_status',0)
-            ->whereIn('bach_id',$bach_id)
-            ->skip($offset)
-            ->limit($limit)
+            ->whereIn('bach_id', $bach_id)
+            ->count();
+
+        // 当前页数据
+        $large_list = $large->name($userInfo['company'].'_qcode_large')
+            ->order('l_flow')
+            ->where($where)
+            ->where('l_status', 0)
+            ->whereIn('bach_id', $bach_id)
+//            ->skip($skip)
+//            ->limit($limit)
             ->select();
-        $list=[];
-        foreach ($large_list as $k=>$v) {
-            $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
-            $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
+        // 数据处理
+        $list = [];
+        foreach ($large_list as $k => $v) {
+            $bach_detail = $bach->name($userInfo['company'].'_qcode_bach')->where('_id', $v['bach_id'])->find();
+
+            $list[$k]['id'] = substr(json_encode($v['_id']), 9, -2);
+            $list[$k]['l_flow'] = $bach_detail['l_flow'];
             $list[$k]['bach'] = $bach_detail['bach_num'];
-            $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
+            $list[$k]['num'] = $bach_detail['num'];
             $list[$k]['matter_name'] = $bach_detail['matter_name'];
-            $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
+            $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
+            $list[$k]['tray_num'] = $bach_detail['tray_num'];
+            $list[$k]['box_num'] = $bach_detail['box_num'];
+            $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
+            $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
+            $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
+            $list[$k]['larger_num'] = $bach_detail['larger_num'];
+            $list[$k]['manufacture_date'] = date('Y-m-d', strtotime('20'.$bach_detail['manufacture_date']));
             $list[$k]['code'] = $v['code'];
-            $small_num = $small->name($userInfo['company'].'_'.'qcode_small')->where('large_id',substr(json_encode($v['_id']),9,-2))->count();
+            $list[$k]['l_flow'] = ltrim(substr($v['code'], 53, 6), '0');
+
+            $small_num = $small->name($userInfo['company'].'_qcode_small')
+                ->where('large_id', $list[$k]['id'])
+                ->count();
             $list[$k]['small_num'] = $small_num;
         }
-        $result = ['total'=>$total,'rows'=>$list];
-        return json($result);
-    }
 
+        // 返回分页数据(关键!不要再做分组排序!)
+        return json(['total' => $total, 'rows' => $list]);
+    }
     /**
      * 小件列表
      * @return \think\response\Json
@@ -204,7 +350,11 @@ class Deliver extends Backend
         foreach (explode(',',$lager_id) as $kk=>$vv){
             $n = $n + $small->name($userinfo['company'].'_'.'qcode_small')->where('large_id',$vv)->count();
         }
-        $bachDetail = $bach->name($userinfo['company'].'_'.'qcode_bach')->where('_id',$bach_id[0])->find();
+//        $bachDetail = $bach->name($userinfo['company'].'_'.'qcode_bach')->where('_id',$bach_id[0])->find();
+        $bachArray = $bach->name($userinfo['company'].'_'.'qcode_bach')
+            ->where('_id', $bach_id[0])
+            ->find();
+        $bachDetail = $bachArray ? $bachArray->toArray() : [];
         if ($bachDetail['box_num'] === 1){
             $mater_type = 2;
         }else{
@@ -213,12 +363,9 @@ class Deliver extends Backend
         $exportData = $this->exportdata($bach_id,$lager_id,$userinfo['company'],$lager_num,$n);
         $file_dir = $this->exportExcel($exportData);
         $row = [
-            'username'  => $bachDetail['supplier_name'],
-            'matter_name' => $bachDetail['matter_name'],
+            'username'  => $bachDetail['supplier_name'],//公司
             'matter_no' => $bachDetail['matter_no'],
             'large_str' => $lager_id,
-            'large_num' => $lager_num,
-            'small_num' => $n,
             'status' => 0,
             'bach_num' => $bachDetail['bach_num'],
             'note' => '',
@@ -226,6 +373,17 @@ class Deliver extends Backend
             'create_time' => time(),
             'file_dir' => $file_dir,
             'company_id' => $userinfo['company'],
+
+            'large_num' => $lager_num,//你已选中 N 个大件【托盘数】
+            'small_num' => $n,//共包含了 N 个小件
+            'matter_name' => $bachDetail['matter_name'],//产品名称
+            'total_boxes' => $bachDetail['total_boxes'],//每托箱数
+            'tray_num' => $bachDetail['tray_num'],//每层箱数
+            'box_num' => $bachDetail['box_num'],//每托层数
+            'pallet_height' => $bachDetail['pallet_height'],//每托高度
+            'pallet_length' => $bachDetail['pallet_length'],//托盘规格
+            'pallet_width' => $bachDetail['pallet_width'],//托盘规格
+            'larger_num' => $bachDetail['larger_num'],//总箱数
         ];
         if ($bachDetail['box_num'] != 1){
             $row['num'] = $bachDetail['box_num'];
@@ -428,6 +586,15 @@ class Deliver extends Backend
             ->select();
         $list=[];
         foreach ($export_list as $k=>$v) {
+            $list[$k]['large_num'] = $v['large_num'];//托盘数量
+            $list[$k]['total_boxes'] = $v['total_boxes'];//每箱托数
+            $list[$k]['tray_num'] = $v['tray_num'];//每层箱数
+            $list[$k]['box_num'] = $v['box_num'];//每托层数
+            $list[$k]['pallet_height'] = $v['pallet_height'];//托盘高度
+            $list[$k]['pallet_length'] = $v['pallet_length'];//托盘规格
+            $list[$k]['pallet_width'] = $v['pallet_width'];//托盘规格
+            $list[$k]['small_num'] = $v['small_num'];//总箱数
+
             $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
             $list[$k]['matter_name'] = $v['matter_name'];
             $list[$k]['matter_no'] = $v['matter_no'];
@@ -685,6 +852,28 @@ class Deliver extends Backend
             if ($good_list['note'] == 'NULL'){
                 $good_list['note'] = '';
             }
+
+            //新增代码
+            $good_array = $good_list ? $good_list->toArray() : [];
+            // 假设 $goodArray 是已经转为普通数组的结构
+            $dataList = $good_array['data'] ?? [];
+            // 步骤1:按照 create_time 升序排序
+            usort($dataList, function ($a, $b) {
+                return strtotime($a['create_time']) - strtotime($b['create_time']);
+            });
+            // 步骤2:添加 large_ber 字段
+            $start = 1;
+            foreach ($dataList as &$item) {
+                $count = intval($item['large_num']);
+                $end = $start + $count - 1;
+                $item['large_ber'] = ($start === $end) ? (string)$start : "$start-$end";
+                $start = $end + 1;
+            }
+            unset($item);
+            $good_list['data'] = $dataList;
+//            echo "<pre>";
+//            print_r($dataList);
+//            echo "</pre>";die;
             return json(['code'=>1,'data'=>$good_list]);
         }
     }

+ 114 - 0
application/admin/controller/Finishedproduct.php

@@ -0,0 +1,114 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use function EasyWeChat\Kernel\Support\rsa_public_encrypt;
+
+/**
+ * 版本管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Finishedproduct extends Backend
+{
+
+    /**
+     * Finishedproduct模型对象
+     * @var \app\admin\model\Finishedproduct
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Finishedproduct;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+    public function index()
+    {
+        // 获取前端传入的参数:搜索关键词、页码、每页数量(默认为第一页,每页10条)
+        $search = input('get.search');
+        $page = input('get.page', 1);
+        $limit = input('get.limit', 10);
+        // 连接配置中的 db3 数据库
+        $db3 = \db()->connect(config('database.db3'));
+
+        $query = $db3->name('成品入仓')
+            ->where('jjcp_smb', '=', '末 板')
+            ->whereNull('Mod_rq');
+        $where = ['jjcp_cpdh'=>['like','%'.$search.'%']];
+
+        $total = $query->where($where)->count();
+        $data = $query->field('jjcp_cpdh, jjcp_cpmc, jjcp_sl, UniqId, jjcp_smb')
+            ->where($where)
+            ->limit(($page - 1) * $limit, $limit)
+            ->select();
+
+        foreach ($data as &$row) {
+            $row['jjcp_smb'] = ($row['jjcp_smb'] === '末 板') ? '完工入库' : '未完工入库';
+        }
+
+        //AJAX 请求
+        if (request()->isAjax()) {
+            return json([
+                'data'  => $data,
+                'total' => $total,
+                'page'  => $page,
+                'limit' => $limit
+            ]);
+        }
+        $this->assign('data', $data);
+        return $this->fetch();
+    }
+
+
+    public function finished()
+    {
+        // 获取 JSON 格式的请求体
+        $jsonData = file_get_contents("php://input");
+
+        // 解析为 PHP 数组
+        $data = json_decode($jsonData, true);
+
+        if (!isset($data['data']) || !is_array($data['data'])) {
+            return json(['status' => 'error', 'msg' => '无效数据']);
+        }
+
+        // 连接 MongoDB 数据库(你在 config/database.php 中的 mongodb 配置名)
+        $mongo = \think\Db::connect('mongodb');
+
+        $insertList = [];
+
+        foreach ($data['data'] as $item) {
+            $insertList[] = [
+                'jjcp_cpdh' => $item['jjcp_cpdh'],
+                'jjcp_cpmc' => $item['jjcp_cpmc'],
+                'jjcp_sl'   => intval($item['jjcp_sl']),
+                'jjcp_smb'  => '已入库',
+                'created_at' => date('Y-m-d H:i:s')
+            ];
+        }
+
+        try {
+            // 批量插入 MongoDB 集合(表) Finished_products
+            $mongo->name('Finished_products')->insertAll($insertList);
+            return json(['status' => 'success', 'msg' => '成功插入 MongoDB']);
+        } catch (\Exception $e) {
+            return json(['status' => 'error', 'msg' => '插入失败:' . $e->getMessage()]);
+        }
+    }
+
+
+
+}

+ 69 - 0
application/admin/controller/Inventorydetails.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Db;
+use function EasyWeChat\Kernel\Support\rsa_public_encrypt;
+
+/**
+ * 版本管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Inventorydetails extends Backend
+{
+
+    /**
+     * Inventorydetails模型对象
+     * @var \app\admin\model\Inventorydetails
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Inventorydetails;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+    public function index()
+    {
+        // 1. 获取前端参数:搜索关键字、页码、每页条数
+        $search = input('get.search');
+        $page = input('get.page', 1);
+        $limit = input('get.limit', 10);
+
+        // 2. 连接 MongoDB(使用 config/database.php 中名为 mongodb 的连接)
+        $mongo = \think\Db::connect('mongodb');
+        $where = ['jjcp_cpdh' => ['like', '%' . $search . '%']];
+        $total = $mongo->name('finished_products')->where($where)->count();
+        $data = $mongo->name('finished_products')
+            ->limit(($page - 1) * $limit, $limit)
+            ->select();
+
+        if (request()->isAjax()) {
+            return json([
+                'data'  => $data,
+                'total' => $total,
+                'page'  => $page,
+                'limit' => $limit
+            ]);
+        }
+        $this->assign('data', $data);
+        return $this->fetch();
+    }
+
+
+
+
+}

+ 85 - 17
application/admin/controller/QcodeAdd.php

@@ -38,7 +38,6 @@ class QcodeAdd extends Backend
             'printer_code' => $userinfo['printer_code'],
             'company_address' => $userinfo['company_address']
         ];
-
         //创建公司唯一id,进行创建公司对用表名
         $user_company_value = Db::name('admin')->where('id', $userinfo['id'])->value('company');
         if (empty($user_company_value)) {
@@ -65,15 +64,61 @@ class QcodeAdd extends Backend
                 echo "创建集合 {$tableName} 失败:" . $e->getMessage();
             }
         }
+//        $product_id = $company->name((int)$userinfo['company'].'_'.'qcode_company')->where('delete_time','')->column('product_id');
+//        echo "<pre>";
+//        print_r($product_id);
+//        echo "<pre>";
+//        $product_name = [];
+//        foreach ($product_id as $v){
+//            $list = $product->where('_id',$v)->where('delete_time','')->find();
+//            $product_name[$list['product_code']] =  $list['product_name'];
+//        }
+//        echo "<pre>";
+//        print_r($product_name);
+//        echo "<pre>";
+//        $this->view->assign('product', $product_name);
 
-        $product_id = $company->name((int)$userinfo['company'].'_'.'qcode_company')->where('delete_time','')->column('product_id');
-        $product_name = [];
-        foreach ($product_id as $v){
-            $list = $product->where('_id',$v)->where('delete_time','')->find();
-            $product_name[$list['product_code']] =  $list['product_name'];
+        // 1. 获取所有产品的 ID
+        $product_id = $company
+            ->name((int)$userinfo['company'].'_'.'qcode_company')
+            ->where('delete_time','')
+            ->column('product_id');
+        // 2. 查找产品信息:构建 product_code => 全部信息数组
+        $product_info = [];
+        foreach ($product_id as $v) {
+            $list = $product
+                ->where('_id', $v)
+                ->where('delete_time', '')
+                ->find();
+            if ($list) {
+                // 记录完整产品信息
+                $product_info[$list['product_code']] = [
+                    'jjcp_cpmc' => $list['product_name'],     // 产品名称
+                    'jjcp_cpdh' => $list['product_code'],     // 产品代码
+                ];
+            }
+        }
+        // 3. 从 Mongo 查询 jjcp_cpmc 名称
+        $mongo = \think\Db::connect('mongodb');
+        $mongo_products = $mongo
+            ->name('finished_products')
+            ->field('jjcp_cpmc')
+            ->select();
+        // 4. 比对名称,匹配成功的组装完整 vo 结构
+        $matched_products = [];
+        foreach ($product_info as $code => $item) {
+            foreach ($mongo_products as $mp) {
+                if (trim($item['jjcp_cpmc']) === trim($mp['jjcp_cpmc'])) {
+                    $matched_products[] = [
+                        'jjcp_cpmc' => $item['jjcp_cpmc'],
+                        'jjcp_cpdh' => $item['jjcp_cpdh'],
+                        'product_code' => $code,
+                    ];
+                }
+            }
         }
+        $this->view->assign('product', $matched_products);
         $this->view->assign('row',$data);
-        $this->view->assign('product',$product_name);
         return $this->view->fetch();
     }
 
@@ -91,7 +136,9 @@ class QcodeAdd extends Backend
         if ($this->request->isAjax() === false){
             $this->error('请求错误');
         }
+
         $product_code = input('product_code');
+
         if (empty($product_code)){
             $this->error('参数错误');
         }
@@ -110,6 +157,7 @@ class QcodeAdd extends Backend
             $row['flow'] = $flow['l_flow']+1;
             $row['bach'] = $flow['bach_num']+1;
         }
+
         return json(['code'=>1,'data'=>$row]);
     }
 
@@ -128,6 +176,7 @@ class QcodeAdd extends Backend
         $small = new QcodeSmall();
         $liushui = new QcodeLiushui();
         $resetFlow = new ResetFlow();
+        $QcodeCompany = new QcodeCompany();
         if ($this->request->isAjax() === false){
             $this->error('请求错误');
         }
@@ -147,6 +196,7 @@ class QcodeAdd extends Backend
             $tray_num = $data['tray_num'];
             $tray_num1 = $data['tray_num'];
             $box_number = $data['box_number'];
+            //$small_num = (int)ceil((int)总数量(张/个)/(int)张数);
             $small_num = (int)ceil((int)$data['number']/(int)$data['box_number']);
             $large_num = (int)ceil($small_num/$tray_num);
         }else{
@@ -157,27 +207,45 @@ class QcodeAdd extends Backend
             $box_number = 1;
             $tray_num1 = 1;
         }
-        //插入批次信息
-        $userinfo = Session::get('admin');//获取用户信息
-        $productList = $product->where('product_code',$data['product_code'])->find();//获取材料信息
+        $userinfo = Session::get('admin');
+        $productList = $product->where('product_code',$data['product_code'])->find();
+        $arr = [
+            'product_id' => $productList['_id'],
+            'create_time' => time(),
+            'delect_time' => '',
+            'sync_flag' => 0,
+            ];
+        $productres = $QcodeCompany->save($arr);
+        if ($productres === 0){
+            $this->error('添加失败');
+        }
+
         if (empty($productList)){
             $this->error('未找到该产品数据');
         }
+
         $batchList = [
             'supplier_name' => $data['company_name'],
             'supplier_code' => $userinfo['printer_code'],
             'supplier_id' => $userinfo['id'],
             'matter_name' => $productList['product_name'],
-            'matter_no' => $productList['product_code'],
+            'matter_no' => $productList['product_code'],//生产批次号
             'matter_id' => substr(json_encode($productList['_id']),9,-2),
             'matter_type' => $productList['temple'],
-            'num' => $num,
-            'larger_num' => $large_num,
-            'small_num' => $small_num,
             'manufacture_date' => (int)date('ymd',strtotime($data['manufacture_date'])),
             'print_date' => (int)date('ymd',strtotime($data['print_date'])),
-            'box_num' => $box_number,
-            'tray_num' => $tray_num1,
+
+            'danwei' => $data['danwei'],//单位
+            'num' => $num,//总数量(张/个)
+            'tray_num' => $tray_num1,//每层箱数
+            'box_num' => $box_number,//每托层数
+            'total_boxes' => $data['total_boxes'],//每托盘箱数
+            'small_num' => $small_num,//每托盘箱数
+            'pallet_height' => $data['pallet_height'],//每托高度
+            'pallet_length' => $data['pallet_length'],//托盘规格
+            'pallet_width' => $data['pallet_width'],//托盘规格
+            'larger_num' => $large_num,//大件(总托数)
+
             'l_reservation' => '',
             'l_flow' => $data['big_liushui'],
             'l_weight' => $data['big_weight'],
@@ -188,7 +256,7 @@ class QcodeAdd extends Backend
             'userid' => $userinfo['id'],
             'bach_num' => $data['batch'],
             'large_endnum' => $data['big_liushui'] + $data['box_num'] -1,
-            'create_time' => time(),
+            'create_time' => time(),//新增时间
         ];
 
         $res = $bach->save($batchList);

+ 16 - 0
application/admin/lang/zh-cn/command.php

@@ -0,0 +1,16 @@
+<?php
+
+return [
+    'Id'            => 'ID',
+    'Type'          => '类型',
+    'Params'        => '参数',
+    'Command'       => '命令',
+    'Content'       => '返回结果',
+    'Executetime'   => '执行时间',
+    'Createtime'    => '创建时间',
+    'Updatetime'    => '更新时间',
+    'Execute again' => '再次执行',
+    'Successed'     => '成功',
+    'Failured'      => '失败',
+    'Status'        => '状态'
+];

+ 15 - 0
application/admin/lang/zh-cn/finishedproduct.php

@@ -0,0 +1,15 @@
+<?php
+
+return [
+    'Id'          => 'ID',
+    'Oldversion'  => '旧版本号',
+    'Newversion'  => '新版本号',
+    'Packagesize' => '包大小',
+    'Content'     => '升级内容',
+    'Downloadurl' => '下载地址',
+    'Enforce'     => '强制更新',
+    'Createtime'  => '创建时间',
+    'Updatetime'  => '更新时间',
+    'Weigh'       => '权重',
+    'Status'      => '状态'
+];

+ 15 - 0
application/admin/lang/zh-cn/inventorydetails.php

@@ -0,0 +1,15 @@
+<?php
+
+return [
+    'Id'          => 'ID',
+    'Oldversion'  => '旧版本号',
+    'Newversion'  => '新版本号',
+    'Packagesize' => '包大小',
+    'Content'     => '升级内容',
+    'Downloadurl' => '下载地址',
+    'Enforce'     => '强制更新',
+    'Createtime'  => '创建时间',
+    'Updatetime'  => '更新时间',
+    'Weigh'       => '权重',
+    'Status'      => '状态'
+];

+ 59 - 0
application/admin/model/Command.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+class Command extends Model
+{
+    // 表名
+    protected $name = 'command';
+
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+
+    // 追加属性
+    protected $append = [
+        'executetime_text',
+        'type_text',
+        'status_text'
+    ];
+
+
+    public function getStatusList()
+    {
+        return ['successed' => __('Successed'), 'failured' => __('Failured')];
+    }
+
+
+    public function getExecutetimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : $data['executetime'];
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    public function getTypeTextAttr($value, $data)
+    {
+        $value = $value ? $value : $data['type'];
+        $list = ['crud' => '一键生成CRUD', 'menu' => '一键生成菜单', 'min' => '一键压缩打包', 'api' => '一键生成文档'];
+        return $list[$value] ?? '';
+    }
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : $data['status'];
+        $list = $this->getStatusList();
+        return $list[$value] ?? '';
+    }
+
+    protected function setExecutetimeAttr($value)
+    {
+        return $value && !is_numeric($value) ? strtotime($value) : $value;
+    }
+
+
+}

+ 57 - 0
application/admin/model/Finishedproduct.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Finishedproduct extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'version';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'integer';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'status_text'
+    ];
+    
+
+    protected static function init()
+    {
+        self::afterInsert(function ($row) {
+            $pk = $row->getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
+    
+    public function getStatusList()
+    {
+        return ['30' => __('Status 30')];
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+
+
+}

+ 57 - 0
application/admin/model/Inventorydetails.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Inventorydetails extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'version';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'integer';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'status_text'
+    ];
+    
+
+    protected static function init()
+    {
+        self::afterInsert(function ($row) {
+            $pk = $row->getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
+    
+    public function getStatusList()
+    {
+        return ['30' => __('Status 30')];
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+
+
+}

+ 27 - 0
application/admin/validate/Command.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Command extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+
+}

+ 27 - 0
application/admin/validate/Finishedproduct.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Finishedproduct extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 27 - 0
application/admin/validate/Inventorydetails.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Inventorydetails extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 420 - 0
application/admin/view/command/add.html

@@ -0,0 +1,420 @@
+<style>
+    .relation-item {margin-top:10px;}
+    legend {padding-bottom:5px;font-size:14px;font-weight:600;}
+    label {font-weight:normal;}
+    .form-control{padding:6px 8px;}
+    #extend-zone .col-xs-2 {margin-top:10px;padding-right:0;}
+    #extend-zone .col-xs-2:nth-child(6n+0) {padding-right:15px;}
+</style>
+<div class="panel panel-default panel-intro">
+    <div class="panel-heading">
+        <ul class="nav nav-tabs">
+            <li class="active"><a href="#crud" data-toggle="tab">{:__('一键生成CRUD')}</a></li>
+            <li><a href="#menu" data-toggle="tab">{:__('一键生成菜单')}</a></li>
+            <li><a href="#min" data-toggle="tab">{:__('一键压缩打包')}</a></li>
+            <li><a href="#api" data-toggle="tab">{:__('一键生成API文档')}</a></li>
+        </ul>
+    </div>
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="crud">
+                <div class="row">
+                    <div class="col-xs-12">
+                        <form role="form">
+                            <input type="hidden" name="commandtype" value="crud" />
+                            <div class="form-group">
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <input checked="" name="isrelation" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="当前只支持生成1对1关联模型,选中后请配置关联表和字段">
+                                            <input name="isrelation" type="checkbox" value="1">
+                                            关联模型
+                                        </label>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <input checked="" name="local" type="hidden" value="1">
+                                        <label class="control-label" data-toggle="tooltip" title="默认模型生成在application/admin/model目录下,选中后将生成在application/common/model目录下">
+                                            <input name="local" type="checkbox" value="0"> 全局模型类
+                                        </label>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <input checked="" name="delete" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="删除CRUD生成的相关文件">
+                                            <input name="delete" type="checkbox" value="1"> 删除模式
+                                        </label>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <input checked="" name="force" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="选中后,如果已经存在同名文件将被覆盖。如果是删除将不再提醒">
+                                            <input name="force" type="checkbox" value="1">
+                                            强制覆盖模式
+                                        </label>
+                                    </div>
+                                    <!--
+                                    <div class="col-xs-3">
+                                        <input checked="" name="menu" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="选中后,将同时生成后台菜单规则">
+                                            <input name="menu" type="checkbox" value="1">
+                                            生成菜单
+                                        </label>
+                                    </div>
+                                    -->
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <legend>主表设置</legend>
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <label>请选择主表</label>
+                                        {:build_select('table',$tableList,null,['class'=>'form-control selectpicker', 'data-live-search'=>'true']);}
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>自定义控制器名</label>
+                                        <input type="text" class="form-control" name="controller" data-toggle="tooltip" title="默认根据表名自动生成,如果需要放在二级目录请手动填写" placeholder="支持目录层级,以/分隔">
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>自定义模型名</label>
+                                        <input type="text" class="form-control" name="model" data-toggle="tooltip" title="默认根据表名自动生成" placeholder="不支持目录层级">
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>显示字段(默认全部)</label>
+                                        <select name="fields[]" id="fields" multiple style="height:30px;" class="form-control selectpicker"></select>
+                                    </div>
+
+                                </div>
+
+                            </div>
+
+                            <div class="form-group hide" id="relation-zone">
+                                <legend>关联表设置</legend>
+
+                                <div class="row" style="margin-top:15px;">
+                                    <div class="col-xs-12">
+                                        <a href="javascript:;" class="btn btn-primary btn-sm btn-newrelation" data-index="1">追加关联模型</a>
+                                    </div>
+                                </div>
+                            </div>
+
+                            <hr>
+                            <div class="form-group" id="extend-zone">
+                                <legend>字段识别设置 <span style="font-size:12px;font-weight: normal;">(与之匹配的字段都将生成相应组件)</span></legend>
+                                <div class="row">
+                                    <div class="col-xs-2">
+                                        <label>复选框后缀</label>
+                                        <input type="text" class="form-control" name="setcheckboxsuffix" placeholder="默认为set类型" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>单选框后缀</label>
+                                        <input type="text" class="form-control" name="enumradiosuffix" placeholder="默认为enum类型" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>图片类型后缀</label>
+                                        <input type="text" class="form-control" name="imagefield" placeholder="默认为image,images,avatar,avatars" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>文件类型后缀</label>
+                                        <input type="text" class="form-control" name="filefield" placeholder="默认为file,files" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>日期时间后缀</label>
+                                        <input type="text" class="form-control" name="intdatesuffix" placeholder="默认为time" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>开关后缀</label>
+                                        <input type="text" class="form-control" name="switchsuffix" placeholder="默认为switch" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>城市选择后缀</label>
+                                        <input type="text" class="form-control" name="citysuffix" placeholder="默认为city" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>动态下拉后缀(单)</label>
+                                        <input type="text" class="form-control" name="selectpagesuffix" placeholder="默认为_id" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>动态下拉后缀(多)</label>
+                                        <input type="text" class="form-control" name="selectpagessuffix" placeholder="默认为_ids" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>忽略的字段</label>
+                                        <input type="text" class="form-control" name="ignorefields" placeholder="默认无" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>排序字段</label>
+                                        <input type="text" class="form-control" name="sortfield" placeholder="默认为weigh" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>富文本编辑器</label>
+                                        <input type="text" class="form-control" name="editorsuffix" placeholder="默认为content" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>选项卡过滤字段</label>
+                                        <input type="text" class="form-control" name="headingfilterfield" placeholder="默认为status" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>标签后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
+                                        <input type="text" class="form-control" name="tagsuffix" placeholder="默认为tag,tags" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>JSON后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
+                                        <input type="text" class="form-control" name="jsonsuffix" placeholder="默认为json" />
+                                    </div>
+                                    <div class="col-xs-2">
+                                        <label>固定列数量 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本,大于0时为右侧固定列数量,小于0时为左侧固定列数量"></i></label>
+                                        <input type="text" class="form-control" name="fixedcolumns" placeholder="默认不启用" />
+                                    </div>
+
+                                </div>
+
+                            </div>
+
+                            <div class="form-group">
+                                <legend>生成命令行</legend>
+                                <textarea class="form-control" data-toggle="tooltip" title="如果在线执行命令失败,可以将命令复制到命令行进行执行" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>返回结果</legend>
+                                <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                    <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
+                                    <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
+                            </div>
+
+                        </form>
+                    </div>
+                </div>
+            </div>
+            <div class="tab-pane fade" id="menu">
+                <div class="row">
+                    <div class="col-xs-12">
+                        <form role="form">
+                            <input type="hidden" name="commandtype" value="menu" />
+                            <div class="form-group">
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <input checked="" name="allcontroller" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="将删除全部的菜单规则,重新按控制器进行生成,请做好备份,谨慎选择">
+                                            <input name="allcontroller" data-toggle="collapse" data-target="#controller" type="checkbox" value="1"> 一键生成全部控制器
+                                        </label>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <input checked="" name="delete" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="删除控制器菜单规则">
+                                            <input name="delete" type="checkbox" value="1"> 删除模式
+                                        </label>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <input checked="" name="force" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="如果菜单规则已经存在则覆盖">
+                                            <input name="force" type="checkbox" value="1"> 强制覆盖模式
+                                        </label>
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="form-group in" id="controller">
+                                <legend>控制器设置</legend>
+
+                                <div class="row" style="margin-top:15px;">
+                                    <div class="col-xs-12">
+                                        <input type="text" name="controllerfile" class="form-control selectpage" style="width:720px;" data-source="command/get_controller_list" data-multiple="true" name="controller" placeholder="请选择控制器" />
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>生成命令行</legend>
+                                <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>返回结果</legend>
+                                <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
+                                <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
+                            </div>
+
+                        </form>
+                    </div>
+                </div>
+            </div>
+            <div class="tab-pane fade" id="min">
+                <div class="row">
+                    <div class="col-xs-12">
+                        <form role="form">
+                            <input type="hidden" name="commandtype" value="min" />
+                            <div class="form-group">
+                                <legend>基础设置</legend>
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <label>请选择压缩模块</label>
+                                        <select name="module" class="form-control selectpicker">
+                                            <option value="all" selected>全部</option>
+                                            <option value="backend">后台Backend</option>
+                                            <option value="frontend">前台Frontend</option>
+                                        </select>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>请选择压缩资源</label>
+                                        <select name="resource" class="form-control selectpicker">
+                                            <option value="all" selected>全部</option>
+                                            <option value="js">JS</option>
+                                            <option value="css">CSS</option>
+                                        </select>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>请选择压缩模式</label>
+                                        <select name="optimize" class="form-control selectpicker">
+                                            <option value="">无</option>
+                                            <option value="uglify">uglify</option>
+                                            <option value="closure">closure</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>生成命令行</legend>
+                                <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>返回结果</legend>
+                                <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
+                                <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
+                            </div>
+
+                        </form>
+                    </div>
+                </div>
+            </div>
+            <div class="tab-pane fade" id="api">
+                <div class="row">
+                    <div class="col-xs-12">
+                        <form role="form">
+                            <input type="hidden" name="commandtype" value="api" />
+                            <div class="form-group">
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <input checked="" name="force" type="hidden" value="0">
+                                        <label class="control-label" data-toggle="tooltip" title="如果已经存在则覆盖">
+                                            <input name="force" type="checkbox" value="1">
+                                            覆盖模式
+                                        </label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <legend>文档设置</legend>
+                                <div class="row">
+                                    <div class="col-xs-3">
+                                        <label>请输入接口URL</label>
+                                        <input type="text" name="url" class="form-control" placeholder="API URL,可留空" />
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>接口生成文件</label>
+                                        <input type="text" name="output" class="form-control" placeholder="留空则使用api.html" />
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>模板文件</label>
+                                        <input type="text" name="template" class="form-control" placeholder="如果不清楚请留空" />
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>文档语言</label>
+                                        <select name="language" class="form-control">
+                                            <option value="" selected>请选择语言</option>
+                                            <option value="zh-cn">中文</option>
+                                            <option value="en">英文</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="row" style="margin-top:10px;">
+                                    <div class="col-xs-3">
+                                        <label>文档标题</label>
+                                        <input type="text" name="title" class="form-control" placeholder="默认为{$site.name}" />
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>文档作者</label>
+                                        <input type="text" name="author" class="form-control" placeholder="默认为{$site.name}" />
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>生成模块</label>
+                                        <select name="module" class="form-control selectpicker">
+                                            <option value="" selected>请选择模块</option>
+                                            <option value="api">API</option>
+                                            <option value="backend">后台</option>
+                                            <option value="frontend">前台</option>
+                                        </select>
+                                    </div>
+                                    <div class="col-xs-3">
+                                        <label>生成插件文档</label>
+                                        <select name="addon" class="form-control selectpicker" data-live-search="true">
+                                            <option value="" selected>请选择插件</option>
+                                            {foreach name=":get_addon_list()" id="item"}
+                                            <option value="{$item.name}">{$item.title}</option>
+                                            {/foreach}
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>生成命令行</legend>
+                                <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <legend>返回结果</legend>
+                                <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
+                            </div>
+
+                            <div class="form-group">
+                                <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
+                                <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
+                            </div>
+
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script id="relationtpl" type="text/html">
+    <div class="row relation-item">
+        <div class="col-xs-2">
+            <label>请选择关联表</label>
+            <select name="relation[<%=index%>][relation]" class="form-control relationtable" data-live-search="true"></select>
+        </div>
+        <div class="col-xs-2">
+            <label>请选择关联类型</label>
+            <select name="relation[<%=index%>][relationmode]" class="form-control relationmode"></select>
+        </div>
+        <div class="col-xs-2">
+            <label>关联外键</label>
+            <select name="relation[<%=index%>][relationforeignkey]" class="form-control relationforeignkey"></select>
+        </div>
+        <div class="col-xs-2">
+            <label>关联主键</label>
+            <select name="relation[<%=index%>][relationprimarykey]" class="form-control relationprimarykey"></select>
+        </div>
+        <div class="col-xs-2">
+            <label>请选择显示字段</label>
+            <select name="relation[<%=index%>][relationfields][]" multiple class="form-control relationfields"></select>
+        </div>
+        <div class="col-xs-2">
+            <label>&nbsp;</label>
+            <a href="javascript:;" class="btn btn-danger btn-block btn-removerelation">移除</a>
+        </div>
+    </div>
+</script>

+ 42 - 0
application/admin/view/command/detail.html

@@ -0,0 +1,42 @@
+<table class="table table-striped">
+    <thead>
+    <tr>
+        <th>{:__('Title')}</th>
+        <th>{:__('Content')}</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr>
+        <td>{:__('Type')}</td>
+        <td>{$row.type}({$row.type_text})</td>
+    </tr>
+    <tr>
+        <td>{:__('Params')}</td>
+        <td>{$row.params|htmlentities}</td>
+    </tr>
+    <tr>
+        <td>{:__('Command')}</td>
+        <td>{$row.command|htmlentities}</td>
+    </tr>
+    <tr>
+        <td>{:__('Content')}</td>
+        <td>
+            <textarea class="form-control" name="" id="" cols="60" rows="10">{$row.content|htmlentities}</textarea>
+        </td>
+    </tr>
+    <tr>
+        <td>{:__('Executetime')}</td>
+        <td>{$row.executetime|datetime}</td>
+    </tr>
+    <tr>
+        <td>{:__('Status')}</td>
+        <td>{$row.status_text}</td>
+    </tr>
+    </tbody>
+</table>
+<div class="hide layer-footer">
+    <label class="control-label col-xs-12 col-sm-2"></label>
+    <div class="col-xs-12 col-sm-8">
+        <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
+    </div>
+</div>

+ 25 - 0
application/admin/view/command/index.html

@@ -0,0 +1,25 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('command/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('command/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover" 
+                           data-operate-detail="{:$auth->check('command/detail')}"
+                           data-operate-execute="{:$auth->check('command/execute')}"
+                           data-operate-del="{:$auth->check('command/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 3 - 0
application/admin/view/deliver/index.html

@@ -6,6 +6,9 @@
     .table tbody tr.selected {
         background-color: yellow !important;  /* 选中行背景色为黄色 */
     }
+    .content{
+        padding: 0px;
+    }
 </style>
 <div class="panel-heading">
     <ul id="myTab" class="nav nav-tabs">

+ 21 - 21
application/admin/view/deliver/lager.html

@@ -1,6 +1,6 @@
 <style>
     .content{
-        padding: 0px 15px 15px 15px;
+        padding: 0px 15px 0px 15px;
     }
     /* 默认背景颜色 */
     .table tbody tr.selected {
@@ -18,11 +18,11 @@
                             <a href="javascript:;" class="btn btn-success  btn-print btn-disabled disabled {:$auth->check('deliver/print')?'':'hide'}" title="导出发货" ><i class="glyphicon glyphicon-export"></i>导出发货</a>
                             <p></p>
                             <p>
-                                <span style="font-size: 18px;font-weight: bold">温馨提示,你已选中</span>
+                                <span style="font-size: 18px;font-weight: bold">温馨提示你已选中</span>
                                 <span style="font-size: 18px;font-weight: bold;color: red">0</span>
-                                <span style="font-size: 18px;font-weight: bold">个大件,公包含了</span>
+                                <span style="font-size: 18px;font-weight: bold">箱,每层共包含了</span>
                                 <span style="font-size: 18px;font-weight: bold;color: red">0</span>
-                                <span style="font-size: 18px;font-weight: bold">个小件</span>
+                                <span style="font-size: 18px;font-weight: bold"></span>
                             </p>
 <!--                            <a href="javascript:;" class="btn btn-success  btn-disabled disabled {:$auth->check('')?'':'hide'}" title="新增大件" ><i class="fa fa-pencil"></i>新增大件</a>-->
                         </div>
@@ -34,22 +34,22 @@
             </div>
         </div>
     </div>
-    <input type="hidden" value="" id="lager_id">
-    <div class="panel panel-default panel-intro">
-        <div class="panel-body">
-            <div id="myTabContent1" class="tab-content">
-                <div class="tab-pane fade active in row" id="two">
-                    <div class="widget-body no-padding">
-                        <div id="toolbar1" class="toolbar">
-                            <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        </div>
-                        <table id="small_table" class="table"
-                               width="100%">
-                        </table>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
+<!--    <input type="hidden" value="" id="lager_id">-->
+<!--    <div class="panel panel-default panel-intro">-->
+<!--        <div class="panel-body">-->
+<!--            <div id="myTabContent1" class="tab-content">-->
+<!--                <div class="tab-pane fade active in row" id="two">-->
+<!--                    <div class="widget-body no-padding">-->
+<!--                        <div id="toolbar1" class="toolbar">-->
+<!--                            <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>-->
+<!--                        </div>-->
+<!--                        <table id="small_table" class="table"-->
+<!--                               width="100%">-->
+<!--                        </table>-->
+<!--                    </div>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--    </div>-->
 </div>
 

+ 63 - 0
application/admin/view/finishedproduct/add.html

@@ -0,0 +1,63 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-content" class="form-control" name="row[content]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="30"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 63 - 0
application/admin/view/finishedproduct/edit.html

@@ -0,0 +1,63 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="{$row.oldversion|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="{$row.newversion|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="{$row.packagesize|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-content" class="form-control" name="row[content]" type="text" value="{$row.content|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="{$row.downloadurl|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="{$row.enforce|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 380 - 0
application/admin/view/finishedproduct/index.html

@@ -0,0 +1,380 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <title>待入库工单列表</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <style>
+        body {
+            font-family: "微软雅黑", sans-serif;
+            padding: 20px;
+            background: #f9f9f9;
+        }
+
+        h2 {
+            margin-bottom: 20px;
+            color: #333;
+        }
+
+        #searchInput {
+            padding: 8px;
+            width: 300px;
+            font-size: 14px;
+            margin-bottom: 20px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+        }
+        #q_btn{
+            padding: 8px;
+            font-size: 14px;
+            margin-bottom: 20px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+            background-color: #18bc9c;
+            color: #fff;
+        }
+
+        .scroll-table-wrapper {
+            max-height: 400px;
+            overflow-y: auto;
+            border: 1px solid #ddd;
+            background: white;
+        }
+
+        table {
+            width: 100%;
+            border-collapse: collapse;
+            table-layout: fixed;
+        }
+
+        th, td {
+            border: 1px solid #ddd;
+            text-align: center;
+            font-size: 14px;
+            padding: 5px;
+            word-break: break-word;
+        }
+
+        thead th {
+            background: #f0f0f0;
+            position: sticky;
+            top: 0;
+            z-index: 2;
+        }
+
+        tbody tr:hover {
+            background: #f5f5f5;
+        }
+
+        tr.selected {
+            background-color: yellow !important;
+        }
+
+        #pagination-wrapper {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            flex-wrap: wrap;
+            margin-top: 20px;
+            font-size: 14px;
+        }
+
+        #pagination-controls {
+            display: flex;
+            align-items: center;
+            flex-wrap: wrap;
+        }
+
+        #pagination-controls button {
+            padding: 6px 10px;
+            margin: 0 2px;
+            cursor: pointer;
+            border: 1px solid #ccc;
+            background: white;
+            border-radius: 4px;
+        }
+
+        #pagination-controls button.active {
+            background: #4CAF50;
+            color: white;
+            border-color: #4CAF50;
+        }
+
+        #pagination-controls button:disabled {
+            background: #eee;
+            color: #aaa;
+            cursor: not-allowed;
+        }
+
+        #pageSize {
+            margin: 0 5px;
+            padding: 4px 6px;
+        }
+
+        .ellipsis {
+            padding: 6px 10px;
+            color: #999;
+        }
+        /* 按钮基础样式(可选美化) */
+        .btn-refresh {
+            font-size: 18px;
+            color: #fff;
+            cursor: pointer;
+        }
+
+        /* 旋转动画类 */
+        .rotating {
+            animation: spin 1s linear infinite;
+        }
+
+        @keyframes spin {
+            0% { transform: rotate(0deg); }
+            100% { transform: rotate(360deg); }
+        }
+    </style>
+</head>
+<body>
+
+<h2>待入库工单列表</h2>
+<a href="javascript:;" class="btn btn-primary btn-refresh" title="刷新">
+    <i class="fas fa-sync-alt"></i> <!-- 这是刷新图标 -->
+</a>
+<input type="text" id="searchInput" placeholder="搜索产品名称..." />
+<button id="q_btn">确认入库</button>
+<div class="scroll-table-wrapper">
+    <table id="productTable">
+        <thead>
+        <tr>
+            <th style="width: 4%"><input type="checkbox" id="checkAll"></th>
+            <th style="width: 10%">产品代号</th>
+            <th style="width: 30%">产品名称</th>
+            <th style="width: 10%">数量</th>
+            <th style="width: 10%">入库状态</th>
+        </tr>
+        </thead>
+        <tbody id="tableBody">
+        <!-- JS 动态渲染数据 -->
+        </tbody>
+    </table>
+</div>
+
+<div id="pagination-wrapper">
+    <div id="pagination-info">共 0 条记录,第 1 / 1 页</div>
+    <div id="pagination-controls">
+        每页显示:
+        <select id="pageSize">
+            <option value="10">10</option>
+            <option value="20" selected>20</option>
+            <option value="50">50</option>
+        </select> 条
+    </div>
+</div>
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
+<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
+<script>
+    $(document).on('click', '.btn-refresh', function () {
+        currentPage = 1; // 可选:回到第一页
+        loadData(currentPage, searchKey); // 带着当前搜索关键字刷新
+    });
+    $(document).on('click', '.btn-refresh', function () {
+        var $icon = $(this).find('i');
+
+        // 添加旋转动画
+        $icon.addClass('rotating');
+
+        // 模拟刷新数据(这里调用你的表格刷新函数)
+        loadData(); // 真实刷新
+
+        // 假设刷新完毕后停止旋转(用 AJAX 完成后去除)
+        setTimeout(function () {
+            $icon.removeClass('rotating');
+        }, 1000); // 假设1秒刷新完成
+    });
+    let currentPage = 1;
+    let searchKey = '';
+    let pageSize = parseInt($('#pageSize').val());
+
+    function loadData(page = 1, search = '') {
+        pageSize = parseInt($('#pageSize').val());
+
+        $.ajax({
+            method: "GET",
+            url: "Finishedproduct/index",
+            data: { page: page, search: search, limit: pageSize },
+            success: function (res) {
+                const tbody = $('#tableBody');
+                tbody.empty();
+                $('#checkAll').prop('checked', false); // 每次刷新取消“全选”
+
+                if (res.data && res.data.length > 0) {
+                    res.data.forEach(row => {
+                        tbody.append(`<tr>
+                            <td><input type="checkbox" class="row-check"></td>
+                            <td>${row.jjcp_cpdh}</td>
+                            <td>${row.jjcp_cpmc}</td>
+                            <td>${row.jjcp_sl}</td>
+                            <td>${row.jjcp_smb}</td>
+                        </tr>`);
+                    });
+                } else {
+                    tbody.append('<tr><td colspan="5">暂无数据</td></tr>');
+                }
+
+                renderPaginationInfo(res.total, res.page, res.limit);
+                renderPagination(res.total, res.page, res.limit);
+            },
+            error: function () {
+                console.log("加载数据失败!");
+            }
+        });
+    }
+
+    function renderPaginationInfo(total, page, limit) {
+        const totalPages = Math.ceil(total / limit);
+        $('#pagination-info').text(`共 ${total} 条记录,第 ${page} / ${totalPages} 页`);
+    }
+
+    function renderPagination(total, current, limit) {
+        const totalPages = Math.ceil(total / limit);
+        current = parseInt(current);
+        const container = $('#pagination-controls');
+        container.find('button, .ellipsis').remove();
+
+        const addButton = (text, pageNum, isActive = false, isDisabled = false) => {
+            const btn = $('<button>')
+                .text(text)
+                .prop('disabled', isDisabled)
+                .addClass(isActive ? 'active' : '')
+                .click(() => {
+                    if (!isDisabled && pageNum !== current) {
+                        currentPage = pageNum;
+                        loadData(currentPage, searchKey);
+                    }
+                });
+            container.append(btn);
+        };
+
+        addButton('上一页', current - 1, false, current === 1);
+
+        const pages = [];
+        if (totalPages <= 5) {
+            for (let i = 1; i <= totalPages; i++) pages.push(i);
+        } else {
+            if (current <= 3) {
+                pages.push(1, 2, 3, 4, 5, '...', totalPages);
+            } else if (current >= totalPages - 2) {
+                pages.push(1, '...');
+                for (let i = totalPages - 4; i <= totalPages; i++) pages.push(i);
+            } else {
+                pages.push(1, '...', current - 1, current, current + 1, '...', totalPages);
+            }
+        }
+
+        let prev = null;
+        pages.forEach(p => {
+            if (p === '...') {
+                if (prev !== '...') {
+                    container.append('<span class="ellipsis">...</span>');
+                    prev = '...';
+                }
+            } else {
+                addButton(p, p, p === current);
+                prev = p;
+            }
+        });
+
+        addButton('下一页', current + 1, false, current === totalPages);
+    }
+
+    // 行点击切换勾选 + 高亮
+    $(document).on('click', '#productTable tbody tr', function (e) {
+        if (!$(e.target).is('input')) {
+            const checkbox = $(this).find('.row-check');
+            checkbox.prop('checked', !checkbox.prop('checked'));
+        }
+        $(this).toggleClass('selected');
+    });
+
+    // 勾选框勾选联动行背景
+    $(document).on('change', '.row-check', function () {
+        const tr = $(this).closest('tr');
+        tr.toggleClass('selected', $(this).is(':checked'));
+    });
+
+    // 全选/取消全选
+    $('#checkAll').on('change', function () {
+        const checked = $(this).is(':checked');
+        $('.row-check').prop('checked', checked);
+        $('#productTable tbody tr').each(function () {
+            $(this).toggleClass('selected', checked);
+        });
+    });
+
+    $('#searchInput').on('input', function () {
+        searchKey = $(this).val();
+        currentPage = 1;
+        loadData(currentPage, searchKey);
+    });
+
+    $('#pageSize').on('change', function () {
+        currentPage = 1;
+        loadData(currentPage, searchKey);
+    });
+
+
+    // 点击“确认入库”按钮
+    $('#q_btn').on('click', function () {
+        const selectedData = [];
+
+        $('#productTable tbody tr').each(function () {
+            const checkbox = $(this).find('.row-check');
+            if (checkbox.is(':checked')) {
+                const row = $(this).find('td');
+                selectedData.push({
+                    jjcp_cpdh: row.eq(1).text().trim(),
+                    jjcp_cpmc: row.eq(2).text().trim(),
+                    jjcp_sl: row.eq(3).text().trim(),
+                    jjcp_smb: row.eq(4).text().trim()
+                });
+            }
+        });
+
+        if (selectedData.length === 0) {
+            alert("请选择要入库的产品!");
+            return;
+        }
+
+        $.ajax({
+            method: "POST",
+            url: "Finishedproduct/finished",
+            contentType: "application/json",
+            data: JSON.stringify({ data: selectedData }),
+            success: function (res) {
+                Swal.fire({
+                    icon: 'success',
+                    title: '入库成功!',
+                    showConfirmButton: false,
+                    timer: 3000
+                });
+                loadData(); // 可选:刷新表格
+            },
+            error: function () {
+                Swal.fire({
+                    icon: 'error',
+                    title: '入库失败!',
+                    showConfirmButton: false,
+                    timer: 3000
+                });
+            }
+        });
+    });
+
+
+    $(document).ready(function () {
+        loadData();
+    });
+</script>
+
+</body>
+</html>

+ 4 - 1
application/admin/view/index/login.html

@@ -90,10 +90,13 @@
 <body>
 <div class="container">
     <div class="login-wrapper">
-        <div class="login-screen">
+        <br>
+        <br>
+        <div class="login-screen" style="margin-left: 400px">
             <div class="well">
                 <div class="login-head">
                     <img src="__CDN__/assets/img/login-head.png" style="width:100%;"/>
+<!--                    <img src="/uploads/bg.png" style="width:100%;"/>-->
                 </div>
                 <div class="login-form">
                     <img id="profile-img" class="profile-img-card" src="__CDN__/assets/img/avatar.png"/>

+ 63 - 0
application/admin/view/inventorydetails/add.html

@@ -0,0 +1,63 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-content" class="form-control" name="row[content]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="30"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 63 - 0
application/admin/view/inventorydetails/edit.html

@@ -0,0 +1,63 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="{$row.oldversion|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="{$row.newversion|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="{$row.packagesize|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-content" class="form-control" name="row[content]" type="text" value="{$row.content|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="{$row.downloadurl|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="{$row.enforce|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 330 - 0
application/admin/view/inventorydetails/index.html

@@ -0,0 +1,330 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <title>入库明细列表</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <style>
+        body {
+            font-family: "微软雅黑", sans-serif;
+            padding: 20px;
+            background: #f9f9f9;
+        }
+
+        h2 {
+            margin-bottom: 20px;
+            color: #333;
+        }
+
+        #searchInput {
+            padding: 8px;
+            width: 300px;
+            font-size: 14px;
+            margin-bottom: 20px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+        }
+        #q_btn{
+            padding: 8px;
+            font-size: 14px;
+            margin-bottom: 20px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+            background-color: #18bc9c;
+            color: #fff;
+        }
+
+        .scroll-table-wrapper {
+            max-height: 400px;
+            overflow-y: auto;
+            border: 1px solid #ddd;
+            background: white;
+        }
+
+        table {
+            width: 100%;
+            border-collapse: collapse;
+            table-layout: fixed;
+        }
+
+        th, td {
+            border: 1px solid #ddd;
+            text-align: center;
+            font-size: 14px;
+            padding: 5px;
+            word-break: break-word;
+        }
+
+        thead th {
+            background: #f0f0f0;
+            position: sticky;
+            top: 0;
+            z-index: 2;
+        }
+
+        tbody tr:hover {
+            background: #f5f5f5;
+        }
+
+        tr.selected {
+            background-color: yellow !important;
+        }
+
+        #pagination-wrapper {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            flex-wrap: wrap;
+            margin-top: 20px;
+            font-size: 14px;
+        }
+
+        #pagination-controls {
+            display: flex;
+            align-items: center;
+            flex-wrap: wrap;
+        }
+
+        #pagination-controls button {
+            padding: 6px 10px;
+            margin: 0 2px;
+            cursor: pointer;
+            border: 1px solid #ccc;
+            background: white;
+            border-radius: 4px;
+        }
+
+        #pagination-controls button.active {
+            background: #4CAF50;
+            color: white;
+            border-color: #4CAF50;
+        }
+
+        #pagination-controls button:disabled {
+            background: #eee;
+            color: #aaa;
+            cursor: not-allowed;
+        }
+
+        #pageSize {
+            margin: 0 5px;
+            padding: 4px 6px;
+        }
+
+        .ellipsis {
+            padding: 6px 10px;
+            color: #999;
+        }
+        /* 按钮基础样式(可选美化) */
+        .btn-refresh {
+            font-size: 18px;
+            color: #fff;
+            cursor: pointer;
+        }
+
+        /* 旋转动画类 */
+        .rotating {
+            animation: spin 1s linear infinite;
+        }
+
+        @keyframes spin {
+            0% { transform: rotate(0deg); }
+            100% { transform: rotate(360deg); }
+        }
+    </style>
+</head>
+<body>
+
+<h2>入库明细列表</h2>
+<a href="javascript:;" class="btn btn-primary btn-refresh" title="刷新">
+    <i class="fas fa-sync-alt"></i> <!-- 这是刷新图标 -->
+</a>
+<input type="text" id="searchInput" placeholder="搜索产品名称..." />
+<div class="scroll-table-wrapper">
+    <table id="productTable">
+        <thead>
+        <tr>
+            <th style="width: 4%"><input type="checkbox" id="checkAll"></th>
+            <th style="width: 10%">产品代号</th>
+            <th style="width: 30%">产品名称</th>
+            <th style="width: 10%">数量</th>
+            <th style="width: 10%">入库状态</th>
+        </tr>
+        </thead>
+        <tbody id="tableBody">
+        <!-- JS 动态渲染数据 -->
+        </tbody>
+    </table>
+</div>
+
+<div id="pagination-wrapper">
+    <div id="pagination-info">共 0 条记录,第 1 / 1 页</div>
+    <div id="pagination-controls">
+        每页显示:
+        <select id="pageSize">
+            <option value="10">10</option>
+            <option value="20" selected>20</option>
+            <option value="50">50</option>
+        </select> 条
+    </div>
+</div>
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
+<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
+<script>
+    $(document).on('click', '.btn-refresh', function () {
+        currentPage = 1; // 可选:回到第一页
+        loadData(currentPage, searchKey); // 带着当前搜索关键字刷新
+    });
+    $(document).on('click', '.btn-refresh', function () {
+        var $icon = $(this).find('i');
+
+        // 添加旋转动画
+        $icon.addClass('rotating');
+
+        // 模拟刷新数据(这里调用你的表格刷新函数)
+        loadData(); // 真实刷新
+
+        // 假设刷新完毕后停止旋转(用 AJAX 完成后去除)
+        setTimeout(function () {
+            $icon.removeClass('rotating');
+        }, 1000); // 假设1秒刷新完成
+    });
+    let currentPage = 1;
+    let searchKey = '';
+    let pageSize = parseInt($('#pageSize').val());
+
+    function loadData(page = 1, search = '') {
+        pageSize = parseInt($('#pageSize').val());
+
+        $.ajax({
+            method: "GET",
+            url: "Inventorydetails/index",
+            data: { page: page, search: search, limit: pageSize },
+            success: function (res) {
+                const tbody = $('#tableBody');
+                tbody.empty();
+                $('#checkAll').prop('checked', false); // 每次刷新取消“全选”
+
+                if (res.data && res.data.length > 0) {
+                    res.data.forEach(row => {
+                        tbody.append(`<tr>
+                            <td><input type="checkbox" class="row-check"></td>
+                            <td>${row.jjcp_cpdh}</td>
+                            <td>${row.jjcp_cpmc}</td>
+                            <td>${row.jjcp_sl}</td>
+                            <td>${row.jjcp_smb}</td>
+                        </tr>`);
+                    });
+                } else {
+                    tbody.append('<tr><td colspan="5">暂无数据</td></tr>');
+                }
+
+                renderPaginationInfo(res.total, res.page, res.limit);
+                renderPagination(res.total, res.page, res.limit);
+            },
+            error: function () {
+                console.log("加载数据失败!");
+            }
+        });
+    }
+
+    function renderPaginationInfo(total, page, limit) {
+        const totalPages = Math.ceil(total / limit);
+        $('#pagination-info').text(`共 ${total} 条记录,第 ${page} / ${totalPages} 页`);
+    }
+
+    function renderPagination(total, current, limit) {
+        const totalPages = Math.ceil(total / limit);
+        current = parseInt(current);
+        const container = $('#pagination-controls');
+        container.find('button, .ellipsis').remove();
+
+        const addButton = (text, pageNum, isActive = false, isDisabled = false) => {
+            const btn = $('<button>')
+                .text(text)
+                .prop('disabled', isDisabled)
+                .addClass(isActive ? 'active' : '')
+                .click(() => {
+                    if (!isDisabled && pageNum !== current) {
+                        currentPage = pageNum;
+                        loadData(currentPage, searchKey);
+                    }
+                });
+            container.append(btn);
+        };
+
+        addButton('上一页', current - 1, false, current === 1);
+
+        const pages = [];
+        if (totalPages <= 5) {
+            for (let i = 1; i <= totalPages; i++) pages.push(i);
+        } else {
+            if (current <= 3) {
+                pages.push(1, 2, 3, 4, 5, '...', totalPages);
+            } else if (current >= totalPages - 2) {
+                pages.push(1, '...');
+                for (let i = totalPages - 4; i <= totalPages; i++) pages.push(i);
+            } else {
+                pages.push(1, '...', current - 1, current, current + 1, '...', totalPages);
+            }
+        }
+
+        let prev = null;
+        pages.forEach(p => {
+            if (p === '...') {
+                if (prev !== '...') {
+                    container.append('<span class="ellipsis">...</span>');
+                    prev = '...';
+                }
+            } else {
+                addButton(p, p, p === current);
+                prev = p;
+            }
+        });
+
+        addButton('下一页', current + 1, false, current === totalPages);
+    }
+
+    // 行点击切换勾选 + 高亮
+    $(document).on('click', '#productTable tbody tr', function (e) {
+        if (!$(e.target).is('input')) {
+            const checkbox = $(this).find('.row-check');
+            checkbox.prop('checked', !checkbox.prop('checked'));
+        }
+        $(this).toggleClass('selected');
+    });
+
+    // 勾选框勾选联动行背景
+    $(document).on('change', '.row-check', function () {
+        const tr = $(this).closest('tr');
+        tr.toggleClass('selected', $(this).is(':checked'));
+    });
+
+    // 全选/取消全选
+    $('#checkAll').on('change', function () {
+        const checked = $(this).is(':checked');
+        $('.row-check').prop('checked', checked);
+        $('#productTable tbody tr').each(function () {
+            $(this).toggleClass('selected', checked);
+        });
+    });
+
+    $('#searchInput').on('input', function () {
+        searchKey = $(this).val();
+        currentPage = 1;
+        loadData(currentPage, searchKey);
+    });
+
+    $('#pageSize').on('change', function () {
+        currentPage = 1;
+        loadData(currentPage, searchKey);
+    });
+
+    $(document).ready(function () {
+        loadData();
+    });
+</script>
+
+</body>
+</html>

+ 368 - 53
application/admin/view/qcode_add/index.html

@@ -1,5 +1,35 @@
 <style>
     table tr th,table tr td {border: thin #ddd dashed;padding: 5px }
+    .select2-container {
+        width: 400px !important;
+    }
+
+    .select2-dropdown {
+        width: 400px !important;
+    }
+    .select2-results__options {
+        max-height: 200px;   /* 固定高度 */
+        overflow-y: auto;    /* 超出时出现滚动条 */
+    }
+    .select2-container--default .select2-selection--single .select2-selection__clear{
+        margin-top: -6px;
+    }
+    .select2-container--default .select2-selection--single{
+        width: 400px !important;
+        height: 35px !important;
+        line-height: 38px;
+        padding: 4px 10px;
+        font-size: 14px;
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        box-sizing: border-box;
+    }
+    .select2-container--open .select2-dropdown--below{
+        margin-top: -13px;
+    }
+    .selection{
+        top: -13px;
+    }
 </style>
 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
     <fieldset style="width: 1200px;margin:10px 10px 0px 10px ;padding: 10px 10px 0px 10px ;border:solid thin #c0c0c0">
@@ -29,15 +59,16 @@
             </div>
         </div>
     </fieldset>
+
     <fieldset style="width: 1200px;margin:10px 10px 0px 10px ;padding: 10px 10px 0px 10px ;border: solid thin #c0c0c0">
         <legend  style="padding: 0px;margin: 0px">辅料信息</legend>
         <div class="form-group">
-            <label class="control-label col-xs-2 col-sm-1">辅料名称</label>
+            <label for="c-product_name" class="control-label col-xs-2 col-sm-2">辅料名称(产品名称)</label>
             <div class="col-xs-2 col-sm-4">
-                <select class="form-control" id="c-product_name" name="product_name">
-                    <option>==================>选择<===================</option>
-                    {volist name='product' id='vo' }
-                    <option value="{$key}">{$vo}</option>
+                <select class="form-control select2" id="c-product_name" name="product_name">
+                    <option value="">==================>选择<===================</option>
+                    {volist name='product' id='vo'}
+                    <option value="{$vo.product_code}" data-cpdh="{$vo.jjcp_cpdh}">{$vo.jjcp_cpmc}</option>
                     {/volist}
                 </select>
             </div>
@@ -59,74 +90,189 @@
                 <td><span>请选择单位</span></td>
                 <td style="padding: 5px 0px 0px 5px">
                     <select id="danwei" name="danwei" style="width: 200px;padding: 5px;">
-                        <option value="1"></option>
-                        <option value="2">卷</option>
+                        <option value="1"></option>
+<!--                        <option value="2">卷</option>-->
                     </select>
                 </td>
             </tr>
             <tr class="xiang">
-                <td><span>总(张)数量(6位)</span></td>
+                <td><span>总数量(个或张)</span></td>
                 <td style="padding: 5px 0px 0px 5px"><input type="text" name="number" id="c-number" data-rule="required"></td>
             </tr>
             <tr class="xiang">
-                <td><span>一托盘多少箱(包)</span></td>
+                <td><span>一托盘多少箱(箱*层)</span></td>
                 <td style="padding: 5px 0px 0px 5px">
-                    <select name="tray_num" id="tray_num" style="width: 200px;padding: 5px;">
-                        <option value="1">========>选择<========</option>
-                        <option value="5">========>5层<========</option>
-                        <option value="24">========>24箱<========</option>
-                        <option value="28">========>28箱<========</option>
-                        <option value="32">========>32箱<========</option>
-                        <option value="40">========>40箱<========</option>
-                        <option value="42">========>42箱<========</option>
-                        <option value="48">========>48箱<========</option>
-                        <option value="60">========>60箱<========</option>
-                        <option value="64">========>64箱<========</option>
-                        <option value="72">========>72箱<========</option>
-                        <option value="80">========>80箱<========</option>
-                        <option value="96">========>96箱<========</option>
-                        <option value="105">========>105箱<========</option>
-                        <option value="108">========>108箱<========</option>
-                        <option value="144">========>144箱<========</option>
-                        <option value="180">========>180箱<========</option>
-                        <option value="240">========>240箱<========</option>
-                    </select>
+                    <input type="text" id="tray_num" placeholder="" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 箱/层 ×
+                    <input type="text" id="box_number"  placeholder="" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 层/托 =
+<!--                    <input type="text" id="boxes_per_layer" placeholder="箱数" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 箱 ×-->
+<!--                    <input type="text" id="layers_per_tray" placeholder="层数" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 层 =-->
+                    <input type="text" id="total_boxes" disabled placeholder="" style="width: 100px;" readonly> 箱/托
                 </td>
             </tr>
-            <tr class="xiang">
-                <td><span>一箱(包)多少张(直接填比例分母)</span></td>
+            <!--            <tr class="xiang">-->
+<!--                <td><span>一托盘多少箱(包)</span></td>-->
+<!--                <td style="padding: 5px 0px 0px 5px">-->
+<!--                    <select name="tray_num" id="tray_num" style="width: 200px;padding: 5px;">-->
+<!--                        <option value="1">========>选择<========</option>-->
+<!--                        <option value="5">========>5层<========</option>-->
+<!--                        <option value="24">========>24箱<========</option>-->
+<!--                        <option value="28">========>28箱<========</option>-->
+<!--                        <option value="32">========>32箱<========</option>-->
+<!--                        <option value="40">========>40箱<========</option>-->
+<!--                        <option value="42">========>42箱<========</option>-->
+<!--                        <option value="48">========>48箱<========</option>-->
+<!--                        <option value="60">========>60箱<========</option>-->
+<!--                        <option value="64">========>64箱<========</option>-->
+<!--                        <option value="72">========>72箱<========</option>-->
+<!--                        <option value="80">========>80箱<========</option>-->
+<!--                        <option value="96">========>96箱<========</option>-->
+<!--                        <option value="105">========>105箱<========</option>-->
+<!--                        <option value="108">========>108箱<========</option>-->
+<!--                        <option value="144">========>144箱<========</option>-->
+<!--                        <option value="180">========>180箱<========</option>-->
+<!--                        <option value="240">========>240箱<========</option>-->
+<!--                    </select>-->
+<!--                </td>-->
+<!--            </tr>-->
+<!--            <tr class="xiang">-->
+<!--                <td><span>一托盘多少箱(箱*层)</span></td>-->
+<!--                <td style="padding: 5px 0px 0px 5px">-->
+<!--                    <select name="box_number" id="box_numbers" style="width:200px;padding: 5px">-->
+<!--                        <option value="1">========选择=========</option>-->
+<!--                        <option value="25">========25========</option>-->
+<!--                        <option value="50">========50========</option>-->
+<!--                        <option value="250">========250张========</option>-->
+<!--                        <option value="500">========500张========</option>-->
+<!--                        <option value="1000">=======1000张========</option>-->
+<!--                        <option value="2000">=======2000张========</option>-->
+<!--                        <option value="2500">=======2500张========</option>-->
+<!--                        <option value="3000">=======3000张========</option>-->
+<!--                        <option value="4000">=======4000张========</option>-->
+<!--                        <option value="5000">=======5000张========</option>-->
+<!--                        <option value="8000">=======8000张========</option>-->
+<!--                        <option value="10000">=======10000张========</option>-->
+<!--                        <option value="24000">=======24000张========</option>-->
+<!--                    </select>-->
+<!--                </td>-->
+<!--            </tr>-->
+
+            <tr>
+                <td><span>每箱数(个或张)</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-small_num" disabled name="small_num" data-rule="required"></td>
+            </tr>
+<!--            <tr class="juan">-->
+<!--                <td><span>一托盘多少卷(3位)</span></td>-->
+<!--                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-volume_num" name="volume_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>-->
+<!--            </tr>-->
+
+
+            <tr>
+                <td><span>每层箱数</span></td>
                 <td style="padding: 5px 0px 0px 5px">
-                    <select name="box_number" id="box_number" style="width:200px;padding: 5px">
-                        <option value="1">========选择=========</option>
-                        <option value="25">========25========</option>
-                        <option value="50">========50========</option>
-                        <option value="250">========250张========</option>
-                        <option value="500">========500张========</option>
-                        <option value="1000">=======1000张========</option>
-                        <option value="2000">=======2000张========</option>
-                        <option value="2500">=======2500张========</option>
-                        <option value="3000">=======3000张========</option>
-                        <option value="4000">=======4000张========</option>
-                        <option value="5000">=======5000张========</option>
-                        <option value="8000">=======8000张========</option>
-                        <option value="10000">=======10000张========</option>
-                        <option value="24000">=======24000张========</option>
-                    </select>
+                    <input type="text" id="boxes_per_layer" name="boxes_per_layer" data-rule="required" disabled>
+                    <span style="color: red;font-size: 23px;"> *</span>
+                </td>
+            </tr>
+
+            <tr>
+                <td><span>每托层数</span></td>
+                <td style="padding: 5px 0px 0px 5px">
+                    <input type="text" id="layers_per_pallet" name="layers_per_pallet" data-rule="required" disabled>
+                    <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
 
             <tr>
-                <td><span>小件总数量(3位)</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-small_num" name="small_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>
+                <td><span>每托高度</span></td>
+                <td style="padding: 5px 0px 0px 5px; position: relative;">
+                    <input type="text" id="pallet_height" name="pallet_height" data-rule="required"
+                           style="width: 160px;" placeholder="可选择或输入" autocomplete="off">
+                    <ul id="height-suggestions" style="
+                                position: absolute;
+                                top: 33px;
+                                left: 5px;
+                                width: 160px;
+                                border: 1px solid #ccc;
+                                background: #fff;
+                                list-style: none;
+                                margin: 0;
+                                padding: 0;
+                                display: none;
+                                z-index: 1000;">
+                        <li style="padding: 5px; cursor: pointer;">0.995</li>
+                        <li style="padding: 5px; cursor: pointer;">1.05</li>
+                        <li style="padding: 5px; cursor: pointer;">1.35</li>
+                    </ul>
+                    <span style="color: red; font-size: 23px;"> *</span>
+                </td>
             </tr>
-            <tr class="juan">
-                <td><span>一托盘多少卷(3位)</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-volume_num" name="volume_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>
+
+<!--            <tr>-->
+<!--                <td><span>托盘规格(例如:0.9 * 1.2)</span></td>-->
+<!--                <td style="padding: 5px 0px 0px 5px">-->
+<!--                    <input type="text" id="pallet_length" name="pallet_length" style="width:80px;" data-rule="required">-->
+<!--                    &nbsp;-->
+<!--                    *-->
+<!--                    &nbsp;-->
+<!--                    <input type="text" id="pallet_width" name="pallet_width" style="width:80px;" data-rule="required">-->
+<!--                    <span style="color: red;font-size: 23px;"> *</span>-->
+<!--                </td>-->
+<!--            </tr>-->
+            <tr>
+                <td><span>托盘规格(例如:0.9 * 1.2)</span></td>
+                <td style="padding: 5px 0px 0px 5px; position: relative;">
+                    <div style="display: inline-block; position: relative;">
+                        <input type="text" id="pallet_length" name="pallet_length" style="width:80px;" placeholder="" autocomplete="off">
+                        <ul id="length-suggestions" style="
+                position: absolute;
+                top: 28px;
+                left: 0;
+                width: 80px;
+                border: 1px solid #ccc;
+                background: #fff;
+                list-style: none;
+                margin: 0;
+                padding: 0;
+                display: none;
+                z-index: 1000;">
+                            <li style="padding: 5px; cursor: pointer;">0.9</li>
+                            <li style="padding: 5px; cursor: pointer;">1.0</li>
+                            <li style="padding: 5px; cursor: pointer;">1.1</li>
+                        </ul>
+                    </div>
+                    &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                    *
+                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                    <div style="display: inline-block; position: relative;">
+                        <input type="text" id="pallet_width" name="pallet_width" style="width:80px;"  placeholder="" autocomplete="off">
+                        <ul id="width-suggestions" style="
+                position: absolute;
+                top: 28px;
+                left: 0;
+                width: 80px;
+                border: 1px solid #ccc;
+                background: #fff;
+                list-style: none;
+                margin: 0;
+                padding: 0;
+                display: none;
+                z-index: 1000;">
+                            <li style="padding: 5px; cursor: pointer;">1.1</li>
+                            <li style="padding: 5px; cursor: pointer;">1.2</li>
+                            <li style="padding: 5px; cursor: pointer;">1.3</li>
+                        </ul>
+                    </div>
+                    <span style="color: red;font-size: 23px;"> *</span>
+                </td>
             </tr>
+
+
             <tr>
-                <td><span>大件数量</span></td>
+                <td><span>大件(总托数)</span></td>
                 <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-box_num" name="box_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>
             </tr>
+
+
             <tr>
                 <td><span>生产日期</span></td>
                 <td style="padding: 5px 0px 0px 5px">
@@ -141,6 +287,10 @@
                     <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
+            <tr>
+                <td><span>产品代号</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-jjcp_cpdh" name="jjcp_cpdh" disabled data-rule="required"></td>
+            </tr>
             <tr>
                 <td><span>生产批次号</span></td>
                 <td>
@@ -183,3 +333,168 @@
         </div>
     </div>
 </form>
+<!-- 引入 select2 样式 -->
+<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
+
+<!-- 引入 jQuery -->
+<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
+
+<!-- 引入 select2 JS -->
+<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
+
+<script>
+    $(function() {
+        const $input = $('#pallet_height');
+        const $list = $('#height-suggestions');
+
+        // 显示下拉菜单
+        $input.on('focus click', function () {
+            $list.show();
+        });
+
+        // 点击选项
+        $list.on('click', 'li', function () {
+            $input.val($(this).text());
+            $list.hide();
+        });
+
+        // 失焦隐藏
+        $input.on('blur', function () {
+            setTimeout(() => $list.hide(), 100); // 延迟防止刚点 li 时被关闭
+        });
+    });
+
+    function allowNumberAndDot(input) {
+        input.value = input.value.replace(/[^\d.]/g, '')    // 只保留数字和小数点
+            .replace(/^\./g, '')      // 开头不能是小数点
+            .replace(/\.{2,}/g, '.')  // 不能连续两个点
+            .replace(/(\.\d*)\./g, '$1'); // 只允许一个小数点
+    }
+
+    $('#pallet_length, #pallet_width').on('input', function() {
+        allowNumberAndDot(this);
+    });
+    // 绑定 pallet_length 的下拉选择
+    $('#pallet_length').on('focus input', function () {
+        $('#length-suggestions').show();
+    });
+    $('#length-suggestions li').on('click', function () {
+        $('#pallet_length').val($(this).text());
+        $('#length-suggestions').hide();
+    });
+
+    // 绑定 pallet_width 的下拉选择
+    $('#pallet_width').on('focus input', function () {
+        $('#width-suggestions').show();
+    });
+    $('#width-suggestions li').on('click', function () {
+        $('#pallet_width').val($(this).text());
+        $('#width-suggestions').hide();
+    });
+
+    // 点击空白区域时隐藏建议框
+    $(document).on('click', function (e) {
+        if (!$(e.target).closest('#pallet_length, #length-suggestions').length) {
+            $('#length-suggestions').hide();
+        }
+        if (!$(e.target).closest('#pallet_width, #width-suggestions').length) {
+            $('#width-suggestions').hide();
+        }
+    });
+
+
+    function calculateTotalBoxes() {
+        const boxesPerLayer = parseInt(document.getElementById("tray_num").value) || 0;
+        const layersPerTray = parseInt(document.getElementById("box_number").value) || 0;
+        const totalBoxes = boxesPerLayer * layersPerTray;
+        console.log("totalBoxes".totalBoxes)
+        document.getElementById("total_boxes").value = totalBoxes;
+
+        var trayNum1 = $('#tray_num').val();
+        console.log('箱:', trayNum1);
+        $('#boxes_per_layer').val(trayNum1 ? trayNum1 : '');
+
+        var trayNum2 = $('#box_number').val();
+        console.log('层:', trayNum2);
+        $('#layers_per_pallet').val(trayNum2 ? trayNum2 : '');
+
+        var trayNum3 = $('#total_boxes').val();
+        console.log('总箱数:', trayNum3);
+        $('#c-small_num').val(trayNum3 ? trayNum3 : '');
+    }
+
+    $('#c-product_name').on('change', function () {
+        // 获取选中的产品编码和产品代号
+        var selectedOption = $(this).find('option:selected');
+        var product_code = selectedOption.val();  // 获取产品编码
+        var cpdh = selectedOption.data('cpdh');   // 获取产品代号
+
+        // 设置产品编码和产品代号到对应的输入框
+        $('#c-product_code').val(product_code);
+        $('#c-jjcp_cpdh').val(cpdh);
+
+        // 发起 AJAX 请求获取产品信息
+        $.ajax({
+            method: "GET",
+            url: 'qcode_add/product',
+            data: { product_code: product_code },
+            success: function (data) {
+                console.log(data)
+                // 根据返回的模板值判断单位显示
+                // if (data.temple === '07') {
+                    $('#danwei').val(1);
+                    $('.juan').hide();
+                    $('.xiang').show();
+                // } else {
+                //     $('#danwei').val(2);
+                //     $('.xiang').hide();
+                //     $('.juan').show();
+                // }
+
+                // 设置流水号字段,如果为空则默认设置为 1
+                $('#c-big_liushui').val(data.data.flow || 1);
+                // 设置批次号字段,如果为空则生成当前年份的默认批次号
+                if (data.data.bach === '' || data.data.bach === undefined) {
+                    var currentYear = new Date().getFullYear();
+                    var newValue = currentYear + '000000';
+                    $('#c-batch').removeAttr('disabled').val(newValue);
+                } else {
+                    $('#c-batch').val(data.data.bach);
+                    $('#c-batch').attr('disabled', true);
+                }
+            },
+            error: function () {
+                console.log("加载数据失败!");
+            }
+        });
+    });
+
+    $('#c-product_name').select2({
+        placeholder: "请选择辅料名称",
+        allowClear: true,
+        width: 'style',
+        dropdownAutoWidth: false,
+        language: {
+            noResults: function () {
+                return "未查询到结果";
+            }
+        },
+        matcher: function(params, data) {
+            if ($.trim(params.term) === '') {
+                return data;
+            }
+
+            if (typeof data.text === 'undefined') {
+                return null;
+            }
+
+            // 模糊匹配:忽略大小写
+            if (data.text.toLowerCase().indexOf(params.term.toLowerCase()) > -1) {
+                return data;
+            }
+
+            return null;
+        }
+    });
+
+</script>

+ 71 - 18
application/admin/view/qcode_bach/index.html

@@ -34,6 +34,9 @@
     .table tbody tr.selected {
         background-color: yellow !important;  /* 选中行背景色为黄色 */
     }
+    .bootstrap-table .form-commonsearch .row > .form-group{
+        display: none;
+    }
 </style>
 <div class="row">
     <div class="panel panel-default panel-intro">
@@ -70,35 +73,85 @@
             <div id="myTabContent2" class="tab-content">
                 <div class="tab-pane fade active in" id="two">
                     <div class="widget-body no-padding">
-                        <div id="toolbar2" class="toolbar">
-                            {:build_toolbar('refresh')}
-<!--                            <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('qcode_bach/add')?'':'hide'}" data-area='["800px","500px"]' title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
-                            <!--                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('qcode_bach/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
 
+                        <!-- 工具栏:独立固定在表格滚动区域外部 -->
+                        <div id="toolbar2" class="toolbar" style="margin-bottom: 10px;">
+                            {:build_toolbar('refresh')}
                             <button style="background-color: #f4f4f4;color: #f4f4f4;border-color: #ddd">
-                                <a href="javascript:;" style="color: black" id="print_l" class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_l')?'':'hide'}" title="自动打码(大件)" ><i class="fa "></i> 自动打码(大件)</a>
+                                <a href="javascript:;" style="color: black"
+                                   id="print_l"
+                                   class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_l')?'':'hide'}"
+                                   title="自动打码(大件)">
+                                    <i class="fa"></i> 自动打码(大件)</a>
                             </button>
                             <button style="background-color: #f4f4f4;color: #f4f4f4;border-color: #ddd">
-                                <a href="javascript:;" style="color: black" id="print_s" class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_s')?'':'hide'}" title="自动打码(小件)" ><i class="fa "></i> 自动打码(小件)</a>
+                                <a href="javascript:;" style="color: black"
+                                   id="print_s"
+                                   class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_s')?'':'hide'}"
+                                   title="自动打码(小件)">
+                                    <i class="fa"></i> 自动打码(小件)</a>
                             </button>
-
-<!--                            <a href="javascript:;" id="print_l" class="btn btn-default btn-disabled disabled {:$auth->check('qcode_bach/print_l')?'':'hide'}" title="自动打码(大件)" ><i class="fa "></i> 自动打码(大件)</a>-->
-<!--                            <a href="javascript:;" id="print_s" class="btn btn-default btn-disabled disabled {:$auth->check('qcode_bach/print_s')?'':'hide'}" title="自动打码(小件)" ><i class="fa "></i> 自动打码(小件)</a>-->
-                            <a href="javascript:;" id="edit" class="btn btn-success btn-disabled disabled {:$auth->check('qcode_bach/edit')?'':'hide'}" title="{:__('修改')}" ><i class="fa fa-pencil"></i> {:__('修改')}</a>
-
                         </div>
-                        <table id="table2" class="table table-striped table-bordered table-hover"data-show-toggle="false"
-                               data-show-columns="false"
-                               data-show-export="false"
-                               width="100%">
-
-                        </table>
 
+                        <!-- 表格滚动区域 -->
+                        <div class="table-container" style="max-height: 600px; overflow-y: auto;">
+                            <table id="table2" class="table table-striped table-bordered table-hover"
+                                   data-show-toggle="false"
+                                   data-show-columns="false"
+                                   data-show-export="false"
+                                   width="100%">
+                            </table>
+                        </div>
 
                     </div>
                 </div>
-
             </div>
         </div>
     </div>
+
+    <!--    <div class="panel panel-default panel-intro">-->
+<!--        <div class="panel-body">-->
+<!--            <div id="myTabContent2" class="tab-content">-->
+<!--                <div class="tab-pane fade active in" id="two">-->
+<!--                    <div class="widget-body no-padding">-->
+<!--                        <div id="toolbar2" class="toolbar">-->
+<!--                            {:build_toolbar('refresh')}-->
+<!--&lt;!&ndash;                            <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('qcode_bach/add')?'':'hide'}" data-area='["800px","500px"]' title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>&ndash;&gt;-->
+<!--                            &lt;!&ndash;                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('qcode_bach/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>&ndash;&gt;-->
+
+<!--                            <button style="background-color: #f4f4f4;color: #f4f4f4;border-color: #ddd">-->
+<!--                                <a href="javascript:;" style="color: black" id="print_l" class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_l')?'':'hide'}" title="自动打码(大件)" ><i class="fa "></i> 自动打码(大件)</a>-->
+<!--                            </button>-->
+<!--                            <button style="background-color: #f4f4f4;color: #f4f4f4;border-color: #ddd">-->
+<!--                                <a href="javascript:;" style="color: black" id="print_s" class="btn btn-defaults btn-disabled disabled {:$auth->check('qcode_bach/print_s')?'':'hide'}" title="自动打码(小件)" ><i class="fa "></i> 自动打码(小件)</a>-->
+<!--                            </button>-->
+
+<!--&lt;!&ndash;                            <a href="javascript:;" id="print_l" class="btn btn-default btn-disabled disabled {:$auth->check('qcode_bach/print_l')?'':'hide'}" title="自动打码(大件)" ><i class="fa "></i> 自动打码(大件)</a>&ndash;&gt;-->
+<!--&lt;!&ndash;                            <a href="javascript:;" id="print_s" class="btn btn-default btn-disabled disabled {:$auth->check('qcode_bach/print_s')?'':'hide'}" title="自动打码(小件)" ><i class="fa "></i> 自动打码(小件)</a>&ndash;&gt;-->
+<!--&lt;!&ndash;                            <a href="javascript:;" id="edit" class="btn btn-success btn-disabled disabled {:$auth->check('qcode_bach/edit')?'':'hide'}" title="{:__('修改')}" ><i class="fa fa-pencil"></i> {:__('修改')}</a>&ndash;&gt;-->
+
+<!--                        </div>-->
+<!--&lt;!&ndash;                        <table id="table2" class="table table-striped table-bordered table-hover"&ndash;&gt;-->
+<!--&lt;!&ndash;                               data-show-toggle="false"&ndash;&gt;-->
+<!--&lt;!&ndash;                               data-show-columns="false"&ndash;&gt;-->
+<!--&lt;!&ndash;                               data-show-export="false"&ndash;&gt;-->
+
+<!--&lt;!&ndash;                               width="100%">&ndash;&gt;-->
+
+<!--&lt;!&ndash;                        </table>&ndash;&gt;-->
+<!--                        <div class="table-container" style="max-height: 600px; overflow-y: auto;">-->
+<!--                            <table id="table2" class="table table-striped table-bordered table-hover"-->
+<!--                                   data-show-toggle="false"-->
+<!--                                   data-show-columns="false"-->
+<!--                                   data-show-export="false"-->
+<!--                                   width="100%">-->
+<!--                            </table>-->
+<!--                        </div>-->
+
+<!--                    </div>-->
+<!--                </div>-->
+
+<!--            </div>-->
+<!--        </div>-->
+<!--    </div>-->
 </div>

+ 2 - 2
application/admin/view/qcode_bach/print_l.html

@@ -2,13 +2,13 @@
     <input type="hidden" name="row[ids]" value="{$ids|htmlentities}">
     <div>
         <label class="col-xs-4 col-sm-2" style="text-align: right;">{:__('标签类型')}:</label>
-        <select class="selectpicker" style="height: 30px;" name="row[type]" id="type">
+        <select class="selectpicker" style="height: 30px;height: 200px" name="row[type]" id="type">
             <option value="v010" >v010大件盒包装(10cmx15cm)</option>
         </select>
     </div>
     <div>
         <label class="col-xs-4 col-sm-2" style="text-align: right;">{:__('打印数量')}:</label>
-        <input id="numn" style="width: 200px;margin-bottom: 2px;" name="row[numn]" type="text" value="4">
+        <input id="numn" style="width: 200px;margin-bottom: 2px;" name="row[numn]" type="text" value="1">
     </div>
     <div class="form-group layer-footer" >
         <div style="text-align: center">

+ 51 - 6
application/database.php

@@ -18,11 +18,11 @@ return [
     // 服务器地址
     'hostname'        => Env::get('database.hostname', '10.10.4.58'),
     // 数据库名
-    'database'        => Env::get('database.database', 'dm'),
+    'database'        => Env::get('database.database', 'zsfastadmin'),
     // 用户名
-    'username'        => Env::get('database.username', 'fastadmin'),
+    'username'        => Env::get('database.username', 'zsfastadmin'),
     // 密码
-    'password'        => Env::get('database.password', 'HKRcnaAfMAKikN8h'),
+    'password'        => Env::get('database.password', 'fDkGB8NYm2yKR3eD'),
     // 端口
     'hostport'        => Env::get('database.hostport', ''),
     // 连接dsn
@@ -60,10 +60,55 @@ return [
         // 服务器地址
         'hostname'        => Env::get('database.mongodb.hostname', '10.10.4.58'),
         // 数据库名
-        'database'        => Env::get('database.mongodb.database', 'dm_v3_7in6_com'),
+        'database'        => Env::get('database.mongodb.database', 'zsdm_v3_7in6_com'),
         // 用户名
-        'username'        => Env::get('database.mongodb.username', 'dm_v3_7in6_com'),
+        'username'        => Env::get('database.mongodb.username', 'zsdm_v3_7in6_com'),
         // 密码
-        'password'        => Env::get('database.mongodb.password', 'RC6Y2mhZKGKr247W'),
+        'password'        => Env::get('database.mongodb.password', 'GaMwsGWheaB3MH5r'),
     ],
+    /**
+     * 配置中间表数据库
+     **/
+    'db3'             => [
+        // 数据库类型
+        'type'            => Env::get('database.type', 'mysql'),
+        // 服务器地址
+        'hostname'        => Env::get('database.hostname', '20.0.51.77'),
+        // 数据库名
+        'database'        => Env::get('database.database', 'mesdb'),
+        // 用户名
+        'username'        => Env::get('database.username', 'mesdb'),
+        // 密码
+        'password'        => Env::get('database.password', 'nY72kLdaXtpKdLNf'),
+        // 端口
+        'hostport'        => Env::get('database.hostport', '3306'),
+        // 连接dsn
+        'dsn'             => '',
+        // 数据库连接参数
+        'params'          => [],
+        // 数据库编码默认采用 utf8mb4
+        'charset'         => Env::get('database3.charset', 'utf8mb4'),
+        // 数据库表前缀
+        'prefix'          => Env::get('database3.prefix', ''),
+        // 数据库调试模式
+        'debug'           => Env::get('database3.debug', false),
+        // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+        'deploy'          => 0,
+        // 数据库读写是否分离 主从式有效
+        'rw_separate'     => false,
+        // 读写分离后 主服务器数量
+        'master_num'      => 1,
+        // 指定从服务器序号
+        'slave_no'        => '',
+        // 是否严格检查字段是否存在
+        'fields_strict'   => true,
+        // 数据集返回类型
+        'resultset_type'  => 'array',
+        // 自动写入时间戳字段
+        'auto_timestamp'  => false,
+        // 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s
+        'datetime_format' => false,
+        // 是否需要进行SQL性能分析
+        'sql_explain'     => false,
+    ]
 ];