提交 ba1a5ebc authored 作者: liqiufan's avatar liqiufan

2072 开发需求 1228

上级 6ee393d4
......@@ -21,6 +21,8 @@ import OrderItem from './OrderItem';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import FormdataWrapper from '@/utils/object-to-formdata-custom';
import { getServicesNomal } from '@/webPublic/one_stop_public/Services/services';
import { getExportInfoApi } from '@/webPublic/one_stop_public/Services/apiConfig';
const Option = Select.Option;
let keyX = 1;
......@@ -82,44 +84,39 @@ export default class Index extends React.Component {
this.setState({ groups });
};
open = () => {
const { dispatch } = this.props;
dispatch({
type: 'DataObj/getExportInfo',
payload: {
objId: this.props.objId,
},
callback: (infos) => {
const mockData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
});
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
getServicesNomal(getExportInfoApi, {
objId: this.props.objId,
}).then(infos => {
const mockData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
});
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
}
this.setState({
mockData,
infos,
visiable: true,
qs,
gs,
os,
});
},
this.setState({
mockData,
infos,
visiable: true,
qs,
gs,
os,
});
});
};
onCancle = () => {
......
......@@ -11,6 +11,9 @@ import {
getSassApiHeader,
getSysCode
} from '@/webPublic/one_stop_public/2023yunshangguizhou/utils';
import { getServicesNomal, importExecute } from '../../one_stop_public/Services/services';
import { importAnalyseApi } from '../../one_stop_public/Services/apiConfig';
const Step = Steps.Step;
const TabPane = Tabs.TabPane;
......@@ -95,92 +98,80 @@ export default class ImportUtil extends React.PureComponent {
}
import() {
const { dispatch, importParams } = this.props;
dispatch({
type: 'DataObj/importExecute',
payload: {
...(importParams || {}),
cacheKey: this.state.filekey,
const { importParams } = this.props;
importExecute({
...(importParams || {}),
cacheKey: this.state.filekey,
objId: this.props.objId,
},
callback: (res) => {
this.next();
message.success('导入成功');
objId: this.props.objId,
}).then(() => {
this.next();
message.success('导入成功');
this.setState({
current: 3,
isShow: true,
visible: false,
});
if (this.props.callback) {
this.props.callback();
}
},
this.setState({
current: 3,
isShow: true,
visible: false,
});
if (this.props.callback) {
this.props.callback();
}
});
}
getCachKey = (filePath) => {
const { dispatch, importParams } = this.props;
dispatch({
type: 'DataObj/importAnalyse',
payload: {
...(importParams || {}),
isLocal: false,
filePath,
objId: this.props.objId,
},
callback: (res) => {
this.setState({
filekey: res.cacheKey,
});
this.queryFile(res.cacheKey);
},
const { importParams } = this.props;
getServicesNomal(importAnalyseApi, {
...(importParams || {}),
isLocal: false,
filePath,
objId: this.props.objId,
}).then(res => {
this.setState({
filekey: res.cacheKey,
});
this.queryFile(res.cacheKey);
});
};
queryFile = (cacheKey) => {
const { dispatch, importParams } = this.props;
dispatch({
type: 'DataObj/importDataQuery',
payload: {
...(importParams || {}),
cacheKey,
objId: this.props.objId,
},
callback: (res) => {
this.setState({
current: 1,
isShow: false,
const { importParams } = this.props;
getServicesNomal(importDataQueryApi, {
...(importParams || {}),
cacheKey,
objId: this.props.objId,
}).then(res => {
this.setState({
current: 1,
isShow: false,
sucData: res.pass,
errData: res.noPass,
column: res.column,
});
if (res.noPass && res.noPass.length == 0) {
if (res.pass.length == 0) {
message.error('当前没有验证成功的数据,无法导入。');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
} else {
message.success('所有数据验证通过,请确认后点击下一步。');
this.setState({
currentKey: '2',
ch: !this.state.ch,
isNextDisabled: false,
});
}
} else {
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
sucData: res.pass,
errData: res.noPass,
column: res.column,
});
if (res.noPass && res.noPass.length == 0) {
if (res.pass.length == 0) {
message.error('当前没有验证成功的数据,无法导入。');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
} else {
message.success('所有数据验证通过,请确认后点击下一步。');
this.setState({
currentKey: '2',
ch: !this.state.ch,
isNextDisabled: false,
});
}
},
} else {
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
}
});
};
changePane = (activeKey) => {
......
......@@ -22,6 +22,8 @@ import OrderItem from './OrderItem';
import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
import { getServicesNomal } from '../Services/services';
import { getExportInfoApi } from '../Services/apiConfig';
const Option = Select.Option;
var keyX = 1;
......@@ -97,14 +99,10 @@ export default class ExportInfo extends React.Component {
this.setState({ groups });
};
open = () => {
const { dispatch } = this.props;
dispatch({
type: 'DataObj/getExportInfo',
payload: {
objId: this.props.objId,
},
callback: (infos) => {
const mockData = [];
getServicesNomal(getExportInfoApi, {
objId: this.props.objId,
}).then(infos => {
const mockData = [];
const qs = [];
const gs = [];
const os = [];
......@@ -134,7 +132,6 @@ export default class ExportInfo extends React.Component {
gs,
os,
});
},
});
};
onCancle = () => {
......
......@@ -14,6 +14,8 @@ import {
getSassApiHeader,
getSysCode
} from '@/webPublic/one_stop_public/2023yunshangguizhou/utils';
import { getServicesNomal, importExecute } from '../Services/services';
import { importDataQueryApi, importAnalyseApi } from '../Services/apiConfig';
const Modal = getModal();
const message = getMessage();
......@@ -126,107 +128,91 @@ export default class ImportUtil extends React.PureComponent {
import() {
const {
dispatch,
importParams,
} = this.props;
dispatch({
type: 'DataObj/importExecute',
payload: {
...(importParams || {}),
cacheKey: this.state.fileCacheKey,
objId: this.props.objId,
},
callback: (res) => {
if (res && res.sync === false && res.total) {
// 23013 学生事务/学生医保管理/学生平安险/保险办理,2001010248 高职界面已购买 导入 报错【接口超时】
this.setState({
openProgress: res,
});
return;
}
this.next();
importExecute({
...(importParams || {}),
cacheKey: this.state.fileCacheKey,
objId: this.props.objId,
}).then(res => {
if (res && res.sync === false && res.total) {
// 23013 学生事务/学生医保管理/学生平安险/保险办理,2001010248 高职界面已购买 导入 报错【接口超时】
this.setState({
openProgress: res,
});
return;
}
this.next();
message.success('导入成功', 1);
this.setState({
current: 3,
isShow: true,
visible: false,
});
},
});
}
getCachKey = (filePath) => {
const {
dispatch,
importParams,
importConfig,
} = this.props;
dispatch({
type: 'DataObj/importAnalyse',
payload: {
...(importParams || {}),
isLocal: false,
filePath,
getServicesNomal(importAnalyseApi, {
...(importParams || {}),
isLocal: false,
filePath,
importConfig: importConfig ? JSON.stringify(importConfig) : null,
objId: this.props.objId,
},
callback: (res) => {
this.setState({
fileCacheKey: res.cacheKey,
});
this.queryFile(res.cacheKey);
},
importConfig: importConfig ? JSON.stringify(importConfig) : null,
objId: this.props.objId,
}).then(res => {
this.setState({
fileCacheKey: res.cacheKey,
});
this.queryFile(res.cacheKey);
});
};
queryFile = (cacheKey) => {
const {
dispatch,
importParams,
} = this.props;
dispatch({
type: 'DataObj/importDataQuery',
payload: {
...(importParams || {}),
cacheKey,
objId: this.props.objId,
},
callback: (res) => {
this.setState({
current: 1,
isShow: false,
getServicesNomal(importDataQueryApi, {
...(importParams || {}),
cacheKey,
objId: this.props.objId,
}).then(res => {
this.setState({
current: 1,
isShow: false,
sucData: res.pass,
errData: res.noPass,
column: res.column,
});
if (res.noPass && res.noPass.length === 0) {
if (res.pass.length === 0) {
message.error('当前没有验证成功的数据,无法导入。');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
} else {
message.success('所有数据验证通过,请确认后点击下一步。');
this.setState({
currentKey: '2',
ch: !this.state.ch,
isNextDisabled: false,
});
}
} else {
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
sucData: res.pass,
errData: res.noPass,
column: res.column,
});
if (res.noPass && res.noPass.length === 0) {
if (res.pass.length === 0) {
message.error('当前没有验证成功的数据,无法导入。');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
} else {
message.success('所有数据验证通过,请确认后点击下一步。');
this.setState({
currentKey: '2',
ch: !this.state.ch,
isNextDisabled: false,
});
}
},
} else {
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
this.setState({
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true,
});
}
});
};
......
......@@ -2,11 +2,12 @@ import React, { useEffect, useState, useRef, useMemo } from 'react';
import { Progress, message } from 'antd';
import styles from './ImportUtil.less';
import { connect } from 'dva';
import { getServicesNomal } from '../Services/services';
import { importProcessApi } from '../Services/apiConfig';
function ProgressDiy(props) {
const {
fileCacheKey,
dispatch,
changeOpenProgress = () => {
},
} = props;
......@@ -14,20 +15,15 @@ function ProgressDiy(props) {
const [speedData, setData] = useState({ ...props });
useEffect(() => {
interv.current = setInterval(() => {
dispatch({
type: 'DataObj/importProcess',
payload: {
cacheKey: fileCacheKey,
},
callback: res => {
console.log(res);
setData(res);
getServicesNomal(importProcessApi, {
cacheKey: fileCacheKey,
}).then(res => {
setData(res);
if (res.finished) {
clearInterval(interv.current);
// message.success('导入完成');
changeOpenProgress(false); // 导入成功
}
},
});
}, 1000);
}, []);
......
......@@ -23,6 +23,7 @@ import OrderItem from './OrderItem';
import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
import { getServicesNomal } from '../Services/services';
const Option = Select.Option;
var keyX = 1;
......@@ -98,45 +99,40 @@ export default class SearchInfo extends React.Component {
this.setState({ groups });
};
open = () => {
const { dispatch } = this.props;
dispatch({
type: 'DataObj/getExportInfo',
payload: {
objId: this.props.objId,
},
callback: (infos) => {
const mockData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
});
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
getServicesNomal(getExportInfoApi, {
objId: this.props.objId,
}).then(infos => {
const mockData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
});
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
}
this.setState({
mockData,
infos,
visiable: true,
qs,
gs,
os,
});
},
});
this.setState({
mockData,
infos,
visiable: true,
qs,
gs,
os,
});
})
};
onCancle = () => {
this.setState({ visiable: false });
......
......@@ -9,6 +9,8 @@ import FormdataWrapper from '../../utils/object-to-formdata-custom';
import ButtonDiy from '../ButtonDiy/ButtonDiy';
import { nameSpan, nameSpan3, nameSpan2 } from './config';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
import { getServicesNomal } from '../../Services/services';
import { getExportInfoApi, getStatisticsApi } from '../../Services/apiConfig';
const Option = Select.Option;
const FormItem = Form.Item;
......@@ -79,37 +81,25 @@ export default class StatisticsInfo extends React.Component {
);
};
open = () => {
const { dispatch } = this.props;
dispatch({
type: 'DataObj/getExportInfo',
payload: {
objId: this.props.objId,
},
callback: (infos) => {
const filterXZKeys = this.props.filterXZKeys;
const mockData = [];
const mockXZData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
hql: x.hql,
});
if (filterXZKeys != null) {
if (filterXZKeys.includes(key)) {
mockXZData.push({
key: x.field,
title: x.name,
chosen: false,
hql: x.hql,
});
}
} else {
getServicesNomal(getExportInfoApi, {
objId: THIS.props.objId,
}).then(infos => {
const filterXZKeys = this.props.filterXZKeys;
const mockData = [];
const mockXZData = [];
const qs = [];
const gs = [];
const os = [];
for (var key in infos) {
const x = infos[key];
mockData.push({
key: x.field,
title: x.name,
chosen: false,
hql: x.hql,
});
if (filterXZKeys != null) {
if (filterXZKeys.includes(key)) {
mockXZData.push({
key: x.field,
title: x.name,
......@@ -117,27 +107,33 @@ export default class StatisticsInfo extends React.Component {
hql: x.hql,
});
}
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
} else {
mockXZData.push({
key: x.field,
title: x.name,
chosen: false,
hql: x.hql,
});
}
this.setState({
mockData,
mockXZData,
infos,
visiable: true,
qs,
gs,
os,
});
},
if (x.canQuery) {
qs.push(x);
}
if (x.canGroup) {
gs.push(x);
}
if (x.canOrder) {
os.push(x);
}
}
this.setState({
mockData,
mockXZData,
infos,
visiable: true,
qs,
gs,
os,
});
});
};
onCancle = () => {
......@@ -184,7 +180,7 @@ export default class StatisticsInfo extends React.Component {
this.setState({ querys, queryVisiable: false, currentQueryKey: null });
};
finish = () => {
const { dispatch, objId } = this.props;
const { objId } = this.props;
const { x, y, z, infos, XxX, currentKey, groups } = this.state;
if (x == null) {
......@@ -254,21 +250,17 @@ export default class StatisticsInfo extends React.Component {
ttz = infos[z].hql;
}
}
dispatch({
type: 'DataObj/getStatistics',
payload: {
x: ttx,
y: tty,
z: ttz,
objId,
xXx: XxX,
hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null,
querys: JSON.stringify(qqs),
groups: JSON.stringify(ggs),
},
callback: (data) => {
this.setState({ dataSource: data.dataSource, columns: data.columns });
},
getServicesNomal(getStatisticsApi, {
x: ttx,
y: tty,
z: ttz,
objId,
xXx: XxX,
hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null,
querys: JSON.stringify(qqs),
groups: JSON.stringify(ggs),
}).then(data => {
this.setState({ dataSource: data.dataSource, columns: data.columns });
});
});
};
......@@ -316,7 +308,7 @@ export default class StatisticsInfo extends React.Component {
}
export = () => {
const { dispatch, objId } = this.props;
const { objId } = this.props;
const { x, y, z, infos, XxX, currentKey, groups } = this.state;
if (x == null) {
......
......@@ -49,6 +49,8 @@ import {
} from '@/webPublic/one_stop_public/utils/queryConfig';
import { getIsGui_Jian, isJSON } from '@/webPublic/zyd_public/utils/utils';
import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList';
import { getServicesNomal, getUaaServicesNomal } from '../Services/services';
import { getAllApi, getDetailsApi, queryUserSetApi } from '../Services/apiConfig';
@connect()
class DetailSplit extends Component {
......@@ -176,7 +178,7 @@ class DetailSplit extends Component {
* @function 默认请求
*/
getInit = (handleUser) => {
const { dispatch, formPrepareData } = this.props;
const { formPrepareData } = this.props;
const id = this.props.history.location.state && this.props.history.location.state.id;
const code = this.props.history.location.state && this.props.history.location.state.code;
const queryId = this.props.history.location.query && this.props.history.location.query.id;
......@@ -232,21 +234,17 @@ class DetailSplit extends Component {
},
() => {
if (val.isSecond) {
this.props.dispatch({
type: 'urge/GetMyBtn',
payload: {},
callback: (arr) => {
this.setState(
{
btnList: arr,
radiovalue: val.formLevelId ? val.formLevelId : arr[arr.length - 1].id,
},
() => {
// this.giveMessageTop();
},
);
},
});
getUaaServicesNomal(getAllApi, {}).then(arr => {
this.setState(
{
btnList: arr,
radiovalue: val.formLevelId ? val.formLevelId : arr[arr.length - 1].id,
},
() => {
// this.giveMessageTop();
},
);
})
} else {
// this.giveMessageTop();
}
......@@ -255,41 +253,32 @@ class DetailSplit extends Component {
});
}
}
dispatch({
type: 'emailorphone/GetLogo',
payload: {
configKeys: ['isCloseUserDetail', 'isCloseFlowPath', 'isAllPrint', 'closeAutoSign'],
},
callback: (val) => {
const closeAutoSign = !!(val[3] && val[3].configValue === 'true');
this.setState({
isCloseUserDetail: !!(val[0] && val[0].configValue === 'true'),
isAllPrint: !!(val[2] && val[2].configValue === 'true'),
closeAutoSign,
});
if (!closeAutoSign) {
/**
* 获取设置的数据
*/
this.props.dispatch({
type: 'UserSetCenterApi/queryUserSet',
payload: {},
callback: (val) => {
this.setState({
setData: val,
});
},
getUaaServicesNomal(getDetailsApi, {
configKeys: ['isCloseUserDetail', 'isCloseFlowPath', 'isAllPrint', 'closeAutoSign'],
}).then(val => {
const closeAutoSign = !!(val[3] && val[3].configValue === 'true');
this.setState({
isCloseUserDetail: !!(val[0] && val[0].configValue === 'true'),
isAllPrint: !!(val[2] && val[2].configValue === 'true'),
closeAutoSign,
});
if (!closeAutoSign) {
/**
* 获取设置的数据
*/
getServicesNomal(queryUserSetApi, {}).then(val => {
this.setState({
setData: val,
});
}
});
}
if (val[1]?.configValue) {
sessionStorage.setItem(
'isCloseFlowPath',
val[1]?.configValue === 'true' ? JSON.stringify(true) : JSON.stringify(false),
);
}
},
if (val[1]?.configValue) {
sessionStorage.setItem(
'isCloseFlowPath',
val[1]?.configValue === 'true' ? JSON.stringify(true) : JSON.stringify(false),
);
}
});
if (getToken()) {
const user = localStorage.getItem('user');
......
......@@ -6,6 +6,8 @@ import { Modal, Input, Table, Row, Col, Tooltip, Spin, Tag } from 'antd';
import styles from './style.less';
import { openToast } from '../Notification';
import { connect } from 'dva';
import { getUaaServicesNomal } from '../../../Services/services';
import { addSignsApi } from '../../../Services/apiConfig';
const { Search } = Input;
......@@ -126,13 +128,6 @@ export default class Countersign extends Component {
});
};
getInit = async () => {
const {
dispatch,
data: {
addSignSql,
id,
},
} = this.props;
// 用户名列表
this.getData();
await this.setState({
......@@ -166,7 +161,6 @@ export default class Countersign extends Component {
};
userPaginationChange = value => {
const { dispatch } = this.props;
const {
realname,
username,
......@@ -183,7 +177,6 @@ export default class Countersign extends Component {
* @param { string } value 用户输入值
*/
searchNameChange = value => {
const { dispatch } = this.props;
this.getData({
realname: value,
pageNo: 1,
......@@ -206,7 +199,6 @@ export default class Countersign extends Component {
* @param { stirng } value 用户输入值
*/
serachStuNoChange = value => {
const { dispatch } = this.props;
this.setState({
username: value,
});
......@@ -234,7 +226,6 @@ export default class Countersign extends Component {
handleOk = e => {
const { selectUserData } = this.state;
const { dispatch } = this.props;
let ary = [];
selectUserData.map(item => {
ary.push(item.id);
......@@ -248,21 +239,32 @@ export default class Countersign extends Component {
btnLoading: true,
},
() => {
dispatch({
type: 'countersign/countersignHandle',
payload: {
taskId: this.props.taskId,
userIds: ary,
},
callback: () => {
openToast('success', '加签成功');
getUaaServicesNomal(addSignsApi, {
taskId: this.props.taskId,
userIds: ary,
}).then(() => {
openToast('success', '加签成功');
this.props.getInit();
this.setState({
visible: false,
btnLoading: false,
});
},
});
// dispatch({
// type: 'countersign/countersignHandle',
// payload: {
// taskId: this.props.taskId,
// userIds: ary,
// },
// callback: () => {
// openToast('success', '加签成功');
// this.props.getInit();
// this.setState({
// visible: false,
// btnLoading: false,
// });
// },
// });
},
);
};
......
......@@ -3,6 +3,8 @@ import Loading from '../loadThree';
import { Slider, Row, Col } from 'antd';
import { connect } from 'dva';
import classNames from 'classnames/bind';
import { getUaaServicesNomal } from '../../../Services/services';
import { getDetailsApi } from '../../../Services/apiConfig';
const names = classNames.bind(require('./style.less'));
......@@ -73,17 +75,13 @@ export default class PortalFlowExamineModalImage extends React.Component {
});
},
});
this.props.dispatch({
// 获取配置信息
type: 'emailorphone/GetLogo',
payload: {
configKeys: 'IsOldFlow',
},
callback: val => {
this.setState({
configValue: val[0].configValue == 'true',
});
},
// 获取配置信息
getUaaServicesNomal(getDetailsApi, {
configKeys: 'IsOldFlow',
}).then(val => {
this.setState({
configValue: val[0].configValue == 'true',
});
});
};
......
......@@ -15,6 +15,8 @@ import Recycle from './recycle';
import styles from './style.less';
import { confirm,openToast } from '../Notification';
import { connect } from 'dva';
import { getUaaServicesNomal } from '../../../Services/services';
import { refuseProcessApi, resetProcessApi, turnsProcessApi } from '../../../Services/apiConfig';
@connect()
export default class TurnToModel extends Component {
constructor(props){
......@@ -55,39 +57,31 @@ export default class TurnToModel extends Component {
if(status === '转办'){ // 发起转办提交处理
const { user } = this.state
if(user){
dispatch({
type:'trunTo/turnsProcess',
payload: {
taskIds:[value.taskId],
reason,
turnsUserCode: user.stuNo
},
callback: (val) => {
openToast('success', '成功','当前流程已成功移交')
this.props.init()
this.setState({
loading: false
})
}
getUaaServicesNomal(turnsProcessApi, {
taskIds:[value.taskId],
reason,
turnsUserCode: user.stuNo
}).then(() => {
openToast('success', '成功','当前流程已成功移交')
this.props.init()
this.setState({
loading: false
})
})
} else {
openToast('info','错误','请选择移交人员')
}
} else if(status === '回退') { // 发起回退提交处理
dispatch({
type: 'trunTo/refuseProcess',
payload: {
taskIds:[value.taskId],
reason
},
callback: (val) => {
openToast('success', '回退','当前流程已成功回退')
this.props.init()
this.setState({
loading: false
})
}
getUaaServicesNomal(refuseProcessApi, {
taskIds:[value.taskId],
reason
}).then(() => {
openToast('success', '回退','当前流程已成功回退')
this.props.init()
this.setState({
loading: false
})
});
} else {
console.log('缺乏匹配字段提交方法')
}
......@@ -96,16 +90,12 @@ export default class TurnToModel extends Component {
recallConfim = () => {
const { status,dispatch,value } = this.props
confirm('撤回','是否撤回当前转办流程',()=>{
dispatch({
type:'trunTo/resetProcess',
payload:{
taskIds:[value.taskId],
},
callback:(val) => {
openToast('success','成功','该转办流程已成功撤回')
this.props.init()
}
})
getUaaServicesNomal(resetProcessApi, {
taskIds:[value.taskId],
}).then(() => {
openToast('success','成功','该转办流程已成功撤回')
this.props.init()
});
this.props.handleCancel()
},()=>{
this.props.handleCancel()
......
......@@ -8,6 +8,8 @@ import React, { Component } from 'react'
import styles from '../style.less';
import { Row, Col,Input,Spin } from 'antd';
import { connect } from 'dva';
import { getUaaServicesNomal } from '../../../../Services/services';
import { getListApi } from '../../../../Services/services';
const { TextArea } = Input;
@connect()
export default class index extends Component {
......@@ -24,18 +26,14 @@ export default class index extends Component {
this.setState({
isLoading: true
})
await dispatch({
type: 'trunTo/detailProcess',
payload: {
taskId:value.taskId,
},
callback: (val) => {
this.setState({
data:Array.isArray(val)&&val?.length>0?val[val.length-1]:'',
isLoading: false,
})
}
})
await getUaaServicesNomal(getListApi, {
taskId:value.taskId,
}).then(val => {
this.setState({
data:Array.isArray(val)&&val?.length>0?val[val.length-1]:'',
isLoading: false,
})
});
}
/**
* 多行文本输入
......
......@@ -9,6 +9,8 @@ import React, { Component } from 'react';
import { Input, Table, Row, Col, Tooltip, Spin } from 'antd';
import styles from '../style.less';
import { connect } from 'dva';
import { getUaaServicesNomal } from '../../../../Services/services';
import { getListApi } from '../../../../Services/apiConfig';
const { Search } = Input;
const { TextArea } = Input;
@connect()
......@@ -91,16 +93,12 @@ export default class index extends Component {
});
},
});
await dispatch({
type: 'trunTo/detailProcess',
payload: {
taskId: value.taskId,
},
callback: val => {
this.setState({
userData: Array.isArray(val) && val?.length > 0 ? val[val.length - 1] : '',
});
},
await getUaaServicesNomal(getListApi, {
taskId: value.taskId,
}).then(val => {
this.setState({
userData: Array.isArray(val) && val?.length > 0 ? val[val.length - 1] : '',
});
});
await this.setState({
isLoading: false,
......
......@@ -11,6 +11,8 @@ import SVG from './components/SVG';
import { Spin, Timeline,Icon } from 'antd';
import { connect } from 'dva';
import moment from 'moment';
import { getUaaServicesNomal } from '../Services/services';
import { getListApi } from '../Services/apiConfig';
@connect()
export default class trunToDetail extends Component {
constructor(props){
......@@ -35,18 +37,12 @@ export default class trunToDetail extends Component {
isLoading: true,
})
// 发起请求获取数据
dispatch({
type: 'trunTo/detailProcess',
payload: {
taskId: item.id,
},
callback: (val) => {
this.setState({
isLoading: false,
trunToData: val
})
}
})
getUaaServicesNomal(getListApi, { taskId: item.id }).then(val => {
this.setState({
isLoading: false,
trunToData: val
});
});
} else { // 为关闭状态清空数据
this.setState({
trunToData: ''
......
......@@ -9,10 +9,10 @@ import React from 'react';
import classNames from 'classnames/bind';
import { connect } from 'dva';
import SponsorForm from './SponsorForm/index';
import { isJSON } from '@/webPublic/one_stop_public/copy';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import { setToken } from '@/webPublic/one_stop_public/utils/token';
import { Button } from 'antd';
import { getUaaServicesNomal } from '../Services/services';
import { getAllApi } from '../Services/apiConfig';
const names = classNames.bind(require('./style.less'));
......@@ -60,15 +60,11 @@ export default class IframeForApply extends React.Component {
}
componentDidMount() {
this.props.dispatch({
type: 'urge/GetMyBtn',
payload: {},
callback: val => {
this.setState({
btnList: val,
value: val[val.length - 1].id,
});
},
getUaaServicesNomal(getAllApi, {}).then(val => {
this.setState({
btnList: val,
value: val[val.length - 1].id,
});
});
// document.getElementById('root').style.backgroundColor = '#fff';
}
......
// 请求地址
const DataObjApi = '/DataObjApi';
const DataColumnApi = "/DataColumnApi";
const SqlManageEntityApi = '/SqlManageEntityApi';
const UnifiedAppFormApi = '/UnifiedAppFormApi';
// formList model层相关api
export const getFormDataPageApi = DataObjApi + '/getFormDataPage'
export const getHeaderListApi = DataColumnApi + '/getHeaderList';
export const getBatchOptionsApi = DataColumnApi + '/getBatchOptions';
export const getFormDataApi = DataObjApi + '/getFormData';
export const deleteFormDataApi = DataObjApi + '/deleteFormData';
export const getDetailByCodeApi = UnifiedAppFormApi + '/getDetailByCode';
export const getDetailApi = DataObjApi + '/getDetail';
export const addFormDataApi = DataObjApi + '/addFormData';
export const getGroupListApi = DataColumnApi + '/getGroupList';
export const getFormDataListApi = DataObjApi + '/getFormDataList';
// DataColumn model层相关api
export const getSqlDataApi = DataColumnApi + '/getSqlData';
export const getSqlOptionsApi = DataColumnApi + '/getSqlOptions';
export const getSqlLabelsApi = DataColumnApi + '/getSqlLabels';
export const getLabelsApi = DataColumnApi + '/getLabels';
export const getOptionsApi = DataColumnApi + '/getOptions';
// SqlManageEntity model层相关api
export const findApi = SqlManageEntityApi + '/find'
// DataObj model层相关api
export const getExportInfoApi = DataObjApi + '/getExportInfo'
export const importExecuteApi = DataObjApi + '/importExecute'
export const importAnalyseApi = DataObjApi + '/importAnalyse'
export const importDataQueryApi = DataObjApi + '/importDataQuery'
export const importProcessApi = DataObjApi + '/importProcess'
export const getStatisticsApi = DataObjApi + '/getStatistics'
export const findByCodeApi = DataObjApi + '/findByCode';
// countersign model层相关api
export const addSignsApi = UnifiedAppFormApi + "/addSigns"
// emailorphone model层相关api
export const getDetailsApi = '/ConfigApi/getDetails'
// UserSetCenterApi model层相关api
export const queryUserSetApi = '/UserSetCenterApi/queryUserSet'
// trunTo model层相关api
export const turnsProcessApi = '/ActCommentApi/turnsProcess'
export const refuseProcessApi = '/ActCommentApi/refuseProcess'
export const resetProcessApi = '/ActCommentApi/resetProcess'
export const getListApi = '/ActCommentApi/getList'
// urge model层相关api
export const getAllApi = '/UnifiedAppFormLevelApi/getAll'
\ No newline at end of file
import { apiRequest, uaaRequest } from '../utils/request';
import { importExecuteApi, getFormDataPageApi } from './apiConfig'
// apiRequest
export const getServicesNomal = (apiAddress, params) => {
return apiRequest(apiAddress, params);
};
// uaaRequest
export const getUaaServicesNomal = (apiAddress, params) => {
return uaaRequest(apiAddress, params);
};
export const getFormDataPage = (params) => {
return apiRequest(getFormDataPageApi, params).then((response) => {
if (response) {
return {
list: response.rows,
pagination: {
current: response.pageNo,
pageSize: response.pageSize,
total: response.total,
},
};
}
});
};
export const importExecute = (params) => {
return apiRequest(importExecuteApi, {
...params,
customErrMsg:
'导入的文件中可能存在字段不一致、字段类型不匹配、唯一性字段冲突,请检查或联系系统管理员',// 自定义errMsg
});
};
......@@ -33,6 +33,19 @@ import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
import { getServicesNomal } from '../../Services/services';
import {
getFormDataListApi,
getBatchOptionsApi,
getFormDataApi,
deleteFormDataApi,
getDetailByCodeApi,
findByCodeApi,
getDetailApi,
getHeaderListApi,
getGroupListApi,
addFormDataApi,
} from '../../Services/apiConfig';
const Popconfirm = getPopconfirm();
const Modal = getModal();
......@@ -197,58 +210,42 @@ class TreeList extends React.Component {
}
if (refIds.length > 0) {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options: { ...this.state.options, ...options } });
},
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options: { ...this.state.options, ...options } });
});
}
};
getList = (values, callback, isFirst) => {
const {
dispatch,
json: { treeParentIdName, ctgFilterSql },
} = this.props;
const { json: { treeParentIdName, ctgFilterSql } } = this.props;
if (!values) {
values = this.state.formValues;
}
dispatch({
type: 'formList/tree',
payload: {
...values,
ctgFilterSql: ctgFilterSql,
parentIdName: treeParentIdName,
dataObjId: this.state.objId,
},
callback: callback,
});
getServicesNomal(getFormDataListApi, {
...values,
ctgFilterSql: ctgFilterSql,
parentIdName: treeParentIdName,
dataObjId: this.state.objId,
}).then(res => {
callback()
})
};
modify = (record) => {
// if (this.state.formItem.length < 10) {
this.getOptions();
this.props.dispatch({
type: 'formList/getDetail',
payload: {
dataObjId: this.state.objId,
key: this.state.primaryKey,
value: record[this.state.primaryKey],
isBase: false,
},
callback: (record2) => {
this.setState({
formData: record2,
modalVisible: true,
isAdd: false,
isView: false,
});
},
getServicesNomal(getFormDataApi, {
dataObjId: this.state.objId,
key: this.state.primaryKey,
value: record[this.state.primaryKey],
isBase: false,
}).then(record2 => {
this.setState({
formData: record2,
modalVisible: true,
isAdd: false,
isView: false,
});
});
};
view = (record) => {
......@@ -284,34 +281,23 @@ class TreeList extends React.Component {
//找出主键
let Keys = {};
Keys[this.state.primaryKey] = record[this.state.primaryKey];
this.props.dispatch({
type: 'formList/delete',
payload: {
keys: JSON.stringify(Keys),
objId: this.state.objId,
},
callback: () => {
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
treeData,
});
getServicesNomal(deleteFormDataApi, {
keys: JSON.stringify(Keys),
objId: this.state.objId,
}).then(() => {
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
treeData,
});
},
});
});
};
viewProcess = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'formList/getAppId',
payload: {
code: record.process_biz_key,
},
callback: (data) => {
router.push({ pathname: '/portal/serviceCentre/getdetail', state: { id: data.id } });
},
getServicesNomal(getDetailByCodeApi, { code: record.process_biz_key }).then(data => {
router.push({ pathname: '/portal/serviceCentre/getdetail', state: { id: data.id } });
});
};
......@@ -335,77 +321,24 @@ class TreeList extends React.Component {
//渲染值
componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
window.addEventListener('resize', this.resize);
if (this.props.objCode) {
const { dispatch, objCode, sql } = this.props;
const { objCode } = this.props;
if (objCode == 1 || objCode == '1') {
this.initColumn();
} else {
dispatch({
type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode },
callback: (dataObj) => {
this.setState({ objId: dataObj.id, isTable: data.isTable }, () => {
/**
* 2022年10月27日
* 欢哥说这个权限功能没用了 在一站式后台元数据管理-数据授权里面修改 实际已经废弃了
* 问了姚新国也说没用了. 有问题就还原回来
* */
this.initColumn();
// dispatch({
// type: 'DataRight/getUserRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// if (!this.props.rights) {
// this.setState({ rights: data });
// }
// dispatch({
// type: 'DataRight/getUserColumnRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// this.setState({ columnRights: data });
// this.initColumn();
// },
// });
// },
// });
});
},
getServicesNomal(findByCodeApi, { objCode: this.props.objCode }).then(dataObj => {
this.setState({ objId: dataObj.id, isTable: data.isTable }, () => {
this.initColumn();
});
});
}
} else {
dispatch({
type: 'formList/getObjDetail',
payload: { id: this.state.objId },
callback: (data) => {
this.setState({ isTable: data.isTable });
},
getServicesNomal(getDetailApi, { id: this.state.objId }).then(data => {
this.setState({ isTable: data.isTable });
});
/**
* 2022年10月27日
* 欢哥说这个权限功能没用了 在一站式后台元数据管理-数据授权里面修改 实际已经废弃了
* 问了姚新国也说没用了. 有问题就还原回来
* */
this.initColumn();
// dispatch({
// type: 'DataRight/getUserRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// if (!this.props.rights) {
// this.setState({ rights: data });
// }
// dispatch({
// type: 'DataRight/getUserColumnRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// this.setState({ columnRights: data });
// this.initColumn();
// },
// });
// },
// });
this.initColumn();
}
}
......@@ -447,9 +380,7 @@ class TreeList extends React.Component {
}
initColumn = () => {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
const { rights, columnRights } = this.state;
const { columnRights } = this.state;
if (this.props.value && this.props.value.columns) {
this.columns = this.props.value.columns;
this.getPage();
......@@ -457,124 +388,112 @@ class TreeList extends React.Component {
}
if (this.props.objCode == 1 || this.props.objCode == '1') {
} else {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: this.state.objId },
callback: (datas) => {
const querys = [];
const refIds = [];
const groups = {};
if (datas) {
this.state.formItem = datas;
let i = 0;
for (let t in datas) {
if (datas[t].isPrimaryKey) this.state.primaryKey = datas[t].name;
if (datas[t].isHidden) {
continue;
}
let column = {};
column.title = datas[t].title;
column.dataIndex = datas[t].name;
column.width = datas[t].width;
if (i == 0) column.fixed = 'left';
if (columnRights.length > 0 && !columnRights.includes(datas[t].id)) {
continue;
}
if (data.includes(datas[t].type)) {
column.render = (val) => {
if (val == null) {
return val;
}
if (datas[t].dataFormatStrWeb != null) {
return moment(val).format(datas[t].dataFormatStrWeb);
} else {
return moment(val).format('YYYY-MM-DD HH:mm:ss');
}
};
} else if (datas[t].name.indexOf('process_status') > -1) {
column.render = (val) => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
} else if (datas[t].extendTypeId && datas[t].extendTypeId.indexOf('file') > -1) {
//特殊处理附件
column.render = (val) => {
if (this.isJSON(val)) {
val = JSON.parse(val);
let files = val.files;
let xx = (
<ul>
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li>
);
})}
</ul>
);
return xx;
} else {
return val;
}
};
} else {
column.render = (val) =>
val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}>
<span
style={{
width: column.width || 200,
display: 'block',
wordBreak: 'keep-all',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}>
{val}
</span>
</Tooltip>
) : (
val
getServicesNomal(getHeaderListApi, { dataObjId: this.state.objId }).then(datas => {
const querys = [];
const refIds = [];
const groups = {};
if (datas) {
this.state.formItem = datas;
let i = 0;
for (let t in datas) {
if (datas[t].isPrimaryKey) this.state.primaryKey = datas[t].name;
if (datas[t].isHidden) {
continue;
}
let column = {};
column.title = datas[t].title;
column.dataIndex = datas[t].name;
column.width = datas[t].width;
if (i == 0) column.fixed = 'left';
if (columnRights.length > 0 && !columnRights.includes(datas[t].id)) {
continue;
}
if (data.includes(datas[t].type)) {
column.render = (val) => {
if (val == null) {
return val;
}
if (datas[t].dataFormatStrWeb != null) {
return moment(val).format(datas[t].dataFormatStrWeb);
} else {
return moment(val).format('YYYY-MM-DD HH:mm:ss');
}
};
} else if (datas[t].name.indexOf('process_status') > -1) {
column.render = (val) => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
} else if (datas[t].extendTypeId && datas[t].extendTypeId.indexOf('file') > -1) {
//特殊处理附件
column.render = (val) => {
if (this.isJSON(val)) {
val = JSON.parse(val);
let files = val.files;
let xx = (
<ul>
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li>
);
})}
</ul>
);
}
return xx;
} else {
return val;
}
};
} else {
column.render = (val) =>
val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}>
<span
style={{
width: column.width || 200,
display: 'block',
wordBreak: 'keep-all',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}>
{val}
</span>
</Tooltip>
) : (
val
);
}
this.setState({ tableWidth: (datas.length - 1) * 200 });
this.columns.push(column);
this.setState({ tableWidth: (datas.length - 1) * 200 });
this.columns.push(column);
if (datas[t].isShowQuery) {
querys.push(datas[t]);
if (datas[t].referenceObjId != null) {
refIds.push(datas[t].id);
}
if (datas[t].isGroupQuery != null) {
dispatch({
type: 'formList/getGroupList',
payload: { columnId: datas[t].id },
callback: (gourp) => {
groups[datas[t].id] = gourp;
this.setState({ groups });
},
});
}
if (datas[t].isShowQuery) {
querys.push(datas[t]);
if (datas[t].referenceObjId != null) {
refIds.push(datas[t].id);
}
i++;
}
if (querys.length > 0) {
this.setState({ querys });
if (refIds.length > 0) {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options });
},
if (datas[t].isGroupQuery != null) {
getServicesNomal(getGroupListApi, { columnId: datas[t].id }).then(gourp => {
groups[datas[t].id] = gourp;
this.setState({ groups });
});
}
}
this.getPage();
i++;
}
},
if (querys.length > 0) {
this.setState({ querys });
if (refIds.length > 0) {
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options });
})
}
}
this.getPage();
}
});
}
};
......@@ -584,7 +503,6 @@ class TreeList extends React.Component {
return;
}
const {
dispatch,
json: { treeParentIdName },
} = this.props;
const pagination = this.state.data.pagination;
......@@ -616,31 +534,27 @@ class TreeList extends React.Component {
});
}
} else {
dispatch({
type: 'formList/tree',
payload: {
custom: this.custom,
...params,
parentIdName: treeParentIdName,
sql: this.sqlBs16,
dataObjId: this.state.objId,
},
callback: (list) => {
const data = {
list: list,
pagination: false,
};
if (!this.state.isReady) {
this.setState({ data, parentId: params.parentId, isReady: true }, () => {
if (callback) callback(list);
});
} else {
this.setState({ data, parentId: params.parentId }, () => {
if (callback) callback(list);
});
}
},
getServicesNomal(getFormDataListApi, {
custom: this.custom,
...params,
parentIdName: treeParentIdName,
sql: this.sqlBs16,
dataObjId: this.state.objId,
}).then((list) => {
const data = {
list: list,
pagination: false,
};
if (!this.state.isReady) {
this.setState({ data, parentId: params.parentId, isReady: true }, () => {
if (callback) callback(list);
});
} else {
this.setState({ data, parentId: params.parentId }, () => {
if (callback) callback(list);
});
}
});
}
};
......@@ -672,26 +586,21 @@ class TreeList extends React.Component {
...fields,
};
params[treeParentIdName] = this.state.parentId;
this.props.dispatch({
type: 'formList/add',
payload: {
params: params,
objId: this.state.objId,
isAdd: isAdd,
isSelf: true,
isView: false,
},
callback: () => {
message.success('操作成功');
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
treeData,
});
getServicesNomal(addFormDataApi, {
params: params,
objId: this.state.objId,
isAdd: isAdd,
isSelf: true,
isView: false,
}).then(() => {
message.success('操作成功');
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
treeData,
});
},
});
});
};
......@@ -723,7 +632,6 @@ class TreeList extends React.Component {
};
batchDelete = (e) => {
const { dispatch } = this.props;
const { selectedRows } = this.state;
if (!selectedRows) return;
......@@ -737,19 +645,15 @@ class TreeList extends React.Component {
Keys[columns[i].name] = selectedRows.map((row) => row[columns[i].name]).join(',');
}
}
this.props.dispatch({
type: 'formList/delete',
payload: {
keys: JSON.stringify(Keys),
objId: this.state.objId,
isSelf: true,
},
callback: () => {
this.setState({
selectedRows: [],
});
this.getPage();
},
getServicesNomal(deleteFormDataApi, {
keys: JSON.stringify(Keys),
objId: this.state.objId,
isSelf: true,
}).then(() => {
this.setState({
selectedRows: [],
});
this.getPage();
});
};
......@@ -759,7 +663,7 @@ class TreeList extends React.Component {
handleSearch = (e) => {
e.preventDefault();
const { dispatch, form } = this.props;
const { form } = this.props;
const { formValues } = this.state;
......@@ -806,7 +710,7 @@ class TreeList extends React.Component {
this.getPage(params);
};
handleFormReset = () => {
const { form, dispatch } = this.props;
const { form } = this.props;
form.resetFields();
this.setState(
{
......
import React, { Fragment } from 'react';
import { Button, Card, Col, DatePicker, Form, Input, InputNumber, message, Row } from 'antd';
import React from 'react';
import { Col, Form, message, Row } from 'antd';
import { connect } from 'dva';
import PageHeaderWrapper from './PageHeaderWrapper';
import router from 'umi/router';
......@@ -7,6 +7,13 @@ import { getFormArrayConfig } from './config/index';
import FormArray from '../../App/ButtonDiy/FormArray';
import ButtonDiy from '../../App/ButtonDiy/ButtonDiy';
import Shell from './Shell';
import { getServicesNomal } from '../../Services/services';
import {
getBatchOptionsApi,
getFormDataApi,
getHeaderListApi,
addFormDataApi,
} from '../../Services/apiConfig';
@connect(({ formEdit, formList, loading }) => ({
formEdit,
......@@ -29,50 +36,37 @@ class FormEdit extends React.Component {
//渲染值
componentDidMount() {
const { dispatch } = this.props;
const { objId, recordKey, recordId } = this.state;
dispatch({
type: 'formList/getHead',
payload: { dataObjId: objId },
callback: (dates) => {
if (dates) {
this.state.formItem = dates;
const refIds = [];
for (let t in dates) {
if (
dates[t].referenceObjId != null &&
this.state.options[this.state.formItem[t].id + ''] == null
) {
refIds.push(dates[t].id);
}
getServicesNomal(getHeaderListApi, { dataObjId: objId }).then(dates => {
if (dates) {
this.state.formItem = dates;
const refIds = [];
for (let t in dates) {
if (
dates[t].referenceObjId != null &&
this.state.options[this.state.formItem[t].id + ''] == null
) {
refIds.push(dates[t].id);
}
}
if (refIds.length > 0) {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options });
},
});
}
if (refIds.length > 0) {
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options });
});
}
},
}
});
//渲染表单字段
if (recordId != null) {
dispatch({
type: 'formList/getDetail',
payload: {
dataObjId: objId,
key: recordKey,
value: recordId,
},
callback: (date) => {
if (date) {
this.state.formData = date;
}
},
getServicesNomal(getFormDataApi, {
dataObjId: objId,
key: recordKey,
value: recordId,
}).then(date => {
if (date) {
this.state.formData = date;
}
});
}
}
......@@ -85,13 +79,9 @@ class FormEdit extends React.Component {
isAdd,
isSelf: true,
};
this.props.dispatch({
type: 'formList/add',
payload,
callback: () => {
message.success('操作成功');
router.goBack();
},
getServicesNomal(addFormDataApi, payload).then(() => {
message.success('操作成功');
router.goBack();
});
};
......
......@@ -36,6 +36,18 @@ import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils
import { text, number, date } from '@/webPublic/one_stop_public/libs/formList/config';
import { FormListButtons } from '@/webPublic/one_stop_public/libs/formList/FormListButtons';
import countWidth from '@/webPublic/one_stop_public/libs/formList/countWidth';
import { getFormDataPage, getServicesNomal } from '../../Services/services';
import {
getHeaderListApi,
getBatchOptionsApi,
getFormDataApi,
deleteFormDataApi,
getDetailByCodeApi,
findByCodeApi,
getDetailApi,
addFormDataApi,
getGroupListApi
} from '../../Services/apiConfig';
const FormItem = Form.Item;
const Popconfirm = getPopconfirm();
......@@ -119,19 +131,19 @@ const CreateForm = Form.create()((props) => {
);
});
@connect(({
formList,
DataColumn,
DataObj
}) => ({
formList,
DataColumn,
DataObj,
// loading: loading.models.formList || loading.models.DataColumn || loading.models.DataObj,
// loading: loading.models.formList,
// 解决 禅道 28100 查询下拉选择后界面会刷新一次
// https://blog.csdn.net/m0_37148591/article/details/103685339 dva-loading
}))
// @connect(({
// formList,
// DataColumn,
// DataObj
// }) => ({
// formList,
// DataColumn,
// DataObj,
// // loading: loading.models.formList || loading.models.DataColumn || loading.models.DataObj,
// // loading: loading.models.formList,
// // 解决 禅道 28100 查询下拉选择后界面会刷新一次
// // https://blog.csdn.net/m0_37148591/article/details/103685339 dva-loading
// }))
@Form.create()
class FormList extends React.Component {
state = {
......@@ -177,34 +189,26 @@ class FormList extends React.Component {
}
if (refIds.length > 0) {
this.props.dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options: { ...this.state.options, ...options } });
},
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options: { ...this.state.options, ...options } });
});
}
};
modify = (record) => {
// if (this.state.formItem.length < 10) {
this.getOptions();
this.props.dispatch({
type: 'formList/getDetail',
payload: {
dataObjId: this.state.objId,
key: this.state.primaryKey,
value: record[this.state.primaryKey],
isBase: false,
},
callback: (record2) => {
this.setState({
formData: record2,
modalVisible: true,
isAdd: false,
isView: false,
});
},
getServicesNomal(getFormDataApi, {
dataObjId: this.state.objId,
key: this.state.primaryKey,
value: record[this.state.primaryKey],
isBase: false,
}).then(record2 => {
this.setState({
formData: record2,
modalVisible: true,
isAdd: false,
isView: false,
});
});
};
......@@ -239,33 +243,22 @@ class FormList extends React.Component {
//找出主键
let Keys = {};
Keys[this.state.primaryKey] = record[this.state.primaryKey];
this.props.dispatch({
type: 'formList/delete',
payload: {
keys: JSON.stringify(Keys),
objId: this.state.objId,
},
callback: () => {
getServicesNomal(deleteFormDataApi, {
keys: JSON.stringify(Keys),
objId: this.state.objId,
}).then(res => {
this.getPage();
},
});
};
viewProcess = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'formList/getAppId',
payload: {
code: record.process_biz_key,
},
callback: (data) => {
const domainName = sessionStorage.getItem('domainName')
? sessionStorage.getItem('domainName')
: '';
getServicesNomal(getDetailByCodeApi, { code: record.process_biz_key }).then(data => {
const domainName = sessionStorage.getItem('domainName')
? sessionStorage.getItem('domainName')
: '';
window.open(domainName + '/portal/serviceCentre/getdetail?id=' + data.id, '_blank');
//router.push({ pathname: '/portal/serviceCentre/getdetail', state: { id: data.id } });
},
window.open(domainName + '/portal/serviceCentre/getdetail?id=' + data.id, '_blank');
//router.push({ pathname: '/portal/serviceCentre/getdetail', state: { id: data.id } });
});
};
......@@ -289,12 +282,10 @@ class FormList extends React.Component {
//渲染值
componentDidMount() {
const { dispatch } = this.props;
window.addEventListener('resize', this.resize);
if (this.props.objCode) {
const {
dispatch,
objCode,
sql
} = this.props;
......@@ -302,52 +293,21 @@ class FormList extends React.Component {
if (Number(objCode) === 1) {
this.initColumn();
} else {
// console.log('componentDidMount-296');
dispatch({
type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode },
callback: (dataObj) => {
this.setState(
{
objId: dataObj.id,
isTable: dataObj.isTable,
},
() => {
this.initColumn();
/**
* 2022年10月27日
* 欢哥说这个权限功能没用了 在一站式后台元数据管理-数据授权里面修改 实际已经废弃了
* 问了姚新国也说没用了. 有问题就还原回来
* */
// dispatch({
// type: 'DataRight/getUserRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// if (!this.props.rights) {
// this.setState({ rights: data });
// }
// dispatch({
// type: 'DataRight/getUserColumnRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// this.setState({ columnRights: data });
// this.initColumn();
// },
// });
// },
// });
},
);
},
// DataObj models层中的数据
getServicesNomal(findByCodeApi, { objCode: this.props.objCode }).then(dataObj => {
this.setState(
{
objId: dataObj.id,
isTable: dataObj.isTable,
},
() => {
this.initColumn();
})
});
}
} else {
dispatch({
type: 'formList/getObjDetail',
payload: { id: this.state.objId },
callback: (data) => {
this.setState({ isTable: data.isTable });
},
getServicesNomal(getDetailApi, { id: this.state.objId }).then(data => {
this.setState({ isTable: data.isTable });
});
/**
* 2022年10月27日
......@@ -355,23 +315,6 @@ class FormList extends React.Component {
* 问了姚新国也说没用了
* */
this.initColumn();
// dispatch({
// type: 'DataRight/getUserRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// if (!this.props.rights) {
// this.setState({ rights: data });
// }
// dispatch({
// type: 'DataRight/getUserColumnRight',
// payload: { objId: this.state.objId },
// callback: (data) => {
// this.setState({ columnRights: data });
// this.initColumn();
// },
// });
// },
// });
}
}
......@@ -424,7 +367,6 @@ class FormList extends React.Component {
initColumn = () => {
const {
dispatch,
value,
objCode
} = this.props;
......@@ -462,11 +404,8 @@ class FormList extends React.Component {
this.getPage();
return undefined;
}
dispatch({
type: 'formList/getHead',
payload: { dataObjId: this.state.objId },
callback: (datas) => {
this.state.formItem = datas;
getServicesNomal(getHeaderListApi, { dataObjId: this.state.objId }).then(datas => {
this.state.formItem = datas;
const querys = [];
const groups = {};
const refIds = [];
......@@ -478,13 +417,9 @@ class FormList extends React.Component {
refIds.push(datas[t].id);
}
if (datas[t].isGroupQuery != null) {
dispatch({
type: 'formList/getGroupList',
payload: { columnId: datas[t].id },
callback: (gourp) => {
groups[datas[t].id] = gourp;
this.setState({ groups });
},
getServicesNomal(getGroupListApi, { columnId: datas[t].id }).then(gourp => {
groups[datas[t].id] = gourp;
this.setState({ groups });
});
}
}
......@@ -492,17 +427,12 @@ class FormList extends React.Component {
if (querys.length > 0) {
this.setState({ querys });
if (refIds.length > 0) {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options });
},
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options });
});
}
}
this.getPage();
},
});
}
return;
......@@ -517,143 +447,131 @@ class FormList extends React.Component {
this.getPage();
return undefined;
}
dispatch({
type: 'formList/getHead',
payload: { dataObjId: this.state.objId },
callback: (datas) => {
const querys = [];
const refIds = [];
const groups = {};
if (datas) {
this.state.formItem = datas;
let i = 0;
let cacheList = [];
let cacheChecked = [];
// 表头筛选逻辑
datas.map((item) => {
if (item.name != null) {
cacheList.push({
label: item.title,
value: item.name,
});
cacheChecked.push(item.name);
}
});
this.checkList = cacheList;
this.setState({
checkedList: cacheChecked,
});
for (let t in datas) {
if (datas[t].isPrimaryKey) this.state.primaryKey = datas[t].name;
if (datas[t].isHidden) {
continue;
}
let column = {};
column.title = datas[t].title;
column.dataIndex = datas[t].name;
column.width = datas[t].width;
if (i == 0) column.fixed = 'left';
if (columnRights.length > 0 && !columnRights.includes(datas[t].id)) {
continue;
}
if (date.includes(datas[t].type)) {
column.render = (val) => {
if (val == null) {
return val;
}
if (datas[t].dataFormatStrWeb != null) {
return moment(val)
.format(datas[t].dataFormatStrWeb);
} else {
return moment(val)
.format('YYYY-MM-DD HH:mm:ss');
}
};
} else if (datas[t].name.indexOf('process_status') > -1) {
column.render = (val) => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
} else if (datas[t].extendTypeId && datas[t].extendTypeId.indexOf('file') > -1) {
//特殊处理附件
column.render = (val) => {
if (this.isJSON(val)) {
val = JSON.parse(val);
let files = val.files;
let xx = (
<ul>
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryFileUrl(f.path)} pathName={f.name}/>
</li>
);
})}
</ul>
);
return xx;
} else {
return val;
}
};
} else {
column.render = (val) =>
val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}>
<span
style={{
width: column.width || 200,
display: 'block',
wordBreak: 'keep-all',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}>
{val}
</span>
</Tooltip>
) : (
val
);
}
this.setState({ tableWidth: (datas.length - 1) * 200 });
this.columns.push(column);
this.setState({
cacheColumns: cloneDeep(this.columns),
getServicesNomal(getHeaderListApi, { dataObjId: this.state.objId }).then(datas => {
const querys = [];
const refIds = [];
const groups = {};
if (datas) {
this.state.formItem = datas;
let i = 0;
let cacheList = [];
let cacheChecked = [];
// 表头筛选逻辑
datas.map((item) => {
if (item.name != null) {
cacheList.push({
label: item.title,
value: item.name,
});
if (datas[t].isShowQuery) {
querys.push(datas[t]);
if (datas[t].referenceObjId != null) {
refIds.push(datas[t].id);
cacheChecked.push(item.name);
}
});
this.checkList = cacheList;
this.setState({
checkedList: cacheChecked,
});
for (let t in datas) {
if (datas[t].isPrimaryKey) this.state.primaryKey = datas[t].name;
if (datas[t].isHidden) {
continue;
}
let column = {};
column.title = datas[t].title;
column.dataIndex = datas[t].name;
column.width = datas[t].width;
if (i == 0) column.fixed = 'left';
if (columnRights.length > 0 && !columnRights.includes(datas[t].id)) {
continue;
}
if (date.includes(datas[t].type)) {
column.render = (val) => {
if (val == null) {
return val;
}
if (datas[t].isGroupQuery != null) {
dispatch({
type: 'formList/getGroupList',
payload: { columnId: datas[t].id },
callback: (gourp) => {
groups[datas[t].id] = gourp;
this.setState({ groups });
},
});
if (datas[t].dataFormatStrWeb != null) {
return moment(val)
.format(datas[t].dataFormatStrWeb);
} else {
return moment(val)
.format('YYYY-MM-DD HH:mm:ss');
}
}
i++;
};
} else if (datas[t].name.indexOf('process_status') > -1) {
column.render = (val) => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
} else if (datas[t].extendTypeId && datas[t].extendTypeId.indexOf('file') > -1) {
//特殊处理附件
column.render = (val) => {
if (this.isJSON(val)) {
val = JSON.parse(val);
let files = val.files;
let xx = (
<ul>
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryFileUrl(f.path)} pathName={f.name}/>
</li>
);
})}
</ul>
);
return xx;
} else {
return val;
}
};
} else {
column.render = (val) =>
val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}>
<span
style={{
width: column.width || 200,
display: 'block',
wordBreak: 'keep-all',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}>
{val}
</span>
</Tooltip>
) : (
val
);
}
if (querys.length > 0) {
this.setState({ querys });
if (refIds.length > 0) {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: (options) => {
this.setState({ options });
},
this.setState({ tableWidth: (datas.length - 1) * 200 });
this.columns.push(column);
this.setState({
cacheColumns: cloneDeep(this.columns),
});
if (datas[t].isShowQuery) {
querys.push(datas[t]);
if (datas[t].referenceObjId != null) {
refIds.push(datas[t].id);
}
if (datas[t].isGroupQuery != null) {
getServicesNomal(getGroupListApi, { columnId: datas[t].id }).then(gourp => {
groups[datas[t].id] = gourp;
this.setState({ groups });
});
}
}
this.getPage();
i++;
}
},
if (querys.length > 0) {
this.setState({ querys });
if (refIds.length > 0) {
getServicesNomal(getBatchOptionsApi, { ids: refIds }).then(options => {
this.setState({ options });
})
}
}
this.getPage();
}
});
}
};
......@@ -664,7 +582,6 @@ class FormList extends React.Component {
if (!this.columns || !Array.isArray(this.columns) || this.columns.length === 0) {
return;
}
const { dispatch } = this.props;
const pagination = this.state.data.pagination;
if (params == null) {
......@@ -705,32 +622,27 @@ class FormList extends React.Component {
this.setState({
loading: true,
});
dispatch({
type: 'formList/fetch',
payload: {
custom: this.custom,
...params,
sql: this.sqlBs16,
dataObjId: this.state.objId,
},
callback: (data) => {
getFormDataPage({
custom: this.custom,
...params,
sql: this.sqlBs16,
dataObjId: this.state.objId,
}).then(data => {
this.setState({
loading: false,
});
if (!this.state.isReady) {
this.setState({
loading: false,
data,
isReady: true,
selectedRows: [], // 姚鑫国说的 调了分页接口以后需要 把这个选择的行数据 清空
});
if (!this.state.isReady) {
this.setState({
data,
isReady: true,
selectedRows: [], // 姚鑫国说的 调了分页接口以后需要 把这个选择的行数据 清空
});
} else {
this.setState({
data,
selectedRows: [], // 姚鑫国说的 调了分页接口以后需要 把这个选择的行数据 清空
});
}
},
} else {
this.setState({
data,
selectedRows: [], // 姚鑫国说的 调了分页接口以后需要 把这个选择的行数据 清空
});
}
});
}
};
......@@ -759,22 +671,18 @@ class FormList extends React.Component {
let params = {
...fields,
};
this.props.dispatch({
type: 'formList/add',
payload: {
params: params,
objId: this.state.objId,
isAdd: isAdd,
isSelf: true,
isView: false,
},
callback: () => {
message.success('操作成功');
this.setState({
modalVisible: false,
});
this.getPage();
},
getServicesNomal(addFormDataApi, {
params: params,
objId: this.state.objId,
isAdd: isAdd,
isSelf: true,
isView: false,
}).then(() => {
message.success('操作成功');
this.setState({
modalVisible: false,
});
this.getPage();
});
};
......@@ -813,7 +721,6 @@ class FormList extends React.Component {
};
batchDelete = (e) => {
const { dispatch } = this.props;
const { selectedRows } = this.state;
if (!selectedRows) return;
......@@ -828,19 +735,15 @@ class FormList extends React.Component {
.join(',');
}
}
this.props.dispatch({
type: 'formList/delete',
payload: {
keys: JSON.stringify(Keys),
objId: this.state.objId,
// isSelf: true,
},
callback: () => {
this.setState({
selectedRows: [],
});
this.getPage();
},
getServicesNomal(deleteFormDataApi, {
keys: JSON.stringify(Keys),
objId: this.state.objId,
// isSelf: true,
}).then(res => {
this.setState({
selectedRows: [],
});
this.getPage();
});
};
......@@ -851,7 +754,6 @@ class FormList extends React.Component {
e.preventDefault();
const {
dispatch,
form
} = this.props;
......@@ -894,7 +796,7 @@ class FormList extends React.Component {
};
hanldeHighSearch = (e) => {
const pagination = this.props.formList.data.pagination;
const pagination = this.state.data.pagination;
let params = {
pageNo: pagination.current ? pagination.current : 1,
pageSize: pagination.pageSize ? pagination.pageSize : this.props.pageSize || 10,
......@@ -904,10 +806,7 @@ class FormList extends React.Component {
this.getPage(params);
};
handleFormReset = () => {
const {
form,
dispatch
} = this.props;
const { form } = this.props;
form.resetFields();
this.setState(
{
......
......@@ -84,7 +84,16 @@ import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Inde
import getPopupContainer from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer';
import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy';
import EchartsDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/EchartsDiy';
import { getServicesNomal } from '../Services/services';
import {
getHeaderListApi,
getSqlDataApi,
findApi,
getSqlOptionsApi,
getSqlLabelsApi,
getLabelsApi,
getOptionsApi,
} from '../Services/apiConfig';
/**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
*/
......@@ -447,123 +456,106 @@ export default class TableCom extends Component {
preHandle(allValues);
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props;
const { sqlKey, optionType } = json;
if (optionType === 'sql') {
dispatch({
type: 'SqlManageEntity/find',
payload: { sqlKey },
callback: sqlModel => {
this.setState({ sqlModel });
if (sqlModel.dataObjId) {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: sqlModel.dataObjId },
callback: datas => {
if (datas) {
const columns = [];
for (var i = 0; i < datas.length; i++) {
if (i <= json.colNum ? json.colNum : 10) {
let column = {};
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (
['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
columns.push(column);
} else {
break;
}
}
this.setState({ columns });
}
},
});
} else {
const cols = sqlModel.cols;
if (cols != null || cols.length > 0) {
getServicesNomal(findApi, { sqlKey }).then(sqlModel => {
this.setState({ sqlModel });
if (sqlModel.dataObjId) {
getServicesNomal(getHeaderListApi, { dataObjId: sqlModel.dataObjId }).then(datas => {
if (datas) {
const columns = [];
const cll = JSON.parse(cols);
for (var k in cll) {
let column = {};
column.title = cll[k].title;
column.dataIndex = cll[k].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(cll[k].type)) {
var ff = 'YYYY-MM-DD HH:mm:ss';
switch (cll[k].type) {
case 'DATE':
ff = 'YYYY-MM-DD';
break;
case 'YEAR':
ff = 'YYYY';
break;
case 'TIME':
ff = 'HH:mm:ss';
break;
for (var i = 0; i < datas.length; i++) {
if (i <= json.colNum ? json.colNum : 10) {
let column = {};
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (
['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column.render = val => moment(parseInt(val)).format(ff);
}
if (cll[k].isQuery) {
column = {
...this.getColumnSearchProps(cll[k].name, cll[k].title),
...column,
};
}
column = giveRender(column);
column = giveRender(column);
columns.push(column);
columns.push(column);
} else {
break;
}
}
this.setState({ columns });
}
dispatch({
type: 'DataColumn/getSqlData',
payload: {
sqlKey,
allValues,
isCache: this.otherProps?.isCache || false,
},
callback: list => {
const x = {
list: list,
pagination: false,
});
} else {
const cols = sqlModel.cols;
if (cols != null || cols.length > 0) {
const columns = [];
const cll = JSON.parse(cols);
for (var k in cll) {
let column = {};
column.title = cll[k].title;
column.dataIndex = cll[k].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(cll[k].type)) {
var ff = 'YYYY-MM-DD HH:mm:ss';
switch (cll[k].type) {
case 'DATE':
ff = 'YYYY-MM-DD';
break;
case 'YEAR':
ff = 'YYYY';
break;
case 'TIME':
ff = 'HH:mm:ss';
break;
}
column.render = val => moment(parseInt(val)).format(ff);
}
if (cll[k].isQuery) {
column = {
...this.getColumnSearchProps(cll[k].name, cll[k].title),
...column,
};
this.setState({ dataSource: x });
},
});
}
column = giveRender(column);
columns.push(column);
}
this.setState({ columns });
}
},
getServicesNomal(getSqlDataApi, {
sqlKey,
allValues,
isCache: this.otherProps?.isCache || false,
}).then(list => {
const x = {
list: list,
pagination: false,
};
this.setState({ dataSource: x });
});
}
});
} else if (optionType == 'reference' && dataColumn.referenceObjId) {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: dataColumn.referenceObjId },
callback: datas => {
if (datas) {
const columns = [];
for (var i = 0; i < datas.length; i++) {
if (i <= json.colNum ? json.colNum : 10) {
let column = {};
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
columns.push(column);
} else {
break;
getServicesNomal(getHeaderListApi, { dataObjId: dataColumn.referenceObjId }).then(datas => {
if (datas) {
const columns = [];
for (var i = 0; i < datas.length; i++) {
if (i <= json.colNum ? json.colNum : 10) {
let column = {};
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
columns.push(column);
} else {
break;
}
this.setState({ columns });
}
},
this.setState({ columns });
}
});
}
}
......@@ -1270,14 +1262,9 @@ export default class TableCom extends Component {
return;
}
if (json.sqlKey != null && json.sqlKey !== '') {
const { dispatch } = this.props;
dispatch({
type: 'SqlManageEntity/find',
payload: { sqlKey: json.sqlKey },
callback: res => {
this.setState({ sqlContent: res.sql });
},
});
getServicesNomal(findApi, { sqlKey: json.sqlKey }).then(res => {
this.setState({ sqlContent: res.sql });
})
}
const bindObj = this.getColumn('c1');
......@@ -1325,7 +1312,6 @@ export default class TableCom extends Component {
// 解决禅道bug 28017
allValues = {};
}
const { dispatch } = this.props;
if (init != null && Object.keys(init).length > 0) {
const params = {
sqlKey,
......@@ -1341,35 +1327,30 @@ export default class TableCom extends Component {
dispatch({
type: 'DataColumn/getSqlOptions',
payload: params,
callback: options => {
const optionsx = [];
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
let isExist = false;
for (var i = 0; i < options.length; i++) {
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
optionsx.push({
label: options[i][labelName],
value: options[i][valueName],
});
}
if (!isExist && vl != null && options.length > 0) {
// console.log(base52, 1144);
this.props.form.setFieldsValue({ [base52]: null });
getServicesNomal(getSqlOptionsApi, params).then(options => {
const optionsx = [];
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
let isExist = false;
for (var i = 0; i < options.length; i++) {
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
this.setState({
getSqlOptionsCache,
options: optionsx,
selectDis: false,
optionsx.push({
label: options[i][labelName],
value: options[i][valueName],
});
},
}
if (!isExist && vl != null && options.length > 0) {
// console.log(base52, 1144);
this.props.form.setFieldsValue({ [base52]: null });
}
this.setState({
getSqlOptionsCache,
options: optionsx,
selectDis: false,
});
});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52;
......@@ -1394,17 +1375,13 @@ export default class TableCom extends Component {
}
if (obj[base52]) {
dispatch({
type: 'DataColumn/getSqlLabels',
payload: params,
callback: labels => {
this.setState({
getSqlOptionsCache,
labels,
selectDis: false,
});
},
});
getServicesNomal(getSqlLabelsApi, params).then(labels => {
this.setState({
getSqlOptionsCache,
labels,
selectDis: false,
});
})
}
} else {
const params = {
......@@ -1423,42 +1400,35 @@ export default class TableCom extends Component {
// if(params.sqlKey === 'KFRvOyGdyvU'){
// console.log(params);
// }
dispatch({
type: 'DataColumn/getSqlOptions',
payload: params,
callback: options => {
// console.log(options);
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
const optionsx = [];
let isExist = false;
for (var i = 0; i < options.length; i++) {
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
if (Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist) {
// 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug
isExist = true;
}
optionsx.push({
label: options[i][labelName],
value: options[i][valueName],
});
getServicesNomal(getSqlOptionsApi, params).then(options => {
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
const optionsx = [];
let isExist = false;
for (var i = 0; i < options.length; i++) {
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
if (!isExist && vl != null && options.length > 0) {
//console.log("isExist",optionsx,vl,isExist)
// console.log(1186, base52);
this.props.form.setFieldsValue({ [base52]: null });
if (Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist) {
// 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug
isExist = true;
}
this.setState({
getSqlOptionsCache,
options: optionsx,
selectDis: false,
optionsx.push({
label: options[i][labelName],
value: options[i][valueName],
});
},
});
}
if (!isExist && vl != null && options.length > 0) {
this.props.form.setFieldsValue({ [base52]: null });
}
this.setState({
getSqlOptionsCache,
options: optionsx,
selectDis: false,
});
})
}
};
changeEnum = (obj, dataColumn, options) => {
......@@ -1499,18 +1469,14 @@ export default class TableCom extends Component {
}
};
fetchData = (obj, dataColumn, init, filterSql, allValues) => {
const { dispatch } = this.props;
if (init != null && Object.keys(init).length > 0) {
dispatch({
type: 'DataColumn/getOptions',
payload: {
id: dataColumn.id,
filterSql,
allValues,
},
callback: options => {
const optionsx = [];
getServicesNomal(getSqlOptionsApi, {
id: dataColumn.id,
filterSql,
allValues,
}).then(options => {
const optionsx = [];
for (var i = 0; i < options.length; i++) {
optionsx.push({
label: options[i][dataColumn.referenceNameName],
......@@ -1521,36 +1487,28 @@ export default class TableCom extends Component {
options: optionsx,
selectDis: false,
});
},
});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
if (obj[dataColumn.base52]) {
dispatch({
type: 'DataColumn/getLabels',
payload: {
id: dataColumn.id,
values: obj[dataColumn.base52],
filterSql,
allValues,
},
callback: labels => {
this.setState({
labels,
selectDis: false,
});
},
});
}
} else {
dispatch({
type: 'DataColumn/getOptions',
payload: {
getServicesNomal(getLabelsApi, {
id: dataColumn.id,
values: obj[dataColumn.base52],
filterSql,
allValues,
},
callback: options => {
const optionsx = [];
}).then(labels => {
this.setState({
labels,
selectDis: false,
});
});
}
} else {
getServicesNomal(getOptionsApi, {
id: dataColumn.id,
filterSql,
allValues,
}).then(options => {
const optionsx = [];
for (var i = 0; i < options.length; i++) {
optionsx.push({
label: options[i][dataColumn.referenceNameName],
......@@ -1561,7 +1519,6 @@ export default class TableCom extends Component {
options: optionsx,
selectDis: false,
});
},
});
}
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论