This commit is contained in:
2023-10-12 11:24:33 +08:00
parent 40b946dde4
commit 8c9bf09057
3 changed files with 62 additions and 19 deletions

View File

@@ -42,7 +42,7 @@
<script> <script>
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
import {queryTask, taskOperation} from '@/utils/getData2.js' import {tasks, taskoperation} from '@/utils/getData1.js'
export default { export default {
components: { components: {
NavBar NavBar
@@ -60,11 +60,11 @@
}; };
}, },
created () { created () {
this._queryTask(this.keyword, this.startPoint, this.endPoint) this._tasks(this.keyword, this.startPoint, this.endPoint)
}, },
methods: { methods: {
async _queryTask () { async _tasks () {
let res = await queryTask(this.keyword, this.startPoint, this.endPoint) let res = await tasks(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') { if (res.code === '1') {
this.dataList = [...res.result] this.dataList = [...res.result]
} else { } else {
@@ -74,14 +74,14 @@
}) })
} }
}, },
async _taskOperation (type) { async _taskoperation (type) {
try { try {
let res = await taskOperation(this.pkId, type) let res = await taskoperation(type, this.pkId)
if (res.code === '1') { if (res.code === '1') {
this.disabled1 = false this.disabled1 = false
this.disabled2 = false this.disabled2 = false
this.pkId = '' this.pkId = ''
this._queryTask() this._tasks()
uni.showToast({ uni.showToast({
title: res.desc, title: res.desc,
icon: 'none' icon: 'none'
@@ -108,7 +108,7 @@
this.disabled1 = false this.disabled1 = false
return return
} }
this._taskOperation(type) this._taskoperation(type)
}, },
toSure2 (type) { toSure2 (type) {
this.disabled2 = true this.disabled2 = true
@@ -116,7 +116,7 @@
this.disabled2 = false this.disabled2 = false
return return
} }
this._taskOperation(type) this._taskoperation(type)
} }
} }
} }

View File

@@ -47,7 +47,7 @@
<script> <script>
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
import {queryInstraction, instOperation} from '@/utils/getData2.js' import {insts, inst} from '@/utils/getData1.js'
export default { export default {
components: { components: {
NavBar NavBar
@@ -65,11 +65,11 @@
}; };
}, },
created () { created () {
this._queryInstraction(this.keyword, this.startPoint, this.endPoint) this._insts(this.keyword, this.startPoint, this.endPoint)
}, },
methods: { methods: {
async _queryInstraction () { async _insts () {
let res = await queryInstraction(this.keyword, this.startPoint, this.endPoint) let res = await insts(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') { if (res.code === '1') {
this.dataList = [...res.result] this.dataList = [...res.result]
} else { } else {
@@ -79,15 +79,15 @@
}) })
} }
}, },
async _instOperation (type) { async _inst (type) {
try { try {
let res = await instOperation(this.pkId, type) let res = await inst(type, this.pkId)
if (res.code === '1') { if (res.code === '1') {
this.disabled1 = false this.disabled1 = false
this.disabled2 = false this.disabled2 = false
this.disabled3 = false this.disabled3 = false
this.pkId = '' this.pkId = ''
this._queryInstraction() this._insts()
uni.showToast({ uni.showToast({
title: res.desc, title: res.desc,
icon: 'none' icon: 'none'
@@ -116,7 +116,7 @@
this.disabled1 = false this.disabled1 = false
return return
} }
this._instOperation(type) this._inst(type)
}, },
toSure2 (type) { toSure2 (type) {
this.disabled2 = true this.disabled2 = true
@@ -124,7 +124,7 @@
this.disabled2 = false this.disabled2 = false
return return
} }
this._instOperation(type) this._inst(type)
}, },
toSure3 (type) { toSure3 (type) {
this.disabled3 = true this.disabled3 = true
@@ -132,7 +132,7 @@
this.disabled3 = false this.disabled3 = false
return return
} }
this._instOperation(type) this._inst(type)
} }
} }
} }

43
utils/getData1.js Normal file
View File

@@ -0,0 +1,43 @@
import request from './request.js'
/**
* 指令管理
*/
// 1.1查询未完成指令
export const insts = (keyword, scode, ncode) => request({
url:'api/hand/insts',
data: {
keyword: keyword,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 指令操作
export const inst = (type, uuid) => request({
url:'api/hand/inst',
data: {
type: type,
inst_uuid: uuid
}
})
/**
* 任务管理
*/
// 1.1 查询无指令的任务
export const tasks = (keyword, scode, ncode) => request({
url:'api/hand/tasks',
data: {
keyword: keyword,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 指令操作
export const taskoperation = (type, uuid) => request({
url:'api/hand/taskoperation',
data: {
type: type,
inst_uuid: uuid
}
})