| | |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | // const { confirm } = Modal |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | |
| | | this.props.refreshdata() |
| | | } |
| | | actionTrigger = (item) => { |
| | | let _this = this |
| | | // let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | if (item.Ot === 'required' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectline'] |
| | | }) |
| | | return |
| | | } else if (item.Ot === 'pop' && data.length !== 1) { |
| | | if (data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectline'] |
| | | }) |
| | | return |
| | | } else { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectSingleLine'] |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | console.log(data) |
| | | // if (item.Ot === 'required' && data.length === 0) { |
| | | // // 需要选择行时,校验数据 |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: this.props.dict['main.action.confirm.selectline'] |
| | | // }) |
| | | // return |
| | | // } else if (item.Ot === 'pop' && data.length !== 1) { |
| | | // if (data.length === 0) { |
| | | // // 需要选择行时,校验数据 |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: this.props.dict['main.action.confirm.selectline'] |
| | | // }) |
| | | // return |
| | | // } else { |
| | | // // 需要选择单行时,校验数据 |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: this.props.dict['main.action.confirm.selectSingleLine'] |
| | | // }) |
| | | // return |
| | | // } |
| | | // } |
| | | |
| | | if (item.Action === 'Prompt' || item.Action === 'Delete') { |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return Api.setActionSubmit({ |
| | | func: 'SetActionSubmitSuccess' |
| | | // func: 'SetActionSubmitError' |
| | | }).then((res) => { |
| | | if (res.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: _this.props.dict['main.action.confirm.success'] |
| | | // duration: 0 |
| | | // description: |
| | | }) |
| | | _this.refreshdata() |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (item.Action === 'Update') { |
| | | Api.getModelFormData(item.MenuID).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | formdata: res.data.map(input => { |
| | | let validate = input.Validate && JSON.parse(input.Validate) |
| | | input.DynOptions = JSON.parse(input.DynOptions) |
| | | input.required = (validate && validate.required) || false |
| | | return input |
| | | }), |
| | | visible: true, |
| | | execAction: item, |
| | | tabledata: data[0] |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // if (item.Action === 'Prompt' || item.Action === 'Delete') { |
| | | // confirm({ |
| | | // title: this.props.dict['main.action.confirm.tip'], |
| | | // onOk() { |
| | | // return Api.setActionSubmit({ |
| | | // func: 'SetActionSubmitSuccess' |
| | | // // func: 'SetActionSubmitError' |
| | | // }).then((res) => { |
| | | // if (res.status) { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: _this.props.dict['main.action.confirm.success'] |
| | | // // duration: 0 |
| | | // // description: |
| | | // }) |
| | | // _this.refreshdata() |
| | | // } else { |
| | | // notification.error({ |
| | | // top: 92, |
| | | // message: res.message |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else if (item.Action === 'Update') { |
| | | // Api.getModelFormData(item.MenuID).then(res => { |
| | | // if (res.status) { |
| | | // this.setState({ |
| | | // formdata: res.data.map(input => { |
| | | // let validate = input.Validate && JSON.parse(input.Validate) |
| | | // input.DynOptions = JSON.parse(input.DynOptions) |
| | | // input.required = (validate && validate.required) || false |
| | | // return input |
| | | // }), |
| | | // visible: true, |
| | | // execAction: item, |
| | | // tabledata: data[0] |
| | | // }) |
| | | // } |
| | | // }) |
| | | // } |
| | | } |
| | | |
| | | getModels = () => { |