diff --git a/public/importTemplates/materialImport.xlsx b/public/importTemplates/materialImport.xlsx index 35ffa00..c7bd88f 100644 Binary files a/public/importTemplates/materialImport.xlsx and b/public/importTemplates/materialImport.xlsx differ diff --git a/public/importTemplates/productImport.xlsx b/public/importTemplates/productImport.xlsx new file mode 100644 index 0000000..35ffa00 Binary files /dev/null and b/public/importTemplates/productImport.xlsx differ diff --git a/public/index.html b/public/index.html index 11c8690..78aa5e3 100644 --- a/public/index.html +++ b/public/index.html @@ -39,8 +39,8 @@ <% } %> diff --git a/src/views/modules/pms/equipment/config.js b/src/views/modules/pms/equipment/config.js index 742230b..923c136 100644 --- a/src/views/modules/pms/equipment/config.js +++ b/src/views/modules/pms/equipment/config.js @@ -56,10 +56,13 @@ export default function () { }, { button: { - type: 'plain', + type: 'primary', name: '新增', permission: 'pms:equipment:save' - } + }, + bind: { + plain: true, + }, } ] diff --git a/src/views/modules/pms/material/components/ListViewWithHead.vue b/src/views/modules/pms/material/components/ListViewWithHead.vue index 7ff6556..6ed361f 100644 --- a/src/views/modules/pms/material/components/ListViewWithHead.vue +++ b/src/views/modules/pms/material/components/ListViewWithHead.vue @@ -9,43 +9,24 @@ - + - + - + - + + + @@ -54,6 +35,7 @@ import BaseListTable from "./BaseListTable.vue"; import BaseSearchForm from "@/components/BaseSearchForm.vue"; import DialogWithMenu from "@/components/DialogWithMenu.vue"; import DialogJustForm from "./DialogJustForm.vue"; +import DialogUpload from "@/components/DialogUpload.vue"; const DIALOG_WITH_MENU = "DialogWithMenu"; const DIALOG_JUST_FORM = "DialogJustForm"; @@ -61,7 +43,7 @@ const dictList = JSON.parse(localStorage.getItem("dictList")); export default { name: "ListViewWithHead", - components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm }, + components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogUpload }, props: { tableConfig: { type: Object, @@ -104,6 +86,7 @@ export default { dataList: [], tableLoading: false, subdialogVisible: false, + uploadDialogVisible: false, subdialogConfigs: { form: { rows: [ @@ -214,9 +197,9 @@ export default { const params = queryParams ? { ...queryParams, page: this.page, limit: this.size } : { - page: this.page, - limit: this.size, - }; + page: this.page, + limit: this.size, + }; if (!queryParams && this.listQueryExtra.length) { this.listQueryExtra.map((name) => { @@ -228,7 +211,7 @@ export default { .get(this.urls.page, { params: { ...params, - parentId: "0", + // parentId: "0", }, }) .then(({ data: res }) => { @@ -280,7 +263,7 @@ export default { } }); }) - .catch((err) => {}); + .catch((err) => { }); } case "edit": { this.openDialog(data); /** data is ==> id */ @@ -318,7 +301,16 @@ export default { }, handleRefreshDatalist() { - location.reload(); + // location.reload(); + this.getList() + }, + + openUploadDialog() { + this.uploadDialogVisible = true; + + this.$nextTick(() => { + this.$refs["upload-dialog"].init(); + }); }, handleBtnClick({ btnName, payload }) { @@ -331,6 +323,9 @@ export default { this.getList(payload); break; } + case "导入": + this.openUploadDialog(); + break; } }, diff --git a/src/views/modules/pms/material/config.js b/src/views/modules/pms/material/config.js index 50d0c76..59c8b76 100644 --- a/src/views/modules/pms/material/config.js +++ b/src/views/modules/pms/material/config.js @@ -5,18 +5,18 @@ import { timeFilter, dictFilter } from "@/utils/filters"; export default function () { const tableProps = [ - { type: 'index', label: '序号' }, - { prop: "code", label: "原料编码" }, - { prop: "description", label: "原料描述", }, - { prop: "name", label: "原料名称" }, - { prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} }, + { type: "index", label: "序号" }, + { width: 90, prop: "code", label: "原料编码" }, + { width: 240, prop: "description", label: "原料描述" }, + { width: 90, prop: "name", label: "原料名称" }, + { width: 90, prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} }, { prop: "baseMaterialCode", label: "基础原料编码" }, { prop: "baseMaterialDescription", label: "基础原料描述" }, // { prop: "type", label: "原料类型" }, - { prop: "density", label: "堆积密度" }, + { width: 90, prop: "density", label: "堆积密度" }, // { prop: "brandsOwner", label: "品牌" }, - { prop: "dosLow", label: "加料下限" }, - { prop: "dosHigh", label: "加料上限" }, + { width: 90, prop: "dosLow", label: "加料下限" }, + { width: 90, prop: "dosHigh", label: "加料上限" }, // { prop: "description", label: "详情", subcomponent: TableTextComponent }, // { prop: "remark", label: "中文描述" }, { prop: "createTime", label: "添加时间", filter: timeFilter }, @@ -30,7 +30,8 @@ export default function () { options: [ // { name: "add-sub", permission: "pms:material:save" }, { name: "edit", label: "编辑", icon: "edit-outline" }, - { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:material:save" },], + { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:material:save" }, + ], }, ]; @@ -58,6 +59,16 @@ export default function () { plain: true, }, }, + { + button: { + type: "success", + name: "导入", + permission: "", + }, + bind: { + plain: true, + }, + }, ]; /** @@ -90,7 +101,6 @@ export default function () { elparams: { placeholder: "请输入原料编码" }, }, { input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } }, - ], [ // { @@ -135,8 +145,8 @@ export default function () { label: "基础原料", prop: "baseMaterialId", options: [], - optionLabel: 'code', - fetchData: () => this.$http.get('/pms/baseMaterial/page', { params: { limit: 999, page: 1, key: '' } }), + optionLabel: "code", + fetchData: () => this.$http.get("/pms/baseMaterial/page", { params: { limit: 999, page: 1, key: "" } }), elparams: { placeholder: "请选择基础原料" }, }, { input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } }, @@ -155,7 +165,7 @@ export default function () { prop: "dosLow", rules: [ { required: true, message: "必填项不能为空", trigger: "blur" }, - { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) }, + { type: "number", message: "请输入正确的数字类型", trigger: "blur", transform: (val) => Number(val) }, ], elparams: { placeholder: "请输入加料下限" }, }, @@ -165,7 +175,7 @@ export default function () { prop: "dosHigh", rules: [ { required: true, message: "必填项不能为空", trigger: "blur" }, - { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) }, + { type: "number", message: "请输入正确的数字类型", trigger: "blur", transform: (val) => Number(val) }, ], elparams: { placeholder: "请输入加料上限" }, }, @@ -206,7 +216,7 @@ export default function () { // extraParams: ['stepId'], extraParams: "materialId", props: [ - { type: 'index', label: '序号' }, + { type: "index", label: "序号" }, { prop: "name", label: "属性名", isEditField: true }, { prop: "value", label: "属性值", isEditField: true }, { prop: "createTime", label: "添加时间", filter: timeFilter }, @@ -231,15 +241,9 @@ export default function () { extraParam: "materialId", forceAttachCode: true, rows: [ - [ - { input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } } - ], - [ - { input: true, label: "属性值", prop: "value", elparams: { placeholder: "请输入属性值" } } - ], - [ - { input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } }, - ] + [{ input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } }], + [{ input: true, label: "属性值", prop: "value", elparams: { placeholder: "请输入属性值" } }], + [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } }], ], operations: [ { name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false }, @@ -266,6 +270,8 @@ export default function () { tree: "/pms/material/tree", subase: "/pms/materialArrt", subpage: "/pms/materialArrt/page", + importUrl: "/pms/material/importExcel", + templateUrl: "/importTemplates/materialImport.xlsx", // more... }, }; diff --git a/src/views/modules/pms/product/config.js b/src/views/modules/pms/product/config.js index 1aea499..46116d8 100644 --- a/src/views/modules/pms/product/config.js +++ b/src/views/modules/pms/product/config.js @@ -57,17 +57,23 @@ export default function () { }, { button: { - type: "plain", + type: "primary", name: "新增", permission: "pms:product:save", }, + bind: { + plain: true + } }, { button: { - type: "plain", + type: "success", name: "导入", permission: "", }, + bind: { + plain: true + } }, ]; @@ -220,7 +226,7 @@ export default function () { subase: "/pms/productArrt", subpage: "/pms/productArrt/page", importUrl: "/pms/product/import", - templateUrl: '/importTemplates/materialImport.xlsx' + templateUrl: '/importTemplates/productImport.xlsx' }, }; }