diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea7..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -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. diff --git a/src/application/mk/libs/function/form.js b/src/application/mk/libs/function/form.js index 5a66510..a2df18d 100644 --- a/src/application/mk/libs/function/form.js +++ b/src/application/mk/libs/function/form.js @@ -37,9 +37,31 @@ export default { if (!value) { value = 0; } + if(value === true){ + value = 1; + } + if(value === false){ + value = 1; + } 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") { // 如果是整数 if(value == null){ data[saveField] = null; @@ -115,6 +137,9 @@ export default { } } + if(rule.dataRule.type == "bool"){ + data[rule.field] = data[rule.field] ? true :false; + } } }); }; diff --git a/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/Edit.vue b/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/Edit.vue index 55ac1a4..53e439b 100644 --- a/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/Edit.vue +++ b/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/Edit.vue @@ -37,7 +37,7 @@ export default { created() { this.optionsInit(); - this.dataInit(); + this.dataInit(); }, // 函数 @@ -58,70 +58,63 @@ export default { listPageUrl: "/MesWarehouse/MesWarehouseList", - uploadDefaultImg: null, - detailDataFieldName: "mes_warehouse", + uploadDefaultImg: null, + detailDataFieldName: "mes_warehouse", - actions: { - // =============================== 接口地址 自动生成 Start =============================== - MesWarehouseList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`, // 仓库列表 - MesWarehouseDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detail`, // 仓库详情 - MesWarehouseCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/create`, // 创建仓库 - MesWarehouseUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/update`, // 更新仓库 - MesWarehouseDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detele`, // 删除仓库 - MesWarehouseBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchDelete`, // 批量删除仓库 - MesWarehouseBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchUpdate`, // 批量更新仓库 - MesWarehouseBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchCreate`, // 批量创建仓库 - MesWarehouseExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/export/excel`, // 导出仓库数据到EXCEL - MesWarehouseImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/import/excel`, // 批量导入EXCEL仓库数据 - WarehouseLocationList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`, // 仓库库位列表 - WarehouseLocationDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detail`, // 仓库库位详情 - WarehouseLocationCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/create`, // 创建仓库库位 - WarehouseLocationUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/update`, // 更新仓库库位 - WarehouseLocationDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detele`, // 删除仓库库位 - WarehouseLocationBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchDelete`, // 批量删除仓库库位 - WarehouseLocationBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchUpdate`, // 批量更新仓库库位 - WarehouseLocationBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchCreate`, // 批量创建仓库库位 - WarehouseLocationExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/export/excel`, // 导出仓库库位数据到EXCEL - WarehouseLocationImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/import/excel`, // 批量导入EXCEL仓库库位数据 + actions: { + // =============================== 接口地址 自动生成 Start =============================== + MesWarehouseList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`, // 仓库列表 + MesWarehouseDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detail`, // 仓库详情 + MesWarehouseCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/create`, // 创建仓库 + MesWarehouseUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/update`, // 更新仓库 + MesWarehouseDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detele`, // 删除仓库 + MesWarehouseBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchDelete`, // 批量删除仓库 + MesWarehouseBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchUpdate`, // 批量更新仓库 + MesWarehouseBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchCreate`, // 批量创建仓库 + MesWarehouseExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/export/excel`, // 导出仓库数据到EXCEL + MesWarehouseImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/import/excel`, // 批量导入EXCEL仓库数据 + WarehouseLocationList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`, // 仓库库位列表 + WarehouseLocationDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detail`, // 仓库库位详情 + WarehouseLocationCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/create`, // 创建仓库库位 + WarehouseLocationUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/update`, // 更新仓库库位 + WarehouseLocationDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detele`, // 删除仓库库位 + WarehouseLocationBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchDelete`, // 批量删除仓库库位 + WarehouseLocationBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchUpdate`, // 批量更新仓库库位 + WarehouseLocationBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchCreate`, // 批量创建仓库库位 + WarehouseLocationExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/export/excel`, // 导出仓库库位数据到EXCEL + WarehouseLocationImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/import/excel`, // 批量导入EXCEL仓库库位数据 - // =============================== 接口地址 自动生成 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 =============================== + // =============================== 接口地址 自动生成 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, // 标题对齐方式 @@ -133,37 +126,62 @@ export default { code: [ { required: true, message: '请输入编码' } - ] , + ], warehouse_name: [ { required: true, message: '请输入仓库名称' } - ] + ] // =============================== 表单校验 自动生成 End =============================== }, // 表单项 items: [ // =============================== 表单项 自动生成 Start =============================== - { field: 'code', title: '编码', span: 6, itemRender: { name: '$input' } }, - //{ field: 'warehouse_title', title: '仓库名称', span: 12, itemRender: { name: '$input' } }, - { field: 'warehouse_title', title: '仓库名称', span: 8, 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: 8, itemRender: { name: '$input' } }, { field: 'warehouse_name', 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_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_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} } }, + { 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_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_phone', title: '仓库电话', span: 12, itemRender: { name: '$input' } }, - // =============================== 表单项 自动生成 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.create = pageData.actions.MesWarehouseCreate; - pageData.actions.update = pageData.actions.MesWarehouseUpdate; + pageData.actions.get = pageData.actions.MesWarehouseDetail; + pageData.actions.create = pageData.actions.MesWarehouseCreate; + 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; }, @@ -202,26 +220,23 @@ export default { }).then(a => { 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); - } - if(a.data[detailDataFieldName].warehouse_invalid_date){ - a.data[detailDataFieldName].warehouse_invalid_date = new Date(a.data[detailDataFieldName].warehouse_invalid_date * 1000); - } - if (a.data[detailDataFieldName].create_time) { - a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000); - } - if (a.data[detailDataFieldName].update_time) { - a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000); - } + + let rules = [ + { field: "warehouse_effective_date", dataRule: "timestamp" }, + { field: "warehouse_invalid_date", dataRule: "timestamp" }, + { field: "create_time", dataRule: "timestamp" }, + { field: "update_time", dataRule: "timestamp" }, + ]; + rules = []; //上面几个字段如果不需要在表单显示,可以不转换(不转换的话,表单拿到的是什么数据,提交的时候就是什么数据) + this.$mk.formatInitFormData({ data: a.data[detailDataFieldName], rules: [...this.pageOptions.formOptions.items, ...rules] }); //建议固定格式化写法 this.pageOptions.formOptions.data = a.data[detailDataFieldName]; - + this.$forceUpdate() }).catch((a) => { this.$mk.error(a.data.msg); }); - + this.pageOptions.isEdit = true; this.$forceUpdate() @@ -244,7 +259,7 @@ export default { dataId = 0; } return dataId; - } + } }, // 监听属性 watch: { diff --git a/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/PositionEdit.vue b/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/PositionEdit.vue index 22b34c3..44e64fc 100644 --- a/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/PositionEdit.vue +++ b/src/pages/Middle/Mes/MesWarehouse/MesWarehouse/PositionEdit.vue @@ -150,13 +150,59 @@ export default { items: [ // =============================== 表单项 自动生成 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: 'warehouse_location_code', 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 =============================== ] @@ -196,18 +242,16 @@ export default { }).then(a => { 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); - } - if(a.data[detailDataFieldName].warehouse_invalid_date){ - a.data[detailDataFieldName].warehouse_invalid_date = new Date(a.data[detailDataFieldName].warehouse_invalid_date * 1000); - } - if (a.data[detailDataFieldName].create_time) { - a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000); - } - if (a.data[detailDataFieldName].update_time) { - a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000); - } + + let rules = [ + {field:"warehouse_effective_date",dataRule:"timestamp"}, + {field:"warehouse_invalid_date",dataRule:"timestamp"}, + {field:"create_time",dataRule:"timestamp"}, + {field:"update_time",dataRule:"timestamp"}, + ]; + rules = []; //上面几个字段如果不需要在表单显示,可以不转换(不转换的话,表单拿到的是什么数据,提交的时候就是什么数据) + this.$mk.formatInitFormData({data: a.data[detailDataFieldName] , rules:[...this.pageOptions.formOptions.items,...rules] }); //建议固定格式化写法 + this.pageOptions.formOptions.data = a.data[detailDataFieldName]; this.$forceUpdate() @@ -241,10 +285,6 @@ export default { }, // 监听属性 watch: { - // 将 warehouse_id 转换为 数字 - 'pageOptions.formOptions.data.warehouse_id': function (val) { - this.pageOptions.formOptions.data.warehouse_id = parseInt(val); - }, } };