| | |
| | | <template> |
| | | <div class="btns"> |
| | | <el-button type="primary" size="small" @click="getMetadata()">进口网分仪数采</el-button> |
| | | <el-button type="primary" size="small">国产网分仪数采</el-button> |
| | | <el-button type="primary" size="small" @click="getMetadata()" v-if="isShowBtn">进口网分仪数采</el-button> |
| | | <el-button type="primary" size="small" @click="getMetadata0" v-if="isShowBtn">国产网分仪数采</el-button> |
| | | <el-dialog title="国产网分" :visible.sync="dialogVisible" width="30%"> |
| | | <el-form ref="form" :model="form" label-width="50px" :rules="rules"> |
| | | <el-form-item label="IP"> |
| | | <el-input v-model="form.serverIp" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="端口"> |
| | | <el-input v-model="form.serverPort" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="通道" prop="memoryDir"> |
| | | <el-select v-model="form.memoryDir" placeholder="请选择"> |
| | | <el-option :label="item" :value="item" v-for="(item, index) in channel" :key="index"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="saveForm">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | data() { |
| | | return { |
| | | itemConfig: [], |
| | | itemListNew: [] |
| | | itemListNew: [], |
| | | dialogVisible: false, |
| | | form: {}, |
| | | channel: [], |
| | | rules: { |
| | | memoryDir: [ |
| | | { required: true, message: '请选择通道', trigger: 'change' } |
| | | ], |
| | | }, |
| | | isShowBtn: false,//是否展示按钮 |
| | | } |
| | | }, |
| | | mounted() { |
| | | // console.log(this.param, this.itemList) |
| | | |
| | | }, |
| | | methods: { |
| | | async getMetadata() { |
| | | console.log(this.param, this.itemList) |
| | | init() { |
| | | 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) |
| | | let obj = this.equipOptions.find(m => this.param[n].equipValue && this.param[n].equipValue.length > 0 && (m.value == this.param[n].equipValue[0].v.v)) |
| | | if (obj && obj.label && obj.label.indexOf('网络分析仪') > -1) { |
| | | equip = obj |
| | | this.isShowBtn = true |
| | | } |
| | | } |
| | | return equip |
| | | }, |
| | | // 进口网分仪数采 |
| | | async getMetadata() { |
| | | let equip = this.init() |
| | | if (equip) { |
| | | await this.getItemConfig(equip) |
| | | this.itemListNew.forEach(item => { |
| | |
| | | } |
| | | }) |
| | | this.gatherNetworkAnalyzerSampleItem() |
| | | } |
| | | }, |
| | | // 国产网分仪数采 |
| | | getMetadata0() { |
| | | let equip = this.init() |
| | | if (equip) { |
| | | this.form = { |
| | | serverIp: equip.ip, |
| | | serverPort: equip.port, |
| | | memoryDir: null |
| | | } |
| | | this.channel = equip.channel ? equip.channel.split(',') : [] |
| | | this.dialogVisible = true |
| | | } |
| | | }, |
| | | async getItemConfig(param) { |
| | |
| | | if (temperatureItem) { |
| | | temperatureItem.itemValue = this.param[temperatureItem.id].resValue.v.v |
| | | } |
| | | console.log('temperatureItem', temperatureItem) |
| | | const temperature = temperatureItem ? temperatureItem.itemValue : null |
| | | |
| | | const cdItem = this.itemListNew.find(m => m.inspectionItem == '电缆长度') |
| | |
| | | ) { |
| | | dataItem = { |
| | | Column1: item.inspectionItem, |
| | | Column2: item.itemReference,// TODO: 相位差-周期数 |
| | | // Column2: item.itemReference,// TODO: 相位差-周期数 |
| | | TD: item.aisle == null ? '0' : item.aisle, |
| | | BW: item.position == null ? '0' : item.position |
| | | } |
| | |
| | | flag = false |
| | | flagMsg = flagMsg + item.inspectionItem + ',部位值为空;' |
| | | } |
| | | if ( |
| | | item.itemReference == null || |
| | | item.itemReference.indexOf('数') < 0 |
| | | ) { |
| | | phaseDifferenceFlag = false |
| | | } |
| | | // TODO: |
| | | // if ( |
| | | // item.itemReference == null || |
| | | // item.itemReference.indexOf('数') < 0 |
| | | // ) { |
| | | // phaseDifferenceFlag = false |
| | | // } |
| | | } else if (item.inspectionItem.indexOf('特性阻抗') > -1 && item.inspectionItemType == 1 |
| | | ) { |
| | | dataItem = { |
| | |
| | | if (flag) { |
| | | const dataArrStr = JSON.stringify(dataArr) |
| | | requireData = preStr + dataArrStr + ednStr |
| | | console.log(3333, requireData) |
| | | this.gatherLoadingShow = true |
| | | $.ajax({ |
| | | type: 'post', |
| | |
| | | this.$message.error('电缆长度和送检长度转换系数不能为空') |
| | | } |
| | | }, |
| | | saveForm() { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | // alert('submit!'); |
| | | this.GuochanNetworkAnalyzer() |
| | | } else { |
| | | console.log('error submit!!'); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | // 国产网分仪 |
| | | GuochanNetworkAnalyzer(type) { |
| | | const { findFromCL } = this |
| | | const temperture = findFromCL('温度') |
| | | const num = findFromCL('电缆长度') * findFromCL('送检长度转换系数') |
| | | const length = num ? this.roundFun(num, 6) : undefined |
| | | const capacity = findFromCL('电容(测试值)') |
| | | const Xiangweicha = this.itemListNew.find(m => m.inspectionItem.indexOf('相位差') > -1) |
| | | let cycle |
| | | if ( |
| | | Xiangweicha && |
| | | Xiangweicha.itemReference && |
| | | Xiangweicha.itemReference.match(/周期数(\d+)/) |
| | | ) { |
| | | cycle = Xiangweicha.itemReference.match(/周期数(\d+)/)[1] |
| | | } |
| | | const index1 = this.itemListNew.findIndex(m => m.inspectionItem.indexOf('特性阻抗') > -1) |
| | | |
| | | // 国产 |
| | | // 温度 |
| | | // 电缆长度和送检长度转换系数 |
| | | // 电容(测试值)-- 电容标准不能为空 |
| | | // 相位差 存在 |
| | | // 特性阻抗 存在 |
| | | // 相位差的周期 |
| | | // 轧纹 |
| | | // 特性阻抗 存在 |
| | | // 高温 |
| | | // 温度 |
| | | // 电缆长度和送检长度转换系数 |
| | | // 特性阻抗 存在 |
| | | // 京信 |
| | | // 温度 |
| | | // 电缆长度和送检长度转换系数 |
| | | // 特性阻抗 存在 |
| | | |
| | | if (index1 < 0) { |
| | | this.$message.error('无平均特性阻抗') |
| | | return |
| | | } |
| | | if (type === '国产') { |
| | | if (!capacity) { |
| | | this.$message.error('电容标准不能为空') |
| | | return |
| | | } |
| | | if (!Xiangweicha) { |
| | | this.$message.error('无相位差') |
| | | return |
| | | } |
| | | if (!cycle) { |
| | | this.$message.error('无相位差周期数') |
| | | return |
| | | } |
| | | } |
| | | if (type === '国产' || type === '高温' || type === '京信') { |
| | | if (!temperture) { |
| | | this.$message.error('温度不能为空') |
| | | return |
| | | } |
| | | if (!length) { |
| | | this.$message.error('电缆长度和送检长度转换系数不能为空') |
| | | return |
| | | } |
| | | } |
| | | |
| | | const loading = this.$loading({ |
| | | lock: true, |
| | | text: '数据采集中', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }) |
| | | const params = { |
| | | ...this.form, |
| | | temperture, |
| | | length, |
| | | cycle, |
| | | capacity |
| | | } |
| | | getTCPValuesNew(params) |
| | | .then((res) => { |
| | | if (res.data.code === 0) { |
| | | // 测试值acqItemValue -- decimalVal |
| | | // 计算值calItemValue -- measureValue |
| | | // 通道aisle -- channel 窗口 |
| | | // 部位position -- trace 同一窗口下的不同轨迹线 |
| | | // 值itemValue -- |
| | | const data = res.data.data.filter((e) => e.ifLegal) |
| | | data.forEach((e) => { |
| | | if (e.decimalVal) { |
| | | e.decimalVal = Math.abs(e.decimalVal) |
| | | } |
| | | if (e.measureValue) { |
| | | e.measureValue = Math.abs(e.measureValue) |
| | | } |
| | | }) |
| | | |
| | | this.dataList['采集项'].forEach((e) => { |
| | | if (e.itemName.indexOf('衰减') > -1) { |
| | | const d = data.find((d) => { |
| | | const match = d.label.match(/decay_(\d+)m/) |
| | | return ( |
| | | match && |
| | | (match[1] + 'MHz衰减' === e.itemName || |
| | | match[1] + 'MHZ衰减' === e.itemName || |
| | | +match[1] / 1000 + 'GHz衰减' === e.itemName || |
| | | +match[1] / 1000 + 'GHZ衰减' === e.itemName) && |
| | | d.channel === +e.aisle |
| | | ) |
| | | }) |
| | | if (d) { |
| | | e.acqItemValue = this.roundFun(d.decimalVal, 3) |
| | | e.calItemValue = this.roundFun(d.measureValue, 3) |
| | | // e.itemValue = Math.min(e.acqItemValue, e.calItemValue) |
| | | e.itemValue = e.calItemValue |
| | | } |
| | | } else if (e.itemName.indexOf('驻波比') > -1) { |
| | | const trace1 = data.find((d) => { |
| | | const match = d.label.match(/swr_(\d+)m/) |
| | | return match && d.channel === +e.aisle && d.trace === 1 |
| | | }) |
| | | const trace2 = data.find((d) => { |
| | | const match = d.label.match(/swr_(\d+)m/) |
| | | if (type === '轧纹' && d.trace === 5) { |
| | | d.trace = 2 |
| | | // 轧纹网分仪配置不正确,手动修正 |
| | | } |
| | | return match && d.channel === +e.aisle && d.trace === 2 |
| | | }) |
| | | let [value1, value2, match1, match2] = [null, null, null, null] |
| | | if (trace1) { |
| | | value1 = this.roundFun(trace1.decimalVal, 3) |
| | | match1 = this.roundFun(trace1.label.match(/swr_(\d+)m/)[1], 3) |
| | | e.acqItemValue = `${value1}|${match1}` |
| | | } |
| | | if (trace2) { |
| | | value2 = this.roundFun(trace2.decimalVal, 3) |
| | | match2 = this.roundFun(trace2.label.match(/swr_(\d+)m/)[1], 3) |
| | | e.calItemValue = `${value2}|${match2}` |
| | | } |
| | | if (trace1 || trace2) { |
| | | e.itemValue = Math.max(value1, value2) |
| | | } |
| | | } else if (e.itemName.indexOf('相位差') > -1) { |
| | | const d = data.find((d) => { |
| | | return d.channel === +e.aisle && d.label === 'pha_mean' |
| | | }) |
| | | if (d) { |
| | | e.acqItemValue = this.roundFun(d.decimalVal, 3) |
| | | } |
| | | } else if (e.itemName.indexOf('特性阻抗') > -1) { |
| | | const trace1 = data.find((d) => { |
| | | return ( |
| | | d.channel === +e.aisle && |
| | | d.trace === 1 && |
| | | d.label === 'impedance_mean' |
| | | ) |
| | | }) |
| | | const trace2 = data.find((d) => { |
| | | return ( |
| | | d.channel === +e.aisle && |
| | | d.trace === 2 && |
| | | d.label === 'impedance_mean' |
| | | ) |
| | | }) |
| | | let [value1, value2] = [null, null] |
| | | if (trace1) { |
| | | value1 = this.roundFun(trace1.decimalVal, 3) |
| | | e.calItemValue = this.roundFun(trace1.calculateValue, 3) |
| | | e.itemValue = e.calItemValue |
| | | } |
| | | if (trace2) { |
| | | value2 = this.roundFun(trace2.decimalVal, 3) |
| | | e.calItemValue = this.roundFun(trace2.calculateValue, 3) |
| | | e.itemValue = e.calItemValue |
| | | } |
| | | if (trace1 || trace2) { |
| | | e.acqItemValue = `${value1}${value1 && value2 ? '|' : '' |
| | | }${value2}` |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | loading.close() |
| | | }) |
| | | }, |
| | | findFromCL(type) { |
| | | const obj = this.itemListNew.find(m => m.inspectionItem == type) |
| | | if (obj) { |
| | | return this.param[obj.id].resValue.v.v |
| | | } else { |
| | | return '' |
| | | } |
| | | }, |
| | | roundFun(value, n) { |
| | | if (value === null) { |
| | | return null |