update 0727 docs

This commit is contained in:
lb 2023-07-27 16:41:02 +08:00
parent ce29b3ca9b
commit f0c1691775
5 changed files with 227 additions and 155 deletions

View File

@ -10,6 +10,7 @@
}" }"
row-key="id" row-key="id"
:cell-style="{ padding: 0 }" :cell-style="{ padding: 0 }"
@selection-change="handleSelectionChange"
border border
> >
<!-- :cell-style="{ padding: 0 }" --> <!-- :cell-style="{ padding: 0 }" -->
@ -113,6 +114,7 @@ export default {
data() { data() {
return { return {
dataList: [], dataList: [],
selections: []
}; };
}, },
watch: { watch: {
@ -125,6 +127,11 @@ export default {
console.log("[component] BaseListTable handleSubEmitData(): ", payload); console.log("[component] BaseListTable handleSubEmitData(): ", payload);
this.$emit("operate-event", payload); this.$emit("operate-event", payload);
}, },
handleSelectionChange(val) {
// this.selections = val;
console.log('selections change: ', val)
this.$emit('select', val.map(item => item.id))
}
}, },
}; };
</script> </script>

View File

@ -520,7 +520,7 @@ export default {
if (fields.indexOf(key) !== -1) { if (fields.indexOf(key) !== -1) {
// console.log(`key ${key} in fields`) // console.log(`key ${key} in fields`)
// this.dataForm[key] = null; // this.dataForm[key] = null;
this.$set(this.dataForm, key, null) this.$set(this.dataForm, key, null);
} }
}); });
console.log("this.dataform", this.dataForm); console.log("this.dataform", this.dataForm);
@ -743,6 +743,9 @@ export default {
case "update": case "update":
this.addOrUpdate(payload.name === "add" ? "POST" : "PUT"); this.addOrUpdate(payload.name === "add" ? "POST" : "PUT");
break; break;
case "update-bom":
this.addOrUpdate("POST", this.urls.editUrl);
break;
case "add-pos-manually": { case "add-pos-manually": {
this.addOrUpdate("POST", this.urls.posFormUrl); this.addOrUpdate("POST", this.urls.posFormUrl);
break; break;

View File

@ -12,6 +12,7 @@
@operate-event="handleOperate" @operate-event="handleOperate"
:current-page="page" :current-page="page"
:current-size="size" :current-size="size"
@select="handleTableSelect"
:refresh-layout-key="refreshLayoutKey" /> :refresh-layout-key="refreshLayoutKey" />
<el-pagination <el-pagination
@ -173,6 +174,7 @@ export default {
overlayVisible: false, overlayVisible: false,
cachedSearchCondition: {}, cachedSearchCondition: {},
needAttachmentDialog: false, needAttachmentDialog: false,
tableSelectedIds: [],
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -276,6 +278,10 @@ export default {
return Math.random(); return Math.random();
}, },
handleTableSelect(ids) {
this.tableSelectedIds = [...ids];
},
/** 处理 表格操作 */ /** 处理 表格操作 */
handleOperate({ type, data }) { handleOperate({ type, data }) {
console.log("payload", type, data); console.log("payload", type, data);
@ -334,7 +340,7 @@ export default {
.catch((err) => {}); .catch((err) => {});
} }
case "edit": { case "edit": {
console.log("[edit] ",data) console.log("[edit] ", data);
this.openDialog(data); /** data is ==> id */ this.openDialog(data); /** data is ==> id */
break; break;
} }
@ -605,6 +611,14 @@ export default {
handleBtnClick({ btnName, payload }) { handleBtnClick({ btnName, payload }) {
console.log("[search] form handleBtnClick", btnName, payload); console.log("[search] form handleBtnClick", btnName, payload);
switch (btnName) { switch (btnName) {
case "批量同步":
this.overlayVisible = true;
this.$http.post(this.urls.syncUrl, this.tableSelectedIds).then(({ data: res }) => {
this.$message({ message: res.msg, type: res.code === 0 ? "success" : "error" });
res.code == 0 && this.getList();
this.overlayVisible = false;
});
break;
case "新增": case "新增":
this.openDialog(); this.openDialog();
break; break;

View File

@ -7,10 +7,11 @@ import techBox from "@/components/noTemplateComponents/techBox";
export default function () { export default function () {
const tableProps = [ const tableProps = [
{ type: "index", label: "序号" }, { type: "index", label: "序号" },
{ type: "selection" },
{ width: 160, prop: "code", label: "配方号" }, { width: 160, prop: "code", label: "配方号" },
{ prop: "name", label: "牌号" }, { prop: "name", label: "牌号" },
{ prop: "syncTime", label: "同步时间", filter: timeFilter }, { prop: "syncTime", label: "同步时间", filter: timeFilter },
{ width: 90, prop: "techCode", label: "烧制曲线", subcomponent: techBox }, { width: 120, prop: "techCode", label: "烧制曲线", subcomponent: techBox },
{ prop: "upweight", label: "建议混料上限" }, { prop: "upweight", label: "建议混料上限" },
{ prop: "downweight", label: "建议混料下限" }, { prop: "downweight", label: "建议混料下限" },
// { prop: "externalCode", label: "版本号" }, // { prop: "externalCode", label: "版本号" },
@ -38,9 +39,9 @@ export default function () {
width: 120, width: 120,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true } // { name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true }
// { name: "copy", label: "复制", icon: "copy-document" }, // { name: "copy", label: "复制", icon: "copy-document" },
// { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "edit", label: "编辑", icon: "edit-outline" },
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" }, // { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
], ],
}, },
@ -83,169 +84,214 @@ export default function () {
]; ];
const dictList = JSON.parse(localStorage.getItem("dictList") || {}); const dictList = JSON.parse(localStorage.getItem("dictList") || {});
const dialogConfigs = { // const dialogConfigs = {
menu: [ // menu: [
{ name: "配方", key: "info" }, // { name: "配方", key: "info" },
{ name: "配方详情", key: "attr", onlyEditMode: true }, // { name: "配方详情", key: "attr", onlyEditMode: true },
// // {
// // name: "附件",
// // key: "attachment",
// // onlyEditMode: true,
// // actionUrl: window.SITE_CONFIG["apiURL"] + "/pms/attachment/uploadFileFormData?typeCode=ProductAttachment",
// // },
// ],
// form: {
// rows: [
// [
// { // {
// name: "附件", // input: true,
// key: "attachment", // label: "牌号",
// onlyEditMode: true, // prop: "name",
// actionUrl: window.SITE_CONFIG["apiURL"] + "/pms/attachment/uploadFileFormData?typeCode=ProductAttachment", // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入牌号" },
// }, // },
], // {
// input: true,
// label: "配方编码",
// prop: "code",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入配方编码" },
// },
// // { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } },
// // {
// // select: true,
// // label: "产品类型",
// // prop: "typeDictValue",
// // options: "product_type" in dictList ? dictList["product_type"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// // elparams: { placeholder: "选择一个产品类型" },
// // },
// ],
// [
// // { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } },
// // {
// // select: true,
// // label: "单位",
// // prop: "unitDictValue",
// // options: "unit" in dictList ? dictList["unit"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// // elparams: { placeholder: "选择单位" },
// // },
// {
// input: true,
// label: "版本号",
// prop: "externalCode",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入版本号" },
// },
// { input: true, label: "物料销售文本(短)", prop: "shortDesc", elparams: { placeholder: "物料销售文本" } },
// ],
// [{ textarea: true, label: "物料销售文本", prop: "description", elparams: { placeholder: "物料销售文本" } }],
// [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
// [
// {
// // input: true,
// forceDisabled: true,
// label: "同步状态",
// prop: "sync",
// key: "sync",
// // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// // elparams: { placeholder: "请输入同步状态" },
// },
// ],
// ],
// operations: [
// { name: "add", label: "保存", type: "primary", permission: "pms:bom:save", showOnEdit: false },
// { name: "update", label: "更新", type: "primary", permission: "pms:bom:update", showOnEdit: true },
// { name: "reset", label: "重置", type: "warning", showAlways: true },
// // { name: 'cancel', label: '取消', showAlways: true },
// ],
// },
// table: {
// // extraParams: ['stepId'],
// extraParams: "bomId",
// props: [
// { type: "index", label: "序号" },
// { prop: "material", label: "物料", isEditField: true },
// {
// width: 130,
// prop: "qty",
// label: "配方物料重量",
// filter: (val) => (!!val ? val + " kg" : "-"),
// isEditField: true,
// },
// {
// width: 130,
// prop: "sumqty",
// label: "配方总重量",
// filter: (val) => (!!val ? val + " kg" : "-"),
// isEditField: true,
// },
// { prop: "percent", label: "配比 [%]", filter: (val) => (!!val ? val + " %" : "-"), isEditField: true },
// { prop: "remark", label: "备注", isEditField: true },
// { prop: "createTime", label: "添加时间", filter: timeFilter },
// {
// prop: "operations",
// name: "操作",
// fixed: "right",
// width: 90,
// subcomponent: TableOperaionComponent,
// options: [
// { name: "edit", label: "编辑", icon: "edit-outline", permission: "pms:bomMaterial:update" },
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bomMaterial:delete" },
// ],
// },
// ],
// data: [
// // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
// ],
// },
// subDialog: {
// extraParam: "bomId",
// forceAttachCode: true, // 产品属性新增必填 code 字段......
// rows: [
// [
// {
// select: true,
// label: "物料",
// prop: "materialId",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请选择物料", filterable: true },
// options: [],
// fetchData: () => this.$http.get("/pms/material/page", { params: { limit: 999, page: 1 } }),
// // fetchData: () => new Promise((resolve) => {
// // setTimeout(() => {
// // resolve({
// // data: {
// // code: 0,
// // data: {
// // total: 0,
// // list:
// // [
// // { id: 10001, name: 'mock物料1' },
// // { id: 10002, name: 'mock物料2' },
// // { id: 10003, name: 'mock物料3' },
// // { id: 10004, name: 'mock物料4' },
// // { id: 10005, name: 'mock物料5' },
// // ]
// // }
// // }
// // })
// // }, 800)
// // })
// },
// {
// input: true,
// label: "物料重量[kg]",
// prop: "qty",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入物料重量" },
// },
// ],
// [{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "添加备注" } }],
// ],
// operations: [
// { name: "add", label: "保存", type: "primary", permission: "pms:bomMaterial:save", showOnEdit: false },
// { name: "update", label: "更新", type: "primary", permission: "pms:bomMaterial:update", showOnEdit: true },
// ],
// },
// };
const dialogConfigs = {
form: { form: {
rows: [ rows: [
[ [
{
input: true,
label: "配方号",
prop: "code",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// disabledOnEdit: true
elparams: { disabled: true },
},
{ {
input: true, input: true,
label: "牌号", label: "牌号",
prop: "name", prop: "name",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入牌号" }, elparams: { disabled: true },
},
],
[
{
input: true,
label: "建议混料下限",
prop: "downweight",
rules: [{ type: "number", trigger: "blur", message: "请输入数字类型", transform: (val) => Number(val) }],
elparams: { placeholder: "请输入建议混料下限" },
}, },
{ {
input: true, input: true,
label: "配方编码", label: "建议混料上限",
prop: "code", prop: "upweight",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: [{ type: "number", trigger: "blur", message: "请输入数字类型", transform: (val) => Number(val) }],
elparams: { placeholder: "请输入配方编码" }, elparams: { placeholder: "请输入建议混料上限" },
}, },
// { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } }, ]
// {
// select: true,
// label: "产品类型",
// prop: "typeDictValue",
// options: "product_type" in dictList ? dictList["product_type"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// elparams: { placeholder: "选择一个产品类型" },
// },
],
[
// { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } },
// {
// select: true,
// label: "单位",
// prop: "unitDictValue",
// options: "unit" in dictList ? dictList["unit"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// elparams: { placeholder: "选择单位" },
// },
{
input: true,
label: "版本号",
prop: "externalCode",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入版本号" },
},
{ input: true, label: "物料销售文本(短)", prop: "shortDesc", elparams: { placeholder: "物料销售文本" } },
],
[{ textarea: true, label: "物料销售文本", prop: "description", elparams: { placeholder: "物料销售文本" } }],
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
[
{
// input: true,
forceDisabled: true,
label: "同步状态",
prop: "sync",
key: "sync",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入同步状态" },
},
],
], ],
operations: [ operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:bom:save", showOnEdit: false }, { name: "add-bom", label: "保存", type: "primary", permission: "", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:bom:update", showOnEdit: true }, { name: "update-bom", label: "更新", type: "primary", permission: "", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true }, { name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
table: {
// extraParams: ['stepId'],
extraParams: "bomId",
props: [
{ type: "index", label: "序号" },
{ prop: "material", label: "物料", isEditField: true },
{
width: 130,
prop: "qty",
label: "配方物料重量",
filter: (val) => (!!val ? val + " kg" : "-"),
isEditField: true,
},
{
width: 130,
prop: "sumqty",
label: "配方总重量",
filter: (val) => (!!val ? val + " kg" : "-"),
isEditField: true,
},
{ prop: "percent", label: "配比 [%]", filter: (val) => (!!val ? val + " %" : "-"), isEditField: true },
{ prop: "remark", label: "备注", isEditField: true },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", label: "编辑", icon: "edit-outline", permission: "pms:bomMaterial:update" },
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bomMaterial:delete" },
],
},
],
data: [
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
],
},
subDialog: {
extraParam: "bomId",
forceAttachCode: true, // 产品属性新增必填 code 字段......
rows: [
[
{
select: true,
label: "物料",
prop: "materialId",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择物料", filterable: true },
options: [],
fetchData: () => this.$http.get("/pms/material/page", { params: { limit: 999, page: 1 } }),
// fetchData: () => new Promise((resolve) => {
// setTimeout(() => {
// resolve({
// data: {
// code: 0,
// data: {
// total: 0,
// list:
// [
// { id: 10001, name: 'mock物料1' },
// { id: 10002, name: 'mock物料2' },
// { id: 10003, name: 'mock物料3' },
// { id: 10004, name: 'mock物料4' },
// { id: 10005, name: 'mock物料5' },
// ]
// }
// }
// })
// }, 800)
// })
},
{
input: true,
label: "物料重量[kg]",
prop: "qty",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入物料重量" },
},
],
[{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "添加备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:bomMaterial:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:bomMaterial:update", showOnEdit: true },
], ],
}, },
}; };
@ -262,8 +308,10 @@ export default function () {
}, },
urls: { urls: {
base: "/pms/bom", base: "/pms/bom",
editUrl: "/pms/bom/modify",
page: "/pms/bom/page", page: "/pms/bom/page",
syncUrl: "/pms/bom/sync", // syncUrl: "/pms/bom/sync",
syncUrl: "/pms/trans/batchBomSync",
copyUrl: "/pms/bom/copy", copyUrl: "/pms/bom/copy",
subase: "/pms/bomMaterial", subase: "/pms/bomMaterial",
subpage: "/pms/bomMaterial/page", subpage: "/pms/bomMaterial/page",

View File

@ -10,9 +10,9 @@ export default function () {
{ width: 160, prop: "orderCode", label: "主订单号" }, { width: 160, prop: "orderCode", label: "主订单号" },
{ width: 60, prop: "orderCate", label: "子号" }, { width: 60, prop: "orderCate", label: "子号" },
{ width: 160, prop: "code", label: "压制订单号" }, { width: 160, prop: "code", label: "压制订单号" },
{ width: 60, prop: "percent", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") }, { width: 90, prop: "percent", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
{ prop: "statusDictValue", label: "订单状态", filter: (val) => (val !== null && val !== undefined ? ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝", "已下发"][val] : "-"), }, { prop: "statusDictValue", label: "订单状态", filter: (val) => (val !== null && val !== undefined ? ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝", "已下发"][val] : "-"), },
{ prop: "startTime", label: "开始时间" }, { width: 160, prop: "startTime", label: "开始时间", filter: timeFilter },
{ width: 100, prop: "shapeCode", label: "砖型" }, { width: 100, prop: "shapeCode", label: "砖型" },
{ prop: "pressCode", label: "压机" }, { prop: "pressCode", label: "压机" },
{ width: 80, prop: "qty", label: "生产量" }, { width: 80, prop: "qty", label: "生产量" },