| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取或修改本地配置,增加appkey |
| | | */ |
| | | getLocalConfig (param) { |
| | | param.userid = param.userid || sessionStorage.getItem('UserID') || '' |
| | | param.lang = param.lang || sessionStorage.getItem('lang') || '' |
| | | param.SessionUid = localStorage.getItem('SessionUid') || '' |
| | | param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | let url = '/webapi/dostars' |
| | | if (param.rduri) { |
| | | url = param.rduri |
| | | delete param.rduri |
| | | } |
| | | |
| | | param = this.encryptParam(param) |
| | | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统配置,取值优先等级websql、缓存、服务器 |
| | | * @param {Object} param 请求参数 |
| | | */ |
| | | getCacheConfig (param) { |
| | | param.userid = sessionStorage.getItem('UserID') || '' |
| | |
| | | |
| | | /** |
| | | * @description 获取业务通用接口 |
| | | * 访问 'https://sso.mk9h.cn/webapi/dostars'或云端时,传入userid、LoginUID |
| | | */ |
| | | genericInterface (param) { |
| | | param.userid = sessionStorage.getItem('UserID') || '' |
| | | param.lang = sessionStorage.getItem('lang') || '' |
| | | param.userid = param.userid || sessionStorage.getItem('UserID') || '' |
| | | param.lang = param.lang || sessionStorage.getItem('lang') || '' |
| | | param.SessionUid = localStorage.getItem('SessionUid') || '' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | if (options.cloudServiceApi && param.rduri === options.cloudServiceApi) { // HS下菜单 |
| | | param.userid = sessionStorage.getItem('CloudUserID') || param.userid || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || param.LoginUID || '' |
| | | } |
| | | |
| | | let url = '/webapi/dostars' |
| | | if (param.rduri && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { // 切换用户需要通过本地 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel |
| | | * @description 导出Excel,后台生成文件 |
| | | */ |
| | | getExcelOut (param, name) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | param.lang = sessionStorage.getItem('lang') || '' |
| | | param.SessionUid = localStorage.getItem('SessionUid') || '' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | // getExcelOut (param, name) { |
| | | // param.userid = sessionStorage.getItem('UserID') |
| | | // param.lang = sessionStorage.getItem('lang') || '' |
| | | // param.SessionUid = localStorage.getItem('SessionUid') || '' |
| | | // param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | // param.appkey = window.GLOB.appkey || '' |
| | | |
| | | return new Promise(resolve => { |
| | | axios({ |
| | | url: '/webapi/doexcel', |
| | | responseType: 'blob', |
| | | method: 'post', |
| | | data: param |
| | | }).then(res => { |
| | | try { |
| | | const blob = new Blob([res]) |
| | | // return new Promise(resolve => { |
| | | // axios({ |
| | | // url: '/webapi/doexcel', |
| | | // responseType: 'blob', |
| | | // method: 'post', |
| | | // data: param |
| | | // }).then(res => { |
| | | // try { |
| | | // const blob = new Blob([res]) |
| | | |
| | | if (res.type === 'application/json') { |
| | | const reader = new FileReader() |
| | | reader.onload = e => resolve(JSON.parse(e.target.result)) |
| | | reader.readAsText(blob) |
| | | } else { |
| | | if ('download' in document.createElement('a')) { // 非IE下载 |
| | | const elink = document.createElement('a') |
| | | elink.download = name |
| | | elink.style.display = 'none' |
| | | elink.href = URL.createObjectURL(blob) |
| | | document.body.appendChild(elink) |
| | | elink.click() |
| | | URL.revokeObjectURL(elink.href) // 释放URL 对象 |
| | | document.body.removeChild(elink) |
| | | } else { // IE10+下载 |
| | | navigator.msSaveBlob(blob, name) |
| | | } |
| | | resolve() |
| | | } |
| | | } catch (e) { |
| | | resolve({ |
| | | ErrCode: 'E', |
| | | ErrMesg: '文件解析错误', |
| | | message: '', |
| | | status: false |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // if (res.type === 'application/json') { |
| | | // const reader = new FileReader() |
| | | // reader.onload = e => resolve(JSON.parse(e.target.result)) |
| | | // reader.readAsText(blob) |
| | | // } else { |
| | | // if ('download' in document.createElement('a')) { // 非IE下载 |
| | | // const elink = document.createElement('a') |
| | | // elink.download = name |
| | | // elink.style.display = 'none' |
| | | // elink.href = URL.createObjectURL(blob) |
| | | // document.body.appendChild(elink) |
| | | // elink.click() |
| | | // URL.revokeObjectURL(elink.href) // 释放URL 对象 |
| | | // document.body.removeChild(elink) |
| | | // } else { // IE10+下载 |
| | | // navigator.msSaveBlob(blob, name) |
| | | // } |
| | | // resolve() |
| | | // } |
| | | // } catch (e) { |
| | | // resolve({ |
| | | // ErrCode: 'E', |
| | | // ErrMesg: '文件解析错误', |
| | | // message: '', |
| | | // status: false |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 上传base64 |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | card: card, |
| | |
| | | const isApp = ['pc', 'mob'].includes(appType) |
| | | |
| | | let funTypes = [ |
| | | { value: 'changeuser', text: '切换用户' }, |
| | | { value: 'print', text: '标签打印' }, |
| | | { value: 'changeuser', text: '切换用户' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | { value: 'megvii', text: '旷视面板机' }, |
| | | { value: 'filezip', text: '文件压缩包' }, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (sumParam) { |
| | | Api.getLocalConfig(sumParam).then(res => { |
| | | Api.genericInterface(sumParam).then(res => { |
| | | if (res.status) { |
| | | resolve() |
| | | } else { |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | delete result.status |
| | | delete result.message |
| | |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | delete result.status |
| | | delete result.message |
| | |
| | | // group.subButton.$forbid = true // 不声明数据源变量 |
| | | group.subButton.OpenType = 'formSubmit' |
| | | group.subButton.execError = 'never' |
| | | group.subButton.logLabel = item.$menuname + '-' + group.subButton.label |
| | | |
| | | if (!group.subButton.Ot) { |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | |
| | | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | delete result.status |
| | | delete result.message |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | res.rduri = btn.interface |
| | | } |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | |
| | | this.getSelectMenuList() |
| | | }) |
| | | if (window.GLOB.mainSystemApi) { |
| | | Api.getLocalConfig(localParam).then(res => { |
| | | Api.genericInterface(localParam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | |
| | | if (window.GLOB.mainSystemApi) { |
| | | Api.getLocalConfig(localParam).then(res => { |
| | | Api.genericInterface(localParam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | |
| | | if (options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | |
| | | |
| | | if (options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | } |
| | | } else if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | res.rduri = btn.interface |
| | | } |
| | |
| | | _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) |
| | | } |
| | | |
| | | return Api.getLocalConfig(_callbackparam) |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | // 一次请求成功,进行下一项请求 |
| | |
| | | if (!res.status) { |
| | | errRes = res |
| | | } |
| | | return Api.getLocalConfig(_localParam) |
| | | return Api.genericInterface(_localParam) |
| | | } else if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | result.rduri = options.cloudServiceApi |
| | | result.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | result.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | result.rduri = btn.proInterface |
| | |
| | | _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' |
| | | _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' |
| | | |
| | | Api.getLocalConfig(_param).then(result => { |
| | | Api.genericInterface(_param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | result.tempId = tempId |
| | | resolve(result) |
| | | }) |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | |
| | | delete localParam.EasyCode |
| | | delete localParam.open_edition |
| | | |
| | | Api.getLocalConfig(localParam) |
| | | Api.genericInterface(localParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | }) |
| | | } |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | Api.genericInterface(localParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | Api.genericInterface(param) |
| | | } |
| | | |
| | | let _config = {...config, setting: setting} |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | Api.genericInterface(param) |
| | | } |
| | | |
| | | if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) { |
| | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | _resolve() |
| | | } else { |
| | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | resolve() |
| | | } else { |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | Api.genericInterface(param) |
| | | } |
| | | |
| | | resolve(values) |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | Api.genericInterface(param) |
| | | } |
| | | |
| | | resolve(values) |
| | |
| | | sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (sumParam) { |
| | | Api.getLocalConfig(sumParam).then(res => { |
| | | Api.genericInterface(sumParam).then(res => { |
| | | if (res.status) { |
| | | _resolve() |
| | | } else { |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | Api.genericInterface(param) |
| | | } |
| | | |
| | | resolve(values) |
| | |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | _resolve() |
| | | } else { |
| | |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | Api.genericInterface(localParam) |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | Api.genericInterface(localParam) |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | return Api.genericInterface(_param) |
| | | }).then(res => { |
| | | if (!res) return res |
| | | |
| | |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | return Api.genericInterface(_param) |
| | | }).then(res => { |
| | | if (!res || res === 'create') return res |
| | | |
| | |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | return Api.genericInterface(_param) |
| | | }).then(res => { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | |
| | | new Promise(resolve => { |
| | | // 获取云端存储过程信息 |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | |
| | | _mainParam = fromJS(param).toJS() |
| | | |
| | | return Api.getLocalConfig(param) |
| | | return Api.genericInterface(param) |
| | | }).then(res => { |
| | | if (res === false) return res |
| | | |
| | |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'changeuser', |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }, { |
| | | value: 'changeuser', |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }, { |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | if (window.GLOB.mkHS) { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | |
| | | func: 's_get_kei' |
| | | } |
| | | |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | let selectApp = null |
| | | let applist = result.data.map(item => { |
| | |
| | | _param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(_param).then(result => { |
| | | Api.genericInterface(_param).then(result => { |
| | | if (result.status) { |
| | | let config = '' |
| | | |
| | |
| | | let componentId = item.componentId |
| | | delete item.componentId |
| | | return new Promise(resolve => { |
| | | Api.getLocalConfig(item).then(res => { |
| | | Api.genericInterface(item).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | res.func = 's_sVersion_Local_add' |
| | | res.VersionName = version.id |
| | | |
| | | Api.getLocalConfig(res).then(result => { |
| | | Api.genericInterface(res).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.DateCount = '' |
| | | |
| | | Api.getLocalConfig(param).then(response => { |
| | | Api.genericInterface(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | execSso = (ssoParam, scripts) => { |
| | | Api.getLocalConfig(ssoParam).then(res => { |
| | | Api.genericInterface(ssoParam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | execLocal = (localParam, ssoParam, scripts) => { |
| | | Api.getLocalConfig(localParam).then(res => { |
| | | Api.genericInterface(localParam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(response => { |
| | | Api.genericInterface(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | _templates.push({ |
| | | uuid: temp.MenuID, |
| | | title: temp.MenuName, |
| | | MenuNo: temp.MenuNo, |
| | | type: temp.Template, |
| | | url: illust[temp.Template], |
| | | disabled: temp.disabled || false, |
| | |
| | | </Row> |
| | | <Row> |
| | | {this.state.usedTemplates.map((template, index) => { |
| | | if (!tempSearchKey || template.title.toLowerCase().indexOf(tempSearchKey.toLowerCase()) >= 0) { |
| | | return ( |
| | | <Col key={template.type + index} className={template.disabled ? 'disabled' : ''} title={template.disTitle || ''} span={6}> |
| | | <Card |
| | | title={template.title}> |
| | | <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> |
| | | <div className="card-operation"> |
| | | <Button type="primary" onClick={() => {this.useTemplate(template, 'user')}}>使用模板</Button> |
| | | </div> |
| | | </Card> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | return null |
| | | if (tempSearchKey) { |
| | | if ((template.title + template.MenuNo).toLowerCase().indexOf(tempSearchKey.toLowerCase()) === -1) { |
| | | return null |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Col key={template.type + index} className={template.disabled ? 'disabled' : ''} title={template.disTitle || ''} span={6}> |
| | | <Card |
| | | title={template.title}> |
| | | <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> |
| | | <div className="card-operation"> |
| | | <Button type="primary" onClick={() => {this.useTemplate(template, 'user')}}>使用模板</Button> |
| | | </div> |
| | | </Card> |
| | | </Col> |
| | | ) |
| | | })} |
| | | </Row> |
| | | </TabPane> |
| | |
| | | |
| | | // positecgroup |
| | | // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { |
| | | // Api.getLocalConfig ({ |
| | | // Api.genericInterface ({ |
| | | // func: 's_Get_local_u_deleted', |
| | | // users_upt_date: res.users_upt_date, |
| | | // userid: result.UserID, |
| | |
| | | // LoginUID: result.LoginUID |
| | | // }).then(ssores => { |
| | | // if (!ssores.status) return |
| | | // Api.getLocalConfig ({ |
| | | // Api.genericInterface ({ |
| | | // func: 's_get_local_u_create', |
| | | // user_ids_local: ssores.user_ids_local, |
| | | // userid: result.UserID, |
| | |
| | | }) |
| | | LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000) |
| | | |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | |
| | | } else { |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | let _total = res.amount ? parseFloat(res.amount.total) : '' |
| | | |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(res => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.pay_status) { |
| | | this.setState({ |
| | | overdone: true |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Modal, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { updateSubTable } from '@/utils/utils-update.js' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | | import ActionComponent from '@/templates/sharecomponent/actioncomponent' |
| | | import ColumnComponent from '@/templates/sharecomponent/columncomponent' |
| | | |
| | | import Source from './source' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | |
| | | class TableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | | editSubTab: PropTypes.any, |
| | | btnTab: PropTypes.any, |
| | | btnTabConfig: PropTypes.any, |
| | | config: PropTypes.any, |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 页面配置 |
| | | visible: false, // 搜索条件、按钮、显示列,模态框显示控制 |
| | | menuloading: false, // 菜单保存中 |
| | | menucloseloading: false, // 菜单关闭时,选择保存 |
| | | loading: false, // 加载中,页面spin |
| | | closeVisible: false, // 关闭模态框 |
| | | originConfig: null, // 原配置 |
| | | originActions: null, // 原始按钮信息,使用已有用户模板 |
| | | delActions: [], // 删除按钮列表 |
| | | copyActions: [], // 复制按钮组 |
| | | tabviews: [], // 所有标签页 |
| | | thawButtons: [], // 已选择要解冻的按钮 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | chartview: null, // 当前视图 |
| | | openEdition: '', // 编辑版本标记,防止多人操作 |
| | | modalStatus: false // 弹窗是否开启,判断ctrl+s是否可用 |
| | | } |
| | | |
| | | /** |
| | | * @description 数据预处理 |
| | | * 1、设置页面配置信息,新建或无配置信息时(切换模板后无配置信息),使用模板默认配置 |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { config, editTab, editSubTab } = this.props |
| | | |
| | | let _config = null |
| | | |
| | | if (!config) { |
| | | _config = fromJS(Source.baseConfig).toJS() |
| | | _config.uuid = editSubTab ? editSubTab.linkTab : editTab.linkTab |
| | | _config.tabName = editSubTab ? editSubTab.label : editTab.label |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = fromJS(config).toJS() |
| | | } |
| | | |
| | | let _oriActions = [] |
| | | |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | if (item.linkTab) { |
| | | item.linkTab = '' |
| | | } |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮 |
| | | _oriActions.push({ |
| | | prebtn: fromJS(item).toJS(), |
| | | curuuid: uuid, |
| | | Template: 'Modal' |
| | | }) |
| | | } |
| | | |
| | | item.uuid = uuid |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | let _activeKey = editSubTab ? editSubTab.activeKey : editTab.activeKey |
| | | |
| | | // 版本兼容 |
| | | _config = updateSubTable(_config) |
| | | |
| | | this.setState({ |
| | | openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''), |
| | | chartview: _config.charts ? _config.charts[0].uuid : '', |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | activeKey: _activeKey || '0', |
| | | originConfig: fromJS(_config).toJS(), |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 加载完成后 |
| | | * 1、获取系统可使用表 |
| | | * 2、根据配置信息中已使用表获取相关字段信息 |
| | | */ |
| | | componentDidMount () { |
| | | this.reloadTab(false) |
| | | document.onkeydown = (event) => { |
| | | let e = event || window.event |
| | | let keyCode = e.keyCode || e.which || e.charCode |
| | | let preKey = '' |
| | | |
| | | if (e.ctrlKey) { |
| | | preKey = 'ctrl' |
| | | } |
| | | if (e.shiftKey) { |
| | | preKey = 'shift' |
| | | } else if (e.altKey) { |
| | | preKey = 'alt' |
| | | } |
| | | |
| | | if (!preKey || !keyCode) return |
| | | |
| | | let _shortcut = `${preKey}+${keyCode}` |
| | | |
| | | if (_shortcut === 'ctrl+83') { |
| | | if (this.state.modalStatus) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请保存' + this.state.modalStatus, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } |
| | | |
| | | let node = document.getElementById('save-config') |
| | | if (node && node.click) { |
| | | node.click() |
| | | } |
| | | return false |
| | | } |
| | | } |
| | | MKEmitter.addListener('modalStatus', this.modalStatus) |
| | | } |
| | | |
| | | /** |
| | | * @description 加载或刷新标签信息 |
| | | */ |
| | | reloadTab = (type) => { |
| | | this.setState({ |
| | | loading: type, |
| | | tabviews: [] |
| | | }) |
| | | Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { |
| | | if (res.status) { |
| | | let _tabviews = [] |
| | | res.UserTemp.forEach(temp => { |
| | | let item = { |
| | | uuid: temp.MenuID, |
| | | value: temp.MenuID, |
| | | text: temp.MenuName, |
| | | type: temp.Template, |
| | | MenuNo: temp.MenuNo |
| | | } |
| | | |
| | | if (this.props.config && temp.MenuID === this.props.config.uuid) return |
| | | |
| | | _tabviews.push(item) |
| | | }) |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | tabviews: _tabviews |
| | | }) |
| | | |
| | | if (type) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '刷新成功。', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | document.onkeydown = () => {} |
| | | MKEmitter.removeListener('modalStatus', this.modalStatus) |
| | | } |
| | | |
| | | modalStatus = (val) => { |
| | | this.setState({modalStatus: val}) |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let _subconfig = null |
| | | |
| | | if (editSubTab) { |
| | | _subconfig = tabConfig |
| | | if (editTab.hasOwnProperty('OpenType')) { |
| | | _tabview = editTab.tabType || 'SubTable' |
| | | } else { |
| | | _tabview = editTab.type |
| | | } |
| | | } else if (!editSubTab && btnTab) { |
| | | _tabview = btnTab.tabTemplate |
| | | _subconfig = btnTabConfig |
| | | } |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: editSubTab ? editTab : null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: btnTabConfig, |
| | | editAction: null, |
| | | subConfig: _subconfig, |
| | | tabview: _tabview |
| | | } |
| | | |
| | | this.state.copyActions.forEach(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item |
| | | } |
| | | Api.getSystemConfig(_param) |
| | | }) |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | /** |
| | | * @description 标签页保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { delActions, thawButtons, openEdition } = this.state |
| | | let _config = fromJS(this.state.config).toJS() |
| | | let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig |
| | | |
| | | // 基本信息验证 |
| | | if (!_config.tabName || !_config.tabNo) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['model.menu.basemsg'], |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: '0'}) |
| | | return |
| | | } |
| | | |
| | | if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '此标签为复制标签,请修改标签名称和标签参数,不可以时间格式 YYYY-MM-DD HH:mm:ss 结尾!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (_config.isAdd) { |
| | | if (_config.search[0] && _config.search[0].origin) { |
| | | _config.search = _config.search.filter(item => !item.origin) |
| | | } |
| | | if (_config.action[0] && _config.action[0].origin) { |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | } |
| | | if (_config.columns[0] && _config.columns[0].origin) { |
| | | _config.columns = _config.columns.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | _config.setting.doubleClick = '' |
| | | } |
| | | |
| | | // 未设置数据源或主键时,启用状态为false |
| | | let result = this.verifyconfig(_config) |
| | | |
| | | if (result !== true) { |
| | | _config.enabled = false |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | let _LongParam = '' |
| | | let reload = _config.isAdd |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 5 |
| | | }) |
| | | |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let btnParam = { |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, |
| | | ParentID: _config.uuid, |
| | | MenuNo: _config.tabNo, |
| | | Template: 'SubTable', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: [] |
| | | } |
| | | |
| | | let btntabs = [] |
| | | |
| | | _config.action.forEach((item, index) => { |
| | | if (item.hidden === 'true') return |
| | | if (item.OpenType === 'popview') { |
| | | btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) |
| | | } |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | let tabParam = { // 添加标签按钮tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: _config.uuid, |
| | | LText: btntabs.join(' union all ') |
| | | } |
| | | |
| | | tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let param = { |
| | | func: 'sPC_Tab_AddUpt', |
| | | MenuID: _config.uuid, |
| | | MenuNo: _config.tabNo, |
| | | Template: 'SubTable', |
| | | MenuName: _config.tabName, |
| | | Remark: _config.Remark, |
| | | Sort: 0, |
| | | PageParam: JSON.stringify({Template: 'SubTable'}), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (openEdition) { |
| | | param.open_edition = openEdition |
| | | } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | | if (delActions.length > 0) { |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.card.uuid |
| | | } |
| | | |
| | | let _ParentParam = null |
| | | |
| | | try { |
| | | _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | _ParentParam = null |
| | | } |
| | | |
| | | if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | _param.ParentParam = _ParentParam |
| | | } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig(_param).then(response => { |
| | | resolve(response) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let error = null |
| | | result.forEach(response => { |
| | | if (!response.status) { |
| | | error = response |
| | | } |
| | | }) |
| | | |
| | | if (error) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | this.setState({ |
| | | delActions: [] |
| | | }) |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else if (delActions.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | |
| | | if (thawButtons.length > 0) { |
| | | let defers = thawButtons.map(item => { |
| | | return new Promise((resolve) => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_MainMenu_ReDel', |
| | | MenuID: item |
| | | }).then(res => { |
| | | if (res.status) { |
| | | resolve('') |
| | | } else { |
| | | resolve(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | return Promise.all(defers) |
| | | } else { |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | |
| | | let msg = res.filter(Boolean)[0] |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else { |
| | | this.setState({ |
| | | thawButtons: [] |
| | | }) |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | openEdition: response.open_edition || '', |
| | | config: _config, |
| | | originConfig: fromJS(_config).toJS() |
| | | }, () => { |
| | | reload && MKEmitter.emit('revert') |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | this.submitAction(btnParam, tabParam) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = (btnParam, tabParam) => { |
| | | const { config } = this.state |
| | | |
| | | new Promise(resolve => { |
| | | let deffers = [] |
| | | |
| | | if (tabParam.LText) { |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemConfig(tabParam).then(result => { |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | deffers.push(defer) |
| | | } |
| | | |
| | | if (btnParam.LText) { |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemConfig(btnParam).then(result => { |
| | | if (result.status) { |
| | | this.setState({ // 保存成功后清空复制列表 |
| | | copyActions: [] |
| | | }) |
| | | } |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | deffers.push(defer) |
| | | } |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve(true) |
| | | } else { |
| | | Promise.all(deffers).then(result => { |
| | | let error = false |
| | | result.forEach(res => { |
| | | if (!res.status) { |
| | | error = res |
| | | } |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | if (!curBtn) return |
| | | if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: curBtn |
| | | }) |
| | | }) |
| | | |
| | | if (oriActions.length === 0) return 'true' |
| | | |
| | | oriActions.forEach(action => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.prebtn ? action.prebtn.uuid : '' |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: config.uuid, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: config.tabNo, |
| | | Template: _LongParam.type, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(() => {}) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | return 'true' |
| | | }).then(response => { |
| | | if (response === 'true') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.handleViewBack() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | | const { config, originConfig } = this.state |
| | | |
| | | let _this = this |
| | | |
| | | if (originConfig.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originConfig), fromJS(config))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn) => { |
| | | const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props |
| | | const { config, originConfig, activeKey, openEdition } = this.state |
| | | |
| | | if (originConfig.isAdd) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未保存,请保存菜单配置!', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originConfig), fromJS(config))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单配置已修改,请保存!', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | // 子菜单信息验证通过后,跳转子按钮配置页面 |
| | | let _view = '' |
| | | let _subtab = editSubTab |
| | | |
| | | if (btn.OpenType === 'pop' || btn.execMode === 'pop') { |
| | | _view = 'Modal' // 表单页面 |
| | | } else if (btn.OpenType === 'popview') { |
| | | _view = 'SubTable' // 新弹窗标签模板 tabType 属性已去除 |
| | | _subtab = btn |
| | | |
| | | if (editSubTab) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '弹窗(标签)中不支持此按钮打开方式!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (editSubTab) { |
| | | editSubTab.activeKey = activeKey |
| | | editSubTab.open_edition = openEdition // 更新版本号 |
| | | } else { |
| | | editTab.activeKey = activeKey |
| | | editTab.open_edition = openEdition // 更新版本号 |
| | | } |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: editTab, |
| | | tabConfig: editSubTab ? tabConfig : originConfig, |
| | | editSubTab: _subtab, |
| | | subTabConfig: editSubTab ? originConfig : null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: btnTabConfig, |
| | | editAction: btn, |
| | | subConfig: '', |
| | | tabview: _view |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.OpenType === 'popview' ? btn.linkTab : btn.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam && param.tabview === 'Modal' && _LongParam.type === 'Modal') { |
| | | param.subConfig = _LongParam |
| | | } else if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { |
| | | param.subConfig = _LongParam |
| | | } |
| | | |
| | | if (param.editAction) { |
| | | param.editAction.open_edition = res.open_edition || '' |
| | | } else if (param.editSubTab) { |
| | | param.editSubTab.open_edition = res.open_edition || '' |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 切换标签是否启用 |
| | | */ |
| | | onEnabledChange = () => { |
| | | const { config } = this.state |
| | | |
| | | let _enabled = !config.enabled |
| | | let result = this.verifyconfig(config) |
| | | |
| | | if (_enabled && result !== true) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, enabled: _enabled} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 校验配置信息的合法性 |
| | | */ |
| | | verifyconfig = (config) => { |
| | | let hasKey = false |
| | | let chartcols = [] |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | chartcols.push(col.field) |
| | | } |
| | | if (config.setting.primaryKey === col.field) { |
| | | hasKey = true |
| | | } |
| | | }) |
| | | |
| | | let chartError = '' |
| | | config.charts && config.charts.forEach((chart, index) => { |
| | | if (chartError) return |
| | | if (chart.Hide === 'true') return |
| | | if (!['line', 'bar', 'pie'].includes(chart.chartType)) return |
| | | |
| | | if (!chart.Xaxis) { |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段尚未设置,不可启用!` |
| | | } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype !== 'statistics' && (!chart.Yaxis || chart.Yaxis.length === 0)) { // query 查询数据 |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段尚未设置,不可启用!` |
| | | } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype === 'statistics' && (!chart.InfoType || !chart.InfoValue)) { // statistics 统计数据 |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段尚未设置,不可启用!` |
| | | } else if (chart.chartType === 'pie' && !chart.Yaxis) { |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段尚未设置,不可启用!` |
| | | } else if (!chartcols.includes(chart.Xaxis)) { |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段在显示列中不存在,不可启用!` |
| | | } else if (chart.chartType === 'pie' && !chartcols.includes(chart.Yaxis)) { |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段在显示列中不存在,不可启用!` |
| | | } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype === 'statistics' && (!chartcols.includes(chart.InfoType) || !chartcols.includes(chart.InfoValue))) { // statistics 统计数据 |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段在显示列中不存在,不可启用!` |
| | | } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype !== 'statistics' && chart.Yaxis.filter(yaxis => !chartcols.includes(yaxis)).length > 0) { |
| | | chartError = `图表${chart.title ? '《' + chart.title + '》' : index + 1}坐标轴字段在显示列中不存在,不可启用!` |
| | | } |
| | | }) |
| | | |
| | | config.action && config.action.forEach((btn) => { |
| | | if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { |
| | | let hascheck = false |
| | | btn.verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (/\$check@|@check\$/ig.test(item.sql)) { |
| | | hascheck = true |
| | | } |
| | | }) |
| | | if (hascheck) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置前置脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.callbackType === 'script' && config.setting.cbScripts && config.setting.cbScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置回调脚本,不可启用!' |
| | | } else if (!config.setting.primaryKey) { |
| | | return '尚未设置主键,不可启用!' |
| | | } else if (config.columns.length === 0) { |
| | | return '尚未设置显示列,不可启用!' |
| | | } else if (!hasKey) { |
| | | return '显示列中不存在主键字段,不可启用!' |
| | | } else if (chartError) { |
| | | return chartError |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 编辑功能完成更新,包括解冻按钮等 |
| | | */ |
| | | updateConfig = (res) => { |
| | | this.setState({ |
| | | thawButtons: res.thawButtons, |
| | | config: res.config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新搜索条件配置信息 |
| | | */ |
| | | updatesearch = (config) => { |
| | | |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新按钮配置信息 |
| | | */ |
| | | updateaction = (config, copyId, delcard) => { |
| | | const { copyActions, delActions } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | copyActions: copyId ? [...copyActions, copyId] : copyActions, |
| | | delActions: delcard ? [...delActions, delcard] : delActions |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新显示列配置信息 |
| | | */ |
| | | updateconfig = (config) => { |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新图表组配置信息 |
| | | */ |
| | | updatechartgroup = (config, _chartview) => { |
| | | this.setState({ |
| | | config: config, |
| | | chartview: _chartview |
| | | }) |
| | | } |
| | | |
| | | |
| | | refreshConfig = () => { |
| | | const { config } = this.props |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: config.uuid |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | let _config = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _config = '' |
| | | } |
| | | } |
| | | |
| | | if (!_config) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到配置信息!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 版本兼容 |
| | | _config = updateSubTable(_config) |
| | | |
| | | this.setState({ |
| | | config: null |
| | | }, () => { |
| | | this.setState({ |
| | | chartview: _config.charts ? _config.charts[0].uuid : '', |
| | | config: _config, |
| | | openEdition: res.open_edition || '', |
| | | activeKey: '0', |
| | | originActions: [], |
| | | originConfig: fromJS(_config).toJS() |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const { config } = this.state |
| | | |
| | | return ( |
| | | <div className="model-subtable-board"> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <SettingComponent |
| | | config={config} |
| | | mainsearch={!this.props.editSubTab && this.props.editTab.mainsearch ? this.props.editTab.mainsearch : ''} |
| | | MenuID={config.uuid} |
| | | updatesetting={this.updateconfig} |
| | | /> |
| | | <SearchComponent |
| | | config={config} |
| | | updatesearch={this.updatesearch} |
| | | /> |
| | | <ActionComponent |
| | | type="subtable" |
| | | menu={{MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo, fstMenuList: this.props.menu.fstMenuList}} |
| | | config={config} |
| | | tabs={this.state.tabviews} |
| | | setSubConfig={this.setSubConfig} |
| | | updateaction={this.updateaction} |
| | | /> |
| | | <ColumnComponent |
| | | config={config} |
| | | menu={this.props.menu} |
| | | updatecolumn={this.updateconfig} |
| | | /> |
| | | </DndProvider> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default TableConfig |
New file |
| | |
| | | .model-subtable-board { |
| | | position: fixed; |
| | | z-index: 1; |
| | | padding-top: 48px; |
| | | top: 0px; |
| | | left: 0px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | background: rgba(0, 0, 0, 0.35); |
| | | display: flex; |
| | | .tools { |
| | | flex: 1; |
| | | background: #ffffff; |
| | | border-right: 1px solid #d9d9d9; |
| | | height: 100%; |
| | | overflow-y: hidden; |
| | | padding-bottom: 30px; |
| | | .ant-collapse-borderless { |
| | | background-color: #ffffff; |
| | | } |
| | | .ant-collapse-item { |
| | | position: relative; |
| | | border: 0; |
| | | } |
| | | .ant-input-search { |
| | | margin-top: 10px; |
| | | } |
| | | .ant-collapse-item.ant-collapse-item-active { |
| | | border-bottom: 1px solid #d9d9d9; |
| | | } |
| | | .ant-collapse .ant-collapse-header { |
| | | padding: 11px 16px 10px 40px; |
| | | border-bottom: 1px solid #d9d9d9; |
| | | background: #1890ff; |
| | | color: #ffffff; |
| | | } |
| | | .ant-collapse-content-box { |
| | | .ant-form-item { |
| | | margin-bottom: 10px; |
| | | .ant-form-item-label { |
| | | text-align: left; |
| | | height: 25px; |
| | | line-height: 25px; |
| | | } |
| | | } |
| | | } |
| | | .search-element { |
| | | padding-top: 10px; |
| | | li { |
| | | padding: 0px 16px 10px; |
| | | div { |
| | | cursor: move; |
| | | } |
| | | } |
| | | } |
| | | .config-btn { |
| | | position: relative; |
| | | |
| | | .config-btn-title { |
| | | margin-top: 20px; |
| | | margin-bottom: 10px; |
| | | color: #1890ff; |
| | | border-bottom: 1px solid #e8e8e8; |
| | | } |
| | | } |
| | | .ant-list { |
| | | margin-top: 20px; |
| | | .ant-list-item { |
| | | display: -webkit-box; |
| | | padding-right: 20px; |
| | | position: relative; |
| | | padding-left: 5px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | -webkit-line-clamp: 2; |
| | | -webkit-box-orient: vertical; |
| | | min-height: 55px; |
| | | width: 100%; |
| | | .anticon { |
| | | position: absolute; |
| | | top: 0px; |
| | | right: 0px; |
| | | padding: 3px 3px 10px 10px; |
| | | cursor: pointer; |
| | | } |
| | | .bottom-mask { |
| | | position: absolute; |
| | | width: 100%; |
| | | height: 8px; |
| | | bottom: 0; |
| | | left: 0; |
| | | background: #ffffff; |
| | | border-radius: 8px; |
| | | } |
| | | } |
| | | } |
| | | .config-button { |
| | | min-width: 65px; |
| | | } |
| | | } |
| | | .tools { |
| | | overflow-y: auto; |
| | | } |
| | | .tools::-webkit-scrollbar { |
| | | width: 4px; |
| | | } |
| | | .tools::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); |
| | | background: rgba(0, 0, 0, 0.08); |
| | | } |
| | | .tools::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | |
| | | .setting { |
| | | position: relative; |
| | | width: calc(100vw - 235px); |
| | | height: 100%; |
| | | background: #ffffff; |
| | | .ant-switch.big { |
| | | min-width: 60px; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | margin-top: -2px; |
| | | .ant-switch-inner { |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | .ant-switch.big::after { |
| | | width: 24px; |
| | | height: 24px; |
| | | } |
| | | .ant-card-head { |
| | | min-height: 44px; |
| | | } |
| | | .ant-card-head-title { |
| | | padding: 5px 0; |
| | | color: #1890ff; |
| | | } |
| | | .ant-card-extra { |
| | | padding: 5px 0; |
| | | button { |
| | | margin-left: 20px; |
| | | } |
| | | } |
| | | .ant-card-body { |
| | | position: relative; |
| | | padding: 0; |
| | | |
| | | .chart-view { |
| | | margin-bottom: 70px; |
| | | |
| | | .chart-title { |
| | | position: relative; |
| | | color: rgba(0, 0, 0, 0.65); |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | margin: 0 20px; |
| | | padding: 10px 5px 5px; |
| | | } |
| | | } |
| | | > .anticon-setting { |
| | | position: absolute; |
| | | font-size: 18px; |
| | | right: 7px; |
| | | top: 10px; |
| | | } |
| | | } |
| | | } |
| | | .setting { |
| | | overflow-y: scroll; |
| | | } |
| | | .setting::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .setting::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | display: none; |
| | | } |
| | | .setting::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | .setting:hover::-webkit-scrollbar-thumb { |
| | | display: block; |
| | | } |
| | | .ant-spin { |
| | | position: absolute; |
| | | margin-left: calc(50vw - 22px); |
| | | margin-top: 30vh; |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | config: PropTypes.object, |
| | | updatemenu: PropTypes.func |
| | | } |
| | | |
| | | changeName = (e) => { |
| | | let value = e.target.value || '' |
| | | if (value.length > 100) return |
| | | |
| | | this.setState({}, () => { |
| | | this.props.updatemenu({...this.props.config, tabName: value}) |
| | | }) |
| | | } |
| | | |
| | | changeNo = (e) => { |
| | | let value = e.target.value || '' |
| | | if (value.length > 100) return |
| | | this.setState({}, () => { |
| | | this.props.updatemenu({...this.props.config, tabNo: value}) |
| | | }) |
| | | } |
| | | |
| | | changeRemark = (e) => { |
| | | let value = e.target.value || '' |
| | | if (value.length > 100) return |
| | | this.setState({}, () => { |
| | | this.props.updatemenu({...this.props.config, Remark: value}) |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 24 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 24 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form" id="subqazxcvbn"> |
| | | <Row gutter={24}> |
| | | <Col span={24}> |
| | | <Form.Item label="页面名称"> |
| | | {getFieldDecorator('tabName', { |
| | | initialValue: config.tabName, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '页面名称!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={dict['model.menu'] + dict['model.param']}> |
| | | {getFieldDecorator('tabNo', { |
| | | initialValue: config.tabNo, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + dict['model.menu'] + dict['model.param'] + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={dict['header.menu.Remark']}> |
| | | {getFieldDecorator('Remark', { |
| | | initialValue: config.Remark, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<TextArea rows={2} placeholder="" autoComplete="off" onChange={this.changeRemark}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
New file |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | | const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class SubTableBaseData { |
| | | baseConfig = { |
| | | version: '1.0', |
| | | type: 'system', |
| | | Template: 'SubTable', |
| | | enabled: false, |
| | | tabName: '', |
| | | tabNo: '', |
| | | Remark: '', |
| | | uuid: Utils.getuuid(), |
| | | setting: { |
| | | tableName: '', |
| | | tableType: 'checkbox', |
| | | primaryKey: '', |
| | | order: '', |
| | | dataresource: '', |
| | | interType: 'system', |
| | | innerFunc: '', |
| | | interface: '', |
| | | outerFunc: '' |
| | | }, |
| | | tables: [], |
| | | search: [ |
| | | { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'text', |
| | | resourceType: '0', |
| | | options: [], |
| | | orderType: 'asc', |
| | | match: 'like', |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'select', |
| | | resourceType: '0', |
| | | options: [], |
| | | orderType: 'asc', |
| | | match: 'equal', |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'date', |
| | | resourceType: '0', |
| | | options: [], |
| | | orderType: 'asc', |
| | | match: 'greater', |
| | | } |
| | | ], |
| | | action: [ |
| | | { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'add', |
| | | intertype: 'system', |
| | | Ot: 'notRequired', |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | OpenType: 'pop', |
| | | icon: 'plus', |
| | | class: 'green', |
| | | verify: null |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'update', |
| | | intertype: 'system', |
| | | Ot: 'requiredSgl', |
| | | position: 'grid', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | OpenType: 'pop', |
| | | icon: 'form', |
| | | class: 'purple', |
| | | verify: null |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | label: 'delete', |
| | | intertype: 'system', |
| | | Ot: 'required', |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | OpenType: 'prompt', |
| | | icon: 'delete', |
| | | class: 'red', |
| | | verify: null |
| | | } |
| | | ], |
| | | columns: [ |
| | | { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | } |
| | | ], |
| | | gridBtn: { |
| | | display: false, |
| | | Align: 'center', |
| | | IsSort: 'false', |
| | | uuid: Utils.getuuid(), |
| | | label: CommonDict['model.operation'], |
| | | type: 'action', |
| | | style: 'button', |
| | | show: 'horizontal', |
| | | Width: 120 |
| | | }, |
| | | expand: false, |
| | | charts: [{ |
| | | uuid: Utils.getuuid(), |
| | | label: '', |
| | | title: '', |
| | | chartType: 'table', |
| | | icon: 'table', |
| | | Hide: 'false', |
| | | blacklist: [] |
| | | }] |
| | | } |
| | | |
| | | searchItems = [ |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.text'], |
| | | subType: 'text', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.select'], |
| | | subType: 'select', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.multiselect'], |
| | | subType: 'multiselect', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.link'], |
| | | subType: 'link', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '选项卡', |
| | | subType: 'checkcard', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '日期(天)', |
| | | subType: 'date', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '日期(周)', |
| | | subType: 'dateweek', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.datemonth'], |
| | | subType: 'datemonth', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.daterange'], |
| | | subType: 'daterange', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.dategroup'], |
| | | subType: 'group', |
| | | url: '' |
| | | } |
| | | ] |
| | | |
| | | actionItems = [ |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.popform'], |
| | | subType: 'pop', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.prompt'], |
| | | subType: 'prompt', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.exec'], |
| | | subType: 'exec', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.excelIn'], |
| | | subType: 'excelIn', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.excelOut'], |
| | | subType: 'excelOut', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.popview'], |
| | | subType: 'popview', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.tab'], |
| | | subType: 'tab', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.newpage'], |
| | | subType: 'innerpage', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['model.form.funcbutton'], |
| | | subType: 'funcbutton', |
| | | url: '' |
| | | } |
| | | ] |
| | | |
| | | columnItems = [ |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.text'], |
| | | subType: 'text', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.picture'], |
| | | subType: 'picture', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.number'], |
| | | subType: 'number', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.href'], |
| | | subType: 'link', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.textarea'], |
| | | subType: 'textarea', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: CommonDict['model.form.colspan'], |
| | | subType: 'colspan', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'columns', |
| | | label: '序号', |
| | | subType: 'index', |
| | | url: '' |
| | | } |
| | | ] |
| | | } |
| | | |
| | | export default new SubTableBaseData() |