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

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

上级 7049d1d3
......@@ -2,13 +2,9 @@ import React, { Component, Fragment } from 'react';
import SearchDom from '@/highOrderComponent/SearchDom';
import ButtonListDom from '../ButtonListDom';
import Shell from '@/baseComponent/Shell';
import ColumnsRender from '@/highOrderComponent/ColumnsRender';
import StandardTable from '@/components/StandardTable';
import PropTypes from 'prop-types';
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';
export default class List extends Component {
......
......@@ -24,16 +24,14 @@ export default class AffairPage extends React.Component {
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
const idObj = service.getId(pathname);
if (!idObj) {
message.error('没有配置数据id,无法使用该功能');
}
this.state = {
showIframe: false,
columns: [],
workId: idObj.workId,
pathname,
workId: '',
searchCondition: [],
dataBaseId: idObj.dataBaseId,
dataBaseId: '',
addFields: [], // 新增时填写的字段。
renderIframe: true,
};
......@@ -121,11 +119,7 @@ export default class AffairPage extends React.Component {
return pageSearch;
};
componentDidMount() {
if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
getColumns = () => {
const { workId } = this.state;
service.getColumns(workId).then((response) => {
if (response) {
......@@ -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) => {
if (event.data === 'returnList') {
......
......@@ -16,17 +16,14 @@ export default class Index extends React.Component {
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
const idObj = service.getId(pathname);
if (!idObj) {
message.error('没有配置数据id,无法使用该功能');
}
this.state = {
columns: [],
dataList: [],
headerInfo: [],
workId: idObj.workId,
workId: '',
searchCondition: [],
dataBaseId: idObj.dataBaseId,
pathname,
dataBaseId: '',
addCondition: [],
addFields: [], // 新增时填写的字段。
tableInfo: {}, // 表格配置属性
......@@ -36,10 +33,6 @@ export default class Index extends React.Component {
getFormDetail = (workId) => {
const { dataBaseId } = this.state;
/*service.getQueryCondition(dataBaseId).then((response) => {
this.setState({searchCondition: response})
});*/
service.getFormDetail(workId).then((response) => {
if (typeof response.unifiedServicePatternModel === 'undefined') {
return false;
......@@ -86,8 +79,8 @@ export default class Index extends React.Component {
})
};
componentDidMount() {
const { workId, dataBaseId, addFields } = this.state;
getColumn = () => {
const { workId } = this.state;
service.getColumns(workId).then((response) => {
if (response && response.length) {
this.setState({
......@@ -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() {
......
......@@ -8,7 +8,7 @@
import { apiRequest } from '../request';
import { getFormArrayConfig } from '../config/index';
import { setHuanGeToken } from '@/utils/authority';
import { isJSON } from '@/baseComponent/utils';
import { getOneStopConfig, isJSON } from '@/baseComponent/utils';
import config from '@/config/config';
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
let idObj = config.twOneStopConfig[pathname]; // 路由 /tw/Pjpy/YXTYSBB/Apply
if (typeof idObj === 'undefined') {
const getId = async (pathname) => { // 获取流程引擎 事务workId 和表dataBaseId
let idObj = await getOneStopConfig(pathname);
if (typeof idObj === 'undefined' || !idObj) {
console.error('没有找到对应的流程引擎id');
return false;
} else {
return {
dataBaseId: idObj.id,
workId: idObj.id,
dataBaseId: idObj,
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
// workId, pageSize, pageNo,
......@@ -78,44 +54,8 @@ const getPages = (info) => { // 获取代办事项 分页数据 workId
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 = '') => {
})
};
/**
* 流程紧急度
* 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 {
getId, getColumns, getPages, getQueryCondition,
getListPage, deleteFormData, getColumns2, getFormDetail,
getOptions, startProcess, getApplyPage, getOtherToken,
getId, getColumns, getPages,
getFormDetail,
getOptions, startProcess, getApplyPage,
getDetailInfo, getWaitPage, getHandledPage, handleAudit,
handleSqlData,handleSqlfind, getSqlOptions, getSeriousOptions,
handleSqlData,handleSqlfind, getSqlOptions,
};
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查询模板数据
// 查询表格中某条数据
......@@ -88,3 +91,26 @@ export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => {
export const getHistoryFormDetail = ({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 moment from 'moment';
import { Icon, message, notification } from 'antd';
import { getOnestopKey } from '../../Services';
let messageTime = new Date().getTime() - 3000;
......@@ -218,3 +218,25 @@ export function controlNotification(props) {
});
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论