| | |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import MutilForm from '@/tabviews/zshare/mutilform' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | type: PropTypes.string, // 判断当前为主表(main)、子表(sub)、子表标签(subtab) |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | actions: PropTypes.array, // 按钮组 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | refreshdata: PropTypes.func, // 执行完成后数据刷新 |
| | | gettableselected: PropTypes.func // 获取表格中数据 |
| | | selectedData: PropTypes.array // 表格选中数据 |
| | | } |
| | | |
| | | state = { |
| | |
| | | configMap: {} |
| | | } |
| | | |
| | | refreshdata = (item, type) => { |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (item, record) => { |
| | | const { setting } = this.props |
| | | const { setting, selectedData } = this.props |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | let data = selectedData || [] |
| | | |
| | | if (record) { // 表格中触发按钮 |
| | | data = [record] |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectline'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (item.Ot === 'requiredSgl' && data.length !== 1) { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置主键!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | |
| | | LText: values.LongParam |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | | if (btn.sqlType === 'delete') { |
| | | param.LText = window.GLOB.appkey || '' |
| | | param.Remark = '' |
| | |
| | | param.func_param = '' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (options.cloudServiceApi) { |
| | |
| | | }) |
| | | } |
| | | |
| | | this.refreshdata(btn, 'success') |
| | | if (btn.execSuccess !== 'never') { |
| | | this.props.refreshdata() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 15 |
| | | duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | | } |
| | | |
| | | this.refreshdata(btn, 'error') |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.props.type === 'subtab') { |
| | | container = document.body |
| | | } |
| | | |
| | | return ( |
| | | <Modal |
| | | title={title} |
| | |
| | | |
| | | render() { |
| | | return ( |
| | | <div className="button-list toolbar-button"> |
| | | <div className="script-button-list script-toolbar-button"> |
| | | {this.props.actions.map((item, index) => { |
| | | return ( |
| | | <Button |