From bf772e586c29b4858366dbad143b1eaeca3c46ed Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 四月 2020 10:18:09 +0800 Subject: [PATCH] 2020-04-17 --- src/components/tabview/index.jsx | 3 src/tabviews/managetable/secretKeyTable/actionList/index.jsx | 2 src/tabviews/formtab/index.jsx | 9 src/tabviews/formtab/actionList/index.jsx | 8 src/tabviews/formtab/formgroup/index.jsx | 23 src/tabviews/verupmanage/actionList/index.jsx | 2 src/tabviews/verupmanage/subtabtable/index.jsx | 6 src/tabviews/scriptmanage/topSearch/index.jsx | 120 ++++ src/tabviews/zshare/normalTable/index.jsx | 71 + src/tabviews/scriptmanage/config.jsx | 91 +++ src/templates/comtableconfig/index.jsx | 10 src/templates/zshare/verifycard/customscript/index.jsx | 51 + src/templates/zshare/verifycardexcelin/index.jsx | 47 + src/tabviews/managetable/secretKeyTable/index.jsx | 3 src/tabviews/zshare/actionList/index.jsx | 67 - src/tabviews/subtable/index.jsx | 12 src/tabviews/subtabtable/index.jsx | 14 src/tabviews/commontable/index.jsx | 13 src/templates/subtableconfig/settingform/index.jsx | 6 src/utils/utils.js | 108 ++ src/templates/subtableconfig/actionform/index.jsx | 2 src/index.js | 33 src/tabviews/scriptmanage/topSearch/index.scss | 26 src/templates/comtableconfig/actionform/index.jsx | 2 src/templates/formtabconfig/settingform/index.jsx | 8 src/tabviews/scriptmanage/actionList/index.jsx | 321 ++++++++++ src/templates/zshare/formconfig.jsx | 42 src/templates/zshare/verifycard/index.jsx | 43 + src/tabviews/managetable/index.jsx | 8 src/templates/formtabconfig/actionform/index.jsx | 2 src/templates/zshare/columnform/index.jsx | 11 src/tabviews/scriptmanage/actionList/index.scss | 44 + src/templates/subtableconfig/index.jsx | 10 src/templates/comtableconfig/settingform/index.jsx | 6 src/tabviews/zshare/mutilform/index.jsx | 2 src/templates/zshare/verifycardexcelin/customscript/index.jsx | 48 + src/tabviews/scriptmanage/index.scss | 111 +++ src/tabviews/scriptmanage/index.jsx | 365 ++++++++++++ src/components/sidemenu/config.js | 8 src/tabviews/verupmanage/index.jsx | 6 src/tabviews/zshare/normalTable/index.scss | 6 src/views/login/index.jsx | 7 42 files changed, 1,580 insertions(+), 197 deletions(-) diff --git a/src/components/sidemenu/config.js b/src/components/sidemenu/config.js index 694ed29..ecf0cab 100644 --- a/src/components/sidemenu/config.js +++ b/src/components/sidemenu/config.js @@ -71,6 +71,14 @@ MenuNo: 'sUsersAppM', MenuName: '绯荤粺鐢ㄦ埛绠$悊', text: '绯荤粺鐢ㄦ埛绠$悊' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ScriptTable'}, + type: 'ScriptTable', + MenuID: '1587005717541lov40vg61q7l1rbveon', + MenuNo: 's_custom_scriptM', + MenuName: '鑷畾涔夎剼鏈�', + text: '鑷畾涔夎剼鏈�' }] }, { MenuID: 'systemManageViewInterface', diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index e438c64..2637efe 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -19,6 +19,7 @@ const Home = asyncComponent(() => import('@/tabviews/home')) const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) const VerupTable = asyncComponent(() => import('@/tabviews/verupmanage')) +const ScriptTable = asyncComponent(() => import('@/tabviews/scriptmanage')) const TabManage = asyncComponent(() => import('@/tabviews/tabmanage')) const ManageTable = asyncComponent(() => import('@/tabviews/managetable')) const Iframe = asyncComponent(() => import('@/tabviews/iframe')) @@ -103,6 +104,8 @@ return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'VerupTable') { return (<VerupTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + } else if (view.type === 'ScriptTable') { + return (<ScriptTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'TabManage') { return (<TabManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'ManageTable') { diff --git a/src/index.js b/src/index.js index 972a1c4..927c10d 100644 --- a/src/index.js +++ b/src/index.js @@ -25,8 +25,31 @@ window.GLOB = window.GLOB || {} -if (!(options.systemType === 'local' && window.GLOB.systemType === 'official')) { +if (!(options.systemType === 'local' && window.GLOB.systemType === 'official')) { // 鍙湁涓氬姟绯荤粺鎵嶅彲浠ヨ缃负姝e紡绯荤粺 window.GLOB.systemType = 'test' +} +if (options.systemType !== 'local') { // sso,cloud涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� + window.GLOB.mainSystemApi = '' +} else if (options.systemType === 'local' && window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺 + let systemApi = window.GLOB.mainSystemApi + + if (/^(http|https):\/\//ig.test(systemApi)) { + let _systemApi = /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(systemApi) + + systemApi = _systemApi ? _systemApi[0] : '' + } else { + systemApi = '' + } + + if (systemApi && systemApi === /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(options.cloudServiceApi)[0]) { + window.GLOB.dataFormat = true + } + + if (systemApi) { + systemApi = systemApi + '/webapi/dostars' + } + + window.GLOB.mainSystemApi = systemApi } let _systemMsg = localStorage.getItem(window.location.href.split('#')[0] + 'system') @@ -76,14 +99,6 @@ if (window.GLOB.style && option[window.GLOB.style]) { document.getElementById('root').className = option[window.GLOB.style] } - -if (process.env.NODE_ENV === 'production') { - let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' - window.GLOB.subSystemApi = document.location.origin + '/' + service + 'webapi/dostars' -} else { - window.GLOB.subSystemApi = 'http://qingqiumarket.cn/mkwms/webapi/dostars' -} - sessionStorage.removeItem('isEditState') diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index caf6215..ac411d8 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -587,13 +587,11 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (setting.sysInterface !== 'true') { param.rduri = setting.interface } - - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey if (setting.outerFunc) { param.func = setting.outerFunc @@ -625,8 +623,7 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: arr_field, - appkey: window.GLOB.appkey || '' + arr_field: arr_field } let _orderBy = orderBy || setting.order @@ -652,8 +649,6 @@ value: item.value } }) - - // options.reverse() options.forEach(item => { _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index e2160c7..960a230 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -198,9 +198,9 @@ res.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } } @@ -208,8 +208,6 @@ if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey return Api.genericInterface(res) }).then(response => { diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx index 3d9d77d..fd323ae 100644 --- a/src/tabviews/formtab/formgroup/index.jsx +++ b/src/tabviews/formtab/formgroup/index.jsx @@ -121,7 +121,10 @@ let _readin = item.readin !== 'false' if (item.type === 'funcvar') { _readin = false + item.initval = '' // 鍒濆鍖栦负绌� } + + item.initVal = item.initval ? JSON.parse(JSON.stringify(item.initval)) : '' let _fieldlen = item.fieldlength || 50 if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') { @@ -567,19 +570,26 @@ if (!item.field) return if (item.type === 'funcvar') { + let _val = item.initval + if (values.hasOwnProperty(item.field)) { + _val = values[item.field] === '绯荤粺鑷姩鐢熸垚' ? '' : values[item.field] + } else if (record.hasOwnProperty(item.field)) { + _val = record[item.field] + } search.push({ type: 'funcvar', readonly: 'true', readin: false, fieldlen: this.state.fieldlen[item.field], key: item.field, - value: '' + value: _val }) } else if (item.hidden === 'true' && item.field !== this.props.setting.primaryKey) { let _val = item.initval if (record.hasOwnProperty(item.field)) { _val = record[item.field] } + search.push({ type: this.state.datatype[item.field], readonly: this.state.readtype[item.field], @@ -587,6 +597,15 @@ fieldlen: this.state.fieldlen[item.field], key: item.field, value: _val + }) + } else if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) { + search.push({ + type: this.state.datatype[item.field], + readonly: this.state.readtype[item.field], + readin: this.state.readin[item.field], + fieldlen: this.state.fieldlen[item.field], + key: item.field, + value: item.initVal }) } }) @@ -644,7 +663,7 @@ value: _value }) }) - resolve(search) + // resolve(search) } else { reject(err) } diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 17e08c6..09b5271 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -373,7 +373,6 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - appkey: window.GLOB.appkey || '', ID: primaryId } @@ -415,14 +414,12 @@ param.rduri = setting.interface } } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (setting.sysInterface !== 'true') { param.rduri = setting.interface } } - - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey if (setting.outerFunc) { param.func = setting.outerFunc diff --git a/src/tabviews/managetable/index.jsx b/src/tabviews/managetable/index.jsx index c3a3a16..b4fcc90 100644 --- a/src/tabviews/managetable/index.jsx +++ b/src/tabviews/managetable/index.jsx @@ -363,8 +363,6 @@ param.rduri = setting.interface } - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey - if (setting.outerFunc) { param.func = setting.outerFunc } @@ -395,8 +393,7 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: arr_field, - appkey: window.GLOB.appkey || '' + arr_field: arr_field } let _orderBy = orderBy || setting.order @@ -422,8 +419,6 @@ value: item.value } }) - - // options.reverse() options.forEach(item => { _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) @@ -877,6 +872,7 @@ } <MainTable ref="mainTable" + menuType="HS" tableId="mainTable" pickup={pickup} setting={setting} diff --git a/src/tabviews/managetable/secretKeyTable/actionList/index.jsx b/src/tabviews/managetable/secretKeyTable/actionList/index.jsx index d50430e..67f2847 100644 --- a/src/tabviews/managetable/secretKeyTable/actionList/index.jsx +++ b/src/tabviews/managetable/secretKeyTable/actionList/index.jsx @@ -170,7 +170,7 @@ ] } - let _number = Math.floor(Math.random() * 10) + let _number = Math.floor(Math.random() * 10) let keyString = window.btoa(window.encodeURIComponent(JSON.stringify(datalist))) let regular = refCodes[_number] keyString = keyString.replace(new RegExp(regular.char, 'g'), regular.md5str) diff --git a/src/tabviews/managetable/secretKeyTable/index.jsx b/src/tabviews/managetable/secretKeyTable/index.jsx index 2e5b17e..018f90e 100644 --- a/src/tabviews/managetable/secretKeyTable/index.jsx +++ b/src/tabviews/managetable/secretKeyTable/index.jsx @@ -220,8 +220,6 @@ param.rduri = setting.interface } - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey - if (setting.outerFunc) { param.func = setting.outerFunc } @@ -370,6 +368,7 @@ } <SubTable ref="subTable" + menuType="HS" tableId={this.props.Tab.uuid} pickup={pickup} setting={setting} diff --git a/src/tabviews/scriptmanage/actionList/index.jsx b/src/tabviews/scriptmanage/actionList/index.jsx new file mode 100644 index 0000000..83f24ac --- /dev/null +++ b/src/tabviews/scriptmanage/actionList/index.jsx @@ -0,0 +1,321 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import moment from 'moment' +import { Button, Modal, notification, message } from 'antd' +import MutilForm from '@/tabviews/zshare/mutilform' +import options from '@/store/options.js' +import Utils from '@/utils/utils.js' +import Api from '@/api' +import './index.scss' + +const { confirm } = Modal + +class MainAction extends Component { + static propTpyes = { + BID: PropTypes.string, // 涓昏〃ID + BData: PropTypes.any, // 涓昏〃鏁版嵁 + Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� + 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 // 鑾峰彇琛ㄦ牸涓暟鎹� + } + + state = { + visible: false, + formdata: null, + tabledata: null, + confirmLoading: false, + execAction: null, + configMap: {} + } + + refreshdata = (item, type) => { + this.props.refreshdata(item, type) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (item, record) => { + const { setting } = this.props + + let _this = this + let data = this.props.gettableselected() || [] + + if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� + data = [record] + } + + if (item.Ot !== 'notRequired' && data.length === 0) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectline'], + duration: 10 + }) + return + } else if (item.Ot === 'requiredSgl' && data.length !== 1) { + // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectSingleLine'], + duration: 10 + }) + return + } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� + notification.warning({ + top: 92, + message: '鏈缃富閿紒', + duration: 10 + }) + return + } + + if (item.OpenType === 'prompt') { + confirm({ + title: this.props.dict['main.action.confirm.tip'], + onOk() { + return new Promise(resolve => { + _this.execSubmit(item, data, resolve) + }) + }, + onCancel() {} + }) + } else if (item.OpenType === 'pop') { + this.setState({ + visible: true, + execAction: item, + tabledata: data + }) + } + } + + /** + * @description 鎸夐挳鎻愪氦鎵ц + */ + execSubmit = (btn, data, _resolve, formdata) => { + const { setting } = this.props + let primaryId = data[0] ? data[0][setting.primaryKey] : '' + + if (btn.sqlType === 'insert') { + primaryId = '' + } + + let values = {} + if (formdata) { + formdata.forEach(_data => { + values[_data.key] = _data.value + }) + } else { + values = data[0] + } + + let param = { // 鑷畾涔夎剼鏈坊鍔犱慨鏀瑰垹闄� + func: 's_custom_script_adduptdel', + ID: primaryId, + func_param: values.func, + Remark: values.Remark, + Sort: values.Sort, + LText: values.LongParam + } + + param.LText = Utils.formatOptions(param.LText) + + if (btn.sqlType === 'delete') { + param.LText = window.GLOB.appkey || '' + param.Remark = '' + param.Sort = 0 + param.func_param = '' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + if (options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } + + Api.genericInterface(param).then((res) => { + if (res.status) { + this.execSuccess(btn, res) + } else { + this.execError(res, btn) + } + _resolve() + }) + } + + /** + * @description 鎿嶄綔鎴愬姛鍚庡鐞� + * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� + * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� + * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� + * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execSuccess = (btn, res) => { + if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 + notification.success({ + top: 92, + message: res.ErrMesg || this.props.dict['main.action.confirm.success'], + duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 + }) + } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 + Modal.success({ + title: res.ErrMesg || this.props.dict['main.action.confirm.success'] + }) + } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず + + } + + if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { + this.setState({ + visible: false + }) + } + + this.refreshdata(btn, 'success') + } + + /** + * @description 鎿嶄綔澶辫触鍚庡鐞� + * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅 + * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execError = (res, btn) => { + if (res.ErrCode === 'E') { + Modal.error({ + title: res.message || res.ErrMesg, + }) + } else if (res.ErrCode === 'N') { + notification.error({ + top: 92, + message: res.message || res.ErrMesg, + duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 + }) + } 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 + }) + } else if (res.ErrCode === 'NM') { + message.error(res.message || res.ErrMesg) + } + + this.refreshdata(btn, 'error') + } + + + /** + * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� + */ + handleOk = () => { + this.formRef.handleConfirm().then(res => { + this.setState({ + confirmLoading: true + }) + + this.execSubmit(this.state.execAction, this.state.tabledata, () => { + this.setState({ + confirmLoading: false + }) + }, res) + }, () => {}) + } + + /** + * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑� + */ + handleCancel = () => { + this.setState({ + visible: false + }) + } + + /** + * @description 鏄剧ず妯℃�佹 + */ + getModels = () => { + const { execAction } = this.state + + if (!execAction || !this.state.visible) return + + let title = '' + let width = '62vw' + let clickouter = false + let container = document.body + + if (execAction && execAction.setting) { + title = execAction.setting.title + width = execAction.setting.width + 'vw' + + if (execAction.setting.container === 'tab' && this.props.ContainerId) { + width = execAction.setting.width + '%' + container = () => document.getElementById(this.props.ContainerId) + } + + if (execAction.setting.clickouter === 'close') { + clickouter = true + } + } + + if (this.props.type === 'subtab') { + container = document.body + } + + return ( + <Modal + title={title} + maskClosable={clickouter} + getContainer={container} + wrapClassName='action-modal' + visible={this.state.visible} + width={width} + onOk={this.handleOk} + confirmLoading={this.state.confirmLoading} + onCancel={this.handleCancel} + destroyOnClose + > + <MutilForm + dict={this.props.dict} + action={execAction} + inputSubmit={this.handleOk} + configMap={this.state.configMap} + data={this.state.tabledata[0]} + BData={this.props.BData} + wrappedComponentRef={(inst) => this.formRef = inst} + /> + </Modal> + ) + } + + render() { + return ( + <div className="button-list toolbar-button"> + {this.props.actions.map((item, index) => { + return ( + <Button + className={'mk-btn mk-' + item.class} + icon={item.icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + >{item.label}</Button> + ) + })} + {this.getModels()} + </div> + ) + } +} + +export default MainAction \ No newline at end of file diff --git a/src/tabviews/scriptmanage/actionList/index.scss b/src/tabviews/scriptmanage/actionList/index.scss new file mode 100644 index 0000000..9dd1f19 --- /dev/null +++ b/src/tabviews/scriptmanage/actionList/index.scss @@ -0,0 +1,44 @@ +.button-list.toolbar-button { + position: relative; + padding: 10px 20px 5px; + background: #ffffff; + button { + min-width: 65px; + margin-right: 15px; + margin-bottom: 10px; + overflow: hidden; + } + .ant-spin { + position: fixed; + z-index: 1010; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + } +} +// 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� +.action-modal { + .ant-modal { + max-width: 95vw; + } + .ant-modal-body { + max-height: calc(100vh - 235px); + min-height: 150px; + overflow-y: auto; + padding-bottom: 35px; + } + .ant-modal-body::-webkit-scrollbar { + width: 10px; + height: 10px; + } + .ant-modal-body::-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); + } + .ant-modal-body::-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); + } +} \ No newline at end of file diff --git a/src/tabviews/scriptmanage/config.jsx b/src/tabviews/scriptmanage/config.jsx new file mode 100644 index 0000000..3eceaf7 --- /dev/null +++ b/src/tabviews/scriptmanage/config.jsx @@ -0,0 +1,91 @@ +// 鐗堟湰鍗囩骇椤甸潰閰嶇疆 +export const scriptMainTable = { + setting: { + "tableName":"s_custom_script", + "tableType":"radio", + "interType":"inner", + "innerFunc":"", + "dataresource":"Select s.* from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid=p.OpenID", + "queryType":"query", + "actionfixed":false, + "columnfixed":false, + "primaryKey":"ID", + "order":"ID desc", + "onload":"true", + "subtabs":[] + }, + tables: [{"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"}], + search: [ + {"label":"鎻忚堪","field":"Remark","type":"text","initval":"","match":"like","required":"false","ratio":6,"blacklist":[],"uuid":"1587005744706mppigfhf206gciiivf9"} + ], + action:[ + {"label":"娣诲姞","OpenType":"pop","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"notRequired","execSuccess":"grid","execError":"never","icon":"","class":"green","sql":"s_custom_script","sqlType":"insert","uuid":"1587006129803057fs8mb9q151ae6165"}, + {"label":"淇敼","OpenType":"pop","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"requiredSgl","execSuccess":"grid","execError":"never","icon":"","class":"purple","sql":"s_custom_script","sqlType":"update","uuid":"1587007258155ut4nbggg4r66t9uhut2"}, + {"label":"鍒犻櫎","OpenType":"prompt","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"requiredSgl","execSuccess":"grid","execError":"never","icon":"","class":"danger","sql":"s_custom_script","sqlType":"delete","uuid":"1587007300102g2i6nrhtml3fk9053o4"} + ], + columns: [ + {"label":"ID","field":"ID","type":"text","Align":"left","Hide":"true","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"158700581972776t63lf5ev320o0v3a7"}, + {"label":"鍑芥暟","field":"func","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1587005972372rc3486g45kslpho2hfm"}, + {"label":"鎻忚堪","field":"Remark","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15870058197274p6dte4omt4smcsrg4e"}, + {"label":"LongParam","field":"LongParam","type":"text","Align":"left","Hide":"true","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"158700581972767qdag1vc4l37olpbra"}, + {"uuid":"1587005819727akuibkaqkhsl1ntbh7a","Align":"left","label":"鎺掑簭","field":"Sort","Hide":"false","IsSort":"true","type":"number","Width":120}, + {"label":"鎿嶄綔鏃ユ湡","field":"ModifyDate","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1587005860878ckccsiagipdfsfpdiib"} + ], + gridBtn: {"display":false,"Align":"center","IsSort":"false","uuid":"1587005721270gs3nb5u1gs4gsg7g77i","label":"鎿嶄綔","type":"action","style":"button","show":"horizontal","Width":120}, + tabs:[], + tabgroups: ["tabs"], + easyCode: "", + funcs: [ + {"type":"view","subtype":"view","uuid":"1587005717541lov40vg61q7l1rbveon","intertype":"inner","interface":"","tableName":"s_custom_script","innerFunc":"","outerFunc":""}, + {"type":"button","subtype":"btn","uuid":"1587006129803057fs8mb9q151ae6165","label":"娣诲姞","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""}, + {"type":"button","subtype":"btn","uuid":"1587007258155ut4nbggg4r66t9uhut2","label":"淇敼","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""}, + {"type":"button","subtype":"btn","uuid":"1587007300102g2i6nrhtml3fk9053o4","label":"鍒犻櫎","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""} + ] +} + +export const buttonConfig = { + '1587006129803057fs8mb9q151ae6165': { + type: "Modal", + setting: { + "title":"娣诲姞", + "width":60, + "focus":"func", + "cols":"2", + "finish":"close", + "clickouter":"unclose", + "container":"tab", + "display":"modal" + }, + tables:[ + {"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"} + ], + groups:[], + fields:[ + {"label":"鍑芥暟","field":"func","type":"text","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":50,"regular":"","supField":"","blacklist":[],"uuid":"1587006164634l397q15t49u2pfq02f5"}, + {"label":"鎺掑簭","field":"Sort","type":"number","initval":0,"decimal":0,"min":"","max":"","readonly":"false","hidden":"false","readin":"true","supField":"","blacklist":[],"uuid":"15870101796149403f2pqfpviuo415m2"}, + {"label":"鎻忚堪","field":"Remark","type":"textarea","initval":"","readonly":"false","required":"false","hidden":"false","readin":"true","fieldlength":512,"maxRows":6,"supField":"","blacklist":[],"uuid":"1587006199263k8hm45cmtomgu6hd881"}, + {"label":"鑴氭湰","field":"LongParam","type":"textarea","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":8000,"maxRows":20,"supField":"","blacklist":[],"uuid":"1587006209935qbkle15h4d9i9lg9tcu"} + ] + }, + '1587007258155ut4nbggg4r66t9uhut2': { + type: "Modal", + setting: { + "title":"淇敼", + "width":60, + "focus":"func", + "cols":"2", + "finish":"close", + "clickouter":"unclose", + "container":"tab", + "display":"modal" + }, + tables: [{"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"}], + groups: [], + fields: [ + {"label":"鍑芥暟","field":"func","type":"text","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":50,"regular":"","supField":"","blacklist":[],"uuid":"1587006164634l397q15t49u2pfq02f5"}, + {"label":"鎺掑簭","field":"Sort","type":"number","initval":0,"decimal":0,"min":"","max":"","readonly":"false","hidden":"false","readin":"true","supField":"","blacklist":[],"uuid":"1587010196675i9m6ie3tv9kg2rhgfi0"}, + {"label":"鎻忚堪","field":"Remark","type":"textarea","initval":"","readonly":"false","required":"false","hidden":"false","readin":"true","fieldlength":512,"maxRows":6,"supField":"","blacklist":[],"uuid":"1587006199263k8hm45cmtomgu6hd881"}, + {"label":"鑴氭湰","field":"LongParam","type":"textarea","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":8000,"maxRows":20,"supField":"","blacklist":[],"uuid":"1587006209935qbkle15h4d9i9lg9tcu"} + ] + } +} diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx new file mode 100644 index 0000000..5ff47b4 --- /dev/null +++ b/src/tabviews/scriptmanage/index.jsx @@ -0,0 +1,365 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { notification, Switch } from 'antd' +import moment from 'moment' + +import Api from '@/api' +import zhCN from '@/locales/zh-CN/main.js' +import enUS from '@/locales/en-US/main.js' +import Utils from '@/utils/utils.js' +import options from '@/store/options.js' +import { scriptMainTable, buttonConfig } from './config' + +import MainTable from '@/tabviews/zshare/normalTable' +import TopSearch from './topSearch' +import MainAction from './actionList' +import './index.scss' + +class ScriptTable extends Component { + static propTpyes = { + MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuID: PropTypes.string // 鑿滃崟Id + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id + config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 + searchlist: [], // 鎼滅储鏉′欢 + actions: [], // 鎸夐挳闆� + columns: [], // 鏄剧ず鍒� + arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) + setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 + data: [], // 鍒楄〃鏁版嵁闆� + total: 0, // 鎬绘暟 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + pageIndex: 1, // 椤电爜 + pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 + orderBy: '', // 鎺掑簭 + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + visible: false // 寮规鏄剧ず闅愯棌鎺у埗 + } + + /** + * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 + */ + async loadconfig () { + let config = scriptMainTable + + let _arrField = [] // 瀛楁闆� + let _columns = [] // 鏄剧ず鍒� + let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� + let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� + let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 + + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid + config.columns.forEach(col => { + if (col.field) { + _arrField.push(col.field) + + _logcolumns.push(col) + } + if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 + _hideCol = _hideCol.concat(col.sublist) + } else if (col.Hide === 'true') { + _hideCol.push(col.uuid) + } + colMap.set(col.uuid, col) + }) + + // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� + config.columns.forEach(col => { + if (_hideCol.includes(col.uuid)) return + + if (col.type === 'colspan' && col.sublist) { + let _col = JSON.parse(JSON.stringify(col)) + let subColumn = [] + _col.sublist.forEach(sub => { + if (colMap.has(sub)) { + subColumn.push(colMap.get(sub)) + } + }) + _col.subColumn = subColumn + _columns.push(_col) + } else { + _columns.push(col) + } + }) + + this.setState({ + config: config, + setting: config.setting, + searchlist: config.search, + actions: config.action.map(item => { + if (buttonConfig[item.uuid]) { + item = {...buttonConfig[item.uuid], ...item} + } + return item + }), + columns: _columns, + logcolumns: _logcolumns, + arr_field: _arrField.join(','), + search: Utils.initMainSearch(config.search) + }, () => { + this.setState({ + loading: true + }) + this.loadmaindata() + }) + } + + /** + * @description 涓昏〃鏁版嵁鍔犺浇 + */ + async loadmaindata () { + let param = this.getDefaultParam() + + this.setState({ + pickup: false + }) + + if (options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } + + let result = await Api.genericInterface(param) + if (result.status) { + this.setState({ + data: result.data.map((item, index) => { + item.LongParam = Utils.formatOptions(item.LongParam, true) + item.key = index + return item + }), + total: result.total, + loading: false + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 15 + }) + } + } + + /** + * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� + */ + getDefaultParam = () => { + const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state + + let _search = Utils.joinMainSearchkey(search) + + _search = _search ? 'where ' + _search : '' + + let param = { + func: 'sPC_Get_TableData', + obj_name: 'data', + arr_field: arr_field + } + + let _orderBy = orderBy || setting.order + let _dataresource = setting.dataresource + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } + + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + let DateCount = `select count(1) as total from ${_dataresource} ${_search}` + + param.LText = Utils.formatOptions(LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.DateCount = Utils.formatOptions(DateCount) + + return param + } + + /** + * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 + * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� + */ + refreshbysearch = (searches) => { + this.refs.mainTable.resetTable() + + this.setState({ + loading: true, + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 + */ + refreshbytable = (pagination, filters, sorter) => { + if (sorter.order) { + let _chg = { + ascend: 'asc', + descend: 'desc' + } + sorter.order = _chg[sorter.order] + } + + this.setState({ + loading: true, + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鍒锋柊 + */ + reloadtable = () => { + this.refs.mainTable.resetTable() + this.setState({ + loading: true, + pageIndex: 1 + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� + */ + reloadview = () => { + this.setState({ + config: {}, + searchlist: [], + actions: [], + columns: [], + arr_field: '', + setting: {}, + data: [], + total: 0, + loading: false, + pageIndex: 1, + pageSize: 10, + orderBy: '', + search: '', + pickup: false + }, () => { + this.loadconfig() + }) + } + + /** + * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� + */ + refreshbyaction = (btn, type) => { + if (btn.execSuccess === 'grid' && type === 'success') { + this.reloadtable() + } else if (btn.execError === 'grid' && type === 'error') { + this.reloadtable() + } else if (btn.execSuccess === 'view' && type === 'success') { + this.reloadview() + } else if (btn.execError === 'view' && type === 'error') { + this.reloadview() + } + } + + /** + * @description 鑾峰彇琛ㄦ牸閫夋嫨椤� + */ + gettableselected = () => { + let data = [] + this.refs.mainTable.state.selectedRowKeys.forEach(item => { + data.push(this.refs.mainTable.props.data[item]) + }) + return data + } + + /** + * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 + */ + pickupChange = () => { + const { pickup } = this.state + this.setState({ + pickup: !pickup + }) + } + + UNSAFE_componentWillMount () { + // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 + this.loadconfig() + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { dict, searchlist, setting, actions, columns, pickup } = this.state + + return ( + <div className="veruptable pick-control" id={this.state.ContainerId}> + <TopSearch + dict={dict} + searchlist={searchlist} + refreshdata={this.refreshbysearch} + /> + <MainAction + BID="" + type="main" + setting={setting} + actions={actions} + dict={this.state.dict} + MenuID={this.props.MenuID} + logcolumns={this.state.logcolumns} + ContainerId={this.state.ContainerId} + refreshdata={this.refreshbyaction} + gettableselected={this.gettableselected} + /> + <div className="main-table-box"> + {this.state.data && this.state.data.length > 0 ? + <div className="pickchange"> + <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> + </div> : null + } + <MainTable + ref="mainTable" + menuType="HS" + tableId="mainTable" + pickup={pickup} + setting={setting} + columns={columns} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + MenuID={this.props.MenuID} + loading={this.state.loading} + refreshdata={this.refreshbytable} + buttonTrigger={() => {}} + handleTableId={() => {}} + /> + </div> + </div> + ) + } +} + +export default ScriptTable \ No newline at end of file diff --git a/src/tabviews/scriptmanage/index.scss b/src/tabviews/scriptmanage/index.scss new file mode 100644 index 0000000..d3ec298 --- /dev/null +++ b/src/tabviews/scriptmanage/index.scss @@ -0,0 +1,111 @@ +.veruptable { + position: relative; + min-height: calc(100vh - 94px); + padding-top: 16px; + padding-bottom: 80px; + + .search-line { + padding: 0px 24px 0px; + border-bottom: 1px solid #efefef; + } + + .box404 { + padding-top: 30px; + } + .ant-modal-mask { + position: absolute; + } + .ant-modal-wrap { + position: absolute; + } + .action-modal .ant-modal { + top: 40px; + max-width: 95%; + .ant-modal-body { + max-height: calc(100vh - 265px); + } + } + > .ant-spin { + position: fixed; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + } + > .ant-card { + margin: 0 20px 20px; + > .ant-card-head { + border: 0; + padding: 0; + min-height: 30px; + .ant-card-head-title { + padding: 10px 0 0; + span { + color: #1890ff; + display: inline-block; + padding: 0 10px; + font-size: 15px; + border-bottom: 1px solid #1890ff; + i { + margin-right: 10px; + } + } + } + } + > .ant-card-body { + padding: 0; + } + } + .main-table-box { + position: relative; + .pickchange { + position: absolute; + right: 0px; + top: -25px; + .ant-switch { + z-index: 1; + float: right; + margin-right: 20px; + margin-bottom: 5px; + } + } + } + > .ant-tabs { + padding: 0px 20px; + margin-bottom: 20px; + .ant-tabs-tab:not(.ant-tabs-tab-active) { + cursor: pointer; + } + } + .common-table-copy { + position: fixed; + z-index: 2; + bottom: 65px; + right: 30px; + width: 40px; + height: 40px; + } +} +.commontable.pick-control { + >.button-list { + padding-right: 140px; + } +} + +.menu-tree-modal { + .ant-modal-body { + min-height: 300px; + .menu-header { + text-align: center; + span { + font-weight: 600; + margin-right: 20px; + } + .ant-typography { + font-weight: 600; + display: inline-block; + } + } + .ant-tree li .ant-tree-node-content-wrapper { + cursor: default; + } + } +} \ No newline at end of file diff --git a/src/tabviews/scriptmanage/topSearch/index.jsx b/src/tabviews/scriptmanage/topSearch/index.jsx new file mode 100644 index 0000000..853f358 --- /dev/null +++ b/src/tabviews/scriptmanage/topSearch/index.jsx @@ -0,0 +1,120 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input, Button } from 'antd' +import './index.scss' + +class MainSearch extends Component { + static propTpyes = { + searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 + dict: PropTypes.object // 瀛楀吀椤� + } + + state = { + match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 + style: null, + searchlist: null + } + + UNSAFE_componentWillMount () { + let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) + let match = {} + let style = {} + let _list = [] + + searchlist.forEach(item => { + match[item.field] = item.match + style[item.field] = item.type + + _list.push(item) + }) + + this.setState({ + match: match, + style: style, + searchlist: _list + }) + } + + getFields() { + const { getFieldDecorator } = this.props.form + const fields = [] + + this.state.searchlist.forEach((item, index) => { + fields.push( + <Col span={6} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + ) + }) + + fields.push( + <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> + <Form.Item label={' '} colon={false}> + <Button type="primary" htmlType="submit"> + {this.props.dict['main.search']} + </Button> + <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> + {this.props.dict['main.reset']} + </Button> + </Form.Item> + </Col> + ) + + return fields + } + + handleSearch = (e) => { + // 鍥炶溅鎴栫偣鍑绘悳绱� + e.preventDefault() + this.props.form.validateFields((err, values) => { + let searches = this.getFieldsValues(values) + this.props.refreshdata(searches) + }) + } + + handleReset = () => { + // 閲嶇疆 + this.props.form.resetFields() + this.props.form.validateFields((err, values) => { + let searches = this.getFieldsValues(values) + this.props.refreshdata(searches) + }) + } + + getFieldsValues = (values) => { + // 鑾峰彇鎼滅储鏉′欢鍊� + let search = [] + Object.keys(values).forEach(key => { + search.push({ + type: this.state.style[key], + key: key, + value: values[key].replace(/(^\s*|\s*$)/ig, ''), + match: this.state.match[key] + }) + }) + return search + } + + render() { + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} className="verup-search-line" onSubmit={this.handleSearch}> + <Row gutter={24}>{this.getFields()}</Row> + </Form> + ) + } +} + +export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/scriptmanage/topSearch/index.scss b/src/tabviews/scriptmanage/topSearch/index.scss new file mode 100644 index 0000000..35cfc73 --- /dev/null +++ b/src/tabviews/scriptmanage/topSearch/index.scss @@ -0,0 +1,26 @@ +.verup-search-line { + padding: 0px 24px 20px; + border-bottom: 1px solid #efefef; + .ant-form-item { + display: flex; + margin-bottom: 10px; + } + .ant-form-item-control-wrapper { + flex: 1; + width: calc(100% - 100px); + } + .ant-form-item-label { + // width: 100px; + text-overflow: ellipsis; + } + .daterange .ant-calendar-picker-input { + padding: 4px 20px 4px 5px; + font-size: 13px; + } + .ant-select-dropdown { + z-index: 10 !important; + } + .ant-calendar-picker-container { + z-index: 10 !important; + } +} \ No newline at end of file diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index d73ae6f..2ee84a9 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -488,14 +488,12 @@ param.rduri = setting.interface } } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (setting.sysInterface !== 'true') { param.rduri = setting.interface } } - - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey if (setting.outerFunc) { param.func = setting.outerFunc @@ -518,8 +516,7 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - BID: BID, - appkey: window.GLOB.appkey || '' + BID: BID } let _orderBy = orderBy || setting.order @@ -836,6 +833,7 @@ } <SubTable ref="subTable" + menuType={this.props.menuType} tableId={this.props.Tab.uuid} pickup={pickup} setting={setting} diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 43b61fd..10f7670 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -391,14 +391,12 @@ param.rduri = setting.interface } } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (setting.sysInterface !== 'true') { param.rduri = setting.interface } } - - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey if (setting.outerFunc) { param.func = setting.outerFunc @@ -421,8 +419,7 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - BID: this.props.BID, - appkey: window.GLOB.appkey || '' + BID: this.props.BID } let _orderBy = orderBy || setting.order @@ -631,6 +628,7 @@ BData={this.props.BData} MenuID={this.props.SupMenuID} permRoles={this.props.permRoles} + logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} gettableselected={this.gettableselected} @@ -640,6 +638,7 @@ {columns && <SubTable ref="subTable" + menuType={this.props.menuType} tableId="" dict={this.state.dict} MenuID={this.props.MenuID} @@ -648,7 +647,6 @@ data={this.state.data} total={this.state.total} loading={this.state.loading} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbytable} buttonTrigger={this.buttonTrigger} handleTableId={() => {}} diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx index 466a3ad..6a61df4 100644 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ b/src/tabviews/verupmanage/actionList/index.jsx @@ -460,8 +460,6 @@ res.func = btn.outerFunc } - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey - return Api.genericInterface(res) }).then(response => { if (!response) return diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index 1f2d0b9..82861ff 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -192,8 +192,6 @@ param.rduri = setting.interface } - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey - if (setting.outerFunc) { param.func = setting.outerFunc } @@ -224,8 +222,7 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: arr_field, - appkey: window.GLOB.appkey || '' + arr_field: arr_field } let _orderBy = orderBy || setting.order @@ -472,6 +469,7 @@ } <MainTable ref="mainTable" + menuType="HS" tableId="mainTable" pickup={pickup} setting={setting} diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index 685ad1c..5d8915f 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -215,8 +215,6 @@ param.rduri = setting.interface } - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey - if (setting.outerFunc) { param.func = setting.outerFunc } @@ -238,8 +236,7 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - BID: BID, - appkey: window.GLOB.appkey || '' + BID: BID } let _orderBy = orderBy || setting.order @@ -467,6 +464,7 @@ } <SubTable ref="subTable" + menuType="HS" tableId={this.props.Tab.uuid} pickup={pickup} setting={setting} diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 533eb25..494a553 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -570,9 +570,9 @@ res.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } } @@ -1027,9 +1027,11 @@ let param = { BID: this.props.BID, - func: 'webapi_ChangeUser', - appkey: window.GLOB.appkey || '', - rduri: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + func: 'webapi_ChangeUser' + } + + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi } param[setting.primaryKey] = data[0][setting.primaryKey] @@ -1439,19 +1441,16 @@ res.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } } - // res.method = btn.method if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey return Api.genericInterface(res) }).then(response => { @@ -1916,9 +1915,9 @@ param.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { param.rduri = btn.interface } } @@ -1926,8 +1925,6 @@ if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey return Api.genericInterface(res) }).then(response => { @@ -2008,14 +2005,12 @@ param.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { param.rduri = btn.interface } } - - param.appkey = window.GLOB.appkey || '' if (btn.outerFunc) { param.func = btn.outerFunc @@ -2039,17 +2034,15 @@ delete res.message delete res.status - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey Api.genericInterface(res).then(result => { if (result.status) { @@ -2093,9 +2086,9 @@ param.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { param.rduri = btn.interface } } @@ -2103,8 +2096,6 @@ if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey Api.genericInterface(res).then(result => { if (result.status) { @@ -2156,16 +2147,13 @@ param.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { param.rduri = btn.interface } } - - param.appkey = window.GLOB.appkey || '' - if (btn.outerFunc) { param.func = btn.outerFunc } @@ -2327,8 +2315,7 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: arr_field, - appkey: window.GLOB.appkey || '' + arr_field: arr_field } if (this.props.BID) { diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index e0531e3..7a30c0d 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -80,7 +80,7 @@ _readin = false } - item.initVal = item.initval + item.initVal = item.initval ? JSON.parse(JSON.stringify(item.initval)) : '' // 鐢ㄤ簬鍙楁帶鍊肩殑琛ㄥ崟锛岄殣钘忔椂浼犻粯璁ゅ�� let _fieldlen = item.fieldlength || 50 if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') { diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 0e5dc7d..4fc83b9 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import md5 from 'md5' import { Table, message, Affix, Button, Typography, Modal } from 'antd' import './index.scss' @@ -8,10 +9,12 @@ export default class MainTable extends Component { static defaultProps = { pagination: true, - total: 0 + total: 0, + menuType: 'normal' } static propTpyes = { + menuType: PropTypes.any, // 涓夌骇鑿滃崟绫诲瀷锛孒S闇�鐗规畩澶勭悊 tableId: PropTypes.string, // 鍒楄〃Id dict: PropTypes.object, // 瀛楀吀椤� MenuID: PropTypes.string, // 鑿滃崟Id @@ -19,7 +22,7 @@ pickup: PropTypes.any, // 鏁版嵁鏀惰捣 columns: PropTypes.array, // 琛ㄦ牸鍒� data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - total: PropTypes.any, // 鎬绘暟 + total: PropTypes.any, // 鎬绘暟 loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� buttonTrigger: PropTypes.func, // 琛ㄦ牸涓寜閽Е鍙戞搷浣� @@ -38,11 +41,15 @@ } UNSAFE_componentWillMount () { - const { columns } = this.props + const { columns, menuType } = this.props let _columns = [] columns.forEach((item, index) => { if (item.hidden === true || item.Hide === 'true') return + + if (window.GLOB.dataFormat && menuType !== 'HS' && !Math.floor(Math.random() * 5)) { + item.format = true + } let cell = { align: item.Align, @@ -114,6 +121,10 @@ content = (item.prefix || '') + content + (item.postfix || '') + if (item.format) { + content = md5(content) + } + if (item.linkThdMenu) { return ( <div className={match ? item.color : ''}> @@ -178,6 +189,10 @@ content = (item.prefix || '') + content + (item.postfix || '') } + if (item.format) { + content = md5(content) + } + if (item.linkThdMenu) { return ( <div className={match ? item.color : ''}> @@ -204,13 +219,15 @@ } else { photos = '' } + + let maxHeight = item.maxHeight || 128 return ( <div className="picture-col" style={{ minWidth: (item.Width || 120) + 'px' }}> {photos && photos.map((url, i) => { if (item.scale === 'true') { - return <img className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/> + return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/> } else { - return <img key={`${i}`} src={url} alt=""/> + return <img style={{maxHeight: maxHeight}} key={`${i}`} src={url} alt=""/> } })} </div> @@ -227,6 +244,10 @@ } content = (item.prefix || '') + content + (item.postfix || '') + + if (item.format) { + content = md5(content) + } return ( <div className={match ? item.color : ''}> @@ -279,6 +300,10 @@ content = (col.prefix || '') + content + (col.postfix || '') } + if (item.format) { + content = md5(content) + } + contents.push(content) } else if (col.type === 'picture') { let photos = [] @@ -288,9 +313,21 @@ photos = [] } - images.push(...photos) + photos.forEach(photo => { + images.push({url: photo, scale: col.scale === 'true', maxHeight: col.maxHeight || 128}) + }) } else { - contents.push((col.prefix || '') + record[col.field] + (col.postfix || '')) + let content = record[col.field] + + if (content !== '') { + content = (col.prefix || '') + record[col.field] + (col.postfix || '') + } + + if (item.format) { + content = md5(content) + } + + contents.push(content) } }) @@ -344,9 +381,13 @@ return ( <div className="content-fence"> <div className="content-fence-top"> - {images.map((url, index) => { - if (!url) return '' - return (<img key={`${index}`} src={url} alt=""/>) + {images.map((_img, index) => { + if (!_img.url) return '' + if (_img.scale) { + return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/> + } else { + return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) + } })} </div> <div className="content-fence-bottom"> @@ -360,9 +401,13 @@ return ( <div className="content-fence"> <div className="content-fence-left"> - {images.map((url, index) => { - if (!url) return '' - return (<img key={`${index}`} src={url} alt=""/>) + {images.map((_img, index) => { + if (!_img.url) return '' + if (_img.scale) { + return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/> + } else { + return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) + } })} </div> <div className="content-fence-right"> diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index 28bc4ae..8678655 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -64,6 +64,7 @@ img { max-width: 100%; + display: block; } img + img { margin-left: 10px; @@ -84,6 +85,7 @@ img { max-width: 100%; + display: block; } img + img { margin-top: 10px; @@ -101,6 +103,10 @@ .picture-col { img { max-width: 100%; + display: block; + } + img + img { + margin-top: 10px; } .image-scale { cursor: zoom-in; diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 9c4450c..1cdc807 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -403,7 +403,7 @@ } else if (key === 'sysInterface') { if (value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) } this.setState({ diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 8a7c53b..4964725 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -3182,7 +3182,7 @@ <Modal title={this.state.dict['header.modal.search.edit']} visible={modaltype === 'search'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} confirmLoading={this.state.sqlVerifing} @@ -3227,7 +3227,7 @@ <Modal title={this.state.dict['header.modal.column.edit']} visible={modaltype === 'columns'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -3264,7 +3264,7 @@ <Modal title={this.state.dict['header.modal.gridbtn.edit']} visible={modaltype === 'gridbtn'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -3281,7 +3281,7 @@ <Modal title={this.state.dict['header.modal.tabs.edit']} visible={modaltype === 'tabs'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -3370,7 +3370,7 @@ <Modal title={this.state.dict['header.edit']} visible={this.state.settingVisible} - width={700} + width={750} maskClosable={false} onCancel={() => { // 鍙栨秷淇敼 this.setState({ diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 95b93c6..4e80839 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -80,7 +80,7 @@ let _type = this.props.form.getFieldValue('sysInterface') if (_type === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -96,7 +96,7 @@ onSysChange = (e) => { if (e.target.value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -203,7 +203,7 @@ {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (data.interface || ''), + initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (data.interface || ''), rules: [ { required: true, diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx index 1b9bdc0..e3c8123 100644 --- a/src/templates/formtabconfig/actionform/index.jsx +++ b/src/templates/formtabconfig/actionform/index.jsx @@ -225,7 +225,7 @@ } else if (key === 'sysInterface') { if (value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) } this.setState({ diff --git a/src/templates/formtabconfig/settingform/index.jsx b/src/templates/formtabconfig/settingform/index.jsx index 7dafe72..4dab6bc 100644 --- a/src/templates/formtabconfig/settingform/index.jsx +++ b/src/templates/formtabconfig/settingform/index.jsx @@ -75,7 +75,7 @@ onSysChange = (e) => { if (e.target.value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -96,7 +96,7 @@ let _type = this.props.form.getFieldValue('sysInterface') if (_type === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -120,7 +120,7 @@ let _type = this.props.form.getFieldValue('sysInterface') if (_type === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -239,7 +239,7 @@ {datatype === 'query' && interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (setting.interface || ''), + initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), rules: [ { required: true, diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index 7e14ec5..4438d4f 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -446,7 +446,7 @@ } else if (key === 'sysInterface') { if (value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) } this.setState({ diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 1cccb43..efbf7ec 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -2459,7 +2459,7 @@ <Modal title={this.state.dict['header.modal.search.edit']} visible={modaltype === 'search'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} confirmLoading={this.state.sqlVerifing} @@ -2479,7 +2479,7 @@ <Modal title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} - width={700} + width={750} maskClosable={false} onCancel={this.editModalCancel} footer={[ @@ -2504,7 +2504,7 @@ <Modal title={this.state.dict['header.modal.column.edit']} visible={modaltype === 'columns'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -2523,7 +2523,7 @@ <Modal title={this.state.dict['header.modal.colspan.edit']} visible={modaltype === 'colspan'} - width={700} + width={750} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -2628,7 +2628,7 @@ <Modal title={this.state.dict['header.edit']} visible={this.state.settingVisible} - width={700} + width={750} maskClosable={false} onCancel={() => { // 鍙栨秷淇敼 this.setState({ diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index 0754355..2870677 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -82,7 +82,7 @@ let _type = this.props.form.getFieldValue('sysInterface') if (_type === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -98,7 +98,7 @@ onSysChange = (e) => { if (e.target.value === 'true') { this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + interface: window.GLOB.mainSystemApi || '' }) this.setState({ interReadonly: true @@ -205,7 +205,7 @@ {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (data.interface || ''), + initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (data.interface || ''), rules: [ { required: true, diff --git a/src/templates/zshare/columnform/index.jsx b/src/templates/zshare/columnform/index.jsx index 1fce667..09f9db8 100644 --- a/src/templates/zshare/columnform/index.jsx +++ b/src/templates/zshare/columnform/index.jsx @@ -11,7 +11,7 @@ text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist', 'linkmenu'], number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist', 'linkmenu'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale'] + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight'] } class MainSearch extends Component { @@ -150,10 +150,15 @@ </Form.Item> </Col> ) - } else if (item.type === 'number') { // 鏂囨湰鎼滅储 + } else if (item.type === 'number') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 6912d58..8ea25d1 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -423,7 +423,7 @@ type: 'text', key: 'interface', label: Formdict['header.form.interface'], - initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (card.interface || ''), + initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), required: true, readonly: card.sysInterface === 'true' }, @@ -812,20 +812,16 @@ required: false }, { - type: 'multiselect', - key: 'blacklist', - label: Formdict['header.form.blacklist'], - initVal: card.blacklist || [], - required: false, - options: roleList - }, - { - type: 'cascader', - key: 'linkmenu', - label: Formdict['header.form.linkmenu'], - initVal: card.linkmenu || [], - required: false, - options: menulist + type: 'number', + key: 'maxHeight', + min: 1, + max: 1000, + decimal: 0, + label: '鏈�澶ч珮搴�', + tooltip: '鍥剧墖鍦ㄨ〃鏍间腑鏄剧ず鐨勬渶澶ч珮搴�', + tooltipClass: 'middle', + initVal: card.maxHeight || 128, + required: true }, { type: 'radio', @@ -840,6 +836,22 @@ value: 'false', text: Formdict['header.form.false'] }] + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList + }, + { + type: 'cascader', + key: 'linkmenu', + label: Formdict['header.form.linkmenu'], + initVal: card.linkmenu || [], + required: false, + options: menulist } ] } diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index b56f0b6..cc7bf88 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button, notification, Modal } from 'antd' +import { Form, Row, Col, Input, Button, notification, Modal, Select, Tooltip, Icon, Radio } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' @@ -13,7 +13,8 @@ static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� usefulfields: PropTypes.string, // 鍙敤瀛楁 - initsql: PropTypes.string, // 鍙敤瀛楁 + initsql: PropTypes.string, // sql鍓嶇紑 + systemScripts: PropTypes.array, // 绯荤粺鑴氭湰 scriptsChange: PropTypes.func // 琛ㄥ崟 } @@ -28,7 +29,8 @@ }) this.props.form.setFieldsValue({ - sql: record.sql + sql: record.sql, + position: record.position || 'back' }) } @@ -106,8 +108,14 @@ }) } + selectScript = (val) => { + this.props.form.setFieldsValue({ + sql: val + }) + } + render() { - const { usefulfields } = this.props + const { usefulfields, systemScripts } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { labelCol: { @@ -128,7 +136,7 @@ {usefulfields} </Form.Item> </Col> : null} - <Col span={21} className="sql"> + <Col span={20} className="sql"> <Form.Item label={'sql'}> {getFieldDecorator('sql', { initialValue: '', @@ -141,10 +149,39 @@ })(<TextArea rows={15} />)} </Form.Item> </Col> - <Col span={3} className="add"> - <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row"> + <Col span={4} className="add"> + <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" style={{marginBottom: 20}}> 纭畾 </Button> + <Form.Item labelAlign="left" label={ + <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> + 鎵ц浣嶇疆 + </Tooltip> + } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }> + {getFieldDecorator('position', { + initialValue: 'back' + })( + <Radio.Group> + <Radio value="front">sql鍓�</Radio> + <Radio value="back">sql鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + <Form.Item labelAlign="left" label={ + <Tooltip placement="bottomLeft" title={'浠庣郴缁熷嚱鏁伴泦涓�夋嫨闇�瑕佺殑鍑芥暟锛屽彲蹇�熸坊鍔犺嚦sql涓��'}> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> + 蹇嵎娣诲姞 + </Tooltip> + } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }> + <Select onChange={this.selectScript}> + {systemScripts.map((option, i) => + <Select.Option title={option.name} key={i} value={option.value}> + {option.name} + </Select.Option> + )} + </Select> + </Form.Item> </Col> </Row> </Form> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 396c41e..a4b935c 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -36,6 +36,7 @@ orderModularDetail: [], voucher: [], voucherDetail: [], + systemScripts: [], uniqueColumns: [ { title: '瀛楁鍚�', @@ -224,7 +225,13 @@ { title: 'SQL', dataIndex: 'sql', - width: '70%' + width: '60%' + }, + { + title: '鎵ц浣嶇疆', + dataIndex: 'position', + width: '10%', + render: (text, record) => record.position !== 'front' ? 'sql鍚�' : 'sql鍓�' }, { title: '鐘舵��', @@ -769,6 +776,39 @@ voucher: result[0].data, voucherDetail: result[1].data }) + }) + + let _scriptSql = `Select distinct func+Remark as funcname,longparam from聽s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end` + + _scriptSql = Utils.formatOptions(_scriptSql) + + let _sParam = { + func: 'sPC_Get_SelectedList', + LText: _scriptSql, + obj_name: 'data', + arr_field: 'funcname,longparam' + } + + _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) + + Api.getSystemConfig(_sParam).then(res => { + if (res.status) { + this.setState({ + systemScripts: res.data.map(item => { + return { + name: item.funcname, + value: Utils.formatOptions(item.longparam, true) + } + }) + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } }) } @@ -1331,6 +1371,7 @@ usefulfields={this.state.usefulfields} initsql={this.state.initsql} dict={this.props.dict} + systemScripts={this.state.systemScripts} scriptsChange={this.scriptsChange} wrappedComponentRef={(inst) => this.scriptsForm = inst} /> diff --git a/src/templates/zshare/verifycardexcelin/customscript/index.jsx b/src/templates/zshare/verifycardexcelin/customscript/index.jsx index d436de3..18e0aaa 100644 --- a/src/templates/zshare/verifycardexcelin/customscript/index.jsx +++ b/src/templates/zshare/verifycardexcelin/customscript/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button, notification, Modal } from 'antd' +import { Form, Row, Col, Input, Button, notification, Modal, Select, Icon, Tooltip, Radio } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' @@ -16,6 +16,7 @@ scripts: PropTypes.array, // 鑷畾涔夎剼鏈垪琛� isdefault: PropTypes.any, // 鏄惁浣跨敤榛樿sql usefulfields: PropTypes.any, // 鍙敤瀛楁 + systemScripts: PropTypes.array, // 绯荤粺鑴氭湰 scriptsChange: PropTypes.func // 琛ㄥ崟 } @@ -67,7 +68,8 @@ }) this.props.form.setFieldsValue({ - sql: record.sql + sql: record.sql, + position: record.position || 'back' }) } @@ -158,7 +160,14 @@ }) } + selectScript = (val) => { + this.props.form.setFieldsValue({ + sql: val + }) + } + render() { + const { systemScripts } = this.props const { usefulfields } = this.state const { getFieldDecorator } = this.props.form const formItemLayout = { @@ -180,7 +189,7 @@ {usefulfields} </Form.Item> </Col> : null} - <Col span={21} className="sql"> + <Col span={20} className="sql"> <Form.Item label={'sql'}> {getFieldDecorator('sql', { initialValue: '', @@ -193,10 +202,39 @@ })(<TextArea rows={15} />)} </Form.Item> </Col> - <Col span={3} className="add"> - <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row"> + <Col span={4} className="add"> + <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" style={{marginBottom: 20}}> 纭畾 </Button> + <Form.Item labelAlign="left" label={ + <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> + 鎵ц浣嶇疆 + </Tooltip> + } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }> + {getFieldDecorator('position', { + initialValue: 'back' + })( + <Radio.Group> + <Radio value="front">sql鍓�</Radio> + <Radio value="back">sql鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + <Form.Item labelAlign="left" label={ + <Tooltip placement="bottomLeft" title={'浠庣郴缁熷嚱鏁伴泦涓�夋嫨闇�瑕佺殑鍑芥暟锛屽彲蹇�熸坊鍔犺嚦sql涓��'}> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> + 蹇嵎娣诲姞 + </Tooltip> + } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }> + <Select onChange={this.selectScript}> + {systemScripts.map((option, i) => + <Select.Option title={option.name} key={i} value={option.value}> + {option.name} + </Select.Option> + )} + </Select> + </Form.Item> </Col> </Row> </Form> diff --git a/src/templates/zshare/verifycardexcelin/index.jsx b/src/templates/zshare/verifycardexcelin/index.jsx index 9ae2d2e..4ded8bf 100644 --- a/src/templates/zshare/verifycardexcelin/index.jsx +++ b/src/templates/zshare/verifycardexcelin/index.jsx @@ -1,7 +1,9 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Tabs, Row, Col, Input, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Radio } from 'antd' +import moment from 'moment' +import Api from '@/api' import Utils from '@/utils/utils.js' import UniqueForm from './uniqueform' @@ -21,6 +23,7 @@ state = { verify: {}, + systemScripts: [], excelColumns: [ { title: 'Column', @@ -142,7 +145,13 @@ { title: 'SQL', dataIndex: 'sql', - width: '70%' + width: '60%' + }, + { + title: '鎵ц浣嶇疆', + dataIndex: 'position', + width: '10%', + render: (text, record) => record.position !== 'front' ? 'sql鍚�' : 'sql鍓�' }, { title: '鐘舵��', @@ -214,6 +223,41 @@ columns: _columns, scripts: _verify.scripts || [], uniques: _verify.uniques || [] + } + }) + } + + componentDidMount () { + let _scriptSql = `Select distinct func+Remark as funcname,longparam from聽s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end` + + _scriptSql = Utils.formatOptions(_scriptSql) + + let _sParam = { + func: 'sPC_Get_SelectedList', + LText: _scriptSql, + obj_name: 'data', + arr_field: 'funcname,longparam' + } + + _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) + + Api.getSystemConfig(_sParam).then(res => { + if (res.status) { + this.setState({ + systemScripts: res.data.map(item => { + return { + name: item.funcname, + value: Utils.formatOptions(item.longparam, true) + } + }) + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) } }) } @@ -673,6 +717,7 @@ isdefault={verify.default} usefulfields={verify.columns} scripts={verify.scripts} + systemScripts={this.state.systemScripts} scriptsChange={this.scriptsChange} wrappedComponentRef={(inst) => this.scriptsForm = inst} /> diff --git a/src/utils/utils.js b/src/utils/utils.js index 4b68be0..39c4111 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -54,7 +54,7 @@ * @description sql鍔犲瘑 * @return {String} value */ - static formatOptions (value) { + static formatOptions (value, isUnFormat = false) { if (!value) return '' let salt = 'minKe' // 鐩愬�� @@ -157,25 +157,43 @@ value: ' mrlbkk ' }] - // 鏇挎崲鍏抽敭瀛� - format.forEach(item => { - let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') - value = value.replace(reg, item.value) - }) + if (!isUnFormat) { // 鍔犲瘑 + // 鏇挎崲鍏抽敭瀛� + format.forEach(item => { + let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') + value = value.replace(reg, item.value) + }) + + // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛� + value = value.replace(/%/ig, ' mpercent ') + + // 1銆乪ncode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛夛紝2銆乥ase64鍔犲瘑 + value = window.btoa(window.encodeURIComponent(value)) + + // 鎻掑叆瀛楃 + let index = Math.floor(value.length / 2) + value = value.slice(0, index) + salt + value.slice(index) + + // base64鍔犲瘑 + value = window.btoa(value) + } else { // 瑙e瘑 + try { + value = window.atob(value) + value = value.replace(salt, '') + value = window.decodeURIComponent(window.atob(value)) + value = value.replace(/\smpercent\s/g, '%') - // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛夛紝2銆佸幓闄ゆ敹灏惧浣欑┖鏍� - value = value.replace(/%/ig, ' mpercent ') - // value = value.replace(/(^\s|\s$)/ig, '') - - // 1銆乪ncode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛夛紝2銆乥ase64鍔犲瘑 - value = window.btoa(window.encodeURIComponent(value)) - - // 鎻掑叆瀛楃 - let index = Math.floor(value.length / 2) - value = value.slice(0, index) + salt + value.slice(index) - - // base64鍔犲瘑 - value = window.btoa(value) + format.forEach(item => { + let reg = new RegExp(item.value, 'g') + value = value.replace(reg, ' ' + item.key + ' ') + }) + + value = value.replace(/(^\s+|\s+$)/ig, '') + } catch { + console.warn('UnFormat Failure') + value = '' + } + } return value } @@ -477,6 +495,11 @@ let errors = [] let _topline = btn.range || 0 let upId = this.getuuid() + + if (btn.scripts && btn.scripts.length > 0) { + btn.scripts = btn.scripts.filter(item => item.status !== 'false') + } + let _Ltext = data.map((item, lindex) => { let vals = btn.columns.map((col, cindex) => { let val = item[col.Column] !== undefined ? item[col.Column] : '' @@ -619,6 +642,16 @@ let _insert = '' + if (btn.scripts && btn.scripts.length > 0) { + btn.scripts.forEach(script => { + if (script.position !== 'front') return + + _insert += ` + ${script.sql} + ` + }) + } + if (btn.default !== 'false') { _insert = ` Insert into ${item.sheet} (${fields},createuserid,createuser,createstaff,bid) @@ -628,7 +661,7 @@ if (btn.scripts && btn.scripts.length > 0) { btn.scripts.forEach(script => { - if (script.status === 'false') return + if (script.position === 'front') return _insert += ` ${script.sql} @@ -713,6 +746,10 @@ if (!_vars.includes(_key)) { _vars.push(_key) + if (form.fieldlen && form.fieldlen > 2048) { + form.fieldlen = 'max' + } + let _type = `nvarchar(${form.fieldlen})` if (form.type.match(/date/ig)) { @@ -748,6 +785,10 @@ if (!_vars.includes(_key)) { _vars.push(_key) + + if (col.fieldlength && col.fieldlength > 2048) { + col.fieldlength = 'max' + } let _type = `nvarchar(${col.fieldlength || 50})` @@ -894,7 +935,7 @@ // 鑷畾涔夐獙璇� if (verify.customverifys && verify.customverifys.length > 0) { - verify.customverifys.forEach(item => { + verify.customverifys.forEach(item => { _sql += `select @tbid='', @ErrorCode='',@retmsg='' select top 1 @tbid='X' from (${item.sql}) a If @tbid ${item.result === 'true' ? '!=' : '='}'' @@ -1031,6 +1072,9 @@ keys.push('bid') } values.push('@BID@') + } else if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) { + keys.push(tab.foreignKey) + values.push('@BID@') } keys = keys.join(',') @@ -1047,7 +1091,11 @@ _arr.push(item.key.toLowerCase()) if (item.type === 'funcvar') { - _form.push(item.key + '=@' + item.key) + if (_actionType === 'update') { + _form.push(item.key + '=@' + item.key) + } else if (_actionType === 'insertOrUpdate') { // 娣诲姞鎴栦慨鏀规椂锛屽嚱鏁板彉閲忔坊鍔犺〃鍗曟暟鍊� + _form.push(item.key + '=\'' + item.value + '\'') + } } else if (item.type === 'number') { _form.push(item.key + '=' + item.value) } else { @@ -1076,6 +1124,18 @@ _updatesql = `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKeyName};` } + // 鎷兼帴鑷畾涔夎剼鏈� + if (verify.scripts && verify.scripts.length > 0) { + let _scripts = '' + verify.scripts.forEach(item => { + if (item.position !== 'front') return + + _scripts += ` + ${item.sql}` + }) + _sql += `${_scripts}` + } + // 娣诲姞銆佷慨鏀广�侀�昏緫鍒犻櫎銆佺墿鐞嗗垹闄� if (_actionType === 'insert') { _sql += _insertsql @@ -1095,7 +1155,7 @@ } }) } - _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '鍒犻櫎琛�:${btn.sql} 鏁版嵁: ${_msg}${primaryKey}='+@${primaryKeyName},@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKeyName};` + _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${btn.sql} 鏁版嵁: ${_msg}${primaryKey}='+@${primaryKeyName},200),@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKeyName};` } else if (_actionType === 'insertOrUpdate') { _sql += `select @tbid='' select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@ @@ -1115,6 +1175,8 @@ if (verify.scripts && verify.scripts.length > 0) { let _scripts = '' verify.scripts.forEach(item => { + if (item.position === 'front') return + _scripts += ` ${item.sql}` }) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index fd6343b..fa3842f 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -58,6 +58,13 @@ } async loginsubmit (param) { + if (options.systemType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃 + Modal.warning({ + title: '鏈缃崟鐐规湇鍔″櫒鍦板潃锛岃鑱旂郴绠$悊鍛橈紒' + }) + return + } + // 鐧诲綍鎻愪氦 let res = await Api.getusermsg(param.username, param.password) if (res.status) { -- Gitblit v1.8.0