Explorar o código

Merge branch 'feature_moreStaDimen' of Web/contentCooper into master

jihuaqiang hai 4 días
pai
achega
72ce839169

+ 15 - 7
src/views/publishContent/weCom/index.tsx

@@ -26,6 +26,7 @@ const WeGZHContent: React.FC = () => {
 	const [tableData, setTableData] = useState<WeComPlan[]>([]);
 	const [totalSize, setTotalSize] = useState<number>(0);
 	const [pageNum, setPageNum] = useState<number>(1);
+	const [pageSize, setPageSize] = useState<number>(10);
 	const [isLoading, setIsLoading] = useState<boolean>(false);
 	// State for the new modal
 	const [isLinkDetailModalVisible, setIsLinkDetailModalVisible] = useState<boolean>(false);
@@ -37,11 +38,16 @@ const WeGZHContent: React.FC = () => {
 	const [isVideoPlayModalVisible, setIsVideoPlayModalVisible] = useState<boolean>(false);
 	const [isAddPlanLoading, setIsAddPlanLoading] = useState<boolean>(false);
 
-	const getTableData = (_pageNum?: number) => {
-		setPageNum(_pageNum || 1);
+	const getTableData = (_pageNum?: number, _pageSize?: number) => {
+		if (_pageNum) { 
+			setPageNum(_pageNum);
+		}
+		if (_pageSize) { 
+			setPageSize(_pageSize);
+		}
 		request.post<WeComPlanListResponse>(getQwPlanListApi, {
 				pageNum: _pageNum || pageNum,
-				pageSize: 10,
+				pageSize: _pageSize || pageSize,
 				scene: selectedPublisher,
 				title: videoTitle,
 				subChannel,
@@ -122,7 +128,7 @@ const WeGZHContent: React.FC = () => {
 		}).then(res => {
 			if (res.code === 0) {
 				message.success('删除成功');
-				getTableData();
+				getTableData(1);
 			} else {
 				message.error(res.msg || '删除失败');
 			}
@@ -201,7 +207,7 @@ const WeGZHContent: React.FC = () => {
 				if (type !== activeKey) { 
 					setActiveKey(type as WeComPlanType);
 				} else {
-					getTableData();
+					getTableData(1);
 				}
 			} else {
 				message.error(res.msg || '创建失败');
@@ -284,9 +290,11 @@ const WeGZHContent: React.FC = () => {
 					pagination={{
 						current: pageNum,
 						total: totalSize,
-						pageSize: 10,
+						pageSize: pageSize,
 						showTotal: (total) => `共 ${total} 条`,
-						onChange: (page) => getTableData(page),
+						onChange: (page, pageSize) => {
+							getTableData(page, pageSize);
+						}
 					}}
 				/>
 				<AddPlanModal

+ 21 - 17
src/views/publishContent/weGZH/index.tsx

@@ -29,7 +29,7 @@ const WeGZHContent: React.FC = () => {
 	const { accountOptions, getAccountList } = useAccountOptions();
 	const { gzhPlanList, getGzhPlanList, totalSize } = useGzhPlanList();
 	const [pageNum, setPageNum] = useState<number>(1);
-
+	const [pageSize, setPageSize] = useState<number>(10);
 	const [isShowAddPunlishDetailPlan, setIsShowAddPunlishDetailPlan] = useState<boolean>(false);
 
 	// 表格列配置
@@ -132,7 +132,7 @@ const WeGZHContent: React.FC = () => {
 			getGzhPlanList({
 				type: planType,
 				pageNum: 1,
-				pageSize: 10,
+				pageSize: pageSize,
 				selectVideoType: selectVideoType,
 			});
 		} else {
@@ -178,7 +178,7 @@ const WeGZHContent: React.FC = () => {
 			getGzhPlanList({
 				type: params.type,
 				pageNum: 1,
-				pageSize: 10,
+				pageSize: pageSize,
 			});
 			setIsShowAddPunlishPlan(false);
 		} else {
@@ -197,14 +197,14 @@ const WeGZHContent: React.FC = () => {
 		getGzhPlanList({
 			type: planType,
 			pageNum: 1,
-			pageSize: 10,
+			pageSize: pageSize,
 		});
 	}, [planType]);
 
 	const handleSearch = () => {
 		getGzhPlanList({
 			pageNum: 1,
-			pageSize: 10,
+			pageSize: pageSize,
 			title: videoTitle,
 			type: planType,
 			accountId: selectedAccount ? parseInt(selectedAccount) : undefined,
@@ -316,20 +316,24 @@ const WeGZHContent: React.FC = () => {
 					scroll={{ x: 'max-content', y: TableHeight }}
 					pagination={{
 						total: totalSize,
-						pageSize: 10,
+						pageSize: pageSize,
 						current: pageNum,
 						showTotal: (total) => `共 ${total} 条`,
-						onChange: (page) => getGzhPlanList({
-							pageNum: page,
-							pageSize: 10,
-							title: videoTitle,
-							type: planType,
-							selectVideoType: selectVideoType,
-							accountId: selectedAccount ? parseInt(selectedAccount) : undefined,
-							publishStage: selectedPublisher,
-							createTimestampStart: dateRange?.[0]?.unix() ? dateRange[0].unix() * 1000 : undefined,
-							createTimestampEnd: dateRange?.[1]?.unix() ? dateRange[1].unix() * 1000 : undefined,
-						}),
+						onChange: (page, size) => {
+							setPageNum(page);
+							setPageSize(size);
+							getGzhPlanList({
+								pageNum: page,
+								pageSize: size,
+								title: videoTitle,
+								type: planType,
+								selectVideoType: selectVideoType,
+								accountId: selectedAccount ? parseInt(selectedAccount) : undefined,
+								publishStage: selectedPublisher,
+								createTimestampStart: dateRange?.[0]?.unix() ? dateRange[0].unix() * 1000 : undefined,
+								createTimestampEnd: dateRange?.[1]?.unix() ? dateRange[1].unix() * 1000 : undefined,
+							});
+						},
 					}}
 				/>
 				<PunlishPlanModal

+ 9 - 7
src/views/weData/gzh/index.tsx

@@ -144,7 +144,9 @@ const Gzh: React.FC = () => {
       key: 'score',
     },
 	];
-  const fetchGzhData = async (page = 1, pageSize = 10, type = 0) => {
+	const fetchGzhData = async (page = 1, pageSize = 10, type = 0) => {
+		setAllDataSource([]);
+		setSeparateDataSource([]);
     try {
       setLoading(true);
       const res = await http.post<GzhDataResponse>(gzhDataList, {
@@ -241,8 +243,8 @@ const Gzh: React.FC = () => {
             children: (
               <Table
                 dataSource={allDataSource}
-                columns={columns}
-                rowKey="dateStr"
+								columns={columns}
+								rowKey={(record, idx) => record.dateStr + record.ghId + idx}
                 loading={loading}
                 pagination={{
                   current: pagination.current,
@@ -262,7 +264,7 @@ const Gzh: React.FC = () => {
               <Table
                 dataSource={separateDataSource}
                 columns={separateColumns}
-                rowKey="dateStr"
+                rowKey={(record, idx) => record.dateStr + record.ghId + idx}
                 loading={loading}
                 pagination={{
                   current: pagination.current,
@@ -282,7 +284,7 @@ const Gzh: React.FC = () => {
               <Table
                 dataSource={separateDataSource}
                 columns={separateVideoColumns}
-                rowKey="dateStr"
+								rowKey={(record, idx) => record.dateStr + record.ghId + idx}
                 loading={loading}
                 pagination={{
                   current: pagination.current,
@@ -302,7 +304,7 @@ const Gzh: React.FC = () => {
               <Table
                 dataSource={allDataSource}
                 columns={columns}
-                rowKey="dateStr"
+                rowKey={(record, idx) => record.dateStr + record.ghId + idx}
                 loading={loading}
                 pagination={{
                   current: pagination.current,
@@ -322,7 +324,7 @@ const Gzh: React.FC = () => {
               <Table
                 dataSource={separateDataSource}
                 columns={separateColumns}
-                rowKey="dateStr"
+                rowKey={(record, idx) => record.dateStr + record.ghId + idx}
                 loading={loading}
                 pagination={{
                   current: pagination.current,