init project
This commit is contained in:
249
mes/qd/src/views/wms/pf/productmaterialset/SetMaterial.vue
Normal file
249
mes/qd/src/views/wms/pf/productmaterialset/SetMaterial.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
fullscreen
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="产品编码" prop="material_code">
|
||||
<el-input v-model="form.material_code" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模式" prop="set_type">
|
||||
<el-select
|
||||
v-model="form.set_type"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择模式"
|
||||
class="filter-item"
|
||||
style="width: 210px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.PD_SET_TYPE"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click="insertEvent"
|
||||
>
|
||||
添加物料
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column prop="class_name" label="类型" align="center" />
|
||||
<el-table-column prop="set_prior_level" label="优先等级" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="form.tableData[scope.$index].set_prior_level" filterable class="edit-input" clearable size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dict.ST_IVT_LEVEL"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="set_prior_level" label="是否计算成型剂" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="form.tableData[scope.$index].is_calculate_forming" filterable class="edit-input" clearable size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in isCalcuList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-permission="['admin','receivemst:edit','receivemst:del']" label="操作" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click.native.prevent="delOne(scope.$index,form.tableData)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<MaterDtl
|
||||
:dialog-show.sync="materShowDialog"
|
||||
:is-single="false"
|
||||
:mater-opt-code="'01'"
|
||||
@tableChanged2="tableChanged2"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
material_code: null,
|
||||
set_type: null,
|
||||
material_mark: null,
|
||||
tableData: []
|
||||
}
|
||||
|
||||
import crudProductmaterialset from '@/api/wms/pf/productmaterialset'
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'SeiMaterial',
|
||||
components: { MaterDtl },
|
||||
mixins: [form(defaultForm), crud()],
|
||||
dicts: ['PD_SET_TYPE', 'ST_IVT_LEVEL'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
fla: null,
|
||||
materShowDialog: false,
|
||||
isCalcuList: [
|
||||
{ 'label': '是', 'value': '1' },
|
||||
{ 'label': '否', 'value': '0' }
|
||||
],
|
||||
rules: {
|
||||
set_type: [
|
||||
{ required: true, message: '新料模式不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 编辑之后获取明细
|
||||
crudProductmaterialset.getDtl({ 'material_id': this.form.material_id, 'set_type': this.form.set_type }).then(res => {
|
||||
this.form.tableData = res
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
// 数据校验
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
for (let i = 0; this.form.tableData.length > i; i++) {
|
||||
if (!this.form.tableData[i].set_prior_level) {
|
||||
this.crud.notify('优先等级不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
insertEvent() {
|
||||
this.materShowDialog = true
|
||||
},
|
||||
tableChanged2(item) {
|
||||
const arr = item
|
||||
const data = this.form.tableData
|
||||
arr.forEach((row) => {
|
||||
if (this.form.tableData.length !== 0) {
|
||||
this.fla = false
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].material_code === row.material_code) {
|
||||
this.fla = true
|
||||
}
|
||||
}
|
||||
if (this.fla === false) {
|
||||
this.form.tableData.push(row)
|
||||
}
|
||||
} else {
|
||||
this.form.tableData.push(row)
|
||||
}
|
||||
})
|
||||
},
|
||||
delOne(index, rows) {
|
||||
rows.splice(index, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
159
mes/qd/src/views/wms/pf/productmaterialset/index.vue
Normal file
159
mes/qd/src/views/wms/pf/productmaterialset/index.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
size="mini"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="模糊查询">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="产品编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模式">
|
||||
<el-select
|
||||
v-model="query.set_type"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.PD_SET_TYPE"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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="500px">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @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 type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="material_id" label="产品标识" />
|
||||
<el-table-column prop="material_code" label="产品编码" />
|
||||
<el-table-column prop="material_name" label="产品名称" />
|
||||
<el-table-column prop="set_type_name" label="模式" />
|
||||
<el-table-column prop="num" label="对应PG粉数" />
|
||||
<el-table-column prop="update_optname" label="设置人" />
|
||||
<el-table-column prop="update_time" label="设置时间" />
|
||||
<el-table-column v-permission="[]" label="操作" fixed="right" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="isVisiableEdit"
|
||||
v-permission="permission.edit"
|
||||
:loading="crud.status.cu === 2"
|
||||
:disabled="disabledEdit"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
@click="crud.toEdit(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<SetMaterial />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudProductmaterialset from '@/api/wms/pf/productmaterialset'
|
||||
import CRUD, { presenter, header, crud } 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 SetMaterial from '@/views/wms/pf/productmaterialset/SetMaterial'
|
||||
|
||||
export default {
|
||||
name: 'Productmaterialset',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, SetMaterial },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
dicts: ['PD_SET_TYPE'],
|
||||
props: {
|
||||
isVisiableEdit: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
disabledEdit: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '产品对应PG粉维护',
|
||||
url: 'api/productmaterialset',
|
||||
idField: 'product_material_id',
|
||||
sort: 'product_material_id,desc',
|
||||
crudMethod: { ...crudProductmaterialset },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
product_material_id: [
|
||||
{ required: true, message: '产品PG粉对应标识不能为空', trigger: 'blur' }
|
||||
],
|
||||
material_id: [
|
||||
{ required: true, message: '产品标识不能为空', trigger: 'blur' }
|
||||
],
|
||||
set_type: [
|
||||
{ required: true, message: '对应模式不能为空', trigger: 'blur' }
|
||||
],
|
||||
set_material_id: [
|
||||
{ required: true, message: '对应物料标识不能为空', trigger: 'blur' }
|
||||
]
|
||||
}}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatMark(row, column) {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user