From 66e5fe718384639f45881a1eec822564418f75ef Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期二, 28 五月 2024 18:01:42 +0800
Subject: [PATCH] 修改光纤配置

---
 src/components/do/b1-ins-order/fiberoptic-config.vue |  378 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 323 insertions(+), 55 deletions(-)

diff --git a/src/components/do/b1-ins-order/fiberoptic-config.vue b/src/components/do/b1-ins-order/fiberoptic-config.vue
index bcd523b..3be7c9f 100644
--- a/src/components/do/b1-ins-order/fiberoptic-config.vue
+++ b/src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -5,7 +5,7 @@
         <el-col :span="6" style="padding-left: 20px;">鍏夌氦閰嶇疆</el-col>
         <el-col :span="18" style="text-align: right;">
           <el-button size="medium" type="primary" @click="save" :loading="saveLoad">淇� 瀛�</el-button>
-          <el-button size="medium" @click="$parent.playOrder(0)">
+          <el-button size="medium" @click="outConfig">
             <span style="color: #3A7BFA;">鍙� 娑�</span>
           </el-button>
         </el-col>
@@ -15,47 +15,49 @@
       <el-row :gutter="10" style="margin-bottom: 10px;">
         <el-col :span="9">
           <div class="grid-content">
-            <h5>濂楅</h5>
+            <h5>濂楃</h5>
             <div
               style="display: flex;align-items: center;justify-content: space-between;padding: 0 12px;box-sizing: border-box;">
               <div class="search-item">
                 <label style="width: 70px;">鏍峰搧鍨嬪彿</label>
-                <span style="font-size: 14px;">GYTA53</span>
+                <span style="font-size: 14px;">{{models}}</span>
               </div>
-              <el-radio-group v-model="packageInfo.radio" size="small">
+              <el-radio-group v-model="packageInfo.radio" size="small" @change="upNum()">
                 <el-radio :label="0">鍏ㄦ</el-radio>
                 <el-radio :label="1">鎶芥</el-radio>
               </el-radio-group>
-            </div>
-            <div class="search-item" style="margin-bottom: 8px;padding: 0 12px;box-sizing: border-box;">
-              <label style="width: 70px;">鏍峰搧缂栧彿</label>
-              <el-input v-model="packageInfo.input" placeholder="璇疯緭鍏�" size="small"></el-input>
             </div>
             <div
               style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 8px;padding: 0 12px;box-sizing: border-box;">
               <div class="search-item" style="margin-right: 10px;">
                 <label>濂楃鏁扮洰</label>
-                <el-input v-model="packageInfo.input" placeholder="璇疯緭鍏�" size="small"></el-input>
+                <el-input v-model="packageInfo.num1" placeholder="璇疯緭鍏�" size="small" @change="upNum"></el-input>
               </div>
               <div class="search-item" style="margin-right: 10px;">
                 <label style="width: 70px;">鏍囧噯閲�</label>
-                <el-input v-model="packageInfo.input" placeholder="璇疯緭鍏�" size="small"></el-input>
+                <el-input v-model="packageInfo.num2" placeholder="璇疯緭鍏�" size="small" @change="upNum"></el-input>
               </div>
               <div class="search-item">
                 <label style="width: 70px;">妫�娴嬮噺</label>
-                <el-input v-model="packageInfo.input" placeholder="璇疯緭鍏�" size="small"></el-input>
+                <el-input v-model="packageInfo.num3" placeholder="璇疯緭鍏�" size="small" @change="upNum"
+                  :disabled="packageInfo.radio===0"></el-input>
               </div>
             </div>
-            <el-table ref="table0" :data="tableData" tooltip-effect="dark" style="width: 100%" height="150px"
-              size="small" @selection-change="handleSelectionChange">
-              <el-table-column type="selection" width="55">
+            <el-table ref="table0" :data="bushing" tooltip-effect="dark" style="width: 100%" height="203px" size="small"
+              @selection-change="handleSelectionChange1">
+              <el-table-column type="selection" width="45">
               </el-table-column>
               <el-table-column label="绠¤壊鏍�" show-overflow-tooltip>
-                <template slot-scope="scope">{{ scope.row.date }}</template>
+                <template slot-scope="scope">
+                  <el-select v-model="scope.row.color" size="mini">
+                    <el-option v-for="(color,i) in colors" :key="i" :label="color.lable"
+                      :value="color.value"></el-option>
+                  </el-select>
+                </template>
               </el-table-column>
-              <el-table-column prop="name" label="鏍囬噺" show-overflow-tooltip>
+              <el-table-column prop="num2" label="鏍囬噺" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="address" label="娴嬭瘯閲�" show-overflow-tooltip>
+              <el-table-column prop="num3" label="娴嬭瘯閲�" show-overflow-tooltip>
               </el-table-column>
             </el-table>
           </div>
@@ -63,7 +65,7 @@
         <el-col :span="15">
           <div class="grid-content">
             <h5>妫�娴嬮」淇℃伅</h5>
-            <el-table ref="table1" :data="tableData" tooltip-effect="dark" style="width: 100%" height="274px"
+            <el-table ref="table1" :data="tableData" tooltip-effect="dark" style="width: 100%" height="282px"
               size="small" @selection-change="handleSelectionChange">
               <el-table-column type="selection" width="55">
               </el-table-column>
@@ -91,80 +93,87 @@
       <el-row :gutter="10">
         <el-col :span="12">
           <div class="grid-content">
-            <h5>鍏夌氦甯�</h5>
-            <div class="btns">
-              <el-button size="small" type="primary">鐢熸垚鍏夌氦甯�</el-button>
-              <el-button size="small" type="primary">淇濆瓨鍏夌氦甯﹂」鐩�</el-button>
-            </div>
+            <h5>鍏夌氦甯�
+              <el-button size="mini" type="primary" class="btns" @click="addFibers"
+                :disabled="miresModel===null||miresStandard===null">鐢熸垚鍏夌氦甯�</el-button>
+              <el-button size="mini" class="btns" @click="clearFibers" :disabled="selectBushing.length === 0">娓呴櫎</el-button>
+            </h5>
             <div
-              style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 8px;padding: 0 12px;box-sizing: border-box;">
+              style="display: flex;align-items: center;justify-content: space-between;margin:4px 0 6px 0;padding: 0 12px;box-sizing: border-box;">
               <div class="search-item" style="width: 50%;margin-right: 16px;">
                 <label style="width: 80px;">绾ゅ甫绫诲瀷</label>
-                <el-select v-model="tape.value" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                <el-select v-model="miresModel" placeholder="璇烽�夋嫨" size="small" style="width: 100%;"
+                  :disabled="bushing.length===0">
+                  <el-option v-for="(item,a) in miresModels" :key="a" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
               </div>
               <div class="search-item" style="width: 50%;">
                 <label style="width: 80px;">鍙傝�冩爣鍑�</label>
-                <el-select v-model="tape.value" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                <el-select v-model="miresStandard" placeholder="璇烽�夋嫨" size="small" style="width: 100%;"
+                  :disabled="miresModel===null" @focus="selectsStandardMethodByFLSSM2()"
+                  @change="(value)=>methodChange2(value)">
+                  <el-option v-for="item in miresStandards" :key="item.id" :label="item.code" :value="item.id">
                   </el-option>
                 </el-select>
               </div>
             </div>
-            <el-table ref="table2" :data="tableData" tooltip-effect="dark" style="width: 100%" height="270px"
-              size="small" @selection-change="handleSelectionChange">
+            <el-table ref="table2" :data="fibersList" tooltip-effect="dark" style="width: 100%" height="270px"
+              size="small" @selection-change="handleSelectionChange" highlight-current-row>
               <el-table-column type="selection" width="55">
               </el-table-column>
-              <el-table-column label="鍏夌氦甯︾紪鍙�" show-overflow-tooltip>
-                <template slot-scope="scope">{{ scope.row.date }}</template>
+              <el-table-column prop="code" label="鍏夌氦甯︾紪鍙�" show-overflow-tooltip align="center">
               </el-table-column>
-              <el-table-column prop="name" label="鍏夌氦甯﹁鏍�" show-overflow-tooltip>
+              <el-table-column prop="model" label="鍏夌氦甯﹁鏍�" show-overflow-tooltip align="center">
               </el-table-column>
-              <el-table-column prop="address" label="鍙傝�冩爣鍑�" show-overflow-tooltip>
+              <el-table-column prop="standard" label="鍙傝�冩爣鍑�" show-overflow-tooltip align="center">
               </el-table-column>
-              <el-table-column prop="address" label="鍏夌氦妫�娴嬮噺" show-overflow-tooltip>
+              <el-table-column prop="num" label="鍏夌氦妫�娴嬮噺" show-overflow-tooltip align="center">
               </el-table-column>
             </el-table>
           </div>
         </el-col>
         <el-col :span="12">
           <div class="grid-content">
-            <h5>鍏夌氦</h5>
-            <div class="btns">
-              <el-button size="small" type="primary">鍏夌氦閰嶈壊</el-button>
-              <el-button size="small" type="primary">淇濆瓨鍏夌氦椤圭洰</el-button>
-            </div>
+            <h5>鍏夌氦<el-button size="mini" type="primary" class="btns" @click="addFiber"
+                :disabled="mireModel===null||mireStandard===null">鍏夌氦閰嶈壊</el-button></h5>
             <div
-              style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 8px;padding: 0 12px;box-sizing: border-box;">
+              style="display: flex;align-items: center;justify-content: space-between;margin: 4px 0 6px 0;padding: 0 12px;box-sizing: border-box;">
               <div class="search-item" style="width: 50%;margin-right: 16px;">
                 <label style="width: 80px;">鍏夌氦绫诲瀷</label>
-                <el-select v-model="tape.value" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                <el-select v-model="mireModel" placeholder="璇烽�夋嫨" size="small" style="width: 100%;"
+                  :disabled="bushing.length===0">
+                  <el-option v-for="(item,a) in mireModels" :key="a" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
               </div>
               <div class="search-item" style="width: 50%;">
                 <label style="width: 80px;">鍙傝�冩爣鍑�</label>
-                <el-select v-model="tape.value" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                <el-select v-model="mireStandard" placeholder="璇烽�夋嫨" size="small" style="width: 100%;"
+                  :disabled="mireModel===null" @focus="selectsStandardMethodByFLSSM()"
+                  @change="(value)=>methodChange(value)">
+                  <el-option v-for="item in mireStandards" :key="item.id" :label="item.code" :value="item.id">
                   </el-option>
                 </el-select>
               </div>
             </div>
-            <el-table ref="table3" :data="tableData" tooltip-effect="dark" style="width: 100%" height="270px"
+            <el-table ref="table3" :data="fiberList" tooltip-effect="dark" style="width: 100%" height="270px"
               size="small" @selection-change="handleSelectionChange">
               <el-table-column type="selection" width="55">
               </el-table-column>
-              <el-table-column label="绠″鑹叉爣" show-overflow-tooltip>
-                <template slot-scope="scope">{{ scope.row.date }}</template>
+              <el-table-column prop="bushColor" label="绠″鑹叉爣" width="90" align="center">
               </el-table-column>
-              <el-table-column prop="name" label="鍏夌氦鑹叉爣" show-overflow-tooltip>
+              <el-table-column prop="color" label="鍏夌氦鑹叉爣" width="120">
+                <template slot-scope="scope">
+                  <el-select v-model="scope.row.color" size="mini">
+                    <el-option v-for="(color,i) in colors" :key="i" :label="color.lable"
+                      :value="color.value"></el-option>
+                  </el-select>
+                </template>
               </el-table-column>
-              <el-table-column prop="address" label="鍏夌氦瑙勬牸" show-overflow-tooltip>
+              <el-table-column prop="model" label="鍏夌氦瑙勬牸" show-overflow-tooltip align="center">
               </el-table-column>
-              <el-table-column prop="address" label="鍙傝�冩爣鍑�" show-overflow-tooltip>
+              <el-table-column prop="standard" label="鍙傝�冩爣鍑�" show-overflow-tooltip align="center">
               </el-table-column>
             </el-table>
           </div>
@@ -181,18 +190,277 @@
         saveLoad: false,
         packageInfo: {
           radio: 1,
-          input: ''
+          num1: null,
+          num2: null,
+          num3: null,
+          ismiers: false
         },
         tableData: [],
         tape: {
           value: ''
         },
-        options: []
+        options: [],
+        sample: [],
+        models: '',
+        colors: [],
+        wires: [],
+        bushing: [],
+        mireModels: [],
+        mireModel: null,
+        mireStandard: [],
+        mireStandards: null,
+        miresModels: [],
+        miresModel: null,
+        miresStandard: [],
+        miresStandards: null,
+        selectBushing: [],
+        productList: [],
+        productList2: [],
+        fiberList: [],
+        fibersList: [],
+        selectFibers: []
       }
     },
+    mounted() {
+      this.$parent.sampleIds.forEach(a => {
+        for (var i = 0; i < this.$parent.sampleList.length; i++) {
+          if (this.$parent.sampleList[i].id == a) {
+            this.sample.push(this.$parent.sampleList[i])
+            this.models += (',' + this.$parent.sampleList[i].model)
+            break
+          }
+        }
+      })
+      this.models = this.models.replace(',', '')
+      this.getTypeDicts1()
+      this.getStandTreeBySampleType()
+      this.getStandTreeBySampleType2()
+    },
     methods: {
-      save() {},
-      handleSelectionChange(val) {}
+      handleSelectionChange(val) {
+        this.selectFibers = val
+      },
+      handleSelectionChange1(val) {
+        this.selectBushing = val
+      },
+      outConfig() {
+        this.$parent.configShow = false
+      },
+      getTypeDicts1() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "鑹叉爣"
+        }).then(res => {
+          this.colors = res.data
+        })
+      },
+      upNum() {
+        if (this.packageInfo.radio === 0) {
+          this.packageInfo.num3 = this.packageInfo.num2
+        }
+        if (parseInt(this.packageInfo.num2) < parseInt(this.packageInfo.num3)) {
+          this.packageInfo.num3 = this.packageInfo.num2
+        }
+        if (this.packageInfo.num1 !== null && this.packageInfo.num1 !== '' &&
+          this.packageInfo.num2 !== null && this.packageInfo.num2 !== '' &&
+          this.packageInfo.num3 != null && this.packageInfo.num3 !== '') {
+          let colors2 = []
+          if (this.packageInfo.num1 / this.colors.length > 1) {
+            let num = this.packageInfo.num1 / this.colors.length
+            if (this.packageInfo.num1 % this.colors.length > 0) num += 1
+            for (var i = 0; i < num; i++) {
+              colors2 = colors2.concat(this.colors)
+            }
+          } else {
+            colors2 = colors2.concat(this.colors)
+          }
+          this.bushing = []
+          for (var i = 0; i < this.packageInfo.num1; i++) {
+            let bushing = {
+              color: colors2[i].label,
+              num2: this.packageInfo.num2,
+              num3: this.packageInfo.num3,
+              ismiers: this.packageInfo.ismiers,
+              fibers: [],
+              fiber: []
+            }
+            this.bushing.push(bushing)
+          }
+        } else {
+          this.bushing = []
+        }
+      },
+      getStandTreeBySampleType() {
+        this.$axios.post(this.$api.standardTree.getStandTreeBySampleType, {
+          laboratory: '閫氫俊浜у搧瀹為獙瀹�',
+          sampleType: '鍏夌氦'
+        }).then(res => {
+          this.mireModels = []
+          res.data.forEach(a => {
+            this.mireModels.push({
+              label: a.model,
+              value: a.sample + ' - ' + a.model
+            })
+          })
+        })
+      },
+      getStandTreeBySampleType2() {
+        this.$axios.post(this.$api.standardTree.getStandTreeBySampleType, {
+          laboratory: '閫氫俊浜у搧瀹為獙瀹�',
+          sampleType: '鍏夌氦甯�'
+        }).then(res => {
+          this.miresModels = []
+          res.data.forEach(a => {
+            this.miresModels.push({
+              label: a.model,
+              value: a.sample + ' - ' + a.model
+            })
+          })
+        })
+      },
+      selectsStandardMethodByFLSSM() {
+        this.mireStandards = []
+        this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
+          tree: '涓ぉ绉戞妧妫�娴嬩腑蹇� - 閫氫俊浜у搧瀹為獙瀹� - 鍏夌氦 - ' + this.mireModel
+        }).then(res => {
+          this.mireStandards = res.data.standardMethodList
+        })
+      },
+      selectsStandardMethodByFLSSM2() {
+        this.miresStandards = []
+        this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
+          tree: '涓ぉ绉戞妧妫�娴嬩腑蹇� - 閫氫俊浜у搧瀹為獙瀹� - 鍏夌氦甯� - ' + this.miresModel
+        }).then(res => {
+          this.miresStandards = res.data.standardMethodList
+        })
+      },
+      methodChange(val) {
+        if (val === null || val === '') return
+        this.$axios.post(this.$api.standardTree.selectStandardProductList, {
+          model: this.mireModel.split(' - ')[1],
+          standardMethodListId: val,
+          factory: ''
+        }, {
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          res.data.forEach(a => {
+            a.state = 0
+          })
+          this.productList = res.data
+          setTimeout(() => {
+            this.productList.forEach(a => {
+              if (a.state == 1) this.toggleSelection(a)
+            })
+          }, 200)
+        })
+      },
+      methodChange2(val) {
+        if (val === null || val === '') return
+        this.$axios.post(this.$api.standardTree.selectStandardProductList, {
+          model: this.miresModel.split(' - ')[1],
+          standardMethodListId: val,
+          factory: ''
+        }, {
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          res.data.forEach(a => {
+            a.state = 0
+          })
+          this.productList2 = res.data
+          setTimeout(() => {
+            this.productList2.forEach(a => {
+              if (a.state == 1) this.toggleSelection(a)
+            })
+          }, 200)
+        })
+      },
+      addFiber() {
+        let colors2 = []
+        if (this.packageInfo.num1 / this.colors.length > 1) {
+          let num = this.packageInfo.num1 / this.colors.length
+          if (this.packageInfo.num1 % this.colors.length > 0) num += 1
+          for (var i = 0; i < num; i++) {
+            colors2 = colors2.concat(this.colors)
+          }
+        } else {
+          colors2 = colors2.concat(this.colors)
+        }
+        this.fiberList = []
+        let model = this.mireModel.split(' - ')[1]
+        let standard = this.mireStandards.find(a => a.id == this.mireStandard).code
+        if (this.packageInfo.ismiers) {
+          /* if(this.selectFibers.length === 0){
+            this.$message.error('鏈�夋嫨鍏夌氦甯�')
+            return
+          } */
+          // this.selectFibers.forEach(a => {
+          this.fibersList.forEach(a => {
+            for (var i = 0; i < parseInt(a.num); i++) {
+              let fiber = {
+                bushColor: a.color,
+                color: colors2[i].label,
+                model: model,
+                standard: standard,
+                product: this.productList
+              }
+              a.fiber.push(fiber)
+              this.fiberList.push(fiber)
+            }
+          })
+        } else {
+          // this.selectBushing.forEach(a => {
+          this.bushing.forEach(a => {
+            for (var i = 0; i < parseInt(a.num3); i++) {
+              let fiber = {
+                bushColor: a.color,
+                color: colors2[i].label,
+                model: model,
+                standard: standard,
+                product: this.productList
+              }
+              a.fiber.push(fiber)
+              this.fiberList.push(fiber)
+            }
+          })
+        }
+      },
+      addFibers() {
+        this.fibersList = []
+        let model = this.miresModel.split(' - ')[1]
+        let standard = this.miresStandards.find(a => a.id == this.miresStandard).code
+        this.packageInfo.ismiers = true
+        this.fiberList = []
+        this.bushing.forEach(a => {
+        // this.selectBushing.forEach(a => {
+          a.fiber = []
+          for (var i = 0; i < parseInt(a.num3); i++) {
+            let fibers = {
+              code: null,
+              color: a.color,
+              model: model,
+              standard: standard,
+              num: a.num3,
+              product: this.HaveJson(this.productList2),
+              fiber: []
+            }
+            a.fibers.push(fibers)
+            this.fibersList.push(fibers)
+          }
+        })
+      },
+      clearFibers(){
+        this.packageInfo.ismiers = false
+        this.fibersList = []
+        this.bushing.forEach(a=>{
+          a.fibers = []
+        })
+      },
+      save(){
+        console.log(this.bushing);
+      }
     }
   }
 </script>

--
Gitblit v1.9.3