From a5433bd3d438817794f6506fe4954ee223b0edcf Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 13 九月 2024 16:57:29 +0800
Subject: [PATCH] 优化生成报告

---
 src/components/do/b1-report-preparation/order.vue |  174 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 127 insertions(+), 47 deletions(-)

diff --git a/src/components/do/b1-report-preparation/order.vue b/src/components/do/b1-report-preparation/order.vue
index f3c1d0f..82cc51b 100644
--- a/src/components/do/b1-report-preparation/order.vue
+++ b/src/components/do/b1-report-preparation/order.vue
@@ -31,14 +31,53 @@
         :url="$api.insOrder.selectInsOrderParameter" :componentData="componentData"
         :upIndex="upIndex"  />
     </div>
+    <el-dialog
+      title="鐢熸垚鎶ュ憡"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :append-to-body="true"
+      :modal="!dialogVisible0"
+      >
+      <span>璇烽�夋嫨濮旀墭缂栧彿涓� {{currentInfo.entrustCode}} 瑕佺敓鎴愮殑鏁版嵁</span>
+      <el-card class="box-card" style="margin-top: 16px;" v-for="(item,index) in historyList" :key="index">
+        <div slot="header" style="display: flex;justify-content: space-between;">
+          <span>{{ item.laboratory }}</span>
+          <!-- <el-checkbox v-model="item.checked"></el-checkbox> -->
+        </div>
+        <el-radio-group v-model="item.numValue" ref="radio">
+          <el-radio :label="m.value" v-for="(m,i) in item.arr" :key="i"><el-link type="primary" @click="lookDetail(item,m.value)">{{ m.label }}</el-link></el-radio>
+        </el-radio-group>
+      </el-card>
+      <span slot="footer" class="dialog-footer">
+        <el-button :loading="loading0" @click="handleNoCreate">涓嶇敓鎴�</el-button>
+        <el-button type="primary" @click="handleCreate" :loading="loading1">鐢� 鎴�</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      title="妫�楠岃鎯�"
+      :visible.sync="dialogVisible0"
+      width="100%" :fullscreen="true" :modal="false" :append-to-body="true">
+      <Inspection v-if="dialogVisible0"
+      :orderId="currentInfo.id"
+      :inspectorList="currentItem.inspectorList"
+      :sonLaboratory="currentItem.laboratory"
+      :state="2"
+      :orderStateId="currentItem.orderStateId"
+      :version="currentItem.version"
+      :isLook="true"
+      :num1="currentItem.num1"
+      :noBack="true"/>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import ValueTable from '../../tool/value-table.vue'
+import Inspection from '../b1-inspect-order-plan/Inspection.vue'
 export default {
   components: {
 			ValueTable,
+      Inspection,
 		},
   data() {
     return {
@@ -124,7 +163,14 @@
         needSort: ['createTime', 'sendTime', 'type', 'appointed']
       },
       upIndex: 0,
-      entityCopy: {}
+      entityCopy: {},
+      dialogVisible:false,
+      historyList:[],
+      currentInfo:{},
+      currentItem:{},
+      loading0:false,
+      loading1:false,
+      dialogVisible0:false
     }
   },
   mounted() {
@@ -154,55 +200,85 @@
       this.refreshTable()
     },
     handleCreateReport(row){
-      this.$confirm(`鏄惁鐢熸垚姝ゅ鎵樺崟 ${row.entrustCode} 鐨勬�绘姤鍛�?`, "鎻愮ず", {
-            confirmButtonText: "鐢熸垚",
-            cancelButtonText: "涓嶇敓鎴�",
-            type: "success",
-            distinguishCancelAndClose: true,
-            beforeClose: (action, instance, done) => {
-            if (action === 'confirm') {
-              instance.confirmButtonLoading = true;
-              this.$axios.post(this.$api.insReport.isReport, {
-                id:row.id,
-                state:1
-              }).then(res => {
-                instance.confirmButtonLoading = false;
-                if (res.code === 201) {
-                  return
-                }
-                this.$message.success("宸茬敓鎴�")
-                this.refreshTable()
-                done();
-              }).catch(err => {
-                console.log(err)
-                instance.confirmButtonLoading = false;
+      this.currentInfo = row
+      this.$axios.get(this.$api.insReport.getInsOrderStateCount+'?id='+row.id).then(res => {
+        this.historyList = res.data
+        this.historyList.forEach(item => {
+          item.arr = []
+          this.$set(item,'numValue',1)
+          // item.checked = false;
+          if(item.num>0){
+            for(var i=0;i<item.num;i++){
+              item.arr.push({
+                label:'璁板綍'+(i+1),
+                value:i+1
               })
-            } else if(action === 'cancel'){
-              instance.cancelButtonLoading = true;
-              this.$axios.post(this.$api.insReport.isReport, {
-                id:row.id,
-                state:0
-              }).then(res => {
-                instance.cancelButtonLoading = false;
-                if (res.code === 201) {
-                  return
-                }
-                this.refreshTable()
-                done();
-                this.$message.success("宸插彇娑堢敓鎴�")
-              }).catch(err => {
-                instance.cancelButtonLoading = false;
-                console.log(err)
-              })
-            }else{
-              done();
             }
           }
-          }).then(() => {
-
-          }).catch((e) => {
-            console.log(e)
-          })
+        })
+        this.dialogVisible = true
+      })
+    },
+    // 鐢熸垚鎶ュ憡
+    handleCreate(){
+      this.loading1 = true
+      this.$axios.post(this.$api.insReport.isReport, {
+        id:this.currentInfo.id,
+        state:1,
+        insReportDto1s:this.historyList.map(item => {
+          return{
+            laboratory:item.laboratory,
+            num:item.numValue
+          }
+        })
+      },{
+        headers: {
+          'Content-Type': 'application/json'
+        }}).then(res => {
+        this.loading1 = false
+        if (res.code === 201) {
+          return
+        }
+        this.$message.success("宸茬敓鎴�")
+        this.refreshTable()
+        this.dialogVisible = false
+      }).catch(err => {
+        console.log(err)
+      })
+    },
+    // 涓嶇敓鎴�
+    handleNoCreate(){
+      this.loading0 = true
+      this.$axios.post(this.$api.insReport.isReport, {
+            id:this.currentInfo.id,
+            state:0
+      },{
+        headers: {
+          'Content-Type': 'application/json'
+        }}).then(res => {
+          this.loading0 = false;
+        if (res.code === 201) {
+          return
+        }
+        this.refreshTable()
+        this.$message.success("宸插彇娑堢敓鎴�")
+        this.dialogVisible = false
+      }).catch(err => {
+        console.log(err)
+      })
+    },
+    // 鏌ョ湅妫�楠岃鎯�
+    lookDetail(row,value){
+      this.dialogVisible0 = true
+      let inspectorList = []
+      if(row.userName){
+        inspectorList = row.userName.split(',')
+      }
+      this.currentItem = {
+        num1:value,
+        inspectorList:inspectorList,
+        ...row
+      }
     }
   }
 }
@@ -240,4 +316,8 @@
 		height: 100%;
 		padding: 20px;
 	}
+  >>>.el-card__header,>>>.el-card__body{
+    padding-top: 10px;
+    padding-bottom: 10px;
+  }
 </style>

--
Gitblit v1.9.3