| | |
| | | } |
| | | }, |
| | | "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", |
| | |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import CacheUtils from './cacheutils' |
| | | |
| | | window.GLOB.IndexDB = null |
| | |
| | | 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 { |
| | |
| | | let param = { |
| | | func: 's_get_app_version', |
| | | modifydate: msg.createDate |
| | | } |
| | | |
| | | if (window.GLOB.initVersion && sessionStorage.getItem('visitorUserID')) { |
| | | param.userid = sessionStorage.getItem('visitorUserID') |
| | | param.LoginUID = sessionStorage.getItem('visitorLoginUID') |
| | | } |
| | | |
| | | param.TypeCharOne = '' |
| | |
| | | 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)) { |
| | |
| | | } |
| | | CacheUtils.delIndexDBConfig(list) |
| | | this.delCacheConfig('all') |
| | | |
| | | if (reHome) { |
| | | MKEmitter.emit('reloadMenuView', 'home_page_id') |
| | | } |
| | | } |
| | | |
| | | CacheUtils.updateIndexDBversion({version: res.app_version || '1.00', createDate: curTime}) |
| | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | position: unset!important; |
| | | vertical-align: top; |
| | | } |
| | | .sort-wrap { |
| | | position: relative; |
| | |
| | | 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' |
| | |
| | | * @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) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | 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> |
| | | ]} |
| | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | 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: '黑名单', |
| | |
| | | shows.push('exInterface', 'exProInterface') |
| | | } |
| | | } else if (intertype === 'inner') { |
| | | shows.push('innerFunc', 'output') |
| | | shows.push('innerFunc', 'output', 'recordUser') |
| | | if (Ot === 'requiredOnce') { // 前置函数 |
| | | shows.push('preFunc') |
| | | } |
| | |
| | | shows.push('exInterface', 'exProInterface') |
| | | } |
| | | } else if (intertype === 'inner') { |
| | | shows.push('innerFunc') |
| | | shows.push('innerFunc', 'recordUser') |
| | | reRequired.innerFunc = true |
| | | } else { |
| | | shows.push('sql', 'sqlType') |
| | |
| | | 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') { |
| | |
| | | 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') { |
| | |
| | | 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') { |
| | |
| | | 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)' |
| | |
| | | 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' |
| | |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | if (values.verify) { |
| | | values.verify.scripts = [] |
| | | } |
| | | } |
| | | |
| | |
| | | }, |
| | | { |
| | | 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' : ''), |
| | |
| | | }, |
| | | { |
| | | 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' : ''), |
| | |
| | | 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' |
| | |
| | | * @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) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | 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> |
| | | ]} |
| | |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值@BID@。', |
| | | required: true, |
| | | }, |
| | | { |
| | |
| | | <Modal |
| | | wrapClassName="mk-pop-modal" |
| | | visible={visible} |
| | | width={'80vw'} |
| | | width={'90vw'} |
| | | maskClosable={false} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | |
| | | |
| | | 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='' |
| | | ` |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { type } = this.props |
| | | const { type, btn } = this.props |
| | | const { editItem, skip } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | |
| | | return |
| | | } |
| | | |
| | | let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') |
| | | let tail = ` |
| | | aaa: |
| | | drop table #${sheet} |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ` |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | |
| | | |
| | | 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 |
| | | } |
| | |
| | | <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表示数据不回滚,如ENT、NNT、FNT、NMNT), 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(注:jskey为主键值,新增时前端生成;data_type为操作类型,新增 - add、修改 - upt、删除 - del) |
| | |
| | | </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> |
| | |
| | | </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} |
| | |
| | | <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: [ |
| | |
| | | <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> |
| | |
| | | }] |
| | | }, |
| | | { |
| | | 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, |
| | |
| | | } else { |
| | | cell.type = 'number' |
| | | cell.format = 'none' |
| | | cell.sum = 'false' |
| | | cell.decimal = item.decimal || 0 |
| | | cell.Width = 80 |
| | | } |
| | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | 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: '黑名单', |
| | |
| | | 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 { |
| | |
| | | mainSearch: [], |
| | | visible: false, |
| | | loading: false, |
| | | setting: null |
| | | setting: null, |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | }) |
| | | } |
| | | } 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} |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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"> |
| | |
| | | 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> |
| | |
| | | <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@代表自定义分页,总数请以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@代表自定义分页,总数请以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> |
| | |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 组件配置信息 |
| | | config: PropTypes.object, |
| | | updRecord: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | 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> |
| | | } |
| | |
| | | this.setState({reload: false}) |
| | | }) |
| | | } |
| | | |
| | | this.props.updRecord({...res.data.setting}) |
| | | }) |
| | | } |
| | | |
| | | updateStatus = (res) => { |
| | | this.setState({median: {...res}}) |
| | | this.props.updRecord({...res}) |
| | | } |
| | | |
| | | copyColumns = () => { |
| | |
| | | subColumns={subColumns} |
| | | setting={setting} |
| | | scripts={scripts} |
| | | updateStatus={(res) => this.setState({median: {...res}})} |
| | | updateStatus={this.updateStatus} |
| | | wrappedComponentRef={(inst) => this.settingForm = inst} |
| | | /> : null} |
| | | </TabPane> |
| | |
| | | </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: [ |
| | |
| | | })(<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={ |
| | |
| | | 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) { |
| | |
| | | |
| | | 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) { |
| | |
| | | |
| | | _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, '') |
| | |
| | | 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) { |
| | |
| | | let reg = new RegExp('@' + field + '@', 'ig') |
| | | _dataresource = _dataresource.replace(reg, `'0'`) |
| | | _customScript = _customScript.replace(reg, `'0'`) |
| | | _tailScript = _tailScript.replace(reg, `'0'`) |
| | | }) |
| | | } |
| | | |
| | | // 正则替换 |
| | | let _regoptions = [] |
| | | let _fields = [] |
| | | let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) |
| | | |
| | | searches.forEach(item => { |
| | | if (!item.field) return |
| | |
| | | _regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, '0') |
| | | _customScript = _customScript.replace(item.reg, '0') |
| | | _tailScript = _tailScript.replace(item.reg, '0') |
| | | }) |
| | | |
| | | let _search = defSearch |
| | |
| | | _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}` |
| | | } |
| | | } |
| | | |
| | |
| | | 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 验证 */ |
| | |
| | | }) |
| | | } |
| | | |
| | | 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(';') } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | 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} |
| | | ` |
| | | } |
| | |
| | | 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 |
| | | |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | 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 = [] |
| | |
| | | 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 = [] |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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} |
| | |
| | | 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} |
| | |
| | | |
| | | 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]) { |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | 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) => { |
| | |
| | | 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) => { |
| | |
| | | |
| | | 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')) { |
| | |
| | | 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) || [] |
| | |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.$cache) { |
| | | let getData = (res) => { |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | 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)}) |
| | |
| | | |
| | | 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')) { |
| | |
| | | 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) || [] |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | 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) { |
| | |
| | | } |
| | | } 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} |
| | |
| | | } |
| | | |
| | | 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() |
| | |
| | | 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} |
| | |
| | | |
| | | 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]) { |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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) => { |
| | |
| | | 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) => { |
| | |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | Api.writeCacheConfig(config.uuid, result.data || [], BID) |
| | | } |
| | | |
| | | let data = [] |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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) => { |
| | |
| | | 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) => { |
| | |
| | | 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) => { |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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} |
| | |
| | | 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} |
| | |
| | | |
| | | 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]) { |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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))) { |
| | |
| | | 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 |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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') { |
| | |
| | | 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 |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | 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 |
| | | |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | 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 |
| | | |
| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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 |
| | |
| | | } |
| | | |
| | | 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))) { |
| | |
| | | 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 |
| | | |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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}, () => { |
| | |
| | | } |
| | | |
| | | 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))) { |
| | |
| | | |
| | | 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))) { |
| | |
| | | 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') { |
| | |
| | | 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 => { |
| | |
| | | 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 => { |
| | |
| | | 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 => { |
| | |
| | | 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) |
| | | } |
| | |
| | | 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) || [] |
| | |
| | | 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) || [] |
| | |
| | | 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 |
| | | |
| | |
| | | } 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) |
| | |
| | | _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' |
| | |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true', '', 'timer') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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) => { |
| | |
| | | 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) |
| | | } |
| | | } |
| | |
| | | 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) => { |
| | |
| | | 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) { |
| | |
| | | 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) || [] |
| | |
| | | } |
| | | |
| | | /** |
| | | * @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 搜索条件改变时,重置表格数据 |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true', id) |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | this.loadmaindata(true, 'false', id) |
| | | this.getStatFieldsValue() |
| | | } |
| | | } |
| | | |
| | |
| | | BData: data |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | } |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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) => { |
| | |
| | | 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) => { |
| | |
| | | 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) => { |
| | |
| | | _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' |
| | |
| | | } |
| | | |
| | | 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') |
| | |
| | | } |
| | | } 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}, () => { |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | 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({ |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | 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') { |
| | |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | |
| | | 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) { |
| | |
| | | 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) { |
| | |
| | | |
| | | 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' |
| | |
| | | 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') { |
| | |
| | | inter.setting.customScript = _customScript // 整理后自定义脚本 |
| | | inter.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript) |
| | | |
| | | return inter |
| | | }) |
| | | } |
| | |
| | | * @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 { |
| | |
| | | } |
| | | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | 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') { |
| | |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | |
| | | |
| | | 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' |
| | |
| | | } |
| | | |
| | | 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} |
| | | ` |
| | | } |
| | |
| | | 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') { |
| | |
| | | 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数据处理 |
| | |
| | | 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 |
| | | |
| | |
| | | * @description Excel 导入 |
| | | */ |
| | | getexceldata = (data, errors, sheetName, errDetail) => { |
| | | const { btn } = this.props |
| | | const { btn, BID } = this.props |
| | | |
| | | if (errors) { |
| | | if (errors === 'notexit') { |
| | |
| | | }) |
| | | } |
| | | |
| | | 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({ |
| | |
| | | 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) |
| | | } |
| | |
| | | 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) { |
| | |
| | | } |
| | | } 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) { |
| | |
| | | } |
| | | |
| | | 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) |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | 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) |
| | | } |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | |
| | | Api.genericInterface(res).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | 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) |
| | |
| | | } 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) |
| | |
| | | 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) |
| | |
| | | /** |
| | | * @description Excel 生成 |
| | | */ |
| | | exportExcel = (data) => { |
| | | exportExcel = (data, ErrCode, message) => { |
| | | const { btn } = this.props |
| | | |
| | | let imgCol = false |
| | |
| | | |
| | | this.table2excel(column, table) |
| | | |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | this.execSuccess({ErrCode: ErrCode || 'S', message: message || '导出成功!'}) |
| | | } else { |
| | | let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| | | let cols = [] |
| | |
| | | |
| | | 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生成失败!'}) |
| | |
| | | _setting.dataresource = '' |
| | | } |
| | | |
| | | if (/\s/.test(_setting.dataresource)) { |
| | | _setting.dataresource = '(' + _setting.dataresource + ') tb' |
| | | } |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | |
| | | _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 |
| | |
| | | * 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') { // 完成后不提示 |
| | | |
| | |
| | | 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 = '' |
| | | |
| | |
| | | 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') { // 表单 |
| | |
| | | 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 |
| | | }) |
| | |
| | | } |
| | | |
| | | 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)) { |
| | |
| | | } |
| | | |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 |
| | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(sql) |
| | | } |
| | | |
| | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(sql) |
| | | } |
| | | |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result) |
| | | this.resetFormList(result, skip) |
| | | }) |
| | | } |
| | | |
| | |
| | | * @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 = { |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {} |
| | | |
| | | response.forEach(res => { |
| | | result = {...result, ...res} |
| | | }) |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | 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: '' |
| | | }) |
| | | } |
| | | }) |
| | |
| | | <Radio.Group> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | <Radio value="init">初始化</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | 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='' |
| | | ` |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { type } = this.props |
| | | const { type, btn } = this.props |
| | | const { editItem, skip } = this.state |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | |
| | | return |
| | | } |
| | | |
| | | let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') |
| | | let tail = ` |
| | | aaa: |
| | | drop table #${sheet} |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ` |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | |
| | | |
| | | 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 |
| | | } |
| | |
| | | <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表示数据不回滚,如ENT、NNT、FNT、NMNT、CNT、-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} |
| | |
| | | </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> |
| | |
| | | </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} |
| | |
| | | <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: [ |
| | |
| | | width: '14%', |
| | | inputType: 'input', |
| | | unique: true, |
| | | strict: true, |
| | | editable: true |
| | | }, |
| | | { |
| | |
| | | ] |
| | | }, |
| | | { |
| | | 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: '最小值', |
| | |
| | | const { card } = this.props |
| | | let _verify = fromJS(card.verify || {}).toJS() |
| | | let _columns = _verify.columns || [] |
| | | |
| | | delete _verify.dataresource |
| | | |
| | | // 旧数据兼容 |
| | | _columns = _columns.map(col => { |
| | |
| | | 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) { |
| | |
| | | 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) { |
| | |
| | | <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={ |
| | |
| | | </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: [ |
| | |
| | | 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> |
| | | } |
| | |
| | | |
| | | 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) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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) |
| | | |
| | | // 正则替换 |
| | | let _regoptions = regoptions.map(item => { |
| | |
| | | _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') |
| | |
| | | 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> |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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) |
| | |
| | | |
| | | // 数据源处理, 存在显示列时 |
| | | 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 { |
| | |
| | | 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 ='' |
| | |
| | | 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' |
| | | |
| | |
| | | |
| | | class FieldsComponent extends Component { |
| | | static propTpyes = { |
| | | type: PropTypes.string, // 搜索条件添加、显示列添加 |
| | | config: PropTypes.object, // 容器Id |
| | | type: PropTypes.string, |
| | | config: PropTypes.object, |
| | | updatefield: PropTypes.func |
| | | } |
| | | |
| | |
| | | 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: '请选择表名!', |
| | |
| | | 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) |
| | | }) |
| | |
| | | |
| | | 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" |
| | |
| | | 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' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @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() |
| | |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { visible, search, menu, record } = this.state |
| | | const { visible, search, menu } = this.state |
| | | |
| | | return ( |
| | | <> |
| | |
| | | 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> |
| | | ]} |
| | |
| | | menu={menu} |
| | | config={config} |
| | | search={search} |
| | | updRecord={(record) => this.setState({record: fromJS(record).toJS()})} |
| | | updRecord={() => {}} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | |
| | | state = { |
| | | tables: [], // 系统表 |
| | | tableFields: [], // 已选表字段集 |
| | | selectedTables: [], // 已选表 |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | selectedTables: tables |
| | | }, () => { |
| | | this.gettableFields() |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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) |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | 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}) |
| | | } |
| | |
| | | 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} |
| | | > |
| | | 创建存储过程 |
New file |
| | |
| | | /** |
| | | * @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 |
| | | } |
| | | } |
| | |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@ID@、@BID@。', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | 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) { |
| | |
| | | |
| | | 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) { |
| | |
| | | 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 ` |
| | |
| | | { 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 { |
| | |
| | | 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]) |
| | |
| | | |
| | | let _Ltext = data.map((item, lindex) => { |
| | | let vals = [] |
| | | let convals = [] |
| | | btn.columns.forEach((col, cindex) => { |
| | | if (col.import === 'false') return |
| | | |
| | |
| | | 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)) { |
| | |
| | | } |
| | | |
| | | vals.push(`'${val}'`) |
| | | |
| | | if (lindex < 40) { |
| | | convals.push(`'${val}' as ${col.Column}`) |
| | | } |
| | | }) |
| | | |
| | | let _lineIndex = '0000' + (lindex + 1) + '0' |
| | |
| | | |
| | | 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 => { |
| | |
| | | _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 |
| | |
| | | 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 |
| | |
| | | _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('; ') |
| | | } |
| | | } |
| | |
| | | |
| | | 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 |
| | |
| | | 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 => { |
| | |
| | | _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 |
| | |
| | | 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 |
| | |
| | | _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 |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | 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 |
| | | } |
| | | } |
| | |
| | | |
| | | 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 : '' |
| | |
| | | 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') |
| | |
| | | } |
| | | |
| | | 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 || '')}> |
| | |
| | | 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' |
| | |
| | | |
| | | 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 () { |
| | |
| | | } |
| | | } |
| | | |
| | | export default Design |
| | | export default withRouter(MkHS) |
| | |
| | | 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' |
| | |
| | | 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 : '' |
| | |
| | | } |
| | | } |
| | | |
| | | export default SysProc |
| | | export default withRouter(SysProc) |
| | |
| | | |
| | | 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 = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | if (this.props.func) { |
| | | if (this.props.func && sessionStorage.getItem('UserID')) { |
| | | setTimeout(() => { |
| | | this.search(this.props.func) |
| | | }, 500) |