From 7fe48ed63cf0ce210f2422721eb6c48800502ce0 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 07 六月 2024 09:56:15 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-before into master

---
 src/components/do/b1-ins-order/equip-config.vue |  181 ++++++++++++++++++++++++++------------------
 1 files changed, 106 insertions(+), 75 deletions(-)

diff --git a/src/components/do/b1-ins-order/equip-config.vue b/src/components/do/b1-ins-order/equip-config.vue
index 2b5ed3f..019079d 100644
--- a/src/components/do/b1-ins-order/equip-config.vue
+++ b/src/components/do/b1-ins-order/equip-config.vue
@@ -14,8 +14,7 @@
     </div>
     <div class="center">
       <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="50%" tooltip-effect="dark"
-        border  highlight-current-row @row-click="rowClick" style="margin-top: 10px;"
-        @current-change="selectSample">
+        border highlight-current-row @row-click="rowClick" @current-change="selectSample">
         <!-- <el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column> -->
         <el-table-column type="index" label="搴忓彿" width="65" align="center"></el-table-column>
         <el-table-column prop="sample" label="鏍峰搧鍚嶇О" align="center" min-width="100">
@@ -55,22 +54,12 @@
             </el-select>
           </template>
         </el-table-column>
-        <el-table-column prop="joinName" label="閰嶅鏍峰搧鍚嶇О" width="140" align="center">
-          <template slot-scope="scope">
-            <el-input size="small" type="textarea" :autosize="{ minRows: 1, maxRows: 1}"
-              v-model="scope.row.joinName" :disabled="active!=1"></el-input>
-          </template>
+        <el-table-column prop="num" label="鏍峰搧鏁伴噺" align="center" width="90">
         </el-table-column>
-        <el-table-column prop="joinModel" label="閰嶅鏍峰搧鍨嬪彿" width="140" align="center">
+        <el-table-column label="鎿嶄綔" width="120">
           <template slot-scope="scope">
-            <el-input size="small" type="textarea" :autosize="{ minRows: 1, maxRows: 1}"
-              v-model="scope.row.joinModel" :disabled="active!=1"></el-input>
-          </template>
-        </el-table-column>
-        <el-table-column prop="joinNum" label="閰嶅鏍峰搧鏁伴噺" width="140" align="center">
-          <template slot-scope="scope">
-            <el-input-number size="small" v-model="scope.row.joinNum" :min="1" :max="100" :precision="0"
-              :controls="false" style="width: 80%;" :disabled="active!=1"></el-input-number>
+            <el-button @click.native.prevent="deleteRow(scope.$index, sampleList)" type="text"
+              size="small">鍒犻櫎</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -98,7 +87,7 @@
         </el-table-column>
       </el-table>
     </div>
-    <el-dialog title="閫夋嫨瀛愭牱鍝�" :visible.sync="selectStandardTree" width="400px">
+    <el-dialog title="閫夋嫨瀛愭牱鍝�" :visible.sync="selectStandardTree" width="400px" @closed="addObj.sampleNum = 1">
       <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree">
         <el-row style="margin-bottom: 10px;">
           <el-col :span="24">
@@ -132,7 +121,8 @@
         <el-button type="primary" @click="activeStandardTree">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="妫�娴嬪埌鐗规畩椤癸紝璇蜂綔鍑轰互涓嬮�夋嫨" :visible.sync="bsm1Dia" width="500px" :show-close="false" :before-close="beforeClose">
+    <el-dialog title="妫�娴嬪埌鐗规畩椤癸紝璇蜂綔鍑轰互涓嬮�夋嫨" :visible.sync="bsm1Dia" width="500px" :show-close="false"
+      :before-close="beforeClose">
       <div class="body" style="max-height: 60vh;">
         <el-row v-if="bsm1">
           <el-col class="search_thing" :span="22">
@@ -147,7 +137,8 @@
             <div class="search_label">瑕佹眰鍊硷細</div>
             <div class="search_input" v-show="bsm1Val!==null&&bsm1Val!==''">
               <el-radio-group v-model="bsm1Val" @input="upBsm1">
-                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a">{{JSON.parse(bsmRow.ask)[ai]}}</el-radio>
+                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai"
+                  :label="a">{{JSON.parse(bsmRow.ask)[ai]}}</el-radio>
               </el-radio-group>
             </div>
           </el-col>
@@ -165,23 +156,23 @@
         default: () => 0
       },
     },
-    data(){
+    data() {
       return {
-        saveLoad:false,
-        sampleList:[],
-        productList:[],
-        getProductLoad:false,
-        filters:[],
-        sampleIds:[],
+        saveLoad: false,
+        sampleList: [],
+        productList: [],
+        getProductLoad: false,
+        filters: [],
+        sampleIds: [],
         isAskOnlyRead: false,
         selectStandardTree: false,
-        search:'',
-        expandedKeys:[],
-        addObj:{
-          sampleNum:1,
+        search: '',
+        expandedKeys: [],
+        addObj: {
+          sampleNum: 1,
         },
-        selectTree:null,
-        models:[],
+        selectTree: null,
+        models: [],
         sample: {
           sampleCode: null,
           laboratory: null,
@@ -194,29 +185,65 @@
           isLeave: 0,
           unit: null
         },
-        currentMethod:null,
-        methods:[],
+        currentMethod: null,
+        methods: [],
         methodLoad: false,
-        sampleId:null,
+        sampleId: null,
         bsmRow: null,
         bsm1: false,
-        bsm1Val:null,
-        bsm1Dia:false,
-        list:[]
+        bsm1Val: null,
+        bsm1Dia: false,
+        list: [],
+        parentSample: []
       }
     },
-    methods:{
-      save(){},
-      outConfig(){
+    mounted() {
+      this.selectStandardTreeList()
+      this.selectStandardMethods()
+      this.$parent.sampleIds.forEach(a => {
+        for (var i = 0; i < this.$parent.sampleList.length; i++) {
+          if (this.$parent.sampleList[i].id == a) {
+            this.sampleList = this.$parent.sampleList[i].childSampleList
+            this.parentSample.push(this.$parent.sampleList[i])
+            break
+          }
+        }
+      })
+    },
+    methods: {
+      selectStandardTreeList() {
+        this.$axios.get(this.$api.standardTree.selectStandardTreeList).then(res => {
+          this.list = res.data
+          this.list.forEach(a => {
+            this.expandedKeys.push(a.label)
+          })
+        })
+      },
+      save() {
+        if(this.sampleList.length === 0){
+          this.$message.error('缂哄皯閰嶇疆鏃犳硶淇濆瓨')
+          return
+        }
+        this.parentSample.forEach(a=>{
+          a.childSampleList = this.sampleList
+        })
+        this.$message.success('宸蹭繚瀛�')
+      },
+      deleteRow(index, rows) {
+        this.productList = []
+        rows.splice(index, 1);
+      },
+      outConfig() {
         this.$parent.equipConfigShow = false
       },
-      addChild(){
+      addChild() {
         this.selectStandardTree = true
       },
-      selectSample(val){
+      selectSample(val) {
+        if(val === null)return
         this.sampleIds = [val.id]
       },
-      rowClick(row, column, event){
+      rowClick(row, column, event) {
         this.currentMethod = row
         let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
         if (obj && obj.code == '濮旀墭瑕佹眰') {
@@ -246,7 +273,7 @@
           return true
         }
       },
-      handleChangeModel(e){
+      handleChangeModel(e) {
         let num = this.selectTree.split('-').length;
         if (num == 4) {
           this.selectTree = this.selectTree + ' - ' + e
@@ -256,7 +283,7 @@
           this.selectTree = arr0.join('-') + '- ' + e
         }
       },
-      methodChange(val, row){
+      methodChange(val, row) {
         if (val === null || val === '') return
         this.currentMethod = row
         let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
@@ -292,7 +319,12 @@
       methodFocus() {
         this.selectsStandardMethodByFLSSM()
       },
-      selectsStandardMethodByFLSSM(){
+      selectStandardMethods() {
+        this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => {
+          this.methods = res.data
+        })
+      },
+      selectsStandardMethodByFLSSM() {
         this.methodLoad = true
         this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
           tree: this.selectTree
@@ -314,16 +346,16 @@
           } catch (e) {}
         })
       },
-      selectProduct(val){
+      selectProduct(val) {
         this.productIds = []
         val.forEach(a => {
           this.productIds.push(a.id)
         })
       },
-      upProductSelect(selection, row){
+      upProductSelect(selection, row) {
         row.state = row.state == 1 ? 0 : 1
         if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 1) {
-          if(row.section.indexOf('[') > -1){
+          if (row.section.indexOf('[') > -1) {
             this.bsmRow = this.HaveJson(row)
           }
           this.bsm1 = true
@@ -352,7 +384,7 @@
         }
         return '';
       },
-      handleAll(){
+      handleAll(e) {
         if (e.length > 0) {
           this.productList.map(m => {
             m.state = 1
@@ -364,9 +396,9 @@
             return m
           })
         }
-        this.productList.forEach(p=>{
+        this.productList.forEach(p => {
           if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 1) {
-            if(p.section.indexOf('[') > -1){
+            if (p.section.indexOf('[') > -1) {
               this.bsmRow = this.HaveJson(p)
             }
             this.bsm1 = true
@@ -429,20 +461,18 @@
         this.addObj.sample = trees[3]
         this.addObj.model = (trees[4] == undefined ? null : trees[4])
         this.selectStandardTree = false
-        this.sampleList = []
-        for (var i = 0; i < this.addObj.sampleNum; i++) {
-          this.sample.joinName = null
-          this.sample.joinModel = null
-          this.sample.joinNum = 1
-          this.sample.sample = this.addObj.sample
-          this.sample.model = this.addObj.model
-          this.sample.unit = this.addObj.unit
-          this.sample.standardMethodListId = null
-          this.sample.insProduct = []
-          this.sample.id = this.count
-          this.sampleList.push(this.HaveJson(this.sample))
-          this.count++
-        }
+        this.sample.joinName = null
+        this.sample.joinModel = null
+        this.sample.joinNum = 1
+        this.sample.sample = this.addObj.sample
+        this.sample.model = this.addObj.model
+        this.sample.unit = this.addObj.unit
+        this.sample.standardMethodListId = null
+        this.sample.insProduct = []
+        this.sample.id = this.count
+        this.sample.num = this.addObj.sampleNum
+        this.sampleList.push(this.HaveJson(this.sample))
+        this.count++
         this.$refs.sampleTable.doLayout()
       },
       searchFilter() {
@@ -452,7 +482,7 @@
         if (!value) return true;
         return data.label.indexOf(value) !== -1;
       },
-      handleNodeClick(val, node, el){
+      handleNodeClick(val, node, el) {
         this.selectTree = ''
         this.models = val.children
         this.getNodeParent(node)
@@ -476,9 +506,9 @@
       nodeClose(data, node, el) {
         $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder')
       },
-      beforeClose(done){
-        if(this.bsm1){
-          if(this.bsm1Val===null || this.bsm1Val === ''){
+      beforeClose(done) {
+        if (this.bsm1) {
+          if (this.bsm1Val === null || this.bsm1Val === '') {
             this.$message.error('鐗规畩椤圭洰蹇呴』澶勭悊')
             return
           }
@@ -492,9 +522,9 @@
         let manHours = JSON.parse(this.bsmRow.manHour);
         let prices = JSON.parse(this.bsmRow.price);
         for (var a in sections) {
-          if(val === sections[a]){
-            this.productList.forEach(p=>{
-              if(p.id === this.bsmRow.id){
+          if (val === sections[a]) {
+            this.productList.forEach(p => {
+              if (p.id === this.bsmRow.id) {
                 p.section = sections[a]
                 p.ask = asks[a]
                 p.tell = tells[a]
@@ -528,7 +558,7 @@
 
   .center {
     width: 100%;
-    height: calc(100% - 70px);
+    height: calc(100% - 60px);
   }
 
 
@@ -537,6 +567,7 @@
     border-color: #dcdfe6;
     cursor: not-allowed;
   }
+
   .node_i {
     color: orange;
     font-size: 18px;

--
Gitblit v1.9.3