提交 5bfb05b3 authored 作者: 徐立's avatar 徐立

解决冲突

......@@ -88,7 +88,6 @@ export default class List extends Component {
list: [],
loading: true,
});
search.getPageService({ ...data, appId: workId }).then((response) => {
this.setState({
loading: false,
......
......@@ -24,12 +24,12 @@ export default class AffairPage extends React.Component {
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
const { dataBaseId, workId } = this.props;
this.state = {
showIframe: false,
columns: [],
pathname,
workId: '',
workId: workId || '',
searchCondition: [],
dataBaseId: '',
addFields: [], // 新增时填写的字段。
......@@ -138,14 +138,25 @@ export default class AffairPage extends React.Component {
return false;
}
const { pathname } = this.state;
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumns();
})
});
const { dataBaseId, workId } = this.props;
if(dataBaseId || workId){
this.setState({
workId,
dataBaseId,
},()=>{
this.getColumns();
});
}else{
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumns();
})
});
}
window.addEventListener('message', (event) => {
if (event.data === 'returnList') {
......@@ -178,6 +189,7 @@ export default class AffairPage extends React.Component {
const { workId, dataBaseId, addFields, showIframe, renderIframe } = this.state;
const url = config.onestopPC.split('/#/');
let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
console.log(iframeUrl);
// iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`;
return (
<PageHeaderWrapper title="">
......
......@@ -15,15 +15,16 @@ import { Link } from 'dva/router';
export default class Index extends React.Component {
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
this.state = {
columns: [],
dataList: [],
headerInfo: [],
workId: '',
workId: this.props.workId || '',
searchCondition: [],
pathname,
dataBaseId: '',
dataBaseId: this.props.dataBaseId || '',
addCondition: [],
addFields: [], // 新增时填写的字段。
tableInfo: {}, // 表格配置属性
......@@ -94,14 +95,20 @@ export default class Index extends React.Component {
componentDidMount() {
const { pathname } = this.state;
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumn();
})
});
const { workId } = this.state;
if(workId){
this.getColumn();
}else{
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumn();
})
});
}
}
render() {
......
import { text, number, date, format, taskNode } from '../config/index';
import { isJSON } from '@/baseComponent/utils';
import { translateAddFields } from '../config/index';
import ColumnsRender from '@/highOrderComponent/ColumnsRender';
import config from '@/config/config';
import { Tooltip } from 'antd';
import moment from 'moment';
import React from 'react';
......@@ -314,7 +314,12 @@ export function handleColumns(columns){
if (item.dataType) {
if (text.indexOf(item.dataType) > -1) { // 文本类型字段
item.render = (text) => {
if (typeof text === 'string' && text.length > 20) {
if(item.extendType === 'file' && typeof text === 'string'){
let url = text.includes('http') ? text : config.sqlFormsServer + text;
console.log(url);
return <a href={url} target={'_blank'}>点击查看</a>;
}
else if (typeof text === 'string' && text.length > 20) {
const oldTitle = text;
const newTitle = text.slice(0, 7) + '...';
return (
......@@ -322,8 +327,14 @@ export function handleColumns(columns){
<span key={text}>{newTitle}</span>
</Tooltip>
);
} else if (typeof text === 'object' && Array.isArray(text.files) && text.files.length) {
return <a href={text.files[0].path} target={'_blank'}>点击查看</a>;
} else if (item.extendType === 'file' &&
typeof text === 'object' && Array.isArray(text.files) && text.files.length) {
let url = text.files[0].path.includes('http') ?
text.files[0].path :
config.sqlFormsServer + text.files[0].path;
return <a href={url} target={'_blank'}>
点击查看
</a>;
} else {
return text;
}
......
......@@ -5,13 +5,13 @@
*/
import React, { Component } from 'react'
import { Form } from 'antd';
import { Row, Col ,Input,message} from 'antd'
import { Row, Col, Input, message } from 'antd'
import TableCom from '../tableCompon'
import {Toast} from 'antd-mobile'
import { Toast } from 'antd-mobile'
import router from 'umi/router'
import IsNewTable from './isNewTable';
export default class ZdyTable extends Component {
constructor(props){
constructor(props) {
super(props)
this.state = {
......@@ -19,86 +19,134 @@ export default class ZdyTable extends Component {
left: 0,
top: 0,
max: 4,
formId:null,
formCode:null,
formId: null,
formCode: null,
width: 100,
mapData:{},
defaultBinds:{},
sqlData:{},
defaultValues:{},
currentFormKey:null,
items:[],
init:this.props.init||{},
datas:{},
isEdit:true,
isReady:false,
formConfig:{},
mapData: {},
defaultBinds: {},
sqlData: {},
defaultValues: {},
currentFormKey: null,
items: [],
init: this.props.init || {},
datas: {},
isEdit: true,
isReady: false,
formConfig: {},
}
}
componentDidMount(){
let {
postData, // 数据源
isCg, // 用户点击草稿页面进入
isForm,
isPreview, // 是否为预览模式
isChild, // 是否为子表单
isQRCode=false, // 是否为二维码快捷发起
formDeafault='', // 为二维码快捷发起默认值
} = this.props
if(isPreview||isChild){
this.setState({...this.state,...this.props,isReady:true})
postData, // 数据源
isCg, // 用户点击草稿页面进入
isForm,
isPreview, // 是否为预览模式
isChild, // 是否为子表单
isQRCode = false, // 是否为二维码快捷发起
formDeafault = '', // 为二维码快捷发起默认值
} = this.props
if (isPreview || isChild) {
this.setState({ ...this.state, ...this.props, isReady: true })
return
}
let val = postData
try{
/**
* 数据源不同进行以下区别处理
* this.props.table有传入值表明需要渲染流程中最新表单
*/
if(isForm){ // 由表格的操作按钮进入
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 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.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,
mapData,
currentFormKey: this.props.table ? val.formKey : obj.init,
sqlData,
isEdit: this.props.formKey ? false : true,
items: this.props.table ? obj.datas[val.formKey].items : xxx.items,
defaultValues: val.form.defaultValues,
appId: val.appId,
isReady: true,
formConfig: xxx
});
return
}
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];
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.setState({
items: xxx.items,
init: { ...this.state.init, ...JSON.parse(val.content) },
datas: obj.datas,
isEdit: this.props.formKey ? false : true,
currentFormKey: obj.init,
width: xxx.width,
isBorder: xxx.isBorder,
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 obj = JSON.parse(val.form.content);
const xxx = obj.datas[obj.init];
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,
mapData,
currentFormKey:this.props.table?val.formKey:obj.init,
sqlData,
isEdit:this.props.formKey?false:true,
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"){
if (val.unifiedServicePatternModel.isDefaultError != null && val.unifiedServicePatternModel.isDefaultError) {
if (this.props.get == "web") {
message.error("当前办理人数较多,服务繁忙,请稍后再试!")
}else{
} else {
Toast.fail("当前办理人数较多,服务繁忙,请稍后再试!")
}
......@@ -106,103 +154,55 @@ export default class ZdyTable extends Component {
return;
}
const mapData = {};
const sqlData={};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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];
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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];
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
this.setState({
items: xxx.items,
init: {...this.state.init,...JSON.parse(val.content)},
datas:obj.datas,
isEdit:this.props.formKey?false:true,
currentFormKey:obj.init,
width: xxx.width,
isBorder: xxx.isBorder,
mapData,sqlData,
defaultValues:val.unifiedServicePatternModel.defaultValues,
appId: val.appId,
isReady:true,
formConfig:xxx,
defaultBinds:this.props.table?obj.datas[val.taskFormKey].defaultBinds:xxx.defaultBinds,
appId: val.id,
formId: val.id,
formCode: val.code,
datas: obj.datas,
mapData, sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
isEdit: this.props.formKey ? false : true,
currentFormKey: this.props.formKey ? this.props.formKey : val.taskFormKey ? val.taskFormKey : obj.init,
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,
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):'':{},// 移动端默认值设置
}, () => {
/**
* 为二维码快捷发起时自动设置新默认值
*/
if (isQRCode) {
this.props.form.setFieldsValue(formDeafault)
}
});
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];
}
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
this.setState({
appId: val.id,
formId:val.id,
formCode:val.code,
datas:obj.datas,
mapData,sqlData,
defaultValues:val.unifiedServicePatternModel.defaultValues,
isEdit:this.props.formKey?false:true,
currentFormKey:this.props.formKey?this.props.formKey:val.taskFormKey?val.taskFormKey:obj.init,
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,
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):'':{},// 移动端默认值设置
},()=>{
/**
* 为二维码快捷发起时自动设置新默认值
*/
if(isQRCode){
this.props.form.setFieldsValue(formDeafault)
}
});
} catch(e) {
} catch (e) {
console.log(`公式配置有误`, e)
}
}
componentWillReceiveProps(nextProps){
componentWillReceiveProps(nextProps) {
let {
postData,// 数据源
isCg, // 用户点击草稿页面进入
......@@ -210,21 +210,21 @@ export default class ZdyTable extends Component {
isPreview, // 是否为预览模式
isChild,// 是否为子表单
} = nextProps
if(isPreview||isChild){
if (isPreview || isChild) {
this.setState({...this.state,...this.props,isReady:true})
this.setState({ ...this.state, ...this.props, isReady: true })
return
}
try{
try {
let val = postData
/**
* 数据源不同进行以下区别处理
* this.props.table有传入值表明需要渲染流程中最新表单
*/
if(isForm){ // 由表格的操作按钮进入
if (isForm) { // 由表格的操作按钮进入
const mapData = {};
const sqlData={}
const sqlData = {}
const dataObjs = val.form.dataObjModels;
for (var i = 0; i < dataObjs.length; i++) {
const dob = dataObjs[i];
......@@ -242,95 +242,95 @@ export default class ZdyTable extends Component {
const obj = JSON.parse(val.form.content);
const xxx = obj.datas[obj.init];
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,
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,
mapData,
currentFormKey:this.props.table?val.formKey:obj.init,
currentFormKey: this.props.table ? val.formKey : obj.init,
sqlData,
isEdit:this.props.formKey?false:true,
items: this.props.table?obj.datas[val.formKey].items:xxx.items,
defaultValues:val.form.defaultValues,
isEdit: this.props.formKey ? false : true,
items: this.props.table ? obj.datas[val.formKey].items : xxx.items,
defaultValues: val.form.defaultValues,
appId: val.appId,
isReady:true,
formConfig:xxx
isReady: true,
formConfig: xxx
});
return
}
if(isCg === 'yes'){// 用户从编辑按钮进入
if (isCg === 'yes') {// 用户从编辑按钮进入
const mapData = {};
const sqlData={};
const sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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];
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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.setState({
items: xxx.items,
init: {...this.state.init,...JSON.parse(val.content)},
datas:obj.datas,
isEdit:this.props.formKey?false:true,
currentFormKey:obj.init,
width: xxx.width,
isBorder: xxx.isBorder,
mapData,sqlData,defaultValues:val.unifiedServicePatternModel.defaultValues,
appId: val.appId,
isReady:true,
formConfig:xxx,
defaultBinds:this.props.table?obj.datas[val.taskFormKey].defaultBinds:xxx.defaultBinds,
items: xxx.items,
init: { ...this.state.init, ...JSON.parse(val.content) },
datas: obj.datas,
isEdit: this.props.formKey ? false : true,
currentFormKey: obj.init,
width: xxx.width,
isBorder: xxx.isBorder,
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 sqlData = {};
const sqls = val.unifiedServicePatternModel.sqlModels
for (var i = 0; i < sqls.length; i++) {
const dob = sqls[i].dataObjModel;
const dob = sqls[i].dataObjModel;
for (var j = 0; j < dob.columnModels.length; j++) {
sqlData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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];
const dob = dataObjs[i];
for (var j = 0; j < dob.columnModels.length; j++) {
mapData[dob.columnModels[j].base52] = dob.columnModels[j];
}
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]; // 是否是存在历史表单传入值
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
this.setState({
appId: val.id,
datas:obj.datas,
mapData,sqlData, defaultValues:val.unifiedServicePatternModel.defaultValues,
isEdit:this.props.formKey?false:true,
currentFormKey:this.props.formKey?this.props.formKey:val.taskFormKey?val.taskFormKey:obj.init,
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,
items: this.props.table?obj.datas[val.taskFormKey].items:xxx.items,
isReady:true,
init: {...this.state.init,...val.isSecond?this.props.obj:{}},
formConfig:xxx
datas: obj.datas,
mapData, sqlData, defaultValues: val.unifiedServicePatternModel.defaultValues,
isEdit: this.props.formKey ? false : true,
currentFormKey: this.props.formKey ? this.props.formKey : val.taskFormKey ? val.taskFormKey : obj.init,
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,
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) {
} catch (e) {
console.log(`公式配置有误`, e)
}
}
......@@ -357,19 +357,19 @@ export default class ZdyTable extends Component {
}
render() {
let { width,isBorder,sqlData,mapData,defaultBinds,defaultValues,items, init,currentFormKey ,isEdit ,datas,isReady,formConfig,formCode,formId} = this.state
let { border, get, obj,index,fatherCode} = this.props
let style={}
if(formConfig.style!=null){
try{
style=JSON.parse(formConfig.style)
}catch(e){
console.log(e)
style={}
}
let { width, isBorder, sqlData, mapData, defaultBinds, defaultValues, items, init, currentFormKey, isEdit, datas, isReady, formConfig, formCode, formId } = this.state
let { border, get, obj, index, fatherCode } = this.props
let style = {}
if (formConfig.style != null) {
try {
style = JSON.parse(formConfig.style)
} catch (e) {
console.log(e)
style = {}
}
}
}
const formItemLayout = {
labelCol: {
xs: { span: 24 },
......@@ -381,22 +381,21 @@ export default class ZdyTable extends Component {
},
};
const max = this.countMax(items)
const borderStyle={
borderRight:"1px solid gray",borderTop:"1px solid gray",borderLeft:"1px solid gray",borderBottom:"1px solid gray"
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"
const borderStyleTwo = { // 处理隐藏组件边框样式问题
borderRight: "1px solid gray", borderLeft: "1px solid gray"
}
const styleDiv=this.props.height?{overflow: "auto", width: "100%" ,height:this.props.height}:{overflow: "auto", width: "100%" }
if(!isReady) return<></>
const styleDiv = this.props.height ? { overflow: "auto", width: "100%", height: this.props.height } : { overflow: "auto", width: "100%" }
if (!isReady) return <></>
switch (get) {
case 'web':
return (
<Form
className="login-form" >
{isEdit&&defaultBinds ? Object.keys(defaultBinds).map((k) => {
{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 ""
......@@ -412,7 +411,7 @@ export default class ZdyTable extends Component {
return this.props.form.getFieldDecorator(name, {
initialValue: value
})(<Input type="hidden"/>);
})(<Input type="hidden" />);
}) : ""}
......@@ -426,7 +425,8 @@ export default class ZdyTable extends Component {
style={{
overflow: "auto",
margin: max * width > 550 ? "auto" : '',
...style }}
...style
}}
border={border}
cellSpacing="0"
cellPadding="0" >
......@@ -436,57 +436,58 @@ export default class ZdyTable extends Component {
return <tr key={i}>
{row.map((cell, j) => {
let styles={}
if(cell.content&&cell.content.styles){
try{
styles= JSON.parse(cell.content.styles)
}catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`)
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) : {},
...styles
}} >
<TableCom
formCode={formCode} // 当前表单code
formId={formId} // 当前表单Id
i={i} // 当前组件下标
j={j} // 当前行数下班
fatherCode={fatherCode}
index={index}
fatherObj={this.props.fatherObj}
datas={datas}
uuid={cell.uuid}
isEdit={isEdit}
formKey={currentFormKey}
init={init}
get={get} // 区分移动端或wen端
json={cell.content}
obj={obj || {}} // 是否存在默认值
mapData={mapData}
form={this.props.form} // antd form控件
sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值
/>
</td>
}
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):{},
...styles
}} >
<TableCom
formCode={formCode} // 当前表单code
formId={formId} // 当前表单Id
i={i} // 当前组件下标
j={j} // 当前行数下班
fatherCode={fatherCode}
index={index}
fatherObj={this.props.fatherObj}
datas={datas}
uuid={cell.uuid}
isEdit={isEdit}
formKey={currentFormKey}
init={init}
get={get} // 区分移动端或wen端
json={cell.content}
obj={ obj||{}} // 是否存在默认值
mapData={mapData}
form={this.props.form} // antd form控件
sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值
/>
</td>}
)
}
}
</tr>
......@@ -494,7 +495,7 @@ export default class ZdyTable extends Component {
</tbody>
</table>
{style.pageBreakAfter!=null?<div style={{pageBreakAfter:style.pageBreakAfter}}></div>:""}
{style.pageBreakAfter != null ? <div style={{ pageBreakAfter: style.pageBreakAfter }}></div> : ""}
</div>
</Col>
</Row>
......@@ -504,7 +505,7 @@ export default class ZdyTable extends Component {
case 'mobile':
return (
<Form {...formItemLayout} id='mobile_table' className="login-form">
{defaultBinds ? Object.keys(defaultBinds).map((k) => {
{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 ""
......@@ -520,45 +521,46 @@ export default class ZdyTable extends Component {
return this.props.form.getFieldDecorator(name, {
initialValue: value
})(<Input type="hidden"/>);
})(<Input type="hidden" />);
}) : ""}
{
items.map((item, i) => {
const allhidden = this.checkAllHidden(items)
return (<div
key={i}
style={{
marginTop: 0,
background: '#ffffff',
paddingLeft:12,
width: '100%',
flexWrap:'wrap',
...style }}>
key={i}
style={{
marginTop: 0,
background: '#ffffff',
paddingLeft: 12,
width: '100%',
flexWrap: 'wrap',
...style
}}>
{
item.map((ary, j) => {
return !allhidden && ary.hidden ? ""
: <><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={ obj||{}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
defaultValues={defaultValues || {}} /></>
return !allhidden && ary.hidden ? ""
: <><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
defaultValues={defaultValues || {}} /></>
})
}
</div>)
......
import React from 'react'
import { Button, Row, Col, message } from 'antd';
import { Button, Row, Col, message } from 'antd';
import ZdyTable from '../Table'
import UUID from 'react-native-uuid';
import { Card, WingBlank} from 'antd-mobile';
import { Card, WingBlank } from 'antd-mobile';
export default class ChildForm extends React.Component {
......@@ -142,11 +142,37 @@ export default class ChildForm extends React.Component {
span={span}
>
<ZdyTable formConfig={datas} key={r} fatherCode={base52} isEdit={isEdit} index={r} obj={objs[r]} fatherObj={this.props.fatherObj} init={objs} isChild={true} get="web" form={form} mapData={mapData} sqlData={sqlData} {...datas} defaultValues={defaultValues} />
<ZdyTable
formConfig={datas}
key={r}
fatherCode={base52}
isEdit={isEdit}
index={r}
obj={objs[r]}
fatherObj={this.props.fatherObj}
init={objs} isChild={true}
get="web"
form={form}
mapData={mapData}
sqlData={sqlData}
{...datas}
defaultValues={defaultValues} />
{rights.includes("delete") && isEdit ? <Button size="small"
style={{ position: "absolute", right: 10, top: '50%',transform:'translateY(-50%)' }}
type='danger' onClick={this.delete.bind(this, r)}>{deleteName || "删除"}</Button> : ""}
style={{
position: "absolute",
left: ' 95%',
top: '10px',
transform: 'translateY(-50%)',
borderRadius: '50%',
height: '13px',
width: '13px',
padding: 0,
lineHeight: '10px'
}}
type='danger'
onClick={this.delete.bind(this, r)}>{deleteName || "-"}
</Button> : ""}
</Col>
......
......@@ -14,18 +14,13 @@ export default class TableSelect extends React.Component {
constructor(props) {
super(props)
const value = props.value || {};
this.state = {
selects: value.selects||{},
visiable: value.visiable ,
isAll:value.isAll!=null?value.isAll:false,
querys: value.querys||[],
selects: value.selects || {},
visiable: value.visiable,
isAll: value.isAll != null ? value.isAll : false,
querys: value.querys || [],
sql: value.sql,
}
}
......@@ -33,6 +28,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)
onChange(Object.assign({}, this.state, changedValue));
}
}
......@@ -40,50 +36,50 @@ export default class TableSelect extends React.Component {
// Should be a controlled component.
if ('value' in nextProps) {
const value = nextProps.value;
if(value!=null&& value instanceof Object){
if (value != null && value instanceof Object) {
this.setState(value);
}
//
}
}
remove = (rowKey) => {
console.log(rowKey)
const { selects } = this.state
delete selects[rowKey]
console.log(selects)
if (!('value' in this.props)) {
this.setState({ selects });
}
this.triggerChange({ selects});
this.triggerChange({ selects });
}
select = (obj) => {
var { selects} = this.state
const { json: { isMultiple ,optionType} } = this.props
var { selects } = this.state
const { json: { isMultiple, optionType } } = this.props
let valueName = this.props.json.valueName
if(optionType == "reference" &&this.props.dataColumn.referenceObjId){
valueName=this.props.dataColumn.referenceCodeName
if (optionType == "reference" && this.props.dataColumn.referenceObjId) {
valueName = this.props.dataColumn.referenceCodeName
}
const kk = obj[valueName]
if (kk == null) {
message.error("指定的取值字段不存在或者值为空")
return
}
if (!isMultiple) {
selects = { [kk]: {...obj,selectKey:kk} }
selects = { [kk]: { ...obj, selectKey: kk } }
} else {
selects[kk] = obj;
selects[kk].selectKey=kk
selects[kk].selectKey = kk
}
if (!('value' in this.props)) {
this.setState({ selects });
}
this.triggerChange({ selects});
this.triggerChange({ selects });
......@@ -96,37 +92,35 @@ export default class TableSelect extends React.Component {
values.splice(i, 1)
labels.splice(i, 1)
if (!('value' in this.props)) {
this.setState({ values, labels});
this.setState({ values, labels });
}
this.triggerChange({ values, labels });
}
open = () => {
if (!('value' in this.props)) {
this.setState({ visiable: true});
this.setState({ visiable: true });
}
this.triggerChange({ visiable: true });
}
closeModal = () => {
if (!('value' in this.props)) {
this.setState({ visiable: false});
this.setState({ visiable: false });
}
this.triggerChange({ visiable: false });
}
render() {
const { json: { isMultiple, sql, optionType, showTable }, dataColumn: { referenceObjId }, sqlModel, columns,dataSource } = this.props
let { valueName, labelName} =this.props.json
if(optionType == "reference" &&referenceObjId){
valueName=this.props.dataColumn.referenceCodeName
labelName=this.props.dataColumn.referenceNameName
const { json: { isMultiple, sql, optionType, showTable }, dataColumn: { referenceObjId }, sqlModel, columns, dataSource } = this.props
let { valueName, labelName } = this.props.json
if (optionType == "reference" && referenceObjId) {
valueName = this.props.dataColumn.referenceCodeName
labelName = this.props.dataColumn.referenceNameName
}
......@@ -134,45 +128,44 @@ export default class TableSelect extends React.Component {
if (valueName == null || valueName == "") {
return <>请指定取值的列名</>
}
const { selects, visiable, labels} = this.state
const { selects, visiable, labels } = this.state
const keys=[]
for(let i in selects){
const keys = []
for (let i in selects) {
keys.push(selects[i][valueName])
}
const columns2=[...columns,{
title:"操作",
render:(val,record)=><a onClick={this.remove.bind(this,record.selectKey)}>移除</a>
const columns2 = [...columns, {
title: "操作",
render: (val, record) => <a onClick={this.remove.bind(this, record.selectKey)}>移除</a>
}]
const columns3=[...columns,{
title:"操作",
render:(val,record)=>
keys.includes(record[valueName])?<span>已选择</span>:<a onClick={this.select.bind(this,record)}>选择</a>
const columns3 = [...columns, {
title: "操作",
render: (val, record) =>
keys.includes(record[valueName]) ? <span>已选择</span> : <a onClick={this.select.bind(this, record)}>选择</a>
}]
const custom={
isAll:this.state.isAll,
querys: this.state.querys,
sql: this.state.sql,
}
console.log(columns3)
const custom = {
isAll: this.state.isAll,
querys: this.state.querys,
sql: this.state.sql,
}
// console.log(columns3)
let allWidth = 0
if(columns3) {
columns3.map((item,index) => {
if(index === columns3.length-1){
if (columns3) {
columns3.map((item, index) => {
if (index === columns3.length - 1) {
item.fixed = 'right'
item.width = 50
allWidth += 50
return item
}
if(index === columns3.length-2){
if (index === columns3.length - 2) {
allWidth += 150
} else {
if(item.width){
if (item.width) {
allWidth += item.width
} else {
item.width = 180
......@@ -182,23 +175,20 @@ export default class TableSelect extends React.Component {
return item
})
}
console.log(selects, Object.keys(selects).length)
return (
<div>
{Object.keys(selects).length > 0 ? showTable ? <Table rowKey={valueName} size="small" dataSource={Object.values(selects)} columns={columns2} pagination={false} /> :
Object.keys(selects).map((k) => <Tag key={k} closable onClose={this.remove.bind(this, k)}>{selects[k][labelName]}</Tag>)
{Object.keys(selects).length > 0 ?
showTable ? <Table rowKey={valueName} size="small" dataSource={Object.values(selects)} columns={columns2} pagination={false} /> :
Object.keys(selects).map((k) => <Tag key={k} closable onClose={this.remove.bind(this, k)}>{selects[k][labelName]}</Tag>)
: ""
}
<Button type="primary" onClick={this.open}>选择</Button>
<Modal
width="1200px"
width="60%"
maskClosable={false}
title={`请选择`}
visible={visiable}
onOk={this.closeModal}
......@@ -206,9 +196,10 @@ export default class TableSelect extends React.Component {
>
{optionType == "reference" ? referenceObjId ?
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={referenceObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} /> : "未关联数据对象"
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={referenceObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} />
: "未关联数据对象"
: sqlModel.dataObjId ?
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={sqlModel.dataObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} />
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={sqlModel.dataObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} />
: <Table rowKey={valueName} size="small" dataSource={dataSource.list} columns={columns3} scroll={{ x: allWidth }} />}
</Modal>
</div>
......
......@@ -731,7 +731,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input readOnly={!isAdd} placeholder="请输入"/>)}
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入"/>)}
</FormItem>
);
}
......@@ -771,7 +771,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input placeholder="请输入"/>)}
})(<Input style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem>
);
} else if (number.indexOf(item.type) > -1) {
......@@ -818,7 +818,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input placeholder="请输入"/>)}
})(<Input style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem>
);
}
......@@ -832,11 +832,12 @@ class FormList extends React.Component {
if (querys.length == 0) {
return '';
}
return (
<Form layout="inline">
<Row >
{querys.map((item) =>
<Col span={8} key={item.id}>
<Col style={{height:58}} span={8} key={item.id}>
{this.getItem(true,form, {
...item,
isNull: true
......
......@@ -62,14 +62,14 @@ import Signature from '../Signature';
import baseX from 'base-x'
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
const base64 = baseX(Bs64)
import {Base16Encode} from "../Base16/index"
import { Base16Encode } from "../Base16/index"
import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList';
// import FilePreview from '../filePreview';
const Item = MobileList.Item;
const Brief = Item.Brief;
function getBase64(value){
return value?base64.encode(new Buffer(value)):null;
function getBase64(value) {
return value ? base64.encode(new Buffer(value)) : null;
}
const codeMessage = {
......@@ -121,9 +121,9 @@ const normFile = (e) => {
}
return e && e.fileList[0];
}
@connect(({ DataColumn, SqlManageEntity,formList, loading }) => ({
DataColumn, SqlManageEntity,formList,
loading: loading.models.DataColumn || loading.models.SqlManageEntity||loading.models.formList
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn, SqlManageEntity, formList,
loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList
}))
export default class tableCom extends Component {
state = {
......@@ -212,9 +212,9 @@ export default class tableCom extends Component {
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))
)) {
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)
......@@ -295,18 +295,18 @@ export default class tableCom extends Component {
return res;
};
getRender= (com,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}/>
}
getRender = (com, 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文本
......@@ -423,7 +423,7 @@ export default class tableCom extends Component {
if (json == null) {
return;
}
if(!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect")&&json.isFormulaOnce){
if (!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect") && json.isFormulaOnce) {
return;
}
if (!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect" || (json.formula != null && json.formula != ""))) {
......@@ -482,44 +482,46 @@ export default class tableCom extends Component {
return
}
const bindObj=this.getColumn('c1');
let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
const bindObj = this.getColumn('c1');
{ base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
let dataColumn = this.props.fatherCode != null ? (bindObj ? { ...bindObj, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}` } :
: bindObj;
if (this.props.fatherCode == null&&dataColumn == null) dataColumn = { base52: this.props.uuid }
/* if (this.props.fatherCode != null) {
dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
} else {
dataColumn = { base52: this.props.uuid }
if (Object.keys(mapData).length > 0) {
const columnIds = json.columnIds;
{ base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
if (columnIds && columnIds['c1']) {
const columnId = columnIds['c1'][columnIds['c1'].length - 1];
if (mapData[columnId] != null) {
dataColumn = mapData[columnId]
: bindObj;
if (this.props.fatherCode == null && dataColumn == null) dataColumn = { base52: this.props.uuid }
/* if (this.props.fatherCode != null) {
dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
} else {
dataColumn = { base52: this.props.uuid }
if (Object.keys(mapData).length > 0) {
const columnIds = json.columnIds;
if (columnIds && columnIds['c1']) {
const columnId = columnIds['c1'][columnIds['c1'].length - 1];
if (mapData[columnId] != null) {
dataColumn = mapData[columnId]
}
}
}
}
}
} */
if (!this.props.isEdit&&this.props.fatherCode) {
if(bindObj!=null){
if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) {
dataColumn.base52 = bindObj.base52
}else{
} else {
dataColumn.base52 = this.props.uuid
}
}
}
if (this.dataFilter.includes(json.comName) || json.comName == "TableSelect") {
const obj2 = { ...obj, ...props.form.getFieldsValue(), ...props.defaultValues[this.props.formKey] }
this.getData(json, dataColumn, obj2)
}
if (json.formula != null && json.formula != ""&&!json.isFormulaOnce) {
if (json.formula != null && json.formula != "" && !json.isFormulaOnce) {
this.getFunctionValue(json.formula, dataColumn, json)
}
}
......@@ -528,8 +530,6 @@ export default class tableCom extends Component {
getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj)
if (json.comName == "TableSelect") {
const { dispatch } = this.props
const { sqlKey, optionType } = json
......@@ -613,10 +613,10 @@ export default class tableCom extends Component {
}
}
})
}else if(optionType == "reference"&&dataColumn.referenceObjId){
} else if (optionType == "reference" && dataColumn.referenceObjId) {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: dataColumn.referenceObjId},
payload: { dataObjId: dataColumn.referenceObjId },
callback: datas => {
if (datas) {
......@@ -677,71 +677,71 @@ export default class tableCom extends Component {
}
break;
case "func":
if (json.funcs != null && json.funcs != "") {
let enu;
try {
this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json,()=>{
this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json, () => {
if (init != null && Object.keys(init).length > 0) {
let base52 = dataColumn.base52
let vlu=this.props.form.getFieldValue(base52)
if(vlu instanceof Array){
for(var i=0;i<this.state.options.length;i++){
if(vlu.includes(this.state.options[i].value)){
let vlu = this.props.form.getFieldValue(base52)
if (vlu instanceof Array) {
for (var i = 0; i < this.state.options.length; i++) {
if (vlu.includes(this.state.options[i].value)) {
labs.push(this.state.options[i].label)
}
}
} else {
for (var i = 0; i < this.state.options.length; i++) {
if (vlu == this.state.options[i].value) {
labs.push(this.state.options[i].label)
break;
}
}
}
this.setState({ labels: labs })
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52
const vlu = obj[base52]
const labs = []
if (vlu instanceof Array) {
for (var i = 0; i < this.state.options.length; i++) {
if (vlu.includes(this.state.options[i].value)) {
labs.push(this.state.options[i].label)
}
}
}else{
for(var i=0;i<this.state.options.length;i++){
if(vlu==this.state.options[i].value){
} else {
for (var i = 0; i < this.state.options.length; i++) {
if (vlu == this.state.options[i].value) {
labs.push(this.state.options[i].label)
break;
}
}
}
this.setState({labels:labs})
}else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52
const vlu=obj[base52]
const labs=[]
if(vlu instanceof Array){
for(var i=0;i<this.state.options.length;i++){
if(vlu.includes(this.state.options[i].value)){
labs.push(this.state.options[i].label)
}
}
}else{
for(var i=0;i<this.state.options.length;i++){
if(vlu==this.state.options[i].value){
labs.push(this.state.options[i].label)
break;
}
}
}
this.setState({labels:labs})
}
}) ;
} catch (e) {
message.error("公式选项配置存在问题")
}
this.setState({ labels: labs })
}
});
} catch (e) {
message.error("公式选项配置存在问题")
}
}
......@@ -760,11 +760,11 @@ export default class tableCom extends Component {
}
}
reqUtil = (base52, json,orgCallback, url, method, params, callback, options = {}) => {
reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => {
//查缓存
var isChange = false;
if(url.indexOf("http")===-1){
url=config.httpServer+url
if (url.indexOf("http") === -1) {
url = config.httpServer + url
}
const { reqUrls } = this.state
if (reqUrls[url] != null) {
......@@ -798,17 +798,17 @@ export default class tableCom extends Component {
if (callback) {
const data = reqUrls[url].data
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")){
this.setState({ options: res , selectDis: false },()=>{
if(orgCallback) orgCallback()
if (res != null && !(typeof res === "function")) {
this.setState({ options: res, selectDis: false }, () => {
if (orgCallback) orgCallback()
});
}
}else if (json.comName == "Button") {
} else if (json.comName == "Button") {
try {
callback(data)
......@@ -849,13 +849,13 @@ export default class tableCom extends Component {
return "norefeshxxxxxxxxxxxxxxxxxxxx"
}
this.setState({ reqUrls }, () => {
for(let i in params){
if(params[i]==null){
for (let i in params) {
if (params[i] == null) {
delete params[i]
}
}
if(getToken()!=null){
params.token=getToken()
if (getToken() != null) {
params.token = getToken()
}
const requestParams = params
......@@ -877,17 +877,17 @@ export default class tableCom extends Component {
reqUrls[url].data = data
this.setState({ reqUrls })
if (callback) {
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")){
this.setState({ options: res , selectDis: false },()=>{
if(orgCallback) orgCallback()
if (res != null && !(typeof res === "function")) {
this.setState({ options: res, selectDis: false }, () => {
if (orgCallback) orgCallback()
});
}
}else if (json.comName == "Button") {
} else if (json.comName == "Button") {
try {
callback(data)
......@@ -940,8 +940,8 @@ export default class tableCom extends Component {
}
sqlUtil = (base52, json,orgCallback, sqlKey, params, callback, options = {}) => {
sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => {
//查缓存
var isChange = false;
const { sqlKeys } = this.state
......@@ -968,14 +968,14 @@ export default class tableCom extends Component {
if (callback) {
const data = sqlKeys[sqlKey].data
if(json.optionType&&json.optionType=="func"){
const res=callback(data)
if(res!=null&&!(typeof res === "function")){
this.setState({ options: res , selectDis: false },()=>{
if(orgCallback)orgCallback()
if (json.optionType && json.optionType == "func") {
const res = callback(data)
if (res != null && !(typeof res === "function")) {
this.setState({ options: res, selectDis: false }, () => {
if (orgCallback) orgCallback()
});
}
}else if (json.comName == "Button") {
} else if (json.comName == "Button") {
try {
callback(data)
......@@ -1023,9 +1023,9 @@ export default class tableCom extends Component {
const pp = { sqlKey: Base16Encode(sqlKey), params,allValues: Base16Encode(allValues) }
if(getToken()!=null){
pp.token=getToken()
const pp = { sqlKey: Base16Encode(sqlKey), params, allValues: Base16Encode(allValues) }
if (getToken() != null) {
pp.token = getToken()
}
const umiRequest = extend({
errorHandler, // 默认错误处理
......@@ -1035,7 +1035,7 @@ export default class tableCom extends Component {
});
umiRequest(url, {
data: pp ,
data: pp,
method: 'POST',
requestType: "form"
}).then(data => {
......@@ -1047,17 +1047,17 @@ export default class tableCom extends Component {
}
if (callback) {
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")){
this.setState({ options: res , selectDis: false },()=>{
if(orgCallback) orgCallback()
if (res != null && !(typeof res === "function")) {
this.setState({ options: res, selectDis: false }, () => {
if (orgCallback) orgCallback()
});
}
}else if (json.comName == "Button") {
} else if (json.comName == "Button") {
try {
callback(data)
......@@ -1110,7 +1110,7 @@ export default class tableCom extends Component {
return "norefeshxxxxxxxxxxxxxxxxxxxx"
}
getFunctionValue = (fun, column, json,callback) => {
getFunctionValue = (fun, column, json, callback) => {
/* if (!this.props.isEdit) {
return
......@@ -1132,20 +1132,20 @@ export default class tableCom extends Component {
if(!this.props.isEdit&&this.props.fatherCode){
obj = { ...this.props.fatherObj, ...this.props.form.getFieldsValue(), ...this.props.defaultValues[this.props.formKey] }
}else{
} else {
obj = { ...this.props.obj, ...this.props.form.getFieldsValue(), ...this.props.defaultValues[this.props.formKey] }
}
const value = fun1(obj,this.props.init, this.props.defaultValues, { clientType: this.props.get,formCode:this.props.formCode,formId:this.props.formId }, this.props.index, this.props.fatherCode,
{
const value = fun1(obj, this.props.init, this.props.defaultValues, { clientType: this.props.get, formCode: this.props.formCode, formId: this.props.formId }, this.props.index, this.props.fatherCode,
{
moment: moment,
sql: this.sqlUtil.bind(this, base52, json,callback),
message: message,router:router,
sql: this.sqlUtil.bind(this, base52, json, callback),
message: message, router: router,
setValues: this.setValues.bind(this, base52, json),
req: this.reqUtil.bind(this, base52, json,callback),
req: this.reqUtil.bind(this, base52, json, callback),
md5: md5,
render:this.getRender,base64:getBase64,
},
......@@ -1165,12 +1165,12 @@ export default class tableCom extends Component {
if (json.comName == "Button") {
return value
} else if(json.optionType&&json.optionType=="func"){
} else if (json.optionType && json.optionType == "func") {
if(value!=null&&!(typeof value === "function")){
this.setState({ options: value , selectDis: false },()=>{
if(callback) callback()
if (value != null && !(typeof value === "function")) {
this.setState({ options: value, selectDis: false }, () => {
if (callback) callback()
});
}
......@@ -1215,40 +1215,63 @@ export default class tableCom extends Component {
}
})
}
const bindObj=this.getColumn('c1');
let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
{ base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
: bindObj;
if (this.props.fatherCode == null&&dataColumn == null) dataColumn = { base52: this.props.uuid }
/* if (this.props.fatherCode != null) {
dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
} else {
dataColumn = { base52: this.props.uuid }
if (Object.keys(mapData).length > 0) {
const columnIds = json.columnIds;
if (columnIds && columnIds['c1']) {
const columnId = columnIds['c1'][columnIds['c1'].length - 1];
if (mapData[columnId] != null) {
dataColumn = mapData[columnId]
const bindObj = this.getColumn('c1');
let dataColumn = this.props.fatherCode != null ? (bindObj ? { ...bindObj, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}` } :
{ base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
: bindObj;
if (this.props.fatherCode == null && dataColumn == null) dataColumn = { base52: this.props.uuid }
/* if (this.props.fatherCode != null) {
dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
} else {
dataColumn = { base52: this.props.uuid }
if (Object.keys(mapData).length > 0) {
const columnIds = json.columnIds;
const bindObj = this.getColumn('c1');
let dataColumn = this.props.fatherCode != null ? (bindObj ? { ...bindObj, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}` } :
{ base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
: bindObj;
if (this.props.fatherCode == null && dataColumn == null) dataColumn = { base52: this.props.uuid }
/* if (this.props.fatherCode != null) {
dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
} else {
dataColumn = { base52: this.props.uuid }
if (Object.keys(mapData).length > 0) {
const columnIds = json.columnIds;
if (columnIds && columnIds['c1']) {
const columnId = columnIds['c1'][columnIds['c1'].length - 1];
if (mapData[columnId] != null) {
dataColumn = mapData[columnId]
}
}
}
}
} */
// if (!this.props.isEdit && this.props.fatherCode) {
// if (bindObj != null) {
// dataColumn.base52 = bindObj.base52
// } else {
// dataColumn.base52 = this.props.uuid
// }
// }
if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) {
dataColumn.base52 = bindObj.base52
} else {
dataColumn.base52 = this.props.uuid
}
} */
if (!this.props.isEdit&&this.props.fatherCode) {
if(bindObj!=null){
dataColumn.base52 = bindObj.base52
}else{
dataColumn.base52 = this.props.uuid
}
}
this.getData(json, dataColumn, obj)
if (json.formula != null && json.formula != "") {
this.getFunctionValue(json.formula, dataColumn, json)
......@@ -1267,11 +1290,11 @@ export default class tableCom extends Component {
callback: options => {
const optionsx = [];
let base52 = dataColumn.base52
let vl=this.props.form.getFieldValue(base52)
let isExist=false;
let vl = this.props.form.getFieldValue(base52)
let isExist = false;
for (var i = 0; i < options.length; i++) {
if(vl== options[i][valueName]&&!isExist){
isExist=true;
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
optionsx.push({
label: options[i][labelName],
......@@ -1279,15 +1302,15 @@ export default class tableCom extends Component {
});
}
if(!isExist&&vl!=null&&options.length>0){
this.props.form.setFieldsValue({[base52]:null})
if (!isExist && vl != null && options.length > 0) {
this.props.form.setFieldsValue({ [base52]: null })
}
this.setState({ options: optionsx, selectDis: false });
},
});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52
if (this.props.fatherCode) {
const x = base52.split(".")
......@@ -1307,12 +1330,12 @@ export default class tableCom extends Component {
payload: { sqlKey, allValues },
callback: options => {
let base52 = dataColumn.base52
let vl=this.props.form.getFieldValue(base52)
let vl = this.props.form.getFieldValue(base52)
const optionsx = [];
let isExist=false;
let isExist = false;
for (var i = 0; i < options.length; i++) {
if(vl== options[i][valueName]&&!isExist){
isExist=true;
if (vl == options[i][valueName] && !isExist) {
isExist = true;
}
optionsx.push({
label: options[i][labelName],
......@@ -1320,10 +1343,10 @@ export default class tableCom extends Component {
});
}
if(!isExist&&vl!=null&&options.length>0){
if (!isExist && vl != null && options.length > 0) {
//console.log("isExist",optionsx,vl,isExist)
this.props.form.setFieldsValue({[base52]:null})
}
this.props.form.setFieldsValue({ [base52]: null })
}
this.setState({ options: optionsx, selectDis: false });
},
......@@ -1449,7 +1472,6 @@ export default class tableCom extends Component {
const { options, labels, selectDis } = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
const disabled = json != null ? json.disabled : false
if (json == null) {
return <></>;
}
......@@ -1488,9 +1510,9 @@ export default class tableCom extends Component {
if (json.comName == 'Label') {
let uid
if (this.props.fatherCode != null) {
uid=`${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`
uid = `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`
} else {
uid= this.props.uuid
uid = this.props.uuid
}
if (!isEdit) {
......@@ -1498,18 +1520,18 @@ export default class tableCom extends Component {
} else {
if (this.props.fatherCode != null) {
return <>{this.props.form.getFieldDecorator(uid, {
initialValue: obj[this.props.uuid]||json.initialValue
return <>{this.props.form.getFieldDecorator(uid, {
initialValue: obj[this.props.uuid] || json.initialValue
})(<Input type="hidden" />)}<span style={{ fontWeight: get == 'mobile' ? 'bold' : '', marginRight: get == 'mobile' ? 12 : '' }} {...json.props}>{obj[this.props.uuid]||json.initialValue}</span></>
})(<Input type="hidden" />)}<span style={{ fontWeight: get == 'mobile' ? 'bold' : '', marginRight: get == 'mobile' ? 12 : '' }} {...json.props}>{obj[this.props.uuid] || json.initialValue}</span></>
}else{
return <>{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldValue(uid)||json.initialValue
} else {
return <>{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldValue(uid) || json.initialValue
})(<Input type="hidden" />)}<span style={{ fontWeight: get == 'mobile' ? 'bold' : '', marginRight: get == 'mobile' ? 12 : '' }} {...json.props}>{this.props.form.getFieldValue(uid)}</span></>
})(<Input type="hidden" />)}<span style={{ fontWeight: get == 'mobile' ? 'bold' : '', marginRight: get == 'mobile' ? 12 : '' }} {...json.props}>{this.props.form.getFieldValue(uid)}</span></>
}
}
......@@ -1618,18 +1640,18 @@ export default class tableCom extends Component {
break;
case 'ImgUploadCom':
if(value==null||value==""){
cm=<div style={{ width: json.width, height: json.height }}></div>
}else{
cm = <>
<img src={config.httpServer + value} style={{ width: json.width, height: json.height }} />
{
get === 'mobile' ?
<br />
: ''
}
</>;
if (value == null || value == "") {
cm = <div style={{ width: json.width, height: json.height }}></div>
} else {
cm = <>
<img src={config.httpServer + value} style={{ width: json.width, height: json.height }} />
{
get === 'mobile' ?
<br />
: ''
}
</>;
}
......@@ -1701,20 +1723,20 @@ export default class tableCom extends Component {
var cm;
var required = false;
const bindObj=this.getColumn('c1');
const bindObj = this.getColumn('c1');
let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
let dataColumn = this.props.fatherCode != null ? (bindObj ? { ...bindObj, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}` } :
{ 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 }
}
if (!dataColumn.isNull) {
if (dataColumn.isNull != null && !dataColumn.isNull) {
required = true;
}
......@@ -1722,7 +1744,7 @@ export default class tableCom extends Component {
var initValue;
if (init != null) {
if (this.props.fatherCode != null) {
initValue = init[this.props.index] != null ? init[this.props.index][bindObj?bindObj.base52:this.props.uuid] : null;
initValue = init[this.props.index] != null ? init[this.props.index][bindObj ? bindObj.base52 : this.props.uuid] : null;
} else {
initValue = init[dataColumn.base52];
......@@ -1740,15 +1762,15 @@ export default class tableCom extends Component {
}
}
if (!isEdit) {
if (this.props.fatherCode) {
if(bindObj!=null){
if (bindObj != null) {
dataColumn.base52 = bindObj.base52
}else{
} else {
dataColumn.base52 = this.props.uuid
}
}
......@@ -1769,11 +1791,11 @@ export default class tableCom extends Component {
cm = <span>{obj[dataColumn.base52]}</span>;
break;
case 'InputHidden':
case 'InputHidden':
cm = <></>;
cm = <></>;
break;
break;
case 'InputNumber':
cm = <span>{obj[dataColumn.base52]}</span>;
......@@ -1802,7 +1824,6 @@ export default class tableCom extends Component {
break;
case 'TableSelect':
const ds = obj[dataColumn.base52] && obj[dataColumn.base52].selects ? Object.values(obj[dataColumn.base52].selects) : []
if (json.showTable) {
cm = <Table columns={this.state.columns} size="small" dataSource={ds} pagination={false} />;
......@@ -1912,7 +1933,7 @@ export default class tableCom extends Component {
);
}
} else {
cm = <span style={{display:'inline-block',width:'100%',textAlign:'center'}}>暂无附件</span>
cm = <span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}>暂无附件</span>
}
......@@ -1920,9 +1941,9 @@ export default class tableCom extends Component {
case 'ImgUploadCom':
if(obj[dataColumn.base52]==null||obj[dataColumn.base52]==""){
cm=<div style={{ width: json.width, height: json.height }}></div>
}else{
if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == "") {
cm = <div style={{ width: json.width, height: json.height }}></div>
} else {
cm = <img src={config.httpServer + obj[dataColumn.base52]} style={{ width: json.width, height: json.height }} />;
}
......@@ -1953,17 +1974,17 @@ export default class tableCom extends Component {
if (json.events != null) {
events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json)
}
if(events&&events.dom){
cm=events.dom
}else{
if (events && events.dom) {
cm = events.dom
} else {
const ev = {
children:json.initialValue,
children: json.initialValue,
...events
}
if(json.isLink){
cm = <a {...ev}/>
}else{
cm = <Button loading={this.props.loading} type="primary" {...ev}/>
if (json.isLink) {
cm = <a {...ev} />
} else {
cm = <Button loading={this.props.loading} type="primary" {...ev} />
}
}
......@@ -1980,15 +2001,15 @@ export default class tableCom extends Component {
if (json.objCode == null || json.objCode == "") {
cm = <></>
}
cm = <TableList
loading={this.props.loading}
showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage}
pageSize={json.pageSize}
value={obj[dataColumn.base52 || this.props.uuid] || {}}
objCode={json.objCode}
sql={json.filterSql}
rights={json.rights} />
cm = <TableList
loading={this.props.loading}
showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage}
pageSize={json.pageSize}
value={obj[dataColumn.base52 || this.props.uuid] || {}}
objCode={json.objCode}
sql={json.filterSql}
rights={json.rights} />
break;
default:
cm = <span>缺乏字段{json.comName}的匹配项</span>
......@@ -2016,17 +2037,17 @@ export default class tableCom extends Component {
if (json.events != null) {
events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json)
}
if(events&&events.dom){
cm=events.dom
}else{
if (events && events.dom) {
cm = events.dom
} else {
const ev = {
children:json.initialValue,
children: json.initialValue,
...events
}
if(json.isLink){
cm = <a {...ev}/>
}else{
cm = <Button loading={this.props.loading} type="primary" {...ev}/>
if (json.isLink) {
cm = <a {...ev} />
} else {
cm = <Button loading={this.props.loading} type="primary" {...ev} />
}
}
......@@ -2114,36 +2135,36 @@ export default class tableCom extends Component {
// disabled={disabled}
// placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
// >
// {json.isLabel ?
// title ?
// <span className={styles.text}>
// {required ? must : ''}
// {title}</span>
// : ''
// : get === 'mobile' ?
// <span className={styles.text}>{required ? must : ''}请输入:
// {/* {title} */}
// </span>
// : ''}
// {json.isLabel ?
// title ?
// <span className={styles.text}>
// {required ? must : ''}
// {title}</span>
// : ''
// : get === 'mobile' ?
// <span className={styles.text}>{required ? must : ''}请输入:
// {/* {title} */}
// </span>
// : ''}
// </MobileInputItem></div>)
cm = (
<MobileList
>
<Item arrow="empty" multipleLine onClick={() => {}}>
{json.isLabel ?
title ?
<span className={styles.text}>
{required ? must : ''}
{title}</span>
: ''
: get === 'mobile' ?
<span className={styles.text}>{required ? must : ''}请输入:
>
<Item arrow="empty" multipleLine onClick={() => { }}>
{json.isLabel ?
title ?
<span className={styles.text}>
{required ? must : ''}
{title}</span>
: ''
: get === 'mobile' ?
<span className={styles.text}>{required ? must : ''}请输入:
{/* {title} */}
</span>
: ''}
</span>
: ''}
<Brief>
<div className={styles.form}>
<MobileInputItem
<div className={styles.form}>
<MobileInputItem
type={'text'}
className="mobile-form-input-left"
{...getFieldProps(dataColumn.base52, {
......@@ -2157,7 +2178,7 @@ export default class tableCom extends Component {
disabled={disabled}
placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
>
</MobileInputItem>
</div>
</Brief>
......@@ -2171,31 +2192,31 @@ export default class tableCom extends Component {
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请输入' + title }],
})(<Input disabled={disabled} style={{ width: json.width }} placeholder={json.placeholder} />);
break;
case 'InputHidden':
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue
})(<Input type="hidden" />);
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue
})(<Input type="hidden" />);
break;
case 'InputNumber':
/* if (get === 'mobile') {
cm = (<div className={styles.form}><MobileInputItem
type={'digit'}
className="mobile-form-input-left"
{...getFieldProps(dataColumn.base52, {
initialValue: initValue, // 默认值
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{
required: required,
message: '请输入',
}],
})}
clear
disabled={disabled}
placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
>{json.isLabel ? title ? <span className={styles.text}>{title}</span> : '' : ''}</MobileInputItem></div>)
break
} */
/* if (get === 'mobile') {
cm = (<div className={styles.form}><MobileInputItem
type={'digit'}
className="mobile-form-input-left"
{...getFieldProps(dataColumn.base52, {
initialValue: initValue, // 默认值
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{
required: required,
message: '请输入',
}],
})}
clear
disabled={disabled}
placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
>{json.isLabel ? title ? <span className={styles.text}>{title}</span> : '' : ''}</MobileInputItem></div>)
break
} */
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
......@@ -2313,11 +2334,11 @@ export default class tableCom extends Component {
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp="children"
onFocus= {()=>{
get === 'mobile'?// 移动端取消输入键盘弹出
setTimeout(() => {
if(document.querySelectorAll(`.ant-select-search__field`).length>0){
let ary = [...document.querySelectorAll(`.ant-select-search__field`)]
onFocus={() => {
get === 'mobile' ?// 移动端取消输入键盘弹出
setTimeout(() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)]
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
......@@ -2329,7 +2350,7 @@ export default class tableCom extends Component {
})
}
})
:null
: null
}}
filterOption={(input, option) =>
option ? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 : false
......@@ -2356,13 +2377,12 @@ export default class tableCom extends Component {
break;
case 'TableSelect':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue || {},
rules: [{
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{
validator: (rule, value, callback) => {
if (Object.keys(value).length == 0 && required != null && required) {
if ((Object.keys(value).length == 0 || Object.keys(value.selects).length == 0) && required != null && required) {
var errors = []
errors.push(new Error('请选择至少一个', rule.field))
}
......@@ -2449,47 +2469,47 @@ export default class tableCom extends Component {
// {cm}
// </Form.Item>
// }
// cm = (
// <MobileDatePicker
// mode={'date'}
// disabled={disabled}
// locale={{ okText: "确定", dismissText: '取消' }}
// extra={<span className={styles.placeholder}>{!!initValue ? moment(initValue).format('YYYY-MM-DD') : '请选择日期'}</span>}
// {...getFieldProps(dataColumn.base52, {
// initialValue: +moment(initValue).format('YYYY-MM-DD'), // 默认值
// rules: [
// { required: required, message: '请选择日期' },
// // { validator: this.validateDatePicker },
// ]
// })}
// >
// <MobileList.Item arrow="horizontal"><span className={styles.text}>{required ? must : ''}{dataColumn.title}</span></MobileList.Item>
// </MobileDatePicker>
// )
// cm = (
// <MobileDatePicker
// mode={'date'}
// disabled={disabled}
// locale={{ okText: "确定", dismissText: '取消' }}
// extra={<span className={styles.placeholder}>{!!initValue ? moment(initValue).format('YYYY-MM-DD') : '请选择日期'}</span>}
// {...getFieldProps(dataColumn.base52, {
// initialValue: +moment(initValue).format('YYYY-MM-DD'), // 默认值
// rules: [
// { required: required, message: '请选择日期' },
// // { validator: this.validateDatePicker },
// ]
// })}
// >
// <MobileList.Item arrow="horizontal"><span className={styles.text}>{required ? must : ''}{dataColumn.title}</span></MobileList.Item>
// </MobileDatePicker>
// )
// break
// }
var iv = null;
if (initValue != null) {
iv = moment(typeof initValue === 'string'?+initValue:initValue);
iv = moment(typeof initValue === 'string' ? +initValue : initValue);
}
// console.log(iv,json.format)
cm = getFieldDecorator(dataColumn.base52, {
initialValue: iv,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<DatePicker
disabled={disabled}
showTime
onOpenChange = { get === 'mobile'?() => { // 取消唤起移动端小键盘
setTimeout(() => {
if(document.querySelector('.ant-calendar-input ')){
document.querySelector('.ant-calendar-input ').setAttribute('readonly', 'readonly');
setTimeout(() => {
document.querySelector('.ant-calendar-input ').removeAttribute('readonly');
});
}
});
}:()=>{}}
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} />);
disabled={disabled}
showTime
onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘
setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) {
document.querySelector('.ant-calendar-input ').setAttribute('readonly', 'readonly');
setTimeout(() => {
document.querySelector('.ant-calendar-input ').removeAttribute('readonly');
});
}
});
} : () => { }}
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} />);
if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item
labelCol={{ span: json.labelSpan }}
......@@ -2605,10 +2625,10 @@ export default class tableCom extends Component {
cm = <></>
} else {
cm = <>{getFieldDecorator(dataColumn.base52||this.props.uuid , {
cm = <>{getFieldDecorator(dataColumn.base52 || this.props.uuid, {
initialValue: initValue || {}
})(<TableList isHiddenPage={json.isHiddenPage} showHeader={json.showHeader} loading={this.props.loading} pageSize={json.pageSize} objCode={json.objCode} sql={json.filterSql} rights={json.rights} />)}</>
})(<TableList isHiddenPage={json.isHiddenPage} showHeader={json.showHeader} loading={this.props.loading} pageSize={json.pageSize} objCode={json.objCode} sql={json.filterSql} rights={json.rights} />)}</>
}
break;
......@@ -2656,13 +2676,13 @@ export default class tableCom extends Component {
</Form.Item>
);
} else {
return cm
}
} else {
return (
<Form.Item
>
{cm}
</Form.Item>
......
......@@ -8,7 +8,7 @@ import LoginWithQrCode from './LoginWithQrCode';
* wxSocketGateWay: websocket链接地址 'ws://scjoyedu.eicp.net:51337/wswx/test106/socket/'
* mockServer: 获取sessionId 接口前缀 'http://scjoyedu.eicp.net:51337/test106',
* */
export default function LoginByQrCode({ url, LoginType, wxSocketGateWay, mockServer }) {
export default function LoginByQrCode({ hintStyle, url, LoginType, wxSocketGateWay, mockServer }) {
return (
<div>
<div style={{ backgroundColor: 'white', width: 288, padding: 10, margin: 'auto' }}>
......@@ -19,7 +19,7 @@ export default function LoginByQrCode({ url, LoginType, wxSocketGateWay, mockSer
wxSocketGateWay={wxSocketGateWay}
/>
</div>
<div style={{ marginTop: 20, color: 'white' }}>
<div style={{ marginTop: 20, color: 'white', ...hintStyle, }}>
请使用
<span style={{ color: 'red' }}>微信扫一扫</span>
扫码登录
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论