Browse Source

检测结果管理及委托管理优化

huangsanjia 2 years ago
parent
commit
f5ddf3ad32

+ 13 - 2
application/admin/controller/Entrust.php

@@ -92,6 +92,13 @@ class Entrust extends Backend
     public function add()
     {
         if (false === $this->request->isPost()) {
+            $user_id = Session::get('admin')['id'];
+            $company_id = Db::name('admin')->where('id',$user_id)->value('company');
+            $company = Db::name('company')->where('pid',$company_id)->column('id,name');
+            if (empty($company)){
+                $company = Db::name('company')->where('id',$company_id)->column('id,name');
+            }
+            $this->assign('company',$company);
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');
@@ -104,6 +111,7 @@ class Entrust extends Backend
         $params['user_name'] = $userinfo['username'];
         $params['work_unit'] = $userinfo['company'];
         $params['work_name'] = Db::name('company')->where('id',$userinfo['company'])->value('name');
+        $params['company'] = Db::name('company')->where('id',$params['company'])->value('name');
         $is_exit = false;//默认样品编号唯一
         if ($params['is_two'] == 1){//双样
             for ($i=0;$i<2;$i++){
@@ -163,9 +171,12 @@ class Entrust extends Backend
             $this->error(__('You have no permission'));
         }
         if (false === $this->request->isPost()) {
-            $company = ['美浓','翌星','亚新','涂料','其他'];
+            $user_id = Session::get('admin')['id'];
+            $company_id = Db::name('admin')->where('id',$user_id)->value('company');
+            $pid = Db::name('company')->where('id',$company_id)->value('pid');
+            $company = Db::name('company')->where('pid',$pid)->column('id,name');
+            $this->assign('company',$company);
             $this->view->assign('row', $row);
-            $this->view->assign('company', $company);
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');

+ 33 - 2
application/admin/controller/Res.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-
+use \think\Db;
 /**
  * 检测结果管理管理
  *
@@ -32,6 +32,37 @@ class Res extends Backend
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
      * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
      */
+    //检测数据查看
+    public function data(){
+        $params = input('id');
+        if (empty($params)){
+            $this->error('参数错误');
+        }
+        $entrust_id = Db::name('res')->where('id',$params)->value('entrust_id');
+        $gather_id = Db::name('entrust')->where('id',$entrust_id)->find();
+        if (empty($gather_id['gather_id'])){
+            $this->error('此委托单还未提交检测,暂无检测数据');
+        }
+        //此处根据实际获取到的采集表的数据 gather_tab  去对应表里查数据  重新写一个gc表格页面  js加代码
+        if ($gather_id['gather_tab'] == 'gather_txt_check_gcms'){
+            $gather = Db::name('gather_txt_gcms')->where('id',$gather_id['gather_id'])->find();
+            $data = Db::name('gather_txt_check_gcms')->where('pid',$gather_id['gather_id'])->select();
+            $this->view->assign('gather', $gather);
+            $this->view->assign('data', $data);
+            $this->view->assign('id', $params);
+            return $this->view->fetch();
+        }else if ($gather_id['gather_tab'] == 'gather_txt_check_gc'){
+            $gather = Db::name('gather_txt_gc')->where('id',$gather_id['gather_id'])->find();
+            $data = Db::name('gather_txt_check_gc')->where('pid',$gather_id['gather_id'])->select();
+            $this->view->assign('gather', $gather);
+            $this->view->assign('data', $data);
+            $this->view->assign('id', $params);
+            return $this->fetch('datagc');
+        }
 
-
+    }
+    //数据报告
+    public function report(){
+        $this->error('此功能暂未开发');
+    }
 }

+ 2 - 2
application/admin/view/entrust/add.html

@@ -21,10 +21,10 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Company')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('送样单位')}:</label>
         <div class="col-xs-12 col-sm-8">
 <!--            <input id="c-company" data-rule="required" class="form-control" name="row[company]" >-->
-            {:build_select('row[company]', ['美浓'=>'美浓', '翌星'=>'翌星', '亚新'=>'亚新', '涂料'=>'涂料','其他'=>'其他'], null,['class'=>'form-control company'])}
+            {:build_select('row[company]', $company, null,['class'=>'form-control company'])}
         </div>
     </div>
     <div class="form-group">

+ 1 - 1
application/admin/view/entrust/edit.html

@@ -25,7 +25,7 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Company')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('送样单位')}:</label>
         <div class="col-xs-12 col-sm-8">
             <select class="form-control select" name="row[company]" >
                 {foreach name="company" item="vo"}

+ 117 - 0
application/admin/view/res/data.html

@@ -0,0 +1,117 @@
+<style type="text/css">
+    table.gridtable { font-family: verdana,arial,sans-serif; font-size:11px; color:#333333; border-width: 1px; border-color: #666666; border-collapse: collapse; }
+    table.gridtable th { border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #dedede;text-align: center }
+    table.gridtable td { border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #ffffff; }
+</style>
+<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-3">样品:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$gather['name']}    {$gather['bach']} ">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">数据文件:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-bach" data-rule="required" class="form-control" name="row[bach]" type="text" value="{$gather['data_txt_name']}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">采集:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['gather_time']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">数据路径:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['data_txt_path']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">ALS 样品瓶:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input  data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['ALS']}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-1">样品乘积因子:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['sample_product_factor']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">操作者:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-sample_no" data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['author']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">其他:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-no" data-rule="required" class="form-control" name="row[no]" type="text" value="{$gather['other']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">定量方法标题:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-sample_status" data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['title']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">定量时间:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['quantify_time']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">定量方法:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['quantify_method']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">上一次定量更新:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  class="form-control" name="row[remark]" type="text" value="{$gather['last_quantify_time']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">响应方式</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['response']}">
+        </div>
+    </div>
+    <input type="hidden" id="id" value="{$id}">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3"></label>
+        <table class="col-xs-12 col-sm-6 gridtable" id="check_child">
+            <thead>
+            <tr>
+                <th class="col-xs-12 col-sm-2">化合物</th>
+                <th class="col-xs-12 col-sm-1">保留时间</th>
+                <th class="col-xs-12 col-sm-1">定量离子</th>
+                <th class="col-xs-12 col-sm-1">响应值</th>
+                <th class="col-xs-12 col-sm-1">浓度</th>
+                <th class="col-xs-12 col-sm-1">单位</th>
+                <th class="col-xs-12 col-sm-1">偏差(分钟)</th>
+                <th class="col-xs-12 col-sm-1">定性离子</th>
+            </tr>
+            </thead>
+            <tbody>
+            {foreach name="data" id="vo"}
+            <tr>
+                <td>{$vo.chemical_compound}</td>
+                <td>{$vo.persist_time}</td>
+                <td>{$vo.quantitative_ion}</td>
+                <td>{$vo.response_value}</td>
+                <td>{$vo.potency}</td>
+                <td>{$vo.unit}</td>
+                <td>{$vo.deviation}</td>
+                <td>{$vo.quanlitative_ion}</td>
+            </tr>
+            {/foreach}
+            </tbody>
+        </table>
+    </div>
+
+</form>

+ 157 - 0
application/admin/view/res/datagc.html

@@ -0,0 +1,157 @@
+<style type="text/css">
+    table.gridtable { font-family: verdana,arial,sans-serif; font-size:11px; color:#333333; border-width: 1px; border-color: #666666; border-collapse: collapse; }
+    table.gridtable th { border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #dedede;text-align: center }
+    table.gridtable td { border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #ffffff; }
+</style>
+<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-3">样品:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$gather['name']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">数据文件:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-bach" data-rule="required" class="form-control" name="row[bach]" type="text" value="{$gather['data_txt_name']}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3"></label>
+        <div class="col-xs-12 col-sm-7">
+            <input data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['remak']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">操作者:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input  data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['author']}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-3">序列行:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input  data-rule="required" class="form-control" name="row[sell_bach]" type="text" value="{$gather['line']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">仪器:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['instrument']}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-3">位置:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['position']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">进样日期:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-sample_no" data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['in_date']}">
+        </div>
+
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">进样次数:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="" data-rule="required" class="form-control" name="row[sample_no]" type="text" value="{$gather['in_times']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">进样量:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-no" data-rule="required" class="form-control" name="row[no]" type="text" value="{$gather['in_type']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">采集方法:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input id="c-sample_status" data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['gather_method']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">最后修改:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['update_date_one']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">分析方法:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  data-rule="required" class="form-control" name="row[sample_status]" type="text" value="{$gather['analysis_method']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">最后修改:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input  class="form-control" name="row[remark]" type="text" value="{$gather['update_date_two']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">方法信息:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['method_info']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">排序:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['sort']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">校正数据修改时间:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['check_data_time']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">乘积因子:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['sample_product_factor']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">稀释因子:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['dilution_factor']}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3">信号 1:</label>
+        <div class="col-xs-12 col-sm-7">
+            <input class="form-control" name="row[remark]" type="text" value="{$gather['signal_one']}">
+        </div>
+    </div>
+    <input type="hidden" id="id" value="{$id}">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-3"></label>
+        <table class="col-xs-12 col-sm-6 gridtable" id="check_child">
+            <thead>
+            <tr>
+                <th class="col-xs-12 col-sm-1">保留时间(min)</th>
+                <th class="col-xs-12 col-sm-1">类型</th>
+                <th class="col-xs-12 col-sm-1">峰面积</th>
+                <th class="col-xs-12 col-sm-1">含量/峰面积</th>
+                <th class="col-xs-12 col-sm-1">含量</th>
+                <th class="col-xs-12 col-sm-1">组</th>
+                <th class="col-xs-12 col-sm-2">名称</th>
+            </tr>
+            </thead>
+            <tbody>
+            {foreach name="data" id="vo"}
+            <tr>
+                <td>{$vo.time}</td>
+                <td>{$vo.type}</td>
+                <td>{$vo.peak_area}</td>
+                <td>{$vo.val}</td>
+                <td>{$vo.potency}</td>
+                <td></td>
+                <td>{$vo.chemical_compound}</td>
+            </tr>
+            {/foreach}
+            </tbody>
+        </table>
+    </div>
+
+</form>

+ 2 - 2
public/assets/js/backend/entrust.js

@@ -32,7 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'name', title: __('Name'), operate: 'LIKE'},
                         {field: 'bach', title: __('Bach'), operate: 'LIKE'},
                         {field: 'sell_bach', title: __('Sell_bach'), operate: 'LIKE'},
-                        {field: 'company', title: __('Company')},
+                        {field: 'company', title: __('送样单位')},
                         {field: 'sample_no', title: __('Sample_no'), operate: 'LIKE'},
                         {field: 'is_two', title: __('是否双样'),operate:false,formatter: function (value,row,index) {
                                 if (value == 0){
@@ -141,7 +141,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             })
             $('.mark').change(function () {
                 var mark = parseInt($(this).val());
-                var company = $('.company').val();
+                var company = $('.company option:selected').val();
 
                 switch (mark) {
                     case 1:

+ 36 - 1
public/assets/js/backend/res.js

@@ -57,7 +57,42 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         // {field: 'userid', title: __('Userid')},
                         {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
                         // {field: 'delete_time', title: __('Delete_time'), operate: 'LIKE'},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
+                            buttons: [
+                                {
+                                    name: 'data',
+                                    text: __('检测数据'),
+                                    title: __('检测数据'),
+                                    classname: 'btn btn-xs btn-primary btn-dialog',
+                                    icon: 'fa fa-list',
+                                    extend:'data-area=["100%","100%"]',
+                                    url: 'res/data/id/{ids}',
+                                    callback: function (data) {
+
+                                    },
+                                    visible: function (row) {
+                                        //返回true时按钮显示,返回false隐藏
+                                        return true;
+                                    }
+                                },
+                                {
+                                    name: 'data',
+                                    text: __('导出数据报告'),
+                                    title: __('导出数据报告'),
+                                    classname: 'btn btn-xs btn-primary btn-dialog',
+                                    icon: 'fa fa-list',
+                                    extend:'data-area=["100%","100%"]',
+                                    url: 'res/report/id/{ids}',
+                                    callback: function (data) {
+
+                                    },
+                                    visible: function (row) {
+                                        //返回true时按钮显示,返回false隐藏
+                                        return true;
+                                    }
+                                }
+                            ],
+                            formatter: Table.api.formatter.operate}
                     ]
                 ]
             });