仓库#285、仓位#286

This commit is contained in:
xielue 2023-11-16 10:17:45 +08:00
parent 329c2e87db
commit 6cea75b993
5 changed files with 201 additions and 179 deletions

View File

@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -37,9 +37,31 @@ export default {
if (!value) { if (!value) {
value = 0; value = 0;
} }
if(value === true){
value = 1;
}
if(value === false){
value = 1;
}
data[saveField] = parseInt(value); // 转换为整数 data[saveField] = parseInt(value); // 转换为整数
} }
} }
if (rule.dataRule.type == "bool") { // 如果是布尔
if(value == null){
data[saveField] = null;
}else{
if (!value) {
value = 0;
}
if(value === true){
value = 1;
}
if(value === false){
value = 1;
}
data[saveField] = value ? 1 : 0;
}
}
else if (rule.dataRule.type == "number" || rule.dataRule.type == "float") { // 如果是整数 else if (rule.dataRule.type == "number" || rule.dataRule.type == "float") { // 如果是整数
if(value == null){ if(value == null){
data[saveField] = null; data[saveField] = null;
@ -115,6 +137,9 @@ export default {
} }
} }
if(rule.dataRule.type == "bool"){
data[rule.field] = data[rule.field] ? true :false;
}
} }
}); });
}; };

View File

@ -37,7 +37,7 @@ export default {
created() { created() {
this.optionsInit(); this.optionsInit();
this.dataInit(); this.dataInit();
}, },
// //
@ -58,70 +58,63 @@ export default {
listPageUrl: "/MesWarehouse/MesWarehouseList", listPageUrl: "/MesWarehouse/MesWarehouseList",
uploadDefaultImg: null, uploadDefaultImg: null,
detailDataFieldName: "mes_warehouse", detailDataFieldName: "mes_warehouse",
actions: { actions: {
// =============================== Start =============================== // =============================== Start ===============================
MesWarehouseList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`, // MesWarehouseList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`, //
MesWarehouseDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detail`, // MesWarehouseDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detail`, //
MesWarehouseCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/create`, // MesWarehouseCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/create`, //
MesWarehouseUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/update`, // MesWarehouseUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/update`, //
MesWarehouseDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detele`, // MesWarehouseDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detele`, //
MesWarehouseBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchDelete`, // MesWarehouseBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchDelete`, //
MesWarehouseBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchUpdate`, // MesWarehouseBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchUpdate`, //
MesWarehouseBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchCreate`, // MesWarehouseBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchCreate`, //
MesWarehouseExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/export/excel`, // EXCEL MesWarehouseExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/export/excel`, // EXCEL
MesWarehouseImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/import/excel`, // EXCEL MesWarehouseImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/import/excel`, // EXCEL
WarehouseLocationList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`, // WarehouseLocationList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`, //
WarehouseLocationDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detail`, // WarehouseLocationDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detail`, //
WarehouseLocationCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/create`, // WarehouseLocationCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/create`, //
WarehouseLocationUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/update`, // WarehouseLocationUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/update`, //
WarehouseLocationDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detele`, // WarehouseLocationDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detele`, //
WarehouseLocationBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchDelete`, // WarehouseLocationBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchDelete`, //
WarehouseLocationBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchUpdate`, // WarehouseLocationBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchUpdate`, //
WarehouseLocationBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchCreate`, // WarehouseLocationBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchCreate`, //
WarehouseLocationExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/export/excel`, // EXCEL WarehouseLocationExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/export/excel`, // EXCEL
WarehouseLocationImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/import/excel`, // EXCEL WarehouseLocationImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/import/excel`, // EXCEL
// =============================== End =============================== // =============================== End ===============================
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
// =============================== Start ===============================
id: 0,
code: "",
warehouse_title: "",
warehouse_name: "",
warehouse_code: "",
warehouse_type: "",
warehouse_address: "",
warehouse_uid: 0,
warehouse_uname: "",
warehouse_mobile: "",
warehouse_phone: "",
warehouse_remark: "",
warehouse_negative_stock: 0,
warehouse_location: 1,
warehouse_batch: 1,
warehouse_serial: 1,
warehouse_storage_type: 1,
warehouse_effective_date: new Date(2100, 1, 1).getTime() / 10000,
warehouse_invalid_date: new Date(2100, 1, 1).getTime() / 10000,
warehouse_status: 0,
create_uid: 0,
update_uid: 0,
create_time: new Date(2100, 1, 1).getTime() / 10000,
update_time: new Date(2100, 1, 1).getTime() / 10000,
// =============================== End ===============================
}, },
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
id: 0,
code: "",
warehouse_title: "",
warehouse_name: "",
warehouse_code: "",
warehouse_type: "",
warehouse_address: "",
warehouse_uid: 0,
warehouse_uname: "",
warehouse_mobile: "",
warehouse_phone: "",
warehouse_remark: "",
warehouse_negative_stock: 0,
warehouse_location: 1,
warehouse_batch: 1,
warehouse_serial: 1,
warehouse_storage_type: 1,
warehouse_status: 0,
create_uid: 0,
update_uid: 0,
},
// //
titleWidth: 150, titleWidth: 150,
// //
@ -133,37 +126,62 @@ export default {
code: [ code: [
{ required: true, message: '请输入编码' } { required: true, message: '请输入编码' }
] , ],
warehouse_name: [ warehouse_name: [
{ required: true, message: '请输入仓库名称' } { required: true, message: '请输入仓库名称' }
] ]
// =============================== End =============================== // =============================== End ===============================
}, },
// //
items: [ items: [
// =============================== Start =============================== // =============================== Start ===============================
{ field: 'code', title: '编码', span: 6, itemRender: { name: '$input' } }, { field: 'code', title: '编码', span: 6, itemRender: { name: '$input' } },
//{ field: 'warehouse_title', title: '', span: 12, itemRender: { name: '$input' } }, //{ field: 'warehouse_title', title: '', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_title', title: '仓库名称', span: 8, itemRender: { name: '$input' } }, { field: 'warehouse_title', title: '仓库名称', span: 8, itemRender: { name: '$input' } },
{ field: 'warehouse_name', title: '英文名称', span: 6, itemRender: { name: '$input' } }, { field: 'warehouse_name', title: '英文名称', span: 6, itemRender: { name: '$input' } },
{ field: 'warehouse_code', title: '仓库编号', span: 6, itemRender: { name: '$input' } }, { field: 'warehouse_code', title: '仓库编号', span: 6, itemRender: { name: '$input' } },
{ field: 'warehouse_type', title: '仓库类型', span: 6, itemRender: { name: '$select',props:{options:settings.options_warehouse_type} } }, { field: 'warehouse_type', title: '仓库类型', span: 6, itemRender: { name: '$select', props: { options: settings.options_warehouse_type } } },
{ field: 'warehouse_storage_type', title: '存储类型', span: 6, itemRender: { name: '$select',props:{options:settings.options_warehouse_storage_type} } }, { field: 'warehouse_storage_type', title: '存储类型', span: 6, itemRender: { name: '$select', props: { options: settings.options_warehouse_storage_type } } },
{ field: 'warehouse_address', title: '仓库地址', span: 12, itemRender: { name: '$input' } }, { field: 'warehouse_address', title: '仓库地址', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_phone', title: '仓库电话', span: 12, itemRender: { name: '$input' } }, { field: 'warehouse_phone', title: '仓库电话', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_uid', title: '仓库负责人', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_mobile', title: '仓库负责人手机号', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_remark', title: '仓库备注', span: 24, itemRender: { name: '$input' } },
{ field: 'warehouse_status', title: '仓库状态', span: 4, itemRender: { name: '$switch',props:{options:settings.options_is_enabled} } },
{ field: 'warehouse_negative_stock', title: '仓库是否允许负库存', span: 4, itemRender: { name: '$switch',props:{options:settings.options_warehouse_negative_stock} } },
{ field: 'warehouse_location', title: '是否启用库位管理', span: 4, itemRender: { name: '$switch',props:{options:settings.options_is_open} } },
{ field: 'warehouse_batch', title: '是否启用批次管理', span: 4, itemRender: { name: '$switch',props:{options:settings.options_is_open} } },
{ field: 'warehouse_serial', title: '是否启用序列号', span: 4, itemRender: { name: '$switch',props:{options:settings.options_is_open} } },
// =============================== End =============================== {
title: '仓库负责人', span: 12,
field: 'warehouse_uname',
dataRule: {
fromField: "id",
saveField: "warehouse_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
}
}
}
},
{ field: 'warehouse_mobile', title: '仓库负责人手机号', span: 12, itemRender: { name: 'MkFormInputShow' } },
{ field: 'warehouse_remark', title: '仓库备注', span: 24, itemRender: { name: '$input' } },
{ field: 'warehouse_status', title: '仓库状态', dataRule: { type: 'bool' }, span: 4, itemRender: { name: '$switch', props: { options: settings.options_is_enabled } } },
{ field: 'warehouse_negative_stock', dataRule: { type: 'bool' }, title: '仓库是否允许负库存', span: 4, itemRender: { name: '$switch', props: { options: settings.options_warehouse_negative_stock } } },
{ field: 'warehouse_location', dataRule: { type: 'bool' }, title: '是否启用库位管理', span: 4, itemRender: { name: '$switch', props: { options: settings.options_is_open } } },
{ field: 'warehouse_batch', dataRule: { type: 'bool' }, title: '是否启用批次管理', span: 4, itemRender: { name: '$switch', props: { options: settings.options_is_open } } },
{ field: 'warehouse_serial', dataRule: { type: 'bool' }, title: '是否启用序列号', span: 4, itemRender: { name: '$switch', props: { options: settings.options_is_open } } },
// =============================== End ===============================
] ]
}, },
// //
@ -174,12 +192,12 @@ export default {
}; };
pageData.actions.get = pageData.actions.MesWarehouseDetail; pageData.actions.get = pageData.actions.MesWarehouseDetail;
pageData.actions.create = pageData.actions.MesWarehouseCreate; pageData.actions.create = pageData.actions.MesWarehouseCreate;
pageData.actions.update = pageData.actions.MesWarehouseUpdate; pageData.actions.update = pageData.actions.MesWarehouseUpdate;
// //
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions); pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
this.pageOptions = pageData; this.pageOptions = pageData;
}, },
@ -202,26 +220,23 @@ export default {
}).then(a => { }).then(a => {
let detailDataFieldName = this.pageOptions.detailDataFieldName; let detailDataFieldName = this.pageOptions.detailDataFieldName;
if(a.data[detailDataFieldName].warehouse_effective_date){
a.data[detailDataFieldName].warehouse_effective_date = new Date(a.data[detailDataFieldName].warehouse_effective_date * 1000); let rules = [
} { field: "warehouse_effective_date", dataRule: "timestamp" },
if(a.data[detailDataFieldName].warehouse_invalid_date){ { field: "warehouse_invalid_date", dataRule: "timestamp" },
a.data[detailDataFieldName].warehouse_invalid_date = new Date(a.data[detailDataFieldName].warehouse_invalid_date * 1000); { field: "create_time", dataRule: "timestamp" },
} { field: "update_time", dataRule: "timestamp" },
if (a.data[detailDataFieldName].create_time) { ];
a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000); rules = []; //
} this.$mk.formatInitFormData({ data: a.data[detailDataFieldName], rules: [...this.pageOptions.formOptions.items, ...rules] }); //
if (a.data[detailDataFieldName].update_time) {
a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000);
}
this.pageOptions.formOptions.data = a.data[detailDataFieldName]; this.pageOptions.formOptions.data = a.data[detailDataFieldName];
this.$forceUpdate() this.$forceUpdate()
}).catch((a) => { }).catch((a) => {
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
this.pageOptions.isEdit = true; this.pageOptions.isEdit = true;
this.$forceUpdate() this.$forceUpdate()
@ -244,7 +259,7 @@ export default {
dataId = 0; dataId = 0;
} }
return dataId; return dataId;
} }
}, },
// //
watch: { watch: {

View File

@ -150,13 +150,59 @@ export default {
items: [ items: [
// =============================== Start =============================== // =============================== Start ===============================
{ field: 'warehouse_id', title: '选择仓库', span: 12, itemRender: { name: '$input' } },
{
title: '仓库', span: 12,
field: 'warehouse_detail',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_title",
columns: [
{ field: 'warehouse_title', title: '名称' },
{ field: 'code', title: '编码' }
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`
}
}
}
},
{ field: 'code', title: '编码', span: 12, itemRender: { name: '$input' } }, { field: 'code', title: '编码', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_code', title: '库位编码', span: 12, itemRender: { name: '$input' } }, { field: 'warehouse_location_code', title: '库位编码', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_name', title: '库位名称', span: 12, itemRender: { name: '$input' } }, { field: 'warehouse_location_name', title: '库位名称', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_keeper_uid', title: '选择管理员', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_status', title: '库位状态', span: 12, itemRender: { name: '$switch' } },
{ field: 'is_default', title: '是否默认库位', span: 12, itemRender: { name: '$switch' } }, {
title: '管理员', span: 12,
field: 'warehouse_location_keeper_uname',
dataRule: {
fromField: "id",
saveField: "warehouse_location_keeper_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`
}
}
}
},
{ field: 'warehouse_location_status', title: '库位状态', span: 12, itemRender: { name: '$switch' }, dataRule: { type: 'bool' } },
{ field: 'is_default', title: '是否默认库位', span: 12, itemRender: { name: '$switch' }, dataRule: { type: 'bool' } },
// =============================== End =============================== // =============================== End ===============================
] ]
@ -196,18 +242,16 @@ export default {
}).then(a => { }).then(a => {
let detailDataFieldName = this.pageOptions.detailDataFieldName; let detailDataFieldName = this.pageOptions.detailDataFieldName;
if(a.data[detailDataFieldName].warehouse_effective_date){
a.data[detailDataFieldName].warehouse_effective_date = new Date(a.data[detailDataFieldName].warehouse_effective_date * 1000); let rules = [
} {field:"warehouse_effective_date",dataRule:"timestamp"},
if(a.data[detailDataFieldName].warehouse_invalid_date){ {field:"warehouse_invalid_date",dataRule:"timestamp"},
a.data[detailDataFieldName].warehouse_invalid_date = new Date(a.data[detailDataFieldName].warehouse_invalid_date * 1000); {field:"create_time",dataRule:"timestamp"},
} {field:"update_time",dataRule:"timestamp"},
if (a.data[detailDataFieldName].create_time) { ];
a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000); rules = []; //
} this.$mk.formatInitFormData({data: a.data[detailDataFieldName] , rules:[...this.pageOptions.formOptions.items,...rules] }); //
if (a.data[detailDataFieldName].update_time) {
a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000);
}
this.pageOptions.formOptions.data = a.data[detailDataFieldName]; this.pageOptions.formOptions.data = a.data[detailDataFieldName];
this.$forceUpdate() this.$forceUpdate()
@ -241,10 +285,6 @@ export default {
}, },
// //
watch: { watch: {
// warehouse_id
'pageOptions.formOptions.data.warehouse_id': function (val) {
this.pageOptions.formOptions.data.warehouse_id = parseInt(val);
},
} }
}; };