提交 3a5654f8 authored 作者: 钟是志's avatar 钟是志

20187 国家助学金、奖学金、励志奖学金、贫困生认定--添加查询条件

上级 4d363d89
import pageSetting from './pageSetting'; import pageSetting from './pageSetting';
import React, { Component, Fragment } from 'react'; import React, { Component } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import List from '../ApplyPage/List';
import ListTab from './ListTab'; import ListTab from './ListTab';
import { deepCopy } from '@/baseComponent/utils'; import { getHandledPage, getWaitPage } from '../publicApiService';
import { getApplyPage, getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal'; import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal'; import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy'; import ButtonDiy from '@/baseComponent/ButtonDiy';
...@@ -60,10 +58,24 @@ export default class AuditPage extends Component { ...@@ -60,10 +58,24 @@ export default class AuditPage extends Component {
handleSearchSet = () => { handleSearchSet = () => {
const { columns, searchCondition } = this.props; const { columns, searchCondition } = this.props;
console.log(searchCondition);
const tab1 = { const tab1 = {
search: { search: {
field: {}, field: {},
getPageService: getWaitPage, getPageService: getWaitPage,
beforeSearchData: (data) => {
let searcherKeyValue = {};
for(let item of searchCondition){
if(typeof data[item.key] !== 'undefined'){
searcherKeyValue[item.base52] = data[item.key];
}
}
if(searcherKeyValue && Object.keys(searcherKeyValue).length){
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
console.log(data);
return data;
},
responseCallBack: response => { responseCallBack: response => {
return response; return response;
}, },
...@@ -81,6 +93,19 @@ export default class AuditPage extends Component { ...@@ -81,6 +93,19 @@ export default class AuditPage extends Component {
responseCallBack: response => { responseCallBack: response => {
return response; return response;
}, },
beforeSearchData: (data) => {
let searcherKeyValue = {};
for(let item of searchCondition){
if(typeof data[item.key] !== 'undefined'){
searcherKeyValue[item.base52] = data[item.key];
}
}
if(searcherKeyValue && Object.keys(searcherKeyValue).length){
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
console.log(data);
return data;
},
condition: searchCondition, condition: searchCondition,
nameSpan: { big: 8, small: 9 }, nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 4 }, fileSpan: { big: 4, small: 4 },
...@@ -95,7 +120,7 @@ export default class AuditPage extends Component { ...@@ -95,7 +120,7 @@ export default class AuditPage extends Component {
}; };
render() { render() {
const { workId, dataBaseId, addFields } = this.props; const { workId, dataBaseId, addFields, searchCondition } = this.props;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
...@@ -104,6 +129,7 @@ export default class AuditPage extends Component { ...@@ -104,6 +129,7 @@ export default class AuditPage extends Component {
pageButton={this.handleButtonSet({})} pageButton={this.handleButtonSet({})}
workId={workId} workId={workId}
dataBaseId={dataBaseId} dataBaseId={dataBaseId}
searchCondition={searchCondition}
addFields={addFields} addFields={addFields}
pageSearch={this.handleSearchSet({})} pageSearch={this.handleSearchSet({})}
/> />
......
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from "react";
import SearchDom from '@/highOrderComponent/SearchDom'; import SearchDom from "@/highOrderComponent/SearchDom";
import ButtonListDom from '../ButtonListDom'; import ButtonListDom from "../ButtonListDom";
import Shell from '@/baseComponent/Shell'; import Shell from "@/baseComponent/Shell";
import StandardTable from '@/components/StandardTable'; import StandardTable from "@/components/StandardTable";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import { deepCopy } from '@/baseComponent/utils'; import { deepCopy } from "@/baseComponent/utils";
import { handleAudit } from '../publicApiService'; import { handleAudit } from "../publicApiService";
import { handleColumns } from '@/webPublic/FormInsertDiy/AffairPage/destruction'; import { handleColumns } from "@/webPublic/FormInsertDiy/AffairPage/destruction";
export default class List extends Component { export default class List extends Component {
constructor(props) { constructor(props) {
...@@ -21,24 +21,24 @@ export default class List extends Component { ...@@ -21,24 +21,24 @@ export default class List extends Component {
current: 1, current: 1,
total: 1, total: 1,
pageSize: this.props.listConfig.pageSize || 10, pageSize: this.props.listConfig.pageSize || 10,
pageSizeOptions: ['10', '20', '50', '100', '500'], pageSizeOptions: ["10", "20", "50", "100", "500"],
showQuickJumper: true, showQuickJumper: true,
onShowSizeChange: (current, size) => { onShowSizeChange: (current, size) => {
this.pageChange(current, size); this.pageChange(current, size);
}, },
onChange: (current, size) => { onChange: (current, size) => {
this.pageChange(current, size); this.pageChange(current, size);
}, }
}, }
}; };
} }
giveDefaultValue = (props) => { giveDefaultValue = (props) => {
// 如果设置了 giveFieldsToFormValues 则将默认值赋值给formValues // 如果设置了 giveFieldsToFormValues 则将默认值赋值给formValues
let formValues = {}; let formValues = {};
if(props.pageSearch && props.pageSearch.search && props.pageSearch.search.giveFieldsToFormValues){ if (props.pageSearch && props.pageSearch.search && props.pageSearch.search.giveFieldsToFormValues) {
for(let x in props.pageSearch.search.field){ for (let x in props.pageSearch.search.field) {
if(props.pageSearch.search.field[x].required === true){ if (props.pageSearch.search.field[x].required === true) {
formValues[x] = props.pageSearch.search.field[x].defaultValue; formValues[x] = props.pageSearch.search.field[x].defaultValue;
} }
} }
...@@ -54,7 +54,7 @@ export default class List extends Component { ...@@ -54,7 +54,7 @@ export default class List extends Component {
/** 如果配置了默认值 则 加进去 **/ /** 如果配置了默认值 则 加进去 **/
for (let item in search.field) { for (let item in search.field) {
let one = search.field[item]; let one = search.field[item];
if (one.required && (typeof data[item] === 'undefined')) { if (one.required && (typeof data[item] === "undefined")) {
/** /**
* 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改 * 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
* */ * */
...@@ -65,55 +65,59 @@ export default class List extends Component { ...@@ -65,55 +65,59 @@ export default class List extends Component {
data.pageSize = pagination.pageSize; data.pageSize = pagination.pageSize;
data.pageNo = pagination.current; data.pageNo = pagination.current;
} }
if(search.beforeGetPage){ if (search.beforeGetPage) {
data = search.beforeGetPage(data); data = search.beforeGetPage(data);
} }
return data; return data;
}; };
getPage = () => { getPage = () => {
const { listConfig, pageSearch, dataBaseId, workId, getpageService } = this.props; const { listConfig, pageSearch, workId } = this.props;
const { pagination, sortGetPageFields } = this.state; const { pagination, sortGetPageFields } = this.state;
const { search } = pageSearch; const { search } = pageSearch;
let data = this.giveGetPageFields(); let data = this.giveGetPageFields();
if(!data){ if (!data) {
return false; return false;
} }
if(search.handleSort){ if (search.handleSort) {
data = { data = {
...data, ...data,
...sortGetPageFields, // 增加排序的搜索条件 ...sortGetPageFields, // 增加排序的搜索条件
} };
} }
this.setState({ this.setState({
list: [], list: [],
loading: true, loading: true,
}); });
if (search.beforeSearchData && typeof search.beforeSearchData === "function") {
data = search.beforeSearchData(data, {...this.props});
}
search.getPageService({ ...data, appId: workId }).then((response) => { search.getPageService({ ...data, appId: workId }).then((response) => {
this.setState({ this.setState({
loading: false, loading: false
}); });
if (!response || (search.paging && typeof response.total === 'undefined') || response.errMsg) { if (!response || (search.paging && typeof response.total === "undefined") || response.errMsg) {
return false; return false;
} }
if (listConfig.paging) { if (listConfig.paging) {
pagination.total = Number(response.total); pagination.total = Number(response.total);
} }
if (typeof search.responseCallBack !== 'undefined') { if (typeof search.responseCallBack !== "undefined") {
response = search.responseCallBack(response); response = search.responseCallBack(response);
} }
this.setState({ this.setState({
list: response.rows || response, list: response.rows || response,
selectRows: [], selectRows: [],
pagination: pagination, pagination: pagination
}); });
}); });
}; };
stateChange = (key, value) => { stateChange = (key, value) => {
this.setState({ this.setState({
[key]: value, [key]: value
}); });
}; };
...@@ -122,8 +126,8 @@ export default class List extends Component { ...@@ -122,8 +126,8 @@ export default class List extends Component {
pagination: { pagination: {
...this.state.pagination, ...this.state.pagination,
current: current, current: current,
pageSize: size, pageSize: size
}, }
}, () => { }, () => {
this.getPage(); this.getPage();
}); });
...@@ -137,19 +141,19 @@ export default class List extends Component { ...@@ -137,19 +141,19 @@ export default class List extends Component {
/** /**
* 如果设置了beforeChange回调函数 则调用此回调函数改变另外的字段的值 * 如果设置了beforeChange回调函数 则调用此回调函数改变另外的字段的值
* */ * */
const index = condition.findIndex((item)=>{ const index = condition.findIndex((item) => {
return item.key === key; return item.key === key;
}); });
if(index !== -1){ if (index !== -1) {
const thisConfig = condition[index]; const thisConfig = condition[index];
if(thisConfig.beforeChange){ if (thisConfig.beforeChange) {
oldValue = thisConfig.beforeChange(oldValue,thisConfig); oldValue = thisConfig.beforeChange(oldValue, thisConfig);
} }
} }
this.setState({ this.setState({
formValues: oldValue, formValues: oldValue
},()=>{ }, () => {
if(search.afterFormValuesChange){ if (search.afterFormValuesChange) {
search.afterFormValuesChange(key, oldValue, this.getPage); search.afterFormValuesChange(key, oldValue, this.getPage);
} }
}); });
...@@ -157,13 +161,13 @@ export default class List extends Component { ...@@ -157,13 +161,13 @@ export default class List extends Component {
handleSelectRows = rows => { handleSelectRows = rows => {
this.setState({ this.setState({
selectRows: rows, selectRows: rows
}); });
}; };
componentDidMount() { componentDidMount() {
const { search } = this.props.pageSearch; const { search } = this.props.pageSearch;
if(!search.noNeedInitData){ if (!search.noNeedInitData) {
this.getPage(); this.getPage();
} }
} }
...@@ -171,20 +175,20 @@ export default class List extends Component { ...@@ -171,20 +175,20 @@ export default class List extends Component {
componentWillMount() { componentWillMount() {
} }
componentWillUnmount(){ componentWillUnmount() {
} }
resetFormValues = () => { resetFormValues = () => {
const { beforeResetFormValues } = this.props.pageSearch.search; const { beforeResetFormValues } = this.props.pageSearch.search;
let { formValues } = this.state; let { formValues } = this.state;
if(beforeResetFormValues){ if (beforeResetFormValues) {
formValues = beforeResetFormValues(formValues); formValues = beforeResetFormValues(formValues);
}else{ } else {
formValues = {} ; formValues = {};
} }
this.setState({ this.setState({
formValues, formValues
}) });
}; };
/** /**
...@@ -192,13 +196,13 @@ export default class List extends Component { ...@@ -192,13 +196,13 @@ export default class List extends Component {
* */ * */
handleOnChange = (pagination, filters, sorter) => { handleOnChange = (pagination, filters, sorter) => {
const { pageSearch } = this.props; const { pageSearch } = this.props;
if(sorter){ if (sorter) {
const sortGetPageFields = pageSearch.search.handleSort(sorter); const sortGetPageFields = pageSearch.search.handleSort(sorter);
this.setState({ this.setState({
sortGetPageFields, sortGetPageFields
},()=>{ }, () => {
this.getPage(); this.getPage();
}) });
} }
}; };
...@@ -207,92 +211,92 @@ export default class List extends Component { ...@@ -207,92 +211,92 @@ export default class List extends Component {
const { list } = this.state; const { list } = this.state;
let re = {}; let re = {};
let buttonConfig = []; let buttonConfig = [];
for(let item of list){ for (let item of list) {
if(item.btns && Array.isArray(item.btns)){ if (item.btns && Array.isArray(item.btns)) {
for( let x of item.btns){ for (let x of item.btns) {
if(typeof re[x.name] === 'undefined'){ if (typeof re[x.name] === "undefined") {
re[x.name] = x; re[x.name] = x;
} }
} }
} }
} }
for(let z in re){ for (let z in re) {
let info = re[z]; let info = re[z];
buttonConfig.push( buttonConfig.push(
{ {
type: z, type: z,
name: z, name: z,
component: 'ModalBatch', component: "ModalBatch",
className: z !== '通过' ? 'defaultRed' : 'defaultBlue', className: z !== "通过" ? "defaultRed" : "defaultBlue",
nameSpan: { big: 4, small: 5 }, nameSpan: { big: 4, small: 5 },
fileSpan: { big: 1, small: 1 }, fileSpan: { big: 1, small: 1 },
values: { values: {
[info.key]: info.value, [info.key]: info.value
}, },
fields: [ fields: [
{ {
key: 'reason', key: "reason",
name: '审核意见', name: "审核意见",
type: 'textarea', type: "textarea"
}, }
], ],
beforeSubmit: (props, formValues) => { beforeSubmit: (props, formValues) => {
return { return {
taskForm : {}, taskForm: {},
examineMap: JSON.stringify(formValues), examineMap: JSON.stringify(formValues)
}; };
}, },
sourceKey: 'taskId', sourceKey: "taskId",
postKey: 'taskIds', postKey: "taskIds",
apiServiceApi: handleAudit, apiServiceApi: handleAudit
} }
) );
} }
return buttonConfig; return buttonConfig;
}; };
render() { render() {
const { formValues, selectRows, list, pagination, loading } = this.state; const { formValues, selectRows, list, pagination, loading } = this.state;
const { listConfig, pageSearch, pageButton ,children, addFields} = this.props; const { listConfig, pageSearch, pageButton, children, addFields } = this.props;
let { columns, search } = pageSearch; let { columns, search } = pageSearch;
columns = handleColumns(columns); columns = handleColumns(columns);
let data = list; let data = list;
for(let item of addFields){ for (let item of addFields) {
if(item.type === 'tableSelect' && item.c1){ if (item.type === "tableSelect" && item.c1) {
for(let i = 0; i < data.length; i++ ){ for (let i = 0; i < data.length; i++) {
let nameKey = item.componentProps.labelName; let nameKey = item.componentProps.labelName;
if(data[i][item.c1] && data[i][item.c1].selects){ if (data[i][item.c1] && data[i][item.c1].selects) {
let res = []; let res = [];
for(let x in data[i][item.c1].selects){ for (let x in data[i][item.c1].selects) {
res.push(data[i][item.c1].selects[x][nameKey]); res.push(data[i][item.c1].selects[x][nameKey]);
} }
data[i][item.c1] = res.join(','); data[i][item.c1] = res.join(",");
} }
} }
} }
} }
const tableProps = { const tableProps = {
rowKey: pageSearch.tableRowKey || 'id', rowKey: pageSearch.tableRowKey || "id",
selectedRows: selectRows, selectedRows: selectRows,
data: {list: data, pagination}, data: { list: data, pagination },
columns, columns,
bordered: pageSearch.bordered || false, bordered: pageSearch.bordered || false,
loading, loading,
noSelectRow: !listConfig.selectRows, noSelectRow: !listConfig.selectRows,
onSelectRow: this.handleSelectRows, onSelectRow: this.handleSelectRows,
scroll: {x: true}, scroll: { x: true }
}; };
if(!listConfig.paging){ if (!listConfig.paging) {
tableProps.data = {list: data, pagination:false}; tableProps.data = { list: data, pagination: false };
} }
if(search && search.handleSort){ if (search && search.handleSort) {
tableProps.onChange = this.handleOnChange; tableProps.onChange = this.handleOnChange;
} }
return ( return (
<Fragment> <Fragment>
{listConfig.searchArea ? {listConfig.searchArea && this.props.searchCondition?.length ?
<SearchDom formStateChange={this.formStateChange} <SearchDom formStateChange={this.formStateChange}
formValues={formValues} formValues={formValues}
getPage={this.getPage} getPage={this.getPage}
...@@ -313,7 +317,7 @@ export default class List extends Component { ...@@ -313,7 +317,7 @@ export default class List extends Component {
children={children} children={children}
/> : null} /> : null}
<StandardTable {...tableProps}/> <StandardTable {...tableProps} />
</Shell> </Shell>
</Fragment> </Fragment>
); );
...@@ -323,7 +327,7 @@ export default class List extends Component { ...@@ -323,7 +327,7 @@ export default class List extends Component {
List.propTypes = { List.propTypes = {
listConfig: PropTypes.object.isRequired, listConfig: PropTypes.object.isRequired,
// pageButton: PropTypes.array, // pageButton: PropTypes.array,
pageSearch: PropTypes.object.isRequired, pageSearch: PropTypes.object.isRequired
}; };
List.defaultProps = { List.defaultProps = {
...@@ -331,37 +335,37 @@ List.defaultProps = { ...@@ -331,37 +335,37 @@ List.defaultProps = {
selectRows: true, // 是否可以行选择, selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页, paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom, searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区, buttonArea: true // 是否拥有 按钮区,
}, },
pageSearch: { pageSearch: {
search: { search: {
url: '', url: "",
field: {}, field: {},
responseCallBack: (response) => { responseCallBack: (response) => {
return response; return response;
}, },
condition: [ condition: [
{ {
key: 'studentNo', key: "studentNo",
name: '学号', name: "学号",
type: 'input', type: "input"
}, }
], ],
tableRowKey: 'id', tableRowKey: "id",
columns: [ columns: [
{ {
title: '姓名', title: "姓名",
dataIndex: '', dataIndex: ""
}, },
{ {
title: '操作', title: "操作",
dataIndex: 'operation', dataIndex: "operation",
renderType: 'update', // 修改 renderType: "update" // 修改
}, }
], ],
nameSpan: { big: 8, small: 9 }, nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 4 }, fileSpan: { big: 4, small: 4 }
}, }
}, }
}; };
...@@ -32,17 +32,17 @@ export default class ListTab extends Component { ...@@ -32,17 +32,17 @@ export default class ListTab extends Component {
}; };
render() { render() {
const { tabList, pageSearch, pageButton, workId, dataBaseId, addFields } = this.props; const { tabList, pageSearch, pageButton, workId, dataBaseId, addFields, searchCondition } = this.props;
const { activeKey, tabKeys } = this.state; const { activeKey, tabKeys } = this.state;
return ( return (
<Fragment> <Fragment>
<Shell> <Shell styleShell={{marginTop: 0}}>
{/*<SearchDom />*/}
<Tabs activeKey={activeKey} <Tabs activeKey={activeKey}
className={styles.ListTab} className={styles.ListTab}
onChange={this.handleChangeTab}> onChange={this.handleChangeTab}>
{tabKeys.map((item) => { {tabKeys.map((item) => {
return <TabPane tab={tabList[item].name} key={item}> return <TabPane tab={tabList[item].name} key={item}>
</TabPane> </TabPane>
})} })}
</Tabs> </Tabs>
...@@ -53,6 +53,7 @@ export default class ListTab extends Component { ...@@ -53,6 +53,7 @@ export default class ListTab extends Component {
key={item} key={item}
workId={workId} workId={workId}
addFields={addFields} addFields={addFields}
searchCondition={searchCondition}
dataBaseId={dataBaseId} dataBaseId={dataBaseId}
pageSearch={pageSearch[item]} pageSearch={pageSearch[item]}
pageButton={pageButton[item]} pageButton={pageButton[item]}
......
...@@ -44,10 +44,11 @@ export default class Index extends React.Component { ...@@ -44,10 +44,11 @@ export default class Index extends React.Component {
return false; return false;
} }
destructionFunc.destructionGetDetail(response).then((x) => { destructionFunc.destructionGetDetail(response).then((x) => {
const { addFields, tableInfo, allConfigSetInfo } = x; const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x;
this.setState({ this.setState({
addFields, addFields,
tableInfo, tableInfo,
searchCondition,
allConfigSetInfo, allConfigSetInfo,
},() => { },() => {
this.giveDetailColumns(); this.giveDetailColumns();
......
...@@ -6,7 +6,7 @@ const pageSetting = { ...@@ -6,7 +6,7 @@ const pageSetting = {
listConfig:{ listConfig:{
selectRows: true, // 是否可以行选择, selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页, paging: true, // 是否可以分页,
searchArea: false, // 是否拥有 搜索区dom, searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区, buttonArea: true, // 是否拥有 按钮区,
} }
}, },
...@@ -15,9 +15,9 @@ const pageSetting = { ...@@ -15,9 +15,9 @@ const pageSetting = {
listConfig:{ listConfig:{
selectRows: true, // 是否可以行选择, selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页, paging: true, // 是否可以分页,
searchArea: false, // 是否拥有 搜索区dom, searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区, buttonArea: true, // 是否拥有 按钮区,
} },
}, },
}, },
}; };
......
import { text, number, date, format, taskNode } from '../config/index'; import { text, number, date, format, taskNode } from '../config/index';
import { isJSON } from '@/baseComponent/utils'; import { isJSON } from '@/baseComponent/utils';
import { translateAddFields } from '../config/index'; import { translateAddFields, getSearchCondition } from '../config/index';
import config from '@/config/config'; import config from '@/config/config';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import moment from 'moment'; import moment from 'moment';
...@@ -190,6 +190,7 @@ export async function destructionGetDetail(response) { ...@@ -190,6 +190,7 @@ export async function destructionGetDetail(response) {
addFields: [], addFields: [],
tableInfo: {}, tableInfo: {},
allConfigSetInfo: response, allConfigSetInfo: response,
searchCondition: [],
}; };
} }
const basicPatternModel = response.unifiedServicePatternModel; const basicPatternModel = response.unifiedServicePatternModel;
...@@ -286,6 +287,7 @@ export async function destructionGetDetail(response) { ...@@ -286,6 +287,7 @@ export async function destructionGetDetail(response) {
addFields: await translateAddFields(fileds, tableInfo), addFields: await translateAddFields(fileds, tableInfo),
tableInfo, tableInfo,
allConfigSetInfo: response, allConfigSetInfo: response,
searchCondition: await getSearchCondition(basicPatternModel?.dataObjModels[0]?.id),
}; };
} }
......
...@@ -6,127 +6,144 @@ ...@@ -6,127 +6,144 @@
* */ * */
import { apiRequest } from '../request'; import { apiRequest } from '../request';
import { getFormArrayConfig } from '../config/index'; import { getFormArrayConfig } from '../config/index';
import { setHuanGeToken } from '@/utils/authority'; import { setHuanGeToken } from '@/utils/authority';
import { getOneStopConfig, isJSON } from '@/baseComponent/utils'; import { getOneStopConfig, isJSON } from '@/baseComponent/utils';
import config from '@/config/config'; import config from '@/config/config';
const giveValue = (x) => { const giveValue = (x) => {
if(x && x.rows){ if (x && x.rows) {
let res = []; let res = [];
for(let item of x.rows){ for (let item of x.rows) {
res.push({ res.push({
...item.hisTaskListData, ...item.hisTaskListData,
...item, ...item,
}); });
} }
x.rows = res; x.rows = res;
return x; return x;
}else{ } else {
return { return {
rows: [], rows: [],
total: 1, total: 1,
}; };
} }
}; };
const getId = async (pathname) => {
const getId = async (pathname) => { // 获取流程引擎 事务workId 和表dataBaseId // 获取流程引擎 事务workId 和表dataBaseId
let idObj = await getOneStopConfig(pathname); let idObj = await getOneStopConfig(pathname);
console.log(idObj); console.log(idObj);
if (typeof idObj === 'undefined' || !idObj) { if (typeof idObj === 'undefined' || !idObj) {
console.error('没有找到对应的流程引擎id'); console.error('没有找到对应的流程引擎id');
return false; return false;
} else { } else {
return { return {
dataBaseId: idObj, dataBaseId: idObj,
workId: idObj, workId: idObj,
}; };
} }
}; };
const getPages = (info) => {
const getPages = (info) => { // 获取代办事项 分页数据 workId // 获取代办事项 分页数据 workId
// workId, pageSize, pageNo, // workId, pageSize, pageNo,
if (typeof info.pageNo === 'undefined') { if (typeof info.pageNo === 'undefined') {
info.pageNo = 1; info.pageNo = 1;
info.pageSize = 10; info.pageSize = 10;
} }
return apiRequest('/UnifiedAppFormApi/getWaitPage', info); return apiRequest('/UnifiedAppFormApi/getWaitPage', info);
}; };
const getColumns = (workId) => {
// 获取表头 workId
return apiRequest('/UnifiedAppFormApi/getFormTitle', { id: workId });
const getColumns = (workId) => { // 获取表头 workId
return apiRequest('/UnifiedAppFormApi/getFormTitle', { id: workId });
}; };
const getHead = (dataObjId) => {
// 获取表头 workId
return apiRequest('/DataColumnApi/getHeaderList', { dataObjId });
};
/** /**
* 获取下拉枚举值 * 获取下拉枚举值
* */ * */
const getOptions = async (id, filterSql = undefined, key, name) => { const getOptions = async (id, filterSql = undefined, key, name) => {
return await apiRequest('/DataColumnApi/getOptions', {id, filterSql}).then((x)=>{ return await apiRequest('/DataColumnApi/getOptions', { id, filterSql }).then((x) => {
if(x){ if (x) {
return x.map((y)=>{ return x.map((y) => {
return {
key: y[key],
name: y[name],
};
});
} else {
return [];
}
});
};
/**
* 批量获取下拉枚举值
* */
const getBatchOptions = async (ids) => {
return await apiRequest('/DataColumnApi/getBatchOptions', {ids}).then((x) => {
if (x) {
return x.map((y) => {
return { return {
key: y[key], key: y[key],
name: y[name], name: y[name],
} };
}) });
}else{ } else {
return []; return [];
} }
}); });
}; };
/** /**
* 获取下拉枚举值 通过sql语句 * 获取下拉枚举值 通过sql语句
* */ * */
const getSqlOptions = async (id, sqlKey = undefined, key, name ) => { const getSqlOptions = async (id, sqlKey = undefined, key, name) => {
return await apiRequest('/DataColumnApi/getSqlOptions', {id, sqlKey}).then((x)=>{ return await apiRequest('/DataColumnApi/getSqlOptions', { id, sqlKey }).then((x) => {
if(x){ if (x) {
return x.map((y)=>{ return x.map((y) => {
return { return {
key: y[key], key: y[key],
name: y[name], name: y[name],
} };
}) });
}else{ } else {
return []; return [];
} }
}); });
}; };
/** /**
* 获取发起流程填写的字段表单详情 * 获取发起流程填写的字段表单详情
* */ * */
const getFormDetail = (id) => { const getFormDetail = (id) => {
return apiRequest('/UnifiedAppApi/getDetail', {id}).then((x)=>{ return apiRequest('/UnifiedAppApi/getDetail', { id }).then((x) => {
if(x){ if (x) {
return x; return x;
}else{ } else {
return {}; return {};
} }
}); });
}; };
/** /**
* 发起流程 * 发起流程
* */ * */
const startProcess = (info) => { const startProcess = (info) => {
return apiRequest('/UnifiedAppFormApi/startProcess', info).then((x)=>{ return apiRequest('/UnifiedAppFormApi/startProcess', info).then((x) => {
if(x){ if (x) {
return x; return x;
}else{ } else {
return null; return null;
} }
}); });
}; };
/** /**
...@@ -135,10 +152,9 @@ const startProcess = (info) => { ...@@ -135,10 +152,9 @@ const startProcess = (info) => {
* */ * */
const getApplyPage = (info) => { const getApplyPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getApplyPage', info).then((x)=>{ return apiRequest('/UnifiedAppFormApi/getApplyPage', info).then((x) => {
return giveValue(x); return giveValue(x);
});
});
}; };
/** /**
* 查询一个流程的详情数据 * 查询一个流程的详情数据
...@@ -146,14 +162,14 @@ const getApplyPage = (info) => { ...@@ -146,14 +162,14 @@ const getApplyPage = (info) => {
* */ * */
const getDetailInfo = (id) => { const getDetailInfo = (id) => {
return apiRequest('/UnifiedAppFormApi/getFormDetail', {id}).then((x)=>{ return apiRequest('/UnifiedAppFormApi/getFormDetail', { id }).then((x) => {
if(x){ if (x) {
return x; return x;
}else{ } else {
return null; return null;
} }
}); });
}; };
/** /**
* 待办业务 * 待办业务
* pageSize: 10 * pageSize: 10
...@@ -161,9 +177,9 @@ const getDetailInfo = (id) => { ...@@ -161,9 +177,9 @@ const getDetailInfo = (id) => {
* pageNo: 1 * pageNo: 1
* */ * */
const getWaitPage = (info) => { const getWaitPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getWaitPage', info).then((x) => { return apiRequest('/UnifiedAppFormApi/getWaitPage', info).then((x) => {
return giveValue(x); return giveValue(x);
}) });
}; };
/** /**
* 已办业务 * 已办业务
...@@ -172,10 +188,9 @@ const getWaitPage = (info) => { ...@@ -172,10 +188,9 @@ const getWaitPage = (info) => {
* pageNo: 1 * pageNo: 1
* */ * */
const getHandledPage = (info) => { const getHandledPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getHandledPage', info).then((x) => { return apiRequest('/UnifiedAppFormApi/getHandledPage', info).then((x) => {
return giveValue(x);
return giveValue(x); });
})
}; };
/** /**
...@@ -185,41 +200,48 @@ const getHandledPage = (info) => { ...@@ -185,41 +200,48 @@ const getHandledPage = (info) => {
* taskForm: {} * taskForm: {}
* */ * */
const handleAudit = (info) => { const handleAudit = (info) => {
return apiRequest('/UnifiedAppFormApi/examineProcess', info).then((x) => { return apiRequest('/UnifiedAppFormApi/examineProcess', info).then((x) => {
if(x){ if (x) {
return x; return x;
} }
}) });
}; };
const handleSqlData = (info) => { const handleSqlData = (info) => {
return apiRequest('/DataColumnApi/getSqlData', info).then((x) => { return apiRequest('/DataColumnApi/getSqlData', info).then((x) => {
if(x){ if (x) {
return x; return x;
}else{ } else {
return []; return [];
} }
}) });
}; };
const handleSqlfind = async(sqlKey = '') => { const handleSqlfind = async (sqlKey = '') => {
return await apiRequest('/SqlManageEntityApi/find', {sqlKey}).then((x) => { return await apiRequest('/SqlManageEntityApi/find', { sqlKey }).then((x) => {
if(x){ if (x) {
return x; return x;
}else{ } else {
return null; return null;
} }
}) });
}; };
export { export {
getId, getColumns, getPages, getId,
getFormDetail, getColumns,
getOptions, startProcess, getApplyPage, getPages,
getDetailInfo, getWaitPage, getHandledPage, handleAudit, getFormDetail,
handleSqlData,handleSqlfind, getSqlOptions, getOptions,
getBatchOptions,
startProcess,
getApplyPage,
getDetailInfo,
getWaitPage,
getHandledPage,
handleAudit,
handleSqlData,
handleSqlfind,
getSqlOptions,
getHead,
}; };
...@@ -5,33 +5,33 @@ import { getDefaultValues } from '../AffairPage/destruction'; ...@@ -5,33 +5,33 @@ import { getDefaultValues } from '../AffairPage/destruction';
import { message } from 'antd'; import { message } from 'antd';
const text = [ const text = [
'BINARY', 'BINARY',
'BIT', 'BIT',
'BLOB', 'BLOB',
'CHAR', 'CHAR',
'GEOMETRY', 'GEOMETRY',
'GEOMETRYCOLLECTION', 'GEOMETRYCOLLECTION',
'JSON', 'JSON',
'LINESTRING', 'LINESTRING',
'LONGBLOB', 'LONGBLOB',
'LONGTEXT', 'LONGTEXT',
'MEDIUMBLOB', 'MEDIUMBLOB',
'MEDIUMINT', 'MEDIUMINT',
'MEDIUMTEXT', 'MEDIUMTEXT',
'MULTILINESTRING', 'MULTILINESTRING',
'MULTIPOINT', 'MULTIPOINT',
'MULTIPOLYGON', 'MULTIPOLYGON',
'POINT', 'POINT',
'POLYGON', 'POLYGON',
'REAL', 'REAL',
'DECIMAL', 'DECIMAL',
'ENUM', 'ENUM',
'SET', 'SET',
'TEXT', 'TEXT',
'TINYBLOB', 'TINYBLOB',
'TIBYTEXT', 'TIBYTEXT',
'VARBINARY', 'VARBINARY',
'VARCHAR', 'VARCHAR',
]; ];
const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT']; const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT'];
...@@ -39,12 +39,12 @@ const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALL ...@@ -39,12 +39,12 @@ const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALL
const date = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR']; const date = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'];
const format = { const format = {
// 欢哥那边定义好的 时间格式类型 // 欢哥那边定义好的 时间格式类型
DATE: 'YYYY-MM-DD HH:mm', DATE: 'YYYY-MM-DD HH:mm',
DATETIME: 'YYYY-MM-DD HH:mm:ss', DATETIME: 'YYYY-MM-DD HH:mm:ss',
TIME: 'HH:mm:ss', TIME: 'HH:mm:ss',
TIMESTAMP: 'HH:mm:ss', TIMESTAMP: 'HH:mm:ss',
YEAR: 'YYYY', YEAR: 'YYYY',
}; };
const taskNode = ['TASKNODE']; const taskNode = ['TASKNODE'];
...@@ -52,20 +52,20 @@ const taskNode = ['TASKNODE']; ...@@ -52,20 +52,20 @@ const taskNode = ['TASKNODE'];
* 将时间格式转化为unix时间戳 * 将时间格式转化为unix时间戳
* */ * */
const transLateTimeTOUnix = (value, dataType) => { const transLateTimeTOUnix = (value, dataType) => {
if (date.indexOf(dataType) > -1 && value) { if (date.indexOf(dataType) > -1 && value) {
return moment(value).format('x'); return moment(value).format('x');
} else { } else {
return value; return value;
} }
}; };
const getFormArrayConfig = header => { const getFormArrayConfig = (header) => {
let config = []; let config = [];
for (let item of header) { for (let item of header) {
if (item.isPrimaryKey || item.isHidden || item.dataIndex === 'operationEdit') { if (item.isPrimaryKey || item.isHidden || item.dataIndex === 'operationEdit') {
// 主键 // 主键
continue; continue;
/* config.push( /* config.push(
{ {
key: item.name, key: item.name,
name: item.title, name: item.title,
...@@ -74,178 +74,205 @@ const getFormArrayConfig = header => { ...@@ -74,178 +74,205 @@ const getFormArrayConfig = header => {
required: !item.isNull, required: !item.isNull,
} }
);*/ );*/
} else if (text.indexOf(item.type) > -1) { } else if (text.indexOf(item.type) > -1) {
config.push({ config.push({
key: item.name, key: item.name,
name: item.title, name: item.title,
type: 'input', type: 'input',
placeHolder: `请输入${item.name}`, placeHolder: `请输入${item.name}`,
required: !item.isNull, required: !item.isNull,
base52: item.base52,
});
} else if (number.indexOf(item.type) > -1) {
config.push({
key: item.name,
name: item.title,
type: 'inputNumber',
placeHolder: `请输入${item.name}`,
required: !item.isNull,
min: 0,
base52: item.base52,
}); });
} else if (number.indexOf(item.type) > -1) { } else if (date.indexOf(item.type) > -1) {
config.push({ config.push({
key: item.name, key: item.name,
name: item.title, name: item.title,
type: 'inputNumber', type: 'datePicker',
placeHolder: `请输入${item.name}`, placeHolder: `请输入${item.name}`,
required: !item.isNull, required: !item.isNull,
min: 0, format: format[item.type],
base52: item.base52,
}); });
} else if (date.indexOf(item.type) > -1) { } else {
config.push({ config.push({
key: item.name, key: item.name,
name: item.title, name: item.title,
type: 'datePicker', type: 'input',
placeHolder: `请输入${item.name}`, placeHolder: `请输入${item.name}`,
required: !item.isNull, required: !item.isNull,
format: format[item.type], base52: item.base52,
}); });
} else { }
config.push({ }
key: item.name, return config;
name: item.title,
type: 'input',
placeHolder: `请输入${item.name}`,
required: !item.isNull,
});
}
}
return config;
}; };
const transLate = { const transLate = {
TextArea: 'textarea', TextArea: 'textarea',
Radio: 'radioGroup', Radio: 'radioGroup',
Label: 'text', Label: 'text',
Checkbox: 'checkBoxMutiple', Checkbox: 'checkBoxMutiple',
Select: 'select', Select: 'select',
Switch: 'switch', Switch: 'switch',
DatePicker: 'datePicker', DatePicker: 'datePicker',
RangePicker: 'rangePicker', RangePicker: 'rangePicker',
UploadCom: 'buttonUpload', UploadCom: 'buttonUpload',
ImgUploadCom: 'upload', ImgUploadCom: 'upload',
VideoUploadCom: 'upload', VideoUploadCom: 'upload',
Input: 'input', Input: 'input',
TableSelect: 'tableSelect', // 表格选择 TableSelect: 'tableSelect', // 表格选择
ChildForm: 'childForm', // 最终保存的数据还有问题 ChildForm: 'childForm', // 最终保存的数据还有问题
InputNumber: 'inputNumber', InputNumber: 'inputNumber',
PartForm: 'partForm', // 还未开发 相当于选了一个选项 表单字段变更 PartForm: 'partForm', // 还未开发 相当于选了一个选项 表单字段变更
Echart: 'echart', // 不做 Echart: 'echart', // 不做
Description: 'input', // 'description', // 还未开发 Description: 'input', // 'description', // 还未开发
Table: 'table', // 表格 未开发 Table: 'table', // 表格 未开发
};
const getOpts = async (item) => {
let options = [];
if (item.optionType === 'reference') {
options = await service.getOptions(
item.dataId,
item.filterSql,
item.referenceCodeName,
item.referenceNameName,
);
} else if (item.optionType === 'sql') {
options = await service.getSqlOptions(item.dataId, item.sqlKey, item.valueName, item.labelName);
} else {
options = item.options;
}
return options;
}; };
const getOpts = async item => { const getSearchCondition = async (id) => {
let options = []; const searchHeaders = await service.getHead(id).then((res) => {
if (item.optionType === 'reference') { if (res && res.length) {
options = await service.getOptions( return res.filter((x) => {
item.dataId, return x.isShowQuery !== false && x.isHidden === false;
item.filterSql, });
item.referenceCodeName, }
item.referenceNameName });
); const refIds = [];
} else if (item.optionType === 'sql') { searchHeaders.forEach((x) => {
options = await service.getSqlOptions(item.dataId, item.sqlKey, item.valueName, item.labelName); if (!!x.referenceObjId) {
} else { refIds.push(x.referenceObjId);
options = item.options; }
} });
return options; const condition = getFormArrayConfig(searchHeaders);
if (refIds && refIds.length) { // TODO 暂时不处理下拉的搜索条件 要考虑 getOpts 里面提及的各种问题
const options = await service.getBatchOptions(refIds);
console.log(options);
}
return condition;
}; };
const translateAddFields = async (data, tableInfo) => { const translateAddFields = async (data, tableInfo) => {
let key = []; let key = [];
let res = []; let res = [];
for (let item of data) { for (let item of data) {
if (key.indexOf(item.key) > -1) { if (key.indexOf(item.key) > -1) {
continue; continue;
} else { } else {
key.push(item.key); key.push(item.key);
} }
item.type = transLate[item.comName] || 'input'; item.type = transLate[item.comName] || 'input';
if (typeof item.key === 'undefined' || !item.key) { if (typeof item.key === 'undefined' || !item.key) {
item.key = item.c1; item.key = item.c1;
} }
switch (item.comName) { switch (item.comName) {
case 'Input': case 'Input':
if (number.indexOf(item.dataType) > -1) { if (number.indexOf(item.dataType) > -1) {
item.type = 'inputNumber'; item.type = 'inputNumber';
} }
break; break;
case 'DatePicker': case 'DatePicker':
item.format = item.format || format[item.dataType]; item.format = item.format || format[item.dataType];
if (item.format.indexOf('HH') > -1) { if (item.format.indexOf('HH') > -1) {
item.showTime = true; item.showTime = true;
} }
break; break;
case 'RangePicker': case 'RangePicker':
item.name = item.name || '起止时间'; item.name = item.name || '起止时间';
item.endKey = item.c2; item.endKey = item.c2;
item.format = item.format || format[item.dataType]; item.format = item.format || format[item.dataType];
if (item.format.indexOf('HH') > -1) { if (item.format.indexOf('HH') > -1) {
item.showTime = true; item.showTime = true;
} }
break; break;
case 'ChildForm': case 'ChildForm':
item.componentProps.thisFields = await translateAddFields( item.componentProps.thisFields = await translateAddFields(
item.componentProps.thisFields, item.componentProps.thisFields,
tableInfo tableInfo,
); );
break; break;
case 'Radio': case 'Radio':
item.options = await getOpts(item); item.options = await getOpts(item);
break; break;
case 'Select': case 'Select':
item.options = await getOpts(item); item.options = await getOpts(item);
break; break;
case 'Checkbox': case 'Checkbox':
item.options = await getOpts(item); item.options = await getOpts(item);
item.options = item.options.map(x => { item.options = item.options.map((x) => {
return { return {
label: x.name, label: x.name,
value: x.key, value: x.key,
}; };
}); });
break; break;
case 'TableSelect': case 'TableSelect':
let info = await service.handleSqlfind(item.componentProps.sqlKey); let info = await service.handleSqlfind(item.componentProps.sqlKey);
if (isJSON(info.cols)) { if (isJSON(info.cols)) {
info.cols = JSON.parse(info.cols); info.cols = JSON.parse(info.cols);
} }
item.componentProps.columnsData = info; item.componentProps.columnsData = info;
item.componentProps.allValues = JSON.stringify(getDefaultValues(data, tableInfo)); item.componentProps.allValues = JSON.stringify(getDefaultValues(data, tableInfo));
break; break;
default: default:
break; break;
} }
res.push(item); res.push(item);
} }
return res; return res;
}; };
const mustHaveValue = (configFields, data) => { const mustHaveValue = (configFields, data) => {
for (let item of configFields) { for (let item of configFields) {
if (item.required && !data[item.key] && data[item.key] !== false && data[item.key] !== 0) { if (item.required && !data[item.key] && data[item.key] !== false && data[item.key] !== 0) {
message.warning(`${item.name}是必填项请填写`); message.warning(`${item.name}是必填项请填写`);
return false; return false;
} }
if (item.required && typeof data[item.key] === 'object') { if (item.required && typeof data[item.key] === 'object') {
if (data[item.key].selects && JSON.stringify(data[item.key].selects) === '{}') { if (data[item.key].selects && JSON.stringify(data[item.key].selects) === '{}') {
message.warning(`${item.name}是必填项请填写`); message.warning(`${item.name}是必填项请填写`);
return false; return false;
} }
} }
} }
return true; return true;
}; };
export { export {
text, text,
number, number,
date, date,
getFormArrayConfig, getFormArrayConfig,
translateAddFields, translateAddFields,
transLateTimeTOUnix, transLateTimeTOUnix,
format, format,
mustHaveValue, mustHaveValue,
taskNode, taskNode,
getSearchCondition,
}; };
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论