// import React from "react";
// import {inject, observer} from "mobx-react";
// import { Button} from "antd";
// import {toJS} from "mobx";
// import {WeaForm, WeaLogView, WeaNewScroll, WeaSwitch, WeaTableNew} from "comsMobx";
// import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu} from "ecCom";
// import * as IntegrationUtil from "../../util/IntegrationUtil";
// import {checkTableFieldValueUnique}  from "../../apis/CommonService";
// const { getKey } = WeaTools;
// const getLabel = WeaLocaleProvider.getLabel;

// const store = ["authenticationCenterStore"];

// @inject(...store)
// @observer
// export default class AppEditDialog extends React.Component {
//   render() {
//     const {authenticationCenterStore} = this.props;
//     const status = toJS(authenticationCenterStore.status);
    
//     return <WeaDialog
//       title={getLabel('382079','注册应用')}
//       onCancel={()=> authenticationCenterStore.setState({appEditFormDialogVisible: false})}
//       visible={status.appEditFormDialogVisible}
//       style={{width: 700, height: 600}}
//       hasScroll
//       moduleName="integration"
//       buttons={[
//         <Button type="primary" onClick={()=> this.onRightMenuClick('BTN_SAVE')}>{getLabel(86,'保存')}</Button>,
//         // <Button type="primary" onClick={()=> this.onRightMenuClick('BTN_SAVE_AND_OPEN_DETAIL')}>{getLabel(125540,'保存后详细设置')}</Button>,
//       ]}
//       moreBtn={{
//         datas : this.getRightMenu(),
//         collectParams: []
//       }}
//     >
//       <WeaRightMenu
//         datas={this.getRightMenu()}
//         collectParams={[]}
//       >
//       {
//         authenticationCenterStore.registerAppEditForm.render({col: 1},{
//         onChange: (v)=> {},
//         isHide: (key, formParams) => {}

//       },true,(c, idx)=>{
//         if(idx==0){
//           let items = [];
//           let form = authenticationCenterStore.registerAppEditForm;
//           let formParams = form.getFormParams();
//           c.items.map(fields => {
//             items.push({
//               com: (
//                 <WeaFormItem
//                   label={`${fields.label}`}
//                   labelCol={{span: `${fields.labelcol}`}}
//                   wrapperCol={{span: `${fields.fieldcol}`}}
//                   error={form.getError(fields)}
//                   tipPosition="bottom"
//                 >
//                   <nobr>
//                     <WeaSwitch fieldConfig={fields} form={form} formParams={formParams} 
//                       onChange={v => {
//                         if(getKey(fields) === 'appid') {
//                           let checkParams = {
//                             tableName: 'weaver_sso_app',
//                             fieldName: 'appid',
//                             fieldValue: form.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''),
//                             idName: 'id',
//                             idValue: ''
//                           };
//                           checkTableFieldValueUnique(checkParams).then(result => {
//                             if(result&&result.isNotUnique) {
//                               form.showError('appid',getLabel('387654','标识已存在'));
//                               // message.error(getLabel('387654','标识已存在'));
//                             }
//                           });
//                         }
//                       }}
//                     />
//                     {/*{getKey(fields)==='account_rules'&&formParams.account_rules>5?<Button type="primary" style={{marginLeft:5}}>{getLabel(86,'数据映射')}</Button>:""}*/}
//                   </nobr>

//                 </WeaFormItem>),
//               colSpan: 1,
//               hide: form.isHide(fields, (key, formParams) => {
//                 let hide = false;
//                 if ('definebroswerType' == key && formParams.account_rules !== '7') {
//                   hide = true;
//                 }
//                 return hide;
//               }),
//               onChange: (v)=> {
//                 // console.log(v);
//               }
//             })
//           });

//           return <WeaSearchGroup center={true}  col={1}  needTigger={true} title={c.title} showGroup={c.defaultshow} items={items}/>
//         }
//       })}
//       </WeaRightMenu>
//     </WeaDialog>
//   }

//   getRightMenu() {
//     let btnArr = [
//       {
//         key: 'BTN_SAVE',
//         icon: <i className='icon-coms-Preservation'/>,
//         content : `${getLabel(86,'保存')}`,
//         onClick : () => {this.onRightMenuClick('BTN_SAVE')}
//       }
//       // ,{
//       //   key: 'BTN_SAVE_AND_OPEN_DETAIL',
//       //   icon: <i className='icon-coms-Preservation'/>,
//       //   content : `${getLabel(125540,'保存后详细设置')}`,
//       //   onClick : () => {this.onRightMenuClick('BTN_SAVE_AND_OPEN_DETAIL')}
//       // }
//     ];
//     return btnArr;
//   }

//   ipv6Test = (value) => {
//     let reg = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|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25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/

//     let datas = value.split(',');
//     for(let i = 0; i < datas.length; i++) {
//       if(!reg.test(datas[i].trim()) && (!regV4.test(datas[i].trim()))) {
//         return false;
//       }
//     }
//     return true;
//   }
  
//   onRightMenuClick = (type) => {
//     const {authenticationCenterStore} = this.props;
//     const {registerAppEditForm, status} = authenticationCenterStore;
//     const {interfaceRegisterCustomFormHiddenFields} = toJS(authenticationCenterStore.status);
//     if(type == 'BTN_SAVE'){
//       let checkParams = {
//         tableName: 'weaver_sso_app',
//         fieldName: 'appid',
//         fieldValue: registerAppEditForm.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''),
//         idName: 'id',
//         idValue: ''
//       };
//       checkTableFieldValueUnique(checkParams).then(result => {
//         if(result&&result.isNotUnique) {
//           registerAppEditForm.showError('appid',getLabel('387654','标识已存在'));
//           // message.error(getLabel('387654','标识已存在'));
//         }else {
//           let value = registerAppEditForm.getFormParams().allow_ip;
//           let ipv6 = this.ipv6Test(value.trim());
//           IntegrationUtil.onCheck(registerAppEditForm,function () {
//             if(value.trim() == '' || (value.trim() && ipv6)) {
//               let id="";
//               let operation = "add";
//               let params = Object.assign({id:id,operation:operation}, registerAppEditForm.getFormParams());
//               authenticationCenterStore.getRegisterAppOperation(params);
//             }else {
//               registerAppEditForm.showError('allow_ip',getLabel('382232','应用服务器地址非法'));
//             }
//           });
//         }
//       });
//     }

//     if(type == 'BTN_SAVE_AND_OPEN_DETAIL'){
//       IntegrationUtil.onCheck(registerAppEditForm,function () {
//         let id="";
//         let operation = ("add");
//         let params = Object.assign({id:id,operation:operation}, registerAppEditForm.getFormParams());
//         authenticationCenterStore.getRegisterAppOperation(params,(result)=>{
//           if(result.id) {
//             let p={id:result.id,operation:"edit"}
//             authenticationCenterStore.getRegisterAppEditForm(p);
//           }
//         });
//       });

//     }

//   }

// }
