Commit 25b2b5cce1578669a094e8acc641921d49cd21e4

Authored by chenxt
1 parent aa13c26a

分页

src/components/Common/CommonHooks/useCommonBase.js
@@ -285,6 +285,7 @@ const useCommonBase = props => { @@ -285,6 +285,7 @@ const useCommonBase = props => {
285 isWait, 285 isWait,
286 configData, 286 configData,
287 clearSelectData, 287 clearSelectData,
  288 + isPagination, // mes的通用列表需要真分页,所以增加isPagination参数控制是否分页
288 } = params; 289 } = params;
289 const { 290 const {
290 token, 291 token,
@@ -294,6 +295,7 @@ const useCommonBase = props => { @@ -294,6 +295,7 @@ const useCommonBase = props => {
294 formData, 295 formData,
295 [`${name}DelData`]: tableDelData 296 [`${name}DelData`]: tableDelData
296 } = state; 297 } = state;
  298 +
297 let { 299 let {
298 menuChildData, 300 menuChildData,
299 [`${name}SelectedRowKeys`]: tableSelectedRowKeys, 301 [`${name}SelectedRowKeys`]: tableSelectedRowKeys,
@@ -323,7 +325,10 @@ const useCommonBase = props => { @@ -323,7 +325,10 @@ const useCommonBase = props => {
323 } 325 }
324 } 326 }
325 } 327 }
326 - 328 + if ( isPagination ) {
  329 + condition.pageSize = condition.pageSize || 10; /* 前台传入页数或者默认页数 */
  330 + condition.pageNum = condition.pageNum || 1; /* 前台传入页数或者默认页数 */
  331 + }
327 // 凹印人检特殊处理 332 // 凹印人检特殊处理
328 if (configData?.sGrd === "slaveWyrj2") { 333 if (configData?.sGrd === "slaveWyrj2") {
329 const { 334 const {
@@ -436,7 +441,12 @@ const useCommonBase = props => { @@ -436,7 +441,12 @@ const useCommonBase = props => {
436 menuChildData, 441 menuChildData,
437 pageLoading: false, 442 pageLoading: false,
438 iPageSize, 443 iPageSize,
439 - masterConditionData 444 + masterConditionData,
  445 + mesTotalCount: isPagination ? dataReturn.dataset.totalCount : null,
  446 + mesPageSize: isPagination ? dataReturn.dataset.pageSize : null,
  447 + mesPageNum: isPagination ? dataReturn.dataset.currentPageNo : null,
  448 + isPagination,
  449 + mesPageChange: false,
440 }; 450 };
441 451
442 // 添加动态列数据 452 // 添加动态列数据
src/components/Common/CommonTable/index.js
@@ -50,7 +50,8 @@ import { @@ -50,7 +50,8 @@ import {
50 Tooltip, 50 Tooltip,
51 Row, 51 Row,
52 Progress, 52 Progress,
53 - Modal 53 + Modal,
  54 + Pagination
54 } from "antd"; 55 } from "antd";
55 import { DndProvider, DropTarget, DragSource } from "react-dnd"; 56 import { DndProvider, DropTarget, DragSource } from "react-dnd";
56 import { 57 import {
@@ -3347,6 +3348,9 @@ class CommonTableRc extends React.Component { @@ -3347,6 +3348,9 @@ class CommonTableRc extends React.Component {
3347 components.header = { cell: ResizeableTitle }; 3348 components.header = { cell: ResizeableTitle };
3348 } 3349 }
3349 let bPagination = true; /* 默认表格分页s */ 3350 let bPagination = true; /* 默认表格分页s */
  3351 + let {mesTotalCount , mesPageSize, mesPageNum, isPagination} = this.props.tableProps || {};
  3352 + console.log(this.props.tableProps, 'this.props.tableProps');
  3353 +
3350 if (commonUtils.isNotEmptyObject(this.props)) { 3354 if (commonUtils.isNotEmptyObject(this.props)) {
3351 bPagination = 3355 bPagination =
3352 commonUtils.isNotEmptyObject(this.props.tableProps) && 3356 commonUtils.isNotEmptyObject(this.props.tableProps) &&
@@ -3560,6 +3564,7 @@ class CommonTableRc extends React.Component { @@ -3560,6 +3564,7 @@ class CommonTableRc extends React.Component {
3560 const { expKeys } = this.state; 3564 const { expKeys } = this.state;
3561 const { sModelType } = this.props?.parentProps || {} 3565 const { sModelType } = this.props?.parentProps || {}
3562 /* 返回值 */ 3566 /* 返回值 */
  3567 +
3563 return { 3568 return {
3564 components, 3569 components,
3565 rowKey: sModelType?.includes('/indexPage/commonList') ? 'sSlaveId' : this.rowKey, 3570 rowKey: sModelType?.includes('/indexPage/commonList') ? 'sSlaveId' : this.rowKey,
@@ -3573,7 +3578,7 @@ class CommonTableRc extends React.Component { @@ -3573,7 +3578,7 @@ class CommonTableRc extends React.Component {
3573 columns: tableColumn /* 表头 */, 3578 columns: tableColumn /* 表头 */,
3574 // rowSelection: this.props.rowSelection !== undefined ? this.props.rowSelection : this.getRowSelection(this.props.name, 'slave'), /* 添加的复选框(checkbox)功能 */ 3579 // rowSelection: this.props.rowSelection !== undefined ? this.props.rowSelection : this.getRowSelection(this.props.name, 'slave'), /* 添加的复选框(checkbox)功能 */
3575 rowSelection, 3580 rowSelection,
3576 - // pagination: false, /* 不分页 */ 3581 + pagination: false, /* 不分页 */
3577 rowClassName: this.setRowClassName.bind(this, "slave"), 3582 rowClassName: this.setRowClassName.bind(this, "slave"),
3578 onRow: (record, index) => { 3583 onRow: (record, index) => {
3579 if (this.isDragAndDrop) { 3584 if (this.isDragAndDrop) {
@@ -3670,6 +3675,7 @@ class CommonTableRc extends React.Component { @@ -3670,6 +3675,7 @@ class CommonTableRc extends React.Component {
3670 } 3675 }
3671 } 3676 }
3672 : false /* 表格是否分页 */, 3677 : false /* 表格是否分页 */,
  3678 + isPagination: isPagination,
3673 onChange: this.onChange 3679 onChange: this.onChange
3674 }; 3680 };
3675 }; 3681 };
@@ -10819,6 +10825,7 @@ class CommonTableRc extends React.Component { @@ -10819,6 +10825,7 @@ class CommonTableRc extends React.Component {
10819 10825
10820 /* 获取table中的props */ 10826 /* 获取table中的props */
10821 const tableProps = this.getTableProps(); 10827 const tableProps = this.getTableProps();
  10828 + console.log("🚀 ~ CommonTableRc ~ render ~ tableProps:", tableProps)
10822 let autoHeight = this.props.tableProps.AutoTableHeight; 10829 let autoHeight = this.props.tableProps.AutoTableHeight;
10823 10830
10824 const realizeHeight = 10831 const realizeHeight =
@@ -11144,6 +11151,15 @@ class CommonTableRc extends React.Component { @@ -11144,6 +11151,15 @@ class CommonTableRc extends React.Component {
11144 this.setState({ affixMenuVisible: false }); 11151 this.setState({ affixMenuVisible: false });
11145 } 11152 }
11146 }; 11153 };
  11154 + let { mesTotalCount , mesPageSize, mesPageNum, isPagination} = this.props.tableProps || {};
  11155 + const handleMesPaginationChange = (page, pageSize) => {
  11156 + this.props.onSaveState({
  11157 + mesPageNum: page,
  11158 + mesPageSize: pageSize,
  11159 + mesPageChange: true
  11160 + });
  11161 + }
  11162 + console.log(tableProps, 'tablePropstableProps');
11147 11163
11148 return ( 11164 return (
11149 <FormItem 11165 <FormItem
@@ -11242,7 +11258,8 @@ class CommonTableRc extends React.Component { @@ -11242,7 +11258,8 @@ class CommonTableRc extends React.Component {
11242 /> 11258 />
11243 </DndProvider> 11259 </DndProvider>
11244 ) : ( 11260 ) : (
11245 - <Table 11261 + <div style={{position: 'relative', width: '100%', height: '100%'}}>
  11262 + <Table
11246 {...tableProps} 11263 {...tableProps}
11247 addRow={addProps} 11264 addRow={addProps}
11248 delProps={delProps} 11265 delProps={delProps}
@@ -11260,7 +11277,15 @@ class CommonTableRc extends React.Component { @@ -11260,7 +11277,15 @@ class CommonTableRc extends React.Component {
11260 size="small" 11277 size="small"
11261 sticky={this.sticky} 11278 sticky={this.sticky}
11262 showSorterTooltip={false} 11279 showSorterTooltip={false}
11263 - /> 11280 + >
  11281 +
  11282 + </Table>
  11283 + <div style={{textAlign: 'center', position: 'absolute', bottom: '50px', left: '50%', transform: 'translateX(-50%)', fontSize:'30px'}} >
  11284 + {
  11285 + isPagination && <Pagination size="default " simple defaultCurrent={mesPageNum} total={mesTotalCount} onChange={handleMesPaginationChange} />
  11286 + }
  11287 + </div>
  11288 + </div>
11264 )} 11289 )}
11265 </div> 11290 </div>
11266 {previewVisible ? ( 11291 {previewVisible ? (
src/components/VlistNew/index.js
@@ -1051,3 +1051,4 @@ function scrollTo(option) { @@ -1051,3 +1051,4 @@ function scrollTo(option) {
1051 1051
1052 exports.VList = VList; 1052 exports.VList = VList;
1053 exports.scrollTo = scrollTo; 1053 exports.scrollTo = scrollTo;
  1054 +exports.vidMap = vidMap;
src/mes/common/commonModelComponent/index.js
@@ -260,9 +260,12 @@ const useCommonModelEvent = props =&gt; { @@ -260,9 +260,12 @@ const useCommonModelEvent = props =&gt; {
260 Array.isArray(formData) && formData.length > 0 260 Array.isArray(formData) && formData.length > 0
261 ? (formData[0]?.sName || formData[0]?.sModelType || '') 261 ? (formData[0]?.sName || formData[0]?.sModelType || '')
262 : ''; 262 : '';
  263 +
263 // 初始化事件 264 // 初始化事件
264 useEffect( 265 useEffect(
265 async () => { 266 async () => {
  267 + console.log(props?.mesPageChange, 'props?.mesPageChange');
  268 +
266 if (commonUtils.isNotEmptyArr(formData)) { 269 if (commonUtils.isNotEmptyArr(formData)) {
267 let pageLayout = []; 270 let pageLayout = [];
268 let addState = {}; 271 let addState = {};
@@ -287,7 +290,6 @@ const useCommonModelEvent = props =&gt; { @@ -287,7 +290,6 @@ const useCommonModelEvent = props =&gt; {
287 result = await handleGetDataPop(tableList, true, true) 290 result = await handleGetDataPop(tableList, true, true)
288 } else if (!commonUtils.isEmptyObject(copyTo) && !refreshCount) { 291 } else if (!commonUtils.isEmptyObject(copyTo) && !refreshCount) {
289 result = await handleGetData(tableList, true, true); 292 result = await handleGetData(tableList, true, true);
290 -  
291 } else if (noGetData) { 293 } else if (noGetData) {
292 result = await handleGetData( 294 result = await handleGetData(
293 tableList.filter( 295 tableList.filter(
@@ -298,7 +300,9 @@ const useCommonModelEvent = props =&gt; { @@ -298,7 +300,9 @@ const useCommonModelEvent = props =&gt; {
298 true 300 true
299 ); 301 );
300 } else { 302 } else {
301 - result = await handleGetData(tableList, true, true); 303 + if (props?.mesPageChange || props?.mesPageChange === undefined) {
  304 + result = await handleGetData(tableList, true, true);
  305 + }
302 } 306 }
303 if (!currentId) { 307 if (!currentId) {
304 addState.bFinish = props.bFinish ? props.bFinish + 1 : 1; 308 addState.bFinish = props.bFinish ? props.bFinish + 1 : 1;
@@ -342,7 +346,8 @@ const useCommonModelEvent = props =&gt; { @@ -342,7 +346,8 @@ const useCommonModelEvent = props =&gt; {
342 formData.length, 346 formData.length,
343 refreshCount, 347 refreshCount,
344 noGetData, 348 noGetData,
345 - JSON.stringify(sFilterConditions) 349 + JSON.stringify(sFilterConditions),
  350 + props?.mesPageChange === true
346 ] 351 ]
347 ); 352 );
348 useEffect(() => { 353 useEffect(() => {
@@ -904,7 +909,14 @@ const useCommonModelEvent = props =&gt; { @@ -904,7 +909,14 @@ const useCommonModelEvent = props =&gt; {
904 if (currentIds && tableName !== 'master') { 909 if (currentIds && tableName !== 'master') {
905 conditonValues.sParentId = currentIds; 910 conditonValues.sParentId = currentIds;
906 } 911 }
  912 + // 2026 新增如果是indexPage/commonList那么需要真分页
  913 + const { sName, bPagination = false } = config || {};
  914 + let isPagination = false
  915 + if (sName.includes('/indexPage/commonList') && bPagination) {
  916 + isPagination = true
  917 + console.log(props, 'isPagination');
907 918
  919 + }
908 const result = 920 const result =
909 (await props.onGetDataSet({ 921 (await props.onGetDataSet({
910 name: tableName, 922 name: tableName,
@@ -913,14 +925,16 @@ const useCommonModelEvent = props =&gt; { @@ -913,14 +925,16 @@ const useCommonModelEvent = props =&gt; {
913 ...masterState, 925 ...masterState,
914 sId: currentIds, 926 sId: currentIds,
915 sSqlCondition: { ...conditonValues, ...sFilterConditions, }, 927 sSqlCondition: { ...conditonValues, ...sFilterConditions, },
916 - bFilter 928 + bFilter,
  929 + pageNum: isPagination ? props?.mesPageNum || 1 : undefined,
  930 + pageSize: isPagination ? props?.mesPageSize || 10 : undefined,
917 }, 931 },
918 sModelTypes: props.parentProps, 932 sModelTypes: props.parentProps,
919 - isWait: true 933 + isWait: true,
  934 + isPagination
920 })) || {}; 935 })) || {};
921 936
922 props.setTempRef(result); 937 props.setTempRef(result);
923 -  
924 if (tableName?.includes("master")) { 938 if (tableName?.includes("master")) {
925 const masterData = result[`${tableName}Data`]; 939 const masterData = result[`${tableName}Data`];
926 result[`${tableName}Data`] = masterData?.[0] || {}; 940 result[`${tableName}Data`] = masterData?.[0] || {};
@@ -2547,35 +2561,49 @@ const CommonTableComponent = props =&gt; { @@ -2547,35 +2561,49 @@ const CommonTableComponent = props =&gt; {
2547 // } 2561 // }
2548 props.onTableBtnClick(params); 2562 props.onTableBtnClick(params);
2549 }; 2563 };
2550 - const tableProps = {  
2551 - ...baseProps,  
2552 - tableBtnsConfig: btnsConfig,  
2553 - // tableBtnsWidth: '100px',  
2554 - // tableBtnsConfig: (params) => {  
2555 - // console.log('=====params', params);  
2556 - // return btnsConfig;  
2557 - // },  
2558 - onTableBtnClick,  
2559 - tableProps: {  
2560 - onChange: () => { },  
2561 - rowKey: baseProps?.config?.sId === "17091154460006421964039036672000" ? 'sSlaveId' : 'sId'  
2562 - // AutoTableHeight: 200  
2563 - },  
2564 - onViewClick: (tableName, sFieldName, record, index, config) => {  
2565 - // 异常事件提报-提报信息-事件类型字段点击事件  
2566 - if (tableName === "slave" && sFieldName === "sClassifyName") {  
2567 - props.onTableBtnClick({  
2568 - name: tableName,  
2569 - record,  
2570 - config  
2571 - });  
2572 - }  
2573 - },  
2574 - onViewChoose: (tableName, sFieldName, record, index, isColor) => {  
2575 - handleViewChoose(tableName, sFieldName, record, index, isColor); 2564 + // const pagination = {
  2565 + // pageSize: commonConfig.pageSize,
  2566 + // ...slavePagination,
  2567 + // size: isSmall ? 'small' : 'large',
  2568 + // pageSizeOptions: commonConfig.pageSizeOptions,
  2569 + // showSizeChanger: !isSmall,
  2570 + // showQuickJumper: !isSmall,
  2571 + // };
  2572 + const { mesTotalCount , mesPageSize, mesPageNum, isPagination } = baseProps?.parentProps || {};
  2573 + const tableProps = {
  2574 + ...baseProps,
  2575 + tableBtnsConfig: btnsConfig,
  2576 + // tableBtnsWidth: '100px',
  2577 + // tableBtnsConfig: (params) => {
  2578 + // console.log('=====params', params);
  2579 + // return btnsConfig;
  2580 + // },
  2581 + onTableBtnClick,
  2582 + tableProps: {
  2583 + onChange: () => { },
  2584 + rowKey: baseProps?.config?.sId === "17091154460006421964039036672000" ? 'sSlaveId' : 'sId',
  2585 + mesTotalCount,
  2586 + mesPageSize,
  2587 + mesPageNum,
  2588 + isPagination,
  2589 + // AutoTableHeight: 200
  2590 + },
  2591 + onViewClick: (tableName, sFieldName, record, index, config) => {
  2592 + // 异常事件提报-提报信息-事件类型字段点击事件
  2593 + if (tableName === "slave" && sFieldName === "sClassifyName") {
  2594 + props.onTableBtnClick({
  2595 + name: tableName,
  2596 + record,
  2597 + config
  2598 + });
  2599 + }
  2600 + },
  2601 + onViewChoose: (tableName, sFieldName, record, index, isColor) => {
  2602 + handleViewChoose(tableName, sFieldName, record, index, isColor);
2576 2603
2577 - }  
2578 - }; 2604 + }
  2605 + };
  2606 + console.log("🚀 ~ CommonTableComponent ~ tableProps:", tableProps)
2579 const handleViewChoose = (tableName, sFieldName, record, index, isColor) => { 2607 const handleViewChoose = (tableName, sFieldName, record, index, isColor) => {
2580 if (isColor) { 2608 if (isColor) {
2581 const { sId } = record; /* 控制表主键 */ 2609 const { sId } = record; /* 控制表主键 */
src/mes/common/routerComponent/index.js
@@ -68,7 +68,7 @@ const RouterComponent = props =&gt; { @@ -68,7 +68,7 @@ const RouterComponent = props =&gt; {
68 const selectedType = Object.keys(types).find(type => 68 const selectedType = Object.keys(types).find(type =>
69 sModelType?.includes(type) 69 sModelType?.includes(type)
70 ); 70 );
71 - 71 +
72 if (selectedType) { 72 if (selectedType) {
73 return types[selectedType]({ sModelsId: keyId, props }); 73 return types[selectedType]({ sModelsId: keyId, props });
74 } else if (sModelsId === "12710101117126502477360") { 74 } else if (sModelsId === "12710101117126502477360") {
src/mes/productionExec/productionExecMain/index.js
@@ -1080,7 +1080,7 @@ const ProductionExecContent0 = props =&gt; { @@ -1080,7 +1080,7 @@ const ProductionExecContent0 = props =&gt; {
1080 1080
1081 } = props; 1081 } = props;
1082 const viewRowOld = {...workOrderInfoData[0], ...changeExecInfo,}; 1082 const viewRowOld = {...workOrderInfoData[0], ...changeExecInfo,};
1083 - 1083 +
1084 const newTableProps = { 1084 const newTableProps = {
1085 ...tableProps, 1085 ...tableProps,
1086 data: tableProps.data.map((item, index) => { 1086 data: tableProps.data.map((item, index) => {