定点任务
This commit is contained in:
@@ -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', {
|
||||
})
|
||||
|
||||
@@ -19,9 +19,13 @@
|
||||
<div class="filter-label txtjustify">起点</div>
|
||||
<div class="fxcol mgl20 visible" >
|
||||
<dropdown-menu
|
||||
:option="option2"
|
||||
:option="optionNew2"
|
||||
:active="active2"
|
||||
:open="open2"
|
||||
:inputed="true"
|
||||
v-model="val2"
|
||||
@handleBlur="handleBlur2"
|
||||
@handleChange="handleChange2"
|
||||
@toggleItem="toggleItem2"
|
||||
@dropdownMenu="dropdownMenu2">
|
||||
</dropdown-menu>
|
||||
@@ -31,9 +35,13 @@
|
||||
<div class="filter-label txtjustify">终点</div>
|
||||
<div class="fxcol mgl20 visible" >
|
||||
<dropdown-menu
|
||||
:option="option3"
|
||||
:option="optionNew3"
|
||||
:active="active3"
|
||||
:open="open3"
|
||||
:inputed="true"
|
||||
v-model="val3"
|
||||
@handleBlur="handleBlur3"
|
||||
@handleChange="handleChange3"
|
||||
@toggleItem="toggleItem3"
|
||||
@dropdownMenu="dropdownMenu3">
|
||||
</dropdown-menu>
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user