| | |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import MutilForm from '@/tabviews/zshare/mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import Utils, { getSysDefaultSql } from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | |
| | | type: PropTypes.string, // 判断当前为主表(main)、子表(sub)、子表标签(subtab) |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | actions: PropTypes.array, // 按钮组 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | columns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | |
| | | this.setState({loadingUuid: ''}) |
| | | }) |
| | | } else if (item.OpenType === 'pop') { |
| | | item = updateForm(item) |
| | | if (item.setting.display === 'prompt') { // 如果表单以是否框展示,不请求下拉菜单信息 |
| | | this.setState({ |
| | | execAction: item, |
| | |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | const { setting, logcolumns } = this.props |
| | | const { setting, columns } = this.props |
| | | |
| | | if (btn.intertype === 'inner') { |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns) // 数据源 |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | |
| | | } |
| | | } |
| | | param.ID = primaryId || Utils.getguid() |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 数据源 |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 数据源 |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | |
| | | } |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | param.ID = _formPrimaryId || Utils.getguid() |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else if (btn.sql) { |
| | | if (index !== 0) { |
| | | formdata = formdata.map(_data => { |
| | |
| | | } |
| | | |
| | | param.ID = primaryId |
| | | param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 数据源 |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | | param.LText2 = LText2 |
| | | param.LText1 = LText1 |
| | | param.LText = LText |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | } |
| | | |
| | |
| | | let param = params.shift() |
| | | let _outParam = null |
| | | let _localParam = null |
| | | let errRes = null |
| | | |
| | | if (widthNumber) { |
| | | this.setState({ |
| | |
| | | response.rduri = window.GLOB.mainSystemApi |
| | | |
| | | if (_localParam.LTextOut) { |
| | | _localParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _localParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _localParam.secretkey = Utils.encrypt(_localParam.LTextOut, _localParam.timestamp) |
| | | _localParam.open_key = Utils.encryptOpenKey(_localParam.secretkey, _localParam.timestamp) |
| | | } |
| | |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | if (_callbackparam.LTextOut) { |
| | | _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) |
| | | _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) |
| | | } |
| | |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | |
| | | if (_localParam) { |
| | | |
| | | if (!res.status) { |
| | | errRes = res |
| | | } |
| | | return Api.getLocalConfig(_localParam) |
| | | } else if (res.status) { |
| | | if (params.length === 0) { |
| | |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | if (res.status && !errRes) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | |
| | | this.outerLoopRequest(params, btn, _resolve, widthNumber) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | this.execError(errRes || res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | |
| | | const { BData } = this.props |
| | | const { execAction, tabledata } = this.state |
| | | let _this = this |
| | | let _fields = [] |
| | | |
| | | if (execAction.groups.length > 0) { |
| | | execAction.groups.forEach(group => { |
| | | _fields = [..._fields, ...group.sublist] |
| | | }) |
| | | } else { |
| | | _fields = execAction.fields |
| | | } |
| | | |
| | | let result = _fields.map(item => { |
| | | let result = [] |
| | | execAction.fields.forEach(item => { |
| | | if (!item.field) return |
| | | let _readin = item.readin !== 'false' |
| | | let _initval = item.initval |
| | | |
| | |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } |
| | | |
| | | return { |
| | | result.push({ |
| | | key: item.field, |
| | | readonly: item.readonly === 'true', |
| | | readin: _readin, |
| | | fieldlen: _fieldlen, |
| | | type: item.type, |
| | | value: _initval |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | confirm({ |