fix: 任务配置以及基础分类三级回显失败BUG
This commit is contained in:
@@ -93,18 +93,13 @@
|
||||
<el-input v-model="form.task_name" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型">
|
||||
<el-select
|
||||
v-model="form.task_type"
|
||||
size="mini"
|
||||
placeholder="任务类型"
|
||||
<treeselect
|
||||
v-model="form.task_type_id"
|
||||
:load-options="loadTaskType"
|
||||
:options="taskTypes"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.task_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
placeholder="请选择任务类型"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="优先级" pro="priority">
|
||||
<el-input-number
|
||||
@@ -197,14 +192,15 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="task_name" label="任务名字" :min-width="flexWidth('task_name',crud.data,'任务名字')" />
|
||||
<el-table-column prop="task_type" label="任务类型" :min-width="flexWidth('task_type',crud.data,'任务类型', 20)">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_type[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="task_type_name" label="任务类型" :min-width="flexWidth('task_type_name',crud.data,'任务类型')" />
|
||||
<el-table-column prop="priority" label="优先级" :min-width="flexWidth('priority',crud.data,'优先级')" />
|
||||
<el-table-column prop="task_create_max_num" label="任务生成数上限" :min-width="flexWidth('task_create_max_num',crud.data,'任务生成数上限')" />
|
||||
<el-table-column prop="task_issue_max_num" label="任务下发数上限" :min-width="flexWidth('task_issue_max_num',crud.data,'任务下发数上限')" />
|
||||
<el-table-column prop="is_immediate_create" label="是否立即创建" :min-width="flexWidth('is_immediate_create',crud.data,'是否立即创建')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_immediate_create ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_auto_issue" label="是否自动下发" :min-width="flexWidth('is_auto_issue',crud.data,'是否自动下发')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_auto_issue?'是':'否' }}
|
||||
@@ -238,11 +234,6 @@
|
||||
{{ scope.row.is_check_start_lock?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_immediate_create" label="是否立即创建" :min-width="flexWidth('is_immediate_create',crud.data,'是否立即创建')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_immediate_create?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="false" prop="is_check_next_lock" label="是否判断终点锁" :min-width="flexWidth('is_check_next_lock',crud.data,'是否判断终点锁')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_check_next_lock?'是':'否' }}
|
||||
@@ -306,8 +297,11 @@ import rrOperation from '@crud/RR.operation.vue'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import udOperation from '@crud/UD.operation.vue'
|
||||
import pagination from '@crud/Pagination.vue'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import crudMdBaseWorkShop from '@/views/wms/basedata/workshop/mdBaseWorkshop'
|
||||
import crudSchBaseRegion from '@/views/wms/sch/region/schBaseRegion'
|
||||
import crudClassstandard from '@/views/wms/basedata/master/classification/mdBaseClassstandard'
|
||||
|
||||
const defaultForm = {
|
||||
config_id: null,
|
||||
@@ -317,6 +311,7 @@ const defaultForm = {
|
||||
acs_task_type: null,
|
||||
task_name: null,
|
||||
task_type: null,
|
||||
task_type_id: null,
|
||||
priority: null,
|
||||
task_create_max_num: null,
|
||||
task_issue_max_num: null,
|
||||
@@ -350,7 +345,7 @@ const defaultForm = {
|
||||
export default {
|
||||
name: 'TaskConfig',
|
||||
dicts: ['task_qf_type', 'acs_task_type', 'task_direction', 'task_type'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -390,7 +385,8 @@ export default {
|
||||
]
|
||||
},
|
||||
workShopList: [],
|
||||
regionList: []
|
||||
regionList: [],
|
||||
taskTypes: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -414,12 +410,28 @@ export default {
|
||||
created() {
|
||||
this.getWorkShopList()
|
||||
this.getRegionList()
|
||||
this.initClassType()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
// 新增与编辑前做的操作
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
// 为了初始化数据 -> 树的数据
|
||||
if (form.task_type_id !== null && form.task_type_id !== '0' && form.task_type_id !== '') {
|
||||
this.getSubTypes(form.task_type_id)
|
||||
} else {
|
||||
this.getClass()
|
||||
}
|
||||
},
|
||||
getSubTypes(id) { // 获取当前对象与所有父类数据
|
||||
crudClassstandard.getClassSuperior(id).then(res => {
|
||||
this.buildTree(res)
|
||||
this.taskTypes = res
|
||||
})
|
||||
},
|
||||
getWorkShopList() { // 获取车间列表
|
||||
crudMdBaseWorkShop.getWorkShopList().then(res => {
|
||||
this.workShopList = res
|
||||
@@ -429,6 +441,42 @@ export default {
|
||||
crudSchBaseRegion.getRegionList().then(res => {
|
||||
this.regionList = res
|
||||
})
|
||||
},
|
||||
// 获取弹窗内任务类型数据
|
||||
loadTaskType({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
initClassType() {
|
||||
const param = {
|
||||
parent_class_code: 'task_type'
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res
|
||||
this.buildTree(data)
|
||||
this.taskTypes = data
|
||||
})
|
||||
},
|
||||
buildTree(classes) {
|
||||
classes.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildTree(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null // 重点代码
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user