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

垃圾代码删除

上级 643e2eff
/**
* 徐立
* 2019年9月25日
* 自定义表单表格
*/
import React, { Component } from 'react';
import { Form, Row, Col, Input, message } from 'antd';
import UUID from 'react-native-uuid';
import { Toast } from 'antd-mobile';
import router from 'umi/router';
import moment from 'moment';
import { HyperFormula } from 'hyperformula';
import TableCom from '../tableComponV2';
import IsNewTable from './isNewMobileTable';
import maintain from '../assets/maintain.png';
import { isJSON } from '@/webPublic/one_stop_public/copy';
// import moment2 from 'moment-timezone'
export default class ZdyTable extends Component {
constructor(props) {
super(props);
this.state = {
objRealTime: {},
isChange: false,
selects: new Map(),
left: 0,
top: 0,
max: 4,
formId: null,
formCode: null,
width: 100,
mapData: {},
defaultBinds: {},
sqlData: {},
defaultValues: {},
currentFormKey: null,
currentFormTitle: null,
items: [],
init: this.props.init || {},
datas: {},
isEdit: true,
isRowCol: false,
isReady: false,
formConfig: {},
};
}
componentDidMount() {
const {
postData, // 数据源
isCg, // 用户点击草稿页面进入
isForm,
isPreview, // 是否为预览模式
isChild, // 是否为子表单
isQRCode = false, // 是否为二维码快捷发起
formDeafault = '', // 为二维码快捷发起默认值
} = this.props;
// if(this.props.currentFormKey === 'aa20cdbd-2019-45ea-8cdf-715aa46e132e'){
// }
if (isPreview || isChild) {
this.initExcel({ datas: this.props.datas, trees: this.props.trees }, () => {
this.setState({
...this.state,
...this.props,
formConfig: { ...this.state.formConfig, style: this.props.style },
isReady: true,
viewMode:
this.props.currentFormKey &&
this.props.datas &&
this.props.datas[this.props.currentFormKey]
? this.props.datas[this.props.currentFormKey].viewMode
: null,
});
});
return;
}
const val = postData;
try {
/**
* 数据源不同进行以下区别处理
* this.props.table有传入值表明需要渲染流程中最新表单
*/
if (isForm) {
// 由表格的操作按钮进入
const mapData = {};
const sqlData = {};
const dataObjs = val.form.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const sqls = val.form.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const obj = JSON.parse(val.form.content);
const xxx = obj.datas[obj.init];
const fk = this.props.table ? val.formKey : obj.init;
this.initExcel(obj, () => {
this.setState({
datas: obj.datas,
width: this.props.table ? obj.datas[val.formKey].width : xxx.width,
isBorder: this.props.table ? obj.datas[val.formKey].isBorder : xxx.isBorder,
viewMode: this.props.table ? obj.datas[val.formKey].viewMode : xxx.viewMode,
isRowCol: this.props.table ? obj.datas[val.formKey].isRowCol : xxx.isRowCol,
mapData,
currentFormKey: fk,
currentFormTitle: this.getCurrentFormTitle(obj, fk),
sqlData,
isEdit: !this.props.formKey,
items: this.props.table ? obj.datas[val.formKey].items : xxx.items,
defaultValues: val.form.defaultValues,
appId: val.appId,
isReady: true,
formConfig: xxx,
});
});
return;
}
if (isCg === 'yes') {
// 用户从编辑按钮进入
if (
val.unifiedServicePatternModel.isDefaultError != null &&
val.unifiedServicePatternModel.isDefaultError
) {
if (this.props.get == 'web') {
message.error('当前办理人数较多,服务繁忙,请稍后再试!');
} else {
Toast.fail('当前办理人数较多,服务繁忙,请稍后再试!');
}
router.goBack();
return;
}
const mapData = {};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const dataObjs = val.unifiedServicePatternModel.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[obj.init];
this.initExcel(obj, () => {
this.setState({
items: xxx.items,
init: { ...this.state.init, ...JSON.parse(val.content) },
datas: obj.datas,
isEdit: !this.props.formKey,
currentFormKey: obj.init,
currentFormTitle: this.getCurrentFormTitle(obj, obj.init),
width: xxx.width,
isBorder: xxx.isBorder,
viewMode: xxx.viewMode,
isRowCol: xxx.isRowCol,
mapData,
sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
appId: val.appId,
isReady: true,
formConfig: xxx,
defaultBinds: this.props.table
? obj.datas[val.taskFormKey].defaultBinds
: xxx.defaultBinds,
});
});
return;
}
if (
val.unifiedServicePatternModel.isDefaultError != null &&
val.unifiedServicePatternModel.isDefaultError
) {
if (this.props.get == 'web') {
message.error('当前办理人数较多,服务繁忙,请稍后再试!');
} else {
Toast.fail('当前办理人数较多,服务繁忙,请稍后再试!');
}
router.goBack();
return;
}
const mapData = {};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const dataObjs = val.unifiedServicePatternModel.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
if (!isJSON(val.unifiedServicePatternModel.content)) {
console.error('unifiedServicePatternModel.content 不是一个JSON字符串 请查看配置');
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
const fk = this.props.formKey
? this.props.formKey
: val.taskFormKey
? val.taskFormKey
: obj.init;
// console.log('231--------');
this.initExcel(obj, () =>
this.setState(
{
appId: val.id,
formId: val.id,
formCode: val.code,
datas: obj.datas,
mapData,
sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
isEdit: !this.props.formKey,
currentFormKey: fk,
currentFormTitle: this.getCurrentFormTitle(obj, fk),
defaultBinds: this.props.table
? obj.datas[val.taskFormKey].defaultBinds
: xxx.defaultBinds,
width: this.props.table ? obj.datas[val.taskFormKey].width : xxx.width,
isBorder: this.props.table ? obj.datas[val.taskFormKey].isBorder : xxx.isBorder,
isRowCol: this.props.table ? obj.datas[val.taskFormKey].isRowCol : xxx.isRowCol,
viewMode: this.props.table ? obj.datas[val.taskFormKey].viewMode : xxx.viewMode,
items: this.props.table ? obj.datas[val.taskFormKey].items : xxx.items,
isReady: true,
init: { ...this.state.init, ...(val.isSecond ? this.props.obj : {}) }, // 重新发起就拿obj 里面的值给初始值
formConfig: xxx,
// init:this.props.get==="mobile"?!!val.content?JSON.parse(val.content):'':{},// 移动端默认值设置
},
() => {
/**
* 为二维码快捷发起时自动设置新默认值
*/
if (isQRCode) {
this.props.form.setFieldsValue(formDeafault);
}
this.initExcel(obj);
},
),
);
} catch (e) {
console.log('公式配置有误/Table/index-262', e);
}
}
importExcel = (res, callback) => {
if(this.props.importExcel) {
this.props.importExcel(res,callback);
return }
const { datas, trees } = this.configs;
const sheets = res.sheets;
for (var s = 0; s < sheets.length; s++) {
const uuid = sheets[s].key;
const items = [];
const cc = sheets[s].cells;
for (var i = 0; i < cc.length; i++) {
const rows = [];
const rr = cc[i];
for (var j = 0; j < rr.length; j++) {
const c = rr[j];
if (c.value == null || c.value == '') {
rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'),
row: c.rowSpan,
col: c.colSpan,
content: { comName: 'Excel', cwidth: c.width, cheight: c.height },
});
} else {
rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'),
row: c.rowSpan,
col: c.colSpan,
content: {
comName: 'Excel',
initialValue: c.value,
cwidth: c.width,
cheight: c.height,
},
});
}
}
items.push(rows);
}
const charts = sheets[s].charts;
if (charts && charts.length > 0) {
const rows = [];
for (var j = 0; j < charts.length; j++) {
const chartModel = charts[j];
rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'),
content: {
comName: 'Echart',
columnIds: { c1: [] },
labelSpan: 24,
wrapperSpan: 24,
isLabel: false,
formula: 'return ' + JSON.stringify(chartModel.option),
},
});
items.push(rows);
}
}
if (datas[uuid] == null) {
trees.push({ title: sheets[s].name, key: uuid });
}
datas[uuid] = {
width: 400,
max: 1,
isBorder: true,
items: items,
};
}
this.initExcel(
{
datas,
trees,
},
() => {
this.setState({ isChange: !this.state.isChange }, () => {
if (callback) callback();
});
console.log('公式导入excel成功');
},
);
};
hfInstance;
childExcel = (sheetData, datas, tr) => {
if (tr.children == null || tr.children.length == 0) {
} else {
for (var c = 0; c < tr.children.length; c++) {
this.childExcel(sheetData, datas, tr.children[c]);
}
}
const data = datas[tr.key];
const all = [];
for (var i = 0; i < data.items.length; i++) {
const row = data.items[i];
const r = [];
for (var j = 0; j < row.length; j++) {
const col = row[j];
if (col.content?.comName == 'Excel') {
r.push(col.content.initialValue);
} else {
r.push('');
}
}
all.push(r);
}
sheetData[tr.title] = all;
};
configs;
initExcel = (configs, callback) => {
this.configs = configs;
// console.log(configs);
if (configs == null || configs.trees == null) {
if (callback) callback();
return;
}
const sheetData = {};
for (var key in configs.trees) {
const tr = configs.trees[key];
this.childExcel(sheetData, configs.datas, tr);
}
const hfInstance = HyperFormula.buildFromSheets(sheetData, {});
this.hfInstance = hfInstance;
if (callback) callback();
};
getCellValue = (i, j, currentTitle) => {
let hfInstance = this.props.hfInstance ? this.props.hfInstance : this.hfInstance;
if (hfInstance && currentTitle) {
let x = hfInstance.getCellValue({
col: j,
row: i,
sheet: hfInstance.getSheetId(currentTitle),
});
if (x && x.value != null) {
x = x.value;
}
return x;
}
};
componentWillReceiveProps(nextProps) {
const {
postData, // 数据源
isCg, // 用户点击草稿页面进入
isForm,
isPreview, // 是否为预览模式
isChild, // 是否为子表单
} = nextProps;
if (isPreview || isChild) {
this.setState(
{
...this.state,
...nextProps,
isReady: true,
viewMode:
nextProps.currentFormKey && nextProps.datas && nextProps.datas[nextProps.currentFormKey]
? nextProps.datas[nextProps.currentFormKey].viewMode
: null,
formConfig: { ...this.state.formConfig, style: nextProps.style },
},
() => this.initExcel({ datas: nextProps.datas, trees: nextProps.trees }),
);
return;
}
try {
const val = postData;
/**
* 数据源不同进行以下区别处理
* this.props.table有传入值表明需要渲染流程中最新表单
*/
if (isForm) {
// 由表格的操作按钮进入
const mapData = {};
const sqlData = {};
const dataObjs = val.form.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const sqls = val.form.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const obj = JSON.parse(val.form.content);
const xxx = obj.datas[obj.init];
this.initExcel(obj, () => {
this.setState({
datas: obj.datas,
width: this.props.table ? obj.datas[val.formKey].width : xxx.width,
isRowCol: this.props.table ? obj.datas[val.formKey].isRowCol : xxx.isRowCol,
isBorder: this.props.table ? obj.datas[val.formKey].isBorder : xxx.isBorder,
mapData,
currentFormKey: this.props.table ? val.formKey : obj.init,
currentFormTitle: this.getCurrentFormTitle(obj, fk),
sqlData,
isEdit: !this.props.formKey,
items: this.props.table ? obj.datas[val.formKey].items : xxx.items,
defaultValues: val.form.defaultValues,
appId: val.appId,
isReady: true,
formConfig: xxx,
});
});
return;
}
if (isCg === 'yes') {
// 用户从编辑按钮进入
const mapData = {};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const dataObjs = val.unifiedServicePatternModel.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[obj.init];
this.initExcel(obj, () => {
this.setState({
items: xxx.items,
init: { ...this.state.init, ...JSON.parse(val.content) },
datas: obj.datas,
isEdit: !this.props.formKey,
currentFormKey: obj.init,
currentFormTitle: this.getCurrentFormTitle(obj, obj.init),
width: xxx.width,
isBorder: xxx.isBorder,
isRowCol: xxx.isRowCol,
mapData,
sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
appId: val.appId,
isReady: true,
formConfig: xxx,
defaultBinds: this.props.table
? obj.datas[val.taskFormKey].defaultBinds
: xxx.defaultBinds,
});
});
return;
}
const mapData = {};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels;
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const dataObjs = val.unifiedServicePatternModel.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
if (this.props.isQuery) return;
const fk = this.props.formKey
? this.props.formKey
: val.taskFormKey
? val.taskFormKey
: obj.init;
this.initExcel(obj, () => {
this.setState({
appId: val.id,
datas: obj.datas,
mapData,
sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
isEdit: !this.props.formKey,
currentFormKey: fk,
currentFormTitle: this.getCurrentFormTitle(obj, fk),
defaultBinds: this.props.table
? obj.datas[val.taskFormKey].defaultBinds
: xxx.defaultBinds,
width: this.props.table ? obj.datas[val.taskFormKey].width : xxx.width,
isBorder: this.props.table ? obj.datas[val.taskFormKey].isBorder : xxx.isBorder,
isRowCol: this.props.table ? obj.datas[val.taskFormKey].isRowCol : xxx.isRowCol,
items: this.props.table ? obj.datas[val.taskFormKey].items : xxx.items,
isReady: true,
init: {
...this.state.init,
...(val.isSecond ? this.props.obj : {}),
},
formConfig: xxx,
// init:this.props.get==="mobile"?!!val.content?JSON.parse(val.content):'':{},// 移动端默认值设置
});
});
} catch (e) {
console.log('公式配置有误Table/index.jsx/572', e);
}
}
checkAllHidden = (row) => {
for (var i = 0; i < row.length; i++) {
if (row[i].hidden == null || !row[i].hidden) {
return false;
}
}
for (var i = 0; i < row.length; i++) {
delete row[i].hidden;
}
return true;
};
countMax = (items) => {
let max = 0;
items.forEach((r) => {
if (r.length > max) {
max = r.length;
}
});
return max;
};
getCurrentFormTitle = (obj, key) => {
if (obj == null) return;
const { trees } = obj;
if (trees == null) return;
return this.getT(trees, key);
};
getCurrentFormTitle2 = (key) => {
if (this.configs == null) return;
const trees = this.configs&&this.configs.trees?this.configs.trees:this.props.trees;
if (trees == null) return;
return this.getT(trees, key);
};
setRealTimeValues = (obj) => {
this.setState({ objRealTime: obj });
};
getT = (trees, key) => {
for (var i in trees) {
if (trees[i].key == key) {
return trees[i].title;
}
if (trees[i].children != null&& trees[i].children.length> 0) {
const x = this.getT(trees[i].children, key);
if(x!=null) return x
}
}
return null;
};
render() {
const {
width,
isRowCol,
isBorder,
sqlData,
mapData,
defaultBinds,
defaultValues,
items,
init,
modalTitle,
currentFormKey,
currentFormTitle,
isEdit,
datas,
isReady,
formConfig,
formCode,
formId,
viewMode,
} = this.state;
const {
border,
obj,
index,
fatherCode,
routerState, // 场景设计器共享路由参数
messageData, // 场景设计器共享变量参数 设计器监听到参数发生变化后会重新渲染组件
postData,
modalInit,
concealModel, // 场景设计器内置跳转函数
paddingBottom,
taskAssignee,
userId,
isDynamic, // 是否为大数据页面
isWebPrint, // 打印界面
isWebPrintEnd,
isPreview,
} = this.props;
const trees = this.configs&&this.configs.trees?this.configs.trees:this.props.trees;
let get;
if (viewMode != null && viewMode != '') {
get = viewMode;
} else {
get = this.props.get;
}
let style = {};
if (formConfig.style != null) {
try {
style = JSON.parse(formConfig.style);
} catch (e) {
//console.log(e);
style = {};
}
}
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 24 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 24 },
},
};
const max = this.countMax(items);
const borderStyle = {
borderRight: '1px solid gray',
borderTop: '1px solid gray',
borderLeft: '1px solid gray',
borderBottom: '1px solid gray',
};
const borderStyleTwo = {
// 处理隐藏组件边框样式问题
borderRight: '1px solid gray',
borderLeft: '1px solid gray',
borderTop: '1px solid gray',
};
let updateTime;
const styleDiv = this.props.height
? {
overflow: isDynamic ? 'hidden' : 'auto',
// overflowY: isDynamic && 'auto',
width: '100%',
height: this.props.height,
paddingBottom: paddingBottom != null ? paddingBottom : isWebPrint ? 0 : '10px',
}
: {
overflow: isDynamic ? 'hidden' : 'auto',
// overflowY: isDynamic && 'auto',
width: '100%',
paddingBottom: paddingBottom != null ? paddingBottom : isWebPrint ? 0 : '10px',
};
if (!isReady) return <></>;
if (this.props.postData?.isUpdate) {
updateTime = moment(+this.props.postData?.updateTime).format('llll');
}
if (this.props.currentFormKey === 'aa20cdbd-2019-45ea-8cdf-715aa46e132e') {
console.log(this);
}
switch (get) {
case 'web':
return (
<>
{this.props.postData?.isUpdate ? (
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ marginRight: 30 }} src={maintain} />
</div>
<p
style={{
textAlign: 'center',
width: '100%',
fontSize: '16px',
fontWeight: 'bold',
color: '#666666',
}}>
{updateTime !== 'Invalid date'
? `升级维护中,预计${updateTime ?? '一万年'}恢复使用,请耐心等待。`
: '请耐心等待'}
</p>
</div>
) : (
<div id="web_table">
<Form className="login-form">
{isEdit && defaultBinds
? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k];
if (
r.columnIds == null ||
r.columnIds.length < 2 ||
r.sqls == null ||
r.sqls.length < 2
) {
return '';
}
const name = r.columnIds[r.columnIds.length - 1];
const key = r.sqls[r.sqls.length - 1];
const value = defaultValues[key];
if (value === null || value === undefined) {
return '';
}
return this.props.form.getFieldDecorator(name, {
initialValue: value,
})(<Input type="hidden" />);
})
: ''}
<Row>
<Col span={24}>
<div
style={styleDiv}
ref={(ref) => {
this.root = ref;
}}>
<table
style={{
overflow: 'auto',
margin: max * width > 550 ? 'auto' : '',
marginBottom: isWebPrint ? (isWebPrintEnd ? '5px' : 0) : '1px',
...style,
}}
border={border}
cellSpacing="0"
cellPadding="0">
<tbody>
{items.map((row, i) => {
const allhidden = this.checkAllHidden(row);
return (
<tr key={i}>
{row.map((cell, j) => {
if (!cell.content) {
return;
}
let styles = {};
if (cell.content && cell.content.styles) {
try {
styles = JSON.parse(cell.content.styles);
} catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`);
}
}
return !allhidden && cell.hidden ? (
''
) : (
<td
width={
i == 0
? (cell.content != null && cell.content.cwidth != null
? cell.content.cwidth
: width) * (cell.col ? cell.col : 1)
: width * (cell.col ? cell.col : 1)
}
rowSpan={cell.row}
colSpan={cell.col}
key={j}
style={{
overflow: 'auto',
textAlign:
cell.content && cell.content.calign
? cell.content.calign
: 'left',
...(isBorder
? cell?.content?.comName == 'InputHidden' ||
!cell?.content?.comName
? {}
: borderStyle
: {}),
// position: cell.content&&cell.content.comName ==="InputHidden"&&'absolute',
...styles,
display:
cell.content &&
(cell.content.comName === 'InputHidden' ||
cell.content.isHidden) &&
'none',
}}>
<TableCom
changedValues={this.props.changedValues}
taskId={this.props.taskId}
importExcel={this.importExcel}
getCellValue={this.getCellValue}
getCurrentFormTitle={this.getCurrentFormTitle2}
hfInstance={this.hfInstance}
isWebPrintEnd={isWebPrintEnd}
isWebPrint={isWebPrint}
isPrint={this.props.isPrint}
formCode={formCode} // 当前表单code
modalInit={modalInit}
taskAssignee={taskAssignee} // 提交人
userId={userId}
formId={formId} // 当前表单Id
i={i} // 当前组件下标
j={j} // 当前行数下班
isPreview={isPreview}
fatherCode={fatherCode}
index={index}
fatherObj={this.props.fatherObj}
datas={datas}
uuid={cell.uuid}
setRealTimeValues={this.setRealTimeValues}
isEdit={isEdit}
formKey={currentFormKey}
currentFormTitle={currentFormTitle}
init={init}
get={get} // 区分移动端或wen端
json={cell.content}
obj={{ ...obj, ...this.state.objRealTime } || {}} // 是否存在默认值
mapData={mapData}
form={this.props.form} // antd form控件
sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值
routerState={routerState} // 兼容表单设计器路由传参
messageData={messageData} // 场景设计器共享变量参数
concealModel={concealModel || {}} // 场景设计器内置路由跳转函数
isDynamic={isDynamic} // 是否为场景配置器调用
trees={trees}
/>
</td>
);
})}
</tr>
);
})}
</tbody>
</table>
{style.pageBreakAfter != null ? (
<div style={{ pageBreakAfter: style.pageBreakAfter }} />
) : (
''
)}
</div>
</Col>
</Row>
</Form>
</div>
)}
</>
);
case 'mobile':
return (
<>
{this.props.postData?.isUpdate ? (
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ width: '100%' }} src={maintain} />
</div>
<p
style={{
textAlign: 'center',
width: '100%',
fontSize: '16px',
fontWeight: 'bold',
color: '#666666',
}}>
{updateTime !== 'Invalid date'
? `升级维护中,预计${updateTime ?? '一万年'}恢复使用,请耐心等待。`
: '请耐心等待'}
</p>
</div>
) : (
<Form {...formItemLayout} id="mobile_table" className="login-form">
{defaultBinds
? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k];
if (
r.columnIds == null ||
r.columnIds.length < 2 ||
r.sqls == null ||
r.sqls.length < 2
) {
return '';
}
const name = r.columnIds[r.columnIds.length - 1];
const key = r.sqls[r.sqls.length - 1];
const value = defaultValues[key];
if (value === null || value === undefined) {
return '';
}
return this.props.form.getFieldDecorator(name, {
initialValue: value,
})(<Input type="hidden" />);
})
: ''}
<IsNewTable
changedValues={this.props.changedValues}
taskId={this.props.taskId}
getCellValue={this.getCellValue}
hfInstance={this.hfInstance}
getCurrentFormTitle={this.getCurrentFormTitle2}
taskAssignee={taskAssignee} // 提交人
userId={userId}
importExcel={this.importExcel}
isPreview={isPreview}
trees={trees}
setRealTimeValues={this.setRealTimeValues}
isRowCol={isRowCol}
modalInit={modalInit}
items={items}
checkAllHidden={this.checkAllHidden}
isBorder={isBorder}
borderStyle={borderStyle}
fatherCode={fatherCode}
index={index}
datas={datas}
isEdit={isEdit}
currentFormKey={currentFormKey}
currentFormTitle={currentFormTitle}
init={init}
get={get}
obj={{ ...obj, ...this.state.objRealTime }}
mapData={mapData}
form={this.props.form}
sqlData={sqlData}
defaultValues={defaultValues}
width={width}
formCode={formCode}
style={style}
routerState={routerState} // 兼容表单设计器路由传参
messageData={messageData} // 场景设计器共享变量参数
formId={formId}
fatherObj={this.props.fatherObj}
concealModel={concealModel || {}} // 场景设计器内置路由跳转函数
isDynamic={isDynamic} // 是否为场景配置器调用
/>
</Form>
)}
</>
);
}
}
}
/**
* 测试新表格
*/
import React, { Component } from 'react';
import { Row, Col } from 'antd';
import TableCom from '../tableComponV2/index';
export default class IsNewTable extends Component {
render() {
const {
items,
checkAllHidden,
fatherCode,
userId,
index,
datas,
isEdit,
currentFormKey,
init,
get,
obj,
mapData,
sqlData,
defaultValues,
routerState,
messageData,
formCode,
formId,
style,
isPreview,
modalInit,
concealModel,
taskAssignee,
currentFormTitle,
getCellValue,
hfInstance,
trees,
getCurrentFormTitle,
changedValues
} = this.props;
if (!isEdit) {
// 展示栏 暂不做处理
return (
<>
{items.map((item, i) => {
const allhidden = checkAllHidden(items);
return (
<div
key={item && Array.isArray(item) && item.length > 0 ? item[0].uuid : i}
style={{
marginTop: 0,
background: '#ffffff',
width: '100%',
flexWrap: 'wrap',
...style,
}}>
{item.map((ary, j) => {
let styles = {};
if (ary.content && ary.content.styles) {
try {
styles = JSON.parse(ary.content.styles);
} catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`);
}
}
return !allhidden && ary.hidden ? (
''
) : (
<div
key={ary.uuid || j}
style={{
...styles,
textAlign: 'left',
borderBottom: '1px solid white',
display:
ary.content &&
(ary.content.comName === 'InputHidden' || ary.content.isMobileHidden) &&
'none',
}}>
<TableCom
changedValues={changedValues}
taskAssignee={taskAssignee} // 提交人
trees={trees}
userId={userId}
modalInit={modalInit}
formCode={formCode}
formId={formId}
isPreview={isPreview}
i={i}
j={j}
taskId={this.props.taskId}
setRealTimeValues={this.props.setRealTimeValues}
index={index}
getCurrentFormTitle={getCurrentFormTitle}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
currentFormTitle={currentFormTitle}
hfInstance={hfInstance}
getCellValue={getCellValue}
initExcel={this.props.initExcel}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
concealModel={concealModel} // 场景设计器路由跳转参数
/>
</div>
);
})}
</div>
);
})}
</>
);
}
return items.map((item, i) => {
const allhidden = checkAllHidden(items);
return (
<Row
key={item && Array.isArray(item) && item.length > 0 ? item[0].uuid : i}
style={{
...style,
}}>
{item.map((ary, j) => {
let styles = {};
if (ary.content && ary.content.styles) {
try {
styles = JSON.parse(ary.content.styles);
} catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`);
}
}
if (ary.content?.comName === 'Label') {
return (
<Col
key={ary.uuid || j}
style={{
display:
ary.content &&
(ary.content.comName === 'InputHidden' || ary.content.isMobileHidden) &&
'none',
...styles,
}}
span={ary.content?.labelSpan || 24}>
{!allhidden && ary.hidden ? (
''
) : (
<>
<TableCom
changedValues={changedValues}
trees={trees}
formCode={formCode}
taskAssignee={taskAssignee}
formId={formId}
modalInit={modalInit}
i={i}
j={j}
taskId={this.props.taskId}
isPreview={isPreview}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
setRealTimeValues={this.props.setRealTimeValues}
getCurrentFormTitle={getCurrentFormTitle}
importExcel={this.props.importExcel}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
currentFormTitle={currentFormTitle}
hfInstance={hfInstance}
getCellValue={getCellValue}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/>
</>
)}
</Col>
);
}
return (
<Col
key={ary.uuid || j}
span={24}
style={{
display:
ary.content &&
(ary.content.comName === 'InputHidden' || ary.content.isMobileHidden) &&
'none',
...styles,
}}>
{!allhidden && ary.hidden ? (
''
) : (
<>
<TableCom
changedValues={changedValues}
trees={trees}
formCode={formCode}
taskAssignee={taskAssignee}
formId={formId}
taskId={this.props.taskId}
isPreview={isPreview}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
modalInit={modalInit}
isEdit={isEdit}
getCurrentFormTitle={getCurrentFormTitle}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
importExcel={this.props.importExcel}
currentFormTitle={currentFormTitle}
hfInstance={hfInstance}
getCellValue={getCellValue}
init={init}
get={get}
key={j}
setRealTimeValues={this.props.setRealTimeValues}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/>
</>
)}
</Col>
);
})}
</Row>
);
});
}
}
...@@ -156,7 +156,7 @@ class UploadCom extends React.Component { ...@@ -156,7 +156,7 @@ class UploadCom extends React.Component {
render() { render() {
// console.log(this.props.value); // console.log(this.props.value);
const { files, previewVisible, previewImage, previewImageName } = this.state; const { files, previewVisible, previewImage, previewImageName } = this.state;
const { isMultiple, accept, btnName, disabled } = this.props; const { isMultiple, accept, btnName, disabled, dataKey } = this.props;
const props = { const props = {
name: 'file', name: 'file',
multiple: isMultiple, multiple: isMultiple,
...@@ -167,7 +167,7 @@ class UploadCom extends React.Component { ...@@ -167,7 +167,7 @@ class UploadCom extends React.Component {
beforeUpload: this.otherProps?.limitImageSize ? this.beforeUpload : undefined, beforeUpload: this.otherProps?.limitImageSize ? this.beforeUpload : undefined,
}; };
return ( return (
<div> <div data-mes={dataKey}>
{' '} {' '}
<Upload {...props} disabled={disabled}> <Upload {...props} disabled={disabled}>
{!disabled && ( {!disabled && (
......
...@@ -59,7 +59,9 @@ import DraftEditorCom from '../App/DraftEditorCom'; ...@@ -59,7 +59,9 @@ import DraftEditorCom from '../App/DraftEditorCom';
import MobileItem from './MobileItem'; import MobileItem from './MobileItem';
import MobileCascader from './CascaderDiy/MobileCascader'; import MobileCascader from './CascaderDiy/MobileCascader';
import { equal, errorHandler, getBase64, getRender, isJSON } from './Split_Index/staticInfo'; import { equal, errorHandler, getBase64, getRender, isJSON } from './Split_Index/staticInfo';
import PictureSignature, { SignArray } from "@/webPublic/one_stop_public/libs/PictureSignature/PictureSignature"; import PictureSignature, {
SignArray,
} from '@/webPublic/one_stop_public/libs/PictureSignature/PictureSignature';
import WangEditor from '@/webPublic/zyd_public/WangEditor/OnstopWang'; import WangEditor from '@/webPublic/zyd_public/WangEditor/OnstopWang';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request'; import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
...@@ -195,7 +197,11 @@ export default class tableCom extends Component { ...@@ -195,7 +197,11 @@ export default class tableCom extends Component {
value={selectedKeys[0]} 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)} onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
style={{ width: 188, marginBottom: 8, display: 'block' }} style={{
width: 188,
marginBottom: 8,
display: 'block',
}}
/> />
<Button <Button
type="primary" type="primary"
...@@ -203,7 +209,10 @@ export default class tableCom extends Component { ...@@ -203,7 +209,10 @@ export default class tableCom extends Component {
icon="search" icon="search"
loading={this.props.loading} loading={this.props.loading}
size="small" size="small"
style={{ width: 90, marginRight: 8 }} style={{
width: 90,
marginRight: 8,
}}
> >
搜索 搜索
</Button> </Button>
...@@ -234,7 +243,10 @@ export default class tableCom extends Component { ...@@ -234,7 +243,10 @@ export default class tableCom extends Component {
if (text != null) { if (text != null) {
return ( return (
<Highlighter <Highlighter
highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }} highlightStyle={{
backgroundColor: '#ffc069',
padding: 0,
}}
searchWords={[this.state.searchText]} searchWords={[this.state.searchText]}
autoEscape autoEscape
textToHighlight={text.toString()} textToHighlight={text.toString()}
...@@ -343,8 +355,9 @@ export default class tableCom extends Component { ...@@ -343,8 +355,9 @@ export default class tableCom extends Component {
} }
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` } : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj; : bindObj;
if (this.props.fatherCode == null && dataColumn == null) if (this.props.fatherCode == null && dataColumn == null) {
dataColumn = { base52: this.props.uuid }; dataColumn = { base52: this.props.uuid };
}
if (!this.props.isEdit && this.props.fatherCode) { if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) { if (bindObj != null) {
...@@ -453,7 +466,10 @@ export default class tableCom extends Component { ...@@ -453,7 +466,10 @@ export default class tableCom extends Component {
dispatch({ dispatch({
type: 'DataColumn/getSqlData', type: 'DataColumn/getSqlData',
payload: { sqlKey, allValues }, payload: {
sqlKey,
allValues,
},
callback: list => { callback: list => {
const x = { const x = {
list: list, list: list,
...@@ -524,7 +540,7 @@ export default class tableCom extends Component { ...@@ -524,7 +540,7 @@ export default class tableCom extends Component {
json.labelName, json.labelName,
json.valueName, json.valueName,
allValues, allValues,
json.isMeta json.isMeta,
); );
} }
break; break;
...@@ -668,9 +684,15 @@ export default class tableCom extends Component { ...@@ -668,9 +684,15 @@ export default class tableCom extends Component {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => { this.setState(
if (orgCallback) orgCallback(); {
}); options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
} }
} else if (json.comName == 'Button') { } else if (json.comName == 'Button') {
try { try {
...@@ -747,44 +769,42 @@ export default class tableCom extends Component { ...@@ -747,44 +769,42 @@ export default class tableCom extends Component {
if (reqUrls && reqUrls[url]) { if (reqUrls && reqUrls[url]) {
reqUrls[url].data = data; reqUrls[url].data = data;
} }
this.setState({ res: data, reqUrls }, () => { this.setState(
if (callback) { {
if (json.optionType && json.optionType == 'func') { res: data,
const res = callback(data); reqUrls,
if (res != null && !(typeof res === 'function')) { },
this.setState({ options: res, selectDis: false }, () => { () => {
if (orgCallback) orgCallback(); if (callback) {
}); if (json.optionType && json.optionType == 'func') {
} const res = callback(data);
} else if (json.comName == 'Button') { if (res != null && !(typeof res === 'function')) {
try { this.setState(
callback(data); {
} catch (e) { options: res,
console.log( selectDis: false,
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this },
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`, () => {
e, if (orgCallback) orgCallback();
); },
} );
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
} }
} catch (e) { } else if (json.comName == 'Button') {
console.log( try {
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this callback(data);
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`, } catch (e) {
e, console.log(
); `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
} .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
} else { e,
if (base52) { );
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
// console.log(x, '757'); if (x != null) {
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); this.setState({ option: x });
}
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
...@@ -792,16 +812,31 @@ export default class tableCom extends Component { ...@@ -792,16 +812,31 @@ export default class tableCom extends Component {
e, e,
); );
} }
} else {
if (base52) {
try {
const x = callback(data);
// console.log(x, '757');
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${
json.comName
}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
}
} }
} }
} },
}); );
}); });
return 'norefeshxxxxxxxxxxxxxxxxxxxx'; return 'norefeshxxxxxxxxxxxxxxxxxxxx';
}; };
sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => { sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => {
// console.log({ // console.log({
// base52, json, orgCallback, sqlKey, params, callback, options // base52, json, orgCallback, sqlKey, params, callback, options
// }) // })
...@@ -837,7 +872,10 @@ export default class tableCom extends Component { ...@@ -837,7 +872,10 @@ export default class tableCom extends Component {
} }
} }
} else { } else {
sqlKeys[sqlKey] = { params: params, options: options }; sqlKeys[sqlKey] = {
params: params,
options: options,
};
isChange = true; isChange = true;
} }
if (!isChange) { if (!isChange) {
...@@ -846,9 +884,15 @@ export default class tableCom extends Component { ...@@ -846,9 +884,15 @@ export default class tableCom extends Component {
if (json.optionType && json.optionType == 'func') { if (json.optionType && json.optionType == 'func') {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => { this.setState(
if (orgCallback) orgCallback(); {
}); options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
} }
} else if (json.comName == 'Button') { } else if (json.comName == 'Button') {
try { try {
...@@ -894,14 +938,17 @@ export default class tableCom extends Component { ...@@ -894,14 +938,17 @@ export default class tableCom extends Component {
const url = '/DataColumnApi/getSqlData'; const url = '/DataColumnApi/getSqlData';
this.setState({ sqlKeys }, () => { this.setState({ sqlKeys }, () => {
const allValues = JSON.stringify({ const allValues = JSON.stringify({
...this.props.obj, ...this.props.obj,
...this.props.form.getFieldsValue(), ...this.props.form.getFieldsValue(),
...this.props.defaultValues[this.props.formKey], ...this.props.defaultValues[this.props.formKey],
...options, ...options,
}); });
let pp = { sqlKey, params, allValues, }; let pp = {
sqlKey,
params,
allValues,
};
if (getToken() != null) { if (getToken() != null) {
pp.token = getToken(); pp.token = getToken();
} }
...@@ -918,9 +965,15 @@ export default class tableCom extends Component { ...@@ -918,9 +965,15 @@ export default class tableCom extends Component {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => { this.setState(
if (orgCallback) orgCallback(); {
}); options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
} }
} else if (json.comName == 'Button') { } else if (json.comName == 'Button') {
try { try {
...@@ -1067,9 +1120,15 @@ export default class tableCom extends Component { ...@@ -1067,9 +1120,15 @@ export default class tableCom extends Component {
return value; return value;
} else if (json.optionType && json.optionType == 'func') { } else if (json.optionType && json.optionType == 'func') {
if (value != null && !(typeof value === 'function')) { if (value != null && !(typeof value === 'function')) {
this.setState({ options: value, selectDis: false }, () => { this.setState(
if (callback) callback(); {
}); options: value,
selectDis: false,
},
() => {
if (callback) callback();
},
);
} }
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
this.setState({ option: value }); this.setState({ option: value });
...@@ -1122,8 +1181,9 @@ export default class tableCom extends Component { ...@@ -1122,8 +1181,9 @@ export default class tableCom extends Component {
} }
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` } : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj; : bindObj;
if (this.props.fatherCode == null && dataColumn == null) if (this.props.fatherCode == null && dataColumn == null) {
dataColumn = { base52: this.props.uuid }; dataColumn = { base52: this.props.uuid };
}
if (!this.props.isEdit && this.props.fatherCode) { if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) { if (bindObj != null) {
...@@ -1139,13 +1199,17 @@ export default class tableCom extends Component { ...@@ -1139,13 +1199,17 @@ export default class tableCom extends Component {
} }
} }
fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues,isMeta) => { fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues, isMeta) => {
const { dispatch } = this.props; const { dispatch } = this.props;
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
dispatch({ dispatch({
type: 'DataColumn/getSqlOptions', type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues,isMeta}, payload: {
sqlKey,
allValues,
isMeta,
},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
...@@ -1165,7 +1229,10 @@ export default class tableCom extends Component { ...@@ -1165,7 +1229,10 @@ export default class tableCom extends Component {
// console.log(base52, 1144); // console.log(base52, 1144);
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({ [base52]: null });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({
options: optionsx,
selectDis: false,
});
}, },
}); });
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
...@@ -1177,16 +1244,30 @@ export default class tableCom extends Component { ...@@ -1177,16 +1244,30 @@ export default class tableCom extends Component {
if (obj[base52]) { if (obj[base52]) {
dispatch({ dispatch({
type: 'DataColumn/getSqlLabels', type: 'DataColumn/getSqlLabels',
payload: { sqlKey, values: obj[base52], labelName, valueName, allValues,isMeta}, payload: {
sqlKey,
values: obj[base52],
labelName,
valueName,
allValues,
isMeta,
},
callback: labels => { callback: labels => {
this.setState({ labels, selectDis: false }); this.setState({
labels,
selectDis: false,
});
}, },
}); });
} }
} else { } else {
dispatch({ dispatch({
type: 'DataColumn/getSqlOptions', type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues,isMeta}, payload: {
sqlKey,
allValues,
isMeta,
},
callback: options => { callback: options => {
// console.log(options); // console.log(options);
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
...@@ -1213,7 +1294,10 @@ export default class tableCom extends Component { ...@@ -1213,7 +1294,10 @@ export default class tableCom extends Component {
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({ [base52]: null });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({
options: optionsx,
selectDis: false,
});
}, },
}); });
} }
...@@ -1240,9 +1324,15 @@ export default class tableCom extends Component { ...@@ -1240,9 +1324,15 @@ export default class tableCom extends Component {
} }
} }
this.setState({ labels: labels, selectDis: false }); this.setState({
labels: labels,
selectDis: false,
});
} else { } else {
this.setState({ options: options, selectDis: false }); this.setState({
options: options,
selectDis: false,
});
} }
}; };
fetchData = (obj, dataColumn, init, filterSql, allValues) => { fetchData = (obj, dataColumn, init, filterSql, allValues) => {
...@@ -1251,7 +1341,11 @@ export default class tableCom extends Component { ...@@ -1251,7 +1341,11 @@ export default class tableCom extends Component {
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
dispatch({ dispatch({
type: 'DataColumn/getOptions', type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues }, payload: {
id: dataColumn.id,
filterSql,
allValues,
},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
...@@ -1260,23 +1354,38 @@ export default class tableCom extends Component { ...@@ -1260,23 +1354,38 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({
options: optionsx,
selectDis: false,
});
}, },
}); });
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
if (obj[dataColumn.base52]) { if (obj[dataColumn.base52]) {
dispatch({ dispatch({
type: 'DataColumn/getLabels', type: 'DataColumn/getLabels',
payload: { id: dataColumn.id, values: obj[dataColumn.base52], filterSql, allValues }, payload: {
id: dataColumn.id,
values: obj[dataColumn.base52],
filterSql,
allValues,
},
callback: labels => { callback: labels => {
this.setState({ labels, selectDis: false }); this.setState({
labels,
selectDis: false,
});
}, },
}); });
} }
} else { } else {
dispatch({ dispatch({
type: 'DataColumn/getOptions', type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues }, payload: {
id: dataColumn.id,
filterSql,
allValues,
},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
...@@ -1285,7 +1394,10 @@ export default class tableCom extends Component { ...@@ -1285,7 +1394,10 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({
options: optionsx,
selectDis: false,
});
}, },
}); });
} }
...@@ -1346,7 +1458,6 @@ export default class tableCom extends Component { ...@@ -1346,7 +1458,6 @@ export default class tableCom extends Component {
} }
let otherProps = {}; let otherProps = {};
//私有 //私有
if (!isEdit && permRank == 1 && taskAssignee != userId) { if (!isEdit && permRank == 1 && taskAssignee != userId) {
return <></>; return <></>;
...@@ -1356,8 +1467,9 @@ export default class tableCom extends Component { ...@@ -1356,8 +1467,9 @@ export default class tableCom extends Component {
this.state.option == null || this.state.option == null ||
this.state.option.value == null || this.state.option.value == null ||
this.state.option.value == null this.state.option.value == null
) ) {
return <></>; return <></>;
}
return <QRCode {...this.state.option} key={this.props.uuid} />; return <QRCode {...this.state.option} key={this.props.uuid} />;
} }
if (json.comName == 'Echart') { if (json.comName == 'Echart') {
...@@ -1424,14 +1536,29 @@ export default class tableCom extends Component { ...@@ -1424,14 +1536,29 @@ export default class tableCom extends Component {
</> </>
); );
} }
// if(json.comName !== 'UploadCom'){ // if([
// // 'Select',
// // 'Input',
// 'InputHidden',
// // 'DatePicker',
// // 'TextArea',
// // 'Radio',
// ].includes(json.comName)){
// return null; // return null;
// // Select Input InputHidden DatePicker DatePicker TextArea Radio
// } // }
if (json.comName == 'Excel') { if (json.comName === 'Excel') {
const value = getCellValue(i, j, currentFormTitle); const value = getCellValue(i, j, currentFormTitle);
const xx = ( const xx = (
<div style={{ textAlign: 'center', height: value == null ? 20 : null }}>{value}</div> <div
style={{
textAlign: 'center',
height: value == null ? 20 : null,
}}
>
{value}
</div>
); );
return xx; return xx;
} }
...@@ -1488,19 +1615,17 @@ export default class tableCom extends Component { ...@@ -1488,19 +1615,17 @@ export default class tableCom extends Component {
var cm = ''; var cm = '';
var value; var value;
if (obj != null && obj.defaultValues) { if (obj != null && obj.defaultValues) {
let defaultValuesNew = {}; let defaultValuesNew = {};
for(let i in obj.defaultValues){ for (let i in obj.defaultValues) {
let oneFormKey = obj.defaultValues[i]; let oneFormKey = obj.defaultValues[i];
if(oneFormKey && typeof oneFormKey === 'object'){ if (oneFormKey && typeof oneFormKey === 'object') {
for(let g in oneFormKey){ for (let g in oneFormKey) {
defaultValuesNew[g] = oneFormKey[g]; defaultValuesNew[g] = oneFormKey[g];
} }
} }
} }
value = defaultValuesNew[key] || defaultValues[key] value = defaultValuesNew[key] || defaultValues[key];
/** 2022年3月4日 15点15分 姚鑫国说的 这里面的key 不会有重复的 所以直接遍历后赋值到 value 上 /** 2022年3月4日 15点15分 姚鑫国说的 这里面的key 不会有重复的 所以直接遍历后赋值到 value 上
* 解决 移动端渲染的表单和web端渲染的不同 导致获取不到默认值的bug * 解决 移动端渲染的表单和web端渲染的不同 导致获取不到默认值的bug
* 禅道bug 24669 学生事务/请假管理/请假审核,2018010347 辅导员审核时 在表中 学生的个人信息没出来 * 禅道bug 24669 学生事务/请假管理/请假审核,2018010347 辅导员审核时 在表中 学生的个人信息没出来
...@@ -1612,13 +1737,23 @@ export default class tableCom extends Component { ...@@ -1612,13 +1737,23 @@ export default class tableCom extends Component {
break; break;
case 'ImgUploadCom': // 图片上传组件 case 'ImgUploadCom': // 图片上传组件
if (value == null || value == '') { if (value == null || value == '') {
cm = <div style={{ width: json.width, height: json.height }} />; cm = (
<div
style={{
width: json.width,
height: json.height,
}}
/>
);
} else { } else {
cm = ( cm = (
<> <>
<img <img
src={config.httpServer + value} src={config.httpServer + value}
style={{ width: json.width, height: json.height }} style={{
width: json.width,
height: json.height,
}}
/> />
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
...@@ -1628,13 +1763,23 @@ export default class tableCom extends Component { ...@@ -1628,13 +1763,23 @@ export default class tableCom extends Component {
break; break;
case 'VideoUploadCom': case 'VideoUploadCom':
if (value == null || value == '') { if (value == null || value == '') {
cm = <div style={{ width: json.width, height: json.height }} />; cm = (
<div
style={{
width: json.width,
height: json.height,
}}
/>
);
} else { } else {
cm = ( cm = (
<> <>
<img <img
src={config.httpServer + value} src={config.httpServer + value}
style={{ width: json.width, height: json.height }} style={{
width: json.width,
height: json.height,
}}
/> />
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
...@@ -1882,9 +2027,13 @@ export default class tableCom extends Component { ...@@ -1882,9 +2027,13 @@ export default class tableCom extends Component {
); );
break; break;
case 'WangEditor': case 'WangEditor':
cm = (
cm = (<div dangerouslySetInnerHTML={{__html: `<div class="wangEditorHtml">${obj[dataColumn.base52]}</div>`}}> <div
</div>); dangerouslySetInnerHTML={{
__html: `<div class='wangEditorHtml'>${obj[dataColumn.base52]}</div>`,
}}
></div>
);
break; break;
case 'TextArea': case 'TextArea':
cm = ( cm = (
...@@ -2061,11 +2210,11 @@ export default class tableCom extends Component { ...@@ -2061,11 +2210,11 @@ export default class tableCom extends Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={f.path}> <li key={f.path}>
<PictureSignature json={json} <PictureSignature
disabled={true} // 只读模式 json={json}
basicUrl={queryApiActionPath()} disabled={true} // 只读模式
fileInfo={f} basicUrl={queryApiActionPath()}
fileInfo={f}
/> />
</li> </li>
); );
...@@ -2075,29 +2224,32 @@ export default class tableCom extends Component { ...@@ -2075,29 +2224,32 @@ export default class tableCom extends Component {
} else { } else {
const files = !isEmpty(ary) ? ary : []; const files = !isEmpty(ary) ? ary : [];
cm = ( cm = (
<ul className={styles.imageUl}> <ul className={styles.imageUl}>
{Array.isArray(files) && {Array.isArray(files) &&
files.map((f, index2) => { files.map((f, index2) => {
return ( return (
<li key={f.path}> <li key={f.path}>
<PictureSignature json={json} <PictureSignature
disabled={true} // 只读模式 json={json}
basicUrl={queryApiActionPath()} disabled={true} // 只读模式
fileInfo={f} basicUrl={queryApiActionPath()}
fileInfo={f}
/> />
</li> </li>
); );
})} })}
</ul> </ul>
); );
} }
} else { } else {
cm = ( cm = (
<span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}> <span
style={{
</span> display: 'inline-block',
width: '100%',
textAlign: 'center',
}}
></span>
); );
} }
...@@ -2122,7 +2274,7 @@ export default class tableCom extends Component { ...@@ -2122,7 +2274,7 @@ export default class tableCom extends Component {
// 然后判断存在多个附件的数组是否存在 // 然后判断存在多个附件的数组是否存在
const files = !isEmpty(ary) ? ary.files : []; const files = !isEmpty(ary) ? ary.files : [];
cm = ( cm = (
<ul className={styles.imageUl}> <ul className={styles.imageUl}>
{files.map((f, index2) => { {files.map((f, index2) => {
if (get === 'web' && !this.props.isPrint) { if (get === 'web' && !this.props.isPrint) {
return ( return (
...@@ -2148,7 +2300,7 @@ export default class tableCom extends Component { ...@@ -2148,7 +2300,7 @@ export default class tableCom extends Component {
} else { } else {
const files = !isEmpty(ary) ? ary : []; const files = !isEmpty(ary) ? ary : [];
cm = ( cm = (
<ul className={styles.imageUl}> <ul className={styles.imageUl}>
{Array.isArray(files) && {Array.isArray(files) &&
files.map((f, index2) => { files.map((f, index2) => {
// if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) { // if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
...@@ -2188,7 +2340,13 @@ export default class tableCom extends Component { ...@@ -2188,7 +2340,13 @@ export default class tableCom extends Component {
} }
} else { } else {
cm = ( cm = (
<span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}> <span
style={{
display: 'inline-block',
width: '100%',
textAlign: 'center',
}}
>
暂无附件 暂无附件
</span> </span>
); );
...@@ -2216,7 +2374,10 @@ export default class tableCom extends Component { ...@@ -2216,7 +2374,10 @@ export default class tableCom extends Component {
) : ( ) : (
<img <img
src={config.httpServer + obj[dataColumn.base52]} src={config.httpServer + obj[dataColumn.base52]}
style={{ width: json.width, height: json.height }} style={{
width: json.width,
height: json.height,
}}
/> />
); );
} }
...@@ -2243,7 +2404,10 @@ export default class tableCom extends Component { ...@@ -2243,7 +2404,10 @@ export default class tableCom extends Component {
) : ( ) : (
<img <img
src={config.httpServer + obj[dataColumn.base52]} src={config.httpServer + obj[dataColumn.base52]}
style={{ width: json.width, height: json.height }} style={{
width: json.width,
height: json.height,
}}
/> />
); );
} }
...@@ -2424,7 +2588,12 @@ export default class tableCom extends Component { ...@@ -2424,7 +2588,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + title }], : [
{
required: required,
message: '请选择' + title,
},
],
})} })}
disabled={disabled} disabled={disabled}
onClick={checked => { onClick={checked => {
...@@ -2455,7 +2624,12 @@ export default class tableCom extends Component { ...@@ -2455,7 +2624,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + title }], : [
{
required: required,
message: '请选择' + title,
},
],
})( })(
<Switch <Switch
disabled={disabled} disabled={disabled}
...@@ -2468,7 +2642,8 @@ export default class tableCom extends Component { ...@@ -2468,7 +2642,8 @@ export default class tableCom extends Component {
case 'TextArea': case 'TextArea':
if (json?.otherProps) { if (json?.otherProps) {
otherProps = json?.otherProps; otherProps = json?.otherProps;
try { // mode = multiple 就支持下拉多选了 try {
// mode = multiple 就支持下拉多选了
otherProps = new Function(otherProps)(); otherProps = new Function(otherProps)();
} catch (e) { } catch (e) {
otherProps = {}; otherProps = {};
...@@ -2480,7 +2655,12 @@ export default class tableCom extends Component { ...@@ -2480,7 +2655,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [
{
required: required,
message: '请输入' + title,
},
],
})( })(
<TextArea <TextArea
autoSize={{ minRows: 4 }} autoSize={{ minRows: 4 }}
...@@ -2514,7 +2694,12 @@ export default class tableCom extends Component { ...@@ -2514,7 +2694,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [
{
required: required,
message: '请输入' + title,
},
],
})( })(
<TextArea <TextArea
autoSize={{ minRows: 4 }} autoSize={{ minRows: 4 }}
...@@ -2532,7 +2717,12 @@ export default class tableCom extends Component { ...@@ -2532,7 +2717,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [
{
required: required,
message: '请输入' + title,
},
],
})( })(
<Input <Input
disabled={disabled} disabled={disabled}
...@@ -2571,7 +2761,12 @@ export default class tableCom extends Component { ...@@ -2571,7 +2761,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [
{
required: required,
message: '请输入' + title,
},
],
})( })(
<InputNumber <InputNumber
disabled={disabled} disabled={disabled}
...@@ -2612,7 +2807,12 @@ export default class tableCom extends Component { ...@@ -2612,7 +2807,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled} />); })(<Radio.Group options={options} disabled={disabled} />);
if (get == 'mobile') { if (get == 'mobile') {
cm = <div>{cm}</div>; cm = <div>{cm}</div>;
...@@ -2647,7 +2847,12 @@ export default class tableCom extends Component { ...@@ -2647,7 +2847,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled} />)} })(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex> </Flex>
); );
...@@ -2677,14 +2882,25 @@ export default class tableCom extends Component { ...@@ -2677,14 +2882,25 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
})(<Checkbox.Group options={options} disabled={disabled} />); {
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Checkbox.Group
options={options}
disabled={disabled}
data-base52={dataColumn.base52}
/>,
);
break; break;
case 'Select': case 'Select':
if (json?.otherProps) { if (json?.otherProps) {
otherProps = json?.otherProps; otherProps = json?.otherProps;
try { // mode = multiple 就支持下拉多选了 try {
// mode = multiple 就支持下拉多选了
otherProps = new Function(otherProps)(); otherProps = new Function(otherProps)();
} catch (e) { } catch (e) {
otherProps = {}; otherProps = {};
...@@ -2695,7 +2911,12 @@ export default class tableCom extends Component { ...@@ -2695,7 +2911,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})( })(
<Select <Select
allowClear allowClear
...@@ -2770,7 +2991,8 @@ export default class tableCom extends Component { ...@@ -2770,7 +2991,8 @@ export default class tableCom extends Component {
//zsz //zsz
if (json?.otherProps) { if (json?.otherProps) {
otherProps = json?.otherProps; otherProps = json?.otherProps;
try { // mode = multiple 就支持下拉多选了 try {
// mode = multiple 就支持下拉多选了
otherProps = new Function(otherProps)(); otherProps = new Function(otherProps)();
} catch (e) { } catch (e) {
otherProps = {}; otherProps = {};
...@@ -2786,7 +3008,12 @@ export default class tableCom extends Component { ...@@ -2786,7 +3008,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})( })(
<Cascader // 这里的options 获取方式存在bug 公式会重复调用 <Cascader // 这里的options 获取方式存在bug 公式会重复调用
options={options} options={options}
...@@ -2812,11 +3039,13 @@ export default class tableCom extends Component { ...@@ -2812,11 +3039,13 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [
})(<MobileCascader options={options} {
label={title} required: required,
disabled={disabled} message: '请选择' + dataColumn.title,
json={json} />); },
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
} }
if ( if (
...@@ -2850,13 +3079,13 @@ export default class tableCom extends Component { ...@@ -2850,13 +3079,13 @@ export default class tableCom extends Component {
: [ : [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
let errors = [];
if ( if (
(Object.keys(value).length == 0 || (Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) && Object.keys(value.selects).length == 0) &&
required != null && required != null &&
required required
) { ) {
var errors = [];
errors.push(new Error('请选择至少一个', rule.field)); errors.push(new Error('请选择至少一个', rule.field));
} }
callback(errors); callback(errors);
...@@ -2936,7 +3165,12 @@ export default class tableCom extends Component { ...@@ -2936,7 +3165,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [
{
required: required,
message: '请选择起止时间',
},
],
})(<MobileDate disabled={disabled} formate={json.format} required={required} />); })(<MobileDate disabled={disabled} formate={json.format} required={required} />);
if ( if (
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -2963,7 +3197,12 @@ export default class tableCom extends Component { ...@@ -2963,7 +3197,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [
{
required: required,
message: '请选择起止时间',
},
],
})( })(
<RangePicker <RangePicker
showTime={json.showTime != null ? json.showTime : true} showTime={json.showTime != null ? json.showTime : true}
...@@ -2985,7 +3224,12 @@ export default class tableCom extends Component { ...@@ -2985,7 +3224,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [
{
required: required,
message: '请选择起止时间',
},
],
})( })(
<DatePicker <DatePicker
disabled={disabled} disabled={disabled}
...@@ -3041,13 +3285,20 @@ export default class tableCom extends Component { ...@@ -3041,13 +3285,20 @@ export default class tableCom extends Component {
rules: rules:
json?.vlds && json?.vlds.length > 0 json?.vlds && json?.vlds.length > 0
? json.vlds ? json.vlds
: [{ required, message: '请进行签章' }], : [
{
required,
message: '请进行签章',
},
],
})( })(
<SignArray json={json} <SignArray
disabled={disabled || isPreview} json={json}
basicUrl={queryApiActionPath()} disabled={disabled || isPreview}
form={this.props.form} basicUrl={queryApiActionPath()}
/>); form={this.props.form}
/>,
);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3074,17 +3325,15 @@ export default class tableCom extends Component { ...@@ -3074,17 +3325,15 @@ export default class tableCom extends Component {
} }
// console.log(dataColumn.base52); // console.log(dataColumn.base52);
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: { files, }, initialValue: { files },
rules: [ rules: [
{ {
required, required,
message: '请选择附件', message: '请选择附件',
validator: (rule, valueUploadCom, callback) => { validator: (rule, valueUploadCom, callback) => {
// console.log(valueUploadCom, rule, ); let errors = [];
var errors = []; if ((!valueUploadCom || valueUploadCom?.files?.length === 0) && required) {
// errors.push(new Error('至少上传一个', rule.field));
if ((!valueUploadCom || valueUploadCom?.files.length === 0) && required) {
errors.push(new Error('至少上传一个', rule.field)); errors.push(new Error('至少上传一个', rule.field));
} }
callback(errors); callback(errors);
...@@ -3097,6 +3346,7 @@ export default class tableCom extends Component { ...@@ -3097,6 +3346,7 @@ export default class tableCom extends Component {
accept={json.accept} accept={json.accept}
btnName={json.btnName} btnName={json.btnName}
json={json} json={json}
dataKey={dataColumn.base52}
disabled={disabled || isPreview} disabled={disabled || isPreview}
/>, />,
); );
...@@ -3124,13 +3374,20 @@ export default class tableCom extends Component { ...@@ -3124,13 +3374,20 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' }], : [
})(<WangEditor json={json} {
dataColumn={dataColumn} required: required,
disabled={disabled} message: '请输入',
uuid={this.props.uuid} },
],
/>); })(
<WangEditor
json={json}
dataColumn={dataColumn}
disabled={disabled}
uuid={this.props.uuid}
/>,
);
break; break;
case 'RichText': case 'RichText':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -3138,8 +3395,13 @@ export default class tableCom extends Component { ...@@ -3138,8 +3395,13 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' }], : [
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>); {
required: required,
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3164,7 +3426,12 @@ export default class tableCom extends Component { ...@@ -3164,7 +3426,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [
{
required: required,
message: '请输入' + title,
},
],
})(<CronEditor style={{ width: 600 }} />); })(<CronEditor style={{ width: 600 }} />);
break; break;
case 'LocationCom': case 'LocationCom':
...@@ -3173,7 +3440,12 @@ export default class tableCom extends Component { ...@@ -3173,7 +3440,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请进行定位' }], : [
{
required: required,
message: '请进行定位',
},
],
})( })(
<LocationCom <LocationCom
get={get} get={get}
...@@ -3258,7 +3530,12 @@ export default class tableCom extends Component { ...@@ -3258,7 +3530,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请上传图片' }], : [
{
required: required,
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled} />); })(<ImgUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
...@@ -3284,7 +3561,12 @@ export default class tableCom extends Component { ...@@ -3284,7 +3561,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请上传视频' }], : [
{
required: required,
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled} />); })(<VideoUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
...@@ -3310,7 +3592,12 @@ export default class tableCom extends Component { ...@@ -3310,7 +3592,12 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请进行签名' }], : [
{
required: required,
message: '请进行签名',
},
],
})( })(
<Signature <Signature
width={ width={
...@@ -3371,7 +3658,13 @@ export default class tableCom extends Component { ...@@ -3371,7 +3658,13 @@ export default class tableCom extends Component {
if (json.isLabel) { if (json.isLabel) {
if (get === 'mobile' && !this.props.isEdit) { if (get === 'mobile' && !this.props.isEdit) {
return ( return (
<List style={{ margin: 5, border: '1px solid #ccc' }} className={styles.mobileList}> <List
style={{
margin: 5,
border: '1px solid #ccc',
}}
className={styles.mobileList}
>
{modalCode ? ( {modalCode ? (
<FormModal <FormModal
{...modalProps} {...modalProps}
......
import React, {useMemo, Component} from 'react';
import {List, Picker} from 'antd-mobile';
import styles from './styles.less';
const getItemChildren = (childrenList, parent) => {
if (!childrenList || !childrenList.length) {
return [];
}
for (let item of childrenList) {
if (item.label.indexOf(parent.label) > -1) {
item.label = item.label.replace(parent.label, '');
}
for (let proviceName of ['内蒙古', '广西', '新疆', '香港', '澳门', '西藏', '宁夏']) {
item.label = item.label.replace(proviceName, '');
}
if (item.children) {
item.children = getItemChildren(item.children, parent);
}
}
return childrenList;
}
export default class MobileCascader extends Component{
constructor(props) {
super(props);
}
render() {
const {onChange, options, label, disabled, value, json, otherProps} = this.props;
let opt = options &&
Array.isArray(options) &&
options.map((x) => {
return {
label: x.label,
value: x.value,
children: getItemChildren(x.children, x),
};
});
return (
<div className={styles.mobileFormInput}>
<Picker
data={opt || []}
cascade={true}
// cols={1}
disabled={disabled}
value={value}
extra={disabled ? '' : json.placeholder || '点击选择'}
onChange={(val) => {
console.log(val);
onChange(val || undefined);
}}
{...otherProps?.props}
>
<List.Item arrow={disabled ? '' : 'horizontal'}>
{/*{label}*/}
</List.Item>
</Picker>
</div>
);
}
}
//
//
// export default function MobileCascader(props) { // 级联选择
//
// }
.mobileFormInput {
border-bottom: 1px solid #eee;
:global {
.am-input-label,
.am-textarea-label,
.am-list-content {
white-space: pre-line !important;
font-size: 14px !important;
}
.am-list-item.am-input-item {
height: auto;
}
//.am-list-item .am-list-line .am-list-content{
// padding-left: 15px;
//}
.am-list-item {
padding-left: 0;
}
.am-list-item .am-list-line {
padding-right: 0;
}
.am-list-extra {
flex-basis: 100% !important;
font-size: 14px !important;
}
.am-list-item .am-input-control input {
text-align: right;
}
.am-list-item
.am-input-control
.fake-input-container
.fake-input-placeholder {
font-size: 14px;
}
}
input,
textarea {
font-size: 14px !important;
}
}
.mobileFormItem {
margin-bottom: 0px !important;
:global {
.ant-form-item-label {
/*隐藏手机端 字段的label 使用 antd-mobile 替代*/
display: inline !important;
height: 1px !important;
}
}
}
.viewDetail {
display: grid;
justify-content: start;
align-items: center;
width: 100%;
grid-template-columns: 15% 35% 15% 35%;
.title {
padding: 15px;
margin: -1px;
background-color: #fafafa;
border: 1px solid #eee;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.name {
margin: -1px;
padding: 15px;
background-color: #fff;
border: 1px solid #eee;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.viewDetailMobile {
display: grid;
justify-content: start;
align-items: center;
width: 100%;
grid-template-columns: 35% 65%;
border: 1px solid #eee;
margin-top: -1px;
.title {
padding: 15px;
margin-bottom: 0;
//margin: -1px;
background-color: #fafafa;
//overflow: hidden;
//white-space: nowrap;
//text-overflow: ellipsis;
}
.name {
//margin: -1px;
padding: 15px;
background-color: #fff;
//overflow: hidden;
//white-space: nowrap;
//text-overflow: ellipsis;
}
}
import React, { Children } from 'react';
import { Button, Form, Input, InputNumber, Modal, Select } from 'antd';
export default class FormModal extends React.Component {
render() {
// console.log(this.props);
return (
<Modal
destroyOnClose
title={this.props.title}
maskClosable={false}
width={this.props.width}
height={this.props.height}
visible={this.props.visible}
footer={null}
onCancel={this.props.handleCancel}>
{this.props.children}
</Modal>
);
}
}
/**
* @file 移动端 Row,Col二次封装
*/
import React, { Component } from 'react';
import { Form } from 'antd';
export default class MobileItem extends Component {
render() {
const { isPreview } = this.props;
return (
<Form.Item
{...this.props}
className={isPreview ? 'isPreview' : null}
label={isPreview ? this.props.label : this.props.label + '::'}
/>
);
}
}
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 equal = (obj1, obj2, json, sqlContent, depth, props, excludeKeys) => {
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, props, excludeKeys)) {
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, props, excludeKeys);
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 };
This source diff could not be displayed because it is too large. You can view the blob instead.
:global {
// table{
// border-collapse:collapse;
// }
#web_table .ant-form-item {
margin-bottom: 2.5px;
margin-top: 2.5px;
}
/*#web_table .ant-form-item-control{
line-height: 20px;
}*/
#mobile_table .am-list-item {
//background-color: rgba(238, 238, 238, 0.801);
border-radius: 4px;
}
// 移动端单选无法换行
#mobile_table .ant-radio-wrapper {
white-space: inherit;
}
#mobile_table .ant-form-item-label.ant-col-0,
#mobile_table .ant-form-item-control-wrapper.ant-col-0 {
width: 0%;
}
#mobile_table .ant-form-item-label.ant-col-1,
#mobile_table .ant-form-item-control-wrapper.ant-col-1 {
width: 4.16666667%;
}
#mobile_table .ant-form-item-label.ant-col-2,
#mobile_table .ant-form-item-control-wrapper.ant-col-2 {
width: 8.33333333%;
}
#mobile_table .ant-form-item-label.ant-col-3,
#mobile_table .ant-form-item-control-wrapper.ant-col-3 {
width: 12.5%;
}
#mobile_table .ant-form-item-label.ant-col-4,
#mobile_table .ant-form-item-control-wrapper.ant-col-4 {
width: 16.66666667%;
}
#mobile_table .ant-form-item-label.ant-col-5,
#mobile_table .ant-form-item-control-wrapper.ant-col-5 {
width: 20.83333333%;
}
#mobile_table .ant-form-item-label.ant-col-6,
#mobile_table .ant-form-item-control-wrapper.ant-col-6 {
width: 25%;
}
#mobile_table .ant-form-item-label.ant-col-7,
#mobile_table .ant-form-item-control-wrapper.ant-col-7 {
width: 29.16666667%;
}
#mobile_table .ant-form-item-label.ant-col-8,
#mobile_table .ant-form-item-control-wrapper.ant-col-8 {
width: 33.33333333%;
}
#mobile_table .ant-form-item-label.ant-col-9,
#mobile_table .ant-form-item-control-wrapper.ant-col-9 {
width: 37.5%;
}
#mobile_table .ant-form-item-label.ant-col-10,
#mobile_table .ant-form-item-control-wrapper.ant-col-10 {
width: 41.66666667%;
}
#mobile_table .ant-form-item-label.ant-col-11,
#mobile_table .ant-form-item-control-wrapper.ant-col-11 {
width: 45.83333333%;
}
#mobile_table .ant-form-item-label.ant-col-12,
#mobile_table .ant-form-item-control-wrapper.ant-col-12 {
width: 50%;
}
#mobile_table .ant-form-item-label.ant-col-13,
#mobile_table .ant-form-item-control-wrapper.ant-col-13 {
width: 54.16666667%;
}
#mobile_table .ant-form-item-label.ant-col-14,
#mobile_table .ant-form-item-control-wrapper.ant-col-14 {
width: 58.33333333%;
}
#mobile_table .ant-form-item-label.ant-col-15,
#mobile_table .ant-form-item-control-wrapper.ant-col-15 {
width: 62.5%;
}
#mobile_table .ant-form-item-label.ant-col-16,
#mobile_table .ant-form-item-control-wrapper.ant-col-16 {
width: 66.66666667%;
}
#mobile_table .ant-form-item-label.ant-col-17,
#mobile_table .ant-form-item-control-wrapper.ant-col-17 {
width: 70.83333333%;
}
#mobile_table .ant-form-item-label.ant-col-18,
#mobile_table .ant-form-item-control-wrapper.ant-col-18 {
width: 75%;
}
#mobile_table .ant-form-item-label.ant-col-19,
#mobile_table .ant-form-item-control-wrapper.ant-col-19 {
width: 79.16666667%;
}
#mobile_table .ant-form-item-label.ant-col-20,
#mobile_table .ant-form-item-control-wrapper.ant-col-20 {
width: 83.33333333%;
}
#mobile_table .ant-form-item-label.ant-col-21,
#mobile_table .ant-form-item-control-wrapper.ant-col-21 {
width: 87.5%;
}
#mobile_table .ant-form-item-label.ant-col-22,
#mobile_table .ant-form-item-control-wrapper.ant-col-22 {
width: 91.66666667%;
}
#mobile_table .ant-form-item-label.ant-col-23,
#mobile_table .ant-form-item-control-wrapper.ant-col-23 {
width: 95.83333333%;
}
#mobile_table .ant-form-item-label.ant-col-24,
#mobile_table .ant-form-item-control-wrapper.ant-col-24 {
width: 100%;
}
#mobile_table .ant-col-24 {
border-bottom: 1px solid white;
}
#mobile_table .am-textarea-control textarea {
background-color: #f5f5f5d3;
}
#mobile_table > .am-card {
min-height: 0;
}
#mobile_table .ant-form-item {
margin-bottom: 0px;
background: white;
overflow: auto;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
&::-webkit-scrollbar {
display: none;
}
}
#mobile_table .am-checkbox-agree .am-checkbox-inner {
left: -30px;
top: 1px;
}
#mobile_table .ant-form-item-label {
padding-top: 9px;
text-align: right;
font-weight: bold;
}
#mobile_table .isPreview > .ant-form-item-label {
padding-top: 0px;
}
#MobileList .am-list-item {
background-color: #fff;
border-radius: 4px;
}
#mobile_table .am-list-item .am-input-label {
overflow: auto;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
&::-webkit-scrollbar {
display: none;
}
}
#mobile_table .ant-form-item-label {
overflow: auto;
// scrollbar-width: none; /* Firefox */
// -ms-overflow-style: none; /* IE 10+ */
// &::-webkit-scrollbar {display:none}
}
#mobile_table .am-flexbox {
padding-left: 25px;
.am-checkbox-agree {
padding-top: 0px;
}
}
#mobile_table .am-list-extra {
flex-basis: 60%;
overflow: auto;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
&::-webkit-scrollbar {
display: none;
}
}
}
.form input {
font-size: 14px !important;
line-height: 28px !important;
padding-left: 29px !important;
background-color: #ccc;
}
.text {
display: inline-block;
font-size: 14px;
line-height: 28px;
text-align: right;
font-family: PingFang-SC-Regular;
}
.placeholder {
font-size: 14px;
}
.text2 {
width: 72px;
display: inline-block;
font-size: 16px;
line-height: 28px;
text-align: left;
font-weight: bold;
font-family: PingFang-SC-Regular;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论