From 0ae7068208a32226f8f8812641f31646fb8b54c9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 29 十一月 2019 09:16:14 +0800 Subject: [PATCH] 2019-11-29-01 --- src/tabviews/commontable/mainAction/index.jsx | 130 ++++++++++++++++++++----------------------- 1 files changed, 61 insertions(+), 69 deletions(-) diff --git a/src/tabviews/commontable/mainAction/index.jsx b/src/tabviews/commontable/mainAction/index.jsx index 97f3764..277e536 100644 --- a/src/tabviews/commontable/mainAction/index.jsx +++ b/src/tabviews/commontable/mainAction/index.jsx @@ -6,7 +6,7 @@ import Api from '@/api' import './index.scss' -// const { confirm } = Modal +const { confirm } = Modal class MainAction extends Component { static propTpyes = { @@ -28,77 +28,69 @@ this.props.refreshdata() } actionTrigger = (item) => { - // let _this = this + let _this = this let data = this.props.gettableselected() || [] + console.log(item) 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.Ot !== 'notRequired' && data.length === 0) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectline'] + }) + return + } else if (item.Ot === 'requiredSgl' && data.length !== 1) { + // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 + 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.OpenType === 'prompt') { + 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.OpenType === 'exec') { + 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 = () => { -- Gitblit v1.8.0