update 2023.4.6 - 2

This commit is contained in:
lb 2023-04-06 16:50:13 +08:00
parent 10b50df6f6
commit 45fe1d5d3c
6 changed files with 80 additions and 18 deletions

View File

@ -10,8 +10,9 @@
<div class="dialog-body__inner relative"> <div class="dialog-body__inner relative">
<!-- v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu) && $hasPermission()" --> <!-- v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu) && $hasPermission()" -->
<el-button v-if="configs.allowAdd ?? (dataForm.id && !detailMode && /属性|详情|参数/.test(activeMenu))" plain type="primary" size="small" <el-button v-if="configs.allowAdd ?? (dataForm.id && !detailMode && /属性|详情|参数/.test(activeMenu))" plain
class="at-right-top" style="margin-bottom: 16px" @click="handleAddParam()">+ 添加</el-button> type="primary" size="small" class="at-right-top" style="margin-bottom: 16px" @click="handleAddParam()">+
添加</el-button>
<template v-if="dataForm.id && !detailMode && /附件/.test(activeMenu)"> <template v-if="dataForm.id && !detailMode && /附件/.test(activeMenu)">
<el-upload style="position: absolute; width: 100%; height: 0" name="files" :action="uploadUrl" <el-upload style="position: absolute; width: 100%; height: 0" name="files" :action="uploadUrl"
:show-file-list="false" :headers="uploadHeaders" :on-success="handleUploadSuccess" :show-file-list="false" :headers="uploadHeaders" :on-success="handleUploadSuccess"
@ -185,6 +186,7 @@ export default {
const dataForm = {}; const dataForm = {};
const autoDisabledQueue = []; const autoDisabledQueue = [];
const watingToRefreshQueue = []; const watingToRefreshQueue = [];
const cached = {}
this.configs.form.rows.forEach((row) => { this.configs.form.rows.forEach((row) => {
row.forEach((col) => { row.forEach((col) => {
@ -193,11 +195,17 @@ export default {
if (col.autoDisabled) autoDisabledQueue.push(col.prop); if (col.autoDisabled) autoDisabledQueue.push(col.prop);
if (!!col.refreshOptionsAfterConfirm) watingToRefreshQueue.push(col); if (!!col.refreshOptionsAfterConfirm) watingToRefreshQueue.push(col);
if (col.fetchData) if (col.fetchData)
col.fetchData().then(({ data: res }) => { col.fetchData().then(({ data: res }) => {
console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list); console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
if (res.code === 0) { if (res.code === 0) {
if (!col.options || !col.options.length) if (col.cacheFetchedData) {
// cache fetched data
cached[col.prop] = 'list' in res.data ? res.data.list : (Array.isArray(res.data) ? res.data : [])
}
if (!col.options || !col.options.length) {
this.$set( this.$set(
col, col,
"options", "options",
@ -211,6 +219,7 @@ export default {
value: col.optionValue ? i[col.optionValue] : i.id, value: col.optionValue ? i[col.optionValue] : i.id,
})) }))
); );
}
// col.options = res.data.list; // col.options = res.data.list;
else if (col.options.length) { else if (col.options.length) {
"list" in res.data ? res.data.list.unshift(...col.options) : res.data.unshift(...col.options); "list" in res.data ? res.data.list.unshift(...col.options) : res.data.unshift(...col.options);
@ -273,6 +282,7 @@ export default {
detailMode: false, detailMode: false,
autoDisabledQueue, autoDisabledQueue,
watingToRefreshQueue, watingToRefreshQueue,
cached,
showBaseDialog: false, showBaseDialog: false,
baseDialogConfig: null, baseDialogConfig: null,
subList: [], subList: [],
@ -309,6 +319,38 @@ export default {
currentImgUrl: "", currentImgUrl: "",
}; };
}, },
mounted() {
this.configs.form.rows.forEach((row) => {
row.forEach((col) => {
if (col.changeReflects && typeof col.changeReflects === 'object' && 'fromKey' in col.changeReflects && 'toProp' in col.changeReflects) {
this.$watch(
() => this.dataForm[col.prop],
val => {
if (val && (col.prop in this.cached)) {
console.log("here changeReflects", col.prop, col.changeReflects.toProp, this.cached[col.prop])
if (typeof col.changeReflects.fromKey === 'string') {
this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)?.[col.changeReflects.fromKey]
} else if (Array.isArray(col.changeReflects.fromKey) && col.changeReflects.delimiter) {
const foundItem = this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)
if (foundItem) {
const values = col.changeReflects.fromKey.map(key => foundItem[key])
this.dataForm[col.changeReflects.toProp] = values.join(col.changeReflects.delimiter)
} else {
this.dataForm[col.changeReflects.toProp] = col.changeReflects.delimiter
console.log("[DialogWithMenu] mounted() 没找到对应数据")
}
}
}
},
{
immediate: false
}
)
}
});
});
},
watch: { watch: {
dialogVisible: function (val) { dialogVisible: function (val) {
if (!!val) { if (!!val) {
@ -923,4 +965,5 @@ ul.file-list>li:hover {
.force-disabled { .force-disabled {
margin-top: 42px; margin-top: 42px;
}</style> }
</style>

View File

@ -99,7 +99,13 @@ export default function () {
refreshOptionsAfterConfirm: true, refreshOptionsAfterConfirm: true,
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { clearable: true, filterable: true, placeholder: "请选择配方" }, elparams: { clearable: true, filterable: true, placeholder: "请选择配方" },
fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 3, externalCode: '', key: '', techId } }), fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 3, version: '', key: '', techId } }),
cacheFetchedData: true,
changeReflects: {
fromKey: ['code', 'version'],
delimiter: '-',
toProp: 'code'
}
}, },
], ],
// [ // [

View File

@ -75,7 +75,7 @@ export default function () {
{ width: 200, prop: "saleOrderItem", label: "销售订单item号" }, { width: 200, prop: "saleOrderItem", label: "销售订单item号" },
{ width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable { width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
{ width: 120, prop: "specifications", label: "生产订单类型" }, { width: 120, prop: "specifications", label: "生产订单类型" },
{ width: 120, prop: "deliveryTime", label: "发货时间" }, { width: 120, prop: "deliveryTime", label: "销售时间" },
{ width: 120, prop: "customerCode", label: "客户" }, { width: 120, prop: "customerCode", label: "客户" },
{ width: 120, prop: "pcsKilnCar", label: "托盘码放砖数" }, { width: 120, prop: "pcsKilnCar", label: "托盘码放砖数" },
// { prop: "description", label: "详情", subcomponent: TableTextComponent }, // { prop: "description", label: "详情", subcomponent: TableTextComponent },

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="main-container"> <div class="main-container">
<div class="inner-sidebar"> <!-- <div class="inner-sidebar">
<a href="#ongoing" :class="{ active: activeTable === '#ongoing' }" @click.prevent="scrollTo('#ongoing')">进行中的订单</a> <a href="#ongoing" :class="{ active: activeTable === '#ongoing' }" @click.prevent="scrollTo('#ongoing')">进行中的订单</a>
<a href="#pending" :class="{ active: activeTable === '#pending' }" @click.prevent="scrollTo('#pending')">等待订单</a> <a href="#pending" :class="{ active: activeTable === '#pending' }" @click.prevent="scrollTo('#pending')">等待订单</a>
<a href="#finished" :class="{ active: activeTable === '#finished' }" @click.prevent="scrollTo('#finished')">完成订单</a> <a href="#finished" :class="{ active: activeTable === '#finished' }" @click.prevent="scrollTo('#finished')">完成订单</a>
</div> </div> -->
<div class="list-view-with-head-list"> <div class="list-view-with-head-list">
<!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> --> <!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> -->
@ -181,7 +181,7 @@ export default {
.list-view-with-head-list { .list-view-with-head-list {
width: 1px; width: 1px;
margin-left: 144px; /* margin-left: 144px; */
flex-grow: 1; flex-grow: 1;
} }
</style> </style>

View File

@ -20,7 +20,10 @@ export default function () {
fixed: "right", fixed: "right",
width: 120, width: 120,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ { name: "copy", label: "复制", icon: "copy-document" }, { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:shapeStep:delete" }], options: [
{ name: "copy", label: "复制", icon: "copy-document" },
{ name: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }],
}, },
]; ];
@ -96,7 +99,12 @@ export default function () {
refreshOptionsAfterConfirm: true, refreshOptionsAfterConfirm: true,
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" }, elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" },
fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 2, externalCode: '', key: '', techId } }), fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 2, key: '', techId } }),
cacheFetchedData: true,
changeReflects: {
fromKey: 'code',
toProp: 'code'
}
}, },
], ],
// [ // [

View File

@ -23,7 +23,7 @@ export default function () {
options: [ options: [
{ 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:testingStep:delete" } { name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:testingStep:delete" }
], ],
}, },
]; ];
@ -101,7 +101,12 @@ export default function () {
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" }, elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" },
// 下面参数的 techId 是为 /pms/xxx/listUnR 接口定制的,默认为 -1新增时使用编辑时传对应的 工艺id // 下面参数的 techId 是为 /pms/xxx/listUnR 接口定制的,默认为 -1新增时使用编辑时传对应的 工艺id
fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 4, externalCode: '', key: '', techId } }), fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 4, key: '', techId } }),
cacheFetchedData: true,
changeReflects: {
fromKey: 'code',
toProp: 'code'
}
}, },
], ],
// [ // [