张江玮
2 years ago
24 changed files with 1125 additions and 308 deletions
@ -0,0 +1,56 @@ |
|||||
|
[交易说明] |
||||
|
交易名: 物料详情分页查询 |
||||
|
所属模块: |
||||
|
功能简述: |
||||
|
版权所有: |
||||
|
表引用: |
||||
|
版本经历: |
||||
|
|
||||
|
[数据库] |
||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
||||
|
|
||||
|
[IO定义] |
||||
|
################################################# |
||||
|
## 表字段对应输入参数 |
||||
|
################################################# |
||||
|
输入.flag TYPEAS s_string |
||||
|
|
||||
|
[临时表] |
||||
|
--这边列出来的临时表就会在运行期动态创建 |
||||
|
|
||||
|
[临时变量] |
||||
|
--所有中间过程变量均可在此处定义 |
||||
|
|
||||
|
[业务过程] |
||||
|
|
||||
|
########################################## |
||||
|
# 1、输入输出检查 # |
||||
|
########################################## |
||||
|
|
||||
|
|
||||
|
########################################## |
||||
|
# 2、主过程前处理 # |
||||
|
########################################## |
||||
|
|
||||
|
|
||||
|
########################################## |
||||
|
# 3、业务主过程 # |
||||
|
########################################## |
||||
|
|
||||
|
IF 输入.flag = "1" |
||||
|
PAGEQUERY |
||||
|
SELECT |
||||
|
md.*, |
||||
|
d1.label AS 'furnace_name', |
||||
|
d2.label AS 'material_brick_type_name', |
||||
|
d3.label AS 'product_grade_name' |
||||
|
FROM |
||||
|
md_me_material_detail md |
||||
|
LEFT JOIN sys_dict_detail d1 ON d1.`value` = md.furnace AND d1.`name` = 'furnace' |
||||
|
LEFT JOIN sys_dict_detail d2 ON d2.`value` = md.material_brick_type AND d2.`name` = 'material_brick_type' |
||||
|
LEFT JOIN sys_dict_detail d3 ON d3.`value` = md.product_grade AND d3.`name` = 'product_grade' |
||||
|
WHERE |
||||
|
md.is_delete = '0' |
||||
|
ENDSELECT |
||||
|
ENDPAGEQUERY |
||||
|
ENDIF |
Binary file not shown.
@ -0,0 +1,287 @@ |
|||||
|
<template> |
||||
|
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container"> |
||||
|
<!--工具栏--> |
||||
|
<div class="head-container"> |
||||
|
<div v-if="crud.props.searchToggle"> |
||||
|
<el-form |
||||
|
:inline="true" |
||||
|
class="demo-form-inline" |
||||
|
label-position="right" |
||||
|
label-width="90px" |
||||
|
label-suffix=":" |
||||
|
> |
||||
|
<el-form-item label="BOM编码"> |
||||
|
<el-input |
||||
|
v-model="query.name" |
||||
|
clearable |
||||
|
placeholder="BOM编码" |
||||
|
@keyup.enter.native="crud.toQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<rrOperation /> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
||||
|
<crudOperation :permission="permission" /> |
||||
|
<!--表单组件--> |
||||
|
<el-dialog |
||||
|
:close-on-click-modal="false" |
||||
|
:before-close="crud.cancelCU" |
||||
|
:visible.sync="crud.status.cu > 0" |
||||
|
:title="crud.status.title" |
||||
|
width="600px" |
||||
|
> |
||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="160px" label-suffix=":"> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="BOM编码" prop="material_code"> |
||||
|
<el-input :disabled="crud.status.edit" v-model="form.material_code" clearable style="width: 300px" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="静置时间" prop="standing_time"> |
||||
|
<el-input v-model="form.standing_time" type="number" style="width: 300px" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="阈值时间" prop="threshold_time"> |
||||
|
<el-input v-model="form.threshold_time" type="number" style="width: 300px" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button type="info" @click="crud.cancelCU">取消</el-button> |
||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="table" |
||||
|
v-loading="crud.loading" |
||||
|
:data="crud.data" |
||||
|
size="mini" |
||||
|
style="width: 100%;" |
||||
|
@selection-change="crud.selectionChangeHandler" |
||||
|
> |
||||
|
<el-table-column prop="material_code" label="BOM编码" :min-width="flexWidth('material_code',crud.data,'BOM编码')" /> |
||||
|
<el-table-column prop="standing_time" label="困料时间" :min-width="flexWidth('standing_time',crud.data,'困料时间')" /> |
||||
|
<el-table-column prop="threshold_time" label="超时时间" :min-width="flexWidth('threshold_time',crud.data,'超时时间')" /> |
||||
|
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" /> |
||||
|
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" /> |
||||
|
<el-table-column prop="update_optname" label="修改人" :min-width="flexWidth('update_optname',crud.data,'修改人')" /> |
||||
|
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" /> |
||||
|
<el-table-column |
||||
|
v-permission="[]" |
||||
|
label="操作" |
||||
|
fixed="right" |
||||
|
width="120px" |
||||
|
align="center" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<udOperation |
||||
|
:is-visiable-del="false" |
||||
|
:data="scope.row" |
||||
|
:permission="permission" |
||||
|
/> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<!--分页组件--> |
||||
|
<pagination /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import crudMaterialbase from '@/api/wms/basedata/materialbase' |
||||
|
import CRUD, { crud, form, 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 { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
||||
|
import crudClassstandard from '@/api/wms/basedata/classstandard' |
||||
|
import crudMdPbMeasureunit from '@/api/wms/basedata/mdPbMeasureunit' |
||||
|
|
||||
|
const defaultForm = { |
||||
|
material_id: null, |
||||
|
ass_unit_id: null, |
||||
|
material_code: null, |
||||
|
material_name: null, |
||||
|
standing_time: null, |
||||
|
threshold_time: null, |
||||
|
a: null, |
||||
|
b: null, |
||||
|
h: null, |
||||
|
w: null, |
||||
|
product_code: null, |
||||
|
create_id: null, |
||||
|
create_name: null, |
||||
|
create_time: null, |
||||
|
update_optid: null, |
||||
|
update_optname: null, |
||||
|
update_time: null, |
||||
|
weight: null, |
||||
|
material_type: '2' |
||||
|
} |
||||
|
export default { |
||||
|
name: 'BOM', |
||||
|
// 数据字典 |
||||
|
dicts: ['is_used'], |
||||
|
components: { pagination, crudOperation, rrOperation, udOperation }, |
||||
|
mixins: [presenter(), header(), form(defaultForm), crud()], |
||||
|
cruds() { |
||||
|
return CRUD({ |
||||
|
title: 'BOM', |
||||
|
optShow: { add: false, reset: true }, |
||||
|
url: 'api/Materialbase', |
||||
|
idField: 'material_id', |
||||
|
sort: 'material_id,desc', |
||||
|
crudMethod: { ...crudMaterialbase }, |
||||
|
query: { |
||||
|
material_type: '2' |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
classes1: [], |
||||
|
classes2: [], |
||||
|
classes3: [], |
||||
|
fullscreenLoading: false, |
||||
|
measure_unit: [], |
||||
|
productSeries: [], |
||||
|
permission: {}, |
||||
|
rules: { |
||||
|
material_code: [ |
||||
|
{ required: true, message: '物料编码不能为空', trigger: 'blur' } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
}, |
||||
|
methods: { |
||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
||||
|
[CRUD.HOOK.beforeRefresh]() { |
||||
|
return true |
||||
|
}, |
||||
|
[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 |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
synchronize() { |
||||
|
this.fullscreenLoading = true |
||||
|
crudMaterialbase.synchronize(this.crud.query).then(res => { |
||||
|
this.fullscreenLoading = false |
||||
|
this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) |
||||
|
}).catch(() => { |
||||
|
this.fullscreenLoading = false |
||||
|
}) |
||||
|
}, |
||||
|
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) { |
||||
|
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.material_name + ', 是否继续?', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
crudMaterialbase.edit(data).then(res => { |
||||
|
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
||||
|
}).catch(() => { |
||||
|
if (data.is_used === '0') { |
||||
|
data.is_used = '1' |
||||
|
return |
||||
|
} |
||||
|
if (data.is_used === '1') { |
||||
|
data.is_used = '0' |
||||
|
} |
||||
|
}) |
||||
|
}).catch(() => { |
||||
|
if (data.is_used === '0') { |
||||
|
data.is_used = '1' |
||||
|
return |
||||
|
} |
||||
|
if (data.is_used === '1') { |
||||
|
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) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,202 @@ |
|||||
|
<template> |
||||
|
<el-dialog |
||||
|
title="BOM选择" |
||||
|
append-to-body |
||||
|
:visible.sync="dialogVisible" |
||||
|
destroy-on-close |
||||
|
width="1000px" |
||||
|
@close="close" |
||||
|
@open="open" |
||||
|
> |
||||
|
<el-form |
||||
|
:inline="true" |
||||
|
class="demo-form-inline" |
||||
|
label-position="right" |
||||
|
label-width="90px" |
||||
|
label-suffix=":" |
||||
|
> |
||||
|
<el-form-item label="BOM编码"> |
||||
|
<el-input |
||||
|
v-model="query.name" |
||||
|
clearable |
||||
|
placeholder="BOM编码" |
||||
|
@keyup.enter.native="crud.toQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<rrOperation /> |
||||
|
</el-form> |
||||
|
|
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="table" |
||||
|
v-loading="crud.loading" |
||||
|
:data="crud.data" |
||||
|
style="width: 100%;" |
||||
|
size="mini" |
||||
|
border |
||||
|
:header-cell-style="{background:'#f5f7fa',color:'#606266'}" |
||||
|
@select="handleSelectionChange" |
||||
|
@select-all="onSelectAll" |
||||
|
@current-change="clickChange" |
||||
|
> |
||||
|
<el-table-column v-if="!isSingle" type="selection" width="55" /> |
||||
|
<el-table-column v-if="isSingle" label="选择" width="55"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="material_code" label="BOM编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" /> |
||||
|
<el-table-column prop="standing_time" label="静置时间" :min-width="flexWidth('standing_time',crud.data,'静置时间')" /> |
||||
|
<el-table-column prop="threshold_time" label="阈值时间" :min-width="flexWidth('threshold_time',crud.data,'阈值时间')" /> |
||||
|
</el-table> |
||||
|
<!--分页组件--> |
||||
|
<pagination /> |
||||
|
<span slot="footer" class="dialog-footer"> |
||||
|
<el-button type="info" @click="dialogVisible = false">取 消</el-button> |
||||
|
<el-button type="primary" @click="submit">确 定</el-button> |
||||
|
</span> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
import crudMaterialbase from '@/api/wms/basedata/materialbase' |
||||
|
import CRUD, { header, presenter } from '@crud/crud' |
||||
|
import rrOperation from '@crud/RR.operation' |
||||
|
import pagination from '@crud/Pagination' |
||||
|
import { 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: 'BOMDtl', |
||||
|
components: { rrOperation, pagination }, |
||||
|
cruds() { |
||||
|
return CRUD({ |
||||
|
title: 'BOM', |
||||
|
url: 'api/Materialbase', |
||||
|
crudMethod: { ...crudMaterialbase }, |
||||
|
optShow: {}, |
||||
|
query: { |
||||
|
material_type: '2' |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
mixins: [presenter(), header()], |
||||
|
dicts: ['product_series'], |
||||
|
props: { |
||||
|
dialogShow: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isSingle: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
materOptCode: { |
||||
|
type: String, |
||||
|
default: '00' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dialogVisible: false, |
||||
|
classes: [], |
||||
|
tableRadio: null, |
||||
|
class_idStr: null, |
||||
|
checkrow: null, |
||||
|
rows: [] |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
dialogShow: { |
||||
|
handler(newValue) { |
||||
|
this.dialogVisible = newValue |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
clickChange(item) { |
||||
|
this.tableRadio = item |
||||
|
}, |
||||
|
open() { |
||||
|
const param = { |
||||
|
'materOpt_code': this.materOptCode |
||||
|
} |
||||
|
crudMaterialbase.getMaterOptType(param).then(res => { |
||||
|
this.class_idStr = res.class_idStr |
||||
|
this.crud.query.class_idStr = res.class_idStr |
||||
|
this.crud.toQuery() |
||||
|
this.queryClassId() |
||||
|
}) |
||||
|
}, |
||||
|
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 |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
handleSelectionChange(val, row) { |
||||
|
if (this.isSingle) { |
||||
|
if (val.length > 1) { |
||||
|
this.$refs.table.clearSelection() |
||||
|
this.$refs.table.toggleRowSelection(val.pop()) |
||||
|
} else { |
||||
|
this.checkrow = row |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
onSelectAll() { |
||||
|
this.$refs.table.clearSelection() |
||||
|
}, |
||||
|
close() { |
||||
|
this.crud.resetQuery(false) |
||||
|
this.$emit('update:dialogShow', false) |
||||
|
}, |
||||
|
submit() { |
||||
|
// 处理单选 |
||||
|
if (this.isSingle && this.tableRadio) { |
||||
|
this.$emit('update:dialogShow', false) |
||||
|
this.$emit('setBOMValue', this.tableRadio) |
||||
|
return |
||||
|
} |
||||
|
this.rows = this.$refs.table.selection |
||||
|
if (this.rows.length <= 0) { |
||||
|
this.$message('请先选择物料') |
||||
|
return |
||||
|
} |
||||
|
this.crud.resetQuery(false) |
||||
|
this.$emit('update:dialogShow', false) |
||||
|
this.$emit('setBOMValue', this.rows) |
||||
|
}, |
||||
|
loadClass({ 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) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style rel="stylesheet/scss" lang="scss" scoped> |
||||
|
::v-deep .el-dialog__body { |
||||
|
padding-top: 0px; |
||||
|
} |
||||
|
</style> |
||||
|
|
Loading…
Reference in new issue