From 4233cf858ab75090558179cdb50891b4120e8f1a Mon Sep 17 00:00:00 2001
From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com>
Date: Wed, 17 Jun 2026 16:34:22 +0800
Subject: [PATCH] 新增commonsubbill
---
src/components/Common/CommonHooks/useCommonBase.js | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
src/mes/common/commonModelComponent/index.js | 30 +++++++++++++++++++++++++++++-
src/mes/common/commonOperationBarComponent/MesToolbar.js | 3 +++
src/mes/common/commonOperationBarComponent/index.js | 13 +++++++++++--
4 files changed, 145 insertions(+), 19 deletions(-)
diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js
index a86c52a..81c0743 100644
--- a/src/components/Common/CommonHooks/useCommonBase.js
+++ b/src/components/Common/CommonHooks/useCommonBase.js
@@ -58,14 +58,17 @@ const useCommonBase = props => {
const { sModelsId, app } = state;
const isChoosePlate = sModelsId !== '12710101117087374661080'
const formData = await handleGetModelConfig({ sModelsId });
- const addState = {};
+ let addState = {};
let pageRoute = props.sModelType;
// 如果是弹窗且没有pageLayout,则认为是commonBill
if (commonUtils.isNotEmptyObject(props.parentProps) && formData.length && !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')) {
pageRoute = '/indexPage/commonBill';
}
+ if (formData.length && formData[0]?.sName.includes('/indexPage/commonSubBill')) {
+ pageRoute = formData[0]?.sName
+ }
- if (formData.length && !props.currentContent && ['/indexPage/commonList', '/indexPage/commonBill'].includes(pageRoute) && !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')) {
+ if (formData.length && !props.currentContent && ['/indexPage/commonList', '/indexPage/commonBill', '/indexPage/commonSubBill'].includes(pageRoute) && !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')) {
if (pageRoute === '/indexPage/commonList') {
formData[0].sGrd = isChoosePlate ? 'slave' : formData[0].sGrd;
formData[0].gdsconfigformslave.push({
@@ -98,6 +101,84 @@ const useCommonBase = props => {
})
addState.bMesBill = true;
addState.copyTo = { master: { maxBillNo: 'sBillNo' } };
+ } else if (pageRoute === '/indexPage/commonSubBill') {
+ const { sLanguage } = app.userinfo;
+ const [tableList, tabConfig] = [[], []];
+ let addState1 = {}
+ const filterData = formData.filter(item => item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible);
+ if (commonUtils.isNotEmptyArr(filterData) && filterData.length > 1 && filterData.length === 2) {
+ const slaveChildConfig = filterData[1];
+ const slaveChildColumn = commonFunc.getHeaderConfig(slaveChildConfig);
+ // handleGetOneMemoData('slaveChild', slaveChildConfig);
+ const slaveChildPageSize = commonUtils.isNotEmptyObject(slaveChildConfig) && commonUtils.isNotEmptyNumber(slaveChildConfig.iPageSize) && slaveChildConfig.iPageSize !== 0 ?
+ slaveChildConfig.iPageSize : commonConfig.pageSize;
+ addState1 = {
+ slaveChildConfig,
+ slaveChildColumn,
+ slaveChildPageSize,
+ };
+ } else if (commonUtils.isNotEmptyArr(filterData) && filterData.length > 2) {
+ const slaveChildConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible && commonUtils.isNotEmptyObject(item.sChildTableName))) ?
+ formData.filter(item => item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible && commonUtils.isNotEmptyObject(item.sChildTableName))[0] : {};
+
+ const slaveChildColumn = commonUtils.isNotEmptyObject(slaveChildConfig) ? commonFunc.getHeaderConfig(slaveChildConfig) : [];
+ // handleGetOneMemoData('slaveChild', slaveChildConfig);
+ const slaveChildPageSize = commonUtils.isNotEmptyObject(slaveChildConfig) && commonUtils.isNotEmptyNumber(slaveChildConfig.iPageSize) && slaveChildConfig.iPageSize !== 0 ?
+ slaveChildConfig.iPageSize : commonConfig.pageSize;
+ addState1 = {
+ slaveChildConfig,
+ slaveChildColumn,
+ slaveChildPageSize,
+ };
+
+ // eslint-disable-next-line no-unused-vars
+ const addState2 = {};
+ const memoDataList = [];
+ const slaveInfoList = [];
+ let slaveIndex = 0;
+ formData.forEach((item, index) => {
+ if (index >= 2 && commonUtils.isNotEmptyObject(item) && item.bGrd && item.bGrdVisible && commonUtils.isEmptyObject(item.sChildTableName)) {
+ addState1[`slave${slaveIndex}Config`] = item;
+ config[`slave${slaveIndex}Config`] = item;
+ addState1[`slave${slaveIndex}Column`] = commonFunc.getHeaderConfig(item);
+ memoDataList.push({
+ name: `slave${slaveIndex}`,
+ config: item,
+ });
+ slaveInfoList.push(`slave${slaveIndex}`);
+ // eslint-disable-next-line no-plusplus
+ slaveIndex++;
+ }
+ });
+ addState1.slaveInfoList = slaveInfoList;
+ }
+ formData.forEach((item, index) => {
+ if (index === 0) {
+ item.sGrd = isChoosePlate ? 'master' : item.sGrd;
+ tableList.push('master');
+ tabConfig.push({ "configList": [{ "sName": "master", "showType": "form", "bHideTitle": true, "defaultEnabled": true }], "mode": "advanced", "height": "auto", "width": "100%" });
+ } else {
+ const tablename = `slave${index - 2 < 0 ? '' : index - 2}`;
+ if (item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible && index - 2 === 0) {
+ return
+ }
+ item.sGrd = isChoosePlate ? tablename : item.sGrd;
+ tableList.push(tablename);
+ if (!tabConfig[1]) {
+ tabConfig.push({ "configList": [], "mode": "advanced" });
+ }
+ tabConfig[1].configList.push({ "sName": tablename, "sTabName": item[sLanguage], "showType": "table", "defaultEnabled": true, "bHideTitle": true });
+ }
+ });
+ formData[0].gdsconfigformslave.push({
+ sId: commonUtils.createSid(),
+ sControlName: 'pageLayout',
+ sDefault: JSON.stringify([tableList, tabConfig]),
+ })
+
+ addState.bMesSubBill = true;
+ // addState.copyTo = { master: { maxBillNo: 'sBillNo' } };
+ addState = { ...addState, ...addState1 };
}
}
@@ -195,7 +276,7 @@ const useCommonBase = props => {
})
} else if (bFilterName !== undefined && bFilterCondition !== undefined && bFilterValue !== undefined) {
const currentValue = masterData[bFilterName];
- flag = handleCompareValues(currentValue, bFilterValue, bFilterCondition);
+ // flag = handleCompareValues(currentValue, bFilterValue, bFilterCondition);
}
if (!flag) {
break;
@@ -379,20 +460,22 @@ const useCommonBase = props => {
if (commonUtils.isNotEmptyObject(props.parentProps)) {
pageRoute = '/indexPage/commonBill';
}
- if (name === 'master' && pageRoute.includes('indexPage/commonBill')) {
+ if (name === 'master' && ['/indexPage/commonBill', 'indexPage/commonSubBill'].includes(pageRoute)) {
// condition.sId = configDataId
condition.pageNum = ''
condition.pageSize = ''
delete condition.sSqlCondition
}
- if (name.includes('slave') && pageRoute.includes('indexPage/commonBill')) {
+
+ if (name.includes('slave') && ['/indexPage/commonBill', '/indexPage/commonSubBill'].includes(pageRoute)) {
delete condition.sId
condition.sSqlCondition = {
sParentId: condition.sSqlCondition.sParentId
}
+
}
// 只有弹窗没有不查询
- if (name === 'master' && (sId === '' || !sId) && props.parentProps && pageRoute.includes('indexPage/commonBill')) return
+ if (name === 'master' && (sId === '' || !sId) && props.parentProps && ['/indexPage/commonBill', '/indexPage/commonSubBill'].includes(pageRoute)) return
const dataUrl = `${commonConfig.server_host
}business/getBusinessDataByFormcustomId/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`;
@@ -432,13 +515,16 @@ const useCommonBase = props => {
const filterConditionNew = commonUtils.isNotEmptyObject(filterCondition)
? filterCondition.filter(item => item.bFilterType !== "tree")
: "";
+ // 如果state中存在slaveChildConfig 那么就是commonSubBill
+ const slaveChild = state?.formData?.find(x => x.sId === state?.slaveChildConfig?.sId)
+ const names = slaveChild && slaveChild.sGrd === name ? 'slaveChild' : name
const addState = {
- [`${name}Data`]: returnData,
- [`${name}TotalData`]: totalData,
+ [`${names}Data`]: returnData,
+ [`${names}TotalData`]: totalData,
// [`${name}Pagination`]: returnPagination,
- [`${name}FilterCondition`]: filterConditionNew,
- [`${name}OrderBy`]: orderBy,
- [`${name}SelectedRowKeys`]: tableSelectedRowKeys,
+ [`${names}FilterCondition`]: filterConditionNew,
+ [`${names}OrderBy`]: orderBy,
+ [`${names}SelectedRowKeys`]: tableSelectedRowKeys,
menuChildData,
pageLoading: false,
iPageSize,
@@ -452,19 +538,21 @@ const useCommonBase = props => {
// 添加动态列数据
if (commonUtils.isNotEmptyArr(columnConfig)) {
- addState[`${name}ColumnConfig`] = columnConfig;
+ addState[`${names}ColumnConfig`] = columnConfig;
}
const slaveSelectedData = [];
- addState[`${name}SelectedData`] = slaveSelectedData;
+ addState[`${names}SelectedData`] = slaveSelectedData;
/* 如果获取数据集时候 删除数据集有数据 则清空 */
if (commonUtils.isNotEmptyArr(tableDelData)) {
- addState[`${name}DelData`] = [];
+ addState[`${names}DelData`] = [];
}
+
if (isWait) {
return addState;
}
{
+
handleSaveState(addState);
}
} else {
@@ -2788,7 +2876,6 @@ const useCommonBase = props => {
const { sControlName = "", sInstruct } = config;
const sControlLowerName = sControlName.toLowerCase();
// 调用指令集
- console.log(sInstruct, 'sInstruct');
if (sInstruct) {
handleExecInstructSet({
...props,
@@ -3481,7 +3568,6 @@ const useCommonBase = props => {
handleOkDel(props);
};
const handleBtnChoose = async (name, sControlName, chooseConfig, recordIndex, tableName) => {
- console.log("🚀 ~ handleBtnChoose ~ chooseConfig:", name, sControlName, chooseConfig, recordIndex, tableName)
return
const { token } = props;
const url = `${commonConfig.server_host}/gdsmodule/getGdsmoduleById/${chooseConfig.sActiveId}?sModelsId=${chooseConfig.sActiveId}`;
diff --git a/src/mes/common/commonModelComponent/index.js b/src/mes/common/commonModelComponent/index.js
index e5c1b8f..f9c09e6 100644
--- a/src/mes/common/commonModelComponent/index.js
+++ b/src/mes/common/commonModelComponent/index.js
@@ -282,6 +282,7 @@ const useCommonModelEvent = props => {
// 特殊情况下处理下页面布局
pageLayout = handleGetFilterPageLayout(pageLayout);
const [tableList, tabConfig] = pageLayout;
+ console.log("🚀 ~ useCommonModelEvent ~ tabConfig:", tabConfig, pageLayoutConfig, pageLayout)
const colunmData = handleGetColumnData(tableList, true);
let result = {};
if (!noGetData && sModelsId === '17211911815017669983448000') {
@@ -1906,10 +1907,12 @@ const CommonModel = baseProps => {
};
const CommonModelComponent = props => {
- const { tabConfig = [], level, modelStyle, app, bMesBill, enabled, masterData, sModelsType } = props;
+ const { tabConfig = [], level, modelStyle, app, bMesBill, enabled, masterData, sModelsType, formData } = props;
const { userinfo } = app;
const sLanguage = userinfo.sLanguage;
+ const pageRoute = formData?.[0]?.sName
const getComponent = (config, index = 0) => {
+ console.log("🚀 ~ getComponent ~ config:", config, props)
const {
sName,
sTabName,
@@ -1940,6 +1943,30 @@ const CommonModelComponent = props => {
} else if (showType === "costom") {
return