From 9855c86aa6b84bb1c6c366cf68e0dee45402fe6f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 八月 2023 17:41:12 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/systemproc/proc/index.jsx | 4 src/templates/zshare/modalform/index.jsx | 2 src/utils/utils-datamanage.js | 21 src/tabviews/custom/components/code/sand-box/index.jsx | 14 src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx | 12 src/menu/components/tree/antd-tree/options.jsx | 12 src/menu/components/table/edit-table/columns/tableIn/index.jsx | 10 src/tabviews/custom/components/tree/antd-tree/index.jsx | 14 src/menu/components/card/balcony/options.jsx | 14 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 37 src/menu/datasource/index.jsx | 91 + src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx | 5 src/tabviews/custom/popview/index.jsx | 28 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 53 src/tabviews/basetable/index.jsx | 20 src/views/systemfunc/index.jsx | 43 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 25 src/templates/sharecomponent/tablecomponent/index.jsx | 164 -- src/views/billprint/index.jsx | 5 src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx | 12 src/menu/components/code/sandbox/options.jsx | 12 src/tabviews/zshare/actionList/normalbutton/index.jsx | 10 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 44 src/menu/datasource/verifycard/index.jsx | 14 src/tabviews/custom/components/card/data-card/index.jsx | 25 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 2 src/tabviews/custom/components/card/prop-card/index.jsx | 22 src/menu/components/card/double-data-card/options.jsx | 14 src/tabviews/custom/components/module/voucher/index.jsx | 8 src/menu/components/carousel/data-card/options.jsx | 14 src/menu/components/card/cardcellcomponent/index.jsx | 75 src/menu/components/card/data-card/options.jsx | 14 src/menu/components/share/actioncomponent/formconfig.jsx | 30 src/tabviews/custom/components/table/normal-table/index.jsx | 90 - src/tabviews/custom/components/chart/antv-pie/index.jsx | 14 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 12 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 13 src/tabviews/zshare/mutilform/index.jsx | 54 src/menu/components/chart/antv-G6/chartcompile/formconfig.jsx | 12 src/menu/components/share/actioncomponent/actionform/index.jsx | 32 src/tabviews/custom/components/carousel/prop-card/index.jsx | 12 src/tabviews/custom/index.jsx | 50 src/views/systemproc/index.jsx | 9 src/menu/components/table/normal-table/columns/index.jsx | 1 src/menu/components/calendar/options.jsx | 14 src/menu/components/table/edit-table/columns/index.jsx | 2 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 16 src/menu/components/timeline/normal-timeline/options.jsx | 14 src/templates/sharecomponent/settingcomponent/index.jsx | 62 src/views/design/index.jsx | 10 src/menu/datasource/verifycard/utils.jsx | 84 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 14 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 14 src/tabviews/custom/components/table/base-table/index.jsx | 5 package-lock.json | 6 src/menu/components/card/cardcellcomponent/dragaction/index.scss | 1 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 14 src/menu/components/table/normal-table/options.jsx | 14 src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx | 10 src/tabviews/custom/components/card/double-data-card/index.jsx | 17 src/tabviews/custom/components/chart/antv-G6/index.jsx | 14 src/menu/datasource/verifycard/customscript/index.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 45 src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx | 12 src/tabviews/custom/components/carousel/data-card/index.jsx | 12 src/templates/sharecomponent/fieldscomponent/index.jsx | 107 + src/tabviews/custom/components/table/edit-table/index.jsx | 5 src/templates/zshare/createfunc/utils.js | 454 +++++++ src/api/index.js | 19 src/tabviews/custom/components/calendar/index.jsx | 8 src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx | 34 src/tabviews/custom/components/chart/custom-chart/index.jsx | 14 src/utils/utils.js | 819 ++----------- src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 71 src/tabviews/custom/components/card/table-card/index.jsx | 12 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 2 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 12 src/templates/zshare/createfunc/index.jsx | 256 +-- src/tabviews/custom/components/share/tabtransfer/index.jsx | 2 src/templates/zshare/formconfig.jsx | 2 src/menu/datasource/verifycard/settingform/index.jsx | 23 src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx | 12 src/menu/components/share/actioncomponent/index.jsx | 84 src/tabviews/zshare/actionList/printbutton/index.jsx | 5 src/tabviews/custom/components/card/balcony/index.jsx | 12 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx | 25 src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx | 7 87 files changed, 1,865 insertions(+), 1,671 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2989e07..48029da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5490,9 +5490,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001464", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001464.tgz", - "integrity": "sha512-oww27MtUmusatpRpCGSOneQk2/l5czXANDSFvsc7VuOQ86s3ANhZetpwXNf1zY/zdfP63Xvjz325DAdAoES13g==" + "version": "1.0.30001523", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001523.tgz", + "integrity": "sha512-I5q5cisATTPZ1mc588Z//pj/Ox80ERYDfR71YnvY7raS/NOk8xXlZcB0sF7JdqaV//kOaa6aus7lRfpdnt1eBA==" }, "canvg": { "version": "3.0.10", diff --git a/src/api/index.js b/src/api/index.js index 9ce1f21..1be7537 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -7,6 +7,7 @@ import moment from 'moment' import Utils from '@/utils/utils.js' +import MKEmitter from '@/utils/events.js' import CacheUtils from './cacheutils' window.GLOB.IndexDB = null @@ -334,21 +335,21 @@ CacheUtils.delIndexDBCacheConfig(date, type) } - writeCacheConfig (menuid, data) { + writeCacheConfig (menuid, data, BID = '', id = '') { if (!menuid) return let date = moment().format('YYYY-MM-DD HH:mm:ss') let _data = data ? JSON.stringify(data) : '' let userid = sessionStorage.getItem('UserID') || '' - CacheUtils.writeCacheInIndexDB({menuid: md5(menuid + userid), CreateDate: date, LongParam: _data}) + CacheUtils.writeCacheInIndexDB({menuid: md5(menuid + userid + BID + id), BID: BID, id: id, CreateDate: date, LongParam: _data}) } - getLCacheConfig (menuid, minutes) { + getLCacheConfig (menuid, minutes, BID = '', id = '') { return new Promise((resolve, reject) => { let limit = minutes ? moment().subtract(minutes, 'minutes').format('YYYY-MM-DD HH:mm:ss') : '' let userid = sessionStorage.getItem('UserID') || '' - CacheUtils.getIndexDBCacheConfig(md5(menuid + userid)).then(res => { + CacheUtils.getIndexDBCacheConfig(md5(menuid + userid + BID + id)).then(res => { if (res && res.LongParam) { resolve({data: JSON.parse(res.LongParam), valid: !limit || res.CreateDate > limit}) } else { @@ -410,6 +411,11 @@ modifydate: msg.createDate } + if (window.GLOB.initVersion && sessionStorage.getItem('visitorUserID')) { + param.userid = sessionStorage.getItem('visitorUserID') + param.LoginUID = sessionStorage.getItem('visitorLoginUID') + } + param.TypeCharOne = '' param.typename = '' @@ -452,6 +458,7 @@ let clear = false let _appkey = window.GLOB.appkey.substr(-10) let reg = new RegExp(_appkey + '$', 'i') + let reHome = list.includes('home_page_id') list.forEach(mid => { if (reg.test(mid)) { @@ -463,6 +470,10 @@ } CacheUtils.delIndexDBConfig(list) this.delCacheConfig('all') + + if (reHome) { + MKEmitter.emit('reloadMenuView', 'home_page_id') + } } CacheUtils.updateIndexDBversion({version: res.app_version || '1.00', createDate: curTime}) diff --git a/src/menu/components/calendar/options.jsx b/src/menu/components/calendar/options.jsx index 56d1e4f..aff9975 100644 --- a/src/menu/components/calendar/options.jsx +++ b/src/menu/components/calendar/options.jsx @@ -110,7 +110,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index 5ae1c32..d9694b2 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -210,7 +210,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.scss b/src/menu/components/card/cardcellcomponent/dragaction/index.scss index 56d6af8..a492bac 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.scss +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.scss @@ -214,6 +214,7 @@ background-repeat: no-repeat; background-size: cover; position: unset!important; + vertical-align: top; } .sort-wrap { position: relative; diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 22adfb8..1100466 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -7,7 +7,6 @@ import asyncComponent from '@/utils/asyncComponent' import { getCardCellForm } from './formconfig' import { getActionForm, getBaseTableActionForm } from '@/menu/components/share/actioncomponent/formconfig' -import Utils, { FuncUtils } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' import ElementForm from './elementform' @@ -660,47 +659,47 @@ * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ */ creatFunc = () => { + const { cards } = this.props const menu = window.GLOB.customMenu - let _config = fromJS(this.props.cards).toJS() - this.actionFormRef.handleConfirm().then(res => { - let btn = res // 鎸夐挳淇℃伅 - let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql + return new Promise((resolve) => { + this.actionFormRef.handleConfirm().then(res => { + let btn = fromJS(res).toJS() + let _config = fromJS(cards).toJS() - if (btn.intertype !== 'inner') return + if (btn.OpenType === 'excelIn') { + btn.func = btn.innerFunc + btn.menuNo = menu.MenuNo + btn.MenuName = menu.MenuName + _config.name + btn.$type = 'excelIn' - if (btn.OpenType === 'pop') { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: btn.modal ? btn.modal.fields : [], - menuNo: menu.MenuNo + resolve(btn) + } else if (btn.OpenType === 'excelOut') { + _config.MenuName = menu.MenuName + '-' + _config.name + _config.menuNo = menu.MenuNo + _config.MenuID = menu.MenuID + _config.func = btn.innerFunc + _config.$type = 'table' + + resolve(_config) + } else { + btn.func = btn.innerFunc + btn.name = _config.setting.tableName || '' + btn.menuNo = menu.MenuNo + btn.MenuID = menu.MenuID + btn.MenuName = menu.MenuName + _config.name + btn.fields = [] + btn.columns = _config.columns + btn.primaryKey = _config.setting.primaryKey || 'ID' + btn.$type = 'btn' + + if (btn.OpenType === 'pop') { + btn.fields = btn.modal ? btn.modal.fields : [] + } + + resolve(btn) } - newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else if (btn.OpenType === 'excelIn') { - let _param = { - funcName: btn.innerFunc, - menuNo: menu.MenuNo - } - newLText = Utils.formatOptions(FuncUtils.getexcelInfunc(_param, btn, menu)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else if (btn.OpenType === 'excelOut') { - newLText = Utils.formatOptions(FuncUtils.getTableFunc(btn.innerFunc, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: '', - menuNo: menu.MenuNo - } - newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } - - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText) + }) }) } @@ -787,7 +786,7 @@ maskClosable={false} onCancel={this.editModalCancel} footer={[ - record && record.intertype === 'inner' && cards.subtype === 'dualdatacard' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null, + record && record.intertype === 'inner' && cards.subtype === 'dualdatacard' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null, <Button key="cancel" onClick={this.editModalCancel}>鍙栨秷</Button>, <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>纭畾</Button> ]} diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 7f8f0cb..b4ec305 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -549,7 +549,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx index 522c7ed..778fe4c 100644 --- a/src/menu/components/card/double-data-card/options.jsx +++ b/src/menu/components/card/double-data-card/options.jsx @@ -236,7 +236,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/carousel/data-card/options.jsx b/src/menu/components/carousel/data-card/options.jsx index 20aeec8..d5116a2 100644 --- a/src/menu/components/carousel/data-card/options.jsx +++ b/src/menu/components/carousel/data-card/options.jsx @@ -209,7 +209,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/chart/antv-G6/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-G6/chartcompile/formconfig.jsx index 19807bf..970e06e 100644 --- a/src/menu/components/chart/antv-G6/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-G6/chartcompile/formconfig.jsx @@ -90,6 +90,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 2620f88..e5a0f18 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -90,6 +90,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + key: 'cacheLocal', + label: '鏈湴缂撳瓨', + initVal: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', text: '缁ф壙鑿滃崟'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx index f1d676e..1840ac9 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx @@ -64,6 +64,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + key: 'cacheLocal', + label: '鏈湴缂撳瓨', + initVal: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', text: '缁ф壙鑿滃崟'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx index ce67f2a..f97f30f 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx @@ -122,6 +122,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + key: 'cacheLocal', + label: '鏈湴缂撳瓨', + initVal: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', text: '缁ф壙鑿滃崟'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx index 8b2f4f4..8957140 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx @@ -64,6 +64,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + key: 'cacheLocal', + label: '鏈湴缂撳瓨', + initVal: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', text: '缁ф壙鑿滃崟'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx index 2434abd..9089580 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx @@ -75,6 +75,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + key: 'cacheLocal', + label: '鏈湴缂撳瓨', + initVal: card.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', text: '缁ф壙鑿滃崟'}, + {value: 'false', text: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'select', key: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/code/sandbox/options.jsx b/src/menu/components/code/sandbox/options.jsx index f3a940b..db2f2ce 100644 --- a/src/menu/components/code/sandbox/options.jsx +++ b/src/menu/components/code/sandbox/options.jsx @@ -74,6 +74,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index e83ff55..c02a963 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -214,7 +214,7 @@ shows.push('exInterface', 'exProInterface') } } else if (intertype === 'inner') { - shows.push('innerFunc', 'output') + shows.push('innerFunc', 'output', 'recordUser') if (Ot === 'requiredOnce') { // 鍓嶇疆鍑芥暟 shows.push('preFunc') } @@ -295,7 +295,7 @@ shows.push('exInterface', 'exProInterface') } } else if (intertype === 'inner') { - shows.push('innerFunc') + shows.push('innerFunc', 'recordUser') reRequired.innerFunc = true } else { shows.push('sql', 'sqlType') @@ -346,7 +346,7 @@ shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { - shows.push('innerFunc') + shows.push('innerFunc', 'recordUser') reRequired.innerFunc = true } if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { @@ -381,7 +381,7 @@ shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { - shows.push('innerFunc') + shows.push('innerFunc', 'recordUser') reRequired.innerFunc = true } if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { @@ -459,7 +459,7 @@ shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { - shows.push('innerFunc') + shows.push('innerFunc', 'recordUser') reRequired.innerFunc = true } if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { @@ -980,11 +980,12 @@ values.$fixed = card.$fixed || false if (card.OpenType === 'excelOut' && values.OpenType === 'excelIn') { - if (values.verify && values.verify.columns && values.verify.columns.length > 0) { - values.verify.columns = values.verify.columns.map(col => { + values.verify = {columns: [], scripts: [], sheet: 'Sheet1', default: 'true', range: 1, uniques: []} + if (card.verify && card.verify.columns) { + values.verify.columns = card.verify.columns.map(col => { col.required = col.required || 'true' col.type = col.type || 'Nvarchar(50)' - col.import = col.import || 'true' + col.import = 'true' if (col.type === 'text' || col.type === 'image') { col.type = 'Nvarchar(50)' @@ -1007,15 +1008,12 @@ return col }) - values.verify.sheet = values.verify.sheet || 'Sheet1' - } - - if (values.verify) { - values.verify.scripts = [] + values.verify.sheet = card.verify.sheet || 'Sheet1' } } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') { - if (values.verify && values.verify.columns && values.verify.columns.length > 0) { - values.verify.columns = values.verify.columns.map(col => { + values.verify = {columns: [], scripts: [], dataType: 'default'} + if (card.verify && card.verify.columns) { + values.verify.columns = card.verify.columns.map(col => { col.type = col.type || 'text' col.output = col.output || 'true' col.required = col.required || 'false' @@ -1033,10 +1031,6 @@ return col }) - } - - if (values.verify) { - values.verify.scripts = [] } } diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 957a299..361a3a6 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -1061,6 +1061,21 @@ }, { type: 'radio', + key: 'recordUser', + label: '璁板綍鐢ㄦ埛', + initVal: card.recordUser || 'false', + tooltip: '褰撻�夋嫨鈥滄槸鈥濇椂锛屽唴閮ㄥ嚱鏁扮殑浼犲弬浼氬鍔� username 涓� fullname銆�', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { + type: 'radio', key: 'control', label: '鎸夐挳鎺у埗', initVal: card.control || (card.controlField ? 'disabled' : ''), @@ -2007,6 +2022,21 @@ }, { type: 'radio', + key: 'recordUser', + label: '璁板綍鐢ㄦ埛', + initVal: card.recordUser || 'false', + tooltip: '褰撻�夋嫨鈥滄槸鈥濇椂锛屽唴閮ㄥ嚱鏁扮殑浼犲弬浼氬鍔� username 涓� fullname銆�', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { + type: 'radio', key: 'control', label: '鎸夐挳鎺у埗', initVal: card.control || (card.controlField ? 'disabled' : ''), diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 516e8c2..3599e68 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -4,7 +4,7 @@ import { Modal, notification, Button } from 'antd' import moment from 'moment' -import Utils, { FuncUtils } from '@/utils/utils.js' +import Utils from '@/utils/utils.js' import { getActionForm, getBaseTableActionForm } from './formconfig' import asyncSpinComponent from '@/utils/asyncSpinComponent' import MKEmitter from '@/utils/events.js' @@ -526,55 +526,47 @@ * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ */ creatFunc = () => { + const { config } = this.props const menu = window.GLOB.customMenu - let _config = fromJS(this.props.config).toJS() - this.actionFormRef.handleConfirm().then(res => { - let btn = res // 鎸夐挳淇℃伅 - let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql + return new Promise((resolve) => { + this.actionFormRef.handleConfirm().then(res => { + let btn = fromJS(res).toJS() + let _config = fromJS(config).toJS() - // 鍒涘缓瀛樺偍杩囩▼锛屽繀椤诲~鍐欏唴閮ㄥ嚱鏁板悕 - if (btn.intertype !== 'inner') { - notification.warning({ - top: 92, - message: '浣跨敤鍐呴儴鍑芥暟鏃讹紝鎵嶅彲浠ュ垱寤哄瓨鍌ㄨ繃绋嬶紒', - duration: 5 - }) - return - } + if (btn.OpenType === 'excelIn') { + btn.func = btn.innerFunc + btn.menuNo = menu.MenuNo + btn.MenuName = menu.MenuName + _config.name + btn.$type = 'excelIn' - if (btn.OpenType === 'pop') { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: btn.modal ? btn.modal.fields : [], - menuNo: menu.MenuNo + resolve(btn) + } else if (btn.OpenType === 'excelOut') { + _config.MenuName = menu.MenuName + '-' + _config.name + _config.menuNo = menu.MenuNo + _config.MenuID = menu.MenuID + _config.func = btn.innerFunc + _config.$type = 'table' + + resolve(_config) + } else { + btn.func = btn.innerFunc + btn.name = _config.setting.tableName || '' + btn.menuNo = menu.MenuNo + btn.MenuID = menu.MenuID + btn.MenuName = menu.MenuName + _config.name + btn.fields = [] + btn.columns = _config.columns + btn.primaryKey = _config.setting.primaryKey || 'ID' + btn.$type = 'btn' + + if (btn.OpenType === 'pop') { + btn.fields = btn.modal ? btn.modal.fields : [] + } + + resolve(btn) } - newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else if (btn.OpenType === 'excelIn') { - let _param = { - funcName: btn.innerFunc, - menuNo: menu.MenuNo - } - newLText = Utils.formatOptions(FuncUtils.getexcelInfunc(_param, btn, menu)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else if (btn.OpenType === 'excelOut') { - newLText = Utils.formatOptions(FuncUtils.getTableFunc(btn.innerFunc, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } else { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: '', - menuNo: menu.MenuNo - } - newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc)) - } - - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText) + }) }) } @@ -710,7 +702,7 @@ maskClosable={false} onCancel={this.editModalCancel} footer={[ - record && record.intertype === 'inner' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null, + record && record.intertype === 'inner' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null, <Button key="cancel" onClick={this.editModalCancel}>鍙栨秷</Button>, <Button key="confirm" type="primary" onClick={this.handleSubmit}>纭畾</Button> ]} diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index c9f7736..9b72d05 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -271,7 +271,7 @@ key: 'dataSource', label: '鏁版嵁婧�', initVal: card.dataSource || '', - placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆�', + placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆傚叕鍏卞�粿BID@銆�', required: true, }, { diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index e30df79..4897eff 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -722,7 +722,7 @@ <Modal wrapClassName="mk-pop-modal" visible={visible} - width={'80vw'} + width={'90vw'} maskClosable={false} onOk={this.verifySubmit} onCancel={() => { this.setState({ visible: false }) }} diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx index f4accd7..9aab9bf 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx @@ -36,7 +36,8 @@ fields.push('jskey') - let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.field + ' ' + item.type).join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50)) + let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') + let _sql = `create table #${sheet} (${usefulfields.map(item => item.field + ' ' + item.type).join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50)) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` @@ -67,7 +68,7 @@ } handleConfirm = () => { - const { type } = this.props + const { type, btn } = this.props const { editItem, skip } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { @@ -144,8 +145,10 @@ return } + let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') let tail = ` - aaa: + drop table #${sheet} + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg ` let _initCustomScript = '' // 鍒濆鍖栬剼鏈� @@ -272,7 +275,7 @@ database = database ? (database[0] || '') : '' - _value = `Insert into ${database}${sheet} (${fields}createuserid,createuser,createstaff,bid)\nSelect ${fields}@userid@,@username,@fullname,@BID@ From @${sheet}` + _value = `Insert into ${database}${sheet} (${fields}createuserid,createuser,createstaff,bid)\nSelect ${fields}@userid@,@username,@fullname,@BID@ From #${sheet}` } else { _value = value } @@ -317,17 +320,17 @@ <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> <Row gutter={24}> {!type && btn.sheet ? <Col span={8}> - <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> - {btn.sheet} + <Form.Item label="琛ㄥ悕" style={{whiteSpace: 'nowrap', margin: 0}}> + {btn.sheet}锛堣〃鍙橀噺璇蜂娇鐢�#{btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')}锛� </Form.Item> </Col> : null} {!type ? <Col span={10}> - <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0, whiteSpace: 'nowrap'}}> + <Form.Item label="鎶ラ敊瀛楁" style={{margin: 0, whiteSpace: 'nowrap'}}> ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT锛�, retmsg </Form.Item> </Col> : null} {!type ? <Col span={24} className="sqlfield"> - <Form.Item label={'鍙敤瀛楁'}> + <Form.Item label="鍙敤瀛楁"> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, {usefulfields},data_type锛堟敞锛歫skey涓轰富閿�硷紝鏂板鏃跺墠绔敓鎴愶紱data_type涓烘搷浣滅被鍨嬶紝鏂板 - add銆佷慨鏀� - upt銆佸垹闄� - del锛� @@ -335,7 +338,7 @@ </Col> : null} {!type ? <Col span={8} style={{whiteSpace: 'nowrap'}}> <Form.Item style={{marginBottom: 0}} label={ - <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}> + <Tooltip placement="bottomLeft" title="鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 鎵ц浣嶇疆 </Tooltip> @@ -352,7 +355,7 @@ </Form.Item> </Col> : null} {!type ? <Col span={8}> - <Form.Item style={{marginBottom: 0}} label={'蹇嵎娣诲姞'}> + <Form.Item style={{marginBottom: 0}} label="蹇嵎娣诲姞"> <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} @@ -386,7 +389,7 @@ <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/> </Col> <Col span={24} className="sql"> - <Form.Item label={'sql'}> + <Form.Item label="sql"> {getFieldDecorator('sql', { initialValue: '', rules: [ diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index 032381a..ec97661 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -535,8 +535,16 @@ <Input value={verify.innerFunc} placeholder="" autoComplete="off" onChange={(e) => this.onOptionChange(e.target.value, 'innerFunc')}/> </Form.Item> </Col> : null} + {verify.intertype === 'inner' ? <Col span={8}> + <Form.Item required label="璁板綍鐢ㄦ埛"> + <Radio.Group value={verify.recordUser || 'false'} onChange={(e) => this.onOptionChange(e.target.value, 'recordUser')}> + <Radio value="false">鍚�</Radio> + <Radio value="true">鏄�</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} {verify.intertype === 'system' ? <Col span={8}> - <Form.Item required label={'榛樿sql'}> + <Form.Item required label="榛樿sql"> <Radio.Group value={verify.default} onChange={(e) => this.onOptionChange(e.target.value, 'default')}> <Radio value="true">鎵ц</Radio> <Radio value="false">涓嶆墽琛�</Radio> diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index e39e5b7..f915309 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -224,22 +224,6 @@ }] }, { - type: 'radio', - key: 'sum', - label: '鏄剧ず鍚堣', - initVal: card.sum || 'false', - tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愭椂鏈夋晥銆�', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }], - forbid: card.isSub || card.sum !== 'true' - }, - { type: 'number', key: 'decimal', min: 0, diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 1713c3c..00f61c5 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -563,7 +563,6 @@ } else { cell.type = 'number' cell.format = 'none' - cell.sum = 'false' cell.decimal = item.decimal || 0 cell.Width = 80 } diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx index 688c674..0a6329b 100644 --- a/src/menu/components/table/normal-table/options.jsx +++ b/src/menu/components/table/normal-table/options.jsx @@ -272,7 +272,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/timeline/normal-timeline/options.jsx b/src/menu/components/timeline/normal-timeline/options.jsx index f9537e1..e07e25d 100644 --- a/src/menu/components/timeline/normal-timeline/options.jsx +++ b/src/menu/components/timeline/normal-timeline/options.jsx @@ -168,7 +168,19 @@ initval: wrap.permission || (!appType ? 'true' : 'false'), required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, {value: 'false', label: '绂佺敤'}, ], forbid: sessionStorage.getItem('editMenuType') === 'popview' diff --git a/src/menu/components/tree/antd-tree/options.jsx b/src/menu/components/tree/antd-tree/options.jsx index 54e81d2..eb10a2a 100644 --- a/src/menu/components/tree/antd-tree/options.jsx +++ b/src/menu/components/tree/antd-tree/options.jsx @@ -134,6 +134,18 @@ forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' }, { + type: 'radio', + field: 'cacheLocal', + label: '鏈湴缂撳瓨', + initval: wrap.cacheLocal || 'true', + required: false, + options: [ + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: sessionStorage.getItem('editMenuType') === 'popview' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 75faaeb..4076942 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -1,10 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal } from 'antd' +import { Modal, Button } from 'antd' import { SettingOutlined } from '@ant-design/icons' import VerifyCard from './verifycard' +import CreateFunc from '@/templates/zshare/createfunc' import './index.scss' class DataSource extends Component { @@ -19,7 +20,8 @@ mainSearch: [], visible: false, loading: false, - setting: null + setting: null, + record: {} } UNSAFE_componentWillMount () { @@ -100,44 +102,42 @@ }) } } else { - let _search = null - let filterComponent = (box) => { + let filterComponent = (box, mainSearch) => { box.components.forEach(item => { - if (_search) return - - if (item.type === 'search') { - box.slist = [...box.slist, item.search] - } else if (item.uuid === config.uuid) { - _search = box.slist.pop() + if (item.type !== 'search') return + mainSearch = item.search + }) + let has = false + box.components.forEach(item => { + if (item.uuid === config.uuid) { + has = true } else if (item.type === 'group') { item.components.forEach(m => { if (m.uuid !== config.uuid) return - _search = box.slist.pop() - }) - } else if (item.type === 'tabs') { - item.subtabs.forEach(tab => { - tab.slist = [...box.slist] - filterComponent(tab) + has = true }) } }) - } - menu.slist = [] - filterComponent(menu) - if (_search) { - search = _search - } else { - menu.components.forEach(item => { - if (item.type !== 'search') return - search = item.search - }) + if (has) { + search = mainSearch || [] + } else { + box.components.forEach(item => { + if (item.type !== 'tabs') return + + item.subtabs.forEach(tab => { + filterComponent(tab, mainSearch) + }) + }) + } } + filterComponent(menu, null) } this.setState({ visible: true, - mainSearch: search + mainSearch: search, + record: {...config.setting} }) } @@ -227,9 +227,34 @@ }) } + creatFunc = () => { + const { config } = this.props + const { mainSearch } = this.state + const menu = window.GLOB.customMenu + + return new Promise((resolve) => { + this.verifyRef.submitDataSource().then(res => { + let _config = fromJS(config).toJS() + _config.MenuName = menu.MenuName + '-' + _config.name + _config.menuNo = menu.MenuNo + _config.MenuID = menu.MenuID + _config.setting = res.setting + _config.columns = res.columns + _config.func = res.setting.innerFunc + _config.$type = 'table' + + if (res.setting.useMSearch === 'true') { // 浣跨敤涓绘悳绱㈡潯浠� + _config.search = [..._config.search, ...mainSearch] + } + + resolve(_config) + }) + }) + } + render () { const { config } = this.props - const { visible, loading, mainSearch } = this.state + const { visible, loading, mainSearch, record } = this.state return ( <div className="model-datasource"> @@ -241,14 +266,18 @@ width={'75vw'} maskClosable={false} okText="鎻愪氦" - onOk={this.verifySubmit} - confirmLoading={loading} - onCancel={() => {this.setState({ visible: false }) }} + onCancel={() => {this.setState({ visible: false, loading: false }) }} + footer={[ + config.subtype !== 'dualdatacard' && record.interType === 'inner' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null, + <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>鍙栨秷</Button>, + <Button key="confirm" type="primary" loading={loading} onClick={this.verifySubmit}>纭畾</Button> + ]} destroyOnClose > <VerifyCard mainSearch={mainSearch} config={config} + updRecord={(record) => this.setState({record: record})} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index 7e7af73..63146d0 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -312,7 +312,7 @@ <Form.Item label="鍙敤瀛楁" className="field-able"> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@鎴朄orderBy@浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'url鍙橀噺锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>{urlFields ? ', ' : ''}<span style={{color: '#13c2c2'}}>{urlFields}</span></Tooltip> </Form.Item> </Col> diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 1f73ba2..9d84902 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -29,7 +29,8 @@ class VerifyCard extends Component { static propTpyes = { - config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 + config: PropTypes.object, + updRecord: PropTypes.func } state = { @@ -137,7 +138,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } @@ -911,7 +912,14 @@ this.setState({reload: false}) }) } + + this.props.updRecord({...res.data.setting}) }) + } + + updateStatus = (res) => { + this.setState({median: {...res}}) + this.props.updRecord({...res}) } copyColumns = () => { @@ -985,7 +993,7 @@ subColumns={subColumns} setting={setting} scripts={scripts} - updateStatus={(res) => this.setState({median: {...res}})} + updateStatus={this.updateStatus} wrappedComponentRef={(inst) => this.settingForm = inst} /> : null} </TabPane> diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index c47b78b..3c256d0 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -406,7 +406,12 @@ </Col> {/* 鏁扮粍鏁版嵁锛岄渶璁剧疆鎺掑簭瑙勫垯 */} {config.format === 'array' ? <Col span={8}> - <Form.Item label="榛樿鎺掑簭"> + <Form.Item label={ + <Tooltip placement="topLeft" title="濡傛灉鍦ㄨ嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡@pageSize@鎴朄orderBy@锛岃鍦ㄦ暟鎹簮涓崟鐙啓鎺掑簭璇彞銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 榛樿鎺掑簭 + </Tooltip> + }> {getFieldDecorator('order', { initialValue: setting.order || 'ID desc', rules: [ @@ -479,6 +484,22 @@ })(<InputNumber min={1} max={500} precision={0} />)} </Form.Item> </Col> : null} + {setting.interType === 'inner' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="褰撻�夋嫨鈥滄槸鈥濇椂锛屽唴閮ㄥ嚱鏁扮殑浼犲弬浼氬鍔� username 涓� fullname銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 璁板綍鐢ㄦ埛 + </Tooltip> + }> + {getFieldDecorator('recordUser', { + initialValue: setting.recordUser || 'false' + })( + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'recordUser')}}> + <Radio value="false">鍚�</Radio> + <Radio value="true">鏄�</Radio> + </Radio.Group>)} + </Form.Item> + </Col> : null} {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */} {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}> <Form.Item label={ diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index e1efa0b..71bb2b5 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -11,13 +11,20 @@ let sql = '' let error = '' let _dataresource = '' - let _customScript = '' let arr_field = columns.map(item => item.field).join(',') - - scripts.forEach(item => { - _customScript += ` - ${item.sql} - ` + let _customScript = '' + let _tailScript = '' + scripts && scripts.forEach(script => { + if (script.status === 'false') return + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) if (!arr_field) { @@ -26,6 +33,10 @@ if (setting.interType === 'system' && setting.execute !== 'false') { _dataresource = setting.dataresource || '' + } + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' } if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { @@ -38,16 +49,17 @@ _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') + _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') _customScript = _customScript.replace(/@select\$|\$select@/ig, '') - // _dataresource = _dataresource.replace(/@sum\$|\$sum@/ig, '') _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') - - _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') - _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') + _dataresource = _dataresource.replace(/\$sum@/ig, '/*') + _dataresource = _dataresource.replace(/@sum\$/ig, '*/') if (type === 'calendar') { _dataresource = _dataresource.replace(/@mk_year@/ig, '') @@ -64,6 +76,7 @@ if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } if (window.GLOB.urlFields) { @@ -71,12 +84,14 @@ let reg = new RegExp('@' + field + '@', 'ig') _dataresource = _dataresource.replace(reg, `'0'`) _customScript = _customScript.replace(reg, `'0'`) + _tailScript = _tailScript.replace(reg, `'0'`) }) } // 姝e垯鏇挎崲 let _regoptions = [] let _fields = [] + let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) searches.forEach(item => { if (!item.field) return @@ -142,6 +157,7 @@ _regoptions.forEach(item => { _dataresource = _dataresource.replace(item.reg, '0') _customScript = _customScript.replace(item.reg, '0') + _tailScript = _tailScript.replace(item.reg, '0') }) let _search = defSearch @@ -150,36 +166,14 @@ _search = '' } - let sumSql = '' - - if (_dataresource && /\/\*\$sum@/ig.test(_dataresource)) { - let _sql = _dataresource.replace(/\/\*\$sum@|@sum\$\*\//ig, '') - _sql = `/*system_query*/${_sql} ${_search}` - if (_customScript) { - sumSql = `/* sql sum楠岃瘉 */ - ${_customScript} - ${_sql} - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' - ` - } else { - sumSql = `/* sql sum楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' - ${_sql}` - } - } - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (setting.order) { + if (custompage) { + _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` + } else if (setting.order) { _dataresource = `/*system_query*/select${setting.laypage === 'true' ? ' top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage === 'true' ? 'where rows > 0' : ''} order by tmptable.rows` } else { - _dataresource = `/*system_query*/select${setting.laypage === 'true' ? ' top 10' : ''} ${arr_field} from ${_dataresource} ${_search}` + _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` } } @@ -187,9 +181,19 @@ sql = `/* sql 楠岃瘉 */ ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' + ` + } else if (_tailScript) { + sql = `/* sql 楠岃瘉 */ + declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sql = `/* sql 楠岃瘉 */ @@ -244,14 +248,8 @@ }) } - if (sumSql) { - sumSql = sumSql.replace(/\n\s{10}/ig, '\n') - - console.info(sumSql) - sumSql = sumSql.replace(/\n/g, ' ') - } sql = sql.replace(/\n/g, ' ') - return { error, sql, sumSql, errors: errors.join('锛�') } + return { error, sql, errors: errors.join('锛�') } } } \ No newline at end of file diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 3eff170..4f0028e 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -505,9 +505,15 @@ } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -527,22 +533,28 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) + + if (!component.setting.execute || component.setting.custompage) { + component.forbidLine = true } - + component.setting.delay = delay delay += 20 diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index 051b672..764dd9b 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -100,11 +100,11 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -128,7 +128,7 @@ this.setState({data: _data}) }) } else { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = [] @@ -243,7 +243,7 @@ if (result.status) { this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } let data = [] diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index e3cc44f..8378215 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -55,7 +55,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -171,12 +171,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -193,7 +193,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data[0] || {$$empty: true} @@ -226,7 +226,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data[0] || {$$empty: true} @@ -389,7 +389,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (!result.data || !result.data[0]) { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 0360c81..96e55f2 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -157,7 +157,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -252,14 +252,14 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state this.loaded && this.prevCheck() if (config.$cache) { if (config.$time && !config.setting.laypage) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('', 'init') @@ -282,12 +282,14 @@ return item }) - this.setState({data: _data}) + this.setState({data: _data}, () => { + this.prevCheck() + }) }) } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data.map((item, index) => { @@ -331,7 +333,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data.map((item, index) => { @@ -762,7 +764,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { @@ -869,6 +871,15 @@ async loadLinedata (id) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state + if (config.forbidLine) { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData() + }) + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 9dea605..53048cb 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -243,7 +243,7 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { let getData = (res) => { @@ -286,7 +286,7 @@ } if (config.$time && !config.setting.laypage) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid) { setTimeout(() => { this.loadData('', 'init') @@ -298,7 +298,7 @@ this.setState({data: getData(res.data)}) }) } else { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.setState({data: getData(res.data)}) @@ -608,7 +608,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { @@ -772,6 +772,15 @@ async loadLinedata (id) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state + if (config.forbidLine) { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData() + }) + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index f8dcefe..f114efa 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -55,7 +55,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -172,13 +172,13 @@ } initExec = () => { - const { config, selected, data } = this.state + const { config, selected, data, BID } = this.state if (config.wrap.datatype === 'dynamic') { if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -190,7 +190,11 @@ let _data = res.data[0] || {$$empty: true} _data.$$uuid = _data[config.setting.primaryKey] || '' - this.setState({data: _data}) + this.setState({data: _data}, () => { + if (selected !== 'false') { + this.checkTopLine() + } + }) }) } else { if (config.wrap.goback === 'true' && data.$$empty) { @@ -208,7 +212,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data[0] || {$$empty: true} @@ -276,12 +280,12 @@ } if (config.$cache && config.$time && config.wrap.autoExec) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (res.valid) return this.autoExec() - Api.writeCacheConfig(config.uuid, []) + Api.writeCacheConfig(config.uuid, [], BID) }) } else { this.autoExec() @@ -299,7 +303,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data[0] || {$$empty: true} @@ -533,7 +537,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (!result.data || !result.data[0]) { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 74582e6..f131f2c 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -74,7 +74,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -154,12 +154,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time && !config.setting.laypage) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -180,7 +180,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data.map((item, index) => { @@ -217,7 +217,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data.map((item, index) => { @@ -374,7 +374,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } let data = [] diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 8740cfd..dcdd491 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -56,7 +56,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -141,12 +141,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -170,7 +170,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data.map((item, index) => { @@ -212,7 +212,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data.map((item, index) => { @@ -354,7 +354,7 @@ if (result.status) { this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } let data = result.data.map((item, index) => { diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index dcbb04b..273c51a 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -55,7 +55,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -139,13 +139,13 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'dynamic') { if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -164,7 +164,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data[0] || {$$empty: true} @@ -204,7 +204,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data[0] || {$$empty: true} @@ -356,7 +356,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (!result.data || !result.data[0]) { diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index ad28222..9fdeb1e 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -837,7 +837,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -1024,12 +1024,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -1046,7 +1046,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -1072,14 +1072,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } if (!is(fromJS(this.data), fromJS(_data))) { @@ -1154,7 +1154,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 00c7926..7f2b2cf 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -328,7 +328,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -398,12 +398,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -420,7 +420,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -446,14 +446,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } this.data = _data @@ -581,7 +581,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 5274412..68babea 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -91,7 +91,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -168,12 +168,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -198,7 +198,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -232,14 +232,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } if (config.subtype !== 'ratioboard') { @@ -340,7 +340,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index a8bb8d5..3605b32 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -76,7 +76,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -140,12 +140,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -162,7 +162,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -188,14 +188,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } this.data = _data @@ -297,7 +297,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index dffbc8d..f4751c8 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -68,7 +68,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -136,12 +136,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -160,7 +160,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -188,14 +188,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } this.data = _data @@ -327,7 +327,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index d505a48..1fcd7c8 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -57,7 +57,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -125,12 +125,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -149,7 +149,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.data = res.data @@ -177,14 +177,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } if (!is(fromJS(this.data), fromJS(_data))) { @@ -320,7 +320,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.loaded = true diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx index b27d86c..d5b40b7 100644 --- a/src/tabviews/custom/components/code/sand-box/index.jsx +++ b/src/tabviews/custom/components/code/sand-box/index.jsx @@ -48,7 +48,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -106,13 +106,13 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.wrap.datatype !== 'static') { if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -130,7 +130,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.setState({data: res.data}, () => { @@ -160,14 +160,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } if (!is(fromJS(this.state.data), fromJS(_data))) { @@ -243,7 +243,7 @@ this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (!is(fromJS(this.state.data), fromJS(_data))) { diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 8142461..361e710 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -609,7 +609,7 @@ sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) }) } - return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` + return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` }) if (type === 'createVoucher') { @@ -625,7 +625,7 @@ let curr = item.foreign_currency_type === 'Y' let direct = item.debit ? 'debit' : 'credit' - subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) + subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) }) supMap.forEach(n => { @@ -902,7 +902,7 @@ sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit || 0},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) }) } - return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` + return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` }) voucherMap.forEach(item => { @@ -910,7 +910,7 @@ let curr = item.foreign_currency_type === 'Y' let direct = !item.credit ? 'debit' : 'credit' - subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) + subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) }) supMap.forEach(n => { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index acda596..a4f5005 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -128,7 +128,7 @@ let param = getStructuredParams(params, config, BID) if (config.$cache && config.$time) { - Api.getLCacheConfig(params[0].uuid, config.$time).then(res => { + Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { if (!res.valid) { this.getMainData(param, params, config.uuid) } diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 2fd32cd..4f1d0fd 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -264,6 +264,11 @@ async loadmainLinedata (id) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + if (config.forbidLine) { + this.reloadtable() + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 495a171..fd88ed1 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -303,6 +303,11 @@ async loadmainLinedata (id) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + if (config.forbidLine) { + this.reloadtable() + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index b7e5af0..10f41bf 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1674,12 +1674,12 @@ if (submit.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' - param.excel_in_type = 'true' - param.LText1 = Utils.formatOptions(result.insert) - param.LText2 = Utils.formatOptions(result.bottom) + delete param.excel_in + + param.exec_type = 'y' param.LText = Utils.formatOptions(result.sql) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) param.menuname = submit.logLabel @@ -1701,6 +1701,11 @@ } else if (submit.intertype === 'inner' && submit.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋� param.func = submit.innerFunc + if (submit.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } + Api.genericInterface(param).then((res) => { if (res.status) { this.execSuccess(res) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index e2aac93..63b75d4 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -87,7 +87,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -180,7 +180,6 @@ pageIndex: 1 }, () => { this.loadmaindata(true, 'true', '', 'timer') - this.getStatFieldsValue() }) }) } @@ -207,12 +206,12 @@ } initExec = () => { - const { config, setting } = this.state + const { config, setting, BID } = this.state if (config.$cache) { if (config.$time && !setting.laypage) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadmaindata(false, 'true', '', 'init') @@ -247,7 +246,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.setState({data: res.data.map((item, index) => { @@ -278,14 +277,12 @@ if (config.setting.onload === 'true') { setTimeout(() => { this.loadmaindata(false, 'true', '', 'init') - this.getStatFieldsValue() }, config.setting.delay || 0) } } } else if (config.setting.onload === 'true') { setTimeout(() => { this.loadmaindata() - this.getStatFieldsValue() }, config.setting.delay || 0) } } @@ -300,7 +297,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data.map((item, index) => { @@ -399,7 +396,7 @@ if (result.status) { this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { @@ -524,6 +521,11 @@ async loadmainLinedata (id) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + if (config.forbidLine) { + this.reloadtable() + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -639,72 +641,6 @@ } /** - * @description 鑾峰彇鍚堣瀛楁鍊� - */ - getStatFieldsValue = () => { - const { setting, config, search, BID, orderBy } = this.state - - if (setting.supModule && !BID && setting.supKey !== 'false') { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� - this.setState({ - statFValue: [] - }) - return - } - - if (config.statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return - - let searches = fromJS(search).toJS() - if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 - let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] - let keys = config.$s_keys || [] - mainSearch.forEach(item => { - if (keys.includes(item.key.toLowerCase())) return - - searches.push(item) - }) - } - - if (config.$s_req && searches.filter(item => item.required && item.value === '').length > 0) { - return - } - - let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, config.statFields, searches, _orderBy, BID) - - Api.genericInterface(param).then(res => { - if (res.status) { - let _data = res.data[0] - let values = [] - - if (_data) { - config.statFields.forEach(item => { - if (_data[item.field] || _data[item.field] === 0) { - let val = +_data[item.field] - if (isNaN(val)) { - val = 0 - } - val = val.toFixed(item.decimal) - values.push({label: item.label, value: val}) - } - }) - } - this.setState({ - statFValue: values - }) - } else { - this.setState({ - statFValue: [] - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }) - } - - /** * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ @@ -714,7 +650,6 @@ search: searches }, () => { this.loadmaindata(true, 'true') - this.getStatFieldsValue() }) } @@ -748,11 +683,9 @@ pageIndex: 1 }, () => { this.loadmaindata(true, 'true', id) - this.getStatFieldsValue() }) } else { this.loadmaindata(true, 'false', id) - this.getStatFieldsValue() } } @@ -805,7 +738,6 @@ BData: data }, () => { this.loadmaindata(true, 'true') - this.getStatFieldsValue() }) } } diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index e915def..9801617 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -59,7 +59,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -149,12 +149,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -174,7 +174,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.setState({data: res.data.map((item, index) => { @@ -210,7 +210,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data.map((item, index) => { @@ -353,7 +353,7 @@ if (result.status) { this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } let data = result.data.map((item, index) => { diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 6aad5fb..721d876 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -60,7 +60,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -129,12 +129,12 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { this.loadData('init') @@ -152,7 +152,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return this.setState({data: res.data}, () => { @@ -179,14 +179,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } this.loaded = true @@ -304,7 +304,7 @@ if (result.status) { this.loaded = true if (config.$cache && type === 'init') { - Api.writeCacheConfig(config.uuid, result.data || []) + Api.writeCacheConfig(config.uuid, result.data || [], BID) } this.setState({ diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 8cf3efe..80d4e93 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -328,11 +328,24 @@ filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => { return components.filter(item => { item.$pageId = pageId - item.$cache = cache - item.$time = time item.$searchId = searchId item.$syncId = syncId + if (cache) { + item.$cache = cache + item.$time = time + + if (item.wrap && item.wrap.cacheLocal === 'false') { + item.$cache = false + } else if (item.plot && item.plot.cacheLocal === 'false') { + item.$cache = false + } + + if (!item.$cache && item.setting && item.setting.sync === 'true') { + item.setting.sync = 'false' + } + } + if (item.style && item.style.boxShadow) { delete item.style.hShadow delete item.style.vShadow @@ -530,7 +543,6 @@ } if (item.type === 'table') { - let statFields = [] let getCols = (cols) => { return cols.filter(col => { if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { @@ -542,9 +554,6 @@ } if (col.type === 'number') { - if (col.sum === 'true' && !statFields.includes(col.field)) { - statFields.push(col) - } if (typeof(col.decimal) === 'number') { col.round = Math.pow(10, col.decimal) if (col.format === 'percent') { @@ -595,7 +604,6 @@ } item.cols = getCols(item.cols) - item.statFields = statFields if (item.subtype === 'editable') { item.submit.logLabel = item.$menuname + '-鎻愪氦' @@ -713,6 +721,11 @@ group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } + if (item.$cache && item.$time) { + group.$cache = item.$cache + group.$time = item.$time + } + group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { @@ -826,6 +839,10 @@ cell.errorType = 'error2' } } + } else if (cell.OpenType === 'pop' && item.$cache && item.$time && cell.modal) { + cell.modal.$cache = item.$cache + cell.modal.$time = item.$time + cell.modal.uuid = cell.uuid + 'pop' } if (cell.syncComponentId) { @@ -859,6 +876,11 @@ resetElement = (cell) => { cell.style = cell.style || {} + + if (cell.style.display === 'inline-block') { + cell.style.verticalAlign = 'top' + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' @@ -1007,8 +1029,10 @@ component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) + + if (!component.setting.execute || component.setting.custompage) { + component.forbidLine = true } if (component.setting.sync === 'true') { @@ -1143,6 +1167,8 @@ inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript) + return inter }) } @@ -1151,13 +1177,13 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ loadmaindata = (params) => { - const { config } = this.state - let param = getStructuredParams(params, config, this.state.BID || '') + const { config, BID } = this.state + let param = getStructuredParams(params, config, BID || '') this.setState({loading: true, loadingview: false}) if (config.$cache && config.$time) { - Api.getLCacheConfig(params[0].uuid, config.$time).then(res => { + Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { if (!res.valid) { this.getMainData(param, params, config.MenuID) } else { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 5fc621c..7463f80 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -344,7 +344,6 @@ } if (item.type === 'table') { - let statFields = [] let getCols = (cols) => { return cols.filter(col => { if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { @@ -356,9 +355,6 @@ } if (col.type === 'number') { - if (col.sum === 'true' && !statFields.includes(col.field)) { - statFields.push(col) - } if (typeof(col.decimal) === 'number') { col.round = Math.pow(10, col.decimal) if (col.format === 'percent') { @@ -404,7 +400,6 @@ } item.cols = getCols(item.cols) - item.statFields = statFields if (item.subtype === 'editable') { item.submit.logLabel = item.$menuname + '-鎻愪氦' @@ -649,6 +644,11 @@ resetElement = (cell) => { cell.style = cell.style || {} + + if (cell.style.display === 'inline-block') { + cell.style.verticalAlign = 'top' + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' @@ -748,9 +748,15 @@ } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -770,20 +776,26 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) + + if (!component.setting.execute || component.setting.custompage) { + component.forbidLine = true } if (component.setting.sync === 'true') { diff --git a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx index 7610cae..ee873ec 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx @@ -27,7 +27,8 @@ onImportExcel = file => { const { btn } = this.props - let columns = btn.verify.columns.map(option => option.Column) + let btnColumns = btn.verify.columns.filter(option => option.import !== 'init') + let columns = btnColumns.map(option => option.Column) let range = btn.verify.range || 0 // excel鏁版嵁澶勭悊 @@ -58,7 +59,7 @@ errors = 'empty' } else { let iserror = false - btn.verify.columns.forEach(op => { + btnColumns.forEach(op => { let _name = typeof(header[op.Column]) === 'string' ? header[op.Column].replace(/(^\s*|\s*$)/g, '') : header[op.Column] let _text = op.Text ? op.Text.replace(/(^\s*|\s*$)/g, '') : op.Text diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 0104e10..2a9e4a7 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -271,7 +271,7 @@ * @description Excel 瀵煎叆 */ getexceldata = (data, errors, sheetName, errDetail) => { - const { btn } = this.props + const { btn, BID } = this.props if (errors) { if (errors === 'notexit') { @@ -314,7 +314,7 @@ }) } - let result = getExcelInSql(btn, data, (this.props.BID || ''), this.state.primaryId) + let result = getExcelInSql(btn, data, (BID || ''), this.state.primaryId) if (result.errors) { notification.warning({ @@ -331,30 +331,29 @@ excel_in: result.lines } - if (this.props.BID) { - param.BID = this.props.BID + if (BID) { + param.BID = BID } if (btn.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' - param.excel_in_type = 'true' - param.LText1 = Utils.formatOptions(result.insert) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText2 = result.bottom + delete param.excel_in + + // param.excel_in_type = 'true' + param.exec_type = 'y' param.LText = result.sql + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') let unCheckParam = null - if (/\$check@|@check\$/ig.test(param.LText2) || /\$check@|@check\$/ig.test(param.LText)) { + if (/\$check@|@check\$/ig.test(param.LText)) { unCheckParam = fromJS(param).toJS() param.LText = param.LText.replace(/\$check@|@check\$/ig, '') - param.LText2 = param.LText2.replace(/\$check@|@check\$/ig, '') } - param.LText2 = Utils.formatOptions(param.LText2) param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mkHS && param.timestamp) { // 浜戠楠岃瘉 param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } @@ -368,11 +367,7 @@ if (unCheckParam) { unCheckParam.LText = unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') unCheckParam.LText = Utils.formatOptions(unCheckParam.LText) - unCheckParam.LText2 = unCheckParam.LText2.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') - unCheckParam.LText2 = Utils.formatOptions(unCheckParam.LText2) - - unCheckParam.secretkey = Utils.encrypt(unCheckParam.LText, unCheckParam.timestamp) - + unCheckParam.secretkey = Utils.encrypt('', unCheckParam.timestamp) unCheckParam.menuname = btn.logLabel if (window.GLOB.probation) { @@ -424,6 +419,11 @@ } } else if (btn.intertype === 'inner' && btn.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋� param.func = btn.innerFunc + + if (btn.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } Api.genericInterface(param).then((res) => { if (res.status) { @@ -515,7 +515,8 @@ } if (window.GLOB.mkHS && res.func === 's_sDataDictb_excelIn') { // s_sDataDictb_excelIn 浜戠楠岃瘉 - param.LText = Utils.formatOptions(result.sql) + let sql = `Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)` + param.LText = Utils.formatOptions(sql) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 30bcbf7..0cab6e9 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -168,7 +168,7 @@ Api.genericInterface(param).then(result => { if (result.status) { - this.exportExcel(result.data) + this.exportExcel(result.data, result.ErrCode, result.message) } else { this.execError(result) } @@ -180,9 +180,14 @@ let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) param.func = btn.innerFunc + if (btn.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } + Api.genericInterface(param).then(result => { if (result.status) { - this.exportExcel(result.data) + this.exportExcel(result.data, result.ErrCode, result.message) } else { this.execError(result) } @@ -235,7 +240,7 @@ Api.genericInterface(param).then(result => { if (result.status) { - this.exportExcel(result.data) + this.exportExcel(result.data, result.ErrCode, result.message) } else { this.execError(result) } @@ -296,7 +301,7 @@ Api.genericInterface(res).then(result => { if (result.status) { - this.exportExcel(result.data) + this.exportExcel(result.data, result.ErrCode, result.message) } else { this.execError(result) } @@ -390,7 +395,7 @@ this.getExcelOutDoubleData(viewParam, pageIndex, pageSize, data) } else { data = data.concat(result.data) - this.exportExcel(data) + this.exportExcel(data, result.ErrCode, result.message) } } else { this.execError(result) @@ -419,6 +424,11 @@ } else if (btn.intertype === 'inner') { // 浣跨敤鍐呴儴鍑芥暟 param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) param.func = btn.innerFunc + + if (btn.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) @@ -475,7 +485,7 @@ this.getExcelOutData(viewParam, pageIndex, pageSize, data) } else { data = data.concat(result.data) - this.exportExcel(data) + this.exportExcel(data, result.ErrCode, result.message) } } else { this.execError(result) @@ -489,7 +499,7 @@ /** * @description Excel 鐢熸垚 */ - exportExcel = (data) => { + exportExcel = (data, ErrCode, message) => { const { btn } = this.props let imgCol = false @@ -573,7 +583,7 @@ this.table2excel(column, table) - this.execSuccess({ErrCode: 'S', message: '瀵煎嚭鎴愬姛锛�'}) + this.execSuccess({ErrCode: ErrCode || 'S', message: message || '瀵煎嚭鎴愬姛锛�'}) } else { let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' let cols = [] @@ -710,7 +720,7 @@ XLSX.writeFile(wb, `${btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`) - this.execSuccess({ErrCode: 'S', message: '瀵煎嚭鎴愬姛锛�'}) + this.execSuccess({ErrCode: ErrCode || 'S', message: message || '瀵煎嚭鎴愬姛锛�'}) } } catch (e) { this.execError({ErrCode: 'N', message: 'Excel鐢熸垚澶辫触锛�'}) @@ -818,6 +828,10 @@ _setting.dataresource = '' } + if (/\s/.test(_setting.dataresource)) { + _setting.dataresource = '(' + _setting.dataresource + ') tb' + } + let _customScript = '' let _tailScript = '' btn.verify.scripts && btn.verify.scripts.forEach(script => { @@ -847,10 +861,7 @@ _setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� _setting.laypage = pagination - - if (_setting.laypage) { - _setting.custompage = /@pageSize@/i.test(_setting.dataresource + _setting.customScript) - } + _setting.custompage = /@pageSize@|@orderBy@/i.test(_setting.dataresource + _setting.customScript) _setting.queryType = btn.verify.queryType _setting.$name = btn.logLabel @@ -891,18 +902,18 @@ * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� */ - execSuccess = (res = {}) => { + execSuccess = (res) => { const { btn } = this.props - if (res.ErrCode === 'S' || !res.ErrCode) { // 鎵ц鎴愬姛 + if (res.ErrCode === 'S') { // 鎵ц鎴愬姛 notification.success({ top: 92, - message: res.message || '鎵ц鎴愬姛锛�', + message: res.message, duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 }) } else if (res.ErrCode === 'Y') { // 鎵ц鎴愬姛 Modal.success({ - title: res.message || '鎵ц鎴愬姛锛�' + title: res.message }) } else if (res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index f07a1dd..a5c366c 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -740,6 +740,11 @@ if (this.props.BID) { param.BID = this.props.BID } + + if (btn.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } let primaryId = '' @@ -778,6 +783,11 @@ param.BID = this.props.BID } + if (btn.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } + let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' if (btn.OpenType === 'pop') { // 琛ㄥ崟 diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index fdc3ac2..db4fd6a 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -903,6 +903,11 @@ if (btn.intertype === 'inner') { params = params.map(_param => { _param.func = btn.innerFunc + + if (btn.recordUser === 'true') { + _param.username = sessionStorage.getItem('User_Name') || '' + _param.fullname = sessionStorage.getItem('Full_Name') || '' + } return _param }) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 33e80b9..e9a26ed 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -610,8 +610,9 @@ } this.record = record + let ID = this.props.data ? this.props.data.$$uuid || '' : '' - this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => { + this.setState({ formlist, ID }, () => { if (unload) return if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { @@ -629,13 +630,29 @@ } if (deForms.length > 0) { - if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { - this.improveSimpleActionForm(deForms) + if (action.$cache && action.setting.cache !== 'false') { + Api.getLCacheConfig(action.uuid, action.$time, this.props.BID, ID).then(res => { + if (!res.valid) { + this.getFormData(deForms) + } else { + this.resetFormList(res.data, true) + } + }) } else { - this.improveActionForm(deForms) + this.getFormData(deForms) } } }) + } + + getFormData = (deForms) => { + if (deForms.length === 1) { + this.improveSimpleActionForm(deForms) + } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { + this.improveSimpleActionForm(deForms) + } else { + this.improveActionForm(deForms) + } } /** @@ -647,8 +664,8 @@ let deffers = [] let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� let localItems = [] // 鏈湴鏁版嵁 - let cache = action.setting.cache !== 'false' - let debug = window.GLOB.debugger === true + let cache = action.setting.cache !== 'false' && !action.$cache + let skip = false let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` let _sso = _sql @@ -661,7 +678,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -675,7 +692,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -712,6 +729,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -753,6 +771,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -768,7 +787,7 @@ delete result.message delete result.status - this.resetFormList(result) + this.resetFormList(result, skip) }) } @@ -776,8 +795,11 @@ * @description 娴嬭瘯绯荤粺鑾峰彇涓嬫媺琛ㄥ崟閫夐」淇℃伅 */ improveSimpleActionForm = (deForms) => { - let cache = this.props.action.setting.cache !== 'false' + const { action } = this.props + + let cache = this.props.action.setting.cache !== 'false' && !action.$cache let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` + let skip = false let deffers = deForms.map((form, index) => { let param = { @@ -812,6 +834,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -822,6 +845,7 @@ Promise.all(deffers).then(response => { let result = {} + response.forEach(res => { result = {...result, ...res} }) @@ -831,11 +855,17 @@ delete result.message delete result.status - this.resetFormList(result) + this.resetFormList(result, skip) }) } - resetFormList = (result) => { + resetFormList = (result, skip) => { + const { BID, action } = this.props + + if (action.$cache && action.setting.cache !== 'false' && !skip) { + Api.writeCacheConfig(action.uuid, fromJS(result).toJS(), BID, this.state.ID) + } + let reFieldsVal = null let _formlist = fromJS(this.state.formlist).toJS().map(item => { if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx index 7724f6c..e3eda1e 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx @@ -46,16 +46,9 @@ } this.props.columnChange(values) - this.setState({ - locked: false, - type: 'Nvarchar(50)' - }) this.props.form.setFieldsValue({ Column: '', - Text: '', - required: 'true', - import: 'true', - type: 'Nvarchar(50)' + Text: '' }) } }) @@ -148,6 +141,7 @@ <Radio.Group> <Radio value="true">鏄�</Radio> <Radio value="false">鍚�</Radio> + <Radio value="init">鍒濆鍖�</Radio> </Radio.Group> )} </Form.Item> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index f5726e6..07c8db4 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -45,12 +45,13 @@ fields.push('jskey') let _dec = columns.map(item => item.Column + ' ' + item.type).join(',') + let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') if (_dec) { _dec += ',' } - let _sql = `Declare @${btn.sheet.replace(/@db@/ig, '')} table (${_dec}jskey nvarchar(50) ) + let _sql = `create table #${sheet} (${_dec}jskey nvarchar(50),BID nvarchar(50) ) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` @@ -81,7 +82,7 @@ } handleConfirm = () => { - const { type } = this.props + const { type, btn } = this.props const { editItem, skip } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� @@ -161,8 +162,10 @@ return } + let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') let tail = ` - aaa: + drop table #${sheet} + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg ` let _initCustomScript = '' // 鍒濆鍖栬剼鏈� @@ -290,7 +293,7 @@ database = database ? (database[0] || '') : '' - _value = `Insert into ${database}${sheet} (${fields}createuserid,createuser,createstaff,bid)\nSelect ${fields}@userid@,@username,@fullname,@BID@ From @${sheet}` + _value = `Insert into ${database}${sheet} (${fields}createuserid,createuser,createstaff,bid)\nSelect ${fields}@userid@,@username,@fullname,@BID@ From #${sheet}` } else { _value = value } @@ -335,17 +338,17 @@ <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> <Row gutter={24}> {!type && btn.sheet ? <Col span={8}> - <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> - {btn.sheet} + <Form.Item label="琛ㄥ悕" style={{whiteSpace: 'nowrap', margin: 0}}> + {btn.sheet}锛堣〃鍙橀噺璇蜂娇鐢�#{btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')}锛� </Form.Item> </Col> : null} {!type ? <Col span={10}> - <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0, whiteSpace: 'nowrap'}}> + <Form.Item label="鎶ラ敊瀛楁" style={{margin: 0, whiteSpace: 'nowrap'}}> ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT銆丆NT銆�-2NT锛�, retmsg </Form.Item> </Col> : null} {!type ? <Col span={24} className="sqlfield"> - <Form.Item label={'鍙敤瀛楁'}> + <Form.Item label="鍙敤瀛楁"> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, {usefulfields} @@ -353,7 +356,7 @@ </Col> : null} {!type ? <Col span={8} style={{whiteSpace: 'nowrap'}}> <Form.Item style={{marginBottom: 0}} label={ - <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}> + <Tooltip placement="bottomLeft" title="鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 鎵ц浣嶇疆 </Tooltip> @@ -370,7 +373,7 @@ </Form.Item> </Col> : null} {!type ? <Col span={8}> - <Form.Item style={{marginBottom: 0}} label={'蹇嵎娣诲姞'}> + <Form.Item style={{marginBottom: 0}} label="蹇嵎娣诲姞"> <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} @@ -404,7 +407,7 @@ <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/> </Col> <Col span={24} className="sql"> - <Form.Item label={'sql'}> + <Form.Item label="sql"> {getFieldDecorator('sql', { initialValue: '', rules: [ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 2ec586a..38fdf04 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -38,6 +38,7 @@ width: '14%', inputType: 'input', unique: true, + strict: true, editable: true }, { @@ -72,20 +73,32 @@ ] }, { + title: '瀵煎叆', + dataIndex: 'import', + width: '10%', + editable: true, + inputType: 'radio', + render: (text, record) => { + if (record.import === 'init') { + return '鍒濆鍖�' + } else if (record.import === 'false') { + return '鍚�' + } + return '鏄�' + }, + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' }, + { value: 'init', text: '鍒濆鍖�' } + ] + }, + { title: '蹇呭~', dataIndex: 'required', width: '10%', editable: true, inputType: 'switch', render: (text, record) => record.required === 'true' ? '鏄�' : '鍚�' - }, - { - title: '瀵煎叆', - dataIndex: 'import', - width: '10%', - editable: true, - inputType: 'switch', - render: (text, record) => record.import !== 'false' ? '鏄�' : '鍚�' }, { title: '鏈�灏忓��', @@ -253,8 +266,6 @@ const { card } = this.props let _verify = fromJS(card.verify || {}).toJS() let _columns = _verify.columns || [] - - delete _verify.dataresource // 鏃ф暟鎹吋瀹� _columns = _columns.map(col => { @@ -638,7 +649,7 @@ if (!err) { let _verify = {...verify, ...values} - let cols = _verify.columns.map(col => col.Column) + let cols = _verify.columns.map(col => col.Column.toLowerCase()) cols = Array.from(new Set(cols)) if (_verify.columns.length === 0) { @@ -666,6 +677,15 @@ return } } + + _verify.columns.sort((a, b) => { + if (a.import === 'init' && b.import !== 'init') { + return 1 + } else if (a.import !== 'init' && b.import === 'init') { + return -1 + } + return 0 + }) let _loading = false if (this.scriptsForm && this.scriptsForm.state.editItem) { @@ -838,7 +858,7 @@ <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� </Button> - <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細鏁板�肩被鍨嬶紙int 鎴� decimal锛夛紝鍐呭涓哄繀濉紱鏈�澶у�煎拰鏈�灏忓�煎湪绫诲瀷涓烘暟鍊兼椂鏈夋晥銆�</Col> + <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細鏁板�肩被鍨嬶紙int 鎴� decimal锛夛紝鍐呭涓哄繀濉紱鏈�澶у�煎拰鏈�灏忓�煎湪绫诲瀷涓烘暟鍊兼椂鏈夋晥銆傚鍏�-鍒濆鍖栵細鐢ㄤ簬excel涓笉瀛樺湪锛屽鍏ユ椂闇�瑕佸垵濮嬪寲鐨勫瓧娈�</Col> <EditTable actions={['edit', 'move', 'copy', 'del', 'extra:required:鏄惁蹇呭~']} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> </TabPane> {card.intertype === 'system' ? <TabPane tab={ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx index 10dcfb6..6d1b718 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx @@ -229,7 +229,12 @@ </Form.Item> </Col> : null} {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> - <Form.Item label="鎺掑簭鏂瑰紡"> + <Form.Item label={ + <Tooltip placement="topLeft" title="濡傛灉鍦ㄨ嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡@pageSize@鎴朄orderBy@锛岃鍦ㄦ暟鎹簮涓崟鐙啓鎺掑簭璇彞銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鎺掑簭鏂瑰紡 + </Tooltip> + }> {getFieldDecorator('order', { initialValue: setting.order || '', rules: [ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index a99543e..ebce7e5 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -164,7 +164,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } @@ -300,54 +300,47 @@ searches = search } else { - let search = [] - + searches = fromJS(config.search || []).toJS() + if (config.setting && config.setting.useMSearch === 'true' && window.GLOB.customMenu) { let menu = fromJS(window.GLOB.customMenu).toJS() - let _search = null - let filterComponent = (box) => { + let filterComponent = (box, mainSearch) => { box.components.forEach(item => { - if (_search) return - - if (item.type === 'search') { - box.slist = [...box.slist, item.search] - } else if (item.uuid === config.uuid) { - _search = box.slist.pop() + if (item.type !== 'search') return + mainSearch = item.search + }) + let has = false + box.components.forEach(item => { + if (item.uuid === config.uuid) { + has = true } else if (item.type === 'group') { item.components.forEach(m => { if (m.uuid !== config.uuid) return - _search = box.slist.pop() - }) - } else if (item.type === 'tabs') { - item.subtabs.forEach(tab => { - tab.slist = [...box.slist] - filterComponent(tab) + has = true }) } }) - } - menu.slist = [] - filterComponent(menu) - - if (_search) { - search = _search - } else { - menu.components.forEach(item => { - if (item.type !== 'search') return - search = item.search - }) - } - } - - searches = fromJS(config.search || []).toJS() - - if (search.length > 0) { - let keys = searches.map(item => (item.field ? item.field.toLowerCase() : '')) - search.forEach(item => { - if (item.field && !keys.includes(item.field.toLowerCase())) { - searches.push(item) + + if (has) { + if (mainSearch) { + let keys = searches.map(item => (item.field ? item.field.toLowerCase() : '')) + mainSearch.forEach(item => { + if (item.field && !keys.includes(item.field.toLowerCase())) { + searches.push(item) + } + }) + } + } else { + box.components.forEach(item => { + if (item.type !== 'tabs') return + + item.subtabs.forEach(tab => { + filterComponent(tab, mainSearch) + }) + }) } - }) + } + filterComponent(menu, null) } } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 6b955e5..0d8cbf7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -28,33 +28,45 @@ } let _customScript = '' + let _tailScript = '' scripts && scripts.forEach(script => { if (script.status === 'false') return - _customScript += ` - ${script.sql} - ` + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) - if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' - ${_customScript} - ` - } + let declare = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg =''` if (verify.defaultSql === 'false') { _dataresource = '' } + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } + + let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) // 姝e垯鏇挎崲 let _regoptions = regoptions.map(item => { @@ -78,36 +90,43 @@ _regoptions.forEach(item => { _dataresource = _dataresource.replace(item.reg, item.value) _customScript = _customScript.replace(item.reg, item.value) + _tailScript = _tailScript.replace(item.reg, item.value) }) if (verify.queryType === 'statistics' && _dataresource) { _search = '' } - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 + // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (verify.order) { - _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${verify.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` - } else { + if (custompage || !verify.order) { _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` + } else { + _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${verify.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` } } if (_customScript) { sql = `/* sql 楠岃瘉 */ + ${declare} ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ ` + } else if (_tailScript) { + sql = `${declare} + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' + ${declare} ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 3e57618..5a622de 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -67,7 +67,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx index 3d26d40..969fa63 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx @@ -5,11 +5,18 @@ let _dataresource = setting.dataresource || '' let _customScript = '' + let _tailScript = '' scripts && scripts.forEach(script => { if (script.status === 'false') return - _customScript += ` - ${script.sql} - ` + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) if (_customScript) { @@ -22,16 +29,22 @@ if (setting.defaultSql === 'false') { _dataresource = '' } + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } let arr_field = columns.map(col => col.field) @@ -43,10 +56,6 @@ // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - if (setting.order) { _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows` } else { @@ -58,10 +67,21 @@ sql = `/* sql 楠岃瘉 */ ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ ` + } else if (_tailScript) { + sql = `/* sql 楠岃瘉 */ + declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' + ${declareSql} + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` } else { sql = `/* sql 楠岃瘉 */ declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index c493ccd..5cc4bf4 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -3,6 +3,7 @@ import { is, fromJS } from 'immutable' import { Button, Modal, Empty, notification } from 'antd' +import Api from '@/api' import Utils from '@/utils/utils.js' import EditCard from './editcard' @@ -11,8 +12,8 @@ class FieldsComponent extends Component { static propTpyes = { - type: PropTypes.string, // 鎼滅储鏉′欢娣诲姞銆佹樉绀哄垪娣诲姞 - config: PropTypes.object, // 瀹瑰櫒Id + type: PropTypes.string, + config: PropTypes.object, updatefield: PropTypes.func } @@ -23,10 +24,8 @@ selectCards: [] } - queryField = () => { - const { type, config } = this.props - // 鍒ゆ柇鏄惁宸查�夋嫨琛ㄥ悕 - if (!window.GLOB.tableFields || window.GLOB.tableFields.length === 0) { + checkField = () => { + if (!window.GLOB.publicTables || window.GLOB.publicTables.length === 0) { notification.warning({ top: 92, message: '璇烽�夋嫨琛ㄥ悕锛�', @@ -35,9 +34,101 @@ return } + window.GLOB.tableFields = window.GLOB.tableFields || [] + + let index = 0 + + let deffers = window.GLOB.publicTables.map(item => { + let tb = window.GLOB.tableFields.filter(tab => tab.tableName === item.TbName)[0] + + if (tb) { + return Promise.resolve(fromJS(tb).toJS()) + } + + return new Promise(resolve => { + setTimeout(() => { + Api.getCloudConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => { + let tabmsg = { + status: res.status, + message: res.message, + tableName: item.TbName, + columns: [] + } + + if (res.FDName && res.FDName.length > 0) { + tabmsg.columns = res.FDName.map(item => { + let _type = item.FieldType.toLowerCase() + let _decimal = 0 + let _length = 50 + if (/^nvarchar/.test(_type)) { + try { // 瀛樺湪max + _length = +_type.match(/\d+/)[0] || 50 + } catch (e) { + _length = 2048 + } + _type = 'text' + } else if (/^int/.test(_type)) { + _type = 'number' + } else if (/^decimal/.test(_type)) { + _decimal = _type.split(',')[1] + _decimal = parseInt(_decimal) + _type = 'number' + } else if (/^datetime/.test(_type)) { + _type = 'datetime' + } else if (/^date/.test(_type)) { + _type = 'date' + } else { + _type = 'text' + } + + return { + field: item.FieldName || '', + label: item.FieldDec, + type: _type, + datatype: _type, + decimal: _decimal, + length: _length, + $datatype: item.FieldType.toLowerCase() + } + }) + } + + resolve(tabmsg) + }) + }, index * 50) + + index++ + }) + }) + Promise.all(deffers).then(response => { + let error = false + let _columns = response + + response.forEach(item => { + if (!item.status) { + error = item.message || '瀛楁鏌ヨ澶辫触锛�' + } + }) + + if (error) { + notification.warning({ + top: 92, + message: error, + duration: 5 + }) + } else { + window.GLOB.tableFields = _columns + this.queryField(_columns) + } + }) + } + + queryField = (tableFields) => { + const { type, config } = this.props + // 琛ㄥ瓧娈甸泦杞负map鏁版嵁 let columns = new Map() - window.GLOB.tableFields.forEach(table => { + tableFields.forEach(table => { table.columns.forEach(column => { columns.set(column.field.toLowerCase(), column) }) @@ -281,7 +372,7 @@ return ( <div className="quickly-add"> - <Button type="primary" block onClick={this.queryField}>{label}</Button> + <Button type="primary" block onClick={this.checkField}>{label}</Button> {/* 鏍规嵁瀛楁鍚嶆坊鍔犳樉绀哄垪鍙婃悳绱㈡潯浠� */} <Modal wrapClassName="model-table-fieldmanage-modal" diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx index 24a1ce3..6d9bb70 100644 --- a/src/templates/sharecomponent/settingcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/index.jsx @@ -4,10 +4,7 @@ import { Modal, Button } from 'antd' import { SettingOutlined } from '@ant-design/icons' -import Utils, { FuncUtils } from '@/utils/utils.js' import SettingForm from './settingform' -import CreateFunc from '@/templates/zshare/createfunc' -import CreateInterface from '@/templates/zshare/createinterface' // import './index.scss' @@ -73,43 +70,26 @@ }) } - /** - * @description 鍒涘缓琛ㄦ牸瀛樺偍杩囩▼ - */ - tableCreatFunc = () => { - const { config } = this.props - const { menu } = this.state + // /** + // * @description 鍒涘缓琛ㄦ牸鎺ュ彛锛堣鍑猴級 + // */ + // tableCreatInterface = () => { + // const { config } = this.props + // const { menu } = this.state - this.settingRef.handleConfirm('loading').then(setting => { - let res = this.resetSetting(setting, config.setting) - let _config = {...config, setting: res} - let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting.innerFunc, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql + // this.settingRef.handleConfirm('loading').then(setting => { + // let res = this.resetSetting(setting, config.setting) + // let _config = {...config, setting: res} + // let _menu = { + // type: config.Template === 'CommonTable' ? 'main' : 'subtable', + // MenuID: menu.MenuID, + // menuName: menu.MenuName, + // menuNo: menu.MenuNo + // } - this.refs.funcCreatComponent.exec(setting.innerFunc, newLText, DelText) - }) - } - - /** - * @description 鍒涘缓琛ㄦ牸鎺ュ彛锛堣鍑猴級 - */ - tableCreatInterface = () => { - const { config } = this.props - const { menu } = this.state - - this.settingRef.handleConfirm('loading').then(setting => { - let res = this.resetSetting(setting, config.setting) - let _config = {...config, setting: res} - let _menu = { - type: config.Template === 'CommonTable' ? 'main' : 'subtable', - MenuID: menu.MenuID, - menuName: menu.MenuName, - menuNo: menu.MenuNo - } - - this.refs.tableCreatInterface.triggerOutInterface(_menu, _config) - }) - } + // this.refs.tableCreatInterface.triggerOutInterface(_menu, _config) + // }) + // } resetSetting = (s, ori) => { let setting = fromJS(s).toJS() @@ -179,7 +159,7 @@ render() { const { config } = this.props - const { visible, search, menu, record } = this.state + const { visible, search, menu } = this.state return ( <> @@ -192,8 +172,6 @@ maskClosable={false} onCancel={() => { this.setState({ visible: false, loading: false })}} footer={[ - record && record.interType === 'system' ? <CreateInterface key="interface" loading={this.state.interloading} ref="tableCreatInterface" trigger={this.tableCreatInterface}/> : null, - record && record.interType === 'inner' ? <CreateFunc key="create" ref="funcCreatComponent" trigger={this.tableCreatFunc}/> : null, <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>鍙栨秷</Button>, <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>纭畾</Button> ]} @@ -203,7 +181,7 @@ menu={menu} config={config} search={search} - updRecord={(record) => this.setState({record: fromJS(record).toJS()})} + updRecord={() => {}} wrappedComponentRef={(inst) => this.settingRef = inst} /> </Modal> diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index 5f6c49a..69e7a3b 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -23,7 +23,6 @@ state = { tables: [], // 绯荤粺琛� - tableFields: [], // 宸查�夎〃瀛楁闆� selectedTables: [], // 宸查�夎〃 } @@ -39,8 +38,6 @@ this.setState({ selectedTables: tables - }, () => { - this.gettableFields() }) } @@ -96,163 +93,28 @@ }) } - gettableFields = () => { - let deffers = this.state.selectedTables.map((item, i) => { - return new Promise(resolve => { - let param = {func: 'sPC_Get_FieldName', TBName: item.TbName} - if (window.GLOB.cloudServiceApi) { // 涓斿瓨鍦ㄤ簯绔湴鍧� - param.rduri = window.GLOB.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } - - setTimeout(() => { - Api.getSystemCacheConfig(param).then(res => { - res.TBName = item.TbName - resolve(res) - }) - }, (i + 1) * 100) - }) - }) - Promise.all(deffers).then(response => { - let _columns = [] - response.forEach(res => { - if (res.status) { - let tabmsg = { - tableName: res.TBName, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - let _length = 50 - if (/^nvarchar/.test(_type)) { - try { // 瀛樺湪max - _length = +_type.match(/\d+/)[0] || 50 - } catch (e) { - _length = 2048 - } - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } - - return { - field: item.FieldName || '', - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal, - length: _length, - $datatype: item.FieldType.toLowerCase() - } - }) - } - _columns.push(tabmsg) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - - this.setState({ - tableFields: _columns - }) - window.GLOB.tableFields = _columns - }) - } - /** * @description 娣诲姞琛ㄥ悕 */ onTableChange = (value) => { const { config } = this.props - const { tables, tableFields, selectedTables } = this.state + const { tables, selectedTables } = this.state let _table = tables.filter(item => item.TbName === value)[0] - let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] - if (!isSelected) { - let _tables = [...selectedTables, _table] - window.GLOB.publicTables = _tables + if (selectedTables.findIndex(cell => cell.TbName === value) > -1) return - this.setState({ - selectedTables: _tables - }) + let _tables = [...selectedTables, _table] - let _config = {...config, tables: _tables} - - Api.getCloudConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { - if (res.status) { - let tabmsg = { - tableName: _table.TbName, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - let _length = 50 + window.GLOB.publicTables = _tables - if (/^nvarchar/.test(_type)) { - try { // 瀛樺湪max - _length = +_type.match(/\d+/)[0] || 50 - } catch (e) { - _length = 2048 - } - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } + this.setState({ + selectedTables: _tables + }) - return { - field: item.FieldName, - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal, - length: _length, - $datatype: item.FieldType.toLowerCase() - } - }) - } - - let _columns = [...tableFields, tabmsg] - - this.setState({ - tableFields: _columns - }) - - window.GLOB.tableFields = _columns - - this.props.updatetable(_config) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } + let _config = {...config, tables: _tables} + + this.props.updatetable(_config) } /** @@ -260,19 +122,15 @@ */ deleteTable = (table) => { const { config } = this.props - const { selectedTables, tableFields } = this.state + const { selectedTables } = this.state let _tables = selectedTables.filter(item => item.TbName !== table.TbName) - let _fields = tableFields.filter(item => item.tableName !== table.TbName) window.GLOB.publicTables = _tables this.setState({ selectedTables: _tables, - tableFields: _fields }) - - window.GLOB.tableFields = _fields this.props.updatetable({...config, tables: _tables}) } diff --git a/src/templates/zshare/createfunc/index.jsx b/src/templates/zshare/createfunc/index.jsx index 6fca05b..d464a7f 100644 --- a/src/templates/zshare/createfunc/index.jsx +++ b/src/templates/zshare/createfunc/index.jsx @@ -4,203 +4,125 @@ import moment from 'moment' import Utils from '@/utils/utils.js' +import FuncUtils from './utils.js' import Api from '@/api' // import './index.scss' class CreateFunc extends Component { static propTypes = { - trigger: PropTypes.func + getMsg: PropTypes.func } state = { - loading: false, + loading: false } - exec = (innerFunc, newLText, DelText) => { + trigger = () => { + this.props.getMsg().then(config => { + let newLText = '' + let func = '' + + if (config.$type === 'table') { + func = config.func + newLText = FuncUtils.getTableFunc(config) + } else if (config.$type === 'excelIn') { + func = config.func + newLText = FuncUtils.getexcelInfunc(config) + } else if (config.$type === 'btn') { + func = config.func + newLText = FuncUtils.getfunc(config) + } + + if (!newLText || !func) return + + this.createExec(func, newLText) + }) + } + + createExec = (func, newLText) => { + let dropfunc = `IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('${func}') AND type in (N'P', N'PC')) mdrpk PROCEDURE ${func}` + // 鍒犻櫎瀛樺偍杩囩▼ + let droparam = { + func: 'sPC_TableData_InUpDe', + LText: Utils.formatOptions(dropfunc), + TypeCharOne: 'proc' // 鍒犻櫎鎴栧垱寤哄瓨鍌ㄨ繃绋嬫爣蹇� + } + + droparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + droparam.secretkey = Utils.encrypt(droparam.LText, droparam.timestamp) + droparam.open_key = Utils.encryptOpenKey(droparam.secretkey, droparam.timestamp) + + // 鏂板缓瀛樺偍杩囩▼ + let _param = { + func: 'sPC_TableData_InUpDe', + LText: Utils.formatOptions(newLText), + TypeCharOne: 'proc' + } + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) + _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) + + let saveParam = { + func: 's_proc_save', + sql_script: window.btoa(window.encodeURIComponent(newLText)), + proc_name: func, + save_type: 'auto' + } + this.setState({ loading: true }) - this.createExec(innerFunc, newLText, DelText) - } - - createExec = (innerFunc, newLText, DelText) => { - let isExist = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 - let cloudText = '' // 浜戠瀛樺偍缁撴灉 - let localfunc = '' // 鏈湴瀛樺偍杩囩▼ - - new Promise(resolve => { - // 鑾峰彇浜戠瀛樺偍杩囩▼淇℃伅 - Api.getCloudConfig({ - func: 'sPC_Get_TVP', - TVPName: innerFunc - }).then(result => { + Api.genericInterface(droparam).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({ + loading: false + }) + return + } + Api.genericInterface(_param).then(result => { if (!result.status) { notification.warning({ top: 92, message: result.message, duration: 5 }) - resolve(false) - } else { - cloudText = result.TVPText - resolve(true) - } - }) - }).then(res => { - if (!res) return res - // 鑾峰彇鏈湴瀛樺偍杩囩▼淇℃伅 - - let _param = { - func: 's_get_userproc', - LText: innerFunc - } - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - - return Api.genericInterface(_param) - }).then(res => { - if (!res) return res - - // 澶勭悊鏈湴缁撴灉 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return false - } else { - isExist = true - localfunc = Utils.formatOptions(res.Ltext) - return true - } - }).then(res => { - if (!res) return res - - // 鏍规嵁鏈湴鍙婅繙绔粨鏋滃垽鏂墽琛屽姩浣� - if ((newLText === localfunc) && (newLText === cloudText)) { - return 'drop' - } else if (!localfunc || (cloudText === localfunc)) { - // 鏈湴瀛樺偍杩囩▼涓嶅瓨鍦紝鎴栦簯绔拰鏈湴瀛樺偍杩囩▼涓�鑷存椂锛屽皢鏂扮殑瀛樺偍杩囩▼鏇存柊鑷充簯绔� - return Api.getCloudConfig({ - func: 'sPC_TVP_InUp', - TVPName: innerFunc, - TVPText: newLText, - TypeName: 'P' - }) - } else { - return new Promise(resolve => { - Api.getCloudConfig({ // 娣诲姞鐜版湁鐨勬湰鍦板瓨鍌ㄨ繃绋嬭嚦浜戠 - func: 'sPC_TVP_InUp', - TVPName: innerFunc, - TVPText: localfunc, - TypeName: 'P' - }).then(result => { - if (result.status) { - Api.getCloudConfig({ - func: 'sPC_TVP_InUp', // 娣诲姞鏈�鏂扮殑瀛樺偍杩囩▼鑷充簯绔� - TVPName: innerFunc, - TVPText: newLText, - TypeName: 'P' - }).then(response => { - resolve(response) - }) - } else { - resolve(result) - } + this.setState({ + loading: false }) + return + } + + Api.genericInterface(saveParam).then(response => { + this.setState({loading: false}) + if (!response.status) { + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) + } else { + notification.success({ + top: 92, + message: '鍒涘缓鎴愬姛銆�', + duration: 5 + }) + } }) - } - }).then(res => { - if (!res || res === 'drop') return res - - // 澶勭悊浜戠鏇存柊缁撴灉 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return false - } else if (isExist) { - return 'drop' - } else { - return 'create' - } - }).then(res => { - if (!res || res === 'create') return res - - // 鍒犻櫎瀛樺偍杩囩▼ - let _param = { - func: 'sPC_TableData_InUpDe', - LText: DelText, - TypeCharOne: 'proc' // 鍒犻櫎鎴栧垱寤哄瓨鍌ㄨ繃绋嬫爣蹇� - } - - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) - - return Api.genericInterface(_param) - }).then(res => { - if (!res || res === 'create') return res - - // 鍒犻櫎缁撴灉澶勭悊 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return false - } else { - return true - } - }).then(res => { - if (!res) return res - - // 鏂板缓瀛樺偍杩囩▼ - let _param = { - func: 'sPC_TableData_InUpDe', - LText: newLText, - TypeCharOne: 'proc' - } - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) - - return Api.genericInterface(_param) - }).then(res => { - this.setState({ - loading: false }) - - if (!res) return res - - // 澶勭悊鏂板缓缁撴灉 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } else { - notification.success({ - top: 92, - message: '鍒涘缓鎴愬姛', - duration: 2 - }) - } }) } render() { - return ( <Button className="mk-btn mk-purple" - onClick={this.props.trigger} + onClick={this.trigger} loading={this.state.loading} > 鍒涘缓瀛樺偍杩囩▼ diff --git a/src/templates/zshare/createfunc/utils.js b/src/templates/zshare/createfunc/utils.js new file mode 100644 index 0000000..2e0c1b6 --- /dev/null +++ b/src/templates/zshare/createfunc/utils.js @@ -0,0 +1,454 @@ +/** + * @description 鍒涘缓瀛樺偍杩囩▼绫� + */ +export default class FuncUtils { + /** + * @description 鍒涘缓椤甸潰瀛樺偍杩囩▼ + * @return {String} + */ + static getTableFunc (config) { + let form = '' + let formParam = '' + let _vars = ['bid', 'pageindex', 'pagesize', 'ordercol', 'ordertype', 'exceltype', 'septmenuno', 'lang', 'debug', 'loginuid', 'sessionuid', 'userid', 'errorcode', 'retmsg'] + let _columns = [] + let primaryKey = config.setting.primaryKey || 'ID' + + if (!_vars.includes(primaryKey.toLowerCase())) { + _vars.push(primaryKey.toLowerCase()) + formParam = `mchr13k@${primaryKey} nvarchar(50)='',` + } + + if (config.search && config.search.length > 0) { + let _fields = new Map() + config.search.forEach(item => { + if (item.field) { + let type = '' + + if (item.type.match(/date/ig)) { + type = 'datetime=null' + } else { + type = 'nvarchar(50)=\'\'' + } + + item.field.split(',').forEach(cell => { + let _f = cell + if (_fields.has(cell)) { + _f = _f + '1' + } + + _fields.set(cell, true) + + if (!_vars.includes(_f.toLowerCase())) { + _vars.push(_f.toLowerCase()) + formParam = formParam + `mchr13k@${_f} ${type},` + } + }) + } + }) + } + + if (config.columns && config.columns.length > 0) { + config.columns.forEach(item => { + if (item.field) { + _columns.push(`${item.field} as ${item.label}`) + } + }) + + form = ` + declare @dc table (${_columns.join(',')}) + + @tableid ='${config.MenuID}' + ` + } + + let Ltext = `create proc ${config.func} + ( /*${config.MenuName}*/ + @appkey nvarchar(50)='', + @BID nvarchar(50)='', + @UserName nvarchar(50)='', + @FullName nvarchar(50)='',${formParam} + @PageIndex nvarchar(50)='', + @PageSize nvarchar(50)='', + @OrderCol nvarchar(50)='', + @OrderType nvarchar(50)='', + @exceltype nvarchar(50)='', + @sEPTMenuNo nvarchar(50)='${config.menuNo}', + @lang nvarchar(50)='', + @debug nvarchar(50)='', + @LoginUID nvarchar(50)='', + @SessionUid nvarchar(50)='', + @UserID nvarchar(50), + @dataM nvarchar(50), + @ErrorCode nvarchar(50) out, + @retmsg nvarchar(4000) out + ) + as + begin + declare @BegindateTest datetime,@EnddateTest datetime + select @BegindateTest=getdate() + set @ErrorCode='' + set @retmsg='' + BEGIN TRY + /*浜嬪姟鎿嶄綔*/ + BEGIN TRAN + /*鍏蜂綋涓氬姟鎿嶄綔*/ + + /* + select top 10 * from sProcExcep order by id desc + + ${form} + if 1=2 + begin + set @ErrorCode='E' + set @retmsg='鍦ㄦ鍐欐姤閿�' + goto GOTO_RETURN + end + + insert into sNote (remark,createuserid,CreateUser,CreateStaff) + select '鍦ㄦ鍐欐棩蹇�',@UserID,@UserName,@FullName + */ + + COMMIT TRAN + SET NOCOUNT ON + RETURN + END TRY + BEGIN CATCH + /*閿欒澶勭悊*/ + ROLLBACK TRAN + DECLARE @ErrorMessage NVARCHAR(4000); + DECLARE @ErrorSeverity INT; + DECLARE @ErrorState INT; + + /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ + set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) + SET @retmsg=ERROR_MESSAGE(); + SELECT @ErrorMessage=ERROR_MESSAGE(), + @ErrorSeverity=ERROR_SEVERITY(), + @ErrorState=ERROR_STATE(); + + RAISERROR(@ErrorMessage, /*-- Message text.*/ + @ErrorSeverity, /*-- Severity.*/ + @ErrorState /*-- State.*/ + ); + END CATCH + + GOTO_RETURN: + ROLLBACK TRAN + + END` + + Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') + + return Ltext + } + + /** + * @description 鍒涘缓瀛樺偍杩囩▼ + * @return {String} + */ + static getfunc (btn) { + let form = '' + let formParam = '' + let _vars = ['bid', 'septmenuno', 'lang', 'debug', 'loginuid', 'sessionuid', 'userid', 'errorcode', 'retmsg'] + let columns = btn.columns + let primaryKey = btn.primaryKey + + if (!_vars.includes(primaryKey.toLowerCase())) { + _vars.push(primaryKey.toLowerCase()) + let _type = '50' + if (btn.Ot === 'requiredOnce') { // 澶氳鎷兼帴鏃讹紝涓婚敭璁句负max + _type = 'max' + } + formParam = `mchr13k@${primaryKey} nvarchar(${_type})='',` + } + + if (btn.fields && btn.fields.length > 0) { + let _fields = [] + btn.fields.forEach(item => { + if (item.field) { + let type = '' + if (item.type.match(/date/ig)) { + type = 'datetime=null' + } else if (item.type === 'number') { + type = `decimal(18,${item.decimal})=0` + } else if (item.type === 'rate') { + type = `decimal(18,2)=0` + } else { + type = 'nvarchar(50)=\'\'' + } + + if (!_vars.includes(item.field.toLowerCase())) { + _vars.push(item.field.toLowerCase()) + formParam = formParam + `mchr13k@${item.field} ${type},` + } + + _fields.push(item.field) + } + }) + + let field1 = _fields.join(',') + let field2 = _fields.join(',@') + let field3 = _fields.map(cell => { + return cell + '=@' + cell + }) + + field2 = field2 ? '@' + field2 : '' + field3 = field3.join(',') + + form = ` + insert into ${btn.name} (${field1},createuserid) select ${field2},@UserID + + update ${btn.name} set ${field3},modifydate=getdate(),modifyuser=@username,modifyuserid=@UserID + ` + } else if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { + form = ` + update ${btn.name} set ModifyDate=getdate(),ModifyUserID=@UserID where ${primaryKey}=@${primaryKey} + ` + } + + if (columns) { + let _col = [] + let _field = [] + columns.forEach(col => { + if (col.field) { + if (col.type === 'number') { + _col.push(col.field + ' decimal(18,2)') + } else { + _col.push(col.field + ' nvarchar(50)') + } + _field.push(col.field) + } + }) + _col = _col.join(',') + _field = _field.join(',') + + form = form + ` + declare @dc table (${_col}) + + insert into @dc (${_field}) + + @tableid ='${btn.MenuID}' + ` + } + + // 鎵撳嵃鑷畾涔夋ā鏉垮瓧娈垫彁绀� + let _printRemark = '' + if (btn.funcType === 'print') { + _printRemark = '/* 鑷畾涔夋暟鎹墦鍗版ā鏉挎椂锛岃浣跨敤TemplateID瀛楁 */' + } + + let Ltext = `create proc ${btn.func} + ( /*${btn.MenuName} ${btn.label}*/ + @appkey nvarchar(50)='', + @BID nvarchar(50)='', + @UserName nvarchar(50)='', + @FullName nvarchar(50)='',${formParam} + @sEPTMenuNo nvarchar(50)='${btn.menuNo}', + @lang nvarchar(50)='', + @debug nvarchar(50)='', + @LoginUID nvarchar(50)='', + @SessionUid nvarchar(50)='', + @UserID nvarchar(50), + @ErrorCode nvarchar(50) out, + @retmsg nvarchar(4000) out + ) + as + begin + declare @BegindateTest datetime,@EnddateTest datetime + select @BegindateTest=getdate() + set @ErrorCode='' + set @retmsg='' + BEGIN TRY + /*浜嬪姟鎿嶄綔*/ + BEGIN TRAN + /*鍏蜂綋涓氬姟鎿嶄綔*/ + ${_printRemark} + /* + select top 10 * from sProcExcep order by id desc + + ${form} + if 1=2 + begin + set @ErrorCode='E' + set @retmsg='鍦ㄦ鍐欐姤閿�' + goto GOTO_RETURN + end + + insert into sNote (remark,createuserid,CreateUser,CreateStaff) + select '鍦ㄦ鍐欐棩蹇�',@UserID,@UserName,@FullName + */ + + COMMIT TRAN + SET NOCOUNT ON + RETURN + END TRY + BEGIN CATCH + /*閿欒澶勭悊*/ + ROLLBACK TRAN + DECLARE @ErrorMessage NVARCHAR(4000); + DECLARE @ErrorSeverity INT; + DECLARE @ErrorState INT; + + /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ + set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) + SET @retmsg=ERROR_MESSAGE(); + SELECT @ErrorMessage=ERROR_MESSAGE(), + @ErrorSeverity=ERROR_SEVERITY(), + @ErrorState=ERROR_STATE(); + + RAISERROR(@ErrorMessage, /* Message text.*/ + @ErrorSeverity, /* Severity.*/ + @ErrorState /* State.*/ + ); + END CATCH + + GOTO_RETURN: + ROLLBACK TRAN + + END` + + Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') + + return Ltext + } + + /** + * @description 鍒涘缓瀵煎叆瀛樺偍杩囩▼ + * @return {String} + */ + static getexcelInfunc (btn) { + let _verify = btn.verify + + let _uniquesql = '' + if (_verify.uniques && _verify.uniques.length > 0) { + _verify.uniques.forEach(unique => { + if (unique.status === 'false') return + + let _fields = unique.field.split(',') + let _fields_ = _fields.map(_field => { + return `a.${_field}=b.${_field}` + }) + _fields_ = _fields_.join(' and ') + + if (unique.verifyType !== 'physical') { + _fields_ += ' and b.deleted=0' + } + + _uniquesql += ` + Set @tbid='' + Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from @${btn.sheet} ) a group by ${unique.field} having sum(n)>1 + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 閲嶅' + goto aaa + end + + Set @tbid='' + Select top 1 @tbid=${_fields.join('+\' \'+')} from @${btn.sheet} a + Inner join ${btn.sheet} b on ${_fields_} + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' + goto aaa + end + ` + }) + + if (_uniquesql) { + _uniquesql = ` + Declare @tbid Nvarchar(512) + ${_uniquesql}` + } + } + + let declarefields = [] + let fields = [] + + _verify.columns.forEach(col => { + declarefields.push(`${col.Column} ${col.type}`) + fields.push(col.Column) + }) + + fields = fields.join(',') + + let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) + + Insert into @${btn.sheet} (${fields},jskey,BID) + + select @LText=dbo.urldecode(dbo.base64decode(@LText)) + + ${_uniquesql} + Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) + Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet} + + Delete @${btn.sheet}` + + let Ltext = `create proc ${btn.func} + ( /*${btn.MenuName} ${btn.label}*/ + @appkey nvarchar(50)='', + @ID nvarchar(50)='', + @BID nvarchar(50)='', + @UserName nvarchar(50)='', + @FullName nvarchar(50)='', + @Ltext nvarchar(max)='', + @sEPTMenuNo nvarchar(50)='${btn.menuNo}', + @secretkey nvarchar(50)='', + @timestamp nvarchar(50)='', + @lang nvarchar(50)='', + @LoginUID nvarchar(50)='', + @SessionUid nvarchar(50)='', + @UserID nvarchar(50), + @ErrorCode nvarchar(50) out, + @retmsg nvarchar(4000) out + ) + as + begin + declare @BegindateTest datetime,@EnddateTest datetime + select @BegindateTest=getdate() + set @ErrorCode='' + set @retmsg='' + BEGIN TRY + /*浜嬪姟鎿嶄綔*/ + BEGIN TRAN + /*鍏蜂綋涓氬姟鎿嶄綔*/ + + /* + ${_sql} + */ + + COMMIT TRAN + SET NOCOUNT ON + RETURN + END TRY + BEGIN CATCH + /*閿欒澶勭悊*/ + ROLLBACK TRAN + DECLARE @ErrorMessage NVARCHAR(4000); + DECLARE @ErrorSeverity INT; + DECLARE @ErrorState INT; + + /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ + set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) + SET @retmsg=ERROR_MESSAGE(); + SELECT @ErrorMessage=ERROR_MESSAGE(), + @ErrorSeverity=ERROR_SEVERITY(), + @ErrorState=ERROR_STATE(); + + RAISERROR(@ErrorMessage, /* Message text.*/ + @ErrorSeverity, /* Severity.*/ + @ErrorState /* State.*/ + ); + END CATCH + + GOTO_RETURN: + ROLLBACK TRAN + + END` + + Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') + + return Ltext + } +} \ No newline at end of file diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 313c909..db78cd8 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2924,7 +2924,7 @@ key: 'dataSource', label: '鏁版嵁婧�', initVal: card.dataSource || '', - placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆�', + placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆傚叕鍏卞�硷細@ID@銆丂BID@銆�', required: true, readonly: false }, diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index c6c2a7b..3aaa932 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -416,6 +416,8 @@ this.record.resourceType = '0' _fieldval.resourceType = '0' } + } else if (this.record.type === 'funcvar' && value !== 'funcvar') { + this.record.readonly = 'false' } if (this.record.options.length > 0) { diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index be72648..a5cb08d 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -54,6 +54,11 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc + + if (setting.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } } else { if (window.GLOB.mkHS) { if (setting.sysInterface === 'true' && window.GLOB.cloudServiceApi) { @@ -201,16 +206,14 @@ let arr_field = setting.all_field || setting.arr_field if (_dataresource) { - if (setting.laypage && orderBy) { - if (setting.custompage) { - LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + if (setting.custompage) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } else if (setting.laypage && orderBy) { + LText = `/*system_query*/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 ` + if (setting.sub_field) { + DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` } else { - LText = `/*system_query*/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 ` - if (setting.sub_field) { - DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` - } else { - DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` - } + DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` } } else if (orderBy) { LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` diff --git a/src/utils/utils.js b/src/utils/utils.js index 566ced2..7186361 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -33,7 +33,8 @@ { key: 'TRAN', value: ' mtrnk ' }, { key: 'goto', value: ' mgtk ' }, { key: 'set', value: ' mstk ' }, - { key: 'ROLLBACK', value: ' mrlbkk ' } + { key: 'ROLLBACK', value: ' mrlbkk ' }, + { key: 'drop', value: ' mdrpk ' }, ] export default class Utils { @@ -921,37 +922,6 @@ let _topline = btn.range || 0 let upId = getuuid() - let _initCustomScript = '' // 鍒濆鍖栬剼鏈� - let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� - let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� - - if (btn.scripts) { - btn.scripts.forEach(script => { - if (script.status === 'false') return - - let _sql = script.sql - - if (script.position === 'init') { - _initCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${_sql} - ` - } else if (script.position === 'front') { - _prevCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${_sql} - ` - } else { - _backCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${_sql} - ` - } - }) - } - - // 鎺у埗鍙版墦鍗版暟鎹� - let conLtext = [] let cols = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] for (let i = 0; i < 26; i++) { cols.push('A' + cols[i]) @@ -959,7 +929,6 @@ let _Ltext = data.map((item, lindex) => { let vals = [] - let convals = [] btn.columns.forEach((col, cindex) => { if (col.import === 'false') return @@ -967,7 +936,15 @@ let _colindex = cols[cindex] || (cindex + 1) let _position = (_topline + lindex + 1) + '琛� ' + _colindex + '鍒� ' - if (/^Nvarchar/ig.test(col.type)) { + if (col.import === 'init') { + if (/^Nvarchar/ig.test(col.type)) { + val = '' + } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { + val = 0 + } else if (col.type === 'date') { + val = '1949-10-01' + } + } else if (/^Nvarchar/ig.test(col.type)) { val = val + '' if (/'/.test(val)) { @@ -1021,10 +998,6 @@ } vals.push(`'${val}'`) - - if (lindex < 40) { - convals.push(`'${val}' as ${col.Column}`) - } }) let _lineIndex = '0000' + (lindex + 1) + '0' @@ -1032,26 +1005,60 @@ vals.push(`'${upId + _lineIndex}'`) vals.push(`'${BID}'`) - - if (lindex < 40) { - convals.push(`'${upId + _lineIndex}' as jskey`) - convals.push(`'${BID}' as BID`) - conLtext.push(`Select ${convals.join(',')}`) - } return `Select ${vals.join(',')}` }) let result = [] - for(let i = 0; i < _Ltext.length; i += 20) { - result.push(_Ltext.slice(i, i + 20)) - } - - let _sql = '' - let _sqlInsert = '' - let _sqlBottom = '' - + let sql = '' + if (item.intertype === 'system') { + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� + let isDM = sessionStorage.getItem('dataM') === 'true' + let regs = [ + {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: `#${sheet} `}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: `#${sheet}(`}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: `#${sheet})`}, + {reg: /@BID@/ig, value: `'${BID}'`}, + {reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, + {reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, + {reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, + {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, + {reg: /@typename@/ig, value: `'admin'`}, + {reg: /\$@/ig, value: isDM ? '/*' : ''}, + {reg: /@\$/ig, value: isDM ? '*/' : ''}, + {reg: /@datam@/ig, value: isDM ? `'Y'` : `''`}, + ] + + btn.scripts && btn.scripts.forEach(script => { + if (script.status === 'false') return + + let _sql = script.sql + + regs.forEach(item => { + _sql = _sql.replace(item.reg, item.value) + }) + + if (script.position === 'init') { + _initCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else if (script.position === 'front') { + _prevCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else { + _backCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } + }) + let _uniquesql = '' if (btn.uniques && btn.uniques.length > 0) { btn.uniques.forEach(unique => { @@ -1069,7 +1076,7 @@ _uniquesql += ` /* 閲嶅鎬ч獙璇� */ Set @tbid='' - Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from @${sheet} ) a group by ${unique.field} having sum(n)>1 + Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 If @tbid!='' Begin @@ -1078,7 +1085,7 @@ end ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' - Select top 1 @tbid=${_afields.join('+\' \'+')} from @${sheet} a Inner join ${sheet} b on ${_fields_} + Select top 1 @tbid=${_afields.join('+\' \'+')} from #${sheet} a Inner join ${sheet} b on ${_fields_} If @tbid!='' Begin @@ -1110,88 +1117,51 @@ _insert = ` /* 榛樿sql */ Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) - Select ${fields},@userid@,@username,@fullname,@BID@ From @${sheet} + Select ${fields},'${sessionStorage.getItem('UserID') || ''}',@username,@fullname,'${BID}' From #${sheet} ` } - _sql = ` + sql = ` /* 绯荤粺鐢熸垚 */ - declare @${sheet} table (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50) ) + create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50) ) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' ${_initCustomScript} - ` - _sqlInsert = `Insert into @${sheet} (${fields},jskey,BID)` - _sqlBottom = ` - /* 榛樿sql */ - delete tmp_excel_in where upid=@upid@ - delete tmp_excel_in where datediff(day,createdate,getdate())>15 + Insert into #${sheet} (${fields},jskey,BID) + + /* excel鏁版嵁*/ + ${_Ltext.join(' Union all ')} + ${_uniquesql} ${_prevCustomScript} ${_insert} ${_backCustomScript} - Delete @${sheet} + + drop table #${sheet} aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` - _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) - _sql = _sql.replace(/@BID@/ig, `'${BID}'`) - _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _sql = _sql.replace(/@typename@/ig, `'admin'`) - - _sqlBottom = _sqlBottom.replace(/@ID@/ig, `'${primaryId || ''}'`) - _sqlBottom = _sqlBottom.replace(/@BID@/ig, `'${BID}'`) - _sqlBottom = _sqlBottom.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _sqlBottom = _sqlBottom.replace(/@typename@/ig, `'admin'`) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - _sqlBottom = _sqlBottom.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - _sqlBottom = _sqlBottom.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } + sql = sql.replace(/\n\s{6}/ig, '\n') if (window.GLOB.debugger === true) { - let fsql = ` - ${_sql} - ${_sqlInsert} - - /* excel鏁版嵁锛堝墠40鏉★級 */ - ${conLtext.join(' Union all ')} - ${_sqlBottom} - ` - fsql = fsql.replace(/\n\s{8}/ig, '\n') - console.info(fsql) + console.info(sql) } - } else { // s_sDataDictb_excelIn 浜戠瀵嗛挜楠岃瘉鍙傛暟 - _sql = ` - /* 绯荤粺鐢熸垚 */ - declare @${sheet} table (jskey nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) - - Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' - ` + } else { + for(let i = 0; i < _Ltext.length; i += 20) { + result.push(_Ltext.slice(i, i + 20)) + } } return { - sql: _sql, + sql: sql, lines: result.map((list, index) => { return { Ltext: window.btoa(window.encodeURIComponent(list.join(' Union all '))), Sort: (index + 1) * 10 } }), - insert: _sqlInsert, - bottom: _sqlBottom, errors: errors.join('; ') } } @@ -1227,44 +1197,12 @@ database = database ? (database[0] || '') : '' - let _initCustomScript = '' // 鍒濆鍖栬剼鏈� - let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� - let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� - - if (btn.scripts && btn.intertype === 'system') { - btn.scripts.forEach(script => { - if (script.status === 'false') return - - if (script.position === 'init') { - _initCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${script.sql} - ` - } else if (script.position === 'front') { - _prevCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${script.sql} - ` - } else { - _backCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${script.sql} - ` - } - }) - } - - // 鎺у埗鍙版墦鍗版暟鎹� - let conLtext = [] - let _Ltext = data.map(item => { let vals = [] - let convals = [] columns.forEach(col => { let val = item[col.field] vals.push(`'${val}'`) - convals.push(`'${val}' as ${col.field}`) }) let key = item.$$uuid @@ -1274,24 +1212,59 @@ vals.push(`'${type}'`) vals.push(`'${BID}'`) - convals.push(`'${key}' as jskey`) - convals.push(`'${type}' as data_type`) - convals.push(`'${BID}' as BID`) - conLtext.push(`Select ${convals.join(',')}`) - return `Select ${vals.join(',')}` }) let result = [] - for(let i = 0; i < _Ltext.length; i += 20) { - result.push(_Ltext.slice(i, i + 20)) - } - - let _sql = '' - let _sqlInsert = '' - let _sqlBottom = '' + let sql = '' if (btn.intertype === 'system') { + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� + let isDM = sessionStorage.getItem('dataM') === 'true' + let regs = [ + {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: `#${sheet} `}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: `#${sheet}(`}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: `#${sheet})`}, + {reg: /@BID@/ig, value: `'${BID}'`}, + {reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, + {reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, + {reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, + {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, + {reg: /@typename@/ig, value: `'admin'`}, + {reg: /\$@/ig, value: isDM ? '/*' : ''}, + {reg: /@\$/ig, value: isDM ? '*/' : ''}, + {reg: /@datam@/ig, value: isDM ? `'Y'` : `''`}, + ] + + btn.scripts && btn.scripts.forEach(script => { + if (script.status === 'false') return + + let _sql = script.sql + + regs.forEach(item => { + _sql = _sql.replace(item.reg, item.value) + }) + + if (script.position === 'init') { + _initCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else if (script.position === 'front') { + _prevCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else { + _backCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } + }) + let _uniquesql = '' if (btn.uniques && btn.uniques.length > 0) { btn.uniques.forEach(unique => { @@ -1309,7 +1282,7 @@ _uniquesql += ` /* 閲嶅鎬ч獙璇� */ Set @tbid='' - Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from @${sheet} ) a group by ${unique.field} having sum(n)>1 + Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 If @tbid!='' Begin @@ -1318,7 +1291,7 @@ end ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' - Select top 1 @tbid=${_afields.join('+\' \'+')} from @${sheet} a Inner join ${sheet} b on ${_fields_} + Select top 1 @tbid=${_afields.join('+\' \'+')} from #${sheet} a Inner join ${sheet} b on ${_fields_} If @tbid!='' Begin @@ -1347,86 +1320,50 @@ _insert = ` /* 榛樿sql */ Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) - Select ${fields},@userid@,@username,@fullname,@BID@ From @${sheet} + Select ${fields},'${sessionStorage.getItem('UserID') || ''}',@username,@fullname,'${BID}' From #${sheet} ` } - _sql = ` + sql = ` /* 绯荤粺鐢熸垚 */ - declare @${sheet} table (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50) ) + create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50) ) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' ${_initCustomScript} - ` - _sqlInsert = `Insert into @${sheet} (${fields},jskey,data_type,BID)` - _sqlBottom = ` - /* 榛樿sql */ - delete tmp_excel_in where upid=@upid@ - - delete tmp_excel_in where datediff(day,createdate,getdate())>15 + Insert into #${sheet} (${fields},jskey,data_type,BID) + + /* excel鏁版嵁*/ + ${_Ltext.join(' Union all ')} + ${_uniquesql} ${_prevCustomScript} ${_insert} ${_backCustomScript} - Delete @${sheet} + + drop table #${sheet} aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` - _sql = _sql.replace(/@BID@/ig, `'${BID}'`) - _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _sql = _sql.replace(/@typename@/ig, `'admin'`) - - _sqlBottom = _sqlBottom.replace(/@BID@/ig, `'${BID}'`) - _sqlBottom = _sqlBottom.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _sqlBottom = _sqlBottom.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _sqlBottom = _sqlBottom.replace(/@typename@/ig, `'admin'`) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - _sqlBottom = _sqlBottom.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - _sqlBottom = _sqlBottom.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } + sql = sql.replace(/\n\s{6}/ig, '\n') if (window.GLOB.debugger === true) { - let fsql = ` - ${_sql} - ${_sqlInsert} - - /* table鏁版嵁 */ - ${conLtext.join(' Union all \n')} - ${_sqlBottom} - ` - fsql = fsql.replace(/\n\s{8}/ig, '\n') - console.info(fsql) + console.info(sql) } - } else { // s_sDataDictb_excelIn 浜戠瀵嗛挜楠岃瘉鍙傛暟 - _sql = ` - /* 绯荤粺鐢熸垚 */ - declare @${sheet} table (jskey nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) - - Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' - ` + } else { + for(let i = 0; i < _Ltext.length; i += 20) { + result.push(_Ltext.slice(i, i + 20)) + } } return { - sql: _sql, + sql: sql, lines: result.map((list, index) => { return { Ltext: window.btoa(window.encodeURIComponent(list.join(' Union all '))), Sort: (index + 1) * 10 } - }), - insert: _sqlInsert, - bottom: _sqlBottom + }) } } @@ -2318,471 +2255,5 @@ }) cursor.continue() } - } -} - -/** - * @description 鍒涘缓瀛樺偍杩囩▼绫� - */ -export class FuncUtils { - /** - * @description 鍒犻櫎瀛樺偍杩囩▼sql - * @return {String} name 瀛樺偍杩囩▼鍚嶇О - */ - static dropfunc (name) { - return `IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('${name}') AND type in (N'P', N'PC')) mdrpk PROCEDURE ${name}` - } - - /** - * @description 鍒涘缓椤甸潰瀛樺偍杩囩▼ - * @return {String} - */ - static getTableFunc (func = 'func', menu, config) { - let form = '' - let formParam = '' - let _vars = ['bid', 'pageindex', 'pagesize', 'ordercol', 'ordertype', 'exceltype', 'septmenuno', 'lang', 'debug', 'loginuid', 'sessionuid', 'userid', 'errorcode', 'retmsg'] - let _columns = [] - let primaryKey = config.setting.primaryKey || 'ID' - - if (!_vars.includes(primaryKey.toLowerCase())) { - _vars.push(primaryKey.toLowerCase()) - formParam = `mchr13k@${primaryKey} nvarchar(50)='',` - } - - if (config.search && config.search.length > 0) { - let _fields = new Map() - config.search.forEach(item => { - if (item.field) { - let type = '' - - if (item.type.match(/date/ig)) { - type = 'datetime=null' - } else { - type = 'nvarchar(50)=\'\'' - } - - item.field.split(',').forEach(cell => { - let _f = cell - if (_fields.has(cell)) { - _f = _f + '1' - } - - _fields.set(cell, true) - - if (!_vars.includes(_f.toLowerCase())) { - _vars.push(_f.toLowerCase()) - formParam = formParam + `mchr13k@${_f} ${type},` - } - }) - } - }) - } - - if (config.columns && config.columns.length > 0) { - config.columns.forEach(item => { - if (item.field) { - _columns.push(`${item.field} as ${item.label}`) - } - }) - - form = ` - declare @dc table (${_columns.join(',')}) - - @tableid ='${menu.MenuID}' - ` - } - - let Ltext = `create proc ${func} - ( /*${menu.MenuName}*/ - @appkey nvarchar(50)='', - @BID nvarchar(50)='',${formParam} - @PageIndex nvarchar(50)='', - @PageSize nvarchar(50)='', - @OrderCol nvarchar(50)='', - @OrderType nvarchar(50)='', - @exceltype nvarchar(50)='', - @sEPTMenuNo nvarchar(50)='${menu.MenuNo}', - @lang nvarchar(50)='', - @debug nvarchar(50)='', - @LoginUID nvarchar(50)='', - @SessionUid nvarchar(50)='', - @UserID nvarchar(50), - @dataM nvarchar(50), - @ErrorCode nvarchar(50) out, - @retmsg nvarchar(4000) out - ) - as - begin - declare @BegindateTest datetime,@EnddateTest datetime - select @BegindateTest=getdate() - set @ErrorCode='' - set @retmsg='' - BEGIN TRY - /*浜嬪姟鎿嶄綔*/ - BEGIN TRAN - /*鍏蜂綋涓氬姟鎿嶄綔*/ - - /* - select top 10 * from sProcExcep order by id desc - - declare @UserName nvarchar(50),@FullName nvarchar(50) - - select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID - ${form} - if 1=2 - begin - set @ErrorCode='E' - set @retmsg='鍦ㄦ鍐欐姤閿�' - goto GOTO_RETURN - end - - insert into sNote (remark,createuserid,CreateUser,CreateStaff) - select '鍦ㄦ鍐欐棩蹇�',@UserID,@UserName,@FullName - */ - - COMMIT TRAN - SET NOCOUNT ON - RETURN - END TRY - BEGIN CATCH - /*閿欒澶勭悊*/ - ROLLBACK TRAN - DECLARE @ErrorMessage NVARCHAR(4000); - DECLARE @ErrorSeverity INT; - DECLARE @ErrorState INT; - - /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ - set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) - SET @retmsg=ERROR_MESSAGE(); - SELECT @ErrorMessage=ERROR_MESSAGE(), - @ErrorSeverity=ERROR_SEVERITY(), - @ErrorState=ERROR_STATE(); - - RAISERROR(@ErrorMessage, /*-- Message text.*/ - @ErrorSeverity, /*-- Severity.*/ - @ErrorState /*-- State.*/ - ); - END CATCH - - GOTO_RETURN: - ROLLBACK TRAN - - END` - - Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') - - return Ltext - } - - /** - * @description 鍒涘缓瀛樺偍杩囩▼ - * @return {String} - */ - static getfunc (param, btn, menu, config) { - let form = '' - let formParam = '' - let _vars = ['bid', 'septmenuno', 'lang', 'debug', 'loginuid', 'sessionuid', 'userid', 'errorcode', 'retmsg'] - let columns = config.columns - let primaryKey = config.setting.primaryKey || 'ID' - - if (!_vars.includes(primaryKey.toLowerCase())) { - _vars.push(primaryKey.toLowerCase()) - let _type = '50' - if (btn.Ot === 'requiredOnce') { // 澶氳鎷兼帴鏃讹紝涓婚敭璁句负max - _type = 'max' - } - formParam = `mchr13k@${primaryKey} nvarchar(${_type})='',` - } - - if (param.fields && param.fields.length > 0) { - let _fields = [] - param.fields.forEach(item => { - if (item.field) { - let type = '' - if (item.type.match(/date/ig)) { - type = 'datetime=null' - } else if (item.type === 'number') { - type = `decimal(18,${item.decimal})=0` - } else if (item.type === 'rate') { - type = `decimal(18,2)=0` - } else { - type = 'nvarchar(50)=\'\'' - } - - if (!_vars.includes(item.field.toLowerCase())) { - _vars.push(item.field.toLowerCase()) - formParam = formParam + `mchr13k@${item.field} ${type},` - } - - _fields.push(item.field) - } - }) - - let field1 = _fields.join(',') - let field2 = _fields.join(',@') - let field3 = _fields.map(cell => { - return cell + '=@' + cell - }) - - field2 = field2 ? '@' + field2 : '' - field3 = field3.join(',') - - form = ` - insert into ${param.name} (${field1},createuserid) select ${field2},@UserID - - update ${param.name} set ${field3},modifydate=getdate(),modifyuser=@username,modifyuserid=@UserID - ` - } else if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { - form = ` - update ${param.name} set ModifyDate=getdate(),ModifyUserID=@UserID where ${primaryKey}=@${primaryKey} - ` - } - - if (columns) { - let _col = [] - let _field = [] - columns.forEach(col => { - if (col.field) { - if (col.type === 'number') { - _col.push(col.field + ' decimal(18,2)') - } else { - _col.push(col.field + ' nvarchar(50)') - } - _field.push(col.field) - } - }) - _col = _col.join(',') - _field = _field.join(',') - - form = form + ` - declare @dc table (${_col}) - - insert into @dc (${_field}) - - @tableid ='${menu.MenuID}' - ` - } - - // 鎵撳嵃鑷畾涔夋ā鏉垮瓧娈垫彁绀� - let _printRemark = '' - if (btn.funcType === 'print') { - _printRemark = '/* 鑷畾涔夋暟鎹墦鍗版ā鏉挎椂锛岃浣跨敤TemplateID瀛楁 */' - } - - let Ltext = `create proc ${param.funcName} - ( /*${menu.MenuName} ${btn.label}*/ - @appkey nvarchar(50)='', - @BID nvarchar(50)='',${formParam} - @sEPTMenuNo nvarchar(50)='${param.menuNo}', - @lang nvarchar(50)='', - @debug nvarchar(50)='', - @LoginUID nvarchar(50)='', - @SessionUid nvarchar(50)='', - @UserID nvarchar(50), - @ErrorCode nvarchar(50) out, - @retmsg nvarchar(4000) out - ) - as - begin - declare @BegindateTest datetime,@EnddateTest datetime - select @BegindateTest=getdate() - set @ErrorCode='' - set @retmsg='' - BEGIN TRY - /*浜嬪姟鎿嶄綔*/ - BEGIN TRAN - /*鍏蜂綋涓氬姟鎿嶄綔*/ - ${_printRemark} - /* - select top 10 * from sProcExcep order by id desc - - declare @UserName nvarchar(50),@FullName nvarchar(50) - - select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID - ${form} - if 1=2 - begin - set @ErrorCode='E' - set @retmsg='鍦ㄦ鍐欐姤閿�' - goto GOTO_RETURN - end - - insert into sNote (remark,createuserid,CreateUser,CreateStaff) - select '鍦ㄦ鍐欐棩蹇�',@UserID,@UserName,@FullName - */ - - COMMIT TRAN - SET NOCOUNT ON - RETURN - END TRY - BEGIN CATCH - /*閿欒澶勭悊*/ - ROLLBACK TRAN - DECLARE @ErrorMessage NVARCHAR(4000); - DECLARE @ErrorSeverity INT; - DECLARE @ErrorState INT; - - /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ - set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) - SET @retmsg=ERROR_MESSAGE(); - SELECT @ErrorMessage=ERROR_MESSAGE(), - @ErrorSeverity=ERROR_SEVERITY(), - @ErrorState=ERROR_STATE(); - - RAISERROR(@ErrorMessage, /* Message text.*/ - @ErrorSeverity, /* Severity.*/ - @ErrorState /* State.*/ - ); - END CATCH - - GOTO_RETURN: - ROLLBACK TRAN - - END` - - Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') - - return Ltext - } - - /** - * @description 鍒涘缓瀵煎叆瀛樺偍杩囩▼ - * @return {String} - */ - static getexcelInfunc (param, btn, menu) { - let _verify = btn.verify - - let _uniquesql = '' - if (_verify.uniques && _verify.uniques.length > 0) { - _verify.uniques.forEach(unique => { - if (unique.status === 'false') return - - let _fields = unique.field.split(',') - let _fields_ = _fields.map(_field => { - return `a.${_field}=b.${_field}` - }) - _fields_ = _fields_.join(' and ') - - if (unique.verifyType !== 'physical') { - _fields_ += ' and b.deleted=0' - } - - _uniquesql += ` - Set @tbid='' - Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from @${btn.sheet} ) a group by ${unique.field} having sum(n)>1 - - If @tbid!='' - Begin - select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 閲嶅' - goto aaa - end - - Set @tbid='' - Select top 1 @tbid=${_fields.join('+\' \'+')} from @${btn.sheet} a - Inner join ${btn.sheet} b on ${_fields_} - - If @tbid!='' - Begin - select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' - goto aaa - end - ` - }) - - if (_uniquesql) { - _uniquesql = ` - Declare @tbid Nvarchar(512) - ${_uniquesql}` - } - } - - let declarefields = [] - let fields = [] - - _verify.columns.forEach(col => { - declarefields.push(`${col.Column} ${col.type}`) - fields.push(col.Column) - }) - - fields = fields.join(',') - - let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50) - - select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID - - Insert into @${btn.sheet} (${fields},jskey) - - exec s_KeyWords_Replace - @LText=@LText, @BID=@BID,@LoginUID=@LoginUID,@SessionUid=@SessionUid,@UserID=@UserID,@ID=@ID - ${_uniquesql} - Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) - Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet} - - Delete @${btn.sheet}` - - let Ltext = `create proc ${param.funcName} - ( /*${menu.MenuName} ${btn.label}*/ - @appkey nvarchar(50)='', - @ID nvarchar(50)='', - @BID nvarchar(50)='', - @Ltext nvarchar(max)='', - @sEPTMenuNo nvarchar(50)='${param.menuNo}', - @secretkey nvarchar(50)='', - @timestamp nvarchar(50)='', - @lang nvarchar(50)='', - @LoginUID nvarchar(50)='', - @SessionUid nvarchar(50)='', - @UserID nvarchar(50), - @ErrorCode nvarchar(50) out, - @retmsg nvarchar(4000) out - ) - as - begin - declare @BegindateTest datetime,@EnddateTest datetime - select @BegindateTest=getdate() - set @ErrorCode='' - set @retmsg='' - BEGIN TRY - /*浜嬪姟鎿嶄綔*/ - BEGIN TRAN - /*鍏蜂綋涓氬姟鎿嶄綔*/ - - /* - ${_sql} - */ - - COMMIT TRAN - SET NOCOUNT ON - RETURN - END TRY - BEGIN CATCH - /*閿欒澶勭悊*/ - ROLLBACK TRAN - DECLARE @ErrorMessage NVARCHAR(4000); - DECLARE @ErrorSeverity INT; - DECLARE @ErrorState INT; - - /*鎶婅嚜瀹氫箟鐨勫弸濂界殑閿欒淇℃伅鎻愮ず鍔犱笂*/ - set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) - SET @retmsg=ERROR_MESSAGE(); - SELECT @ErrorMessage=ERROR_MESSAGE(), - @ErrorSeverity=ERROR_SEVERITY(), - @ErrorState=ERROR_STATE(); - - RAISERROR(@ErrorMessage, /* Message text.*/ - @ErrorSeverity, /* Severity.*/ - @ErrorState /* State.*/ - ); - END CATCH - - GOTO_RETURN: - ROLLBACK TRAN - - END` - - Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') - - return Ltext } } \ No newline at end of file diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 7779306..a245790 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -582,6 +582,11 @@ resetElement = (cell) => { cell.style = cell.style || {} + + if (cell.style.display === 'inline-block') { + cell.style.verticalAlign = 'top' + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { cell.innerHeight = cell.innerHeight || 'auto' cell.alignItems = cell.height > 1 ? cell.alignItems : '' diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index a616714..f965c69 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -15,10 +15,16 @@ state = { editLevel: false, mainMenu: null, + unvalid: !sessionStorage.getItem('UserID'), menuTree: [] } componentDidMount() { + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + return + } + if (sessionStorage.getItem('isEditState') === 'true') { sessionStorage.removeItem('isEditState') this.props.history.replace('/main') @@ -45,7 +51,9 @@ } render () { - const { editLevel, menuTree, mainMenu } = this.state + const { editLevel, menuTree, mainMenu, unvalid } = this.state + + if (unvalid) return null return ( <div className={'mk-main-view ' + (window.GLOB.systemType || '')}> diff --git a/src/views/systemfunc/index.jsx b/src/views/systemfunc/index.jsx index 1c71550..270c6ea 100644 --- a/src/views/systemfunc/index.jsx +++ b/src/views/systemfunc/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' +import { withRouter } from 'react-router-dom' import zhCN from 'antd/es/locale/zh_CN' import asyncComponent from '@/utils/asyncComponent' @@ -11,25 +12,29 @@ const Tabview = asyncComponent(() => import('@/components/tabview')) -class Design extends Component { +class MkHS extends Component { UNSAFE_componentWillMount() { - sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id')) - sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) - sessionStorage.setItem('User_Name', sessionStorage.getItem('CloudUserName')) - sessionStorage.setItem('Full_Name', sessionStorage.getItem('CloudFullName')) - - document.body.className = 'mk-blue-black' - window.GLOB.dataFormat = false // 鍘婚櫎姘村嵃 - window.GLOB.mkHS = true - - // HS涓嬩笉鍙紑鍚柇鐐硅皟璇� - window.GLOB.breakpoint = false - sessionStorage.removeItem('breakpoint') - - Object.defineProperty(window, 'debugger', { - writable: false, - value: false - }) + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + } else { + sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id')) + sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) + sessionStorage.setItem('User_Name', sessionStorage.getItem('CloudUserName')) + sessionStorage.setItem('Full_Name', sessionStorage.getItem('CloudFullName')) + + document.body.className = 'mk-blue-black' + window.GLOB.dataFormat = false // 鍘婚櫎姘村嵃 + window.GLOB.mkHS = true + + // HS涓嬩笉鍙紑鍚柇鐐硅皟璇� + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + Object.defineProperty(window, 'debugger', { + writable: false, + value: false + }) + } } componentDidMount () { @@ -57,4 +62,4 @@ } } -export default Design \ No newline at end of file +export default withRouter(MkHS) \ No newline at end of file diff --git a/src/views/systemproc/index.jsx b/src/views/systemproc/index.jsx index 07d4919..9f1f68a 100644 --- a/src/views/systemproc/index.jsx +++ b/src/views/systemproc/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' +import { withRouter } from 'react-router-dom' import zhCN from 'antd/es/locale/zh_CN' import Header from '../systemfunc/header' @@ -7,6 +8,12 @@ import './index.scss' class SysProc extends Component { + componentDidMount() { + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + } + } + render () { const { params } = this.props.match let func = params && params.func ? params.func : '' @@ -22,4 +29,4 @@ } } -export default SysProc \ No newline at end of file +export default withRouter(SysProc) \ No newline at end of file diff --git a/src/views/systemproc/proc/index.jsx b/src/views/systemproc/proc/index.jsx index 73dd12e..62ce63a 100644 --- a/src/views/systemproc/proc/index.jsx +++ b/src/views/systemproc/proc/index.jsx @@ -29,7 +29,7 @@ if (sessionStorage.getItem('permFuncField')) { this.setState({permFuncs: JSON.parse(sessionStorage.getItem('permFuncField'))}) - } else { + } else if (sessionStorage.getItem('UserID')) { Api.getCloudConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { if (res.status) { let _permFuncs = [] @@ -58,7 +58,7 @@ }) } - if (this.props.func) { + if (this.props.func && sessionStorage.getItem('UserID')) { setTimeout(() => { this.search(this.props.func) }, 500) -- Gitblit v1.8.0