Эх сурвалжийг харах

Merge branch 'feature-1.2' of front/site-front into master

richard 3 жил өмнө
parent
commit
6d2c2a8c59

+ 3 - 1
src/hooks/task.ts

@@ -17,13 +17,15 @@ export const TaskType = {
 export enum taskStatusEnums {
 	'pending_handle' = 1,
 	'pending_review',
+	'refused',
 	'reviewed',
 }
 
 export const taskStatus = {
 	[taskStatusEnums.pending_handle]: '待处理',
 	[taskStatusEnums.pending_review]: '待审核',
-	[taskStatusEnums.reviewed]: '已审核',
+	[taskStatusEnums.refused]: '审核退回',
+	[taskStatusEnums.reviewed]: '已处理',
 };
 /**
  * @description 任务列表

+ 19 - 10
src/pages/task-detail/index.tsx

@@ -24,7 +24,6 @@ import {
 } from '../../hooks/task';
 import Upload from '../../compontens/upload';
 
-
 const APPLY_STATUS_OPTIONS = [
 	{
 		name: '通过',
@@ -44,7 +43,7 @@ const getTaskProcessLabelByIndex = (state: number) => {
 	}[state];
 };
 
-const getTaskProcessLabelDescByIndex = (state:number) => {
+const getTaskProcessLabelDescByIndex = (state: number) => {
 	return {
 		1: '任务描述',
 		2: '处理内容',
@@ -73,8 +72,11 @@ const TaskDetail: React.FC<RouteComponentProps<{ id: string }>> = ({
 				message.error(error.message);
 			});
 	};
-	const isCanHandle =
-		detailState.dataSource?.status !== taskStatusEnums.reviewed;
+	const isCanHandle = [
+		taskStatusEnums.pending_handle,
+		taskStatusEnums.refused,
+	].includes(detailState.dataSource?.status as any);
+
 	return (
 		<Spin spinning={detailState.loading}>
 			<Button
@@ -97,16 +99,17 @@ const TaskDetail: React.FC<RouteComponentProps<{ id: string }>> = ({
 					},
 					{
 						// TODO 任务状态显示
-                        key: 'status',
-                        label: '任务状态',
+						key: 'status',
+						label: '任务状态',
 						value: (value) => value,
 					},
 				].map((infos) => {
 					return (
 						<Descriptions.Item label={infos.label} key={infos.key}>
 							<b>
-								{infos.value?.(taskStatus[detailState.dataSource?.[infos.key]]) ||
-									detailState.dataSource?.[infos.key]}
+								{infos.value?.(
+									taskStatus[detailState.dataSource?.[infos.key]]
+								) || detailState.dataSource?.[infos.key]}
 							</b>
 						</Descriptions.Item>
 					);
@@ -122,13 +125,19 @@ const TaskDetail: React.FC<RouteComponentProps<{ id: string }>> = ({
 								layout='vertical'
 								title={TaskProcess[process.pipe_type]}>
 								{[
-									{ label: getTaskProcessLabelByIndex(process.pipe_type), key: 'person' },
+									{
+										label: getTaskProcessLabelByIndex(process.pipe_type),
+										key: 'person',
+									},
 									{ label: '操作时间', key: 'pipe_time' },
 									{
 										label: '状态',
 										key: 'status',
 									},
-									{ label:  getTaskProcessLabelDescByIndex(process.pipe_type), key: 'desc' },
+									{
+										label: getTaskProcessLabelDescByIndex(process.pipe_type),
+										key: 'desc',
+									},
 									{
 										label: '附件',
 										key: 'img',

+ 33 - 40
src/pages/task-quality/components/warnSearch/index.tsx

@@ -1,6 +1,5 @@
 import React from 'react';
 import { Form, Input, DatePicker, Select, Button, Space } from 'antd';
-import moment from 'moment';
 import { FormItemProps } from 'antd/lib/form';
 const forms: FormItemProps[] = [
 	{
@@ -67,45 +66,39 @@ interface Iprops {
 const search: React.FC<Iprops> = ({ onSearch }) => {
 	const [form] = Form.useForm();
 	return (
-		<Form
-			form={form}
-			layout='inline'
-			onFinish={(data) => {
-				onSearch({
-					...data,
-					start_time: data.start_time
-						?.hours(0)
-						.minute(0)
-						.second(0)
-						.unix(),
-					end_time: data.end_time
-						?.hours(23)
-						.minute(59)
-						.second(59)
-						.unix(),
-				});
-			}}>
-			{forms.map((formItem) => {
-				return (
-					<Form.Item
-						style={{ marginTop: 20 }}
-						{...formItem}
-						key={formItem.name as string}></Form.Item>
-				);
-			})}
-			<Space style={{ marginTop: 20 }}>
-				<Button type='primary' htmlType='submit'>
-					搜索
-				</Button>
-				<Button
-					htmlType='reset'
-					onClick={() => {
-						form.resetFields();
-					}}>
-					清空
-				</Button>
-			</Space>
-		</Form>
+		<div style={{ marginBottom: 20 }}>
+			<Form
+				form={form}
+				layout='inline'
+				onFinish={(data) => {
+					onSearch({
+						...data,
+						start_time: data.start_time?.hours(0).minute(0).second(0).unix(),
+						end_time: data.end_time?.hours(23).minute(59).second(59).unix(),
+					});
+				}}>
+				{forms.map((formItem) => {
+					return (
+						<Form.Item
+							style={{ marginTop: 20 }}
+							{...formItem}
+							key={formItem.name as string}></Form.Item>
+					);
+				})}
+				<Space style={{ marginTop: 20 }}>
+					<Button type='primary' htmlType='submit'>
+						搜索
+					</Button>
+					<Button
+						htmlType='reset'
+						onClick={() => {
+							form.resetFields();
+						}}>
+						清空
+					</Button>
+				</Space>
+			</Form>
+		</div>
 	);
 };
 export default search;

+ 8 - 10
src/pages/task-quality/index.tsx

@@ -69,16 +69,14 @@ const TaskList: React.FC<RouteComponentProps> = ({ history }) => {
 	}, [columns]);
 	return (
 		<Fragment>
-			<Row gutter={[24, 24]}>
-				<Search
-					onSearch={(data) => {
-						changeSearchState((preState) => ({
-							...preState,
-							...data,
-							page: 1,
-						}));
-					}}></Search>
-			</Row>
+			<Search
+				onSearch={(data) => {
+					changeSearchState((preState) => ({
+						...preState,
+						...data,
+						page: 1,
+					}));
+				}}></Search>
 			<Table
 				rowKey={(record) => record.id}
 				loading={taskListState.loading}

+ 33 - 39
src/pages/task-safe/components/warnSearch/index.tsx

@@ -67,45 +67,39 @@ interface Iprops {
 const search: React.FC<Iprops> = ({ onSearch }) => {
 	const [form] = Form.useForm();
 	return (
-		<Form
-			form={form}
-			layout='inline'
-			onFinish={(data) => {
-				onSearch({
-					...data,
-					start_time: data.start_time
-						?.hours(0)
-						.minute(0)
-						.second(0)
-						.unix(),
-					end_time: data.end_time
-						?.hours(23)
-						.minute(59)
-						.second(59)
-						.unix(),
-				});
-			}}>
-			{forms.map((formItem) => {
-				return (
-					<Form.Item
-						style={{ marginTop: 20 }}
-						{...formItem}
-						key={formItem.name as string}></Form.Item>
-				);
-			})}
-			<Space style={{ marginTop: 20 }}>
-				<Button type='primary' htmlType='submit'>
-					搜索
-				</Button>
-				<Button
-					htmlType='reset'
-					onClick={() => {
-						form.resetFields();
-					}}>
-					清空
-				</Button>
-			</Space>
-		</Form>
+		<div style={{ marginBottom: 20 }}>
+			<Form
+				form={form}
+				layout='inline'
+				onFinish={(data) => {
+					onSearch({
+						...data,
+						start_time: data.start_time?.hours(0).minute(0).second(0).unix(),
+						end_time: data.end_time?.hours(23).minute(59).second(59).unix(),
+					});
+				}}>
+				{forms.map((formItem) => {
+					return (
+						<Form.Item
+							style={{ marginTop: 20 }}
+							{...formItem}
+							key={formItem.name as string}></Form.Item>
+					);
+				})}
+				<Space style={{ marginTop: 20 }}>
+					<Button type='primary' htmlType='submit'>
+						搜索
+					</Button>
+					<Button
+						htmlType='reset'
+						onClick={() => {
+							form.resetFields();
+						}}>
+						清空
+					</Button>
+				</Space>
+			</Form>
+		</div>
 	);
 };
 export default search;

+ 8 - 10
src/pages/task-safe/index.tsx

@@ -69,16 +69,14 @@ const TaskList: React.FC<RouteComponentProps> = ({ history }) => {
 	}, [columns]);
 	return (
 		<Fragment>
-			<Row gutter={[24, 24]}>
-				<Search
-					onSearch={(data) => {
-						changeSearchState((preState) => ({
-							...preState,
-							...data,
-							page: 1,
-						}));
-					}}></Search>
-			</Row>
+			<Search
+				onSearch={(data) => {
+					changeSearchState((preState) => ({
+						...preState,
+						...data,
+						page: 1,
+					}));
+				}}></Search>
 			<Table
 				rowKey={(record) => record.id}
 				loading={taskListState.loading}

+ 2 - 1
src/utils/request.ts

@@ -3,6 +3,7 @@ import storage from './storage';
 const prefix = '/api';
 const refreshTokenCodes = 10009;
 const logOutCode = 10010;
+const SUCCESS_CODE = 0;
 let token = '';
 
 const instance = Axios.create({
@@ -87,7 +88,7 @@ instance.interceptors.response.use(
 			return Promise.reject(response.data);
 		}
 		// 请求成功
-		if (response.data.code === 0) {
+		if (response.data.code === SUCCESS_CODE) {
 			return Promise.resolve(response.data.data);
 		} else {
 			return Promise.reject(response.data);