liuhairui 2 жил өмнө
parent
commit
3a09d9f617

+ 16 - 3
application/admin/controller/Entrust.php

@@ -100,7 +100,7 @@ class Entrust extends Backend
                 $company = Db::name('company')->where('id',$company_id)->column('id,name');
             }
             $this->assign('company',$company);
-            $judgeData = Db::name('item_judge')->whereNull('delete')->column('id,name');
+            $judgeData = Db::name('item_judge')->whereNull('delete')->order('weigh asc')->column('id,name');
             $this->view->assign('judgeData', $judgeData);
             $this->view->assign('nickname', $nickname);
             return $this->view->fetch();
@@ -461,8 +461,21 @@ class Entrust extends Backend
             $record = [];
             for ($i=0;$i<count($idList);$i++){
                 $entrust_res = Db::name('entrust')->where('id', $idList[$i])->update($entrust_update[$i]);
-                Db::name('res')->where('entrust_id',$idList[$i])->update(['delete_time'=>date('Y-m-d H:i:s',time())]);
-                $res_check = Db::name('res')->insert($params[$i]);
+//                Db::name('res')->where('entrust_id',$idList[$i])->update(['delete_time'=>date('Y-m-d H:i:s',time())]);
+//                $res_check = Db::name('res')->insert($params[$i]);
+                $entrust_id = Db::name('res')->where('entrust_id',$idList[$i])->order('id desc')->find();
+                if (empty($entrust_id)) {
+                    $res_check = Db::name('res')->insert($params[$i]);
+                } else {
+                    $data =Db::name('res')
+                        ->where('entrust_id',$idList[$i])
+                        ->where('id',$entrust_id['id'])
+                        ->update(['delete_time'=>date('Y-m-d H:i:s',time())]);
+                    if (!$data){
+                        $record[$i] = $idList[$i];
+                    }
+                    $res_check = Db::name('res')->insert($params[$i]);
+                }
                 $log_res = Db::name('entrust_log')->insert($log[$i]);
                 if (!$log_res || !$res_check) {
                     $record[$i] = $idList[$i];

+ 3 - 4
application/admin/view/entrust/add.html

@@ -49,7 +49,6 @@
         <label class="control-label col-xs-12 col-sm-2">判定标准:</label>
         <div class="col-xs-12 col-sm-8">
             {:build_select('row[standard_id]', $judgeData, null,['class'=>'form-control standard_id'])}
-
         </div>
     </div>
     <div class="form-group">
@@ -163,7 +162,7 @@
             <div class="col-xs-12 col-sm-8">
                 <div class="check">
                     <label>
-                        <input name="row[report_grant][]" type="checkbox" value="自取" />自取
+                        <input name="row[report_grant][]" type="checkbox" value="自取" checked />自取
                     </label>
                     <label>
                         <input name="row[report_grant][]" type="checkbox" value="邮寄" />邮寄
@@ -172,7 +171,7 @@
                         <input name="row[report_grant][]" type="checkbox" value="传真" />传真
                     </label>
                     <label>
-                        <input name="row[report_grant][]" type="checkbox" value="邮箱" checked />邮箱
+                        <input name="row[report_grant][]" type="checkbox" value="邮箱"  />邮箱
                     </label>
                 </div>
             </div>
@@ -184,7 +183,7 @@
             <div class="col-xs-12 col-sm-8">
                 <div class="check">
                     <label >
-                        <input name="row[sample_stand][]" type="checkbox" value="YC/T 207-2014" >YC/T 207-2014
+                        <input name="row[sample_stand][]" type="checkbox" value="YC/T 207-2014" checked >YC/T 207-2014
                     </label>
                     <label >
                         <input name="row[sample_stand][]" type="checkbox" value="YQ/T 35-2013" >YQ/T 35-2013