From c1f41b429992dd626751b22c5104a178c1cea439 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Mon, 23 Dec 2019 17:14:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=A1=E5=8F=B7=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=85=B3=E7=B3=BB=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA=E9=80=BB=E8=BE=91=E5=8C=BA?= =?UTF-8?q?=E6=AE=B5=E5=81=8F=E7=A7=BB=E9=87=8F=E6=95=B0=E6=8D=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataRelation/signaloperate/detail.vue | 7 +- .../mapoperate/section/logicBlock.vue | 11 ++-- .../newMapdraft/mapoperate/signal/index.vue | 64 +++++++++---------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/views/newMap/newMapdraft/dataRelation/signaloperate/detail.vue b/src/views/newMap/newMapdraft/dataRelation/signaloperate/detail.vue index c49c2e124..4c2d91a31 100644 --- a/src/views/newMap/newMapdraft/dataRelation/signaloperate/detail.vue +++ b/src/views/newMap/newMapdraft/dataRelation/signaloperate/detail.vue @@ -94,7 +94,7 @@ export default { const list = []; if (val && val.length) { for (let i = 0; i < val.length; i++) { - list.push({ label: val[i].uniqueName, value: val[i].code }); + list.push({ label: val[i].name + '(' + val[i].code + ')', value: val[i].code }); } this.queryForm.queryObject.signalCode.config.data = list; } @@ -137,9 +137,10 @@ export default { const list = data.list; if (list) { list.map(elem => { - that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']); elem.code = elem.signalCode; - elem.signalCode = that.formatName(elem.signalCode); + that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']); + that.$convertSpecifiedField(elem, this.signalList, 'code', 'name', ['signalCode']); + elem.signalCode = `${elem.signalCode}(${elem.code})`; }); } } diff --git a/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue index 2ff547cdd..4fac499db 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue @@ -84,7 +84,7 @@ export default { }); const lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量 this.tableData.forEach((ele, index) => { - models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength)]; + models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)]; allNotZeros = Number(ele.num) && allNotZeros; count += Number(ele.num); logicSectionNumList.push(Number(ele.num)); @@ -116,7 +116,7 @@ export default { row.num = 0; }, // 创建逻辑区段 - createLogicalSections(num, beg, end, model, counts, lineLength) { + createLogicalSections(num, beg, end, model, counts, lineLength, totalNum) { const models = []; const triangle = new JTriangle(beg, end); const offset = Math.sqrt(triangle.abspowz) / num; @@ -125,15 +125,14 @@ export default { { x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) }, { x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) } ]; - const param = this.addLogicalSection(model, points, counts + i, lineLength); - param.lengthFact = Number(model.lengthFact) / num; + const param = this.addLogicalSection(model, points, counts + i, lineLength, totalNum); models.push(param); this.addList.push(param); } return models; }, // 逻辑区段模型 - addLogicalSection(model, points, index, lineLength) { + addLogicalSection(model, points, index, lineLength, totalNum) { const data = { _type: 'Section', code: getUID('T', [...this.sectionList, ...this.addList]), @@ -181,7 +180,7 @@ export default { kmRangeLeft: model.kmRangeLeft, region: model.region, logicSectionStartOffset: Math.floor(lineLength * index), - logicSectionEndOffset: Math.floor(lineLength * (index + 1)), + logicSectionEndOffset: index + 1 != totalNum ? Math.floor(lineLength * (index + 1)) : model.lengthFact, relevanceSectionList: [] }; if (this.isDelimiter) { diff --git a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue index fd5d4cfd1..dddba4f76 100644 --- a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue @@ -17,7 +17,7 @@ - + @@ -99,11 +99,6 @@ export default { }, addModel: { number: 2 - }, - addRules: { - number: [ - { required: true, message: '请输入左右偏移量', trigger: 'blur', min: 0 } - ] } }; }, @@ -308,42 +303,47 @@ export default { }, // 构建信号机偏移量 editAll() { - this.$refs['mark'].validate((valid) => { - if (valid) { - const models = []; - this.questionList = []; - this.signalList.forEach(item => { - const signalModel = deepAssign({}, item); - const section = this.findSection(signalModel); - if (section.code && item.sectionCode != section.code) { - signalModel.sectionCode = section.code; + if (this.addModel.number != '') { + const models = []; + this.questionList = []; + this.signalList.forEach(item => { + const signalModel = deepAssign({}, item); + const section = this.findSection(signalModel); + if (section.code && item.sectionCode != section.code) { + signalModel.sectionCode = section.code; + } + if (!section.code) { + this.questionList.push(`${item.name}(${item.code}) 信号机位置可能不正确,请手动调试归属区段及偏移量.`); + } + signalModel.sectionOffset = this.addModel.number; + if (signalModel.right) { + if (section.lengthFact) { + signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - this.addModel.number); } - if (!section.code) { - this.questionList.push(`${item.name}(${item.code}) 信号机位置可能不正确,请手动调试归属区段及偏移量.`); - } - signalModel.sectionOffset = this.addModel.number; - if (signalModel.right) { - if (section.lengthFact) { - signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - this.addModel.number); - } - } - models.push(signalModel); - }); - this.$emit('updateMapModel', models); - this.$message.success('数据构建成功!'); - } - }); + } + models.push(signalModel); + if (this.editModel.code == signalModel.code) { + this.editModel.sectionCode = signalModel.sectionCode; + } + }); + this.$emit('updateMapModel', models); + this.$message.success('数据构建成功!'); + this.deviceSelect(); + + } else { + this.$message('请输入偏移量'); + } }, // 寻找信号机关联区段 findSection(signal) { // 01 向左 02 向右 let model = {}; this.sectionList.forEach(section => { - if (!signal.right && section.type != '02') { + if (!signal.right && section.type != '02' && section.type != '04') { if (section.points[0].x == signal.position.x && Math.abs(section.points[0].y - signal.position.y) <= 20) { model = section; } - } else if (signal.right && section.type != '02') { + } else if (signal.right && section.type != '02' && section.type != '04') { if (section.points[section.points.length - 1].x == signal.position.x && Math.abs(section.points[section.points.length - 1].y - signal.position.y) <= 20) { model = section; }