// import React from "react";
// import { inject, observer } from "mobx-react";
// import { Button, message } from "antd";
// import { toJS } from "mobx";
// import { WeaForm, WeaSwitch } from "comsMobx";
// import {
//     WeaBrowser,
//     WeaDialog,
//     WeaFormItem,
//     WeaInput,
//     WeaLocaleProvider,
//     WeaRightMenu,
//     WeaSearchGroup,
//     WeaSelect,
//     WeaTableEdit,
//     WeaTools,
//     WeaTab,
//     WeaCheckbox,
//     WeaTextarea,
//     WeaHelpfulTip,
// } from "ecCom";
// import {checkTableFieldValueUnique}  from "../../apis/CommonService";

// const { getKey } = WeaTools;
// const getLabel = WeaLocaleProvider.getLabel;

// const store = ["tencentMailStore"];

// import { isSpecialChar } from '../../util/IntegrationUtil'
// import * as IntegrationUtil from "../../util/IntegrationUtil";
// @inject(...store)
// @observer
// export default class NewDetailForm extends React.Component {
//     constructor(props) {
//         super(props);
//         const { tencentMailStore } = this.props;
//         const { detailFieldListColumnsSetData1
//             , detailFieldListColumnsSetData2
//             , detailFieldListColumnsSetData3
//             , detailFieldListColumnsSetData4
//         } = toJS(tencentMailStore.status);
//         this.state = {
//             detailData1: detailFieldListColumnsSetData1,
//             detailData2: detailFieldListColumnsSetData2,
//             detailData3: detailFieldListColumnsSetData3,
//             detailData4: detailFieldListColumnsSetData4,
//             marginLeftDis: -390,
//             bottomDis: 7,
//             styleSheet: 'labeldeyangshi',
//         };
//     }
//     componentDidMount() {
//         const {tencentMailStore} = this.props;
//         tencentMailStore.setState({ newDetailFormSelectedKey : 0 });
//     }

//     getBtns = () => {
//         let btns = []
//         btns = [
//             <Button type='primary' onClick={() => this.onRightMenuClick('BTN_SAVE')}>{getLabel(86, '保存')}</Button>
//             // ,<Button type='primary' onClick={() => this.onRightMenuClick('BTN_CHECK')}>{getLabel(32367,'有效性检查')}</Button>
//         ];

//         return btns;
//     }
//     getRightMenu() {
//         const { tencentMailStore } = this.props;
//         let btnArr = [
//             {
//                 key: 'BTN_SAVE',
//                 icon: <i className='icon-coms-Preservation' />,
//                 content: `${getLabel(86, '保存')}`,
//                 onClick: () => this.onRightMenuClick('BTN_SAVE')
//             }
//         ]
//         return btnArr;
//     }
//     onRightMenuClick = (type, recordId) => {
//         const { tencentMailStore } = this.props;
//         const { newForm, newDetailForm,triggerIntervalFormDt, status } = tencentMailStore;
//         const { TriggerFormHiddenFields, mainFieldListColumnsSetData, detailFieldListColumnsSetData1, detailFieldListColumnsSetData2, detailFieldListColumnsSetData3, detailFieldListColumnsSetData4, TriggerDetailFormHiddenFields } = toJS(tencentMailStore.status);
//         let { newDetailFormSelectedKey } = toJS(tencentMailStore.status);
//         const formParams = newForm.getFormParams();

//         if (type == 'BTN_SAVE') {
//             if (newDetailFormSelectedKey == 0) {
//                 //基本信息页保存
//                 let checkParams = {
//                     tableName: 'outerdatawfset',
//                     fieldName: 'setname',
//                     fieldValue: newForm.getFormParams().setname.replace(/^(\s*)|(\s*)$/g, ''),
//                     idName: 'id',
//                     idValue: tencentMailStore.settingRegisterID
//                 };
//                 checkTableFieldValueUnique(checkParams).then(result => {
//                     if(result&&result.isNotUnique) {
//                         newForm.showError('setname',getLabel('129943','名称已存在'));
//                         return;
//                     }
//                     newForm.validateForm().then(f => {
//                         if (f.isValid) {
//                             if (isSpecialChar(newForm.getFormParams().setname)) {
//                                 message.error(`${getLabel('131334', '名称包含特殊字符，请重新输入！')}`);
//                                 return;
//                             }

//                             var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
//                             var valdata = formParams.whitelist.split(',');

//                             for(let i=0;i<valdata.length;i++){
//                                 if(valdata[i].trim()) {
//                                     if(reg.test(valdata[i]) == false){
//                                         newForm.showError('whitelist', getLabel('390589',"Ip格式不正确"));
//                                         return;
//                                     }
//                                 }
//                             }

//                             let params = Object.assign(TriggerFormHiddenFields, newForm.getFormParams());
//                             tencentMailStore.getTriggerOperation({ setname: newForm.getFormParams().setname, operate: 'checkShowName', viewid: params.viewid }, (result) => {
//                                 if (result && result.errorMsg) {
//                                     message.error(result.errorMsg);
//                                     return;
//                                 } else {
//                                     //合并hiddenfield参数
//                                     let params = Object.assign(TriggerFormHiddenFields, newForm.getFormParams());
//                                     params.operate = "edit";
//                                     tencentMailStore.getTriggerOperation(params, (result) => {
//                                         let msg = `${getLabel('22619', '保存成功')}`;
//                                         message.success(msg);
//                                         tencentMailStore.setState({ showNewDetailFormDialog: false })
//                                     });
//                                 }
//                             });
    
    
//                         } else {
//                             f.showErrors();
//                             this.setState({ date: new Date() });
//                         }
//                     });
                    
//                 });
               
//             } else if (newDetailFormSelectedKey == 2) {
//               //触发周期保存
//               IntegrationUtil.onCheck(triggerIntervalFormDt,()=>{
//                 let p = triggerIntervalFormDt.getFormParams().periodvalue;
//                 if(p[0] && p[0] != '') {
//                     switch(p[0]) {
//                         case '1': 
//                           let minutes = p[1] || '';
//                           if(!(/^[1-5]\d{0,1}$/.test(Number(minutes)))) {
//                               triggerIntervalFormDt.showError('periodvalue', getLabel('390590',"有效范围为1-59的整数 "));
//                               return;
//                           };
//                           break;
//                         case '2':
//                           let hours = p[1] || '';
//                           if(!(/^(1\d?)$/.test(Number(hours)) || /^(2[0-3])$/.test(Number(hours)) || Number(hours) == 2)) {
//                             triggerIntervalFormDt.showError('periodvalue', getLabel('390591',"有效范围为1-23的整数 "));
//                             return;
//                           }
//                           break;
//                         case '3':
//                           if(!p[1]) {
//                             triggerIntervalFormDt.showError('periodvalue', getLabel('391056','"请选择时间"未填写'));
//                             return;
//                           }
//                           break;
//                         case '4':
//                           if(!p[2]) {
//                             triggerIntervalFormDt.showError('periodvalue', getLabel('391056','"请选择时间"未填写'));
//                             return;
//                           }
//                           break;
//                         case '5':
//                           let days = p[2] || '';
//                           if(!(/^(1\d?)$/.test(Number(days)) || /^2[0-7]$/.test(Number(days)) || Number(days) == 2)) {
//                               triggerIntervalFormDt.showError('periodvalue', getLabel('390592',"有效范围为1-27的整数 "));
//                               return;
//                           }
//                           if(!p[3]) {
//                             triggerIntervalFormDt.showError('periodvalue', getLabel('391056','"请选择时间"未填写'));
//                             return;
//                           }
//                     }
//                 }
//                 tencentMailStore.getTriggerOperation({
//                   operate: 'INTERVAL_SAVE',
//                   scope: tencentMailStore.settingRegisterID,
//                   periodvalue: p[1] || "",
//                   type: p[0] || "",
//                   value2: p[2] || "",
//                   value3: p[3] || ""
//                 },(result)=>{
//                   let msg = `${getLabel('22619', '保存成功')}`;
//                   message.success(msg);
//                   tencentMailStore.setState({ showNewDetailFormDialog: false })
//                 });
//               })


//             } else {
//                 //字段配置保存
//                 if (mainFieldListColumnsSetData[1] && mainFieldListColumnsSetData[1].rulesopt == "5" && mainFieldListColumnsSetData[1].hrmid == "") {
//                     message.error(getLabel('23155,30036', '固定创建人选择必填'));
//                     return;
//                 }

//                 let params = TriggerDetailFormHiddenFields;
//                 params = Object.assign(TriggerDetailFormHiddenFields);

//                 let dtInfo = [];
//                 // dtInfo = dtInfo.concat(this.state.detailData1, this.state.detailData2, this.state.detailData3, this.state.detailData4);
//                 dtInfo = dtInfo.concat(detailFieldListColumnsSetData1, detailFieldListColumnsSetData2, detailFieldListColumnsSetData3, detailFieldListColumnsSetData4);
               
//                 params.dtinfo_detailFieldData = JSON.stringify(dtInfo);

//                 params.operate = "adddetail";
//                 params.dtinfo_mainFieldData = JSON.stringify(mainFieldListColumnsSetData);
//                 tencentMailStore.getTriggerOperation(params, (result) => {
//                     message.success(getLabel('22619', '保存成功'));
//                     tencentMailStore.setState({ showNewDetailFormDialog: false })

//                 });
//             }
//         }
//     }

//   handleClickSetAttachment = (record) => {
//     const {tencentMailStore} = this.props;
//     const {getTriggerEditDetailAttachmentSetForm, settingRegisterID, detailAttachmentSetForm} = tencentMailStore;
//     // 记录点击了表的哪个附件的设置
//     tencentMailStore.setState({fieldid: record.fieldid})
//     let attachment_settings = record.attachment_settings ? record.attachment_settings : '';
//     let attachment_type = '1';
//     if(attachment_settings != '') {
//         attachment_type = JSON.parse(attachment_settings).attachment_type;
//     }
//     let params = Object.assign({viewid: settingRegisterID, fieldid: record.fieldid, attachment_type: attachment_type, attachment_settings: attachment_settings});

//     getTriggerEditDetailAttachmentSetForm(params);
//   }

//     /**
//      * 初始渲染明细表
//      * @param type 标识,区分主表还是明细表
//      * @param mainFieldListColumnsSet 明细表的配置数据
//      * @param newForm
//      */
//     initColumsSet = (type, mainFieldListColumnsSet, newForm, mainFieldListColumnsSetData, storeKey) => {
//         const { tencentMailStore } = this.props;
//         const { resourceOptionList } = toJS(tencentMailStore.status);
//         //自定义sql逻辑
//         mainFieldListColumnsSet[3] && mainFieldListColumnsSet[3].com[0] && (mainFieldListColumnsSet[3].com[0].type = 'custom');
//         mainFieldListColumnsSet[3] && mainFieldListColumnsSet[3].com[0] && (mainFieldListColumnsSet[3].com[0].render = (text, record, index, onEdit) => {
//             if (record.rulesopt == 8) {
//                 return <WeaSelect
//                   {...mainFieldListColumnsSet[3].com[0]}
//                   value={record.customsql}
//                   style={{width: 120}}
//                   options={resourceOptionList}
//                   onChange={(value) => { let key = 'customsql'; onEdit({ record, index, key, value }) }}
//                 />
//               }else if (record.rulesopt == 7) {
//                 return <WeaInput
//                   {...mainFieldListColumnsSet[3].com[0]}
//                   value={record.customsql}
//                   style={{width: 120}}
//                   onChange={(value) => { let key = 'customsql'; onEdit({ record, index, key, value }) }}
//                 />
//               }else if (record.rulesopt == 6) {
//                 return <WeaTextarea
//                   {...mainFieldListColumnsSet[3].com[0]}
//                   value={record.customsql}
//                   style={{width: 120}}
//                   onChange={(value) => { let key = 'customsql'; onEdit({ record, index, key, value }) }}
//                   minRows={1}
//                   maxRows={4}
//                 />
//             } else if (record.rulesopt == 5) {
//                 //固定创建人选择
//                 return <WeaBrowser
//                     type={1}
//                     fieldName="hrmid"
//                     viewAttr="3"
//                     value={record.hrmid}
//                     valueSpan={record.hrmidspan}
//                     textDecoration={true}
//                     inputStyle={{ width: 120}}
//                     onChange={(ids, names, datas) => {
//                         record.hrmidspan = names;
//                         record.hrmid = ids
//                         mainFieldListColumnsSetData[1] = record;
//                         tencentMailStore.setState({ [storeKey]: mainFieldListColumnsSetData });

//                     }}
//                 />
//             } else {
//                 return <input type="hidden" value="" name="customsql" />
//             }

//         })
//         // 固定值、附件设置和固定密集选择
//         mainFieldListColumnsSet[1] && mainFieldListColumnsSet[1].com[0] && (mainFieldListColumnsSet[1].com[0].type = 'custom');
//         mainFieldListColumnsSet[1] && mainFieldListColumnsSet[1].com[0] && (mainFieldListColumnsSet[1].com[0].render = (text, record, index, onEdit) => {
//             if(record.fieldhtmltype == '6') {
//                 return (
//                     <nobr>
//                         <WeaSelect {...mainFieldListColumnsSet[1].com[0]} value={record.outerfieldname} onChange={(value) => { let key = 'outerfieldname'; onEdit({ record, index, key, value }) }}/>
//                         <Button style={{marginLeft: 5}} size={'small'} onClick={() => this.handleClickSetAttachment(record)}>设置</Button>
//                     </nobr>
//                 )
//             }    
//             let formParams = newForm.getFormParams();
//             let no_outerfieldname = (record.rulesopt == 7 || record.rulesopt == 8);
//             if (!no_outerfieldname) {
//                 return <WeaSelect {...mainFieldListColumnsSet[1].com[0]} value={record.outerfieldname} onChange={(value) => { let key = 'outerfieldname'; onEdit({ record, index, key, value }) }} />
//             } else {
//                 return <WeaSelect {...mainFieldListColumnsSet[1].com[0]} name="outerfieldname" viewAttr={1} value={record.outerfieldname} hasBorder />
//             }
//         })

//         if (type == "mainTable") {
//             //归档时是否回写逻辑
//             mainFieldListColumnsSet[4] && mainFieldListColumnsSet[4].com[0] && (mainFieldListColumnsSet[4].com[0].type = 'custom');
//             mainFieldListColumnsSet[4] && mainFieldListColumnsSet[4].com[0] && (mainFieldListColumnsSet[4].com[0].render = (text, record, index, onEdit) => {
//                 let formParams = newForm.getFormParams();
//                 let no_iswriteback = (record.fieldname == "requestname" || record.fieldname == "creater")
//                 if (formParams.datarecordtype == 2 && !no_iswriteback) {
//                     return <WeaCheckbox {...mainFieldListColumnsSet[4].com[0]} value={record.iswriteback} onChange={(value) => { let key = 'iswriteback'; onEdit({ record, index, key, value }) }} />
//                 } else {
//                     return <input type="hidden" value="" name="iswriteback" />
//                 }
//             })
//         }
//     }
                                                                                                                                                                              
//     setColumns = (datas) => {
//         let group = [];

//         datas && datas.map(data => {
//             if(data.key == 'outerfieldname') {
//                 data.title = <nobr><label style={{marginRight:5}}>{data.title}</label><WeaHelpfulTip width={196} title={`${getLabel('388073', '外部字段数据类型要和流程主字段类型保持关系对应，否则会出现转换错误，最终导致触发流程失败！')}`} /></nobr>
//                 group.push(data)
//             }else if(data.key == 'rulesopt') {
//                 data.title = <nobr><label style={{marginRight:5}}>{data.title}</label><WeaHelpfulTip width={280} title={`${getLabel('500368', '如果转换规则为固定值，可设置自定义值或者使用系统变量，系统变量取的是流程创建人属性值，设置如下：人员id，格式为{?userid}；登陆账号，格式为{?loginid}；姓名，格式为{?username}；编号，格式为{?workcode}；密码(MD5格式)，格式为{?password}；部门id，格式为{?departmentid}；部门编码，格式为{?departmentcode}；部门名称，格式为{?departmentname}；分部id，格式为{?subcompanyid}；分部编码，格式为{?subcompanycode}；分部名称，格式为{?subcompanyname} 如果转换规则为自定义sql，此设置查询的是当前系统，格式为：select 最终字段 from tablename where 条件字段={? currentvalue}，{?currentvalue}为固定格式')}`} /></nobr>
//                 group.push(data)
//             }else {
//                 group.push(data);
//             }
//         })
//         return group;
//     }

//     getSearchs3 = () => {
//         const {tencentMailStore} = this.props;
//         const {triggerIntervalFormDt, status} = tencentMailStore;
//         const {TriggerIntervalFormFieldsDt} = toJS(status);
//         const {isFormInit} = triggerIntervalFormDt;
//         let group = [];
//         let i = 0;
//         const formParams = triggerIntervalFormDt.getFormParams();

//         isFormInit && TriggerIntervalFormFieldsDt && TriggerIntervalFormFieldsDt.map(c =>{
//         let items = [];

//         c.items.map(fields => {

//             items.push({
//             com:(
//                 <WeaFormItem
//                 label={`${fields.label}`}
//                 labelCol={{span: `${fields.labelcol}`}}
//                 wrapperCol={{span: `${fields.fieldcol}`}}
//                 error={triggerIntervalFormDt.getError(fields)}
//                 tipPosition="bottom"
//                 >

//                 <nobr>
//                   <div className={this.state.styleSheet}>
//                     <WeaSwitch fieldConfig={fields} form={triggerIntervalFormDt} formParams={formParams}  onChange={v=> {
//                         if(getKey(fields) == 'periodvalue') {
//                             let timer = triggerIntervalFormDt.getFormParams().periodvalue;
//                             if(timer[0] == '1' || timer[0] == '2') {
//                                 this.setState({marginLeftDis: -390, bottomDis: 7, styleSheet: 'labeldeyangshi'})
//                             }else if(timer[0] == '3') {
//                                 this.setState({marginLeftDis: -315, bottomDis: 10, styleSheet: 'meitiandeyangshi'})
//                             }else if(timer[0] == '4') {
//                                 this.setState({marginLeftDis: -240, bottomDis: 7, styleSheet: 'meizhoudeyangshi'})
//                             }else if(timer[0] == '5') {
//                                 this.setState({marginLeftDis: -135, bottomDis: 8, styleSheet: 'meiyuedeyangshi'})
//                             }else if(timer[0] == '0') {
//                                 this.setState({marginLeftDis: -510, bottomDis: 8, styleSheet: ''})
//                             }
//                         }
//                     }} />
//                     <WeaHelpfulTip style={{marginLeft:this.state.marginLeftDis, position: 'absolute', bottom: this.state.bottomDis}}
//                         width =  {170}
//                         title={getLabel('23138','更改后需要重启服务才能生效')}
//                     />
//                   </div>
//                 </nobr>
//                 </WeaFormItem>),
//             colSpan:1,
//             hide: triggerIntervalFormDt.isHide(fields, (keys, allParams) => {
//                 let bool = false;
//                 return bool;
//             })
//             });

//         });
//         group.push(<WeaSearchGroup center  col={1}  needTigger={true} title={c.title}  showGroup={c.defaultshow} items={items}/>);
//         i++;
//         });
//         return group;
//     }

//     getSearchs2 = () => {
//         const { tencentMailStore } = this.props;
//         const { newForm, newDetailForm, status } = tencentMailStore;
//         const { TriggerDetailFormFields, mainFieldListColumnsSet, mainFieldListColumnsSetData
//             , detailFieldListColumnsSet1, detailFieldListColumnsSetData1
//             , detailFieldListColumnsSet2, detailFieldListColumnsSetData2
//             , detailFieldListColumnsSet3, detailFieldListColumnsSetData3
//             , detailFieldListColumnsSet4, detailFieldListColumnsSetData4
//         } = toJS(status);
//         const { isFormInit } = newDetailForm;
//         let group = [];
//         let i = 0;
//         const formParams = newDetailForm.getFormParams();
//         //初始化明细表组件数据

//         this.initColumsSet("mainTable", mainFieldListColumnsSet, newForm, mainFieldListColumnsSetData, 'mainFieldListColumnsSetData');
//         let columnsDatas = this.setColumns(mainFieldListColumnsSet);
        
//         let groupNum = TriggerDetailFormFields.length;

//         isFormInit && TriggerDetailFormFields && TriggerDetailFormFields.map(c => {
//             let items = [];

//             if (i == 0) {
//                 items.push({
//                     com: (
//                         <div className='liuchengchufaxiangxishezhi' style={{marginLeft: -25}}>
//                             <WeaTableEdit
//                                 // title={`WebService${getLabel(125442, "主表字段对应列表")}`}
//                                 showTitle={false}
//                                 pushTitleIntoHeader={false}
//                                 tableProps={{ showEmptyText: false }}
//                                 ref={el => { this.tableEdit = el }}
//                                 // columns={mainFieldListColumnsSet}
//                                 columns={columnsDatas}
//                                 datas={mainFieldListColumnsSetData}
//                                 draggable={false}
//                                 showAdd={false}
//                                 showDelete={false}
//                                 showCopy={false}
//                                 getRowSelection={a => { return false }}
//                                 onAdd={(ks, ds) => { }}
//                                 onEdit={(ks, ds, bdata, key) => {
//                                     if (key == "rulesopt") {
//                                         let editRow = ds[0];
//                                         let rulesopt = editRow.rulesopt;
//                                         if (rulesopt == "5") {
//                                             //todo
//                                         }
//                                     }
//                                 }}
//                                 onCopy={(ks, ds) => { }}
//                                 onDelete={(ks, ds) => { }}
//                                 onChange={(datas) => {
//                                     tencentMailStore.setState({ mainFieldListColumnsSetData: datas })
//                                 }}

//                             />
//                         </div>
//                     ),
//                     hide: newDetailForm.isHide(c, (keys, allParams) => {
//                         return (false);
//                     })
//                 });
//             }
//             if (i > 0 && groupNum > 1) {
//                 let detailColumnsDatas = [];
//                 switch (i) {
//                     case 1:
//                         if (detailFieldListColumnsSetData1 && detailFieldListColumnsSetData1.length) {
//                             detailFieldListColumnsSetData1[0].seqNum = i;
//                             this.initColumsSet("detailTable", detailFieldListColumnsSet1, newForm, detailFieldListColumnsSetData1, 'detailFieldListColumnsSetData1');
//                             detailColumnsDatas[i] = this.setColumns(detailFieldListColumnsSet1);
//                         }
//                         break;

//                     case 2:
//                         if (detailFieldListColumnsSetData2 && detailFieldListColumnsSetData2.length) {
//                             detailFieldListColumnsSetData2[0].seqNum = i;
//                             this.initColumsSet("detailTable", detailFieldListColumnsSet2, newForm, detailFieldListColumnsSetData2, 'detailFieldListColumnsSetData2');
//                             detailColumnsDatas[i] = this.setColumns(detailFieldListColumnsSet2);
//                         }
//                         break;
//                     case 3:
//                         if (detailFieldListColumnsSetData3 && detailFieldListColumnsSetData3.length) {
//                             detailFieldListColumnsSetData3[0].seqNum = i;
//                             this.initColumsSet("detailTable", detailFieldListColumnsSet3, newForm, detailFieldListColumnsSetData3, 'detailFieldListColumnsSetData3');
//                             detailColumnsDatas[i] = this.setColumns(detailFieldListColumnsSet3);
//                         }
//                         break;
//                     case 4:
//                         if (detailFieldListColumnsSetData4 && detailFieldListColumnsSetData4.length) {
//                             detailFieldListColumnsSetData4[0].seqNum = i;
//                             this.initColumsSet("detailTable", detailFieldListColumnsSet4, newForm, detailFieldListColumnsSetData4, 'detailFieldListColumnsSetData4');
//                             detailColumnsDatas[i] = this.setColumns(detailFieldListColumnsSet4);
//                         }
//                         break;
//                     default:
//                         break;

//                 }
//                 items.push({
//                     com: (
//                         <div className='liuchengchufamingxibiao' style={{marginLeft: -25}}>
//                             <WeaTableEdit
//                                 // title={`WebService${getLabel(17632, "参数设置")}`}
//                                 showTitle={false}
//                                 pushTitleIntoHeader={false}
//                                 tableProps={{ showEmptyText: false }}
//                                 columns={detailColumnsDatas[i]}
//                                 // columns={i == 1 ? detailFieldListColumnsSet1 : i == 2 ? detailFieldListColumnsSet2 : i == 3 ? detailFieldListColumnsSet3 : i == 4 ? detailFieldListColumnsSet4 : []}
//                                 datas={i == 1 ? detailFieldListColumnsSetData1 : i == 2 ? detailFieldListColumnsSetData2 : i == 3 ? detailFieldListColumnsSetData3 : i == 4 ? detailFieldListColumnsSetData4 : []}
//                                 draggable={false}
//                                 showAdd={false}
//                                 showDelete={false}
//                                 showCopy={false}
//                                 getRowSelection={a => { return false }}
//                                 onAdd={(ks, ds) => { }}
//                                 onEdit={(ks, ds) => { }}
//                                 onCopy={(ks, ds) => { }}
//                                 onDelete={(ks, ds) => { }}
//                                 onChange={(datas) => {
//                                     let seqNum = datas[0].seqNum;

//                                     if (seqNum) {
//                                         switch (seqNum) {
//                                             case 1:
//                                               tencentMailStore.setState({detailFieldListColumnsSetData1: datas});
//                                               break;
//                                             case 2:
//                                               tencentMailStore.setState({detailFieldListColumnsSetData2: datas});
//                                               break;
//                                             case 3:
//                                               tencentMailStore.setState({detailFieldListColumnsSetData3: datas});
//                                               break;
//                                             case 4:
//                                               tencentMailStore.setState({detailFieldListColumnsSetData4: datas});
//                                               break;
//                                             default:
//                                               break;

//                                         }

//                                     }

//                                 }}

//                             />
//                         </div>
//                     ),
//                     hide: newDetailForm.isHide(newDetailForm, (keys, allParams) => {
//                         return (false);
//                     })
//                 });
//             }

//             if (i == groupNum - 1) {
//                 //说明
//                 items.push({
//                     com: (
//                         <div style={{marginLeft:-30}}>
//                             <div class='badge' style={{ paddingLeft: 10, paddingBottom: 10 }}><span style={{ marginLeft: 10 }}>1、{getLabel('23127', '流程标题：可以选择某个外部字段做为流程标题的来源，如果没选择，流程标题按“流程名-创建人名-日期”的格式自动生成。')}</span></div>
//                             <div class='badge' style={{ paddingLeft: 10, paddingBottom: 10 }}><span style={{ marginLeft: 10 }}>2、{getLabel('23126', '转换规则：转换规则只针对人力资源浏览框，部门浏览框和分部浏览框，如果选择了转换规则，将按照转换规则字段与外部字段对应，再通过转换字段找到人力资源浏览框，部门浏览框和分部浏览框对应的值。\n' +
//                                 '   [创建人可以在转换规则中选择“固定创建人选择”，选择的人员即做为触发流程的创建人，如果没有选择，则以系统管理员做为创建人。]')}</span></div>
//                             <div class='badge' style={{ paddingLeft: 10, paddingBottom: 10 }}><span style={{ marginLeft: 10 }}>3、{getLabel('23123,23124,23125', '选择外部字段与流程字段一一对应，在将外部字段赋值的过程中，如果外部字段的数据库类型与流程字段类型不匹配将按以下规则处理：流程字段是字符型，如果外部数据超长，则对外部数据进行截位后赋值给流程字段；流程字段是整型或浮点型，如果外部数据为字符，则赋值-1给流程字段。')}</span></div>

//                         </div>
//                     ),
//                     hide: newDetailForm.isHide(newDetailForm, (keys, allParams) => {
//                         return (false);
//                     })
//                 });

//             }

//             group.push(<WeaSearchGroup center={false} col={1} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} />);
//             i++;
//         });
//         return group;
//     }

//     /**
//      * todo 冗余代码,和NewForm一致, 待处理
//      * @returns {Array}
//      */
//     getSearchs = () => {
//         const { tencentMailStore } = this.props;
//         const { newForm, status } = tencentMailStore;
//         const { TriggerFormFields } = toJS(status);
//         const { isFormInit } = newForm;
//         let group = [];
//         let i = 0;
//         const formParams = newForm.getFormParams();
//         isFormInit && TriggerFormFields && TriggerFormFields.map(c => {
//             let items = [];

//             c.items.map(fields => {

//                 items.push({
//                     com: (
//                         <WeaFormItem
//                             label={`${fields.label}`}
//                             labelCol={{ span: `${fields.labelcol}` }}
//                             wrapperCol={{ span: `${fields.fieldcol}` }}
//                             error={newForm.getError(fields)}
//                             tipPosition="bottom"
//                         >

//                             <WeaSwitch fieldConfig={fields} form={newForm} formParams={formParams} onChange={v => {
//                                 if (getKey(fields) === 'workFlowId') {
//                                     tencentMailStore.newForm = new WeaForm();
//                                     let params = newForm.getFormParams();
//                                     params.from = 'detailedit';
//                                     tencentMailStore.getTriggerAddForm(params);
//                                     this.setState({ TriggerFormFields: TriggerFormFields });
//                                 } else if (getKey(fields) === 'outermaintable') {
//                                   try{
//                                     let outermaintable = newForm.getFormParams().outermaintable;
//                                     let datasourceid = newForm.getFormParams().datasourceid;
//                                     TriggerFormFields[0].items[7].browserConditionParam.dataParams = { dmltablename: outermaintable, datasourceid: datasourceid }
//                                     TriggerFormFields[0].items[9].browserConditionParam.dataParams = { dmltablename: outermaintable, datasourceid: datasourceid }
//                                     TriggerFormFields[0].items[10].browserConditionParam.dataParams = { dmltablename: outermaintable, datasourceid: datasourceid }
//                                     TriggerFormFields[0].items[14].browserConditionParam.dataParams = { dmltablename: outermaintable, datasourceid: datasourceid }

//                                     tencentMailStore.setState({ TriggerFormFields: TriggerFormFields });
//                                   }catch (e){}


//                                 } else if (getKey(fields) === 'isview') {
//                                     if (newForm.getFormParams().isview == "1") {
//                                         newForm.updateFields({ datarecordtype: "1", isupdatewfdata: "1" });
//                                         TriggerFormFields[0].items[8].options[0].selected = true;
//                                         TriggerFormFields[0].items[8].options[1].selected = false;
//                                         TriggerFormFields[0].items[8].viewAttr = "1";
//                                         TriggerFormFields[0].items[8].hasBorder = true;

//                                         TriggerFormFields[0].items[13].options[0].selected = true;
//                                         TriggerFormFields[0].items[13].options[1].selected = false;
//                                         TriggerFormFields[0].items[13].viewAttr = "1";
//                                         TriggerFormFields[0].items[13].hasBorder = true;
//                                     } else {
//                                         if(newForm.getFormParams().isalways != "1") {
//                                             TriggerFormFields[0].items[13].viewAttr = "2";
//                                             TriggerFormFields[0].items[13].hasBorder = false;
//                                         }
//                                         TriggerFormFields[0].items[8].viewAttr = "2";
//                                         TriggerFormFields[0].items[8].hasBorder = false;
//                                     }
//                                     tencentMailStore.setState({ TriggerFormFields: TriggerFormFields });
//                                 } else if(getKey(fields) === 'setname') {
//                                     let checkParams = {
//                                         tableName: 'outerdatawfset',
//                                         fieldName: 'setname',
//                                         fieldValue: newForm.getFormParams().setname.replace(/^(\s*)|(\s*)$/g, ''),
//                                         idName: 'id',
//                                         idValue: tencentMailStore.settingRegisterID
//                                     };
//                                     checkTableFieldValueUnique(checkParams).then(result => {
//                                         if(result&&result.isNotUnique) {
//                                             newForm.showError('setname',getLabel('129943','名称已存在'));
//                                         }
//                                     });
//                                 } else if(getKey(fields) === 'isalways') {
//                                     if(newForm.getFormParams().isalways=="1") {
//                                         newForm.updateFields({isupdatewfdata:"1"});
//                                         TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').options[0].selected = true);
//                                         TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').options[1].selected = false);
//                                         TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').viewAttr = 1);
//                                         TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').hasBorder = true);
//                                     }else {
//                                         if(newForm.getFormParams().isview != "1") {
//                                             TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').viewAttr = 2);
//                                             TriggerFormFields[0].items && TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata') && (TriggerFormFields[0].items.find(v => v.domkey[0]=='isupdatewfdata').hasBorder = false);
//                                         }
//                                     }
//                                     tencentMailStore.setState({ TriggerFormFields: TriggerFormFields });
//                                 }
//                             }} />
//                         </WeaFormItem>),
//                     colSpan: 1,
//                     hide: newForm.isHide(fields, (keys, allParams) => {
//                         let bool = false;
//                         if (allParams.isview == "1") {
//                             if (getKey(fields) === 'requestid' || getKey(fields) === 'FTriggerFlag'
//                                 || getKey(fields) === 'FTriggerFlagValue' || getKey(fields) === 'isupdatewfdataField') {
//                                 bool = true;
//                             }
//                         }
//                         getKey(fields) === 'updateisnextnode' && allParams.isupdatewfdata == '1' && (bool = true);
//                         getKey(fields) === 'requestid' && allParams.datarecordtype == '1' && (bool = true);
//                         getKey(fields) === 'FTriggerFlag' && allParams.datarecordtype == '1' && (bool = true);
//                         getKey(fields) === 'FTriggerFlagValue' && allParams.datarecordtype == '1' && (bool = true);
//                         getKey(fields) === 'successback' && allParams.datarecordtype == '1' && (bool = true);
//                         getKey(fields) === 'failback' && allParams.datarecordtype == '1' && (bool = true);

//                         getKey(fields) === 'isupdatewfdataField' && allParams.isupdatewfdata == '1' && (bool = true);
//                         return bool;
//                     })
//                 });

//             });

//             if (i == 1) {
//                 //说明
//                 items.push({
//                     com: (
//                         <div style={{marginLeft: -50}} >
//                             <div class='badge' style={{ paddingLeft: 30, paddingBottom: 10 }}>1、<span style={{ marginLeft: 10 }}>{getLabel('386907', '该流程自动触发时，将根据外部主表条件搜索外部主表，有多少条记录即触发多少条流程；流程主字段的值来源于外部主表，而每条流程的各明细值将分别根据明细表条件搜索明细表得到的结果进行赋值；主表中必须包含主键(默认为id)')}</span></div>
//                             <div class='badge' style={{ paddingLeft: 30, paddingBottom: 10 }}>2、<span style={{ marginLeft: 10 }}>{getLabel(386908, '条件以“where”开头，如：“where fieldname1=1 and fieldname2=\'value2\'”；回写设置以“set”开头，如：“set flag=1,isok=true”，FtriggerFlag和requestid字段自动更新，不能在此设置')}</span></div>
//                             <div class='badge' style={{ paddingLeft: 30, paddingBottom: 10 }}>3、<span style={{ marginLeft: 10 }}>{getLabel(391069, '流程触发时如果需要回写外部主表，需要设置是否回写、流程ID字段、标志字段、标志字段需要回写的值(字符型)，回写数据时，默认标志字段=1：表示已触发，流程ID字段=0：表示流程创建人对应的外部字段值为空，流程ID字段=-1：表示外部字段保存的人员信息在oa中不存在')}</span></div>
//                             <div class='badge' style={{ paddingLeft: 30, paddingBottom: 10 }}>4、<span style={{ marginLeft: 10 }}>{getLabel(386910, '外部明细表数据如需与主表数据关联，可将外部明细表条件设置为“where \'明细表.字段\'=\'主表.字段\'”')}</span></div>

//                         </div>
//                     ),
//                     hide: newForm.isHide(newForm, (keys, allParams) => {
//                         return (false);
//                     })
//                 });

//             }

//             group.push(<WeaSearchGroup center={i < 1 ? true : false} col={1} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} />);
//             i++;
//         });
//         return group;
//     }

//     showMessage = (timer) => {
//         setTimeout(function() {
//             $('#shujugaibian').fadeOut();
//         }, timer);
//         return '';
//     }

//     reloadFlowInfo = () => {
//         const { tencentMailStore } = this.props;
//         const { settingRegisterID, getTriggerResetFormFieldMapping } = tencentMailStore;

//         getTriggerResetFormFieldMapping({viewid: settingRegisterID});
//         this.showMessage(0);
//     }

//     reloadHelpfulTip = () => {
//         const { tencentMailStore } = this.props;
//         const { hasChangedWorkflowForm } = toJS(tencentMailStore.status);

//         return (<div id="shujugaibian" style={{position: 'absolute', zIndex: 1, left: '45%', textAlign: 'left', top:0}}>
//                 {hasChangedWorkflowForm ? <div><p>数据表单已被修改!</p>
//                     <p><span style={{color: 'blue', cursor: 'pointer'}} onClick={() => this.reloadFlowInfo()}>点击此处</span>重新加载流程信息!</p></div> : ''}
//             </div>)
//     }

//     handleSaveAttachment = () => {
//       const { tencentMailStore } = this.props;
//       const { detailAttachmentSetForm } = tencentMailStore;
//       let { mainFieldListColumnsSetData, fieldid, detailFieldListColumnsSetData1, detailFieldListColumnsSetData2, detailFieldListColumnsSetData3, detailFieldListColumnsSetData4 } = toJS(tencentMailStore.status);

//       detailAttachmentSetForm.validateForm().then(f => {
//         if(f.isValid) {
//           tencentMailStore.setState({showAttachmentSetForm: false});
//           if(mainFieldListColumnsSetData) {
//             mainFieldListColumnsSetData && mainFieldListColumnsSetData.find(v => v.fieldid==fieldid)
//             && (mainFieldListColumnsSetData.find(v => v.fieldid==fieldid).attachment_settings = JSON.stringify(detailAttachmentSetForm.getFormParams()));
//             tencentMailStore.setState({ mainFieldListColumnsSetData: mainFieldListColumnsSetData });
//             }
//           if(detailFieldListColumnsSetData1) {
//             detailFieldListColumnsSetData1 && detailFieldListColumnsSetData1.find(v => v.fieldid==fieldid)
//             && (detailFieldListColumnsSetData1.find(v => v.fieldid==fieldid).attachment_settings = JSON.stringify(detailAttachmentSetForm.getFormParams()));
//             tencentMailStore.setState({ detailFieldListColumnsSetData1: detailFieldListColumnsSetData1 }); 
//           }
//           if(detailFieldListColumnsSetData2) {
//             detailFieldListColumnsSetData2 && detailFieldListColumnsSetData2.find(v => v.fieldid==fieldid)
//             && (detailFieldListColumnsSetData2.find(v => v.fieldid==fieldid).attachment_settings = JSON.stringify(detailAttachmentSetForm.getFormParams()));
//             tencentMailStore.setState({ detailFieldListColumnsSetData2: detailFieldListColumnsSetData2 }); 
//           }
//           if(detailFieldListColumnsSetData3) {
//             detailFieldListColumnsSetData3 && detailFieldListColumnsSetData3.find(v => v.fieldid==fieldid)
//             && (detailFieldListColumnsSetData3.find(v => v.fieldid==fieldid).attachment_settings = JSON.stringify(detailAttachmentSetForm.getFormParams()));
//             tencentMailStore.setState({ detailFieldListColumnsSetData3: detailFieldListColumnsSetData3 }); 
//           }
//           if(detailFieldListColumnsSetData4) {
//             detailFieldListColumnsSetData4 && detailFieldListColumnsSetData4.find(v => v.fieldid==fieldid)
//             && (detailFieldListColumnsSetData4.find(v => v.fieldid==fieldid).attachment_settings = JSON.stringify(detailAttachmentSetForm.getFormParams()));
//             tencentMailStore.setState({ detailFieldListColumnsSetData4: detailFieldListColumnsSetData4 }); 
//           }
//         }else {
//           f.showErrors();
//         }
//       })

      
//     }

//     getAttachmentBtn = () => {
//       let btnArr = [];
//       btnArr.push({
//         key: 'BTN_SAVE',
//         icon: <i className='icon-coms-Preservation' />,
//         content: `${getLabel(826, '确定')}`,
//         onClick: this.handleSaveAttachment,
//       });

//       return btnArr;
//     }

//     render() {
//         const { tencentMailStore } = this.props;
//         const { getTriggerCheckWorkflowForm, detailAttachmentSetForm,getTriggerEditDetailAttachmentSetForm } = tencentMailStore;
//         let { showNewDetailFormDialog, newDetailFormSelectedKey, hasChangedWorkflowForm, showAttachmentSetForm, mainFieldListColumnsSetData, fieldid, detailFieldListColumnsSetData1, detailFieldListColumnsSetData2, detailFieldListColumnsSetData3, detailFieldListColumnsSetData4 } = toJS(tencentMailStore.status);
//         const topTab = [
//             {
//                 color: "#000000",
//                 groupid: "flowAll",
//                 showcount: true,
//                 title: `${getLabel(81711, "基本信息")}`,
//                 viewcondition_dt: 0
//             }
//             , {
//                 color: "#000000",
//                 groupid: "flowAll",
//                 showcount: true,
//                 title: `${getLabel(19342, "详细设置")}`,
//                 viewcondition_dt: 1
//             }
//             , {
//               color: "#000000",
//               groupid: "flowAll",
//               showcount: true,
//               title: `${getLabel(23136, "触发周期")}`,
//               viewcondition_dt: 2
//             }
//         ];
//         return (
//             <div className='wea-integration-single'>
//                 <WeaDialog
//                     title={`${getLabel('26473,33720', '编辑流程触发集成')}`}
//                     icon='icon-coms-integration'
//                     iconBgcolor='#1a57a0'
//                     visible={showNewDetailFormDialog}
//                     hasScroll={true}
//                     style={{ width: 900, height: 600 }}
//                     onCancel={() => {
//                         tencentMailStore.setState({ showNewDetailFormDialog: false, newDetailFormSelectedKey : 0 });
//                     }}
//                     buttons={this.getBtns()}
//                     moreBtn={{
//                         datas: this.getRightMenu(),
//                         collectParams: []
//                     }}
//                 >
//                     <WeaRightMenu
//                         datas={this.getRightMenu()}
//                         collectParams={[]}>
//                         <div style={{position: "fixed", width: "100%", background: "#fff", zIndex: 9}}>
//                             <WeaTab
//                                 datas={topTab}
//                                 keyParam="viewcondition_dt" //主键
//                                 countParam="groupid" //数量
//                                 selectedKey={newDetailFormSelectedKey}
//                                 searchType={[]}
//                                 advanceHeight={80}
//                                 searchsAd={[]}
//                                 showSearchAd={false}
//                                 buttonsAd={[]}
//                                 setShowSearchAd={() => { }}
//                                 hideSearchAd={() => { }}
//                                 onChange={v => {
//                                     tencentMailStore.setState({newDetailFormSelectedKey : v});
//                                 }}
//                                 onSearch={() => { }}
//                                 onSearchChange={value => { }}
//                             />
//                             {this.reloadHelpfulTip()}
//                         </div>
//                         {/* 占位符，用于补充塌陷的固定高度 */}
//                         <div style={{height: "47px"}}></div>
//                         {
//                             newDetailFormSelectedKey == 0 ?
//                               this.getSearchs():newDetailFormSelectedKey == 1?
//                               this.getSearchs2(): this.getSearchs3()
//                         }
//                     </WeaRightMenu>
//                 </WeaDialog>
//                 <WeaDialog
//                     title={getLabel(23796,'附件设置')}
//                     icon='icon-coms-integration'
//                     iconBgcolor='#1a57a0'
//                     visible={showAttachmentSetForm}
//                     hasScroll={true}
//                     style={{width: 700, height: 600}}
//                     onCancel={() => tencentMailStore.setState({showAttachmentSetForm: false})}
//                     buttons={[<Button type='primary' onClick={this.handleSaveAttachment}>{getLabel(826, '确定')}</Button>]}
//                     moreBtn={{
//                       datas: this.getAttachmentBtn(),
//                       collectParams: []
//                     }}
//                 >
//                     <WeaRightMenu datas={this.getAttachmentBtn()} collectParams={[]}>
//                         {
//                             detailAttachmentSetForm.render({col: 1, center: true}, {
//                                 onChange: (v) => {
//                                   if (v.attachment_type) {
//                                     let params=Object.assign({},detailAttachmentSetForm.getFormParams());
//                                     getTriggerEditDetailAttachmentSetForm(params);
//                                   }
//                                 },
//                                 isHide: (key, formParams) => {}
//                             }, true, (item, index) => {
//                               if(index == 1) {
//                                 let items = [];
//                                 item && item.items.map(field => {
//                                     items.push({
//                                         com: (<div style={{marginLeft: -60, marginRight: -50}}>
//                                           <WeaFormItem
//                                             labelCol={{span: 0}}
//                                             wrapperCol={{span: 24}}
//                                             error={detailAttachmentSetForm.getError(field)}
//                                             tipPosition="bottom"
//                                           >
//                                             <WeaSwitch form={detailAttachmentSetForm} fieldConfig={field} formParams={detailAttachmentSetForm.getFormParams()} />
//                                           </WeaFormItem>
//                                         </div>),
//                                         colSpan: 1
//                                     })
//                                 })
                            
//                                 return <WeaSearchGroup center={true} col={1} items={items} title={item.title} showGroup={item.defaultshow} needTrigger={item.defaultshow} />
//                               }
//                             })
//                         }
//                     </WeaRightMenu>
//                 </WeaDialog>
//             </div>
//         )
//     }
// }
