opt:优化更新仓库管理相关代码
This commit is contained in:
@@ -44,16 +44,6 @@ public class Storattr implements Serializable {
|
||||
*/
|
||||
private String simple_name;
|
||||
|
||||
/**
|
||||
* 容量
|
||||
*/
|
||||
private BigDecimal stor_capacity;
|
||||
|
||||
/**
|
||||
* 总面积(㎡)
|
||||
*/
|
||||
private BigDecimal total_area;
|
||||
|
||||
/**
|
||||
* 仓库性质
|
||||
*/
|
||||
@@ -67,38 +57,20 @@ public class Storattr implements Serializable {
|
||||
|
||||
private String is_productstore;
|
||||
|
||||
private String is_attachment;
|
||||
|
||||
private String is_reversed;
|
||||
|
||||
private String is_mvout_auto_cfm;
|
||||
|
||||
private String is_mvin_auto_cfm;
|
||||
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String storea_ddress;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String principal;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String office_phone;
|
||||
|
||||
private String mobile_no;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private BigDecimal order_index;
|
||||
|
||||
private String whstate_scode;
|
||||
|
||||
/**
|
||||
@@ -106,8 +78,6 @@ public class Storattr implements Serializable {
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
private String base_class_id;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String create_name;
|
||||
@@ -131,8 +101,4 @@ public class Storattr implements Serializable {
|
||||
private String ext_id;
|
||||
|
||||
private String depart_name;
|
||||
|
||||
private String company_name;
|
||||
|
||||
private String is_attachment;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
<mapper namespace="org.nl.wms.basedata.master.storattr.service.dao.mapper.StorattrMapper">
|
||||
|
||||
<select id="queryAll" resultType="org.nl.wms.basedata.master.storattr.service.dao.Storattr">
|
||||
SELECT stor.*,
|
||||
detail.label
|
||||
SELECT stor.*
|
||||
FROM st_ivt_bsrealstorattr stor
|
||||
LEFT JOIN sys_dict detail ON detail.value = stor.stor_type_scode AND detail.code = 'st_stor_type'
|
||||
<where>
|
||||
stor.is_delete = '0'
|
||||
<if test="search != null">
|
||||
@@ -19,7 +17,6 @@
|
||||
<select id="queryAllTotal" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM st_ivt_bsrealstorattr stor
|
||||
LEFT JOIN sys_dict detail ON detail.value = stor.stor_type_scode AND detail.code = 'st_stor_type'
|
||||
<where>
|
||||
stor.is_delete = '0'
|
||||
<if test="map.search != null">
|
||||
|
||||
@@ -47,18 +47,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库容量" prop="stor_capacity">
|
||||
<el-input v-model="form.stor_capacity" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="总面积(㎡)" prop="total_area">
|
||||
<el-input v-model="form.total_area" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库性质" prop="stor_type_scode">
|
||||
@@ -76,23 +64,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库地址">
|
||||
<el-input v-model="form.storea_ddress" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人">
|
||||
<el-input v-model="form.principal" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="office_phone">
|
||||
<el-input v-model="form.office_phone" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-form-item label="仓库类型" required>
|
||||
@@ -141,12 +112,7 @@
|
||||
<el-table-column prop="stor_code" label="仓库编码" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" width="150" />
|
||||
<el-table-column prop="simple_name" label="简称" width="130" />
|
||||
<el-table-column prop="stor_capacity" label="容量" />
|
||||
<el-table-column prop="total_area" width="100px" label="总面积(㎡)" />
|
||||
<el-table-column prop="label" label="仓库性质" />
|
||||
<el-table-column prop="storea_ddress" label="地址" />
|
||||
<el-table-column prop="principal" label="负责人" />
|
||||
<el-table-column prop="office_phone" label="联系电话" width="130" />
|
||||
<el-table-column prop="stor_type_scode" label="仓库性质" />
|
||||
<el-table-column prop="ext_id" label="外部标识" width="130" />
|
||||
<el-table-column label="是否启用" align="center" prop="is_used">
|
||||
<template slot-scope="scope">
|
||||
@@ -160,7 +126,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column
|
||||
v-permission="['admin','stIvtBsrealstorattr:edit','stIvtBsrealstorattr:del']"
|
||||
v-permission="['admin','stor:edit','stor:del']"
|
||||
label="操作"
|
||||
fixed="right"
|
||||
width="120px"
|
||||
@@ -187,55 +153,37 @@ 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 { getDepts, getDeptSuperior } from '@/views/system/dept/dept'
|
||||
import { isvalidPhone } from '@/utils/validate'
|
||||
|
||||
const defaultForm = {
|
||||
stor_id: null,
|
||||
stor_code: null,
|
||||
stor_name: null,
|
||||
simple_name: null,
|
||||
stor_capacity: null,
|
||||
total_area: null,
|
||||
stor_type_scode: null,
|
||||
is_virtualstore: null,
|
||||
is_semi_finished: null,
|
||||
is_attachment: null,
|
||||
is_materialstore: null,
|
||||
is_productstore: null,
|
||||
is_reversed: null,
|
||||
is_mvout_auto_cfm: null,
|
||||
is_mvin_auto_cfm: null,
|
||||
area: null,
|
||||
storea_ddress: null,
|
||||
principal: null,
|
||||
office_phone: null,
|
||||
mobile_no: null,
|
||||
remark: null,
|
||||
order_index: null,
|
||||
whstate_scode: null,
|
||||
is_used: '1',
|
||||
base_class_id: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
sysownerid: null,
|
||||
sysdeptid: null,
|
||||
syscompanyid: null,
|
||||
is_delete: null,
|
||||
ext_id: null,
|
||||
depart_name: null,
|
||||
company_name: null,
|
||||
is_attachment: null
|
||||
depart_name: null
|
||||
|
||||
}
|
||||
export default {
|
||||
name: 'StIvtBsrealstorattr',
|
||||
name: 'Stor',
|
||||
dicts: ['st_stor_type', 'is_used'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -243,64 +191,29 @@ export default {
|
||||
optShow: { add: true, reset: true },
|
||||
url: 'api/Storattr',
|
||||
idField: 'stor_id',
|
||||
sort: 'stor_id,desc',
|
||||
sort: '',
|
||||
crudMethod: { ...crudStorattr }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
const validPhone = (rule, value, callback) => {
|
||||
if (value && !isvalidPhone(value)) {
|
||||
callback(new Error('请输入正确的11位手机号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const numberOne = (rule, value, callback) => {
|
||||
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
||||
const numRe = new RegExp(numReg)
|
||||
if (value) {
|
||||
if (!numRe.test(value)) {
|
||||
callback(new Error('只能输入数字'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
depts: [],
|
||||
permission: {},
|
||||
permission: {
|
||||
add: ['admin', 'stor:add'],
|
||||
edit: ['admin', 'stor:edit'],
|
||||
del: ['admin', 'stor:del']
|
||||
},
|
||||
rules: {
|
||||
stor_code: [
|
||||
{ required: true, message: '仓库编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_name: [
|
||||
{ required: true, message: '仓库名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_capacity: [
|
||||
{ required: false, message: '不能为空', trigger: 'blur' },
|
||||
{ validator: numberOne }
|
||||
],
|
||||
total_area: [
|
||||
{ required: false, message: '不能为空', trigger: 'blur' },
|
||||
{ validator: numberOne }
|
||||
],
|
||||
office_phone: [
|
||||
{ required: false, trigger: 'blur', validator: validPhone }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 新增与编辑前做的操作
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
if (form.id == null) {
|
||||
this.getDepts()
|
||||
} else {
|
||||
this.getSupDepts(form.dept.id)
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit](crud, form) {
|
||||
if (this.form.is_virtualstore === '0' && this.form.is_semi_finished === '0' && this.form.is_materialstore === '0' &&
|
||||
this.form.is_productstore === '0' && this.form.is_attachment === '0') {
|
||||
@@ -313,16 +226,6 @@ export default {
|
||||
return false
|
||||
}
|
||||
},
|
||||
getDepts() {
|
||||
getDepts({ enabled: true }).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
// 改变状态
|
||||
format_is_used(is_used) {
|
||||
return is_used === '1'
|
||||
@@ -346,38 +249,6 @@ export default {
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
getSupDepts(deptId) {
|
||||
getDeptSuperior(deptId).then(res => {
|
||||
const date = res.content
|
||||
this.buildDepts(date)
|
||||
this.depts = date
|
||||
})
|
||||
},
|
||||
buildDepts(depts) {
|
||||
depts.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildDepts(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null
|
||||
}
|
||||
})
|
||||
},
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 200)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user