提交 2e1f5e38 authored 作者: tb53863844's avatar tb53863844

开发

上级 285d96cd
......@@ -24,7 +24,7 @@ import {
Upload,
Form,
Table,
notification,
Cascader,
} from 'antd';
import UUID from 'react-native-uuid';
import QRCode from 'qrcode.react';
......@@ -445,7 +445,20 @@ export default class tableCom extends Component {
}
},
});
searchJson=(value,json,level,labs)=>{
for(var i=0;i<json.length;i++){
if(json[i].value==value[level]){
labs.push(json[i].label)
if(json[i].children){
this.searchJson(value,json[i].children,level+1,labs);
}
break;
}
}
}
componentWillReceiveProps(props) {
const {json, mapData, obj} = props;
if (json == null || this.props.safe) {
......@@ -547,9 +560,10 @@ export default class tableCom extends Component {
}
}
dataFilter = ['Select', 'Radio', 'Checkbox'];
dataFilter = ['Select', 'Radio', 'Checkbox','Cascader'];
getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj);
if (json.comName == 'TableSelect') {
const {dispatch} = this.props;
......@@ -663,8 +677,9 @@ export default class tableCom extends Component {
});
}
}
if (json.optionType != null && this.dataFilter.includes(json.comName)) {
switch (json.optionType) {
case 'reference':
if (dataColumn.referenceObjId != null) {
......@@ -699,56 +714,86 @@ 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, () => {
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)) {
labs.push(this.state.options[i].label);
if(json.comName=="Cascader"){
try {
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);
const labs = [];
this.searchJson(vlu,this.state.options,0,labs)
this.setState({labels: labs});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52;
const vlu = obj[base52];
const labs = [];
this.searchJson(vlu,this.state.options,0,labs)
this.setState({labels: labs});
}
});
} catch (e) {
message.error('公式选项配置存在问题');
}
}else{
try {
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);
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;
}
}
}
} 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});
} 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('公式选项配置存在问题');
}
}
break;
}
......@@ -1195,7 +1240,6 @@ export default class tableCom extends Component {
this.props.messageData,
this.props.concealModel,
);
if (base52) {
if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
} else {
......@@ -2042,6 +2086,13 @@ export default class tableCom extends Component {
cm = <span>{labels != null && labels.length > 0 ? Object.values(labels[0]) : ''}</span>;
break;
case 'Cascader':
cm= <span>
{labels != null
? labels.join(json.spliter?json.spliter:"")
: ''}
</span>
break;
case 'TableSelect':
const ds =
obj[dataColumn.base52] && obj[dataColumn.base52].selects
......@@ -2754,6 +2805,41 @@ export default class tableCom extends Component {
cm = <div>{cm}</div>;
}
break;
case 'Cascader':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [{required: required, message: '请选择' + dataColumn.title}],
})(<Cascader options={options}
allowClear
showSearch
disabled={disabled}
placeholder={json.placeholder}
style={{width: json.width}} />);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel)) &&
title
) {
cm = (
<MobileItem
isPreview={isPreview}
labelCol={{span: json.labelSpan}}
wrapperCol={{span: json.wrapperSpan}}
label={title}
>
{cm}
</MobileItem>
);
} else if (get === 'mobile') {
cm = <div>{cm}</div>;
}
break;
case 'TableSelect':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -2973,7 +3059,7 @@ export default class tableCom extends Component {
}
break;
case 'RichText':
debugger;
//debugger;
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules:
......
......@@ -256,7 +256,7 @@ export default class ViewPrint extends Component {
name={'打印设备选择'}
handleClick={() => {
window.LODOP.SELECT_PRINTER();
debugger;
//debugger;
this.setState({
preaparePrint: true,
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论