更新代码

This commit is contained in:
lyd
2022-10-19 20:06:00 +08:00
parent 36b489ffdc
commit c79adbcdae
4 changed files with 102 additions and 31 deletions

View File

@@ -40,21 +40,13 @@
/>
</el-form-item>
<el-form-item label="任务类型">
<el-select
<treeselect
v-model="query.task_type"
filterable
:load-options="loadChildNodes"
:options="classes1"
style="width: 180px"
placeholder="任务类型"
class="filter-item"
clearable
@change="hand"
>
<el-option
v-for="item in dict.SCH_TASK_TYPE"
:label="item.label"
:value="item.value"
/>
</el-select>
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="完成方式">
<el-select
@@ -140,22 +132,18 @@
v-permission="['admin','instruction:edit','instruction:del']"
fixed="right"
label="操作"
width="80px"
width="120px"
align="center"
>
<template slot-scope="scope">
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
<i class="el-icon-menu" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'d')">下发</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
<!-- <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>-->
<!-- <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">拉回</el-dropdown-item>-->
<!-- <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'e')">详情</el-dropdown-item>-->
</el-dropdown-menu>
</el-dropdown>
<el-button
type="text"
icon="el-icon-upload"
@click="doOperate(scope.row, 'a')">下发</el-button>
<el-button
type="text"
icon="el-icon-success"
@click="doOperate(scope.row, 'b')">完成</el-button>
</template>
</el-table-column>
</el-table>
@@ -187,13 +175,17 @@ import crudTask from '@/api/wms/sch/task'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudClassstandard from '@/api/wms/basedata/classstandard'
export default {
name: 'Task',
dicts: [],
components: {
pagination, crudOperation, rrOperation
pagination, crudOperation, rrOperation, Treeselect, udOperation
},
mixins: [presenter(), header(), crud()],
cruds() {
@@ -229,10 +221,12 @@ export default {
permission: {
},
rules: {}
rules: {},
classes1: []
}
},
created() {
this.initClass1()
crudTask.getTaskStatus().then(data => {
this.taskStatusList = data
})
@@ -243,6 +237,42 @@ export default {
this.crud.toQuery()
},
methods: {
initClass1() {
const param = {
parent_class_code: 'task_type'
}
crudClassstandard.getClassType(param).then(res => {
const data = res.content
this.buildTree(data)
this.classes1 = data
})
},
buildTree(classes) {
classes.forEach(data => {
if (data.children) {
this.buildTree(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null // 重点代码
}
})
},
// 获取子节点数据
loadChildNodes({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
hand(value) {
this.crud.toQuery()
},
@@ -268,6 +298,40 @@ export default {
}
return ''
},
doOperate(row, command) {
let method_name = ''
switch (command) {
case 'a':// 完成
method_name = 'forceFinish'
break
case 'b':// 取消
method_name = 'cancel'
break
case 'c':// 拉回
method_name = 'pullBack'
break
case 'd':// 下发
method_name = 'renotifyAcs'
break
case 'e':// 详情
method_name = 'view'
break
}
if (method_name === 'view') {
this.view(row)
return
}
const data = {
task_id: row.task_id,
method_name: method_name
}
crudTask.operation(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
},
beforeHandleCommand(index, row, command) {
return {
'index': index,