Commit da399e85abbe77f2312d3af506eff9d5dd893be8

Authored by Min
1 parent 5e2af034

1.处理从表的主体内容展示根据sControlName自定义,主表表单可以根据配置 展示Tab页签

src/components/Common/CommonBill/index.js
@@ -2445,6 +2445,58 @@ const BillComponent = Form.create({ @@ -2445,6 +2445,58 @@ const BillComponent = Form.create({
2445 let CheckInfo = commonFunc.showMessage(app.commonConst, 'CheckInfo');/* 审批信息 */ 2445 let CheckInfo = commonFunc.showMessage(app.commonConst, 'CheckInfo');/* 审批信息 */
2446 const BtnimportData = commonFunc.showMessage(app.commonConst, 'importData');/* 导入数据 */ 2446 const BtnimportData = commonFunc.showMessage(app.commonConst, 'importData');/* 导入数据 */
2447 const ImportData = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes('ImportData') && item.bVisible) : '';/* 后台是否配置导入 */ 2447 const ImportData = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes('ImportData') && item.bVisible) : '';/* 后台是否配置导入 */
  2448 + const masterConfigOld = { ...masterConfig };
  2449 + /* 取 masterConfig中有多少个Tab页签配置 */
  2450 + const masterShowConfig = commonUtils.isNotEmptyObject(masterConfigOld)
  2451 + ? masterConfigOld.gdsconfigformslave.filter(item => item.bVisible && item.sName !== "")
  2452 + : [];
  2453 +
  2454 + const diliverConfigTypeArr = []; /* 有Tab的配置 */
  2455 + masterShowConfig.forEach(child => {
  2456 + if (child.sControlName.indexOf("_") > -1) {
  2457 + const tableType = child.sControlName.split("_")[1];
  2458 + const isIndex = diliverConfigTypeArr.findIndex(item => item === tableType);
  2459 + if (isIndex === -1) {
  2460 + diliverConfigTypeArr.push(tableType);
  2461 + }
  2462 + }
  2463 + });
  2464 +
  2465 +
  2466 + /* 主表页签+表格页签排序规则,表格页签以10位一个间隔,10,20,30,40,50,60,如果想进行排序 则页签顺序介入其间即可 */
  2467 + /* 找到各个主表页签Tab所处的区间 */
  2468 + let diliverConfigTypeArr1 = [];
  2469 + let diliverConfigTypeArr2 = [];
  2470 + let diliverConfigTypeArr3 = [];
  2471 + let diliverConfigTypeArr4 = [];
  2472 + let diliverConfigTypeArr5 = [];
  2473 + let diliverConfigTypeArr6 = [];
  2474 + for (const item of diliverConfigTypeArr) {
  2475 + let numStr = item.replace(/[^\d]/g, "").trim();
  2476 + let num = Number(numStr);
  2477 + if (!commonUtils.isEmpty(num)) {
  2478 + if (num < 10) {
  2479 + /* 0- 10 */
  2480 + diliverConfigTypeArr1.push(item);
  2481 + } else if (num < 20) {
  2482 + /* 10- 20 */
  2483 + diliverConfigTypeArr2.push(item);
  2484 + } else if (num < 30) {
  2485 + /* 20- 30 */
  2486 + diliverConfigTypeArr3.push(item);
  2487 + } else if (num < 40) {
  2488 + /* 30- 40 */
  2489 + diliverConfigTypeArr4.push(item);
  2490 + } else if (num < 50) {
  2491 + /* 40- 50 */
  2492 + diliverConfigTypeArr5.push(item);
  2493 + } else if (num < 60) {
  2494 + /* 50- 60 */
  2495 + diliverConfigTypeArr6.push(item);
  2496 + }
  2497 + }
  2498 + }
  2499 +
2448 2500
2449 2501
2450 if (false && commonUtils.isNotEmptyObject(masterConfig)) { 2502 if (false && commonUtils.isNotEmptyObject(masterConfig)) {
@@ -2613,11 +2665,63 @@ const BillComponent = Form.create({ @@ -2613,11 +2665,63 @@ const BillComponent = Form.create({
2613 <Avatar src={props.imgSrc} /> 2665 <Avatar src={props.imgSrc} />
2614 </div> 2666 </div>
2615 <Tabs className={styles.slaveTabs} style={{ overflowY: 'unset' }} tabBarStyle={{ margin: '0 10px' }} > 2667 <Tabs className={styles.slaveTabs} style={{ overflowY: 'unset' }} tabBarStyle={{ margin: '0 10px' }} >
  2668 + {commonUtils.isNotEmptyArr(diliverConfigTypeArr1)
  2669 + ? diliverConfigTypeArr1.map(item => {
  2670 + // 匹配数字
  2671 + // eslint-disable-next-line no-unused-vars
  2672 + let num = item.replace(/[^\d]/g, "").trim();
  2673 + let tabName = item.replace(/\d+/g, "");
  2674 + /* 从主表配置 找到控件名=tabName,否则取他的showName */
  2675 + const tableConfigArr = masterConfig?.gdsconfigformslave.filter(row => row.sControlName === item.trim());
  2676 + if (commonUtils.isNotEmptyArr(tableConfigArr)) {
  2677 + tabName = tableConfigArr[0].showName;
  2678 + }
  2679 + return (
  2680 + <TabPane tab={tabName} key={num} className="xly-bill-list">
  2681 + <div>
  2682 + <CommonView
  2683 + {...props}
  2684 + // 使高度和从表高度一直
  2685 + // isAutoHeight="ture"
  2686 + tableConfigType={item}
  2687 + tableConfigTypeArr={diliverConfigTypeArr}
  2688 + />
  2689 + </div>
  2690 + </TabPane>
  2691 + );
  2692 + })
  2693 + : ""}
2616 <TabPane tab={MainContent} key={10} className="xly-bill-list"> 2694 <TabPane tab={MainContent} key={10} className="xly-bill-list">
2617 <div className="TabPaneStyle"> 2695 <div className="TabPaneStyle">
2618 <StaticEditTable {...slaveTableProps} setOpterationColumn={props.sModelsType !== 'cost/cosexpenseshare' ? 'Y' : ''} /> 2696 <StaticEditTable {...slaveTableProps} setOpterationColumn={props.sModelsType !== 'cost/cosexpenseshare' ? 'Y' : ''} />
2619 </div> 2697 </div>
2620 </TabPane> 2698 </TabPane>
  2699 + {commonUtils.isNotEmptyArr(diliverConfigTypeArr2)
  2700 + ? diliverConfigTypeArr2.map(item => {
  2701 + // 匹配数字
  2702 + // eslint-disable-next-line no-unused-vars
  2703 + let num = item.replace(/[^\d]/g, "").trim();
  2704 + let tabName = item.replace(/\d+/g, "");
  2705 + /* 从主表配置 找到控件名=tabName,否则取他的showName */
  2706 + const tableConfigArr = masterConfig?.gdsconfigformslave.filter(row => row.sControlName === item.trim());
  2707 + if (commonUtils.isNotEmptyArr(tableConfigArr)) {
  2708 + tabName = tableConfigArr[0].showName;
  2709 + }
  2710 + return (
  2711 + <TabPane tab={tabName} key={num} className="xly-bill-list">
  2712 + <div>
  2713 + <CommonView
  2714 + {...props}
  2715 + // 使高度和从表高度一直
  2716 + // isAutoHeight="ture"
  2717 + tableConfigType={item}
  2718 + tableConfigTypeArr={diliverConfigTypeArr2}
  2719 + />
  2720 + </div>
  2721 + </TabPane>
  2722 + );
  2723 + })
  2724 + : ""}
2621 {getTabPaneExtra('slave')} 2725 {getTabPaneExtra('slave')}
2622 { 2726 {
2623 slaveInfoList?.map((item, index) => { 2727 slaveInfoList?.map((item, index) => {