提交 8e8dee89 authored 作者: 钟是志's avatar 钟是志

一站式流程配置的配置项全部改成从接口中获取

上级 7049d1d3
...@@ -2,13 +2,9 @@ import React, { Component, Fragment } from 'react'; ...@@ -2,13 +2,9 @@ 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 ColumnsRender from '@/highOrderComponent/ColumnsRender';
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 { date, format, text, taskNode } from '../../config';
import moment from 'moment';
import { Tooltip } from 'antd';
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 {
......
...@@ -24,16 +24,14 @@ export default class AffairPage extends React.Component { ...@@ -24,16 +24,14 @@ export default class AffairPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
const idObj = service.getId(pathname);
if (!idObj) {
message.error('没有配置数据id,无法使用该功能');
}
this.state = { this.state = {
showIframe: false, showIframe: false,
columns: [], columns: [],
workId: idObj.workId, pathname,
workId: '',
searchCondition: [], searchCondition: [],
dataBaseId: idObj.dataBaseId, dataBaseId: '',
addFields: [], // 新增时填写的字段。 addFields: [], // 新增时填写的字段。
renderIframe: true, renderIframe: true,
}; };
...@@ -121,11 +119,7 @@ export default class AffairPage extends React.Component { ...@@ -121,11 +119,7 @@ export default class AffairPage extends React.Component {
return pageSearch; return pageSearch;
}; };
componentDidMount() { getColumns = () => {
if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
const { workId } = this.state; const { workId } = this.state;
service.getColumns(workId).then((response) => { service.getColumns(workId).then((response) => {
if (response) { if (response) {
...@@ -136,6 +130,22 @@ export default class AffairPage extends React.Component { ...@@ -136,6 +130,22 @@ export default class AffairPage extends React.Component {
}); });
} }
}); });
};
componentDidMount() {
if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
const { pathname } = this.state;
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumns();
})
});
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event.data === 'returnList') { if (event.data === 'returnList') {
......
...@@ -16,17 +16,14 @@ export default class Index extends React.Component { ...@@ -16,17 +16,14 @@ export default class Index extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
const idObj = service.getId(pathname);
if (!idObj) {
message.error('没有配置数据id,无法使用该功能');
}
this.state = { this.state = {
columns: [], columns: [],
dataList: [], dataList: [],
headerInfo: [], headerInfo: [],
workId: idObj.workId, workId: '',
searchCondition: [], searchCondition: [],
dataBaseId: idObj.dataBaseId, pathname,
dataBaseId: '',
addCondition: [], addCondition: [],
addFields: [], // 新增时填写的字段。 addFields: [], // 新增时填写的字段。
tableInfo: {}, // 表格配置属性 tableInfo: {}, // 表格配置属性
...@@ -36,10 +33,6 @@ export default class Index extends React.Component { ...@@ -36,10 +33,6 @@ export default class Index extends React.Component {
getFormDetail = (workId) => { getFormDetail = (workId) => {
const { dataBaseId } = this.state; const { dataBaseId } = this.state;
/*service.getQueryCondition(dataBaseId).then((response) => {
this.setState({searchCondition: response})
});*/
service.getFormDetail(workId).then((response) => { service.getFormDetail(workId).then((response) => {
if (typeof response.unifiedServicePatternModel === 'undefined') { if (typeof response.unifiedServicePatternModel === 'undefined') {
return false; return false;
...@@ -86,8 +79,8 @@ export default class Index extends React.Component { ...@@ -86,8 +79,8 @@ export default class Index extends React.Component {
}) })
}; };
componentDidMount() { getColumn = () => {
const { workId, dataBaseId, addFields } = this.state; const { workId } = this.state;
service.getColumns(workId).then((response) => { service.getColumns(workId).then((response) => {
if (response && response.length) { if (response && response.length) {
this.setState({ this.setState({
...@@ -97,6 +90,18 @@ export default class Index extends React.Component { ...@@ -97,6 +90,18 @@ export default class Index extends React.Component {
}); });
} }
}); });
};
componentDidMount() {
const { pathname } = this.state;
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumn();
})
});
} }
render() { render() {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
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 { 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) => {
...@@ -30,44 +30,20 @@ const giveValue = (x) => { ...@@ -30,44 +30,20 @@ const giveValue = (x) => {
} }
}; };
const getOtherToken = () => {
let userName = sessionStorage.getItem("currentUser");
if(isJSON(userName)){
let name = JSON.parse(userName).name;
return apiRequest(`/UserApi/loginByCount?username=${name}`, {}).then((res)=>{
if(res){
setHuanGeToken(res.token);
}
});
}
};
const getId = (pathname) => { // 获取流程引擎 事务workId 和表dataBaseId const getId = async (pathname) => { // 获取流程引擎 事务workId 和表dataBaseId
let idObj = config.twOneStopConfig[pathname]; // 路由 /tw/Pjpy/YXTYSBB/Apply let idObj = await getOneStopConfig(pathname);
if (typeof idObj === 'undefined') { if (typeof idObj === 'undefined' || !idObj) {
console.error('没有找到对应的流程引擎id'); console.error('没有找到对应的流程引擎id');
return false; return false;
} else { } else {
return { return {
dataBaseId: idObj.id, dataBaseId: idObj,
workId: idObj.id, workId: idObj,
}; };
} }
}; };
const getColumns2 = (id) => { // 获取表头 workId
return apiRequest('/DataColumnApi/getHeaderList', { dataObjId: id }).then((response)=>{
if(response){
return response.map((x)=>{
return {
title: x.title,
dataIndex: x.name,
type: x.type,
}
})
}
});
};
const getPages = (info) => { // 获取代办事项 分页数据 workId const getPages = (info) => { // 获取代办事项 分页数据 workId
// workId, pageSize, pageNo, // workId, pageSize, pageNo,
...@@ -78,44 +54,8 @@ const getPages = (info) => { // 获取代办事项 分页数据 workId ...@@ -78,44 +54,8 @@ const getPages = (info) => { // 获取代办事项 分页数据 workId
return apiRequest('/UnifiedAppFormApi/getWaitPage', info); return apiRequest('/UnifiedAppFormApi/getWaitPage', info);
}; };
const getQueryCondition = (dataObjId) => { // 获取搜索条件 dataBaseId //暂时未生效. 因为欢哥那边不支持
return [];
return apiRequest('/DataColumnApi/getHeaderList', { dataObjId }).then((response) => {
let res = [];
if(response){
for(let item of response){
if(item.isShowQuery){
let sear = getFormArrayConfig([item]);
if(!Array.isArray(sear)){
return false;
}
delete sear[0].required;
delete sear[0].placeHolder;
res.push(sear[0]);
}
}
}
return res;
});
};
const getListPage = (info) => { // 获取表数据。dataObjId
if (typeof info.pageNo === 'undefined') {
info.pageNo = 1;
info.pageSize = 10;
}
return apiRequest('/DataObjApi/getFormDataPage', info);
};
const deleteFormData = (dataBaseId, id) => { // 删除表数据.
const info = {
keys: JSON.stringify({id}),
objId: dataBaseId,
};
return apiRequest('/DataObjApi/deleteFormData', info);
};
/****************************** 以上接口暂时不用 ****************************/
...@@ -271,33 +211,14 @@ const handleSqlfind = async(sqlKey = '') => { ...@@ -271,33 +211,14 @@ const handleSqlfind = async(sqlKey = '') => {
}) })
}; };
/**
* 流程紧急度
* 2019年12月5日
* 钟是志
* 先默认给后台传个值 保证能提交申请
* */
const getSeriousOptions = () => {
return apiRequest('/UnifiedAppFormLevelApi/getAll', {}).then((x)=>{
if(x){
return x.map((s)=>{
return {
key: s.id,
name: s.name,
color: s.color,
}
})
}
});
};
export { export {
getId, getColumns, getPages, getQueryCondition, getId, getColumns, getPages,
getListPage, deleteFormData, getColumns2, getFormDetail, getFormDetail,
getOptions, startProcess, getApplyPage, getOtherToken, getOptions, startProcess, getApplyPage,
getDetailInfo, getWaitPage, getHandledPage, handleAudit, getDetailInfo, getWaitPage, getHandledPage, handleAudit,
handleSqlData,handleSqlfind, getSqlOptions, getSeriousOptions, handleSqlData,handleSqlfind, getSqlOptions,
}; };
import { uaaRequest } from './one_stop_public/utils/request'; import { uaaRequest } from './one_stop_public/utils/request';
import config from '@/config/config';
import { message } from 'antd';
import { setOneStopConfig } from '@/webPublic/zyd_public/utils/utils';
// 根据模板code查询模板数据 // 根据模板code查询模板数据
// 查询表格中某条数据 // 查询表格中某条数据
...@@ -88,3 +91,26 @@ export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => { ...@@ -88,3 +91,26 @@ export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => {
export const getHistoryFormDetail = ({id, code}) => { export const getHistoryFormDetail = ({id, code}) => {
return uaaRequest('/UnifiedAppFormApi/getFormDetail', { id, code, }); return uaaRequest('/UnifiedAppFormApi/getFormDetail', { id, code, });
}; };
export function getOnestopKey(key='',formKey='key_list', formValue='value_list'){
return fetchTableData({
dataObjId: config.onestopConfigDataObjId || '1248169933162938368',
pageNo: 1,
pageSize: 5000,
}).then((x)=>{
if(x && x.rows && x.rows.length){
let onestopConfigList = {};
for(let item of x.rows){
onestopConfigList[item[formKey]] = item[formValue];
}
setOneStopConfig(onestopConfigList);
if(key){
return onestopConfigList[key];
}
}else{
message.warning('没有配置服务,无法使用此功能');
return false;
}
})
}
import React from 'react'; import React from 'react';
import moment from 'moment'; import moment from 'moment';
import { Icon, message, notification } from 'antd'; import { Icon, message, notification } from 'antd';
import { getOnestopKey } from '../../Services';
let messageTime = new Date().getTime() - 3000; let messageTime = new Date().getTime() - 3000;
...@@ -218,3 +218,25 @@ export function controlNotification(props) { ...@@ -218,3 +218,25 @@ export function controlNotification(props) {
}); });
return true; return true;
} }
export function setOneStopConfig(value){
if(typeof value !== 'string'){
value = JSON.stringify(value);
}
localStorage.setItem('oneStopConfig', value);
}
export function getOneStopConfig(key){
let configList = localStorage.getItem('oneStopConfig');
if(configList && isJSON(configList)){
let data = JSON.parse(configList);
if(data && typeof data === 'object'){
if(typeof data === 'undefined'){
return '';
}
return data[key] || false;
}
}else{
return getOnestopKey(key);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论