From c91ea4d8cda53c0f319c9f4306ff03e7c774bca0 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 15 三月 2024 16:03:56 +0800
Subject: [PATCH] 业务管理:检验任务(update)

---
 src/components/view/b1-inspect-order-plan.vue |  138 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 102 insertions(+), 36 deletions(-)

diff --git a/src/components/view/b1-inspect-order-plan.vue b/src/components/view/b1-inspect-order-plan.vue
index 2216473..d7e56f9 100644
--- a/src/components/view/b1-inspect-order-plan.vue
+++ b/src/components/view/b1-inspect-order-plan.vue
@@ -1,6 +1,7 @@
 <style scoped>
-.ins-order-plan-main{
-  padding-top: 60px;
+ins-order-plan-main .title{
+  font-size:20px;
+  color:#3A7BFA
 }
 .ins-order-plan-main .search{
   width: 100%;
@@ -57,17 +58,20 @@
 .center .center-options .center-title {
   width:85%;
   padding-top: 20px;
-  text-align: right;
+  text-align: left;
 }
 .center .center-options .center-title span:last-child{
   color: #3A7BFA;
   font-size: 23px;
   font-weight: 400;
 }
-
+.view-self-checkbox{
+margin-left: 20px;
+}
 </style>
 <template>
   <div class="ins-order-plan-main">
+    <p style="font-size: 16px;padding:19.5px 0px">妫�楠屼换鍔�</p>
     <div class="search">
       <el-form :inline="true" :model="searchForm" class="form-inline">
         <el-form-item label="鏍峰搧鍚嶇О:">
@@ -88,12 +92,15 @@
     <div class="center">
       <div class="center-options">
         <el-row>
-          <el-col :span="20">
-            <ul class="tab">
-              <li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
-            </ul>
+          <el-col :span="21">
+            <div style="display: flex;align-items: center;">
+              <ul class="tab">
+                <li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
+              </ul>
+              <el-checkbox @change="changeCheckBox" class="view-self-checkbox" v-model="viewSelf"/><span>&nbsp;鎴戠殑浠诲姟</span>
+            </div>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="3">
             <div class="center-title">
               <span>鎬昏浠诲姟鏁伴噺:</span>
               <span v-if="$refs.insOrderPlan != undefined">{{$refs.insOrderPlan.total}}</span>
@@ -103,6 +110,16 @@
       </div>
       <ValueTable :tableRowClassName="changeRowClass" class="value-table" ref="insOrderPlan" :url="$api.insOrderPlan.selectInsOrderPlanList" :upUrl="$api.user.updateUser" :componentData="componentData" :key="upIndex" @upUser="upUser"/>
     </div>
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="claimVisible"
+      width="40%">
+      鏄惁璁ら濮旀墭缂栧彿<span style="color:#33C130">{{sampleUserForm.entrustCode}}</span>鐨勪换鍔�
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="claimVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="confirmClaim">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -115,31 +132,27 @@
   },
   data(){
     return {
+      viewSelf: false,
+      sampleUserForm:{
+        entrustCode: null,
+        insSampleId: null,
+        userId: null
+      },
+      claimVisible: false,
       searchForm:{
         sampleName: null,
         state: null
       },
-      tabList: [
-        {
-          label: '瀹為獙瀹�1',
-          value: 1
-        },
-        {
-          label: '瀹為獙瀹�2',
-          value: 2
-        },
-        {
-          label: '瀹為獙瀹�3',
-          value: 3
-        }
-      ],
+      tabList: [],
       active: 1,
       tabIndex: 0,
       componentData: {
 					entity: {
+            viewSelf: false,
             state: 1,
+            childrenLaboratory: null,
             insState: null,
-            sample: null,
+            sampleName: null,
 						orderBy: {
 							field: 'type',
 							order: 'desc'
@@ -169,7 +182,8 @@
 						id: '',
 						font: '璁ら',
 						type: 'text',
-						method: ''
+						method: 'claimFun',
+            disabFun: (row,index)=>{return row.sampleUserId!=null}
 					}],
 					tagField: {
             type:{
@@ -191,23 +205,65 @@
   created(){
     this.getTypeDicts()
     this.getInsStateDicts()
-    this.refreshTable()
+    this.getLaboratoryDicts()
+    this.$nextTick(()=>{
+      this.refreshTable()
+    })
+  },
+  watch:{
+    tabList(newVal){
+      if(newVal && newVal.length>0){
+        this.componentData.entity.childrenLaboratory = newVal[0].value
+        this.$nextTick(()=>{
+          this.refreshTable()
+        })
+      }
+    }
   },
   methods:{
     upUser(){
 
     },
-    refreshTable() {
-      this.$refs.insOrderPlan.selectList()
+    changeCheckBox(val){
+      this.componentData.entity.viewSelf = val
       this.$nextTick(()=>{
-        this.planTotal = this.$refs.insOrderPlan.total
+        this.refreshTable()
       })
     },
-    changeRowClass(obj,rowIndex){
+    claimFun(row){
+      console.log(row)
+      if(row){
+        this.sampleUserForm = {
+          entrustCode : row.entrustCode,
+          insSampleId: row.id
+        }
+        this.claimVisible = true
+      }
+
+    },
+    confirmClaim(){
+      this.$axios.post(this.$api.insOrderPlan.claimInsOrderPlan, this.sampleUserForm,{
+					headers: {
+						'Content-Type': 'application/json'
+					}
+				}).then(res=>{
+        if(res.code===200 && res.data){
+          this.$message.success("璁ら鎴愬姛")
+          this.claimVisible = false
+          this.refreshTable()
+        }
+      }).catch(error=>{
+        console.error(error)
+      })
+    },
+    refreshTable() {
+      this.$refs.insOrderPlan.selectList()
+    },
+    changeRowClass({row,rowIndex}){
       let currentTime = getYearAndMonthAndDays()
-      if(obj.row.sendTime && currentTime===obj.row.sendTime){
+      if(row.sendTime && currentTime===row.sendTime){
         return 'highlight-warning-row-border'
-      }else if(obj.row.sendTime && currentTime>obj.row.sendTime){
+      }else if(row.sendTime && currentTime>row.sendTime){
         return 'highlight-danger-row-border'
       }
       return ''
@@ -218,20 +274,20 @@
         state: null,
       }
       this.componentData.entity.insState = null
-      this.componentData.entity.sample = null
+      this.componentData.entity.sampleName = null
       this.refreshTable()
     },
     onSubmit(){
       this.componentData.entity.insState = this.searchForm.state
-      this.componentData.entity.sample = this.searchForm.sampleName
+      this.componentData.entity.sampleName = this.searchForm.sampleName
       this.$nextTick(()=>{
         this.refreshTable()
       })
     },
     handleTab(m, i) {
       this.tabIndex = i;
-      //this.componentData.entity.state = m.value
-      //this.refreshTable()
+      this.componentData.entity.childrenLaboratory = m.value
+      this.refreshTable()
     },
     getTypeDicts() {
       this.$axios.post(this.$api.enums.selectEnumByCategory, {
@@ -269,6 +325,16 @@
         this.componentData.tagField.insState.select = data
       })
     },
+    getLaboratoryDicts(){
+      this.$axios.post(this.$api.enums.selectEnumByCategory, {
+        category: "瀛愬疄楠屽"
+      }).then(res => {
+        this.tabList = res.data.map(ele=>{return {label:ele.label,value:ele.value}})
+        this.$nextTick(()=>{
+          this.componentData.entity.childrenLaboratory = this.tabList[0].value
+        })
+      })
+    }
   }
 }
 </script>

--
Gitblit v1.9.3