提交 d0cb361e authored 作者: 王绍森's avatar 王绍森

组件修改

上级 e36622e3
import React from 'react';
import { Form } from 'antd';
import Entrance from '../Entrance';
import Shell from '@/baseComponent/Shell';
import SubmitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton';
import { ModalInfo } from '@/baseComponent/Modal';
import withGoBack from '@/highOrderComponent/withGoBack';
export default function ApplyPage({ id, form }) {
let ApplyPage = ({ id, form }) => {
function submitCb(res) {
ModalInfo(`提交${res ? '成功' : '失败'}!`);
}
return (
<Shell styleShell={{ marginTop: 0 }}>
<Entrance id={id} isCg='false' get="web" form={form} />
<Entrance id={id} isCg="false" get="web" form={form} />
<div style={{ padding: 16, textAlign: 'center' }}>
<SubmitButton
form={form}
......@@ -14,8 +20,16 @@ export default function ApplyPage({ id, form }) {
text="提交"
openDraftButton
DraftButtonText="暂存"
callback={submitCb}
/>
</div>
</Shell>
);
}
};
ApplyPage = Form.create()(ApplyPage);
export default ({ hasGoBack = true, ...rest }) => {
const WithGoBack = withGoBack(ApplyPage);
return hasGoBack ? <WithGoBack {...rest} /> : <ApplyPage {...rest} />;
};
import React, { useState, useEffect } from 'react';
import { Form, Spin } from 'antd';
import Shell from '@/baseComponent/Shell';
import { ModalInfo } from '@/baseComponent/Modal';
import HistoryForm from '@/webPublic/one_stop_public/Entrance/historyForm';
import { getHistoryFormDetail } from '../../Services';
import AuditButton from '@/webPublic/one_stop_public/AffairButton/AuditButton';
import withGoBack from '@/highOrderComponent/withGoBack';
let AuditForm = ({ code, isNewForm, form }) => {
function submitCb(res) {
ModalInfo(`提交${res ? '成功' : '失败'}!`);
}
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (typeof code === 'undefined') return;
setLoading(true);
getHistoryFormDetail({ code }).then(res => {
setLoading(false);
if (res && !res.errMsg) {
setData(res);
}
});
}, []);
return (
<Shell styleShell={{ marginTop: 0 }}>
<Spin spinning={loading}>
{data && (
<>
<HistoryForm
data={data} // 'affair/getIdFormDetail' 接口返回数据
form={form} // form控件
isNewForm={!!isNewForm} // 是否渲染需要当前用户填写的审核表单 为false只会渲染历史回显表单
/>
{isNewForm && (
<div style={{ padding: 16, textAlign: 'center' }}>
<AuditButton
data={data} // 为 'affair/getIdFormDetail' 接口请求到的数据
callback={submitCb} // 提交完成后回调函数
form={form} // form表单控件
/>
</div>
)}
</>
)}
</Spin>
</Shell>
);
};
AuditForm = Form.create()(AuditForm);
export default ({ hasGoBack = true, ...rest }) => {
const WithGoBack = withGoBack(AuditForm);
return hasGoBack ? <WithGoBack {...rest} /> : <AuditForm {...rest} />;
};
import React from 'react';
import PageTypeMatching from '@/highOrderComponent/PageTypeMatching';
import { deepCopy } from '@/baseComponent/utils';
import { getInfo } from '@/highOrderComponent/Service';
import getInfoGenerator from '../getInfoGenerator';
const pageSetting = {
type: 'listTab', // 页面类型
tabList: {
tab1: {
key: 0,
name: '待审核',
listConfig: {
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
},
},
tab2: {
name: '已审核',
key: 1,
listConfig: {
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
},
},
},
};
export { DataType } from '../getInfoGenerator'
const defaultNameSpan = { big: 9, small: 9 };
const defaultFieldSpan = { big: 4, small: 4 };
const pageButton = {
tab1: [],
tab2: [],
const defaultPageSetting = {
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
};
export default function AuditPage({ appId }) {
const tab1 = {
search: {
getInfo: (params, url) => getInfo(params, url, { method: 'GET' }),
url: '/common/assigneeTasks',
field: {
appId: {
required: true,
defaultValue: appId,
export default function AuditPage({ appId, tab1 = {}, tab2 = {} }) {
const pageSearch = {
tab1: {
search: {
getInfo: getInfoGenerator(tab1.condition),
url: '/common/assigneeTasks',
field: {
appId: {
required: true,
defaultValue: appId,
},
},
condition: tab1.condition || [],
nameSpan: tab1.nameSpan || defaultNameSpan,
fileSpan: tab1.fieldSpan || defaultFieldSpan,
},
condition: [
{
key: 'startTime',
endKey: 'endTime',
name: '创建时间',
type: 'rangePicker',
format: 'YYYY-MM-DD',
},
{
key: 'department',
name: '扣分部门',
type: 'select',
},
],
nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 3 },
tableRowKey: tab1.tableRowKey || 'buzinessId',
columns: tab1.columns || [],
},
tableRowKey: 'id',
columns: [
{
dataIndex: 'insYear',
title: '年度',
},
{
dataIndex: 'totalScore',
title: '扣分分值',
},
{
dataIndex: 'departName',
title: '扣分部门',
},
{
dataIndex: 'reason',
title: '扣分原因',
},
{
dataIndex: 'recorderDate',
title: '时间',
},
{
dataIndex: 'auditStatus',
title: '状态',
render: text => {
switch (text) {
case 4:
return '进行中';
case 5:
return '完成扣分';
case 1:
return '已完成';
case 2:
return <span style={{ color: 'red' }}>进行中</span>;
case 0:
return <span style={{ color: '#1998f0' }}>进行中</span>;
default:
return '';
}
},
},
{
dataIndex: 'operation',
title: '操作',
renderConfig: {
type: 'component',
render: args => {
return null;
tab2: {
search: {
getInfo: getInfoGenerator(tab2.condition),
url: '/common/assigneeDTasks',
field: {
appId: {
required: true,
defaultValue: appId,
},
},
condition: tab2.condition || [],
nameSpan: tab2.nameSpan || defaultNameSpan,
fileSpan: tab2.fieldSpan || defaultFieldSpan,
},
],
tableRowKey: tab2.tableRowKey || 'id',
columns: tab2.columns || [],
},
};
const pageSearch = {
tab1,
tab2: (deepCopy(tab1).search.url = '/common/assigneeDTasks'),
const pageButton = {
tab1: tab1.pageButton || [],
tab2: tab2.pageButton || [],
};
const pageSetting = {
type: 'listTab', // 页面类型
tabList: {
tab1: {
key: 0,
name: '待审核',
listConfig: { ...defaultPageSetting, ...tab1.pageSetting },
},
tab2: {
name: '已审核',
key: 1,
listConfig: { ...defaultPageSetting, ...tab2.pageSetting },
},
},
};
return (
<PageTypeMatching pageSetting={pageSetting} pageButton={pageButton} pageSearch={pageSearch} />
<PageTypeMatching
tabsShellStyle={{ marginTop: 0 }}
pageSetting={pageSetting}
pageButton={pageButton}
pageSearch={pageSearch}
/>
);
}
import React, { useState, useEffect } from 'react';
import { Form, Spin } from 'antd';
import Shell from '@/baseComponent/Shell';
import HistoryForm from '@/webPublic/one_stop_public/Entrance/historyForm';
import { getHistoryFormDetail } from '../../Services';
import withGoBack from '@/highOrderComponent/withGoBack';
let DetailPage = ({ form, code }) => {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (typeof code === 'undefined') return;
setLoading(true);
getHistoryFormDetail({ code }).then(res => {
setLoading(false);
if (res && !res.errMsg) {
setData(res);
}
});
}, []);
return (
<Shell styleShell={{ marginTop: 0 }}>
<Spin spinning={loading}>
{data && (
<HistoryForm
data={data} // 'affair/getIdFormDetail' 接口返回数据
form={form} // form控件
isNewForm={false} // 是否渲染需要当前用户填写的审核表单 为false只会渲染历史回显表单
/>
)}
</Spin>
</Shell>
);
};
DetailPage = Form.create()(DetailPage);
export default ({ hasGoBack = true, ...rest }) => {
const WithGoBack = withGoBack(DetailPage);
return hasGoBack ? <WithGoBack {...rest} /> : <DetailPage {...rest} />;
};
import React from 'react';
import PageTypeMatching from '@/highOrderComponent/PageTypeMatching';
import getInfoGenerator from '../getInfoGenerator';
export { DataType } from '../getInfoGenerator'
const defaultNameSpan = { big: 9, small: 9 };
const defaultFieldSpan = { big: 4, small: 4 };
const defaultPageSetting = {
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
};
export default function MyApplyList({
appId,
pageSetting = {},
pageButton = [],
condition = [],
nameSpan = defaultNameSpan,
fileSpan = defaultFieldSpan,
tableRowKey = 'buzinessId',
columns = [],
}) {
const pageSearch = {
search: {
fromTab: true,
getInfo: getInfoGenerator(condition),
url: '/common/myApplyMap',
field: {
appId: {
required: true,
defaultValue: appId,
},
},
condition,
nameSpan,
fileSpan,
},
tableRowKey,
columns,
};
return (
<PageTypeMatching
pageSetting={{
type: 'list',
listConfig: { ...defaultPageSetting, ...pageSetting },
}}
bodyShellStyle={{ marginTop: condition && condition.length ? 16 : 0 }}
pageButton={pageButton}
pageSearch={pageSearch}
/>
);
}
import { getInfo } from '@/highOrderComponent/Service';
export const DataType = {
string: 'string',
int: 'int',
long: 'long',
text: 'text',
};
export default function getInfoGenerator(condition) {
return (params, url) => {
// 有dataType的查询条件封装到queryInfo里,其他的直接按参数查询
// queryInfo是{key, value, dataType}对象组成的数组
const newParams = Object.keys(params).reduce((acc, key) => {
const value = params[key];
const conditionItemHasDataType = condition.find(
item => item.key === key && typeof item.dataType !== 'undefined'
);
if (conditionItemHasDataType) {
const oldQueryInfo = acc.queryInfo || [];
return {
...acc,
queryInfo: oldQueryInfo.concat({
key,
value,
dataType: conditionItemHasDataType.dataType,
}),
};
}
return { ...acc, [key]: value };
}, {});
newParams.queryInfo = JSON.stringify(newParams.queryInfo || []);
return getInfo(newParams, url, { method: 'GET' });
};
}
......@@ -14,7 +14,6 @@ import { uaaRequest } from './one_stop_public/utils/request';
export const fetchTemplateByCode = code =>
uaaRequest('/UnifiedServicePatternApi/getDetail', { code });
export const fetchTemplateById = id => uaaRequest('/UnifiedAppApi/getDetail', { id });
/**
......@@ -80,3 +79,12 @@ export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => {
isBase,
});
};
/**
* 根据id或者code查询历史表单信息
* @param {String} id 申报数据的id
* @param {String} code 申报数据的code
*/
export const getHistoryFormDetail = ({id, code}) => {
return uaaRequest('/UnifiedAppFormApi/getFormDetail', { id, code, });
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论