|
|
@ -9,13 +9,21 @@ |
|
|
|
<span style="line-height:36px;text-align: center">物料类别:</span> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<treeselect |
|
|
|
<el-select |
|
|
|
size="mini" |
|
|
|
v-model="query.material_type_id" |
|
|
|
:load-options="loadChildNodes" |
|
|
|
:options="classes1" |
|
|
|
style="width: 200px;" |
|
|
|
placeholder="请选择" |
|
|
|
/> |
|
|
|
placeholder="全部" |
|
|
|
clearable |
|
|
|
class="filter-item" |
|
|
|
@change="crud.toQuery" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in dict.material_type" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-col> |
|
|
@ -79,34 +87,23 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="物料分类" prop="material_type_id"> |
|
|
|
<treeselect |
|
|
|
<el-select |
|
|
|
size="mini" |
|
|
|
v-model="form.material_type_id" |
|
|
|
:load-options="loadChildNodes" |
|
|
|
:options="classes2" |
|
|
|
style="width: 200px;" |
|
|
|
placeholder="请选择" |
|
|
|
/> |
|
|
|
class="filter-item" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in dict.material_type" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="产品系列"> |
|
|
|
<treeselect |
|
|
|
v-model="form.product_series" |
|
|
|
:options="classes3" |
|
|
|
:auto-load-root-options="false" |
|
|
|
:load-options="loadChildNodes" |
|
|
|
style="width: 200px;" |
|
|
|
placeholder="请选择" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="静置时间" prop="standing_time"> |
|
|
|
<el-input-number v-model="form.standing_time" :controls="false" :min="0" label="分钟" style="width: 200px;" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="是否启用" prop="is_used"> |
|
|
|
<el-radio v-model="form.is_used" label="0">否</el-radio> |
|
|
@ -133,10 +130,10 @@ |
|
|
|
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="material_spec" label="物料规格" width="140" /> |
|
|
|
<el-table-column prop="material_model" label="物料型号" /> |
|
|
|
<el-table-column prop="class_code" label="物料分类编码" width="120" /> |
|
|
|
<el-table-column prop="class_name" label="物料分类" width="140" /> |
|
|
|
<el-table-column prop="unit_name" label="计量单位" /> |
|
|
|
<el-table-column prop="standing_time" label="静置时间(分钟)" width="130px" /> |
|
|
|
<el-table-column prop="product_series_name" label="系列" /> |
|
|
|
<el-table-column label="启用" align="center" prop="is_used"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch |
|
|
@ -179,9 +176,6 @@ 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 '@/views/wms/basedata/master/customer/customerbase' |
|
|
|
import crudMdPbMeasureunit from '@/views/wms/basedata/master/measure/mdPbMeasureunit' |
|
|
|
|
|
|
|
const defaultForm = { |
|
|
@ -215,14 +209,13 @@ const defaultForm = { |
|
|
|
is_used: null, |
|
|
|
is_delete: null, |
|
|
|
ext_id: null, |
|
|
|
material_height_type: null, |
|
|
|
product_series: null |
|
|
|
} |
|
|
|
export default { |
|
|
|
name: 'Materialbase', |
|
|
|
// 数据字典 |
|
|
|
dicts: ['is_used'], |
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect }, |
|
|
|
dicts: ['is_used', 'material_type'], |
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation }, |
|
|
|
mixins: [presenter(), header(), form(defaultForm), crud()], |
|
|
|
cruds() { |
|
|
|
return CRUD({ |
|
|
@ -236,9 +229,6 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
classes1: [], |
|
|
|
classes2: [], |
|
|
|
classes3: [], |
|
|
|
fullscreenLoading: false, |
|
|
|
measure_unit: [], |
|
|
|
productSeries: [], |
|
|
@ -262,104 +252,23 @@ export default { |
|
|
|
is_used: [ |
|
|
|
{ required: true, message: '是否启用不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
material_height_type: [ |
|
|
|
material_type_id: [ |
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.initClass1() |
|
|
|
this.initClass2() |
|
|
|
this.initClass3() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
return true |
|
|
|
}, |
|
|
|
initClass1() { |
|
|
|
const param = { |
|
|
|
parent_class_code: '09' |
|
|
|
} |
|
|
|
crudClassstandard.getClassType(param).then(res => { |
|
|
|
const data = res.content |
|
|
|
this.buildTree(data) |
|
|
|
this.classes1 = data |
|
|
|
}) |
|
|
|
}, |
|
|
|
initClass2() { |
|
|
|
const param = { |
|
|
|
parent_class_code: '09' |
|
|
|
} |
|
|
|
crudClassstandard.getClassType(param).then(res => { |
|
|
|
const data = res.content |
|
|
|
this.buildTree(data) |
|
|
|
this.classes2 = data |
|
|
|
}) |
|
|
|
}, |
|
|
|
initClass3() { |
|
|
|
const param = { |
|
|
|
parent_class_code: '07' |
|
|
|
} |
|
|
|
crudClassstandard.getClassType(param).then(res => { |
|
|
|
const data = res.content |
|
|
|
this.buildTree(data) |
|
|
|
this.classes3 = data |
|
|
|
}) |
|
|
|
}, |
|
|
|
[CRUD.HOOK.beforeToCU](crud, form) { |
|
|
|
crudMdPbMeasureunit.getUnit().then(res => { |
|
|
|
this.measure_unit = res.content |
|
|
|
}) |
|
|
|
// 物料标识为空,新增 |
|
|
|
if (!form.material_type_id) { |
|
|
|
form.material_type_id = null // 必须为null,否则会出现unknown |
|
|
|
} else { // 更新 |
|
|
|
this.getSubTypes('02', form.material_type_id) |
|
|
|
} |
|
|
|
// 物料系列为空,新增 |
|
|
|
if (!form.product_series) { |
|
|
|
form.product_series = null // 必须为null,否则会出现unknown |
|
|
|
} else { // 更新 |
|
|
|
this.getSubTypes('03', form.product_series) |
|
|
|
} |
|
|
|
}, |
|
|
|
getSubTypes(type, id) { |
|
|
|
const that = this |
|
|
|
crudClassstandard.getClassSuperior(id).then(res => { |
|
|
|
const data = res.content |
|
|
|
that.buildTree(data) |
|
|
|
if (type == '02') { |
|
|
|
that.classes2 = data |
|
|
|
} |
|
|
|
if (type == '03') { |
|
|
|
that.classes3 = data |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
queryClassId() { |
|
|
|
const param = { |
|
|
|
'class_idStr': this.class_idStr |
|
|
|
} |
|
|
|
crudClassstandard.queryClassById(param).then(res => { |
|
|
|
this.classes = res.content.map(obj => { |
|
|
|
if (obj.hasChildren) { |
|
|
|
obj.children = null |
|
|
|
} |
|
|
|
return obj |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
buildTree(classes) { |
|
|
|
classes.forEach(data => { |
|
|
|
if (data.children) { |
|
|
|
this.buildTree(data.children) |
|
|
|
} |
|
|
|
if (data.hasChildren && !data.children) { |
|
|
|
data.children = null // 重点代码 |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 改变状态 |
|
|
|
changeEnabled(data, val) { |
|
|
@ -388,22 +297,6 @@ export default { |
|
|
|
data.is_used = '0' |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取子节点数据 |
|
|
|
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) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|