update 原料上传

This commit is contained in:
lb 2023-04-23 10:13:02 +08:00
parent 03aa4effa9
commit 5f33d3743f
7 changed files with 80 additions and 70 deletions

Binary file not shown.

View File

@ -39,8 +39,8 @@
<script> <script>
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am'; // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
// window.SITE_CONFIG['apiURL'] = 'http://localhost:3000/pms-am'; // xv // window.SITE_CONFIG['apiURL'] = 'http://localhost:3000/pms-am'; // xv
</script> </script>
<% } %> <% } %>

View File

@ -56,10 +56,13 @@ export default function () {
}, },
{ {
button: { button: {
type: 'plain', type: 'primary',
name: '新增', name: '新增',
permission: 'pms:equipment:save' permission: 'pms:equipment:save'
} },
bind: {
plain: true,
},
} }
] ]

View File

@ -9,43 +9,24 @@
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> --> <!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" /> <BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
<BaseListTable <BaseListTable v-loading="tableLoading" :table-config="tableConfig.table" :column-config="tableConfig.column"
v-loading="tableLoading" :table-data="dataList" @operate-event="handleOperate" @load-sub="handleLoadSub"
:table-config="tableConfig.table" :refresh-layout-key="refreshLayoutKey" />
:column-config="tableConfig.column"
:table-data="dataList"
@operate-event="handleOperate"
@load-sub="handleLoadSub"
:refresh-layout-key="refreshLayoutKey"
/>
<el-pagination <el-pagination class="mt-5 flex justify-end" @size-change="handleSizeChange" @current-change="handlePageChange"
class="mt-5 flex justify-end" :current-page.sync="page" :page-sizes="[1, 5, 10, 20, 50, 100]" :page-size="size" :total="totalPage"
@size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
@current-change="handlePageChange"
:current-page.sync="page"
:page-sizes="[1, 5, 10, 20, 50, 100]"
:page-size="size"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- :current-page.sync="currentPage" <!-- :current-page.sync="currentPage"
:page-size.sync="pageSize" --> :page-size.sync="pageSize" -->
<DialogWithMenu <DialogWithMenu ref="edit-dialog" v-if="dialogType === DIALOG_WITH_MENU" :dialog-visible.sync="dialogVisible"
ref="edit-dialog" :configs="dialogConfigs" @refreshDataList="handleRefreshDatalist" />
v-if="dialogType === DIALOG_WITH_MENU"
:dialog-visible.sync="dialogVisible"
:configs="dialogConfigs"
@refreshDataList="handleRefreshDatalist"
/>
<DialogJustForm <DialogJustForm ref="add-sub-dialog" :dialog-visible.sync="subdialogVisible" :configs="subdialogConfigs"
ref="add-sub-dialog" @refreshDataList="handleRefreshDatalist" />
:dialog-visible.sync="subdialogVisible"
:configs="subdialogConfigs" <DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入原料" filename="bomTemplate.xlsx"
@refreshDataList="handleRefreshDatalist" @refresh-list="getList" />
/>
</div> </div>
</template> </template>
@ -54,6 +35,7 @@ import BaseListTable from "./BaseListTable.vue";
import BaseSearchForm from "@/components/BaseSearchForm.vue"; import BaseSearchForm from "@/components/BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue"; import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "./DialogJustForm.vue"; import DialogJustForm from "./DialogJustForm.vue";
import DialogUpload from "@/components/DialogUpload.vue";
const DIALOG_WITH_MENU = "DialogWithMenu"; const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm"; const DIALOG_JUST_FORM = "DialogJustForm";
@ -61,7 +43,7 @@ const dictList = JSON.parse(localStorage.getItem("dictList"));
export default { export default {
name: "ListViewWithHead", name: "ListViewWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm }, components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogUpload },
props: { props: {
tableConfig: { tableConfig: {
type: Object, type: Object,
@ -104,6 +86,7 @@ export default {
dataList: [], dataList: [],
tableLoading: false, tableLoading: false,
subdialogVisible: false, subdialogVisible: false,
uploadDialogVisible: false,
subdialogConfigs: { subdialogConfigs: {
form: { form: {
rows: [ rows: [
@ -214,9 +197,9 @@ export default {
const params = queryParams const params = queryParams
? { ...queryParams, page: this.page, limit: this.size } ? { ...queryParams, page: this.page, limit: this.size }
: { : {
page: this.page, page: this.page,
limit: this.size, limit: this.size,
}; };
if (!queryParams && this.listQueryExtra.length) { if (!queryParams && this.listQueryExtra.length) {
this.listQueryExtra.map((name) => { this.listQueryExtra.map((name) => {
@ -228,7 +211,7 @@ export default {
.get(this.urls.page, { .get(this.urls.page, {
params: { params: {
...params, ...params,
parentId: "0", // parentId: "0",
}, },
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
@ -280,7 +263,7 @@ export default {
} }
}); });
}) })
.catch((err) => {}); .catch((err) => { });
} }
case "edit": { case "edit": {
this.openDialog(data); /** data is ==> id */ this.openDialog(data); /** data is ==> id */
@ -318,7 +301,16 @@ export default {
}, },
handleRefreshDatalist() { handleRefreshDatalist() {
location.reload(); // location.reload();
this.getList()
},
openUploadDialog() {
this.uploadDialogVisible = true;
this.$nextTick(() => {
this.$refs["upload-dialog"].init();
});
}, },
handleBtnClick({ btnName, payload }) { handleBtnClick({ btnName, payload }) {
@ -331,6 +323,9 @@ export default {
this.getList(payload); this.getList(payload);
break; break;
} }
case "导入":
this.openUploadDialog();
break;
} }
}, },

View File

@ -5,18 +5,18 @@ import { timeFilter, dictFilter } from "@/utils/filters";
export default function () { export default function () {
const tableProps = [ const tableProps = [
{ type: 'index', label: '序号' }, { type: "index", label: "序号" },
{ prop: "code", label: "原料编码" }, { width: 90, prop: "code", label: "原料编码" },
{ prop: "description", label: "原料描述", }, { width: 240, prop: "description", label: "原料描述" },
{ prop: "name", label: "原料名称" }, { width: 90, prop: "name", label: "原料名称" },
{ prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} }, { width: 90, prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} },
{ prop: "baseMaterialCode", label: "基础原料编码" }, { prop: "baseMaterialCode", label: "基础原料编码" },
{ prop: "baseMaterialDescription", label: "基础原料描述" }, { prop: "baseMaterialDescription", label: "基础原料描述" },
// { prop: "type", label: "原料类型" }, // { prop: "type", label: "原料类型" },
{ prop: "density", label: "堆积密度" }, { width: 90, prop: "density", label: "堆积密度" },
// { prop: "brandsOwner", label: "品牌" }, // { prop: "brandsOwner", label: "品牌" },
{ prop: "dosLow", label: "加料下限" }, { width: 90, prop: "dosLow", label: "加料下限" },
{ prop: "dosHigh", label: "加料上限" }, { width: 90, prop: "dosHigh", label: "加料上限" },
// { prop: "description", label: "详情", subcomponent: TableTextComponent }, // { prop: "description", label: "详情", subcomponent: TableTextComponent },
// { prop: "remark", label: "中文描述" }, // { prop: "remark", label: "中文描述" },
{ prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter },
@ -30,7 +30,8 @@ export default function () {
options: [ options: [
// { name: "add-sub", permission: "pms:material:save" }, // { name: "add-sub", permission: "pms:material:save" },
{ name: "edit", label: "编辑", icon: "edit-outline" }, { 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, plain: true,
}, },
}, },
{
button: {
type: "success",
name: "导入",
permission: "",
},
bind: {
plain: true,
},
},
]; ];
/** /**
@ -90,7 +101,6 @@ export default function () {
elparams: { placeholder: "请输入原料编码" }, elparams: { placeholder: "请输入原料编码" },
}, },
{ input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } }, { input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } },
], ],
[ [
// { // {
@ -135,8 +145,8 @@ export default function () {
label: "基础原料", label: "基础原料",
prop: "baseMaterialId", prop: "baseMaterialId",
options: [], options: [],
optionLabel: 'code', optionLabel: "code",
fetchData: () => this.$http.get('/pms/baseMaterial/page', { params: { limit: 999, page: 1, key: '' } }), fetchData: () => this.$http.get("/pms/baseMaterial/page", { params: { limit: 999, page: 1, key: "" } }),
elparams: { placeholder: "请选择基础原料" }, elparams: { placeholder: "请选择基础原料" },
}, },
{ input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } }, { input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } },
@ -155,7 +165,7 @@ export default function () {
prop: "dosLow", prop: "dosLow",
rules: [ rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" }, { 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: "请输入加料下限" }, elparams: { placeholder: "请输入加料下限" },
}, },
@ -165,7 +175,7 @@ export default function () {
prop: "dosHigh", prop: "dosHigh",
rules: [ rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" }, { 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: "请输入加料上限" }, elparams: { placeholder: "请输入加料上限" },
}, },
@ -206,7 +216,7 @@ export default function () {
// extraParams: ['stepId'], // extraParams: ['stepId'],
extraParams: "materialId", extraParams: "materialId",
props: [ props: [
{ type: 'index', label: '序号' }, { type: "index", label: "序号" },
{ prop: "name", label: "属性名", isEditField: true }, { prop: "name", label: "属性名", isEditField: true },
{ prop: "value", label: "属性值", isEditField: true }, { prop: "value", label: "属性值", isEditField: true },
{ prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter },
@ -231,15 +241,9 @@ export default function () {
extraParam: "materialId", extraParam: "materialId",
forceAttachCode: true, forceAttachCode: true,
rows: [ rows: [
[ [{ input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } }],
{ 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: "value", elparams: { placeholder: "请输入属性值" } }
],
[
{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } },
]
], ],
operations: [ operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false },
@ -266,6 +270,8 @@ export default function () {
tree: "/pms/material/tree", tree: "/pms/material/tree",
subase: "/pms/materialArrt", subase: "/pms/materialArrt",
subpage: "/pms/materialArrt/page", subpage: "/pms/materialArrt/page",
importUrl: "/pms/material/importExcel",
templateUrl: "/importTemplates/materialImport.xlsx",
// more... // more...
}, },
}; };

View File

@ -57,17 +57,23 @@ export default function () {
}, },
{ {
button: { button: {
type: "plain", type: "primary",
name: "新增", name: "新增",
permission: "pms:product:save", permission: "pms:product:save",
}, },
bind: {
plain: true
}
}, },
{ {
button: { button: {
type: "plain", type: "success",
name: "导入", name: "导入",
permission: "", permission: "",
}, },
bind: {
plain: true
}
}, },
]; ];
@ -220,7 +226,7 @@ export default function () {
subase: "/pms/productArrt", subase: "/pms/productArrt",
subpage: "/pms/productArrt/page", subpage: "/pms/productArrt/page",
importUrl: "/pms/product/import", importUrl: "/pms/product/import",
templateUrl: '/importTemplates/materialImport.xlsx' templateUrl: '/importTemplates/productImport.xlsx'
}, },
}; };
} }