Commit fb596e372d6e7eb2bba377d57ce2703b252da753

Authored by chenxt
1 parent 4233cf85

新增commonSubBill功能

src/components/Common/CommonComponent/index.js
@@ -1518,7 +1518,7 @@ export default class CommonComponent extends Component { @@ -1518,7 +1518,7 @@ export default class CommonComponent extends Component {
1518 }, /* 数据改变回带到父组件 */ 1518 }, /* 数据改变回带到父组件 */
1519 parser: (oldValue) => { 1519 parser: (oldValue) => {
1520 const value = this.handleCheckNumberInnerInput(oldValue); 1520 const value = this.handleCheckNumberInnerInput(oldValue);
1521 - return value?.replace(/\$\s?|(,*)/g, ''); 1521 + return String(value || '').replace(/\$\s?|(,*)/g, '');
1522 }, 1522 },
1523 formatter: (value) => { 1523 formatter: (value) => {
1524 if (value === '' || value === undefined || value === null || location.pathname.includes("indexPad")) { 1524 if (value === '' || value === undefined || value === null || location.pathname.includes("indexPad")) {
src/components/Common/CommonHooks/useCommonBase.js
@@ -152,6 +152,7 @@ const useCommonBase = props => { @@ -152,6 +152,7 @@ const useCommonBase = props => {
152 }); 152 });
153 addState1.slaveInfoList = slaveInfoList; 153 addState1.slaveInfoList = slaveInfoList;
154 } 154 }
  155 + const deferredItems = [];
155 formData.forEach((item, index) => { 156 formData.forEach((item, index) => {
156 if (index === 0) { 157 if (index === 0) {
157 item.sGrd = isChoosePlate ? 'master' : item.sGrd; 158 item.sGrd = isChoosePlate ? 'master' : item.sGrd;
@@ -160,6 +161,7 @@ const useCommonBase = props => { @@ -160,6 +161,7 @@ const useCommonBase = props => {
160 } else { 161 } else {
161 const tablename = `slave${index - 2 < 0 ? '' : index - 2}`; 162 const tablename = `slave${index - 2 < 0 ? '' : index - 2}`;
162 if (item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible && index - 2 === 0) { 163 if (item.bGrd && item.sTbName !== 'sysbillcheckresult' && item.bGrdVisible && index - 2 === 0) {
  164 + deferredItems.push({ item, tablename });
163 return 165 return
164 } 166 }
165 item.sGrd = isChoosePlate ? tablename : item.sGrd; 167 item.sGrd = isChoosePlate ? tablename : item.sGrd;
@@ -170,6 +172,22 @@ const useCommonBase = props =&gt; { @@ -170,6 +172,22 @@ const useCommonBase = props =&gt; {
170 tabConfig[1].configList.push({ "sName": tablename, "sTabName": item[sLanguage], "showType": "table", "defaultEnabled": true, "bHideTitle": true }); 172 tabConfig[1].configList.push({ "sName": tablename, "sTabName": item[sLanguage], "showType": "table", "defaultEnabled": true, "bHideTitle": true });
171 } 173 }
172 }); 174 });
  175 + deferredItems.forEach(({ item, tablename }) => {
  176 + item.sGrd = isChoosePlate ? tablename : item.sGrd;
  177 + tableList.push(tablename);
  178 +
  179 + if (!tabConfig[2]) {
  180 + tabConfig.push({ "configList": [], "mode": "advanced" });
  181 + }
  182 + tabConfig[2].configList.push({
  183 + "sName": tablename,
  184 + "sTabName": item[sLanguage],
  185 + "showType": "table",
  186 + "defaultEnabled": true,
  187 + "bHideTitle": true,
  188 + "slaveChild": true,
  189 + });
  190 + });
173 formData[0].gdsconfigformslave.push({ 191 formData[0].gdsconfigformslave.push({
174 sId: commonUtils.createSid(), 192 sId: commonUtils.createSid(),
175 sControlName: 'pageLayout', 193 sControlName: 'pageLayout',
@@ -515,7 +533,7 @@ const useCommonBase = props =&gt; { @@ -515,7 +533,7 @@ const useCommonBase = props =&gt; {
515 const filterConditionNew = commonUtils.isNotEmptyObject(filterCondition) 533 const filterConditionNew = commonUtils.isNotEmptyObject(filterCondition)
516 ? filterCondition.filter(item => item.bFilterType !== "tree") 534 ? filterCondition.filter(item => item.bFilterType !== "tree")
517 : ""; 535 : "";
518 - // 如果state中存在slaveChildConfig 那么就是commonSubBill 536 + // 如果state中存在slaveChildConfig 那么就是commonSubBill
519 const slaveChild = state?.formData?.find(x => x.sId === state?.slaveChildConfig?.sId) 537 const slaveChild = state?.formData?.find(x => x.sId === state?.slaveChildConfig?.sId)
520 const names = slaveChild && slaveChild.sGrd === name ? 'slaveChild' : name 538 const names = slaveChild && slaveChild.sGrd === name ? 'slaveChild' : name
521 const addState = { 539 const addState = {
@@ -3051,7 +3069,7 @@ const useCommonBase = props =&gt; { @@ -3051,7 +3069,7 @@ const useCommonBase = props =&gt; {
3051 }; 3069 };
3052 3070
3053 // 表格行新增 3071 // 表格行新增
3054 - const handleMesTableLineAdd = ({ tableName, callback, bAddFirst }) => { 3072 + const handleMesTableLineAdd = ({ tableName, callback, bAddFirst, slaveChild }) => {
3055 const { 3073 const {
3056 [`${tableName}Config`]: config = {}, 3074 [`${tableName}Config`]: config = {},
3057 [`${tableName}Data`]: data = [], 3075 [`${tableName}Data`]: data = [],
@@ -3097,19 +3115,34 @@ const useCommonBase = props =&gt; { @@ -3097,19 +3115,34 @@ const useCommonBase = props =&gt; {
3097 if (masterData.sId) { 3115 if (masterData.sId) {
3098 addRowData.sParentId = masterData.sId; 3116 addRowData.sParentId = masterData.sId;
3099 } 3117 }
  3118 + if (tableName === 'slaveChild') {
  3119 + /* 找到从表的sSqlConditionId */
  3120 + const { slaveSelectedRowKeys, slaveData } = state
  3121 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
  3122 + message.error('请选择父级!');
  3123 + return;
  3124 + }
  3125 + let iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId));
  3126 + if (iIndex > -1) {
  3127 + addRowData.sSqlConditionId = slaveData[iIndex].sSqlConditionId;
  3128 + }
3100 3129
  3130 + }
3101 const newData = bAddFirst ? [addRowData, ...data] : [...data, addRowData]; 3131 const newData = bAddFirst ? [addRowData, ...data] : [...data, addRowData];
3102 const selectedRowKeys = [newSid]; 3132 const selectedRowKeys = [newSid];
3103 const addState = {}; 3133 const addState = {};
3104 if (location.pathname.includes("indexPad")) { 3134 if (location.pathname.includes("indexPad")) {
3105 addState.enabled = true; 3135 addState.enabled = true;
3106 } 3136 }
3107 - 3137 + // const slaveChildData = slaveChild ? {
  3138 + // [`${'slaveChild'}Data`]: newData,
  3139 + // [`${'slaveChild'}SelectedRowKeys`]: selectedRowKeys
  3140 + // } : {}
3108 handleSaveState( 3141 handleSaveState(
3109 { 3142 {
3110 ...addState, 3143 ...addState,
3111 [`${tableName}Data`]: newData, 3144 [`${tableName}Data`]: newData,
3112 - [`${tableName}SelectedRowKeys`]: selectedRowKeys 3145 + [`${tableName}SelectedRowKeys`]: selectedRowKeys,
3113 }, 3146 },
3114 callback 3147 callback
3115 ); 3148 );
@@ -3143,6 +3176,17 @@ const useCommonBase = props =&gt; { @@ -3143,6 +3176,17 @@ const useCommonBase = props =&gt; {
3143 tableDataRow.bDefault = false; 3176 tableDataRow.bDefault = false;
3144 tableDataRow.iOrder = commonUtils.isNotEmptyArr(tableData) ? iOrderMax + 1 : 1; 3177 tableDataRow.iOrder = commonUtils.isNotEmptyArr(tableData) ? iOrderMax + 1 : 1;
3145 tableDataRow.defaultAdded = tableData.length === 0; 3178 tableDataRow.defaultAdded = tableData.length === 0;
  3179 + if (name === 'slaveChild') {
  3180 + /* 找到从表的sSqlConditionId */
  3181 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
  3182 + message.error('请选择父级!');
  3183 + return;
  3184 + }
  3185 + let iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId));
  3186 + if (iIndex > -1) {
  3187 + tableDataRow.sSqlConditionId = slaveData[iIndex].sSqlConditionId;
  3188 + }
  3189 + }
3146 if (isWait) { 3190 if (isWait) {
3147 return tableDataRow; 3191 return tableDataRow;
3148 } else { 3192 } else {
@@ -3223,9 +3267,105 @@ const useCommonBase = props =&gt; { @@ -3223,9 +3267,105 @@ const useCommonBase = props =&gt; {
3223 tableName, 3267 tableName,
3224 actionName: "mesTableLineDel" 3268 actionName: "mesTableLineDel"
3225 }); 3269 });
  3270 + if (tableName === 'slaveChild') {
  3271 + const params = {
  3272 + sFieldName: 'dAuxiliaryQty',
  3273 + tableDataRow: commonUtils.isEmptyArr(nextProps.slaveChildData) ? [] : nextProps.slaveChildData[0],
  3274 + }
  3275 + // 汇总到从表方法
  3276 + handleWriteBack(params, nextProps);
  3277 + // this.handleGroupDataByDefineNoAfterChange();
  3278 + }
3226 } 3279 }
3227 ); 3280 );
3228 }; 3281 };
  3282 + // 汇总
  3283 + const handleWriteBack = async (params, nextProps) => {
  3284 + const {
  3285 + sFieldName,
  3286 + tableDataRow,
  3287 + } = params;
  3288 + const {
  3289 + slaveSelectedRowKeys,
  3290 + slaveData,
  3291 + slaveChildConfig,
  3292 + slaveChildData,
  3293 + slave0SelectedRowKeys,
  3294 + slave0Data,
  3295 + } = nextProps;
  3296 + if (commonUtils.isEmptyArr(slaveData)) {
  3297 + return;
  3298 + }
  3299 + const addState = {};
  3300 + const sId = tableDataRow.sSqlConditionId || slaveSelectedRowKeys[0] || slaveData[0].sId;
  3301 + const iSlaveIndex = slaveData.findIndex(item => item.sId === sId);
  3302 + const slaveDataRow = slaveData[iSlaveIndex];
  3303 + const slaveChildFilter = slaveChildData.filter(item => item.sSqlConditionId === slaveDataRow.sSqlConditionId);
  3304 + let iSlave0Index = commonUtils.isNotEmptyArr(slave0Data) ? (commonUtils.isNotEmptyArr(slave0SelectedRowKeys) ?
  3305 + slave0Data.findIndex(item => slave0SelectedRowKeys.includes(item.sId)) : 0) : -1;
  3306 + const slave0DataRow = iSlave0Index > -1 ? slave0Data[iSlave0Index] : {};
  3307 + // 需要汇总的字段
  3308 + const writeBackFields = ['dAuxiliaryQty', 'dProductQty', 'dArrivalQty', 'sBarcode', 'sDefineNo'];
  3309 +
  3310 + const bHasiType = slaveChildConfig.gdsconfigformslave.find(item => ['itype', 'iType'].includes(item.sName));
  3311 + if (bHasiType && ['dAuxiliaryQty', 'itype', 'iType', 'dProductQty'].includes(sFieldName)) {
  3312 + // 需要汇总到从表的字段 1:dAuxiliaryQty,2:dEscrowQty,3:dGiveAuxiliaryQty
  3313 + let dAuxiliaryQty = 0;
  3314 + let dEscrowAuxiliaryQty = 0;
  3315 + let dGiveAuxiliaryQty = 0;
  3316 + let dProductQty = 0;
  3317 + slaveChildFilter.forEach(item => {
  3318 + const dataRow = item.sId === params.tableDataRow.sId ? params.tableDataRow : item;
  3319 + const { itype, iType } = dataRow;
  3320 + const type = itype !== undefined ? itype : iType !== undefined ? iType : 11;
  3321 +
  3322 + if (type === 1 || type === '1') {
  3323 + dAuxiliaryQty += commonUtils.isNull(Number(dataRow.dAuxiliaryQty), 0);
  3324 + } else if (type === 2 || type === '2') {
  3325 + dEscrowAuxiliaryQty += commonUtils.isNull(Number(dataRow.dAuxiliaryQty), 0);
  3326 + } else if (type === 3 || type === '3') {
  3327 + dGiveAuxiliaryQty += commonUtils.isNull(Number(dataRow.dAuxiliaryQty), 0);
  3328 + } else if (type === 10 || type === '10') {
  3329 + dAuxiliaryQty += commonUtils.isNull(Number(dataRow.dProductQty), 0);
  3330 + } else if (type === 11 || type === '11') {
  3331 + dProductQty += commonUtils.isNull(Number(dataRow.dAuxiliaryQty), 0);
  3332 + } else if (type === 12 || type === '12') {
  3333 + dProductQty += commonUtils.isNull(Number(dataRow.dProductQty), 0);
  3334 + }
  3335 + });
  3336 + const iIndex = slaveData.findIndex(item => item.sId === sId);
  3337 + let tableDataRow = {};
  3338 + tableDataRow = await this.handleTableChange('slave', 'dEscrowAuxiliaryQty', { dEscrowAuxiliaryQty }, sId, [], true);
  3339 + slaveData[iIndex] = tableDataRow;
  3340 + window.tmpSlaveData = slaveData;
  3341 + tableDataRow = await this.handleTableChange('slave', 'dGiveAuxiliaryQty', { dGiveAuxiliaryQty }, sId, [], true);
  3342 + slaveData[iIndex] = tableDataRow;
  3343 + window.tmpSlaveData = slaveData;
  3344 + tableDataRow = await this.handleTableChange('slave', 'dAuxiliaryQty', { dAuxiliaryQty }, sId, [], true);
  3345 + slaveData[iIndex] = tableDataRow;
  3346 + if (commonUtils.isNotEmptyObject(slave0DataRow)) {
  3347 + const dSlave0AuxiliaryQty = slave0DataRow['dAuxiliaryQty'];
  3348 + const table0DataRow = await this.handleTableChange('slave0', 'dAuxiliaryQty', { dSlave0AuxiliaryQty }, slave0DataRow.sId, [], true);
  3349 + slave0Data[iSlave0Index] = table0DataRow;
  3350 + addState.slave0Data = slave0Data;
  3351 + }
  3352 + if (slaveChildFilter.some(item => item.itype === 11 || item.iType === 11 || item.itype === 12 || item.iType === 12) || commonUtils.isEmptyArr(slaveChildFilter)) {
  3353 + window.tmpSlaveData = slaveData;
  3354 + tableDataRow = await this.handleTableChange('slave', 'dProductQty', { dProductQty }, sId, [], true);
  3355 + slaveData[iIndex] = tableDataRow;
  3356 + }
  3357 + window.tmpSlaveData = null;
  3358 + this.props.onSaveState({ slaveData, ...addState });
  3359 + } else if (bHasiType && writeBackFields.includes(sFieldName)) {
  3360 + let dQty = 0;
  3361 + slaveChildFilter.forEach(item => {
  3362 + const dataRow = item.sId === tableDataRow.sId ? tableDataRow : item;
  3363 + dQty += commonUtils.isNull(dataRow[sFieldName], 0);
  3364 + });
  3365 + this.handleTableChange('slave', sFieldName, { [sFieldName]: dQty }, sId, [], false);
  3366 + }
  3367 +
  3368 + }
3229 // 表格行复制 3369 // 表格行复制
3230 const handleMesTableLineCopy = ({ tableName, record, index, callback }) => { 3370 const handleMesTableLineCopy = ({ tableName, record, index, callback }) => {
3231 const { [`${tableName}Data`]: data = [] } = state; 3371 const { [`${tableName}Data`]: data = [] } = state;
src/components/Common/CommonTable/index.js
@@ -1490,7 +1490,7 @@ class CommonTableRc extends React.Component { @@ -1490,7 +1490,7 @@ class CommonTableRc extends React.Component {
1490 name 1490 name
1491 ) /* 选择行发生改变时调用的函数 */, 1491 ) /* 选择行发生改变时调用的函数 */,
1492 getCheckboxProps: record => ({ 1492 getCheckboxProps: record => ({
1493 - disabled: !!record.checkboxDisabled || record.bDisplayHighLight, 1493 + disabled: !!record?.checkboxDisabled || record?.bDisplayHighLight,
1494 style: 1494 style:
1495 record.bSum && commonConfig.hasSum 1495 record.bSum && commonConfig.hasSum
1496 ? { display: "none" } 1496 ? { display: "none" }
@@ -1562,6 +1562,7 @@ class CommonTableRc extends React.Component { @@ -1562,6 +1562,7 @@ class CommonTableRc extends React.Component {
1562 getTableProps = () => { 1562 getTableProps = () => {
1563 /* 给数据都添加上key */ 1563 /* 给数据都添加上key */
1564 const { tableColumn, dataSource } = this.state; 1564 const { tableColumn, dataSource } = this.state;
  1565 + console.log("🚀 ~ CommonTableRc ~ dataSource:", dataSource)
1565 // 二级表头 1566 // 二级表头
1566 const subTableColumn = tableColumn.reduce((result, item) => { 1567 const subTableColumn = tableColumn.reduce((result, item) => {
1567 if (commonUtils.isNotEmptyArr(item.children)) { 1568 if (commonUtils.isNotEmptyArr(item.children)) {
@@ -2184,11 +2185,11 @@ class CommonTableRc extends React.Component { @@ -2184,11 +2185,11 @@ class CommonTableRc extends React.Component {
2184 if (!bEnabled) return; 2185 if (!bEnabled) return;
2185 2186
2186 let newValue = ""; 2187 let newValue = "";
2187 - if (!value || value ==='/') { 2188 + if (!value || value === '/') {
2188 newValue = "✓"; 2189 newValue = "✓";
2189 } else if (["1", "✓"].includes(value)) { 2190 } else if (["1", "✓"].includes(value)) {
2190 newValue = "✗"; 2191 newValue = "✗";
2191 - }else if (["0", "✗"].includes(value)) { 2192 + } else if (["0", "✗"].includes(value)) {
2192 newValue = "/"; 2193 newValue = "/";
2193 } 2194 }
2194 2195
@@ -2260,11 +2261,11 @@ class CommonTableRc extends React.Component { @@ -2260,11 +2261,11 @@ class CommonTableRc extends React.Component {
2260 2261
2261 </div> 2262 </div>
2262 ); 2263 );
2263 - } else if (value === "3" || value === '/') { 2264 + } else if (value === "3" || value === '/') {
2264 return ( 2265 return (
2265 <div 2266 <div
2266 className={`${styles.xunjianNone} ${false ? styles.xunjianEnabled : "" 2267 className={`${styles.xunjianNone} ${false ? styles.xunjianEnabled : ""
2267 - }`} 2268 + }`}
2268 onClick={xunjianClick.bind(this, { 2269 onClick={xunjianClick.bind(this, {
2269 bEnabled, 2270 bEnabled,
2270 value, 2271 value,
@@ -3364,7 +3365,7 @@ class CommonTableRc extends React.Component { @@ -3364,7 +3365,7 @@ class CommonTableRc extends React.Component {
3364 components.header = { cell: ResizeableTitle }; 3365 components.header = { cell: ResizeableTitle };
3365 } 3366 }
3366 let bPagination = true; /* 默认表格分页s */ 3367 let bPagination = true; /* 默认表格分页s */
3367 - let {mesTotalCount , mesPageSize, mesPageNum, isPagination} = this.props.tableProps || {}; 3368 + let { mesTotalCount, mesPageSize, mesPageNum, isPagination } = this.props.tableProps || {};
3368 console.log(this.props.tableProps, 'this.props.tableProps'); 3369 console.log(this.props.tableProps, 'this.props.tableProps');
3369 3370
3370 if (commonUtils.isNotEmptyObject(this.props)) { 3371 if (commonUtils.isNotEmptyObject(this.props)) {
@@ -3391,74 +3392,74 @@ class CommonTableRc extends React.Component { @@ -3391,74 +3392,74 @@ class CommonTableRc extends React.Component {
3391 // } 3392 // }
3392 3393
3393 if (!this.props.noVlist && !noVlistController) { 3394 if (!this.props.noVlist && !noVlistController) {
3394 - if (this.props.slaveInfo || this.useVListNew) {  
3395 - if (!this.uniqueId) {  
3396 - this.uniqueId = this.props.formId  
3397 - ? `${this.props.formId}_${lodash.uniqueId()}`  
3398 - : lodash.uniqueId();  
3399 - }  
3400 - if (!this.Vcomponents || window.vlistNewSearh) {  
3401 - const { tableClassName } = this.state;  
3402 - const oTable = document.querySelectorAll(`.${tableClassName}`)[0];  
3403 - if (oTable) {  
3404 - const oBody = oTable.querySelector(".ant-table-body");  
3405 - oBody && (oBody.scrollTop = 0);  
3406 - }  
3407 - window.vlistNewSearh = null;  
3408 - this.Vcomponents = VListNew({  
3409 - height: this.scrollY,  
3410 - vid: this.uniqueId,  
3411 - onScroll: () => {  
3412 - setTimeout(() => {  
3413 - let divs = document.getElementsByClassName("noInputInsert");  
3414 - if (divs.length) {  
3415 - Array.prototype.forEach.call(divs, item => {  
3416 - item.parentNode.parentNode.parentNode.parentNode.classList.add(  
3417 - "insertTd"  
3418 - );  
3419 - });  
3420 - }  
3421 - }, 20); 3395 + if (this.props.slaveInfo || this.useVListNew) {
  3396 + if (!this.uniqueId) {
  3397 + this.uniqueId = this.props.formId
  3398 + ? `${this.props.formId}_${lodash.uniqueId()}`
  3399 + : lodash.uniqueId();
  3400 + }
  3401 + if (!this.Vcomponents || window.vlistNewSearh) {
  3402 + const { tableClassName } = this.state;
  3403 + const oTable = document.querySelectorAll(`.${tableClassName}`)[0];
  3404 + if (oTable) {
  3405 + const oBody = oTable.querySelector(".ant-table-body");
  3406 + oBody && (oBody.scrollTop = 0);
3422 } 3407 }
3423 - });  
3424 - }  
3425 - components = { ...this.Vcomponents, ...components };  
3426 - } else {  
3427 - // vid是多个列表在同个页面中,同时渲染会促发问题  
3428 - // vid不可以为随机数,随机数会导致双击时,点击的两个VList id不同  
3429 - if (!this.uniqueId) {  
3430 - this.uniqueId = this.props.formId  
3431 - ? `${this.props.formId}_${lodash.uniqueId()}`  
3432 - : lodash.uniqueId();  
3433 - }  
3434 - if (!this.Vcomponents1 || window.vlistNewSearh) {  
3435 - const { tableClassName } = this.state;  
3436 - const oTable = document.querySelectorAll(`.${tableClassName}`)[0];  
3437 - if (oTable) {  
3438 - const oBody = oTable.querySelector(".ant-table-body");  
3439 - oBody && (oBody.scrollTop = 0);  
3440 - }  
3441 - window.vlistNewSearh = null;  
3442 - this.Vcomponents1 = VList({  
3443 - height: this.scrollY,  
3444 - vid: this.uniqueId,  
3445 - rowKey: this.rowKey,  
3446 - onScroll: () => {  
3447 - setTimeout(() => {  
3448 - let divs = document.getElementsByClassName("noInputInsert");  
3449 - if (divs.length) {  
3450 - Array.prototype.forEach.call(divs, item => {  
3451 - item.parentNode.parentNode.parentNode.parentNode.classList.add(  
3452 - "insertTd"  
3453 - );  
3454 - });  
3455 - }  
3456 - }, 20); 3408 + window.vlistNewSearh = null;
  3409 + this.Vcomponents = VListNew({
  3410 + height: this.scrollY,
  3411 + vid: this.uniqueId,
  3412 + onScroll: () => {
  3413 + setTimeout(() => {
  3414 + let divs = document.getElementsByClassName("noInputInsert");
  3415 + if (divs.length) {
  3416 + Array.prototype.forEach.call(divs, item => {
  3417 + item.parentNode.parentNode.parentNode.parentNode.classList.add(
  3418 + "insertTd"
  3419 + );
  3420 + });
  3421 + }
  3422 + }, 20);
  3423 + }
  3424 + });
  3425 + }
  3426 + components = { ...this.Vcomponents, ...components };
  3427 + } else {
  3428 + // vid是多个列表在同个页面中,同时渲染会促发问题
  3429 + // vid不可以为随机数,随机数会导致双击时,点击的两个VList id不同
  3430 + if (!this.uniqueId) {
  3431 + this.uniqueId = this.props.formId
  3432 + ? `${this.props.formId}_${lodash.uniqueId()}`
  3433 + : lodash.uniqueId();
  3434 + }
  3435 + if (!this.Vcomponents1 || window.vlistNewSearh) {
  3436 + const { tableClassName } = this.state;
  3437 + const oTable = document.querySelectorAll(`.${tableClassName}`)[0];
  3438 + if (oTable) {
  3439 + const oBody = oTable.querySelector(".ant-table-body");
  3440 + oBody && (oBody.scrollTop = 0);
3457 } 3441 }
3458 - }); 3442 + window.vlistNewSearh = null;
  3443 + this.Vcomponents1 = VList({
  3444 + height: this.scrollY,
  3445 + vid: this.uniqueId,
  3446 + rowKey: this.rowKey,
  3447 + onScroll: () => {
  3448 + setTimeout(() => {
  3449 + let divs = document.getElementsByClassName("noInputInsert");
  3450 + if (divs.length) {
  3451 + Array.prototype.forEach.call(divs, item => {
  3452 + item.parentNode.parentNode.parentNode.parentNode.classList.add(
  3453 + "insertTd"
  3454 + );
  3455 + });
  3456 + }
  3457 + }, 20);
  3458 + }
  3459 + });
  3460 + }
  3461 + components = { ...this.Vcomponents1, ...components };
3459 } 3462 }
3460 - components = { ...this.Vcomponents1, ...components };  
3461 - }  
3462 } 3463 }
3463 if (this.props.config && this.props.config.iFreezeColumn) { 3464 if (this.props.config && this.props.config.iFreezeColumn) {
3464 tableColumn.forEach((val, index) => { 3465 tableColumn.forEach((val, index) => {
@@ -9923,7 +9924,7 @@ class CommonTableRc extends React.Component { @@ -9923,7 +9924,7 @@ class CommonTableRc extends React.Component {
9923 if (searchText !== props.searchText) { 9924 if (searchText !== props.searchText) {
9924 stateValue.searchText = props.searchText; 9925 stateValue.searchText = props.searchText;
9925 } 9926 }
9926 - if (true || props.enabled) { 9927 + if (true || props.enabled) {
9927 const { config } = this.props; 9928 const { config } = this.props;
9928 if (commonUtils.isNotEmptyObject(config)) { 9929 if (commonUtils.isNotEmptyObject(config)) {
9929 const productionRoute = 9930 const productionRoute =
@@ -10841,6 +10842,7 @@ class CommonTableRc extends React.Component { @@ -10841,6 +10842,7 @@ class CommonTableRc extends React.Component {
10841 10842
10842 /* 获取table中的props */ 10843 /* 获取table中的props */
10843 const tableProps = this.getTableProps(); 10844 const tableProps = this.getTableProps();
  10845 + console.log("🚀 ~ CommonTableRc ~ render ~ tableProps:", tableProps)
10844 let autoHeight = this.props.tableProps.AutoTableHeight; 10846 let autoHeight = this.props.tableProps.AutoTableHeight;
10845 10847
10846 const realizeHeight = 10848 const realizeHeight =
@@ -11166,13 +11168,33 @@ class CommonTableRc extends React.Component { @@ -11166,13 +11168,33 @@ class CommonTableRc extends React.Component {
11166 this.setState({ affixMenuVisible: false }); 11168 this.setState({ affixMenuVisible: false });
11167 } 11169 }
11168 }; 11170 };
11169 - let { mesTotalCount , mesPageSize, mesPageNum, isPagination} = this.props.tableProps || {}; 11171 + let { mesTotalCount, mesPageSize, mesPageNum, isPagination } = this.props.tableProps || {};
11170 const handleMesPaginationChange = (page, pageSize) => { 11172 const handleMesPaginationChange = (page, pageSize) => {
11171 - this.props.onSaveState({  
11172 - mesPageNum: page,  
11173 - mesPageSize: pageSize,  
11174 - mesPageChange: true  
11175 - }); 11173 + this.props.onSaveState({
  11174 + mesPageNum: page,
  11175 + mesPageSize: pageSize,
  11176 + mesPageChange: true
  11177 + });
  11178 + }
  11179 +
  11180 + if (this.props?.name === 'slaveChild') {
  11181 + tableProps.dataSource = tableProps.dataSource
  11182 + .map(item => {
  11183 + const { slaveSelectedRowKeys, slaveData } = this.props?.parentProps;
  11184 +
  11185 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
  11186 + return null;
  11187 + }
  11188 +
  11189 + let iIndex = slaveData.findIndex(slaveItem =>
  11190 + slaveSelectedRowKeys.includes(slaveItem.sId) &&
  11191 + slaveItem.sSqlConditionId === item?.sSqlConditionId
  11192 + );
  11193 +
  11194 + return iIndex > -1 ? item : null;
  11195 + })
  11196 + .filter(item => item !== null); // 过滤掉 null/undefined
  11197 +
11176 } 11198 }
11177 11199
11178 return ( 11200 return (
@@ -11272,33 +11294,33 @@ class CommonTableRc extends React.Component { @@ -11272,33 +11294,33 @@ class CommonTableRc extends React.Component {
11272 /> 11294 />
11273 </DndProvider> 11295 </DndProvider>
11274 ) : ( 11296 ) : (
11275 - <div style={{position: 'relative', width: '100%', height: '100%'}}> 11297 + <div style={{ position: 'relative', width: '100%', height: '100%' }}>
11276 <Table 11298 <Table
11277 - {...tableProps}  
11278 - addRow={addProps}  
11279 - delProps={delProps}  
11280 - tableLayout="fixed"  
11281 - expandable={{  
11282 - expandedRowRender:  
11283 - this.props.setExpandedRowRender === "Y" ? expandedRow : null,  
11284 - defaultExpandAllRows: this.props.defaultExpandAllRows || null  
11285 - }}  
11286 - scroll={{  
11287 - x: this.scrollX,  
11288 - y: !layoutScrollY ? this.scrollY : layoutScrollY  
11289 - }}  
11290 - summary={this.genFooter}  
11291 - size="small"  
11292 - sticky={this.sticky}  
11293 - showSorterTooltip={false}  
11294 - > 11299 + {...tableProps}
  11300 + addRow={addProps}
  11301 + delProps={delProps}
  11302 + tableLayout="fixed"
  11303 + expandable={{
  11304 + expandedRowRender:
  11305 + this.props.setExpandedRowRender === "Y" ? expandedRow : null,
  11306 + defaultExpandAllRows: this.props.defaultExpandAllRows || null
  11307 + }}
  11308 + scroll={{
  11309 + x: this.scrollX,
  11310 + y: !layoutScrollY ? this.scrollY : layoutScrollY
  11311 + }}
  11312 + summary={this.genFooter}
  11313 + size="small"
  11314 + sticky={this.sticky}
  11315 + showSorterTooltip={false}
  11316 + >
11295 11317
11296 - </Table>  
11297 - <div style={{textAlign: 'center', position: 'absolute', bottom: '50px', left: '50%', transform: 'translateX(-50%)', fontSize:'30px'}} >  
11298 - {  
11299 - isPagination && <Pagination size="default " simple defaultCurrent={mesPageNum} total={mesTotalCount} onChange={handleMesPaginationChange} />  
11300 - }  
11301 - </div> 11318 + </Table>
  11319 + <div style={{ textAlign: 'center', position: 'absolute', bottom: '50px', left: '50%', transform: 'translateX(-50%)', fontSize: '30px' }} >
  11320 + {
  11321 + isPagination && <Pagination size="default " simple defaultCurrent={mesPageNum} total={mesTotalCount} onChange={handleMesPaginationChange} />
  11322 + }
  11323 + </div>
11302 </div> 11324 </div>
11303 )} 11325 )}
11304 </div> 11326 </div>
@@ -11839,7 +11861,7 @@ const useCommonTableEvent = props =&gt; { @@ -11839,7 +11861,7 @@ const useCommonTableEvent = props =&gt; {
11839 // if (data?.length === 0) { 11861 // if (data?.length === 0) {
11840 // data.push({ sId: commonUtils.createSid() }); 11862 // data.push({ sId: commonUtils.createSid() });
11841 // } 11863 // }
11842 - handleSetIRowNum(data); 11864 + handleSetIRowNum(data, props);
11843 handleSetCheckboxDisabled({ ...props, getBtnDisabled }); // 限制多选框选择 11865 handleSetCheckboxDisabled({ ...props, getBtnDisabled }); // 限制多选框选择
11844 handleSetCostomEnabledList({ ...props, allTableSelectedOneData }, data); 11866 handleSetCostomEnabledList({ ...props, allTableSelectedOneData }, data);
11845 setUpdateRowNumTime(pre => pre + 1); 11867 setUpdateRowNumTime(pre => pre + 1);
@@ -12165,9 +12187,10 @@ const CommonTable = baseProps =&gt; { @@ -12165,9 +12187,10 @@ const CommonTable = baseProps =&gt; {
12165 return <CommonTableRc {...props} />; 12187 return <CommonTableRc {...props} />;
12166 }; 12188 };
12167 12189
12168 -const handleSetIRowNum = data => { 12190 +const handleSetIRowNum = (data, props) => {
12169 data.forEach((item, index) => { 12191 data.forEach((item, index) => {
12170 item.iRowNum = index + 1; 12192 item.iRowNum = index + 1;
  12193 +
12171 if (commonUtils.isNotEmptyArr(item.children)) { 12194 if (commonUtils.isNotEmptyArr(item.children)) {
12172 handleSetIRowNum(item.children); 12195 handleSetIRowNum(item.children);
12173 } 12196 }
@@ -12352,6 +12375,7 @@ const useGetTableBtnOprSetting = props =&gt; { @@ -12352,6 +12375,7 @@ const useGetTableBtnOprSetting = props =&gt; {
12352 list.forEach(btnType => { 12375 list.forEach(btnType => {
12353 if (btnType.includes("add")) { 12376 if (btnType.includes("add")) {
12354 resultTemp.mesAdd = params => { 12377 resultTemp.mesAdd = params => {
  12378 + console.log("🚀 ~ useGetTableBtnOprSetting ~ params:", params, props)
12355 const { sDefault: str } = btnTableAddConfig; 12379 const { sDefault: str } = btnTableAddConfig;
12356 let disabled = props.getBtnDisabled({ 12380 let disabled = props.getBtnDisabled({
12357 str, 12381 str,
@@ -12391,7 +12415,8 @@ const useGetTableBtnOprSetting = props =&gt; { @@ -12391,7 +12415,8 @@ const useGetTableBtnOprSetting = props =&gt; {
12391 callback: props.bAddFirst 12415 callback: props.bAddFirst
12392 ? scrollToTop(params.tableClassName) 12416 ? scrollToTop(params.tableClassName)
12393 : scrollToBottom(params.tableClassName), 12417 : scrollToBottom(params.tableClassName),
12394 - bAddFirst: props.bAddFirst 12418 + bAddFirst: props.bAddFirst,
  12419 + slaveChild: props?.parentProps?.slaveChild
12395 }); 12420 });
12396 } 12421 }
12397 12422
src/mes/common/commonModelComponent/index.js
@@ -282,7 +282,6 @@ const useCommonModelEvent = props =&gt; { @@ -282,7 +282,6 @@ const useCommonModelEvent = props =&gt; {
282 // 特殊情况下处理下页面布局 282 // 特殊情况下处理下页面布局
283 pageLayout = handleGetFilterPageLayout(pageLayout); 283 pageLayout = handleGetFilterPageLayout(pageLayout);
284 const [tableList, tabConfig] = pageLayout; 284 const [tableList, tabConfig] = pageLayout;
285 - console.log("🚀 ~ useCommonModelEvent ~ tabConfig:", tabConfig, pageLayoutConfig, pageLayout)  
286 const colunmData = handleGetColumnData(tableList, true); 285 const colunmData = handleGetColumnData(tableList, true);
287 let result = {}; 286 let result = {};
288 if (!noGetData && sModelsId === '17211911815017669983448000') { 287 if (!noGetData && sModelsId === '17211911815017669983448000') {
@@ -413,7 +412,7 @@ const useCommonModelEvent = props =&gt; { @@ -413,7 +412,7 @@ const useCommonModelEvent = props =&gt; {
413 412
414 const { masterConfig, sModelsId, masterData } = props; 413 const { masterConfig, sModelsId, masterData } = props;
415 const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {} 414 const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {}
416 - if (masterData && masterData.sBillNo) return 415 + if (masterData && masterData.sBillNo || masterData && masterData.sId) return
417 let masterDataCopyTo = {}; 416 let masterDataCopyTo = {};
418 for (const key in copyTo) { 417 for (const key in copyTo) {
419 const tableData = copyTo[key]; 418 const tableData = copyTo[key];
@@ -542,7 +541,6 @@ const useCommonModelEvent = props =&gt; { @@ -542,7 +541,6 @@ const useCommonModelEvent = props =&gt; {
542 } 541 }
543 }; 542 };
544 const handleGetDataPop = async (tableList = [], isWait, bInit) => { 543 const handleGetDataPop = async (tableList = [], isWait, bInit) => {
545 - console.log('handleGetData开始执行,tableList:', tableList);  
546 let addState = {}; 544 let addState = {};
547 for (let i = 0; i < tableList.length; i++) { 545 for (let i = 0; i < tableList.length; i++) {
548 const tableName = tableList[i]; 546 const tableName = tableList[i];
@@ -752,7 +750,6 @@ const useCommonModelEvent = props =&gt; { @@ -752,7 +750,6 @@ const useCommonModelEvent = props =&gt; {
752 item => item.sControlName === "bFirstlineSelected" && item.bVisible 750 item => item.sControlName === "bFirstlineSelected" && item.bVisible
753 ); 751 );
754 // 配置刷新数据时,配置 数据集名称+FirstlineSelected,默认选中首行数据。 752 // 配置刷新数据时,配置 数据集名称+FirstlineSelected,默认选中首行数据。
755 - console.log('bFirstlineSelected', bFirstlineSelected);  
756 if (!bFirstlineSelected) { 753 if (!bFirstlineSelected) {
757 bFirstlineSelected = 754 bFirstlineSelected =
758 tableList.findIndex( 755 tableList.findIndex(
@@ -1912,7 +1909,6 @@ const CommonModelComponent = props =&gt; { @@ -1912,7 +1909,6 @@ const CommonModelComponent = props =&gt; {
1912 const sLanguage = userinfo.sLanguage; 1909 const sLanguage = userinfo.sLanguage;
1913 const pageRoute = formData?.[0]?.sName 1910 const pageRoute = formData?.[0]?.sName
1914 const getComponent = (config, index = 0) => { 1911 const getComponent = (config, index = 0) => {
1915 - console.log("🚀 ~ getComponent ~ config:", config, props)  
1916 const { 1912 const {
1917 sName, 1913 sName,
1918 sTabName, 1914 sTabName,
@@ -1920,7 +1916,8 @@ const CommonModelComponent = props =&gt; { @@ -1920,7 +1916,8 @@ const CommonModelComponent = props =&gt; {
1920 defaultEnabled, 1916 defaultEnabled,
1921 bHideTitle, 1917 bHideTitle,
1922 tableBtnsConfig, 1918 tableBtnsConfig,
1923 - children = [] 1919 + children = [],
  1920 + slaveChild
1924 } = config; 1921 } = config;
1925 1922
1926 if (showType === "none") { 1923 if (showType === "none") {
@@ -1949,12 +1946,13 @@ const CommonModelComponent = props =&gt; { @@ -1949,12 +1946,13 @@ const CommonModelComponent = props =&gt; {
1949 showType, // 展示类型(表单/表格) 1946 showType, // 展示类型(表单/表格)
1950 enabled: !bMesBill ? defaultEnabled : enabled, // 是否可编辑 1947 enabled: !bMesBill ? defaultEnabled : enabled, // 是否可编辑
1951 sTabName, // 标题名称 1948 sTabName, // 标题名称
1952 - sName, // 配置对应的sGrd 1949 + sName: slaveChild ? 'slaveChild' : sName, // 配置对应的sGrd
1953 bHideTitle, //隐藏标题 1950 bHideTitle, //隐藏标题
1954 tableBtnsConfig, // 表格按钮配置 1951 tableBtnsConfig, // 表格按钮配置
1955 - bFirstComponent: level === 0 && index === -1 1952 + bFirstComponent: level === 0 && index === -1,
  1953 + slaveChild
1956 }; 1954 };
1957 - console.log("🚀 ~ getComponent ~ componentProps:", componentProps) 1955 +
1958 const commonDivHeight = useComputedCommonDivHeight(componentProps); 1956 const commonDivHeight = useComputedCommonDivHeight(componentProps);
1959 return ( 1957 return (
1960 <div 1958 <div
@@ -1963,7 +1961,7 @@ const CommonModelComponent = props =&gt; { @@ -1963,7 +1961,7 @@ const CommonModelComponent = props =&gt; {
1963 key={sName} 1961 key={sName}
1964 > 1962 >
1965 <CommonViewTableComponent {...componentProps} /> 1963 <CommonViewTableComponent {...componentProps} />
1966 - {/* <CommonTableComponent {...componentProps} /> */} 1964 + <CommonTableComponent {...componentProps} />
1967 </div> 1965 </div>
1968 ); 1966 );
1969 } 1967 }
@@ -1998,9 +1996,9 @@ const CommonModelComponent = props =&gt; { @@ -1998,9 +1996,9 @@ const CommonModelComponent = props =&gt; {
1998 extraStyle.flexDirection = 'column'; 1996 extraStyle.flexDirection = 'column';
1999 extraStyle.paddingTop = 5; 1997 extraStyle.paddingTop = 5;
2000 } 1998 }
2001 - const { sModelsId } = props; 1999 + const { sModelsId, slaveChildConfig } = props;
2002 const isNotTab = sModelsId === '12710101117119423319470' 2000 const isNotTab = sModelsId === '12710101117119423319470'
2003 - 2001 + const subHeight = slaveChildConfig ? '' : '100%'
2004 return ( 2002 return (
2005 <> 2003 <>
2006 <div className={styles.commonModel} style={{ ...modelStyle, ...extraStyle }}> 2004 <div className={styles.commonModel} style={{ ...modelStyle, ...extraStyle }}>
@@ -2012,7 +2010,7 @@ const CommonModelComponent = props =&gt; { @@ -2012,7 +2010,7 @@ const CommonModelComponent = props =&gt; {
2012 sBig5EntireTabName, 2010 sBig5EntireTabName,
2013 mode, 2011 mode,
2014 width = "100%", 2012 width = "100%",
2015 - height = "100%" 2013 + height = subHeight
2016 } = item; 2014 } = item;
2017 const sEntireTabNameNew = sLanguage === 'sEnglish' ? sEnglishEntireTabName : 2015 const sEntireTabNameNew = sLanguage === 'sEnglish' ? sEnglishEntireTabName :
2018 sLanguage === 'sBig5EntireTabName' ? sBig5EntireTabName : sEntireTabName; 2016 sLanguage === 'sBig5EntireTabName' ? sBig5EntireTabName : sEntireTabName;
@@ -2035,7 +2033,7 @@ const CommonModelComponent = props =&gt; { @@ -2035,7 +2033,7 @@ const CommonModelComponent = props =&gt; {
2035 // advancedStyle.border = "1px solid green"; 2033 // advancedStyle.border = "1px solid green";
2036 // { width: "100%", height: level === 0 ? "100%" : "auto" } 2034 // { width: "100%", height: level === 0 ? "100%" : "auto" }
2037 2035
2038 - if (configList.length === 1 && configList[0].showType !== "none") { 2036 + if (configList.length === 1 && configList[0].showType !== "none" && !configList[0].slaveChild) {
2039 if ( 2037 if (
2040 [ 2038 [
2041 "维修申请记录", 2039 "维修申请记录",
@@ -2056,6 +2054,7 @@ const CommonModelComponent = props =&gt; { @@ -2056,6 +2054,7 @@ const CommonModelComponent = props =&gt; {
2056 ...props, 2054 ...props,
2057 sTabName: configList[0].sTabName 2055 sTabName: configList[0].sTabName
2058 }; 2056 };
  2057 +
2059 return ( 2058 return (
2060 <> 2059 <>
2061 <EquipmentRepair {...equipmentRepairProps} /> 2060 <EquipmentRepair {...equipmentRepairProps} />
@@ -2107,6 +2106,7 @@ const CommonModelComponent = props =&gt; { @@ -2107,6 +2106,7 @@ const CommonModelComponent = props =&gt; {
2107 ) 2106 )
2108 .map((config, index) => { 2107 .map((config, index) => {
2109 const { sName, sEnglishTabName, sBig5TabName, sTabName } = config; 2108 const { sName, sEnglishTabName, sBig5TabName, sTabName } = config;
  2109 +
2110 const sTabNewName = sLanguage === 'sEnglish' ? sEnglishTabName : sLanguage === 'sBig5' ? 2110 const sTabNewName = sLanguage === 'sEnglish' ? sEnglishTabName : sLanguage === 'sBig5' ?
2111 sBig5TabName : sTabName; 2111 sBig5TabName : sTabName;
2112 let disabled = false; 2112 let disabled = false;
@@ -2134,6 +2134,7 @@ const CommonModelComponent = props =&gt; { @@ -2134,6 +2134,7 @@ const CommonModelComponent = props =&gt; {
2134 props.salveWybz2Data?.[0]?.bSave === false || 2134 props.salveWybz2Data?.[0]?.bSave === false ||
2135 props.salveWybz2Data?.[0]?.bSave === 0; 2135 props.salveWybz2Data?.[0]?.bSave === 0;
2136 } 2136 }
  2137 +
2137 return ( 2138 return (
2138 <TabPane 2139 <TabPane
2139 tab={sTabNewName} 2140 tab={sTabNewName}
src/mes/common/commonOperationBarComponent/MesToolbar.js
@@ -11,7 +11,6 @@ const ToolbarFun = async (props) =&gt; { @@ -11,7 +11,6 @@ const ToolbarFun = async (props) =&gt; {
11 const { sModelType = '' } = currentMesPane; 11 const { sModelType = '' } = currentMesPane;
12 const { sControlName, sButtonParam } = btnConfig; 12 const { sControlName, sButtonParam } = btnConfig;
13 const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); 13 const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase();
14 - console.log("🚀 ~ ToolbarFun ~ btnName:", btnName)  
15 if ((btnName.includes('btnscanface')) && !bMesBill) { 14 if ((btnName.includes('btnscanface')) && !bMesBill) {
16 handleScanFace(props); 15 handleScanFace(props);
17 return true 16 return true
@@ -20,7 +19,6 @@ const ToolbarFun = async (props) =&gt; { @@ -20,7 +19,6 @@ const ToolbarFun = async (props) =&gt; {
20 } else if (btnName.includes('btnfooter')) { 19 } else if (btnName.includes('btnfooter')) {
21 return false 20 return false
22 } 21 }
23 -  
24 // const { sControlName } = btnConfig; 22 // const { sControlName } = btnConfig;
25 // const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); 23 // const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase();
26 let flag = 0; 24 let flag = 0;
@@ -329,6 +327,8 @@ const ToolbarFun = async (props) =&gt; { @@ -329,6 +327,8 @@ const ToolbarFun = async (props) =&gt; {
329 } 327 }
330 } else if (btnName.includes('tmpinfobysql')) { 328 } else if (btnName.includes('tmpinfobysql')) {
331 return false 329 return false
  330 + } else if (btnName && btnName.includes('btncalc')) {
  331 + handleCalc(props, btnConfig)
332 } 332 }
333 333
334 334
@@ -859,7 +859,6 @@ const handleForceComplete = (props, name, createDate) =&gt; { @@ -859,7 +859,6 @@ const handleForceComplete = (props, name, createDate) =&gt; {
859 } 859 }
860 } 860 }
861 } 861 }
862 - console.log("singleRow:", singleRow);  
863 if (sIndex > -1) { 862 if (sIndex > -1) {
864 if (target === "slaveInfo") { 863 if (target === "slaveInfo") {
865 singleConfig = props.slaveInfoConfig.gdsconfigformslave[sIndex]; 864 singleConfig = props.slaveInfoConfig.gdsconfigformslave[sIndex];
@@ -958,6 +957,94 @@ const handleForceComplete = (props, name, createDate) =&gt; { @@ -958,6 +957,94 @@ const handleForceComplete = (props, name, createDate) =&gt; {
958 }); 957 });
959 } 958 }
960 }; 959 };
  960 +// subbill
  961 +const handleCalc = async (props, btnConfig) => {
  962 + const { masterConfig, masterData, sModelsId, } = props;
  963 + props.onSaveState({ pageLoading: true });
  964 +
  965 + if (commonUtils.isNotEmptyObject(btnConfig)) {
  966 + /* 组装allTableData */
  967 + const allTableMap = {};
  968 + const allReturnMap = {};
  969 + const slaveNameList = [];
  970 + /* 从props找到 所有的Config */
  971 + if (commonUtils.isNotEmptyArr(props)) {
  972 + for (const key of Object.keys(props)) {
  973 + if (key.includes('Config') && !key.includes('onGet') && !key.includes('report')) {
  974 + const tablename = key.replace('Config', '').trim();
  975 + slaveNameList.push(tablename);
  976 + }
  977 + }
  978 + }
  979 +
  980 + if (commonUtils.isNotEmptyArr(slaveNameList)) {
  981 + slaveNameList.forEach((name, index) => {
  982 + const tableConfig = props[name + 'Config']; /* 动态配置 */
  983 + const tableData = props[name + 'Data']; /* 动态配置 */
  984 + const tableSelectedRowKeys = props[name + 'SelectedRowKeys']; /* 选中Key */
  985 + if (commonUtils.isNotEmptyObject(tableConfig)) {
  986 + allTableMap[name + '.' + tableConfig.sTbName] = tableData
  987 + }
  988 +
  989 + })
  990 + const masterTbName = masterConfig.sTbName;
  991 + allTableMap['master.' + masterTbName] = masterData;
  992 + }
  993 + const sButtonParam = btnConfig.sButtonParam;
  994 + const btn = commonUtils.isJSON(sButtonParam) ? JSON.parse(sButtonParam) : '';
  995 + const sProName = btn.sproName;
  996 + const url = `${commonConfig.server_host}calcprocedure/calc?sModelsId=${sModelsId}`;
  997 + const value = {
  998 + sProName,
  999 + sButtonParam,
  1000 + allTableMap
  1001 + };
  1002 + const dataReturn = (await commonServices.postValueService(props.app.token, value, url)).data;
  1003 + if (dataReturn.code === 1) {
  1004 + /* 数据操作 数据回传页面 */
  1005 + message.success('操作成功!');
  1006 + const returnData = dataReturn.dataset.rows[0];
  1007 + if (commonUtils.isNotEmptyArr(slaveNameList) && commonUtils.isNotEmptyObject(returnData)) {
  1008 + slaveNameList.forEach((name, index) => {
  1009 + const tableConfig = props[name + 'Config']; /* 动态配置 */
  1010 + let tableDelData = props[name + 'DelData'];
  1011 + if (commonUtils.isEmptyArr(tableDelData)) {
  1012 + tableDelData = [];
  1013 + }
  1014 + let tableDelDataNew = []
  1015 + let tableData = [];
  1016 + if (commonUtils.isNotEmptyObject(tableConfig)) {
  1017 + tableData = returnData[name + '.' + tableConfig.sTbName]; /* 动态配置 */
  1018 + if (commonUtils.isNotEmptyArr(tableData) && Array.isArray(tableData)) {
  1019 + tableDelDataNew = tableData.filter(item => item.handleType === 'del');
  1020 + tableData = tableData.filter(item => item.handleType !== 'del');
  1021 + tableDelData = tableDelData.concat(tableDelDataNew);
  1022 + }
  1023 +
  1024 + }
  1025 + allReturnMap[name + 'Data'] = tableData;
  1026 + allReturnMap[name + 'DelData'] = tableDelData;
  1027 + });
  1028 + const masterTbName = masterConfig.sTbName;
  1029 + allReturnMap.masterData = returnData['master.' + masterTbName];
  1030 + allReturnMap.masterData.enabled = true;
  1031 + }
  1032 + allReturnMap?.slaveChildData?.forEach(item => {
  1033 + item.sSqlConditionId = allReturnMap?.slaveData?.[0].sSqlConditionId
  1034 + })
  1035 + allReturnMap.slaveSelectedRowKeys = [allReturnMap?.slaveData?.[0].sId]
  1036 +
  1037 + props.onSaveState({ ...allReturnMap, pageLoading: false });
  1038 + } else if (dataReturn.code === -8 || dataReturn.code === 2) {
  1039 + props.getServiceError(dataReturn);
  1040 + props.onSaveState({ pageLoading: false });
  1041 + } else { /* 失败 */
  1042 + props.getServiceError(dataReturn);
  1043 + props.onSaveState({ pageLoading: false });
  1044 + }
  1045 +
  1046 + }
  1047 +}
961 // 新增 1048 // 新增
962 const handleAdd = (props) => { 1049 const handleAdd = (props) => {
963 const { slaveConfig } = props; 1050 const { slaveConfig } = props;
src/mes/common/commonOperationBarComponent/index.js
@@ -92,13 +92,11 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -92,13 +92,11 @@ const useCommonOperationBarComponentEvent = props =&gt; {
92 92
93 const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); 93 const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班');
94 const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); 94 const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班');
95 - console.log(333333);  
96 95
97 // 走工具栏功能逻辑 96 // 走工具栏功能逻辑
98 if (await MesToolbar({ ...props, btnConfig: config })) { 97 if (await MesToolbar({ ...props, btnConfig: config })) {
99 return; 98 return;
100 } 99 }
101 - console.log(222222);  
102 100
103 // 自定义按钮事件 101 // 自定义按钮事件
104 if ( 102 if (
@@ -110,7 +108,6 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -110,7 +108,6 @@ const useCommonOperationBarComponentEvent = props =&gt; {
110 }) 108 })
111 ) 109 )
112 return; 110 return;
113 - console.log(1111111);  
114 111
115 // 通用按钮处理 112 // 通用按钮处理
116 const { showName = "", sActiveKey = "" } = config; 113 const { showName = "", sActiveKey = "" } = config;
@@ -566,7 +563,7 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -566,7 +563,7 @@ const useCommonOperationBarComponentEvent = props =&gt; {
566 const { slaveSelectedRowKeys, slaveData, formData } = props 563 const { slaveSelectedRowKeys, slaveData, formData } = props
567 const record = slaveData.find(item => slaveSelectedRowKeys?.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); 564 const record = slaveData.find(item => slaveSelectedRowKeys?.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId));
568 565
569 -// !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout') 566 + // !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')
570 // // 弹窗展示 567 // // 弹窗展示
571 props.onOpenCommonModal({ 568 props.onOpenCommonModal({
572 type: "commonModal", 569 type: "commonModal",
@@ -575,7 +572,7 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -575,7 +572,7 @@ const useCommonOperationBarComponentEvent = props =&gt; {
575 copyTo, 572 copyTo,
576 sModelType: '/indexPage/commonBill', 573 sModelType: '/indexPage/commonBill',
577 sParentConditions, 574 sParentConditions,
578 - parentProps: {...props, record }, 575 + parentProps: { ...props, record },
579 onOk: data => { 576 onOk: data => {
580 console.log("=====onOk", data); 577 console.log("=====onOk", data);
581 }, 578 },
@@ -602,7 +599,19 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -602,7 +599,19 @@ const useCommonOperationBarComponentEvent = props =&gt; {
602 const sRowData = slaveSelectedData.filter(x => x.sId === selectedRowKeys || x.sSlaveId === selectedRowKeys) 599 const sRowData = slaveSelectedData.filter(x => x.sId === selectedRowKeys || x.sSlaveId === selectedRowKeys)
603 /* 塞原始数据 */ 600 /* 塞原始数据 */
604 if (commonUtils.isNotEmptyArr(slaveSelectedData)) { 601 if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
605 - copyTo.masterData = slaveSelectedData[0]; 602 + delete slaveSelectedData?.[0]?.bCheck
  603 + const sAssignField = copyToConfig?.[0]?.sAssignField
  604 + let addSAssignField = {
  605 + ...commonFunc.getAssignFieldValue(sAssignField, props?.app?.userinfo)
  606 + }
  607 + copyTo.masterData = {
  608 + ...addSAssignField,
  609 + ...commonFunc.getAssignFieldValue(sAssignField, slaveSelectedData[0]),
  610 + handleType: "add",
  611 + sId: commonUtils.createSid(),
  612 + sFormId: sModelsId,
  613 + maxBillNo: "sBillNo",
  614 + };;
606 copyTo.slaveData = slaveSelectedData; 615 copyTo.slaveData = slaveSelectedData;
607 } 616 }
608 const values = { sConfigformId, sControlName, sRowData }; 617 const values = { sConfigformId, sControlName, sRowData };
@@ -621,7 +630,7 @@ const useCommonOperationBarComponentEvent = props =&gt; { @@ -621,7 +630,7 @@ const useCommonOperationBarComponentEvent = props =&gt; {
621 let tableRow = {}; 630 let tableRow = {};
622 tableRow = { ...tableRow, ...commonFunc.getAssignFieldValue(sAssignField, item) }; // 取赋值字段 631 tableRow = { ...tableRow, ...commonFunc.getAssignFieldValue(sAssignField, item) }; // 取赋值字段
623 tableRow.sId = commonUtils.createSid(); 632 tableRow.sId = commonUtils.createSid();
624 - tableRow.sParentId = slaveSelectedData[0].sId; 633 + tableRow.sParentId = copyTo.masterData.sId;
625 tableRow.handleType = 'add'; 634 tableRow.handleType = 'add';
626 newData.push(tableRow); 635 newData.push(tableRow);
627 }) 636 })
@@ -1582,7 +1591,7 @@ const BarcodeComponent = props =&gt; { @@ -1582,7 +1591,7 @@ const BarcodeComponent = props =&gt; {
1582 try { 1591 try {
1583 props.onExecInstructSet({ 1592 props.onExecInstructSet({
1584 btnConfig, 1593 btnConfig,
1585 - nextProps: {scanCodeData: [{value: valueNew}]}, 1594 + nextProps: { scanCodeData: [{ value: valueNew }] },
1586 // callback: () => { 1595 // callback: () => {
1587 // if (commonUtils.isNotEmptyArr(searchProductConfig)) { 1596 // if (commonUtils.isNotEmptyArr(searchProductConfig)) {
1588 // props.onSaveState({ 1597 // props.onSaveState({