From 0885aa811a94cae8d7473c9b2957a447110c9b1d Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 18 四月 2025 11:17:08 +0800
Subject: [PATCH] 网分仪数采20%

---
 src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue |  220 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 157 insertions(+), 63 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
index 99d88ac..e149b1b 100644
--- a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
+++ b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
@@ -12,11 +12,9 @@
       </el-row>
     </div>
     <div class="table">
-      <el-table :data="tableList.slice(
-        (page.current - 1) * page.size,
-        page.current * page.size
-      )
-        " border tooltip-effect="dark" style="width: 74%;" height="100%" :span-method="spanMethod">
+      <el-table :data="tableList.slice((page.current - 1) * page.size, page.current * page.size)"
+        :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border tooltip-effect="dark" height="100%"
+        :span-method="spanMethod">
         <el-table-column type="index" label="搴忓彿" align="center" width="65"></el-table-column>
         <el-table-column prop="deviceName" align="center" min-width="100" label="璁惧鍚嶇О"></el-table-column>
         <el-table-column prop="fileType" align="center" label="鏂囦欢鍚庣紑"></el-table-column>
@@ -30,14 +28,25 @@
         <el-table-column prop="inspectionItemClass" align="center" label="妫�楠岄」鍒嗙被" min-width="120"></el-table-column>
         <el-table-column prop="inspectionItem" align="center" label="妫�楠岄」" min-width="100"></el-table-column>
         <el-table-column prop="inspectionItemSubclass" align="center" label="妫�楠屽瓙椤�" min-width="100"></el-table-column>
-        <el-table-column prop="referx" align="center" label="鍙傜収X" min-width="100"></el-table-column>
-        <el-table-column prop="x" align="center" label="X"></el-table-column>
-        <el-table-column prop="refery" align="center" label="鍙傜収Y" min-width="100"></el-table-column>
-        <el-table-column prop="y" align="center" label="Y"></el-table-column>
-        <el-table-column prop="anotherName" align="center" label="鍒悕" min-width="100"></el-table-column>
-        <el-table-column prop="matchingName" align="center" label="鍖归厤鍚嶇О" min-width="100"></el-table-column>
-        <el-table-column prop="formula" align="center" label="鍏紡"></el-table-column>
-        <el-table-column prop="section" fixed="right" label="鎿嶄綔" width="120">
+        <el-table-column prop="importedParts" align="center" label="閮ㄤ綅" min-width="100"
+          v-if="deviceName && deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="importedChannel" align="center" label="閫氶亾" min-width="100"
+          v-if="deviceName && deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="referx" align="center" label="鍙傜収X" min-width="100"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="x" align="center" label="X"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="refery" align="center" label="鍙傜収Y" min-width="100"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="y" align="center" label="Y"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="anotherName" align="center" label="鍒悕" min-width="100"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="matchingName" align="center" label="鍖归厤鍚嶇О" min-width="100"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column prop="formula" align="center" label="鍏紡"
+          v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')"></el-table-column>
+        <el-table-column fixed="right" label="鎿嶄綔" width="120" align="center">
           <template slot-scope="scope">
             <el-button type="text" @click="dataConfig(scope.row)">鏁伴噰閰嶇疆</el-button>
           </template>
@@ -53,7 +62,8 @@
     <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible3" width="920px" :before-close="closeForm">
       <el-form :model="configForm" label-position="top" size="small" ref="configForm" label-width="100px"
         class="demo-ruleForm">
-        <el-table :data="domains" style="width: 100%" height="300">
+        <el-table :data="domains" style="width: 100%" height="300"
+          :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
           <el-table-column label="搴忓彿" type="index" width="80">
             <template v-slot="scope">
               {{ getIndexWithAlphabet(scope.$index) }}
@@ -125,17 +135,31 @@
         </div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.ip"></el-input>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && deviceName.includes('缃戠粶鍒嗘瀽')">
+        <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>绔彛锛�
+        </div>
+        <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.port"></el-input>
+      </div>
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">
           <span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛�
         </div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.collectUrl"></el-input>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && deviceName.includes('缃戠粶鍒嗘瀽')">
+        <div class="search_label" style="width: 130px;">
+          <span style="color:red;margin-right: 4px;">*</span>缃戝垎浠噰闆嗛�氶亾锛�
+        </div>
+        <el-select v-model="configForm.channel" multiple filterable allow-create placeholder="璇烽�夋嫨">
+          <el-option v-for="(item, index) in channelList" :key="index" :label="item" :value="item">
+          </el-option>
+        </el-select>
+      </div>
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">鍌ㄥ瓨鍦板潃锛�</div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.storageUrl"></el-input>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">
           <span style="color:red;margin-right: 4px;">*</span>鏂囦欢鍚庣紑锛�
         </div>
@@ -144,15 +168,15 @@
           </el-option>
         </el-select>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">濮旀墭瀛楁锛�</div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.entrustCode"></el-input>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">鏍峰搧瀛楁锛�</div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.sampleCode"></el-input>
       </div>
-      <div class="search_thing" style="margin-bottom: 14px;">
+      <div class="search_thing" style="margin-bottom: 14px;" v-if="deviceName && !deviceName.includes('缃戠粶鍒嗘瀽')">
         <div class="search_label">鏂囦欢鍚嶇О锛�</div>
         <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.dbFileName"></el-input>
       </div>
@@ -160,6 +184,25 @@
         <el-row>
           <el-button @click="dialogVisible4 = false">鍙� 娑�</el-button>
           <el-button type="primary" @click="submitForm4" :loading="upLoad4">纭� 瀹�</el-button>
+        </el-row>
+      </span>
+    </el-dialog>
+    <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible5" width="400px">
+      <div class="search_thing" style="margin-bottom: 14px;">
+        <div class="search_label">
+          <span style="color:red;margin-right: 4px;">*</span>閮ㄤ綅锛�
+        </div>
+        <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.importedParts"></el-input>
+      </div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+        <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>閫氶亾锛�
+        </div>
+        <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.importedChannel"></el-input>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-row>
+          <el-button @click="dialogVisible5 = false">鍙� 娑�</el-button>
+          <el-button type="primary" @click="submitForm5" :loading="upLoad5">纭� 瀹�</el-button>
         </el-row>
       </span>
     </el-dialog>
@@ -180,7 +223,11 @@
     deviceId: {
       type: Number,
       default: () => []
-    }
+    },
+    deviceName: {
+      type: String,
+      default: () => ''
+    },
   },
   mounted() {
     this.init();
@@ -228,7 +275,9 @@
         entrustCode: "",
         sampleCode: "",
         dbFileName: "",
-        fiberOpticRibbon: ""
+        fiberOpticRibbon: "",
+        port: '',
+        channel: []
       },
       domains: [
         {
@@ -296,7 +345,10 @@
           ]
         }
       },
-      deleteList: []
+      deleteList: [],
+      channelList: [],
+      dialogVisible5: false,
+      upLoad5: false,
     };
   },
   // 鏂规硶闆嗗悎
@@ -396,6 +448,10 @@
           "fiberOpticRibbon",
           this.tableList[0].fiberOpticRibbon
         )
+        this.$set(this.configForm, "port", this.tableList[0].port);
+        let arr = this.tableList[0].channel ? this.tableList[0].channel.split(',') : []
+        this.$set(this.configForm, "channel", arr);
+        this.channelList = arr
       }
     },
     init() {
@@ -452,6 +508,18 @@
             "fiberOpticRibbon",
             this.tableList[0].fiberOpticRibbon
           )
+          let arr = this.tableList[0].channel ? this.tableList[0].channel.split(',') : []
+          this.$set(
+            this.configForm,
+            "channel",
+            arr
+          )
+          this.$set(
+            this.configForm,
+            "port",
+            this.tableList[0].port
+          )
+          this.channelList = arr;
         }
         // 涓�鑸殑鍚堝苟琛�
         if (
@@ -506,8 +574,18 @@
         entrustCode: this.configForm.entrustCode,
         sampleCode: this.configForm.sampleCode,
         dbFileName: this.configForm.dbFileName,
-        fiberOpticRibbon: this.configForm.fiberOpticRibbon
+        fiberOpticRibbon: this.configForm.fiberOpticRibbon,
+        port: this.configForm.port,
+        channel: this.configForm.channel
       });
+      if (this.deviceName && this.deviceName.includes('缃戠粶鍒嗘瀽')) {
+        if (!this.configForm.port) {
+          return this.$message.error("璇峰~鍐欑鍙�");
+        }
+        if (!this.configForm.channel || !this.configForm.channel.length) {
+          return this.$message.error("璇峰~鍐欑綉鍒嗕华閲囬泦閫氶亾");
+        }
+      }
       this.upLoad4 = true;
       saveDataAcquisitionConfiguration({ deviceId: this.deviceId, ...obj }).then(res => {
         if (res.code == 200) {
@@ -530,46 +608,52 @@
         structureItemParameterId: row.structureItemParameterId,
         inspectionItemClass: row.inspectionItemClass,
       };
-      this.dialogVisible3 = true;
-      queryDataAcquisitionConfiguration({
-        deviceId: this.deviceId,
-        inspectionItem: row.inspectionItem.trim(),
-        isDevice: true,
-        inspectionItemSubclass: row.inspectionItemSubclass.trim(),
-        inspectionItemClass: row.inspectionItemClass.trim(),
-        structureItemParameterId: row.structureItemParameterId
-      }).then(res => {
-        const data = res.data;
-        if (data[0]) {
-          this.domains.splice(0, 1);
-          let formula = data[0].formula
-          let isIncludes = false
-          if (formula && formula != "") {
-            for (let key in this.formulas) {
-              if (formula.includes(this.formulas[key].label)) {
-                isIncludes = true
+      if (this.deviceName && this.deviceName.includes('缃戠粶鍒嗘瀽')) {
+        this.dialogVisible5 = true;
+        this.$set(this.configForm, 'importedParts', row.importedParts ? row.importedParts : '')
+        this.$set(this.configForm, 'importedChannel', row.importedChannel ? row.importedChannel : '')
+      } else {
+        this.dialogVisible3 = true;
+        queryDataAcquisitionConfiguration({
+          deviceId: this.deviceId,
+          inspectionItem: row.inspectionItem.trim(),
+          isDevice: true,
+          inspectionItemSubclass: row.inspectionItemSubclass.trim(),
+          inspectionItemClass: row.inspectionItemClass ? row.inspectionItemClass.trim() : '',
+          structureItemParameterId: row.structureItemParameterId
+        }).then(res => {
+          const data = res.data;
+          if (data[0]) {
+            this.domains.splice(0, 1);
+            let formula = data[0].formula
+            let isIncludes = false
+            if (formula && formula != "") {
+              for (let key in this.formulas) {
+                if (formula.includes(this.formulas[key].label)) {
+                  isIncludes = true
+                }
               }
             }
-          }
-          if (!isIncludes && formula) {
-            let formulaValue = formula.slice(1, -1)
-            this.$set(this.configForm, "formula", formulaValue);
-          } else {
-            this.$set(this.configForm, "formula", data[0].formula);
-          }
-          data.forEach(i => {
-            this.domains.push({
-              referx: i.referx,
-              refery: i.refery,
-              x: i.x,
-              y: i.y,
-              anotherName: i.anotherName,
-              matchingName: i.matchingName,
-              id: i.id
+            if (!isIncludes && formula) {
+              let formulaValue = formula.slice(1, -1)
+              this.$set(this.configForm, "formula", formulaValue);
+            } else {
+              this.$set(this.configForm, "formula", data[0].formula);
+            }
+            data.forEach(i => {
+              this.domains.push({
+                referx: i.referx,
+                refery: i.refery,
+                x: i.x,
+                y: i.y,
+                anotherName: i.anotherName,
+                matchingName: i.matchingName,
+                id: i.id
+              });
             });
-          });
-        }
-      });
+          }
+        });
+      }
     },
     submitForm3() {
       this.$refs.configForm.validate(valid => {
@@ -679,6 +763,18 @@
       ];
       this.dialogVisible3 = false;
       this.$refs.configForm.resetFields();
+    },
+    submitForm5() {
+      saveDataAcquisitionConfiguration({
+        deviceId: this.deviceId,
+        isDevice: true,
+        importedParts: this.configForm.importedParts,
+        importedChannel: this.configForm.importedChannel,
+      }).then(res => {
+        this.dialogVisible5 = false;
+        this.init();
+        this.$message.success("娣诲姞鎴愬姛");
+      });
     }
   }
 };
@@ -722,9 +818,7 @@
 }
 
 .table {
-  margin-top: 10px;
   background-color: #fff;
-  width: calc(100vw - 1em);
   height: calc(100vh - 18em);
 }
 

--
Gitblit v1.9.3