|
@@ -58,6 +58,7 @@ interface defaultState {
|
|
|
QdTableRef: any;
|
|
|
CodeMxDialogProps: any;
|
|
|
CodeMxDialogRef: any;
|
|
|
+ loadingStatus: any;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -85,7 +86,13 @@ export const useHooks = (t?: any) => {
|
|
|
workgrpEnum2: [],
|
|
|
configureTypeEnum: [],
|
|
|
CodeMxDialogProps: null,
|
|
|
- CodeMxDialogRef: null
|
|
|
+ CodeMxDialogRef: null,
|
|
|
+ loadingStatus: {
|
|
|
+ save: false,
|
|
|
+ synchsL1: false,
|
|
|
+ mtrldef: false,
|
|
|
+ prdpf: false
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
const QdAddRowList = [
|
|
@@ -207,13 +214,19 @@ export const useHooks = (t?: any) => {
|
|
|
type: "warning"
|
|
|
})
|
|
|
.then(() => {
|
|
|
- CreatPrdPf({ list }).then(() => {
|
|
|
- ElNotification({
|
|
|
- title: "金蝶清单",
|
|
|
- message: "生成成功!",
|
|
|
- type: "success"
|
|
|
+ state.loadingStatus.prdpf = true;
|
|
|
+ CreatPrdPf({ list })
|
|
|
+ .then(() => {
|
|
|
+ ElNotification({
|
|
|
+ title: "金蝶清单",
|
|
|
+ message: "生成成功!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ state.loadingStatus.prdpf = false;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ state.loadingStatus.prdpf = false;
|
|
|
});
|
|
|
- });
|
|
|
})
|
|
|
.catch((e: TypeError) => {
|
|
|
console.log("e :>> ", e);
|
|
@@ -249,19 +262,26 @@ export const useHooks = (t?: any) => {
|
|
|
type: "warning"
|
|
|
})
|
|
|
.then(() => {
|
|
|
- CreatMtrlPf({ list }).then(res => {
|
|
|
- console.log("toCreateMtrl, res :>> ", res);
|
|
|
- if (state.LjDetailRef) {
|
|
|
- state.LjDetailRef._mainData.erp_mtrlid = res.mattress.erp_mtrlid;
|
|
|
- state.LjDetailRef._mainData.creatmtrl_flag = res.mattress.creatmtrl_flag;
|
|
|
- state.LjDetailRef._mainData.erp_mtrlcode = res.mattress.erp_mtrlcode;
|
|
|
- }
|
|
|
- ElNotification({
|
|
|
- title: "物料",
|
|
|
- message: "生成/更新成功!",
|
|
|
- type: "success"
|
|
|
+ state.loadingStatus.mtrldef = true;
|
|
|
+ CreatMtrlPf({ list })
|
|
|
+ .then(res => {
|
|
|
+ console.log("toCreateMtrl, res :>> ", res);
|
|
|
+ if (state.LjDetailRef) {
|
|
|
+ state.LjDetailRef._mainData.erp_mtrlid = res.mattress.erp_mtrlid;
|
|
|
+ state.LjDetailRef._mainData.creatmtrl_flag = res.mattress.creatmtrl_flag;
|
|
|
+ state.LjDetailRef._mainData.erp_mtrlcode = res.mattress.erp_mtrlcode;
|
|
|
+ }
|
|
|
+ ElNotification({
|
|
|
+ title: "物料",
|
|
|
+ message: "生成/更新成功!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+
|
|
|
+ state.loadingStatus.mtrldef = false;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ state.loadingStatus.mtrldef = false;
|
|
|
});
|
|
|
- });
|
|
|
})
|
|
|
.catch((e: TypeError) => {
|
|
|
ElMessage({
|
|
@@ -1867,6 +1887,8 @@ export const useHooks = (t?: any) => {
|
|
|
const $table = state.YwTableRef?.element;
|
|
|
let { visibleData } = $table.getTableData();
|
|
|
const copyMap = new Map();
|
|
|
+ let showData: any = [];
|
|
|
+ let matchQty = 0;
|
|
|
|
|
|
const COMMON_PRESERVED_PROPS = ["bj_inputtype", "erp_pzname", "erp_pzcode", "bj_pzname", "bj_namemx", "itemname"];
|
|
|
const SPECIAL_PRESERVED_PROPS = ["actual_size", "sb_craft", "actual_size_sb", "ss_rate", "ls_rate"];
|
|
@@ -1878,9 +1900,10 @@ export const useHooks = (t?: any) => {
|
|
|
copyMap.set(`${mx.erp_pzid}`, mx);
|
|
|
});
|
|
|
|
|
|
- state.mattressYWList = res.mxList.map(mx => {
|
|
|
+ showData = res.mxList.map(mx => {
|
|
|
const key = `${mx.erp_pzid}`;
|
|
|
if (copyMap.has(key)) {
|
|
|
+ matchQty++;
|
|
|
const mx2 = copyMap.get(key);
|
|
|
if (mx2.bj_inputtype === 2) {
|
|
|
SPECIAL_PRESERVED_PROPS.forEach(prop => {
|
|
@@ -1899,22 +1922,25 @@ export const useHooks = (t?: any) => {
|
|
|
const NEED_PROPS = ["bj_inputtype", "bj_namemx"];
|
|
|
res.mxList.forEach(mx => copyMap.set(`${mx.erp_pzid}`, mx));
|
|
|
|
|
|
- visibleData.forEach(mx => {
|
|
|
+ showData = visibleData.map(mx => {
|
|
|
const key = `${mx.erp_pzid}`;
|
|
|
if (copyMap.has(key) && (mx.bj_inputtype === 1 || mx.bj_inputtype === 0)) {
|
|
|
+ matchQty++;
|
|
|
NEED_PROPS.forEach(prop => {
|
|
|
mx[prop] = copyMap.get(key)[prop];
|
|
|
});
|
|
|
}
|
|
|
+ return mx;
|
|
|
});
|
|
|
|
|
|
- state.mattressQDList = visibleData.map((mx: any) => mx);
|
|
|
+ // state.mattressYWList = visibleData.map((mx: any) => mx);
|
|
|
} else {
|
|
|
// 重新生成: FEAT: 删除所有已经填写的【录入】和【选择)项目,根据核价资料,重新生成所有的【带出】资料
|
|
|
visibleData.forEach(mx => copyMap.set(`${mx.erp_pzid}`, mx));
|
|
|
- state.mattressYWList = res.mxList.map(mx => {
|
|
|
+ showData = res.mxList.map(mx => {
|
|
|
const key = `${mx.erp_pzid}`;
|
|
|
if (copyMap.has(key)) {
|
|
|
+ matchQty++;
|
|
|
SPECIAL_PRESERVED_PROPS.forEach(prop => {
|
|
|
mx[prop] = copyMap.get(key)[prop];
|
|
|
});
|
|
@@ -1923,13 +1949,22 @@ export const useHooks = (t?: any) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // $table.reloadData(visibleData);
|
|
|
- resetMergeCells();
|
|
|
+ if (res.mxList.length > 0) {
|
|
|
+ await $table.reloadData(showData);
|
|
|
+ resetMergeCells();
|
|
|
|
|
|
- ElNotification({
|
|
|
- title: "刷新成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
+ ElNotification({
|
|
|
+ title: "刷新成功",
|
|
|
+ message: `成功匹配${matchQty}条数据`,
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ title: "刷新失败",
|
|
|
+ message: "暂无配置数据(mattressid: " + mattressid + ")",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
/**
|
|
|
* 刷新产品清单
|
|
@@ -1941,6 +1976,9 @@ export const useHooks = (t?: any) => {
|
|
|
|
|
|
let res = await RefreshMattressInterfaceQd({ mattressid, isPz, isCheck });
|
|
|
|
|
|
+ let showData: any = [];
|
|
|
+ let matchQty = 0;
|
|
|
+
|
|
|
const interfaceMap = {};
|
|
|
state.mattressYWList.forEach(mb => {
|
|
|
interfaceMap[mb.bj_pzname] = mb;
|
|
@@ -1972,9 +2010,10 @@ export const useHooks = (t?: any) => {
|
|
|
// 刷新清单
|
|
|
visibleData.forEach(mx => copyMap.set(`${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`, mx));
|
|
|
|
|
|
- state.mattressQDList = res.mxList.map(mx => {
|
|
|
+ showData = res.mxList.map(mx => {
|
|
|
const key = `${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`;
|
|
|
if (copyMap.has(key)) {
|
|
|
+ matchQty++;
|
|
|
PRESERVE_PROPS.forEach(prop => {
|
|
|
mx[prop] = copyMap.get(key)[prop];
|
|
|
});
|
|
@@ -1988,6 +2027,7 @@ export const useHooks = (t?: any) => {
|
|
|
"erp_mtrlcode",
|
|
|
"erp_mtrlname",
|
|
|
"erp_mtrlmode",
|
|
|
+ "erp_mtrlengname",
|
|
|
"erp_unit",
|
|
|
"useqty",
|
|
|
"actual_useqty",
|
|
@@ -1997,23 +2037,26 @@ export const useHooks = (t?: any) => {
|
|
|
];
|
|
|
res.mxList.forEach(mx => copyMap.set(`${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`, mx));
|
|
|
|
|
|
- visibleData.forEach(mx => {
|
|
|
+ showData = visibleData.map(mx => {
|
|
|
const key = `${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`;
|
|
|
if (copyMap.has(key)) {
|
|
|
+ matchQty++;
|
|
|
NEED_PROPS.forEach(prop => {
|
|
|
mx[prop] = copyMap.get(key)[prop];
|
|
|
});
|
|
|
}
|
|
|
+ return mx;
|
|
|
});
|
|
|
|
|
|
- state.mattressQDList = visibleData.map((mx: any) => mx);
|
|
|
+ // state.mattressQDList = visibleData.map((mx: any) => mx);
|
|
|
} else {
|
|
|
// 重新刷新清单
|
|
|
visibleData.forEach(mx => copyMap.set(`${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`, mx));
|
|
|
|
|
|
- state.mattressQDList = res.mxList.map(mx => {
|
|
|
+ showData = res.mxList.map(mx => {
|
|
|
const key = `${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`;
|
|
|
if (copyMap.has(key)) {
|
|
|
+ matchQty++;
|
|
|
PRESERVE_PROPS.forEach(prop => {
|
|
|
mx[prop] = copyMap.get(key)[prop];
|
|
|
});
|
|
@@ -2022,13 +2065,22 @@ export const useHooks = (t?: any) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // $table.reloadData(visibleData);
|
|
|
- resetMergeCellsQd();
|
|
|
+ if (res.mxList.length > 0) {
|
|
|
+ await $table.reloadData(showData);
|
|
|
+ resetMergeCellsQd();
|
|
|
|
|
|
- ElNotification({
|
|
|
- title: "刷新成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
+ ElNotification({
|
|
|
+ title: "刷新成功",
|
|
|
+ message: `成功匹配${matchQty}条数据`,
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ title: "刷新失败",
|
|
|
+ message: "暂无清单数据(mattressid: " + mattressid + ")",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|