提交 0fa1f2bd authored 作者: 钟是志's avatar 钟是志

合并分支 'yaanzhiyuan_2021' 到 'master'

norefeshxxxxxxxxxxxxxxxxxxxx 修改 查看合并请求 !2
......@@ -26,7 +26,7 @@ export default class TableSelect extends React.Component {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
if (onChange) {
console.log('changedValue', changedValue);
// console.log('changedValue', changedValue);
onChange(Object.assign({}, this.state, changedValue));
}
};
......@@ -234,9 +234,9 @@ export default class TableSelect extends React.Component {
});
}
console.log(this.props);
console.log(this.state);
console.log('-0000 TableSelect000');
// console.log(this.props);
// console.log(this.state);
// console.log('-0000 TableSelect000');
return (
<div>
{Object.keys(selects).length > 0 ? (
......
import {message} from "antd";
import baseX from "base-x";
import moment from "moment";
import {isNaN} from "lodash";
import React from 'react';
import config from "@/webPublic/one_stop_public/config";
const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
202: '一个请求已经进入后台排队(异步任务)。',
204: '删除数据成功。',
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '登录已过期,请重新登录',
403: '用户得到授权,但是访问是被禁止的。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
500: '服务器发生错误,请检查服务器。',
502: '网关错误。',
503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。',
};
const errorHandler = (error) => {
const { response } = error;
if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText;
message.error(`请求错误${errorText}`);
if (response.status === 401) {
return window.g_app._store.dispatch({
type: 'login/loginout',
});
}
} else {
message.error(`网络故障,请检查网络链接或联系管理员`);
}
};
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64 = baseX(Bs64);
export function getBase64(value) {
return value ? base64.encode(new Buffer(value)) : null;
}
const excludeKeys = ['defaultValues', ''];
const equal = (obj1, obj2, json, sqlContent, depth, props) => {
if (obj1 == null && obj2 != null) {
return false;
}
if (obj1 != null && obj2 == null) {
return false;
}
if (obj1 == null && obj2 == null) {
return true;
}
if (obj1 instanceof Date) {
if (obj1.valueOf() != obj2.valueOf()) {
return false;
}
} else if (obj1 instanceof moment) {
if (obj1.valueOf() != obj2.valueOf()) {
return false;
}
} else if (typeof obj1 == 'function') {
if (obj1.toString() != obj2.toString()) {
return false;
}
}
const keys = new Set();
if (obj2 != null) {
Object.keys(obj2).forEach(k => {
if (k != '') keys.add(k);
});
}
if (obj1 != null) {
Object.keys(obj1).forEach(k => {
if (k != '') keys.add(k);
});
}
let res = true;
for (let key of keys) {
if (key == '') {
continue;
}
if (excludeKeys.includes(key)) {
continue;
}
if (obj1[key] == null && obj2[key] != null) {
res = false;
break;
}
if (obj1[key] != null && obj2[key] == null) {
res = false;
break;
}
if (
depth == 1 &&
((props.json.sqlKey == null &&
sqlContent == null &&
json.formula == null &&
json.funcs == null) ||
(sqlContent != null && sqlContent.indexOf(key) == -1) ||
(json.formula != null &&
json.formula.indexOf(key) == -1 &&
json.funcs != null &&
json.funcs.indexOf(key) == -1))
) {
excludeKeys.push(key);
continue;
}
if (obj1[key] == null && obj2[key] == null) {
continue;
}
if (isNaN(obj1[key]) && isNaN(obj2[key])) {
continue;
}
if (obj1[key] instanceof Array) {
if (obj1[key].length != obj2[key].length) {
res = false;
break;
} else {
var xx = true;
for (var i = 0; i < obj1[key].length; i++) {
if (!equal(obj1[key][i], obj2[key][i], json, sqlContent, depth + 1)) {
xx = false;
break;
}
}
if (!xx) {
res = false;
break;
}
}
} else if (obj1[key] instanceof Object) {
const x = equal(obj1[key], obj2[key], json, sqlContent, depth + 1);
if (!x) {
res = false;
break;
}
} else if (typeof obj1[key] == 'function') {
if (obj1[key].toString() != obj2[key].toString()) {
res = false;
break;
}
} else {
if (obj1[key] != obj2[key]) {
res = false;
break;
}
}
}
return res;
};
const getRender = (com, props) => {
if (com == 'p') return <p {...props} />;
if (com == 'ul') return <ul {...props} />;
if (com == 'li') return <li {...props} />;
if (com == 'video') return <video {...props} />;
if (com == 'span') return <span {...props} />;
if (com == 'a') return <a {...props} />;
if (com == 'div') return <div {...props} />;
if (com == 'canvas') return <canvas {...props} />;
if (com == 'iframe') return <iframe {...props} />;
if (com == 'img') {
const src =
props.src != null
? props.src.indexOf('http') > -1
? props.src
: config.httpServer + props.src
: null;
const pp = { ...props, src: src };
return <img {...pp} />;
}
};
/**
* 判断传入值是否为JSON文本
*/
const isJSON = str => {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log('error:' + str + '!!!' + e);
return false;
}
}
};
export { errorHandler, equal, getRender, isJSON };
......@@ -51,58 +51,18 @@ import { extend } from 'umi-request';
import Highlighter from 'react-highlight-words';
import Signature from '../Signature';
import { changeToDraftState } from '../utils/myutils';
import baseX from 'base-x';
import { Base16Encode } from '../Base16/index';
import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList';
import FilePreview from '../filePreview';
import DraftEditorCom from '../App/DraftEditorCom';
import MobileItem from './MobileItem';
import MobileCascader from "./CascaderDiy/MobileCascader";
import MobileCascader from './CascaderDiy/MobileCascader';
import { errorHandler, getBase64, equal, getRender, isJSON } from './Split_Index/staticInfo';
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64 = baseX(Bs64);
function getBase64(value) {
return value ? base64.encode(new Buffer(value)) : null;
}
const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
202: '一个请求已经进入后台排队(异步任务)。',
204: '删除数据成功。',
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '登录已过期,请重新登录',
403: '用户得到授权,但是访问是被禁止的。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
500: '服务器发生错误,请检查服务器。',
502: '网关错误。',
503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。',
};
const { TextArea } = Input;
const { Option } = Select;
const { RangePicker } = DatePicker;
const errorHandler = (error) => {
const { response } = error;
if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText;
message.error(`请求错误${errorText}`);
if (response.status === 401) {
return window.g_app._store.dispatch({
type: 'login/loginout',
});
}
} else {
message.error(`网络故障,请检查网络链接或联系管理员`);
}
};
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn,
......@@ -136,7 +96,6 @@ export default class tableCom extends Component {
pagination: false,
},
};
this.excludeKeys = ['defaultValues', ''];
}
closeModal = (fk, callback) => {
......@@ -149,6 +108,7 @@ export default class tableCom extends Component {
callback: callback,
});
};
showModal = (fk, title, data, modalProps) => {
const { dispatch } = this.props;
const x = this.props.DataColumn.isShowModal;
......@@ -167,174 +127,6 @@ export default class tableCom extends Component {
});
};
equal = (obj1, obj2, json, sqlContent, depth) => {
if (obj1 == null && obj2 != null) {
return false;
}
if (obj1 != null && obj2 == null) {
return false;
}
if (obj1 == null && obj2 == null) {
return true;
}
if (obj1 instanceof Date) {
if (obj1.valueOf() != obj2.valueOf()) {
return false;
}
} else if (obj1 instanceof moment) {
if (obj1.valueOf() != obj2.valueOf()) {
return false;
}
} else if (typeof obj1 == 'function') {
if (obj1.toString() != obj2.toString()) {
return false;
}
}
const keys = new Set();
if (obj2 != null) {
Object.keys(obj2).forEach((k) => {
if (k != '') keys.add(k);
});
}
if (obj1 != null) {
Object.keys(obj1).forEach((k) => {
if (k != '') keys.add(k);
});
}
let res = true;
for (let key of keys) {
if (key == '') {
continue;
}
if (this.excludeKeys.includes(key)) {
continue;
}
if (obj1[key] == null && obj2[key] != null) {
res = false;
break;
}
if (obj1[key] != null && obj2[key] == null) {
res = false;
break;
}
if (
depth == 1 &&
((this.props.json.sqlKey == null &&
sqlContent == null &&
json.formula == null &&
json.funcs == null) ||
(sqlContent != null && sqlContent.indexOf(key) == -1) ||
(json.formula != null &&
json.formula.indexOf(key) == -1 &&
json.funcs != null &&
json.funcs.indexOf(key) == -1))
) {
this.excludeKeys.push(key);
continue;
}
if (obj1[key] == null && obj2[key] == null) {
continue;
}
if (isNaN(obj1[key]) && isNaN(obj2[key])) {
continue;
}
/* if (this.typeOf(obj1[key]) != this.typeOf(obj1[key])) {
res = false
break;
} */
if (obj1[key] instanceof Array) {
if (obj1[key].length != obj2[key].length) {
res = false;
break;
} else {
var xx = true;
for (var i = 0; i < obj1[key].length; i++) {
if (!this.equal(obj1[key][i], obj2[key][i], json, sqlContent, depth + 1)) {
xx = false;
break;
}
}
if (!xx) {
res = false;
break;
}
}
} else if (obj1[key] instanceof Object) {
const x = this.equal(obj1[key], obj2[key], json, sqlContent, depth + 1);
if (!x) {
res = false;
break;
}
} else if (typeof obj1[key] == 'function') {
if (obj1[key].toString() != obj2[key].toString()) {
res = false;
break;
}
} else {
if (obj1[key] != obj2[key]) {
res = false;
break;
}
}
}
return res;
};
getRender = (com, props) => {
if (com == 'p') return <p {...props} />;
if (com == 'ul') return <ul {...props} />;
if (com == 'li') return <li {...props} />;
if (com == 'video') return <video {...props} />;
if (com == 'span') return <span {...props} />;
if (com == 'a') return <a {...props} />;
if (com == 'div') return <div {...props} />;
if (com == 'canvas') return <canvas {...props} />;
if (com == 'iframe') return <iframe {...props} />;
if (com == 'img') {
const src =
props.src != null
? props.src.indexOf('http') > -1
? props.src
: config.httpServer + props.src
: null;
const pp = { ...props, src: src };
return <img {...pp} />;
}
};
/**
* 判断传入值是否为JSON文本
*/
isJSON = (str) => {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log('error:' + str + '!!!' + e);
return false;
}
}
};
/**
* 上传文件输入
* 使用antd上传组件
......@@ -342,7 +134,7 @@ export default class tableCom extends Component {
file = {
name: 'file',
action: queryApiActionPath() + '/upload',
onChange: (info) => {
onChange: info => {
if (info.file.status !== 'uploading') {
this.setState({
img: info.file.response,
......@@ -363,7 +155,7 @@ export default class tableCom extends Component {
this.setState({ searchText: selectedKeys[0] });
};
handleReset = (clearFilters) => {
handleReset = clearFilters => {
clearFilters();
this.resetSearchText();
};
......@@ -378,12 +170,12 @@ export default class tableCom extends Component {
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
<div style={{ padding: 8 }}>
<Input
ref={(node) => {
ref={node => {
this.searchInput = node;
}}
placeholder={`请输入${title}`}
value={selectedKeys[0]}
onChange={(e) => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
style={{ width: 188, marginBottom: 8, display: 'block' }}
/>
......@@ -393,21 +185,21 @@ export default class tableCom extends Component {
icon="search"
loading={this.props.loading}
size="small"
style={{ width: 90, marginRight: 8 }}>
style={{ width: 90, marginRight: 8 }}
>
搜索
</Button>
<Button
loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)}
size="small"
style={{ width: 90 }}>
style={{ width: 90 }}
>
重置
</Button>
</div>
),
filterIcon: (filtered) => (
<Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />
),
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
onFilter: (value, record) =>
record[dataIndex]
? record[dataIndex]
......@@ -415,12 +207,12 @@ export default class tableCom extends Component {
.toLowerCase()
.includes(value.toLowerCase())
: '',
onFilterDropdownVisibleChange: (visible) => {
onFilterDropdownVisibleChange: visible => {
if (visible) {
setTimeout(() => this.searchInput.select());
}
},
render: (text) => {
render: text => {
if (text != null) {
return (
<Highlighter
......@@ -468,14 +260,14 @@ export default class tableCom extends Component {
return;
}
const obj2 = props.form.getFieldsValue();
const bb = this.equal(this.obj, obj2, json, this.state.sqlContent, 1);
const bb = equal(this.obj, obj2, json, this.state.sqlContent, 1, this.props);
let bb2 = true;
let childObj2 = {};
if (props.fatherCode) {
if (obj2 != null && obj2[props.fatherCode]) {
childObj2 = obj2[props.fatherCode][props.index];
bb2 = this.equal(this.childObj, childObj2, json, this.state.sqlContent, 1);
bb2 = equal(this.childObj, childObj2, json, this.state.sqlContent, 1, this.props);
}
}
......@@ -560,13 +352,13 @@ export default class tableCom extends Component {
dispatch({
type: 'SqlManageEntity/find',
payload: { sqlKey: sqlKey },
callback: (sqlModel) => {
callback: sqlModel => {
this.setState({ sqlModel });
if (sqlModel.dataObjId) {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: sqlModel.dataObjId },
callback: (datas) => {
callback: datas => {
if (datas) {
const columns = [];
for (var i = 0; i < datas.length; i++) {
......@@ -577,7 +369,7 @@ export default class tableCom extends Component {
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(val).format('YYYY-MM-DD HH:mm:ss');
}
columns.push(column);
} else {
......@@ -611,7 +403,7 @@ export default class tableCom extends Component {
break;
}
column.render = (val) => moment(parseInt(val)).format(ff);
column.render = val => moment(parseInt(val)).format(ff);
}
if (cll[k].isQuery) {
column = {
......@@ -628,7 +420,7 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getSqlData',
payload: { sqlKey, allValues },
callback: (list) => {
callback: list => {
const x = {
list: list,
pagination: false,
......@@ -643,7 +435,7 @@ export default class tableCom extends Component {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: dataColumn.referenceObjId },
callback: (datas) => {
callback: datas => {
if (datas) {
const columns = [];
for (var i = 0; i < datas.length; i++) {
......@@ -652,7 +444,7 @@ export default class tableCom extends Component {
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(val).format('YYYY-MM-DD HH:mm:ss');
}
columns.push(column);
} else {
......@@ -837,8 +629,16 @@ export default class tableCom extends Component {
if (json.optionType && json.optionType == 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => {
if (
res != null &&
!(typeof res === 'function') &&
res !== 'norefeshxxxxxxxxxxxxxxxxxxxx'
) {
// console.table(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback();
});
}
......@@ -912,21 +712,28 @@ export default class tableCom extends Component {
data: requestParams,
method: method,
requestType: 'form',
}).then((data) => {
}).then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
const { reqUrls } = this.state;
if(reqUrls && reqUrls[url]){
if (reqUrls && reqUrls[url]) {
reqUrls[url].data = data;
}
this.setState({ res: data, reqUrls }, () => {
if (callback) {
if (json.optionType && json.optionType == 'func') {
const res = callback(data);
// console.error(res)
if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => {
if (
res != null &&
!(typeof res === 'function') &&
res !== 'norefeshxxxxxxxxxxxxxxxxxxxx'
) {
// console.table(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback();
});
}
......@@ -974,30 +781,32 @@ export default class tableCom extends Component {
}
});
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
};
sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => {
//查缓存
var isChange = false;
const { sqlKeys } = this.state;
if (sqlKeys[sqlKey] != null) {
const ps = sqlKeys[sqlKey].params;
const ps = sqlKeys[sqlKey].params; // []
if (params.length != ps.length) {
if (params.length !== ps.length) {
// 长度不想等 直接更新
isChange = true;
} else {
for (var i = 0; i < params.length; i++) {
if (params[i] != ps[i]) {
// 某一个不相等 直接更新
isChange = true;
break;
}
}
}
if (!isChange) {
const os = sqlKeys[sqlKey].options;
if (Object.keys(options).length != Object.keys(os).length) {
const os = sqlKeys[sqlKey].options; // {}
if (Object.keys(options).length !== Object.keys(os).length) {
// {}
isChange = true;
} else {
for (var k in options) {
......@@ -1009,20 +818,32 @@ export default class tableCom extends Component {
}
}
} else {
sqlKeys[sqlKey] = { params: params, options: options };
sqlKeys[sqlKey] = { params, options };
isChange = true;
}
if (!isChange) {
if (callback) {
const data = sqlKeys[sqlKey].data;
if (json.optionType && json.optionType == 'func') {
const data = sqlKeys[sqlKey].data; // Array[8]; options
if (json.optionType && json.optionType === 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => {
if (
res != null &&
!(typeof res === 'function') &&
res !== 'norefeshxxxxxxxxxxxxxxxxxxxx'
) {
// console.log(res);
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
});
},
);
}
} else if (json.comName == 'Button') {
} else if (json.comName === 'Button') {
try {
callback(data);
} catch (e) {
......@@ -1032,11 +853,7 @@ export default class tableCom extends Component {
e,
);
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
......@@ -1089,7 +906,7 @@ export default class tableCom extends Component {
data: pp,
method: 'POST',
requestType: 'form',
}).then((data) => {
}).then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
......@@ -1100,9 +917,12 @@ export default class tableCom extends Component {
if (callback) {
if (json.optionType && json.optionType == 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => {
if (res != null && !(typeof res === 'function') && res !== 'norefeshxxxxxxxxxxxxxxxxxxxx') {
// console.log(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback();
});
}
......@@ -1150,7 +970,6 @@ export default class tableCom extends Component {
}
});
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
};
......@@ -1163,8 +982,8 @@ export default class tableCom extends Component {
* 动态生成表单配置函数所使用
*/
let functionObj = {};
formulaList.map((item) => {
item.children.map((arr) => {
formulaList.map(item => {
item.children.map(arr => {
functionObj[arr.callKey] = arr.function;
});
});
......@@ -1228,7 +1047,7 @@ export default class tableCom extends Component {
md5,
showModal: this.showModal,
closeModal: this.closeModal,
render: this.getRender,
render: getRender,
base64: getBase64,
form: this.props.form,
},
......@@ -1238,7 +1057,7 @@ export default class tableCom extends Component {
this.props.concealModel,
);
if (base52) {
if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
if (value != null && value === 'norefeshxxxxxxxxxxxxxxxxxxxx') {
} else {
/**
* 会出现重复调用2次,然后NAN造成无限循环
......@@ -1246,11 +1065,15 @@ export default class tableCom extends Component {
if (isNaN(value)) {
return;
}
if (json.comName == 'Button') {
if (json.comName === 'Button') {
return value;
} else if (json.optionType && json.optionType == 'func') {
if (value != null && !(typeof value === 'function')) {
this.setState({ options: value, selectDis: false }, () => {
} else if (json.optionType && json.optionType === 'func') {
if (value != null && !(typeof value === 'function') && value !== 'norefeshxxxxxxxxxxxxxxxxxxxx') {
// console.log(value);
this.setState({
options: value,
selectDis: false,
}, () => {
if (callback) callback();
});
}
......@@ -1259,7 +1082,9 @@ export default class tableCom extends Component {
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
this.setState({ option: value });
this.setState({
option: value,
});
} else {
try {
this.props.form.setFieldsValue({ [base52]: value });
......@@ -1292,7 +1117,7 @@ export default class tableCom extends Component {
dispatch({
type: 'SqlManageEntity/find',
payload: { sqlKey: json.sqlKey },
callback: (res) => {
callback: res => {
this.setState({ sqlContent: res.sql });
},
});
......@@ -1333,7 +1158,7 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues },
callback: (options) => {
callback: options => {
const optionsx = [];
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
......@@ -1351,7 +1176,10 @@ export default class tableCom extends Component {
if (!isExist && vl != null && options.length > 0) {
this.props.form.setFieldsValue({ [base52]: null });
}
this.setState({ options: optionsx, selectDis: false });
// console.log(optionsx);
this.setState({
options: optionsx,
selectDis: false });
},
});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
......@@ -1364,8 +1192,11 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getSqlLabels',
payload: { sqlKey, values: obj[base52], labelName, valueName, allValues },
callback: (labels) => {
this.setState({ labels, selectDis: false });
callback: labels => {
this.setState({
labels,
selectDis: false,
});
},
});
}
......@@ -1373,7 +1204,7 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues },
callback: (options) => {
callback: options => {
let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52];
const optionsx = [];
......@@ -1392,8 +1223,11 @@ export default class tableCom extends Component {
//console.log("isExist",optionsx,vl,isExist)
this.props.form.setFieldsValue({ [base52]: null });
}
this.setState({ options: optionsx, selectDis: false });
// console.log(optionsx);
this.setState({
options: optionsx,
selectDis: false,
});
},
});
}
......@@ -1420,9 +1254,15 @@ export default class tableCom extends Component {
}
}
this.setState({ labels: labels, selectDis: false });
this.setState({
labels,
selectDis: false,
});
} else {
this.setState({ options: options, selectDis: false });
// console.log(options);
this.setState({
options,
selectDis: false });
}
};
fetchData = (obj, dataColumn, init, filterSql, allValues) => {
......@@ -1432,7 +1272,7 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues },
callback: (options) => {
callback: options => {
const optionsx = [];
for (var i = 0; i < options.length; i++) {
optionsx.push({
......@@ -1440,7 +1280,11 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName],
});
}
this.setState({ options: optionsx, selectDis: false });
// console.log(optionsx);
this.setState({
options: optionsx,
selectDis: false,
});
},
});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
......@@ -1448,8 +1292,11 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getLabels',
payload: { id: dataColumn.id, values: obj[dataColumn.base52], filterSql, allValues },
callback: (labels) => {
this.setState({ labels, selectDis: false });
callback: labels => {
this.setState({
labels,
selectDis: false,
});
},
});
}
......@@ -1457,7 +1304,7 @@ export default class tableCom extends Component {
dispatch({
type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues },
callback: (options) => {
callback: options => {
const optionsx = [];
for (var i = 0; i < options.length; i++) {
optionsx.push({
......@@ -1465,12 +1312,16 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName],
});
}
this.setState({ options: optionsx, selectDis: false });
// console.log(optionsx);
this.setState({
options: optionsx,
selectDis: false,
});
},
});
}
};
getColumn = (key) => {
getColumn = key => {
let { mapData, json } = this.props;
const columnIds = json.columnIds;
......@@ -1624,7 +1475,8 @@ export default class tableCom extends Component {
fontWeight: get == 'mobile' ? 'bold' : '',
marginRight: get == 'mobile' ? 12 : '',
}}
{...json.props}>
{...json.props}
>
{obj[this.props.uuid] || json.initialValue}
</span>
</>
......@@ -1640,7 +1492,8 @@ export default class tableCom extends Component {
fontWeight: get == 'mobile' ? 'bold' : '',
marginRight: get == 'mobile' ? 12 : '',
}}
{...json.props}>
{...json.props}
>
{this.props.form.getFieldsValue()[uid]}
</span>
</>
......@@ -1794,7 +1647,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}>
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
>
{cm}
</MobileItem>
);
......@@ -1805,7 +1659,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}>
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
>
{cm}
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
......@@ -1837,7 +1692,8 @@ export default class tableCom extends Component {
style={{
minHeight: 40,
lineHeight: '40px',
}}>
}}
>
<Col
className={json.label ? json.label : sqlData[key] ? styles.row_col_div : ''}
span={json.labelSpan}
......@@ -1848,7 +1704,8 @@ export default class tableCom extends Component {
overflow: 'hidden',
fontSize: 14,
color: 'rgba(0,0,0,0.85)',
}}>
}}
>
{json.label ? (
<>
{json.label}
......@@ -1857,7 +1714,8 @@ export default class tableCom extends Component {
position: 'relative',
top: '-0.5px',
margin: '0 8px 0 2px',
}}>
}}
>
:
</span>
</>
......@@ -1869,7 +1727,8 @@ export default class tableCom extends Component {
position: 'relative',
top: '-0.5px',
margin: '0 8px 0 2px',
}}>
}}
>
:
</span>
</>
......@@ -1884,7 +1743,8 @@ export default class tableCom extends Component {
lineHeight: '40px',
zoom: 1,
fontSize: 14,
}}>
}}
>
{cm}
</Col>
</Row>
......@@ -1894,7 +1754,8 @@ export default class tableCom extends Component {
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}>
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
>
{cm}
</Form.Item>
);
......@@ -1905,7 +1766,8 @@ export default class tableCom extends Component {
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}>
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
>
{cm}
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
......@@ -2008,7 +1870,8 @@ export default class tableCom extends Component {
<span
style={{
wordBreak: 'break-all',
}}>
}}
>
{obj[dataColumn.base52]}
</span>
);
......@@ -2022,7 +1885,8 @@ export default class tableCom extends Component {
<span
style={{
wordBreak: 'break-all',
}}>
}}
>
{obj[dataColumn.base52]}
</span>
);
......@@ -2051,8 +1915,7 @@ export default class tableCom extends Component {
cm = (
<span>
{labels != null
? labels.map(
(r, i) =>
? labels.map((r, i) =>
i == 0 ? (
typeof r == 'string' ? (
<span>{r}</span>
......@@ -2165,7 +2028,7 @@ export default class tableCom extends Component {
/**
* 判断返回值是否为JSON字符串,不是则直接使用
*/
if (this.isJSON(obj[dataColumn.base52])) {
if (isJSON(obj[dataColumn.base52])) {
ary = JSON.parse(obj[dataColumn.base52]);
} else {
ary = obj[dataColumn.base52];
......@@ -2229,7 +2092,8 @@ export default class tableCom extends Component {
<a
target="_blank"
key={f.filePath}
href={queryApiActionPath() + f.filePath}>
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li>
......@@ -2500,7 +2364,8 @@ export default class tableCom extends Component {
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</Form.Item>
);
......@@ -2541,14 +2406,15 @@ export default class tableCom extends Component {
: [{ required: required, message: '请选择' + title }],
})}
disabled={disabled}
onClick={(checked) => {
onClick={checked => {
// set new value
this.props.form.setFieldsValue({
[dataColumn.base52]: checked,
});
}}
/>
}>
}
>
{(json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel)
? title
......@@ -2605,7 +2471,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2646,7 +2513,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2677,7 +2545,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2712,7 +2581,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2731,6 +2601,8 @@ export default class tableCom extends Component {
break;
case 'Select':
// console.table(selectDis, disabled);
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules:
......@@ -2757,7 +2629,7 @@ export default class tableCom extends Component {
? setTimeout(() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map((item) => {
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
// ary.map(arr => {
......@@ -2773,9 +2645,10 @@ export default class tableCom extends Component {
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
: false
}>
}
>
{options && options instanceof Array
? options.map((r) => (
? options.map(r => (
<Option key={r.value} value={r.value}>
{r.label}
</Option>
......@@ -2794,7 +2667,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2829,20 +2703,14 @@ export default class tableCom extends Component {
style={{ width: json.width }}
/>,
);
if(get === 'mobile') {
if (get === 'mobile') {
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }],
})(
<MobileCascader options={options}
label={title}
disabled={disabled}
json={json}
/>);
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
}
if (
......@@ -2856,7 +2724,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2912,7 +2781,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -2961,7 +2831,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3033,7 +2904,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3047,7 +2919,6 @@ export default class tableCom extends Component {
files = initValue.files;
}
cm = getFieldDecorator(dataColumn.base52, {
initialValue: { files: files },
rules: [
......@@ -3064,7 +2935,8 @@ export default class tableCom extends Component {
},
],
})(
<UploadCom isMultiple={json.isMultiple}
<UploadCom
isMultiple={json.isMultiple}
accept={json.accept}
btnName={json.btnName}
disabled={disabled || isPreview}
......@@ -3081,7 +2953,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3106,7 +2979,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3149,14 +3023,14 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
}
break;
case 'ChildForm':
cm = getFieldDecorator(dataColumn.base52, { initialValue: initValue || {} })(
<ChildForm
taskId={this.props.taskId}
......@@ -3196,7 +3070,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3221,7 +3096,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3246,7 +3122,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3280,7 +3157,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
);
......@@ -3324,7 +3202,8 @@ export default class tableCom extends Component {
{...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle}>
title={modalTitle}
>
<ZdyTable
taskId={this.props.taskId}
taskAssignee={taskAssignee}
......@@ -3361,7 +3240,8 @@ export default class tableCom extends Component {
style={{
minHeight: 40,
lineHeight: '40px',
}}>
}}
>
<Col
className={title ? styles.row_col_div : ''}
span={json.labelSpan}
......@@ -3372,7 +3252,8 @@ export default class tableCom extends Component {
overflow: 'hidden',
fontSize: 14,
color: 'rgba(0,0,0,0.85)',
}}>
}}
>
{title}
{title && (
<span
......@@ -3380,7 +3261,8 @@ export default class tableCom extends Component {
position: 'relative',
top: '-0.5px',
margin: '0 8px 0 2px',
}}>
}}
>
:
</span>
)}
......@@ -3392,7 +3274,8 @@ export default class tableCom extends Component {
lineHeight: '40px',
zoom: 1,
fontSize: 14,
}}>
}}
>
{cm}
</Col>
{modalCode ? (
......@@ -3400,7 +3283,8 @@ export default class tableCom extends Component {
{...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle}>
title={modalTitle}
>
<ZdyTable
taskId={this.props.taskId}
taskAssignee={taskAssignee}
......@@ -3435,7 +3319,8 @@ export default class tableCom extends Component {
{...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle}>
title={modalTitle}
>
<ZdyTable
taskId={this.props.taskId}
taskAssignee={taskAssignee}
......@@ -3463,7 +3348,8 @@ export default class tableCom extends Component {
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</Form.Item>
</>
......@@ -3477,7 +3363,8 @@ export default class tableCom extends Component {
{...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle}>
title={modalTitle}
>
<ZdyTable
taskId={this.props.taskId}
taskAssignee={taskAssignee}
......@@ -3514,7 +3401,8 @@ export default class tableCom extends Component {
{...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle}>
title={modalTitle}
>
<ZdyTable
taskId={this.props.taskId}
taskAssignee={taskAssignee}
......@@ -3544,7 +3432,8 @@ export default class tableCom extends Component {
isPreview={isPreview}
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</MobileItem>
) : isEdit && get == 'web' ? (
......@@ -3552,7 +3441,8 @@ export default class tableCom extends Component {
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}>
label={title}
>
{cm}
</Form.Item>
) : (
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论