From 056da80081e0ccf39ce685c62ef7e85072c476a4 Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 23 Nov 2022 17:38:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=82=B9=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/getData2.js | 9 +++-- src/pages/proj/FixedPointTask.vue | 67 +++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/config/getData2.js b/src/config/getData2.js index da0435e..dd7ef4c 100644 --- a/src/config/getData2.js +++ b/src/config/getData2.js @@ -1,4 +1,4 @@ -import {post} from '@config/http.js' +import {post, post2} from '@config/http.js' // 测试接口返回结果 export const test = () => post('test/1', {}) @@ -100,13 +100,14 @@ export const bindingMaterialConfirm = (id, code, mname, pcsn, qty, vcode) => pos /** 定点任务 */ // 1.1查询设备起点和终点 -export const queryDevice = () => post('api/hand/queryDevice', { +export const queryDevice = () => post2('api/hand/queryDevice', { }) // 1.2任务生成 -export const handTask = (scode, ncode) => post('api/hand/task', { +export const handTask = (type, scode, ncode) => post2('api/hand/task', { + task_type: type, start_devicecode: scode, next_devicecode: ncode }) // 1.3查询任务类型 -export const taskType = () => post('api/hand/task_type', { +export const taskType = () => post2('api/hand/task_type', { }) diff --git a/src/pages/proj/FixedPointTask.vue b/src/pages/proj/FixedPointTask.vue index 86b3bbd..154c40d 100644 --- a/src/pages/proj/FixedPointTask.vue +++ b/src/pages/proj/FixedPointTask.vue @@ -19,9 +19,13 @@
起点
@@ -31,9 +35,13 @@
终点
@@ -64,15 +72,22 @@ export default { active1: '', open1: false, option2: [], + optionNew2: [], + val2: '', + startCode: '', active2: '', open2: false, option3: [], + optionNew3: [], + val3: '', + endCode: '', active3: '', open3: false, disabled1: false } }, created () { + this._taskType() this._queryDevice() }, methods: { @@ -87,7 +102,7 @@ export default { this.option2 = [...res.result] this.option2.map(el => { this.$set(el, 'value', el.device_code) - this.$set(el, 'label', el.device_name) + this.$set(el, 'label', el.device_code) }) this.option3 = [...this.option2] }, @@ -99,7 +114,7 @@ export default { return } try { - let res = await handTask(this.option1[this.active1].value, this.option2[this.active2].value, this.option3[this.active3].value) + let res = await handTask(this.option1[this.active1].value, this.startCode, this.endCode) this.toast(res.desc) this.toCancle() this.disabled1 = false @@ -113,6 +128,10 @@ export default { this.active2 = '' this.active3 = '' this.disabled1 = false + this.val2 = '' + this.startCode = '' + this.val3 = '' + this.endCode = '' }, toggleItem1 () { if (!this.open1) { @@ -125,8 +144,29 @@ export default { this.active1 = i + '' this.open1 = false }, + /** 模糊匹配 */ + selectMatchItem (lists, keyWord) { + let resArr = [] + lists.filter((item) => { + if (item.device_code.indexOf(keyWord) > -1) { + resArr.push(item) + } + }) + return resArr + }, + handleChange2 (e) { + this.optionNew2 = [] + this.optionNew2 = this.selectMatchItem(this.option2, e) + this.open2 = true + }, + handleBlur2 () { + this.open2 = false + this.val2 = '' + this.startCode = '' + }, toggleItem2 () { if (!this.open2) { + this.optionNew2 = this.option2 this.open2 = true } else { this.open2 = false @@ -135,9 +175,24 @@ export default { dropdownMenu2 (i) { this.active2 = i + '' this.open2 = false + if (this.optionNew2.length > 0) { + this.val2 = this.optionNew2[i].label + this.startCode = this.optionNew2[i].value + } + }, + handleChange3 (e) { + this.optionNew3 = [] + this.optionNew3 = this.selectMatchItem(this.option3, e) + this.open3 = true + }, + handleBlur3 () { + this.open3 = false + this.val3 = '' + this.endCode = '' }, toggleItem3 () { if (!this.open3) { + this.optionNew3 = this.option3 this.open3 = true } else { this.open3 = false @@ -146,6 +201,10 @@ export default { dropdownMenu3 (i) { this.active3 = i + '' this.open3 = false + if (this.optionNew3.length > 0) { + this.val3 = this.optionNew3[i].label + this.endCode = this.optionNew3[i].value + } } } }