定点任务

This commit is contained in:
2022-11-23 17:38:43 +08:00
parent b2db8af681
commit 056da80081
2 changed files with 68 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
import {post} from '@config/http.js' import {post, post2} from '@config/http.js'
// 测试接口返回结果 // 测试接口返回结果
export const test = () => post('test/1', {}) export const test = () => post('test/1', {})
@@ -100,13 +100,14 @@ export const bindingMaterialConfirm = (id, code, mname, pcsn, qty, vcode) => pos
/** 定点任务 */ /** 定点任务 */
// 1.1查询设备起点和终点 // 1.1查询设备起点和终点
export const queryDevice = () => post('api/hand/queryDevice', { export const queryDevice = () => post2('api/hand/queryDevice', {
}) })
// 1.2任务生成 // 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, start_devicecode: scode,
next_devicecode: ncode next_devicecode: ncode
}) })
// 1.3查询任务类型 // 1.3查询任务类型
export const taskType = () => post('api/hand/task_type', { export const taskType = () => post2('api/hand/task_type', {
}) })

View File

@@ -19,9 +19,13 @@
<div class="filter-label txtjustify">起点</div> <div class="filter-label txtjustify">起点</div>
<div class="fxcol mgl20 visible" > <div class="fxcol mgl20 visible" >
<dropdown-menu <dropdown-menu
:option="option2" :option="optionNew2"
:active="active2" :active="active2"
:open="open2" :open="open2"
:inputed="true"
v-model="val2"
@handleBlur="handleBlur2"
@handleChange="handleChange2"
@toggleItem="toggleItem2" @toggleItem="toggleItem2"
@dropdownMenu="dropdownMenu2"> @dropdownMenu="dropdownMenu2">
</dropdown-menu> </dropdown-menu>
@@ -31,9 +35,13 @@
<div class="filter-label txtjustify">终点</div> <div class="filter-label txtjustify">终点</div>
<div class="fxcol mgl20 visible" > <div class="fxcol mgl20 visible" >
<dropdown-menu <dropdown-menu
:option="option3" :option="optionNew3"
:active="active3" :active="active3"
:open="open3" :open="open3"
:inputed="true"
v-model="val3"
@handleBlur="handleBlur3"
@handleChange="handleChange3"
@toggleItem="toggleItem3" @toggleItem="toggleItem3"
@dropdownMenu="dropdownMenu3"> @dropdownMenu="dropdownMenu3">
</dropdown-menu> </dropdown-menu>
@@ -64,15 +72,22 @@ export default {
active1: '', active1: '',
open1: false, open1: false,
option2: [], option2: [],
optionNew2: [],
val2: '',
startCode: '',
active2: '', active2: '',
open2: false, open2: false,
option3: [], option3: [],
optionNew3: [],
val3: '',
endCode: '',
active3: '', active3: '',
open3: false, open3: false,
disabled1: false disabled1: false
} }
}, },
created () { created () {
this._taskType()
this._queryDevice() this._queryDevice()
}, },
methods: { methods: {
@@ -87,7 +102,7 @@ export default {
this.option2 = [...res.result] this.option2 = [...res.result]
this.option2.map(el => { this.option2.map(el => {
this.$set(el, 'value', el.device_code) 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] this.option3 = [...this.option2]
}, },
@@ -99,7 +114,7 @@ export default {
return return
} }
try { 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.toast(res.desc)
this.toCancle() this.toCancle()
this.disabled1 = false this.disabled1 = false
@@ -113,6 +128,10 @@ export default {
this.active2 = '' this.active2 = ''
this.active3 = '' this.active3 = ''
this.disabled1 = false this.disabled1 = false
this.val2 = ''
this.startCode = ''
this.val3 = ''
this.endCode = ''
}, },
toggleItem1 () { toggleItem1 () {
if (!this.open1) { if (!this.open1) {
@@ -125,8 +144,29 @@ export default {
this.active1 = i + '' this.active1 = i + ''
this.open1 = false 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 () { toggleItem2 () {
if (!this.open2) { if (!this.open2) {
this.optionNew2 = this.option2
this.open2 = true this.open2 = true
} else { } else {
this.open2 = false this.open2 = false
@@ -135,9 +175,24 @@ export default {
dropdownMenu2 (i) { dropdownMenu2 (i) {
this.active2 = i + '' this.active2 = i + ''
this.open2 = false 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 () { toggleItem3 () {
if (!this.open3) { if (!this.open3) {
this.optionNew3 = this.option3
this.open3 = true this.open3 = true
} else { } else {
this.open3 = false this.open3 = false
@@ -146,6 +201,10 @@ export default {
dropdownMenu3 (i) { dropdownMenu3 (i) {
this.active3 = i + '' this.active3 = i + ''
this.open3 = false this.open3 = false
if (this.optionNew3.length > 0) {
this.val3 = this.optionNew3[i].label
this.endCode = this.optionNew3[i].value
}
} }
} }
} }