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/api/cnas/resourceDemand/device.js | 9 + src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue | 142 ++++++++++++----- src/views/business/inspectionTask/inspection.vue | 12 + src/views/business/inspectionTask/components/NetworkAnalyzerDataAcquisition.vue | 285 +++++++++++++++++++++++++++++++++++ 4 files changed, 399 insertions(+), 49 deletions(-) diff --git a/src/api/cnas/resourceDemand/device.js b/src/api/cnas/resourceDemand/device.js index 400a1ec..5138812 100644 --- a/src/api/cnas/resourceDemand/device.js +++ b/src/api/cnas/resourceDemand/device.js @@ -1243,3 +1243,12 @@ params: query, }); } + +//閫氳繃璁惧鍚嶇О锛岃澶囩紪鍙锋煡璇㈡暟閲囬厤缃� +export function queryDataAcquisitionConfigurationTwo(query) { + return request({ + url: "/deviceScope/queryDataAcquisitionConfigurationTwo", + method: "get", + params: query, + }); +} diff --git a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue index 5c1b33e..e149b1b 100644 --- a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue +++ b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue @@ -28,13 +28,24 @@ <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="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> @@ -127,7 +138,7 @@ <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> + <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"> @@ -173,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> @@ -316,7 +346,9 @@ } }, deleteList: [], - channelList: [] + channelList: [], + dialogVisible5: false, + upLoad5: false, }; }, // 鏂规硶闆嗗悎 @@ -576,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 ? 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 => { @@ -725,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("娣诲姞鎴愬姛"); + }); } } }; diff --git a/src/views/business/inspectionTask/components/NetworkAnalyzerDataAcquisition.vue b/src/views/business/inspectionTask/components/NetworkAnalyzerDataAcquisition.vue new file mode 100644 index 0000000..c1b881f --- /dev/null +++ b/src/views/business/inspectionTask/components/NetworkAnalyzerDataAcquisition.vue @@ -0,0 +1,285 @@ +<template> + <div class="btns"> + <el-button type="primary" size="small" @click="getMetadata()">杩涘彛缃戝垎浠暟閲�</el-button> + <el-button type="primary" size="small">鍥戒骇缃戝垎浠暟閲�</el-button> + </div> +</template> + +<script> +import { + queryDataAcquisitionConfigurationTwo, +} from '@/api/cnas/resourceDemand/device.js' +export default { + props: ['itemList', 'param', 'equipOptions'], + data() { + return { + itemConfig: [], + itemListNew: [] + } + }, + mounted() { + // console.log(this.param, this.itemList) + + }, + methods: { + async getMetadata() { + console.log(this.param, this.itemList) + this.itemListNew = this.HaveJson(this.itemList) + + let equip = null; + for (let n in this.param) { + let obj = this.equipOptions.find(m => m.value == this.param[n].equipValue[0].v.v) + if (obj && obj.label && obj.label.indexOf('缃戠粶鍒嗘瀽浠�') > -1) { + equip = obj + } + } + if (equip) { + await this.getItemConfig(equip) + this.itemListNew.forEach(item => { + if (item.inspectionItemType == 1) { + let obj = this.itemConfig.find(m => m.inspectionItem == item.inspectionItem) + if (obj) { + item.aisle = obj.importedChannel + item.position = obj.importedParts + } + } + }) + this.gatherNetworkAnalyzerSampleItem() + } + }, + async getItemConfig(param) { + let res = await queryDataAcquisitionConfigurationTwo({ ...param }) + if (res.code == 200) { + this.itemConfig = res.data + } + }, + // 杩涘彛缃戝垎浠� + gatherNetworkAnalyzerSampleItem() { + // 浼犲弬鏁� + // 鐢熸垚璇锋眰淇℃伅 + const preStr = + '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><CalValue xmlns="zhrf_CollectData"><dataGridView>' + const ednStr = '</dataGridView></CalValue></soap:Body></soap:Envelope>' + let requireData = '' + const electricItem = this.itemListNew.find(m => m.inspectionItem == '鐢靛锛堟祴璇曞�硷級') + if (electricItem) { + electricItem.itemValue = this.param[electricItem.id].resValue.v.v + } + const dataArr = [] + let dataItem + let flag = true + let flagMsg = '' + const temperatureItem = this.itemListNew.find(m => m.inspectionItem == '娓╁害') + if (temperatureItem) { + temperatureItem.itemValue = this.param[temperatureItem.id].resValue.v.v + } + const temperature = temperatureItem ? temperatureItem.itemValue : null + + const cdItem = this.itemListNew.find(m => m.inspectionItem == '鐢电紗闀垮害') + if (cdItem) { + cdItem.itemValue = this.param[cdItem.id].resValue.v.v + } + + const cdItems = this.itemListNew.find(m => m.inspectionItem == '閫佹闀垮害杞崲绯绘暟') + if (cdItems) { + cdItems.itemValue = this.param[cdItems.id].resValue.v.v + } + const res = + (cdItem ? cdItem.itemValue : 0) * (cdItems ? cdItems.itemValue : 0) + const num = this.roundFun(res, 6) + const cd = cdItem && cdItems ? num : null + console.log('cd', cd) + if (cd && cd != null) { + if (temperature && temperature != null) { + if ( + electricItem && + electricItem != null && + electricItem.itemValue != null + ) { + let phaseDifferenceFlag = true + this.itemListNew.forEach(item => { + if (item.inspectionItem.indexOf('琛板噺') > -1 && item.inspectionItemType == 1) { + dataItem = { + Column1: item.inspectionItem, + TD: item.aisle == null ? '0' : item.aisle, + BW: item.position == null ? '0' : item.position, + temperture: temperature, + cd: cd + } + dataArr.push(dataItem) + // 鍒ゆ柇鏄惁鏈夐儴浣嶃�侀�氶亾 + if (item.aisle == null || item.aisle == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閫氶亾鍊间负绌猴紱' + } + if (item.position == null || item.position == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閮ㄤ綅鍊间负绌猴紱' + } + } else if (item.inspectionItem.indexOf('椹绘尝姣�') > -1 && item.inspectionItemType == 1 + ) { + dataItem = { + Column1: item.inspectionItem, + TD: item.aisle == null ? '0' : item.aisle, + BW: item.position == null ? '0' : item.position + } + dataArr.push(dataItem) + // 鍒ゆ柇鏄惁鏈夐儴浣嶃�侀�氶亾 + if (item.aisle == null || item.aisle == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閫氶亾鍊间负绌猴紱' + } + if (item.position == null || item.position == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閮ㄤ綅鍊间负绌猴紱' + } + } else if (item.inspectionItem.indexOf('鐩镐綅宸�') > -1 && item.inspectionItemType == 1 + ) { + dataItem = { + Column1: item.inspectionItem, + Column2: item.itemReference,// TODO: 鐩镐綅宸�-鍛ㄦ湡鏁� + TD: item.aisle == null ? '0' : item.aisle, + BW: item.position == null ? '0' : item.position + } + dataArr.push(dataItem) + // 鍒ゆ柇鏄惁鏈夐儴浣嶃�侀�氶亾 + if (item.aisle == null || item.aisle == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閫氶亾鍊间负绌猴紱' + } + if (item.position == null || item.position == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閮ㄤ綅鍊间负绌猴紱' + } + if ( + item.itemReference == null || + item.itemReference.indexOf('鏁�') < 0 + ) { + phaseDifferenceFlag = false + } + } else if (item.inspectionItem.indexOf('鐗规�ч樆鎶�') > -1 && item.inspectionItemType == 1 + ) { + dataItem = { + Column1: item.inspectionItem, + TD: item.aisle == null ? '0' : item.aisle, + BW: item.position == null ? '0' : item.position, + DR: electricItem ? electricItem.itemValue : '0' + } + dataArr.push(dataItem) + // 鍒ゆ柇鏄惁鏈夐儴浣嶃�侀�氶亾 + if (item.aisle == null || item.aisle == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閫氶亾鍊间负绌猴紱' + } + if (item.position == null || item.position == '') { + flag = false + flagMsg = flagMsg + item.inspectionItem + ',閮ㄤ綅鍊间负绌猴紱' + } + } + }) + if (phaseDifferenceFlag) { + const _that = this + if (dataArr.length > 0) { + // 鍒ゆ柇鐩镐綅宸�佺壒鎬ч樆鎶楃殑椤哄簭浣嶇疆锛岀浉浣嶅樊鍦ㄥ墠銆佸钩鍧囩壒鎬ч樆鎶楀湪鍚� + const index0 = dataArr.findIndex((item) => { + return item.Column1.indexOf('鐩镐綅宸�') >= 0 + }) + const index1 = dataArr.findIndex((item) => { + return item.Column1.indexOf('鐗规�ч樆鎶�') >= 0 + }) + if (index0 >= 0) { + if (index1 >= 0) { + if (index0 < index1) { + if (flag) { + const dataArrStr = JSON.stringify(dataArr) + requireData = preStr + dataArrStr + ednStr + this.gatherLoadingShow = true + $.ajax({ + type: 'post', + url: + 'http://127.0.0.1:8089/zhrf_CollectData.asmx?op=CalValue', + headers: { + 'Content-Type': 'text/xml;charset=utf-8' + }, + data: requireData, + success: function (response) { + console.log('response', response) + const resJson = response + // TODO + if (resJson.message) { + const resData = resJson.data + if (resData.length > 0) { + resData.forEach((resDataEle) => { + const paramItem = _that.dataList[ + '閲囬泦椤�' + ].find((ele) => { + return ele.itemName == resDataEle.Column1 + }) + if (paramItem) { + paramItem.acqItemValue = + resDataEle.Column3 + paramItem.calItemValue = + resDataEle.Column4 + paramItem.itemValue = resDataEle.Column5 + } + }) + } + } else { + console.log('鑾峰彇缃戝垎浠暟鎹け璐�') + } + _that.gatherLoadingShow = false + }, + error: function ( + XMLHttpRequest, + textStatus, + errorThrown + ) { + console.log('鑾峰彇缃戝垎浠帴鍙e紓甯�') + _that.gatherLoadingShow = false + } + }) + } else { + this.$message.error(flagMsg) + } + } else { + this.$message.error('鐩镐綅宸渶骞冲潎鐗规�ч樆鎶椾箣鍓�') + } + } else { + this.$message.error('鏃犲钩鍧囩壒鎬ч樆鎶�') + } + } else { + this.$message.error('鏃犵浉浣嶅樊') + } + } else { + this.$message.error('鏃犳娴嬮」鐩渶杩涜閲囬泦') + } + } else { + this.$message.error('鐩镐綅宸姹傝寖鍥存牸寮忛敊璇�') + } + } else { + this.$message.error('鐢靛鏍囧噯涓嶈兘涓虹┖') + } + } else { + this.$message.error('娓╁害涓嶈兘涓虹┖') + } + } else { + this.$message.error('鐢电紗闀垮害鍜岄�佹闀垮害杞崲绯绘暟涓嶈兘涓虹┖') + } + }, + roundFun(value, n) { + if (value === null) { + return null + } + return Math.round(value * Math.pow(10, n)) / Math.pow(10, n) + }, + }, +} +</script> + +<style scoped> +.btns { + display: flex; + align-items: center; + margin-right: 10px; +} +</style> \ No newline at end of file diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue index 3b35599..7c1b889 100644 --- a/src/views/business/inspectionTask/inspection.vue +++ b/src/views/business/inspectionTask/inspection.vue @@ -91,9 +91,9 @@ </el-radio-group> </div> <div style="display: flex; align-items: center"> - <el-button v-if="state == 1" size="small" type="primary" @click="openAddUnpass">鏂板涓嶅悎鏍煎娴�</el-button> + <!-- <el-button v-if="state == 1" size="small" type="primary" @click="openAddUnpass">鏂板涓嶅悎鏍煎娴�</el-button> <el-button v-if="state == 1" size="small" type="primary" @click="unpassCheck">涓嶅悎鏍煎娴�</el-button> - <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">鏌ョ湅涓嶅悎鏍煎娴�</el-button> + <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">鏌ョ湅涓嶅悎鏍煎娴�</el-button> --> <span v-if="cableTagList.length > 0"> 鐢电紗閰嶇疆锛�</span> <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="璇烽�夋嫨" size="small" @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m) @@ -138,6 +138,10 @@ type="success">宸叉</el-tag> </el-option> </el-select> + <!-- 缃戝垎浠暟閲囧浗浜�/杩涘彛 --> + <NetworkAnalyzerDataAcquisition :itemList="currentSample.insProduct" :param="param" + :equipOptions="equipOptions" + v-if="currentSample.insProduct && currentSample.insProduct.length > 0 && param" /> <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary" @click="getDataAcquisitionDevice">鏁版嵁閲囬泦</el-button> <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small" @@ -529,6 +533,7 @@ import UnPassDialog from "../unpass/components/unPassDialog.vue"; import AddUnPass from "../unpass/components/addUnPass.vue"; import InspectionWord from "./components/InspectionWord.vue"; +import NetworkAnalyzerDataAcquisition from "./components/NetworkAnalyzerDataAcquisition.vue"; import PurchaseVerification from "../unpass/components/PurchaseVerification.vue"; import { doInsOrder, @@ -563,6 +568,7 @@ limsTable, UnPassDialog, InspectionWord, + NetworkAnalyzerDataAcquisition, }, data() { return { @@ -966,7 +972,7 @@ // 璧嬪�煎綋鍓嶆牱鍝佸垪琛� this.sampleProduct = res.data.sampleProduct; this.currentSample = this.HaveJson(this.sampleProduct[0]); - let insProduct = this.HaveJson(this.currentSample.insProduct); + // let insProduct = this.HaveJson(this.currentSample.insProduct); // 娓╁害銆佹箍搴﹁祴鍊� this.otherForm = { temperature: this.insOrder.temperature -- Gitblit v1.9.3