opt:物料基础功能wql改成mybatis plus

This commit is contained in:
zds
2024-10-15 15:19:05 +08:00
parent 60422a9884
commit f69678e3ae
22 changed files with 466 additions and 986 deletions

View File

@@ -1,24 +1,8 @@
<template>
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-row>
<el-col :span="8">
<el-row>
<el-col :span="7">
<span style="line-height:36px;text-align: center">物料类别</span>
</el-col>
<el-col :span="12">
<treeselect
v-model="query.material_type_id"
:load-options="loadChildNodes"
:options="classes1"
style="width: 200px;"
placeholder="请选择"
/>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
模糊查询
<el-input
@@ -36,84 +20,43 @@
</el-col>
</el-row>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation/>
<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="1200px"
width="500px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
<el-row>
<el-col :span="8">
<el-form-item label="物料编码" prop="material_code">
<el-input v-model="form.material_code" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="规格" prop="material_spec">
<label slot="label">规&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</label>
<el-input v-model="form.material_spec" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="型号" prop="material_model">
<label slot="label">型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</label>
<el-input v-model="form.material_model" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="外部标识" prop="ext_id">
<el-input v-model="form.ext_id" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料分类" prop="material_type_id">
<treeselect
v-model="form.material_type_id"
:load-options="loadChildNodes"
:options="classes2"
style="width: 200px;"
placeholder="请选择"
/>
</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>
<el-radio v-model="form.is_used" label="1">是</el-radio>
</el-form-item>
</el-col>
</el-row>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="物料编码" prop="material_code">
<el-input v-model="form.material_code" style="width: 200px;" />
</el-form-item>
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" style="width: 200px;" />
</el-form-item>
<el-form-item label="物料单位" prop="base_unit_id">
<el-select
v-model="form.base_unit_id"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
style="width: 210px"
>
<el-option
v-for="item in measure_unit"
:key="item.measure_unit_id"
:label="item.unit_name"
:value="item.measure_unit_id"
/>
</el-select>
</el-form-item>
<el-form-item label="是否启用" prop="is_used">
<el-radio v-model="form.is_used" label="0">否</el-radio>
<el-radio v-model="form.is_used" label="1">是</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
@@ -129,14 +72,9 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column prop="material_code" label="物料编码" width="160" />
<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_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 prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="unit_name" label="计量单位" :min-width="flexWidth('unit_name',crud.data,'计量单位')" />
<el-table-column label="启用" align="center" prop="is_used">
<template slot-scope="scope">
<el-switch
@@ -149,10 +87,10 @@
/>
</template>
</el-table-column>
<el-table-column prop="update_optname" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="135" />
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
<el-table-column
v-permission="['admin','Materialbase:edit','Materialbase:del']"
v-permission="['admin','material:edit','material:del']"
fixed="right"
label="操作"
width="120px"
@@ -179,50 +117,22 @@ 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 = {
material_id: null,
ass_unit_id: null,
material_code: null,
material_name: null,
material_spec: null,
material_model: null,
english_name: null,
base_unit_id: null,
approve_fileno: null,
print_no: null,
material_type_id: null,
len_unit_id: null,
length: null,
width: null,
height: null,
weight_unit_id: null,
gross_weight: null,
net_weight: null,
cubage_unit_id: null,
cubage: null,
create_id: null,
create_name: null,
create_time: null,
update_optid: null,
update_optname: null,
update_time: null,
is_used_time: null,
is_used: null,
is_delete: null,
ext_id: null,
material_height_type: null,
product_series: null
is_used: '1',
is_delete: '0',
ext_id: null
}
export default {
name: 'Materialbase',
name: 'Material',
// 数据字典
dicts: ['is_used'],
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -230,136 +140,37 @@ export default {
optShow: { add: true, reset: true },
url: 'api/Materialbase',
idField: 'material_id',
sort: 'material_id,desc',
sort: '',
crudMethod: { ...crudMaterialbase }
})
},
data() {
return {
classes1: [],
classes2: [],
classes3: [],
fullscreenLoading: false,
measure_unit: [],
productSeries: [],
permission: {},
permission: {
add: ['admin', 'material:add'],
edit: ['admin', 'material:edit'],
del: ['admin', 'material:del']
},
rules: {
material_id: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
material_code: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
],
material_name: [
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
],
create_id: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
create_time: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
is_used: [
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
],
material_height_type: [
{ 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 +199,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)
})
}
}
}
}

View File

@@ -24,27 +24,4 @@ export function edit(data) {
})
}
export function getMaterOptType(data) {
return request({
url: 'api/Materialbase/getMaterOptType',
method: 'post',
data
})
}
export function isAlongMaterType(data) {
return request({
url: 'api/Materialbase/isAlongMaterType',
method: 'post',
data
})
}
export function getProductSeries() {
return request({
url: 'api/Materialbase/getProductSeries',
method: 'get'
})
}
export default { add, edit, del, getMaterOptType, isAlongMaterType, getProductSeries }
export default { add, edit, del }

View File

@@ -15,15 +15,6 @@
label-width="80px"
label-suffix=":"
>
<el-form-item label="物料类别">
<treeselect
v-model="query.material_type_id"
:load-options="loadClass"
:options="classes"
style="width: 200px;"
placeholder="选择物料类别"
/>
</el-form-item>
<el-form-item label="模糊搜索">
<el-input
v-model="query.search"
@@ -58,10 +49,6 @@
<el-table-column prop="material_code" label="物料编码" min-width="150" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="200" show-overflow-tooltip />
<el-table-column prop="material_spec" label="规格" show-overflow-tooltip />
<el-table-column prop="material_model" label="型号" show-overflow-tooltip />
<el-table-column prop="class_code" label="分类编码" show-overflow-tooltip />
<el-table-column prop="class_name" label="物料分类" show-overflow-tooltip />
<el-table-column prop="unit_name" label="计量单位" />
</el-table>
<!--分页组件-->
@@ -79,13 +66,10 @@ import crudMaterialbase from '@/views/wms/basedata/master/material/materialbase'
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.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'
export default {
name: 'MaterDtl',
components: { rrOperation, pagination, Treeselect },
components: { rrOperation, pagination },
cruds() {
return CRUD({ title: '物料', url: 'api/Materialbase', crudMethod: { ...crudMaterialbase }, optShow: {}})
},
@@ -108,9 +92,7 @@ export default {
data() {
return {
dialogVisible: false,
classes: [],
tableRadio: null,
class_idStr: null,
checkrow: null,
rows: []
}
@@ -126,32 +108,8 @@ export default {
clickChange(item) {
this.tableRadio = item
},
seriesFormat(row) {
return this.dict.label.product_series[row.product_series]
},
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
})
})
this.crud.toQuery()
},
handleSelectionChange(val, row) {
if (this.isSingle) {
@@ -185,21 +143,6 @@ export default {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('setMaterValue', 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)
})
}
}
}
}

View File

@@ -146,7 +146,6 @@
<!-- <el-button type="primary" @click="saveCheck">保存</el-button>-->
<el-button type="primary" @click="submitCheck">确认</el-button>
</span>
<MaterDialog :dialog-show.sync="materShow" @tableChanged2="tableChanged2" />
<DtlViewDialog :dialog-show.sync="dtlViewShow" :open-param="paramDtlView"/>
</el-dialog>
</template>
@@ -154,13 +153,12 @@
<script>
import CRUD, { crud } from '@crud/crud'
import check from '@/views/wms/st/inStor/check/check'
import MaterDialog from '@/views/wms/pub/MaterDialog'
import DtlViewDialog from '@/views/wms/st/inStor/check/DtlViewDialog'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
export default {
name: 'CheckDialog',
components: { MaterDialog, DtlViewDialog },
components: { DtlViewDialog },
mixins: [crud()],
props: {
dialogShow: {
@@ -323,11 +321,6 @@ export default {
this.tableData.push({ check_id: this.form.check_id, check_code: this.form.check_code, checkdtl_id: '', sect_id: this.nowrow.sect_id, sect_name: this.nowrow.sect_name, struct_id: this.nowrow.struct_id, struct_name: this.nowrow.struct_name, storagevehicle_id: this.nowrow.storagevehicle_id, storagevehicle_code: this.nowrow.storagevehicle_code, status: '01', material_id: '', material_name: '', base_qty: '0', qty_unit_id: '42', qty_unit_name: '桶', is_down: '0', fac_qty: '', check_result: '0', edit: false })
this.form.dtl_num = this.tableData.length
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
tableChanged2(row) {
for (let i = 0; i < this.tableData.length; i++) {
if ((this.tableData[i].material_id === row.material_id) && (this.tableData[i].storagevehicle_code === this.nowrow.storagevehicle_code) && (this.tableData[i].struct_id === this.nowrow.struct_id)) {

View File

@@ -156,23 +156,14 @@
</el-table>
<AddDtl :dialog-show.sync="dtlShow" :open-param="opendtlParam" @tableChanged="tableChanged" />
<MaterDtl
:dialog-show.sync="materShow"
:is-single="true"
:mater-opt-code="materType"
@tableChanged2="tableChanged2"
/>
</el-dialog>
</template>
<script>
import crudOperation from '@crud/CRUD.operation'
import CRUD, { crud, form } from '@crud/crud'
import AddDtl from '@/views/wms/st/inbill/AddDtl'
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
import crudRawAssist from '@/views/wms/st/inbill/rawassist'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
@@ -191,7 +182,7 @@ const defaultForm = {
export default {
name: 'AddDialog',
components: { AddDtl, MaterDtl },
components: { AddDtl },
mixins: [crud(), form(defaultForm)],
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_INV_IN_TYPE'],
props: {
@@ -308,14 +299,6 @@ export default {
fun(val) {
return Number(val).toFixed(3)
},
async queryMater(index, row) {
checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type, 'io_flag': '00' }).then(res => {
this.materType = res.materType
this.materShow = true
this.nowindex = index
this.nowrow = row
})
},
async insertdtl() {
if (this.form.bill_type == '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)

View File

@@ -260,8 +260,6 @@ import CRUD, { crud, form } from '@crud/crud'
import AddDtl from '@/views/wms/st/outbill/AddDtl'
import MaterDialog from '@/views/wms/pub/MaterDialog'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
import crudRawAssist from '@/views/wms/st/inbill/rawassist'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
const defaultForm = {
@@ -348,10 +346,6 @@ export default {
this.crud.notify('移入仓库不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
/*if (this.form.out_stor_id === this.form.stor_id) {
this.crud.notify('移出仓库和移入仓库不能一致!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}*/
}
},
[CRUD.HOOK.afterToEdit]() {