| | |
| | | WXMerchID -- 使用微信支付时,绑定的商户ID |
| | | WXNotice -- 是否开启明科云公众号消息提醒,值为 true 时开启,可通过明科云发送模板消息 |
| | | WXApps -- 存在多个公众号、小程序或商户时可使用微信APP列表,注意填写默认公众号、小程序与商户号,格式 [{"appId": "", "appName": "", "appType": "public/miniProgram/merchant"}] |
| | | debugger -- 值为 true 时开启调试模式,开启后移动端子应用中会有控制台 |
| | | devTools -- 值为 false 时不允许使用调试模式 |
| | | debugger -- 值为 true 时开启调试模式,开启后移动端子应用中会有控制台,值为 forbid 时,禁止系统打印脚本 |
| | | systemRun -- 系统接口的执行方式,值为 backend 时,在后端运行 |
| | | licenseKey -- 许可密钥,在内部网络中使用系统时,会跳过epc验证 |
| | | storeKey -- 电子档案本地授权码,使用本地许可密钥时有效 |
| | | probation -- 试用期(YYYY-MM-DD),在正式系统中,试用期内调用系统接口的脚本会记录下来 |
| | |
| | | "WXMerchID": "", |
| | | "WXNotice": "true", |
| | | "debugger": true, |
| | | "devTools": true, |
| | | "systemRun": "backend", |
| | | "licenseKey": "", |
| | | "storeKey": "", |
| | | "probation": "", |
| | |
| | | if (!window.GLOB.IndexDB.objectStoreNames.contains('caches')) { |
| | | window.GLOB.IndexDB.createObjectStore('caches', { keyPath: 'menuid' }) |
| | | } |
| | | if (!window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | | } |
| | | // if (!window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | // window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | | // } |
| | | } |
| | | } catch (e) { |
| | | console.warn('IndexedDB 初始化失败!') |
| | |
| | | /** |
| | | * @description 获取或修改系统配置,增加appkey |
| | | */ |
| | | getSystemFuncs (time) { |
| | | let param = { |
| | | func: 's_get_func_base_sso', |
| | | update_date: time, |
| | | userid: sessionStorage.getItem('UserID') || '', |
| | | lang: sessionStorage.getItem('lang') || '', |
| | | SessionUid: localStorage.getItem('SessionUid') || '', |
| | | LoginUID: sessionStorage.getItem('LoginUID') || '', |
| | | appkey: window.GLOB.appkey |
| | | } |
| | | // getSystemFuncs (time) { |
| | | // let param = { |
| | | // func: 's_get_func_base_sso', |
| | | // update_date: time, |
| | | // userid: sessionStorage.getItem('UserID') || '', |
| | | // lang: sessionStorage.getItem('lang') || '', |
| | | // SessionUid: localStorage.getItem('SessionUid') || '', |
| | | // LoginUID: sessionStorage.getItem('LoginUID') || '', |
| | | // appkey: window.GLOB.appkey |
| | | // } |
| | | |
| | | let url = window.GLOB.mainSystemApi || '/webapi/dostars' |
| | | param = this.encryptParam(param) |
| | | // let url = window.GLOB.mainSystemApi || '/webapi/dostars' |
| | | // param = this.encryptParam(param) |
| | | |
| | | return axios({ |
| | | url: `${url}/${param.func}`, |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | // return axios({ |
| | | // url: `${url}/${param.func}`, |
| | | // method: 'post', |
| | | // data: JSON.stringify(param) |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 获取或修改系统配置,增加appkey |
| | |
| | | logout = () => { |
| | | const { dict } = this.state |
| | | // 退出登录 |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | title: dict['logout_query'] || '您确定要退出吗?', |
| | | content: '', |
| | |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.history.replace('/login') |
| | | that.props.history.replace('/login') |
| | | window.location.reload() |
| | | }, |
| | | onCancel() {} |
| | |
| | | cell.$ctrls = cell.$ctrls || [] |
| | | cell.$ctrls.push(key) |
| | | |
| | | if (cell.hidden) return |
| | | |
| | | if (cell.skip && supItem.forbid) { // 上级表单禁用时,此表单不受控制 |
| | | |
| | | if (cell.hidden) { |
| | | |
| | | } else if (supItem.hidden) { |
| | | cell.hidden = true |
| | | } else if (item.notNull) { |
| | |
| | | GLOB.memberLevel = 0 |
| | | } |
| | | |
| | | if (config.devTools === false) { |
| | | if (config.systemRun === 'backend') { |
| | | Object.defineProperty(window, 'backend', { |
| | | writable: false, |
| | | value: true |
| | | }) |
| | | } |
| | | if (config.debugger === 'forbid') { |
| | | sessionStorage.removeItem('breakpoint') |
| | | GLOB.debugger = false |
| | | |
| | | let getVal = () => { |
| | | let _i = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight |
| | | let _h = window.outerHeight - _i - 200 |
| | | let _w = window.outerWidth - window.innerWidth - 100 |
| | | |
| | | return Math.max(_h, _w) |
| | | } |
| | | |
| | | if (getVal() > 0) { |
| | | document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">本系统禁止使用控制台,请关闭控制台重新刷新!</div>' |
| | | return |
| | | } else { |
| | | let timer = null |
| | | window.addEventListener('resize', () => { |
| | | timer && clearTimeout(timer) |
| | | |
| | | if (getVal() > 0) { |
| | | timer = setTimeout(() => { |
| | | document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">本系统禁止使用控制台,请关闭控制台重新刷新!</div>' |
| | | }, 100) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (GLOB.sysType === 'cloud') { |
| | | Object.defineProperty(GLOB, 'debugger', { |
| | | writable: false, |
| | | value: GLOB.debugger |
| | | }) |
| | | } else if (GLOB.sysType === 'cloud') { |
| | | Object.defineProperty(GLOB, 'debugger', { |
| | | writable: false, |
| | | value: GLOB.debugger |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { elements } = this.state |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除元素吗?', |
| | | onOk() { |
| | | let _elements = elements.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | elements: _elements |
| | | }, () => { |
| | | _this.props.updateElement(_elements) |
| | | that.props.updateElement(_elements) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | controlFields: subtype === 'propcard' ? [ |
| | | {field: 'goback', values: ['dynamic', 'public']}, |
| | | {field: 'empty', values: ['dynamic', 'public']}, |
| | | {field: 'jump', values: ['dynamic', 'public']}, |
| | |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | {field: 'emptyExec', values: ['dynamic', 'public']}, |
| | | ], |
| | | ] : null, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | {value: 'normal', label: '正常显示'}, |
| | | {value: 'hidden', label: '不可见'}, |
| | | ], |
| | | controlFields: [ |
| | | controlFields: subtype === 'propcard' ? [ |
| | | {field: 'empty', values: ['normal']}, |
| | | ], |
| | | ] : null, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | ], |
| | | controlFields: [ |
| | | controlFields: subtype === 'propcard' ? [ |
| | | {field: 'empty', values: ['dynamic']}, |
| | | ], |
| | | ] : null, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | this.updateComponent(_card) |
| | | } else { |
| | | let _card = fromJS(card).toJS() |
| | | |
| | | if (_card.wrap.firstTr === 'light') { |
| | | _card.wrap.tbStyle = 'th-light' |
| | | delete _card.wrap.firstTr |
| | | } |
| | | |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | card: _card |
| | | }) |
| | | } |
| | | } |
| | |
| | | updateWrap = (res) => { |
| | | const { card } = this.state |
| | | |
| | | if (res.tbStyle) { |
| | | res.tbStyle = res.tbStyle.join(' ') |
| | | } |
| | | |
| | | let _card = {...card, wrap: res} |
| | | |
| | | if (res.datatype === 'public') { |
| | |
| | | let style = {...card.style} |
| | | |
| | | return ( |
| | | <div className={'menu-normal-editor-box ' + (card.wrap.firstTr || '')} style={style} onClick={this.clickComponent} id={card.uuid}> |
| | | <div className={'menu-normal-editor-box ' + (card.wrap.tbStyle || '')} style={style} onClick={this.clickComponent} id={card.uuid}> |
| | | <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <NormalForm title="富文本设置" width={750} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <NormalForm title="富文本设置" width={850} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="editor" card={card}/> |
| | |
| | | color: #bcbcbc; |
| | | } |
| | | } |
| | | .menu-normal-editor-box.light { |
| | | .menu-normal-editor-box.th-light { |
| | | .braft-content { |
| | | table { |
| | | tr:first-child { |
| | | background-color:#ffffff; |
| | | background-color:transparent; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .menu-normal-editor-box.no-border { |
| | | .braft-content { |
| | | table { |
| | | td, th { |
| | | border: none!important; |
| | | } |
| | | tr td:first-child { |
| | | padding-left: 0px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .menu-normal-editor-box.tb-flex { |
| | | .braft-content { |
| | | table { |
| | | table-layout: fixed; |
| | | } |
| | | } |
| | | } |
| | | .menu-normal-editor-box::after { |
| | | display: block; |
| | | content: ' '; |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'firstTr', |
| | | label: '表格首行', |
| | | initval: wrap.firstTr || 'deep', |
| | | tooltip: '富文本中table的首行背景颜色。', |
| | | type: 'checkbox', |
| | | field: 'tbStyle', |
| | | label: '表格样式', |
| | | initval: wrap.tbStyle ? wrap.tbStyle.split(' ') : [], |
| | | required: false, |
| | | options: [ |
| | | {value: 'deep', label: '深色'}, |
| | | {value: 'light', label: '浅色'}, |
| | | {value: 'th-light', label: '表头透明'}, |
| | | {value: 'no-border', label: '无边框'}, |
| | | {value: 'tb-flex', label: '列等宽'}, |
| | | ] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'firstTr', |
| | | // label: '表格首行', |
| | | // initval: wrap.firstTr || 'deep', |
| | | // tooltip: '富文本中table的首行背景颜色。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'deep', label: '深色'}, |
| | | // {value: 'light', label: '浅色'}, |
| | | // ] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | |
| | | |
| | | changecols = (type) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | card.subcards[0].fields = card.subcards[0].fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | confirm({ |
| | | content: `确定切换为${type}列吗?`, |
| | | onOk() { |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | closeForm = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | card.subcards[0].fields = card.subcards[0].fields.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${cell.label}>>吗?`, |
| | | onOk() { |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | clearGroup = () => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | card.subcards[0].fields = [] |
| | | |
| | | confirm({ |
| | | content: `确定清空表单吗?`, |
| | | onOk() { |
| | | _this.updateComponent(card) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | closeGroup = (cell) => { |
| | | const { group } = this.state |
| | | let card = fromJS(this.state.card).toJS() |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除分组吗?', |
| | |
| | | _group = card.subcards[0] || null |
| | | } |
| | | |
| | | _this.setState({group: _group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group: _group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | changecols = (type) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let config = fromJS(this.state.group).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({group: config}) |
| | | _this.updateComponent(card) |
| | | that.setState({group: config}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeForm = (cell) => { |
| | | let group = fromJS(this.state.group).toJS() |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | group.fields = group.fields.filter(item => item.uuid !== cell.uuid) |
| | | |
| | |
| | | confirm({ |
| | | content: `确定删除<<${cell.label}>>吗?`, |
| | | onOk() { |
| | | _this.setState({group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | clearGroup = () => { |
| | | let group = fromJS(this.state.group).toJS() |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | group.fields = [] |
| | | |
| | |
| | | confirm({ |
| | | content: `确定清空表单吗?`, |
| | | onOk() { |
| | | _this.setState({group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | closeGroup = (cell) => { |
| | | const { group } = this.state |
| | | let card = fromJS(this.state.card).toJS() |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除分组吗?', |
| | |
| | | _group = card.subcards[0] || null |
| | | } |
| | | |
| | | _this.setState({group: _group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group: _group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | changecols = (type) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let config = fromJS(this.state.group).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({group: config}) |
| | | _this.updateComponent(card) |
| | | that.setState({group: config}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeForm = (cell) => { |
| | | let group = fromJS(this.state.group).toJS() |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | group.fields = group.fields.filter(item => item.uuid !== cell.uuid) |
| | | |
| | |
| | | confirm({ |
| | | content: `确定删除<<${cell.label}>>吗?`, |
| | | onOk() { |
| | | _this.setState({group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | clearGroup = () => { |
| | | let group = fromJS(this.state.group).toJS() |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | group.fields = [] |
| | | |
| | |
| | | confirm({ |
| | | content: `确定清空表单吗?`, |
| | | onOk() { |
| | | _this.setState({group}) |
| | | _this.updateComponent(card) |
| | | that.setState({group}) |
| | | that.updateComponent(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | if (group.components.length === 0) return |
| | | |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | title: '确定释放分组元素吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.props.unGroup(group.uuid) |
| | | that.props.unGroup(group.uuid) |
| | | |
| | | setTimeout(() => { |
| | | _this.updataGroup() |
| | | that.updataGroup() |
| | | }, 10) |
| | | }, |
| | | onCancel() {} |
| | |
| | | </>) |
| | | } |
| | | |
| | | let labelwidth = card.labelwidth || 33.3 |
| | | if (card.labelShow === 'false') { |
| | | labelwidth = 0 |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | |
| | | <div className={'page-card ' + (card.labelShow === 'false' ? 'label-hide ' : '') + card.type + (card.advanced === 'true' ? ' advanced' : '') + (card.query === 'false' ? ' no-query' : '')} style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | <Form.Item |
| | | labelCol={{xs: { span: 24 }, sm: { span: 8 }}} |
| | | wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} |
| | | labelCol={{style: {width: labelwidth + '%'}}} |
| | | wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} |
| | | label={card.labelShow !== 'false' ? card.label : ''} |
| | | required={card.required === 'true'} |
| | | help={card.field + (card.datefield ? ', ' + card.datefield : '') + (card.advanced === 'true' ? '(高级搜索)' : '')} |
| | |
| | | * @description 搜索条件删除 |
| | | */ |
| | | deleteElement = (cell) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${cell.label} ?`, |
| | | onOk() { |
| | | let _card = fromJS(_this.state.card).toJS() |
| | | let _card = fromJS(that.state.card).toJS() |
| | | _card.search = _card.search.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.updateComponent(_card) |
| | | that.updateComponent(_card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | .ant-form-item { |
| | | position: relative; |
| | | margin-bottom: 0px; |
| | | .ant-form-item-label { |
| | | float: left; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | float: left; |
| | | .ant-select { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | |
| | | if (this.record.openmenu && this.record.openmenu !== 'goback') { |
| | | shows.push('open') |
| | | } |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | |
| | |
| | | if (this.record.execSuccess === 'goback') { |
| | | shows.push('reload') |
| | | } |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | |
| | |
| | | } else { |
| | | shows.push('database') |
| | | } |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | } else if (openType === 'excelOut') { |
| | |
| | | } else { |
| | | shows.push('database') |
| | | } |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | if (this.record.Ot !== 'notRequired' && appType === 'mob') { |
| | |
| | | shows.push('innerFunc', 'extraParam') |
| | | reRequired.innerFunc = true |
| | | } |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | if (this.record.execMode === 'pop' || this.record.execMode === 'prompt') { |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${card.label} ?`, |
| | | onOk() { |
| | | let _actionlist = fromJS(_this.state.actionlist).toJS() |
| | | let _actionlist = fromJS(that.state.actionlist).toJS() |
| | | |
| | | _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | _this.props.updateaction({...config, action: _actionlist}) |
| | | that.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | _config.colsCtrls = colsCtrls |
| | | |
| | | if (this.customForm && this.customForm.state.editItem) { |
| | | const _this = this |
| | | const that = this |
| | | let title = '存在未保存项,确定忽略吗?' |
| | | if (s.length > 0) { |
| | | title = `存在未保存项,且第 ${s.join('、')} 行中字段在搜索条件中不存在,确定忽略吗?` |
| | |
| | | confirm({ |
| | | title: title, |
| | | onOk() { |
| | | _this.setState({ visible: false }) |
| | | _this.props.onSubmit(_config) |
| | | that.setState({ visible: false }) |
| | | that.props.onSubmit(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (s.length > 0) { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | title: `第 ${s.join('、')} 行中字段在搜索条件中不存在,确定忽略吗?`, |
| | | onOk() { |
| | | _this.setState({ visible: false }) |
| | | _this.props.onSubmit(_config) |
| | | that.setState({ visible: false }) |
| | | that.props.onSubmit(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | }) |
| | | this.props.onSubmit(marks) |
| | | } else { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | title: '存在未保存标记,确定忽略吗?', |
| | | onOk() { |
| | | _this.setState({ visible: false }) |
| | | _this.props.onSubmit(marks) |
| | | that.setState({ visible: false }) |
| | | that.props.onSubmit(marks) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${card.label} ?`, |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | let _searchlist = fromJS(that.state.searchlist).toJS() |
| | | |
| | | _searchlist = _searchlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | searchlist: _searchlist |
| | | }, () => { |
| | | _this.props.updatesearch({...config, search: _searchlist}) |
| | | that.props.updatesearch({...config, search: _searchlist}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | class HeaderCol extends Component { |
| | | deleteCol = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除显示列吗?', |
| | | onOk() { |
| | | _this.props.deleteCol(_this.props.column) |
| | | that.props.deleteCol(that.props.column) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | {value: 'small', label: '小'}, |
| | | ], |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'selected', |
| | | // label: '首行选中', |
| | | // initval: wrap.selected || 'false', |
| | | // tooltip: '当按钮执行完成并返回主键值时,默认选中主键值对应行。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'false', label: '无'}, |
| | | // {value: 'init', label: '初始化'}, |
| | | // {value: 'always', label: '数据加载'}, |
| | | // ] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'tableMode', |
| | |
| | | |
| | | class HeaderCol extends Component { |
| | | deleteCol = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除显示列吗?', |
| | | onOk() { |
| | | _this.props.deleteCol(_this.props.column) |
| | | that.props.deleteCol(that.props.column) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | columns.push(cell) |
| | | }) |
| | | |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定同步字段集吗?', |
| | | onOk() { |
| | | _this.setState({columns}, () => { |
| | | _this.props.updatecolumn({..._this.props.config, cols: columns}) |
| | | that.setState({columns}, () => { |
| | | that.props.updatecolumn({...that.props.config, cols: columns}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定清空显示列吗?', |
| | | onOk() { |
| | | _this.setState({columns: []}, () => { |
| | | _this.props.updatecolumn({..._this.props.config, cols: []}) |
| | | that.setState({columns: []}, () => { |
| | | that.props.updatecolumn({...that.props.config, cols: []}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | sql = sql.replace(/@datam@/ig, `''`) |
| | | sql = sql.replace(/@typename@/ig, `'debug'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | | <Form.Item label="可用字段"> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, lang, time_id</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, lang, typename, datam, 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) |
| | | </Form.Item> |
| | |
| | | |
| | | class HeaderCol extends Component { |
| | | deleteCol = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除显示列吗?', |
| | | onOk() { |
| | | _this.props.deleteCol(_this.props.column) |
| | | that.props.deleteCol(that.props.column) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | columns.push(cell) |
| | | }) |
| | | |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定同步字段集吗?', |
| | | onOk() { |
| | | _this.setState({columns}, () => { |
| | | _this.props.updatecolumn({..._this.props.config, cols: columns}) |
| | | that.setState({columns}, () => { |
| | | that.props.updatecolumn({...that.props.config, cols: columns}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定清空显示列吗?', |
| | | onOk() { |
| | | _this.setState({columns: []}, () => { |
| | | _this.props.updatecolumn({..._this.props.config, cols: []}) |
| | | that.setState({columns: []}, () => { |
| | | that.props.updatecolumn({...that.props.config, cols: []}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | delTab = (tab) => { |
| | | let tabs = fromJS(this.state.tabs).toJS() |
| | | const _this = this |
| | | const that = this |
| | | |
| | | tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) |
| | | |
| | |
| | | title: '确定删除标签?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({tabs}) |
| | | _this.props.updateConfig(tabs) |
| | | that.setState({tabs}) |
| | | that.props.updateConfig(tabs) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | delTab = (tab) => { |
| | | let tabs = fromJS(this.state.tabs).toJS() |
| | | const _this = this |
| | | const that = this |
| | | |
| | | tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) |
| | | |
| | |
| | | title: '确定删除标签?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({tabs}) |
| | | _this.props.updateConfig(tabs) |
| | | that.setState({tabs}) |
| | | that.props.updateConfig(tabs) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | initval: wrap.empty || 'show', |
| | | tooltip: '当查询数据为空时,隐藏该组件。', |
| | | required: false, |
| | | skip: true, |
| | | options: [ |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | |
| | | let maxScript = 0 |
| | | let useExec = false |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | if (res.setting.dataresource) { |
| | | res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | let sFields = [] |
| | | res.searches && res.searches.forEach(item => { |
| | | if (!item.key) return |
| | | |
| | | if (item.type === 'date') { |
| | | if (sFields.includes(item.key)) { |
| | | sFields.push(item.key + '1') |
| | | } else { |
| | | sFields.push(item.key) |
| | | } |
| | | res.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | |
| | | if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | useExec = true |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | } else if (item.type === 'dateweek' || item.type === 'range' || (item.type === 'datemonth' && item.match !== '=')) { |
| | | sFields.push(item.key) |
| | | sFields.push(item.key + '1') |
| | | } else if (item.type === 'daterange') { |
| | | if (/,/.test(item.key)) { |
| | | sFields.push(item.key.split(',')[0]) |
| | | sFields.push(item.key.split(',')[1]) |
| | | } else { |
| | | sFields.push(item.key) |
| | | sFields.push(item.key + '1') |
| | | } |
| | | } else if (item.type === 'text' || item.type === 'select') { |
| | | item.key.split(',').forEach(field => { |
| | | sFields.push(field) |
| | | }) |
| | | }) |
| | | } else { |
| | | res.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | } else { |
| | | sFields.push(item.key) |
| | | } |
| | | }) |
| | | delete res.searches |
| | | sFields = sFields.join('|') |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | useExec = true |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | // if (res.setting.dataresource) { |
| | | // res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // } |
| | | // res.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | |
| | | // if (item.status === 'false') return |
| | | |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // useExec = true |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } else { |
| | | // res.scripts.forEach(item => { |
| | | // if (item.status === 'false') return |
| | | |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // useExec = true |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | if (res.setting.interType === 'system' && res.setting.dataresource && res.setting.execute !== 'false' && sFields) { |
| | | if (new RegExp(`@(${sFields})@`, 'ig').test(res.setting.dataresource)) { |
| | | maxScript = 1000 |
| | | } |
| | | } |
| | | |
| | | res.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | useExec = true |
| | | maxScript = 1000 |
| | | } else if (sFields && new RegExp(`@(${sFields})@`, 'ig').test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | |
| | | res.setting.maxScript = maxScript |
| | | |
| | | if (useExec && res.setting.sync === 'true') { |
| | |
| | | let _setting = fromJS(config.setting).toJS() |
| | | let scripts = config.scripts ? fromJS(config.scripts).toJS() : [] |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | if (_setting.dataresource) { |
| | | _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | } |
| | | scripts && scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | // if (_setting.dataresource) { |
| | | // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // } |
| | | // scripts && scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | let columns = config.columns ? fromJS(config.columns).toJS() : [] |
| | | let subColumns = config.subColumns ? fromJS(config.subColumns).toJS() : [] |
| | |
| | | |
| | | submitDataSource = () => { |
| | | const { config, mainSearch } = this.props |
| | | const { activeKey, setting, columns, subColumns, scripts, cols, median } = this.state |
| | | const { activeKey, setting, columns, subColumns, scripts, cols, median, searches } = this.state |
| | | |
| | | if (config.subtype === 'dualdatacard') { |
| | | let arr = columns.map(col => col.field.toLowerCase()) |
| | |
| | | if (res.useMSearch === 'true') { // 使用主搜索条件 |
| | | search = [...search, ...mainSearch] |
| | | } |
| | | let _searches = formatSearch(search) |
| | | |
| | | this.setState({ |
| | | searches: formatSearch(search), |
| | | searches: _searches, |
| | | setting: res |
| | | }, () => { |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }) }, reject, 'submit') |
| | | }) |
| | | }, () => { |
| | | reject() |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } else if (activeKey === 'subcolumns') { |
| | | if (this.subdatasource && this.subdatasource.state.editingKey) { |
| | | notification.warning({ |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } else if (activeKey === 'scripts') { |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } |
| | | }) |
| | | } |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | let regs = [ |
| | | // {reg: /@time_id@/ig, value: `'${getuuid()}'`}, // 计算md5后替换 |
| | |
| | | {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey}'`}, |
| | | {reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`}, |
| | | {reg: /@\$|\$@/ig, value: ''}, |
| | | {reg: /@select\$|\$select@/ig, value: ''}, |
| | | {reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | // {reg: /@select\$|\$select@/ig, value: ''}, |
| | | // {reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | ] |
| | | |
| | | if (window.GLOB.process && type !== 'invoice') { |
| | |
| | | } |
| | | |
| | | if (hasExtend) { |
| | | regs.push({reg: /@mk_time@/ig, value: '2024-04-29 17:20:00'}) |
| | | regs.push({reg: /@mk_time@/ig, value: `'2024-04-29 17:20:00'`}) |
| | | } |
| | | if (type === 'calendar') { |
| | | regs.push({reg: /@mk_year@/ig, value: '2024'}) |
| | | regs.push({reg: /@mk_year@/ig, value: `'2024'`}) |
| | | } |
| | | if (window.GLOB.getLocation) { |
| | | regs.push( |
| | |
| | | if (process) { |
| | | regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) |
| | | } |
| | | |
| | | let _mainSearch = [] |
| | | |
| | | if (sessionStorage.getItem('appType') === 'mob') { |
| | | let search = [] |
| | | let ms = null |
| | | config.components.forEach(item => { |
| | | if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { |
| | | ms = item.search |
| | | } else if (item.type === 'search' && item.wrap.field) { |
| | | search.push({ |
| | | type: 'text', |
| | | label: item.wrap.label, |
| | | field: item.wrap.field, |
| | | match: item.wrap.match, |
| | | required: item.wrap.required, |
| | | value: item.wrap.initval || '' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (ms) { |
| | | if (ms.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | label: '搜索栏', |
| | | field: ms.setting.field, |
| | | match: ms.setting.match, |
| | | required: ms.setting.required, |
| | | value: ms.setting.initval || '' |
| | | }) |
| | | } |
| | | search.push(...ms.fields) |
| | | |
| | | ms.groups.forEach(group => { |
| | | if (group.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | label: group.wrap.name, |
| | | field: group.setting.field, |
| | | match: group.setting.match, |
| | | required: group.setting.required, |
| | | value: group.setting.initval || '' |
| | | }) |
| | | } |
| | | search.push(...group.fields) |
| | | }) |
| | | } |
| | | |
| | | if (search.length > 0) { |
| | | _mainSearch = search |
| | | } |
| | | } else { |
| | | config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | _mainSearch = component.search || [] |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces && config.interfaces.length > 0) { |
| | | config.interfaces.forEach(m => { |
| | | if (m.status !== 'true' || m.setting.interType !== 'system') return false |
| | | |
| | | let sql = this.formatDataSource(m, regs) |
| | | m.setting.laypage = 'false' |
| | | m.setting.$top = true |
| | | |
| | | let sql = this.formatDataSource(m, regs, _mainSearch) |
| | | |
| | | this.sqlList.push({label: m.setting.name, children: [{label: '数据源', sql: sql}]}) |
| | | }) |
| | | } |
| | | |
| | | this.filterComponent(config.components, [], regs, process) |
| | | this.filterComponent(config.components, _mainSearch, regs, process) |
| | | |
| | | let sqls = [] |
| | | let foreachSql = (list, name, tabName = '', supName = '') => { |
| | |
| | | |
| | | filterComponent = (components, mainSearch, regs, process, ispop = false) => { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let _mainSearch = mainSearch || [] |
| | | |
| | | if (appType === 'mob') { |
| | | let search = [] |
| | | let ms = null |
| | | components.forEach(item => { |
| | | if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { |
| | | ms = item.search |
| | | } else if (item.type === 'search' && item.wrap.field) { |
| | | search.push({ |
| | | type: 'text', |
| | | label: item.wrap.label, |
| | | field: item.wrap.field, |
| | | match: item.wrap.match, |
| | | required: item.wrap.required, |
| | | value: item.wrap.initval || '' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (ms) { |
| | | if (ms.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | label: '搜索栏', |
| | | field: ms.setting.field, |
| | | match: ms.setting.match, |
| | | required: ms.setting.required, |
| | | value: ms.setting.initval || '' |
| | | }) |
| | | } |
| | | search.push(...ms.fields) |
| | | |
| | | ms.groups.forEach(group => { |
| | | if (group.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | label: group.wrap.name, |
| | | field: group.setting.field, |
| | | match: group.setting.match, |
| | | required: group.setting.required, |
| | | value: group.setting.initval || '' |
| | | }) |
| | | } |
| | | search.push(...group.fields) |
| | | }) |
| | | } |
| | | |
| | | if (search.length > 0) { |
| | | _mainSearch = search |
| | | } |
| | | } else { |
| | | components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | _mainSearch = component.search || [] |
| | | }) |
| | | } |
| | | |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | let _mainSearch = mainSearch || [] |
| | | |
| | | if (appType !== 'mob') { |
| | | tab.components.forEach(com => { |
| | | if (com.type !== 'search') return |
| | | |
| | | _mainSearch = com.search || [] |
| | | }) |
| | | } |
| | | this.filterComponent(tab.components, _mainSearch, regs, process) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | this.filterComponent(item.components, _mainSearch, regs, process) |
| | | this.filterComponent(item.components, mainSearch, regs, process) |
| | | } else { |
| | | let children = [] |
| | | if (item.wrap && item.setting) { |
| | |
| | | } |
| | | |
| | | if (item.setting && item.setting.interType === 'system') { |
| | | let sql = this.formatDataSource(item, regs, _mainSearch) |
| | | if (item.format === 'object') { |
| | | item.setting.laypage = 'false' |
| | | item.setting.$top = true |
| | | } |
| | | |
| | | let sql = this.formatDataSource(item, regs, mainSearch) |
| | | |
| | | children.push({label: '数据源', sql: sql}) |
| | | } else if (item.setting && item.setting.useMSearch === 'true') { |
| | | let searches = item.search || [] |
| | | if (_mainSearch.length > 0) { |
| | | searches = [...searches, ..._mainSearch] |
| | | if (mainSearch.length > 0) { |
| | | searches = [...searches, ...mainSearch] |
| | | } |
| | | item.$searches = fromJS(searches).toJS() |
| | | } |
| | |
| | | if (process) { |
| | | regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) |
| | | } |
| | | this.filterComponent(cell.config.components, [], regs, process, true) |
| | | |
| | | let _mainSearch = [] |
| | | |
| | | if (sessionStorage.getItem('appType') === 'mob') { |
| | | cell.config.components.forEach(item => { |
| | | if (item.type === 'search' && item.wrap.field) { |
| | | _mainSearch.push({ |
| | | type: 'text', |
| | | label: item.wrap.label, |
| | | field: item.wrap.field, |
| | | match: item.wrap.match, |
| | | required: item.wrap.required, |
| | | value: item.wrap.initval || '' |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | cell.config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | _mainSearch = component.search || [] |
| | | }) |
| | | } |
| | | |
| | | this.filterComponent(cell.config.components, _mainSearch, regs, process, true) |
| | | |
| | | if (this.sqlPopList.length) { |
| | | sql = fromJS(this.sqlPopList).toJS() |
| | |
| | | } |
| | | }) |
| | | |
| | | if (!_prev) return '' |
| | | if (!_prev) return _back |
| | | |
| | | let tbs = [] |
| | | _prev.replace(/\n|\r/g, ' ').split(/\sdeclare\s/ig).forEach(line => { |
| | |
| | | let BID = Utils.getuuid() |
| | | let verify = btn.verify || {} |
| | | let _actionType = null |
| | | let setting = component.setting |
| | | let setting = component.setting || {} |
| | | let columns = component.columns || [] |
| | | |
| | | if (verify.invalid === 'true') { |
| | | if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { |
| | | verify.invalid = 'false' |
| | | } else if (setting.maxScript && setting.maxScript >= 300) { |
| | | verify.invalid = 'false' |
| | | } else if (!setting.dataresource) { |
| | | verify.invalid = 'false' |
| | | } else if (btn.intertype !== 'system' && btn.procMode !== 'system') { |
| | | verify.invalid = 'false' |
| | | } else if (btn.sqlType === 'insert') { |
| | | verify.invalid = 'false' |
| | | } else if (btn.Ot === 'notRequired') { |
| | | verify.invalid = 'false' |
| | | } |
| | | } |
| | | if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce') { |
| | | if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { |
| | | verify.uniques = [] |
| | | } |
| | | } |
| | | |
| | | if (verify.default !== 'false') { // 判断是否使用默认sql |
| | | _actionType = btn.sqlType |
| | |
| | | }) |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (btn.Ot !== 'notRequired' && columns && columns.length > 0) { |
| | | const setField = (col) => { |
| | | if (btn.Ot !== 'notRequired' && columns.length > 0) { |
| | | columns.forEach(col => { |
| | | if (!col.field) return |
| | | let _key = col.field.toLowerCase() |
| | | |
| | |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (col.datatype) { |
| | | _declarefields.push(`@${_key} ${col.datatype}`) |
| | | } else { |
| | | if (col.fieldlength && col.fieldlength > 4000) { |
| | | col.fieldlength = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${col.fieldlength || 50})` |
| | | |
| | | if (col.type === 'number') { |
| | | let _length = col.decimal ? col.decimal : 0 |
| | | _type = `decimal(18,${_length})` |
| | | } else if (col.type === 'picture' || col.type === 'textarea') { |
| | | _type = `nvarchar(${col.fieldlength || 512})` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | } |
| | | } |
| | | |
| | | columns.forEach(col => { |
| | | if (col.type === 'colspan' || col.type === 'old_colspan') { |
| | | col.subcols.forEach(cell => { |
| | | setField(cell) |
| | | }) |
| | | } else { |
| | | setField(col) |
| | | _declarefields.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | // 失效验证,添加数据时不用 |
| | | if (btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && verify.invalid === 'true' && setting.dataresource) { |
| | | if (verify.invalid === 'true') { |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | let orderBy = setting.order |
| | | |
| | | let regoptions = [{ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${userName}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${fullName}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order || primaryKey |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 1 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }] |
| | | |
| | | if (setting.queryType === 'statistics' || customScript) { |
| | | let searches = formatSearch(component.$searches || []) |
| | | let regoptions = getSearchRegs(searches) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${userName}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${fullName}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: orderBy |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 999999 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | } |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (customScript) { |
| | | _sql += ` |
| | |
| | | |
| | | if (!keys.includes(_key)) return // 表单中不含单号生成字段 |
| | | |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | let _val = '' |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _val = BID |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` |
| | | } else { |
| | | _val = 0 |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` |
| | | } |
| | | _ModularDetailCode = `'${item.TypeCharOne + _val}'` |
| | | } else { |
| | | _ModularDetailCode = `'${item.ModularDetailCode}'` |
| | | } |
| | | |
| | | let _declare = '' |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | | _vars.push(_key) |
| | | _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` |
| | | } |
| | | |
| | | _billcodesSql += ` |
| | | /* 单号生成 */ |
| | | ${_declare} |
| | | select @BillCode='', @${_key}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=${_ModularDetailCode}, |
| | | @ModularDetailCode=@ModularDetailCode, |
| | | @Type=${item.Type}, |
| | | @TypeCharOne='${item.TypeCharOne}', |
| | | @TypeCharTwo ='${item.TypeCharTwo}', |
| | |
| | | _value.push(`${_labels[index] || ''}:${_val || ''}`) |
| | | }) |
| | | |
| | | let _verifyType = '' |
| | | if (item.verifyType === 'logic') { |
| | | _verifyType = ' and deleted=0' |
| | | } |
| | | |
| | | if (!arr.includes(primaryKey.toLowerCase())) { |
| | | _fieldValue.push(`${primaryKey} !='${primaryId}'`) |
| | | } |
| | |
| | | _sql += ` |
| | | /* 唯一性验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType} |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在' |
| | |
| | | if (columns && columns.length > 0 && btn.Ot !== 'notRequired') { |
| | | let _index = 0 |
| | | columns.forEach(col => { |
| | | if (!col.field || col.Hide === 'true' || _index >= 4) return |
| | | if (!col.field || col.Hide === 'true' || _index >= 4 || col.field === primaryKey) return |
| | | _msg += col.label + '=0,' |
| | | _index++ |
| | | }) |
| | |
| | | if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | | |
| | | _sql = _sql.replace(/@start_type@/ig, `'开始'`) |
| | | _sql = _sql.replace(/@check_type@/ig, `'审核'`) |
| | | _sql = _sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | _sql = _sql.replace(/@check_userids@/ig, `''`) |
| | | _sql = _sql.replace(/@notice_userids@/ig, `''`) |
| | | _sql = _sql.replace(/@works_flow_sign@/ig, `''`) |
| | | |
| | | _sql = _sql.replace(/@works_flow_code@/ig, `'mk'`) |
| | | _sql = _sql.replace(/@works_flow_name@/ig, `'mk'`) |
| | | _sql = _sql.replace(/@works_flow_param@/ig, `''`) |
| | |
| | | _sql = _sql.replace(/@statusname@/ig, `'${statusName}'`) |
| | | _sql = _sql.replace(/@work_group@/ig, `'mk'`) |
| | | _sql = _sql.replace(/@work_grade@/ig, `'0'`) |
| | | |
| | | if (verify.flowType === 'start') { |
| | | _sql = _sql.replace(/@start_type@/ig, `'开始'`) |
| | | } else { |
| | | _sql = _sql.replace(/@check_type@/ig, `'审核'`) |
| | | _sql = _sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | |
| | | _sql = _sql.replace(/@check_userids@/ig, `''`) |
| | | _sql = _sql.replace(/@notice_userids@/ig, `''`) |
| | | |
| | | _sql = _sql.replace(/@works_flow_sign@/ig, `''`) |
| | | } |
| | | } else if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | |
| | | |
| | | formatDataSource = (item, regs, mainSearch = []) => { |
| | | if (!item.setting || item.setting.interType !== 'system') return false |
| | | |
| | | |
| | | let searches = item.search || [] |
| | | if (item.setting.useMSearch === 'true' && mainSearch.length > 0) { |
| | | searches = [...searches, ...mainSearch] |
| | |
| | | _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } else if (item.setting.laypage === 'true' && item.setting.order) { |
| | | _dataresource = `/*system_query*/select top 10 ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${item.setting.order}) as rows from ${_dataresource} ${_search}) tmptable where rows > 0 order by tmptable.rows ` |
| | | } else if (item.setting.$top) { |
| | | if (item.setting.order) { |
| | | _dataresource = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by ${item.setting.order} ` |
| | | } else { |
| | | _dataresource = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } else if (item.setting.order) { |
| | | _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${item.setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by ${item.setting.order} ` |
| | | } else { |
| | | _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | |
| | | ) |
| | | |
| | | if (item.hasExtend) { |
| | | regoptions.push({reg: /@mk_time@/ig, value: '2024-04-29 17:20:00'}) |
| | | regoptions.push({reg: /@mk_time@/ig, value: `'2024-04-29 17:20:00'`}) |
| | | } |
| | | if (item.type === 'calendar') { |
| | | regoptions.push({ reg: /@mk_year@/ig, value: '2024' }) |
| | | regoptions.push({ reg: /@mk_year@/ig, value: `'2024'` }) |
| | | } |
| | | if (window.GLOB.getLocation) { |
| | | regoptions.push( |
| | |
| | | destroyOnClose |
| | | > |
| | | <div className="mk-sql-wrap"> |
| | | {/* <div className="header"> |
| | | <div className="sql-item"> |
| | | <div className="sql-1">组件</div> |
| | | <div className="sql-2">检验项</div> |
| | | <div className="sql-3">其他</div> |
| | | <div className="sql-4">状态</div> |
| | | </div> |
| | | </div> */} |
| | | <div className="body"> |
| | | {sqlList.map(item => { |
| | | let other = '' |
| | |
| | | * @description 表单删除并刷新 |
| | | */ |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除${card.label ? `<<${card.label}>>` : ''}吗?`, |
| | | onOk() { |
| | | let _config = fromJS(_this.state.config).toJS() |
| | | let _config = fromJS(that.state.config).toJS() |
| | | _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | config: _config, |
| | | }) |
| | | }, |
| | |
| | | } |
| | | |
| | | clearConfig = () => { |
| | | const _this = this |
| | | const that = this |
| | | let _config = {...this.state.config, fields: []} |
| | | |
| | | confirm({ |
| | | content: '确定清空表单吗?', |
| | | onOk() { |
| | | _this.setState({ config: _config }) |
| | | that.setState({ config: _config }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | content: '配置信息未保存,确定返回吗?', |
| | | onOk() { |
| | | _this.props.handleBack() |
| | | that.props.handleBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | changecols = (type) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | confirm({ |
| | | content: `确定切换为${type}列吗?`, |
| | | onOk() { |
| | | _this.setState({config}) |
| | | that.setState({config}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | <div> |
| | | <PasteForms type="toolbar" config={config} update={this.pasteFields}/> |
| | | <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>保存</Button> |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | <Button disabled={saving} onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <SettingOutlined onClick={this.changeSetting} /> |
| | |
| | | } |
| | | |
| | | deleteSource = (item) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定删除吗?', |
| | |
| | | if (res.status) { |
| | | if (item.typecharone === 'image') { |
| | | window.GLOB.app_pictures = res.data || [] |
| | | _this.resetPicture(res.data || []) |
| | | that.resetPicture(res.data || []) |
| | | } else if (item.typecharone === 'video') { |
| | | window.GLOB.app_videos = res.data || [] |
| | | _this.resetVideo(res.data || []) |
| | | that.resetVideo(res.data || []) |
| | | } else if (item.typecharone === 'color') { |
| | | window.GLOB.app_colors = res.data || [] |
| | | sessionStorage.setItem('app_colors', JSON.stringify(res.data || [])) |
| | | _this.resetColor(res.data || []) |
| | | that.resetColor(res.data || []) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | title: '确定清除历史记录吗?', |
| | | content: '', |
| | | onOk() { |
| | | localStorage.removeItem('replaceRecord') |
| | | _this.setState({fields: [], labels: []}) |
| | | that.setState({fields: [], labels: []}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (!config.enabled) { |
| | | let tb = config.components[0] |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execUpdate(resolve, true) |
| | | that.execUpdate(resolve, true) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execUpdate(resolve) |
| | | that.execUpdate(resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | deleteField = (field) => { |
| | | let config = JSON.stringify(this.props.config) |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (new RegExp('@' + field + '@', 'ig').test(config)) { |
| | | confirm({ |
| | | title: `配置中存在@${field}@,确定删除吗?`, |
| | | content: '', |
| | | onOk() { |
| | | _this.execDelete(field) |
| | | that.execDelete(field) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteCard = (cell, type) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | if (type !== 'direct') { |
| | | confirm({ |
| | |
| | | onOk() { |
| | | card.subMenus = card.subMenus.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.setState({card}) |
| | | _this.props.updateConfig(card) |
| | | that.setState({card}) |
| | | that.props.updateConfig(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | if (editMenu.MenuID && editMenu.property === 'menu' && res.property !== 'menu') { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({menus: _menus, editMenu: null, visible: false}, () => { |
| | | _this.props.updateConfig(_menus) |
| | | that.setState({menus: _menus, editMenu: null, visible: false}, () => { |
| | | that.props.updateConfig(_menus) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { menus } = this.state |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除《${card.name}》吗?`, |
| | | onOk() { |
| | | let _menus = menus.filter(item => item.MenuID !== card.MenuID) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | menus: _menus |
| | | }, () => { |
| | | _this.props.updateConfig(_menus) |
| | | that.props.updateConfig(_menus) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | delTab = (tab) => { |
| | | let tabs = fromJS(this.state.tabs).toJS() |
| | | const _this = this |
| | | const that = this |
| | | |
| | | tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) |
| | | |
| | |
| | | title: '确定删除标签?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({tabs}) |
| | | _this.props.updateConfig(tabs) |
| | | that.setState({tabs}) |
| | | that.props.updateConfig(tabs) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | * @description 表单删除并刷新 |
| | | */ |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除${card.label ? `<<${card.label}>>` : ''}吗?`, |
| | | onOk() { |
| | | let _config = fromJS(_this.state.config).toJS() |
| | | let _config = fromJS(that.state.config).toJS() |
| | | _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | config: _config, |
| | | }) |
| | | }, |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | content: '配置信息未保存,确定返回吗?', |
| | | onOk() { |
| | | _this.props.handleBack() |
| | | that.props.handleBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | clearConfig = () => { |
| | | const _this = this |
| | | const that = this |
| | | let _config = {...this.state.config, fields: []} |
| | | |
| | | confirm({ |
| | | content: '确定清空表单吗?', |
| | | onOk() { |
| | | _this.setState({ config: _config }) |
| | | that.setState({ config: _config }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | * @description 表单删除并刷新 |
| | | */ |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除${card.label ? `<<${card.label}>>` : ''}吗?`, |
| | | onOk() { |
| | | let _group = fromJS(_this.state.group).toJS() |
| | | let _group = fromJS(that.state.group).toJS() |
| | | _group.fields = _group.fields.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | group: _group, |
| | | }) |
| | | _this.resetConfig(_group) |
| | | that.resetConfig(_group) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | content: '配置信息未保存,确定返回吗?', |
| | | onOk() { |
| | | _this.props.handleBack() |
| | | that.props.handleBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | closeGroup = (g) => { |
| | | const _this = this |
| | | const that = this |
| | | let _group = fromJS(this.state.group).toJS() |
| | | _group.groups = _group.groups.filter(item => item.uuid !== g.uuid) |
| | | |
| | | confirm({ |
| | | content: `确定删除分组《${g.wrap.name}》吗?`, |
| | | onOk() { |
| | | _this.setState({ group: _group }) |
| | | _this.resetConfig(_group) |
| | | that.setState({ group: _group }) |
| | | that.resetConfig(_group) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | delMenu = (record) => { |
| | | const { data } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定删除吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) |
| | | that.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | delMenu = (record) => { |
| | | const { menu } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定删除吗?', |
| | | content: '', |
| | | onOk() { |
| | | let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | _this.setState({data: _data}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | let _data = that.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | that.setState({data: _data}) |
| | | that.props.menuUpdate({...menu, sublist: _data}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | }) |
| | | } |
| | | if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({data: _data, editMenu: null, visible: false}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | that.setState({data: _data, editMenu: null, visible: false}) |
| | | that.props.menuUpdate({...menu, sublist: _data}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | delMenu = (record) => { |
| | | const { menu } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: (record.property === 'classify' && record.sublist.length > 0 ? '菜单下含有子菜单,' : '') + '确定删除吗?', |
| | | content: '', |
| | | onOk() { |
| | | let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | _this.setState({data: _data}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | let _data = that.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | that.setState({data: _data}) |
| | | that.props.menuUpdate({...menu, sublist: _data}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | }) |
| | | } |
| | | if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({data: _data, editMenu: null, visible: false}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | that.setState({data: _data, editMenu: null, visible: false}) |
| | | that.props.menuUpdate({...menu, sublist: _data}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | delMenu = (record) => { |
| | | const { data } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: (record.property === 'classify' && record.sublist.length > 0 ? '菜单下含有子菜单,' : '') + '确定删除吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) |
| | | that.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | |
| | | } |
| | | return item |
| | | }) |
| | | _this.setState({data: _data, editMenu: null, visible: false}) |
| | | that.setState({data: _data, editMenu: null, visible: false}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | window.GLOB.CacheData.set(MenuID, urlparam) |
| | | |
| | | // if (window.backend && config.allSqls) { |
| | | // let keys = Object.keys(urlparam) |
| | | // config.allSqls.forEach(item => { |
| | | // if (item.type === 'datasource') { |
| | | // item.urlkeys = keys |
| | | // item.urlparam = urlparam |
| | | // if (config.flow_code) { |
| | | // item.works_flow_code = config.flow_code |
| | | // } |
| | | // } |
| | | // window.GLOB.CacheData.set('sql_' + item.uuid, item) |
| | | // }) |
| | | // } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | |
| | | |
| | | if (cell.verify) { |
| | | if (cell.verify.invalid === 'true') { |
| | | if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { |
| | | cell.verify.invalid = 'false' |
| | | } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { |
| | | if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { |
| | | cell.verify.invalid = 'false' |
| | |
| | | return component |
| | | } |
| | | |
| | | component.setting.uuid = component.uuid |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | component.scripts && component.scripts.forEach(script => { |
| | |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.setState({pageIndex: 1}, () => { |
| | | this.loadData() |
| | | }) |
| | | this.reloadIndex() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _id = config.wrap.selected === 'always' ? id : '' |
| | | if (config.supNodes) { |
| | | if (['mainline', 'maingrid', 'popclose'].includes(position)) { |
| | | let supNode = this.supModules[this.supModules.length - 1] |
| | |
| | | }, i * 10) |
| | | }) |
| | | } else { |
| | | if ((position === 'line' || position === 'line_grid') && lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(lines[0].$$uuid, 'repage') |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | this.reloadIndex() |
| | | } else { |
| | | this.loadData(id) |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } |
| | | } else { |
| | | let supModule = config.setting.supModule |
| | | |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(lines[0].$$uuid, 'repage') |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.loadData(id) |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } else if (['mainline', 'maingrid', 'popclose'].includes(position) && supModule) { |
| | | MKEmitter.emit('reloadData', supModule, position === 'maingrid' ? '' : BID) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | this.reloadIndex() |
| | | } else { |
| | | this.loadData(id) |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadIndex = () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | prevCheck = (id) => { |
| | | const { selected } = this.state |
| | | |
| | | if (selected === 'false' && !id) return |
| | | |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | | this.checkTopLine(id, selected) |
| | | }, 10) |
| | | |
| | | if (selected === 'init') { |
| | |
| | | } |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected } = this.state |
| | | checkTopLine = (id, selected) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | let index = -1 |
| | | let keys = [] |
| | | let items = [] |
| | | |
| | | if (data.length > 0) { |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id && !item.$disabled) |
| | | } |
| | | return |
| | | } |
| | | |
| | | if (selected === 'sign') { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let last = '' |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | last = item |
| | | |
| | | if (index !== -1) { |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } else if (selected === 'sign') { |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | } |
| | | }) |
| | | } else if (selected !== 'false') { |
| | | if (!data[0].$disabled) { |
| | | index = 0 |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | activeKey: index, |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, items, data.length === keys.length) |
| | | } |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | if (data[index].$disabled) { |
| | | if (index === -1) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | } |
| | | return |
| | | } |
| | | |
| | | let item = items[items.length - 1] |
| | | |
| | | this.setState({ |
| | | activeKey: index, |
| | | selectKeys: [index], |
| | | selectedData: [data[index]] |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) |
| | | MKEmitter.emit('resetSelectLine', config.uuid, item.$$uuid, item) |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [data[index]], data.length === 1) |
| | | MKEmitter.emit('syncBalconyData', config.uuid, items, data.length === keys.length) |
| | | } |
| | | } |
| | | |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.loadData() |
| | | this.reloadIndex() |
| | | } else if (config.forbidLine) { |
| | | this.loadData(id, 'repage') |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | |
| | | if (result.status) { |
| | | if (result.$requestId && this.requestId !== result.$requestId) return |
| | | |
| | | if (type === 'repage' && result.data.length === 0 && pageIndex > 1) { |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | | let start = 1 |
| | | if (config.setting.laypage) { |
| | | start = pageSize * (pageIndex - 1) + 1 |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || [], BID) |
| | | } |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | if (selected !== 'false' || id) { |
| | | this.prevCheck(id) |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | |
| | | async loadLinedata (id, position) { |
| | | 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) || [] |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadData() |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.setState({pageIndex: 1}, () => { |
| | | this.loadData() |
| | | }) |
| | | this.reloadIndex() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | let supModule = config.setting.supModule |
| | | |
| | | let _id = config.wrap.selected === 'always' ? id : '' |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(lines[0].$$parentId || lines[0].$$uuid, 'repage') |
| | | } else { |
| | | this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.loadData(id) |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } else if (['mainline', 'maingrid', 'popclose'].includes(position) && supModule) { |
| | | MKEmitter.emit('reloadData', supModule, position === 'maingrid' ? '' : BID) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | this.reloadIndex() |
| | | } else { |
| | | this.loadData(id) |
| | | this.loadData(_id, 'repage') |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected, card } = this.state |
| | | checkTopLine = (id, selected) => { |
| | | const { config, data, card } = this.state |
| | | let _opens = [...this.state.opens] |
| | | |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | return |
| | | } |
| | | let index = -1 |
| | | let keys = [] |
| | | let items = [] |
| | | |
| | | if (selected === 'sign') { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let last = '' |
| | | |
| | | if (card.setting.display === 'collapse') { |
| | | _opens = [] |
| | | if (data.length > 0) { |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id && !item.$disabled) |
| | | } |
| | | |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | last = item |
| | | |
| | | if (card.setting.display === 'collapse') { |
| | | _opens.push(i) |
| | | if (index !== -1) { |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } else if (selected === 'sign') { |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | } |
| | | }) |
| | | } else if (selected !== 'false') { |
| | | if (!data[0].$disabled) { |
| | | index = 0 |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | opens: _opens, |
| | | activeKey: index, |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | if (data[index].$disabled) { |
| | | if (index === -1) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | } |
| | | |
| | | if (card.setting.display === 'collapse') { |
| | | _opens = [index] |
| | | _opens = keys |
| | | } |
| | | |
| | | let item = items[items.length - 1] |
| | | |
| | | this.setState({ |
| | | opens: _opens, |
| | | activeKey: index, |
| | | selectKeys: [index], |
| | | selectedData: [data[index]] |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) |
| | | MKEmitter.emit('resetSelectLine', config.uuid, item.$$uuid, item) |
| | | } |
| | | |
| | | checkAll = () => { |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.loadData() |
| | | this.reloadIndex() |
| | | } else if (config.forbidLine) { |
| | | this.loadData(id, 'repage') |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | |
| | | if (result.status) { |
| | | if (result.$requestId && this.requestId !== result.$requestId) return |
| | | |
| | | if (type === 'repage' && result.data.length === 0 && pageIndex > 1) { |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | | let start = 1 |
| | | if (config.setting.laypage) { |
| | | start = pageSize * (pageIndex - 1) + 1 |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || [], BID) |
| | | } |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | if (selected !== 'false' || id) { |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | | this.checkTopLine(id, selected) |
| | | }, 10) |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | | } |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | } |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | | } |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | |
| | | async loadLinedata (id, position) { |
| | | 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) || [] |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadData() |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | reloadIndex = () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | loadMore = () => { |
| | | const { total, pageIndex, pageSize, loading } = this.state |
| | | |
| | |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.has(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | } |
| | | |
| | | if (_config.wrap.minHeight) { |
| | | _config.style.minHeight = _config.wrap.minHeight |
| | | } |
| | | if (_config.wrap.firstTr === 'light') { |
| | | _config.wrap.tbStyle = 'th-light' |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null |
| | | |
| | | return ( |
| | | <div className={'custom-braft-editor-box ' + (config.wrap.firstTr || '')} id={'anchor' + config.uuid} style={config.style}> |
| | | <div className={'custom-braft-editor-box ' + (config.wrap.tbStyle || '')} id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | <div className="ant-spin-blur"></div> |
| | |
| | | } |
| | | } |
| | | |
| | | .custom-braft-editor-box.light { |
| | | .custom-braft-editor-box.th-light { |
| | | .braft-content { |
| | | table { |
| | | tr:first-child { |
| | | background-color:#ffffff; |
| | | background-color: transparent; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .custom-braft-editor-box.no-border { |
| | | .braft-content { |
| | | table { |
| | | td, th { |
| | | border: none!important; |
| | | } |
| | | tr td:first-child { |
| | | padding-left: 0px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .custom-braft-editor-box.tb-flex { |
| | | .braft-content { |
| | | table { |
| | | table-layout: fixed; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .custom-braft-editor-box::after { |
| | | content: ' '; |
| | |
| | | } |
| | | |
| | | if (tip) { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: tip + '确认要保存吗?', |
| | | onOk() { |
| | | _this.voucherSave(list, t) |
| | | that.voucherSave(list, t) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | .braft-content { |
| | | padding: 15px; |
| | | .media-wrap { |
| | | max-width: 100%; |
| | | } |
| | | img { |
| | | max-width: 100%; |
| | | } |
| | | p { |
| | | margin-bottom: 0px!important; |
| | | min-height: 18px; |
| | | } |
| | | br { |
| | | content: ""; |
| | | display: block; |
| | | height: 18px; |
| | | } |
| | | hr { |
| | | height: 15px; |
| | | border-top: 1px solid rgba(0, 0, 0, 0.1); |
| | | margin-top: 15px; |
| | | } |
| | | video { |
| | | max-width: 100%; |
| | | width: 100%; |
| | | } |
| | | table + p, hr + p { |
| | | min-height: 0px; |
| | | } |
| | | table { |
| | | width: 100%; |
| | | border-collapse: collapse; |
| | |
| | | this.props.refreshdata({pageIndex}) |
| | | } |
| | | |
| | | mkCheckTopLine = (menuId, id, type) => { |
| | | mkCheckTopLine = (menuId, id, selected) => { |
| | | const { MenuID, data, setting } = this.props |
| | | |
| | | if (MenuID !== menuId || !data || data.length === 0) return |
| | | if (MenuID !== menuId) return |
| | | if (!data || data.length === 0) { |
| | | MKEmitter.emit('resetSelectLine', menuId, '', '') |
| | | return |
| | | } |
| | | |
| | | if (type === 'sign') { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let index = -1 |
| | | let keys = [] |
| | | let items = [] |
| | | |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id && !item.$disabled) |
| | | } |
| | | |
| | | if (index !== -1) { |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } else if (selected === 'sign') { |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | |
| | | index = i |
| | | } |
| | | }) |
| | | |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys: keys, activeIndex: index }) |
| | | this.props.chgSelectData(items) |
| | | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) |
| | | } else if (selected !== 'false') { |
| | | if (!data[0].$disabled) { |
| | | index = 0 |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } |
| | | } |
| | | |
| | | if (index === -1) { |
| | | MKEmitter.emit('resetSelectLine', menuId, '', '') |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | if (data[index].$disabled) return |
| | | |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys: [index], activeIndex: index }) |
| | | this.props.chgSelectData([data[index]]) |
| | | this.setState({ selectedRowKeys: keys, activeIndex: index }) |
| | | this.props.chgSelectData(items) |
| | | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, [data[index]], data.length === 1) |
| | | MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) |
| | | } |
| | | } |
| | | |
| | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, selects, data.length === selects.length) |
| | | } |
| | | } else if (type === 'false') { |
| | | this.setState({ |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else if (type === 'repage') { |
| | | this.setState({ |
| | | pageIndex: Index, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | pageIndex: type === 'false' ? this.state.pageIndex : 1, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | |
| | | |
| | | if (setting.selected !== 'always' && setting.selected !== 'init' && setting.selected !== 'sign') { |
| | | setting.selected = 'false' |
| | | } else { |
| | | setting.orisel = true |
| | | } |
| | | |
| | | _config.style = _config.style || {} |
| | |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | this.getStatFieldsValue() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | * @param { Boolean } reset 表格是否重置 |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage, id) { |
| | | async loadData (reset, repage, id) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 列表重置 |
| | | // if (setting.$hasSyncModule) { |
| | | // MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | // } |
| | | |
| | | this.requestId = '' |
| | | return |
| | |
| | | if (result.status) { |
| | | if (result.$requestId && this.requestId !== result.$requestId) return |
| | | |
| | | if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { |
| | | let _pageIndex = Math.ceil(result.total / pageSize) |
| | | |
| | | if (_pageIndex < pageIndex) { |
| | | MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) |
| | | this.setState({ |
| | | pageIndex: _pageIndex, |
| | | data: [], |
| | | selectedData: [], |
| | | total: result.total |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | return |
| | | } |
| | | if (repage === 'false' && result.data.length === 0 && pageIndex > 1) { |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | | if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | | }, 200) |
| | | if (setting.selected === 'init') { |
| | | this.setState({setting: {...setting, selected: 'false'}}) |
| | | } |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | // if (setting.$hasSyncModule) { |
| | | // MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | // } |
| | | } |
| | | |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage || '') // 列表重置 |
| | | |
| | | let start = 1 |
| | | if (setting.laypage) { |
| | |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | if (data.length && (id || setting.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | | }, 200) |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (setting.selected === 'init') { |
| | | this.setState({setting: {...setting, selected: 'false'}}) |
| | | } |
| | | |
| | | if (config.autoMatic) { |
| | | if (result.data && result.data.length > 0) { |
| | |
| | | async loadLinedata (id, position) { |
| | | 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) || [] |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | |
| | |
| | | this.setState({ |
| | | pageIndex: pagination.pageIndex |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }) |
| | | } else { |
| | | if (sorter.order) { |
| | |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = (btn, id) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true', id) |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | this.loadmaindata(true, 'false', id) |
| | | this.getStatFieldsValue() |
| | | } |
| | | } |
| | | |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | this.reloadIndex() |
| | | } else if (config.forbidLine) { |
| | | this.loadData(true, 'false', id) |
| | | this.getStatFieldsValue() |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | |
| | | BData: data |
| | | }, () => { |
| | | if (!setting.checkBid) { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | this.getStatFieldsValue() |
| | | } |
| | | }) |
| | |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id, lines) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _id = config.wrap.selected === 'always' ? (id || '') : '' |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(true, 'false', lines[0].$$uuid) |
| | | this.getStatFieldsValue() |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | this.getStatFieldsValue() |
| | | } |
| | | } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.reloadIndex() |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | this.getStatFieldsValue() |
| | | } |
| | | } |
| | | |
| | |
| | | const { config } = this.state |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.reloadtable() |
| | | |
| | | this.reloadIndex() |
| | | } |
| | | |
| | | reloadIndex = () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | | autoExec = (times) => { |
| | |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | * @param { Boolean } reset 表格是否重置 |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage) { |
| | | async loadData (reset, repage) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | */ |
| | | async loadLinedata (id, position) { |
| | | 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 result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | }) |
| | | } |
| | | |
| | |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = (btn) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | }) |
| | | } else { |
| | | this.loadmaindata(true, 'false') |
| | | } |
| | | reloadIndex = () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(true, 'true') |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | this.reloadIndex() |
| | | } else if (config.forbidLine) { |
| | | this.loadData(true, 'false') |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | |
| | | }, () => { |
| | | if (!setting.checkBid) { |
| | | setTimeout(() => { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | }, setting.delay || 0) |
| | | } |
| | | }) |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(true, 'false') |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.reloadtable(btn) |
| | | this.loadData(true, 'false') |
| | | } |
| | | } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.reloadIndex() |
| | | } else { |
| | | this.reloadtable(btn) |
| | | this.loadData(true, 'false') |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.reloadtable() |
| | | this.reloadIndex() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (setting.selected !== 'always' && setting.selected !== 'init' && setting.selected !== 'sign') { |
| | | setting.selected = 'false' |
| | | } else { |
| | | setting.orisel = true |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true') { |
| | |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true', '', 'timer') |
| | | this.loadData(true, 'true', '', 'timer') |
| | | }) |
| | | }) |
| | | } |
| | |
| | | Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { |
| | | if (!res.valid && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata(false, 'true', '', 'init') |
| | | this.loadData(false, 'true', '', 'init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata(false, 'true', '', 'init') |
| | | this.loadData(false, 'true', '', 'init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | * @param { Boolean } reset 表格是否重置 |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage, id, type) { |
| | | async loadData (reset, repage, id, type) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID && setting.supKey !== 'false') { // BID 不存在时,不做查询 |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || [], BID) |
| | | } |
| | | |
| | | if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { |
| | | let _pageIndex = Math.ceil(result.total / pageSize) |
| | | |
| | | if (_pageIndex < pageIndex) { |
| | | MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) |
| | | this.setState({ |
| | | pageIndex: _pageIndex, |
| | | data: [], |
| | | selectedData: [], |
| | | total: result.total |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | | }, 200) |
| | | if (setting.selected === 'init') { |
| | | this.setState({setting: {...setting, selected: 'false'}}) |
| | | } |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | } |
| | | if (repage === 'false' && result.data.length === 0 && pageIndex > 1) { |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | |
| | | allSearch.push(...searches) |
| | | } |
| | | |
| | | if (data.length && (id || setting.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | | }, 200) |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (setting.selected === 'init') { |
| | | this.setState({setting: {...setting, selected: 'false'}}) |
| | | } |
| | | |
| | | if (config.$hasTopModule) { |
| | | window.GLOB.CacheData.set(config.uuid + 'tb', data[0] || { $$empty: true, $$uuid: '' }) |
| | |
| | | async loadLinedata (id, position) { |
| | | 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) || [] |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | this.reloadIndex() |
| | | return |
| | | } |
| | | |
| | |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | }) |
| | | } |
| | | |
| | |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = (btn, id) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata(true, 'true', id) |
| | | }) |
| | | } else { |
| | | this.loadmaindata(true, 'false', id) |
| | | } |
| | | reloadIndex = () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(true, 'true') |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | this.reloadIndex() |
| | | } else if (config.forbidLine) { |
| | | this.loadData(true, 'false', id) |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | |
| | | |
| | | if (bid !== this.state.BID || bid !== '') { |
| | | this.setState({ BID: bid, BData: _data, pageIndex: 1 }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | }) |
| | | } |
| | | } else { |
| | |
| | | BData: data |
| | | }, () => { |
| | | if (!setting.checkBid) { |
| | | this.loadmaindata(true, 'true') |
| | | this.loadData(true, 'true') |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id, lines) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _id = config.wrap.selected === 'always' ? (id || '') : '' |
| | | if (config.supNodes) { |
| | | if (['mainline', 'maingrid', 'popclose'].includes(position)) { |
| | | let supNode = this.supModules[this.supModules.length - 1] |
| | |
| | | }) |
| | | } else { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(true, 'false', lines[0].$$uuid) |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | } |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.reloadIndex() |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | } |
| | | } |
| | | } else { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1 && !config.forbidLine) { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | if (lines && lines.length === 1) { |
| | | if (config.forbidLine) { |
| | | this.loadData(true, 'false', lines[0].$$uuid) |
| | | } else { |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | } |
| | | } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) |
| | | } else if (btn.resetPageIndex !== 'false') { |
| | | this.reloadIndex() |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | this.loadData(true, 'false', _id) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.reloadtable() |
| | | this.reloadIndex() |
| | | } |
| | | |
| | | render() { |
| | |
| | | } |
| | | |
| | | if (cell.verify) { |
| | | let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') |
| | | if (cell.verify.invalid === 'true') { |
| | | if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { |
| | | if (isStatic) { |
| | | cell.verify.invalid = 'false' |
| | | } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { |
| | | cell.verify.invalid = 'false' |
| | |
| | | cell.verify.invalid = 'false' |
| | | } |
| | | } |
| | | if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { |
| | | cell.verify.uniques = [] |
| | | } |
| | | |
| | | if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { |
| | | cell.returnValue = 'true' |
| | |
| | | } |
| | | |
| | | if (cell.verify) { |
| | | let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') |
| | | if (cell.verify.invalid === 'true') { |
| | | if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { |
| | | if (isStatic) { |
| | | cell.verify.invalid = 'false' |
| | | } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { |
| | | cell.verify.invalid = 'false' |
| | |
| | | } |
| | | } |
| | | |
| | | if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { |
| | | cell.verify.uniques = [] |
| | | } |
| | | |
| | | if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { |
| | | cell.returnValue = 'true' |
| | | } |
| | |
| | | */ |
| | | changeUser = (primaryId) => { |
| | | const { setting, btn } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | let param = { |
| | | func: 'webapi_ChangeUser', |
| | |
| | | message: res.message || '执行失败!', |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 |
| | | }) |
| | | _this.setState({loading: false}) |
| | | that.setState({loading: false}) |
| | | } |
| | | }, () => { |
| | | resolve() |
| | | _this.setState({loading: false}) |
| | | that.setState({loading: false}) |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.setState({loading: false}) |
| | | that.setState({loading: false}) |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else if (res.ErrCode === 'C') { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | title: window.GLOB.dict['exec_sure'] || '请确认', |
| | | content: res.message, |
| | |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | _this.execSuccess(result) |
| | | that.execSuccess(result) |
| | | } else { |
| | | _this.execError(result) |
| | | that.execError(result) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.execError(res) |
| | | that.execError(res) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | width: auto; |
| | | padding: 0 15px; |
| | | } |
| | | .ant-btn.ant-btn-link { |
| | | border-color: #d9d9d9; |
| | | } |
| | | |
| | | .ant-btn.mk-btn-hover-bg:not([disabled]):hover { |
| | | opacity: 1!important; |
| | |
| | | dict: window.GLOB.dict |
| | | } |
| | | |
| | | moduleParams = null |
| | | preCallback = null |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | |
| | | this.setState({autoMatic: type === 'autoMatic'}) |
| | | |
| | | let _this = this |
| | | let that = this |
| | | let data = record || selectedData || [] |
| | | |
| | | let valid = this.checkBtnData(data) |
| | |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(data, resolve) |
| | | that.execSubmit(data, resolve) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.setState({loading: false}) |
| | | that.setState({loading: false}) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'exec') { |
| | |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let that = this |
| | | let data = selectedData || [] |
| | | |
| | | let valid = this.checkBtnData(data) |
| | |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(data, resolve) |
| | | that.execSubmit(data, resolve) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | callback() |
| | | _this.setState({loading: false}) |
| | | that.setState({loading: false}) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'exec') { |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId || Utils.getguid() |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = Utils.getguid() |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (data, _resolve, formdata, force) => { |
| | | const { setting, btn } = this.props |
| | | this.moduleParams = null |
| | | const { btn } = this.props |
| | | |
| | | if (btn.preButton && !force) { |
| | | this.trigger(btn.preButton, data, _resolve, formdata, 0) |
| | | } else if (btn.verify && btn.verify.invalid === 'true' && setting.dataresource) { |
| | | MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | let allSearch = Utils.getAllSearchOptions(param.search) |
| | | |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('User_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('Full_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 10 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | this.moduleParams = { |
| | | datasource, |
| | | customScript |
| | | } |
| | | |
| | | this.execRealSubmit(data, _resolve, formdata) |
| | | }) |
| | | } else { |
| | | this.execRealSubmit(data, _resolve, formdata) |
| | | } |
| | |
| | | msg = msg.replace(/\n|\r/ig, '<br/>') |
| | | msg = <span dangerouslySetInnerHTML={{__html: msg}}></span> |
| | | } |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | title: window.GLOB.dict['exec_sure'] || '请确认', |
| | | content: msg, |
| | |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | _this.triggerNote(result, param.ID) // 消息 |
| | | that.triggerNote(result, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | _this.execSuccess(result) |
| | | that.execSuccess(result) |
| | | _resolve() |
| | | } else { |
| | | _this.checkLoopRequest(params, _resolve) |
| | | that.checkLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | _this.execError(result) |
| | | that.execError(result) |
| | | _resolve() |
| | | } |
| | | resolve() |
| | |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.execError(res) |
| | | that.execError(res) |
| | | _resolve() |
| | | } |
| | | }) |
| | |
| | | modelconfirm = () => { |
| | | const { BID } = this.props |
| | | const { btnconfig, selines, dict } = this.state |
| | | let _this = this |
| | | let that = this |
| | | |
| | | let result = [] |
| | | let _data = {} |
| | |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(selines, resolve, result) |
| | | that.execSubmit(selines, resolve, result) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.preCallback && _this.preCallback() |
| | | _this.setState({ loading: false }) |
| | | that.preCallback && that.preCallback() |
| | | that.setState({ loading: false }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | this.setState({autoMatic: type === 'autoMatic'}) |
| | | |
| | | let _this = this |
| | | let that = this |
| | | let data = record || selectedData || [] |
| | | |
| | | if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | |
| | | okText: dict['ok'] || '确定', |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | _this.triggerPrint(data) |
| | | that.triggerPrint(data) |
| | | }, |
| | | onCancel() { |
| | | _this.setState({ loading: false }) |
| | | that.setState({ loading: false }) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | |
| | | modelconfirm = () => { |
| | | const { btnconfig, selines, dict } = this.state |
| | | let _this = this |
| | | let that = this |
| | | let result = [] |
| | | let _data = {} |
| | | let BData = {} |
| | |
| | | okText: dict['ok'] || '确定', |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | _this.triggerPrint(selines, result) |
| | | that.triggerPrint(selines, result) |
| | | }, |
| | | onCancel() { |
| | | _this.setState({ loading: false }) |
| | | that.setState({ loading: false }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } else if (!links.includes(item.verify.linkUrl)) { |
| | | links.push(item.verify.linkUrl) |
| | | } |
| | | }) |
| | | |
| | | let socket = null |
| | | socket = new WebSocket('ws://' + item.verify.linkUrl) |
| | | if (links.length === 0) return |
| | | |
| | | let defers = links.map(link => { |
| | | return new Promise((resolve) => { |
| | | let socket = new WebSocket('ws://' + link) |
| | | // 打开Socket |
| | | socket.onopen = () =>{ |
| | | let request = { |
| | |
| | | }) |
| | | } |
| | | |
| | | window.GLOB.UserCacheMap.set(item.verify.linkUrl, _printers) |
| | | } else if (data && data.cmd === 'getPrinters') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: data.message, |
| | | duration: 5 |
| | | }) |
| | | resolve({status: true, printers: _printers}) |
| | | } else if (data && data.cmd === 'getPrinters' && data.message) { |
| | | resolve({status: false, printers: null, message: data.message}) |
| | | } |
| | | } |
| | | |
| | | socket.onerror = () => { |
| | | let tool = item.verify.linkUrl |
| | | if (item.verify.linkUrl === '127.0.0.1:13529') { |
| | | let tool = link |
| | | |
| | | if (link === '127.0.0.1:13529') { |
| | | tool = '明科通讯组件' |
| | | } else if (item.verify.linkUrl === '127.0.0.1:13528') { |
| | | } else if (link === '127.0.0.1:13528') { |
| | | tool = 'CAINIAO打印组件' |
| | | } |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '无法连接到: ' + tool, |
| | | duration: 5 |
| | | }) |
| | | |
| | | resolve({status: false, printers: null, message: '无法连接到: ' + tool}) |
| | | |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(defers).then(results => { |
| | | let res = results.filter(item => item.status)[0] |
| | | if (res) { |
| | | links.forEach(link => { |
| | | window.GLOB.UserCacheMap.set(link, res.printers) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: results[0].message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | cancelConfig = () => { |
| | | // const { config, originMenu } = this.state |
| | | |
| | | // let _this = this |
| | | // let that = this |
| | | |
| | | // if (config.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.props.handleView() |
| | | // that.props.handleView() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (!config.enabled) { |
| | | notification.warning({ |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execUpdate(resolve) |
| | | that.execUpdate(resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | saveConfig = (_resolve, _config, errors) => { |
| | | let err = errors.join(';') |
| | | let _this = this |
| | | let that = this |
| | | |
| | | if (err) { |
| | | _resolve() |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.saveNewMenu(resolve, _config) |
| | | that.saveNewMenu(resolve, _config) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | * @description 表单删除并刷新 |
| | | */ |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除${card.label ? `<<${card.label}>>` : ''}吗?`, |
| | | onOk() { |
| | | let _config = fromJS(_this.state.config).toJS() |
| | | let _config = fromJS(that.state.config).toJS() |
| | | _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | config: _config, |
| | | }) |
| | | }, |
| | |
| | | |
| | | cancelConfig = () => { |
| | | // const { config, originConfig } = this.state |
| | | // let _this = this |
| | | // let that = this |
| | | |
| | | // let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | | // if (isOrigin) { |
| | | // confirm({ |
| | | // content: '尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.handleViewBack() |
| | | // that.handleViewBack() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | |
| | | |
| | | changecols = (type) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | confirm({ |
| | | content: `确定切换为${type}列吗?`, |
| | | onOk() { |
| | | _this.setState({config}) |
| | | that.setState({config}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | clearConfig = () => { |
| | | const _this = this |
| | | const that = this |
| | | let _config = {...this.state.config, fields: []} |
| | | |
| | | confirm({ |
| | | content: '确定清空表单吗?', |
| | | onOk() { |
| | | _this.setState({ config: _config }) |
| | | that.setState({ config: _config }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${card.label} ?`, |
| | | onOk() { |
| | | let _actionlist = fromJS(_this.state.actionlist).toJS() |
| | | let _actionlist = fromJS(that.state.actionlist).toJS() |
| | | |
| | | _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | |
| | | card: card |
| | | } |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) |
| | | that.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | clearField = () => { |
| | | const { verify } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | onOk() { |
| | | _this.setState({ |
| | | that.setState({ |
| | | verify: { |
| | | ...verify, |
| | | columns: [] |
| | | } |
| | | }, () => { |
| | | _this.resetUniqueColumns() |
| | | that.resetUniqueColumns() |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | clearField = () => { |
| | | const { verify } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | onOk() { |
| | | _this.setState({ |
| | | that.setState({ |
| | | verify: { |
| | | ...verify, |
| | | columns: [] |
| | |
| | | |
| | | deletedetail = (cell) => { |
| | | const { card } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${cell.content} ?`, |
| | |
| | | |
| | | _details = _details.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.plotChange({details: _details}) |
| | | that.plotChange({details: _details}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | deleteElem = (type) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除?', |
| | | onOk() { |
| | | let _subelement = fromJS(_this.props.card.subelement).toJS() |
| | | let _subelement = fromJS(that.props.card.subelement).toJS() |
| | | _subelement = _subelement.filter(_type => _type !== type) |
| | | |
| | | _this.plotChange({subelement: _subelement}) |
| | | that.plotChange({subelement: _subelement}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deletechart = (plot) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 ${plot.title} ?`, |
| | | onOk() { |
| | | let _chartlist = fromJS(_this.state.chartlist).toJS() |
| | | let _chartview = _this.state.chartview |
| | | let _chartlist = fromJS(that.state.chartlist).toJS() |
| | | let _chartview = that.state.chartview |
| | | |
| | | _chartlist = _chartlist.filter(item => item.uuid !== plot.uuid) |
| | | |
| | |
| | | _chartview = _chartlist[0].uuid |
| | | } |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | chartlist: _chartlist, |
| | | chartview: _chartview |
| | | }) |
| | | _this.props.updatechartgroup({...config, charts: _chartlist}, _chartview) |
| | | that.props.updatechartgroup({...config, charts: _chartlist}, _chartview) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${card.label} ?`, |
| | | onOk() { |
| | | let _columnlist = fromJS(_this.state.columnlist).toJS() |
| | | let _columnlist = fromJS(that.state.columnlist).toJS() |
| | | |
| | | _columnlist = _columnlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | columnlist: _columnlist |
| | | }, ()=> { |
| | | _this.props.updatecolumn({...config, columns: _columnlist}) |
| | | that.props.updatecolumn({...config, columns: _columnlist}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | if (type === 'search') { |
| | | // 添加搜索条件,字段集中存在搜索条件字段,使用搜索条件对象替换字段集,设置数据类型 |
| | | config.search.forEach(item => { |
| | | if (item.field && columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, origin: true, datatype: _datatype}) |
| | | if (item.field) { |
| | | if (/,/.test(item.field)) { |
| | | item.field.split(',').forEach(n => { |
| | | if (columns.has(n.toLowerCase())) { |
| | | let _datatype = columns.get(n.toLowerCase()).datatype |
| | | columns.set(n.toLowerCase(), {...item, field: n, origin: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } else { |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, origin: true, datatype: _datatype}) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } else if (type === 'columns') { |
| | |
| | | } |
| | | |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | // 获取已选字段集合 |
| | | let cards = selectCards |
| | | let columnsMap = new Map() |
| | | cards.forEach(card => { |
| | | columnsMap.set(card.field.toLowerCase(), card) |
| | | }) |
| | | |
| | | let items = [] |
| | | let keys = [] |
| | |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除 - ${card.label} ?`, |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | let _searchlist = fromJS(that.state.searchlist).toJS() |
| | | |
| | | _searchlist = _searchlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | searchlist: _searchlist |
| | | }, () => { |
| | | _this.props.updatesearch({...config, search: _searchlist}) |
| | | that.props.updatesearch({...config, search: _searchlist}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | resetSetting = (s, ori) => { |
| | | let setting = fromJS(s).toJS() |
| | | let maxScript = 0 |
| | | // let maxScript = 0 |
| | | |
| | | setting.show = ori.show || 'true' |
| | | setting.advanceType = ori.advanceType || 'modal' |
| | |
| | | setting.searchLwidth = ori.searchLwidth !== undefined ? ori.searchLwidth : 33.3 |
| | | setting.resetContrl = ori.resetContrl || 'init' |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | setting.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | // setting.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | |
| | | if (item.status === 'false') return |
| | | // if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | setting.preScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | setting.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | if (setting.dataresource) { |
| | | setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | } |
| | | }) |
| | | } else { |
| | | setting.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // setting.preScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // setting.cbScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // if (setting.dataresource) { |
| | | // setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // setting.scripts.forEach(item => { |
| | | // if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | } |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | setting.maxScript = maxScript |
| | | // setting.maxScript = maxScript |
| | | |
| | | return setting |
| | | } |
| | |
| | | |
| | | let status = fromJS(_setting).toJS() |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | _scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | if (_setting.dataresource) { |
| | | _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | } |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | // _scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // if (_setting.dataresource) { |
| | | // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | this.setState({ |
| | | setting: _setting, |
| | |
| | | _dataresource = '' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@select\$|\$select@/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, '') |
| | | // _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') |
| | | |
| | | _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') |
| | | _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') |
| | | // _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') |
| | | // _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | |
| | | */ |
| | | deleteElement = (card, group) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | let tabgroups = fromJS(this.state.tabgroups).toJS() |
| | | |
| | | confirm({ |
| | |
| | | return _group |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | tabgroups: tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: tabgroups}) |
| | | that.props.updatetabs({...config, tabgroups: tabgroups}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | */ |
| | | addTabGroup = () => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | let _tabgroups = fromJS(this.state.tabgroups).toJS() |
| | | |
| | | confirm({ |
| | |
| | | sublist:[] |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | tabgroups: _tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | that.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | */ |
| | | delTabGroup = (group) => { |
| | | const { config } = this.props |
| | | let _this = this |
| | | let that = this |
| | | let _tabgroups = fromJS(this.state.tabgroups).toJS() |
| | | |
| | | confirm({ |
| | |
| | | onOk() { |
| | | _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | tabgroups: _tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) |
| | | that.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | loading: true |
| | | }) |
| | | this.settingRef.handleConfirm().then(res => { |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | res.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | if (res.dataresource) { |
| | | res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | } |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | // res.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // if (res.dataresource) { |
| | | // res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // } |
| | | // }) |
| | | // } |
| | | this.setState({ |
| | | visible: false, |
| | | loading: false |
| | |
| | | let _setting = fromJS(config.setting).toJS() |
| | | let _scripts = _setting.scripts || [] |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | _scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | if (_setting.dataresource) { |
| | | _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | } |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | // _scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // if (_setting.dataresource) { |
| | | // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | this.setState({ |
| | | setting: _setting, |
| | |
| | | _dataresource = '' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | |
| | | cancelConfig = () => { |
| | | // const { config, originConfig } = this.state |
| | | |
| | | // let _this = this |
| | | // let that = this |
| | | |
| | | // if (originConfig.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.handleViewBack() |
| | | // that.handleViewBack() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | |
| | | */ |
| | | cancelConfig = () => { |
| | | // const { config, originMenu } = this.state |
| | | // let _this = this |
| | | // let that = this |
| | | |
| | | // if (config.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.props.handleView() |
| | | // that.props.handleView() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (!config.enabled) { |
| | | notification.warning({ |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execUpdate(resolve) |
| | | that.execUpdate(resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | saveConfig = (_resolve, _config, errors) => { |
| | | let err = errors.join(';') |
| | | let _this = this |
| | | let that = this |
| | | |
| | | if (err) { |
| | | _resolve() |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.saveNewMenu(resolve, _config) |
| | | that.saveNewMenu(resolve, _config) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定清空列表吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({ data: [], editingKey: '' }, () => { |
| | | _this.props.onChange([]) |
| | | that.setState({ data: [], editingKey: '' }, () => { |
| | | that.props.onChange([]) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | let sql = this.props.initsql + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | |
| | | end |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | |
| | | |
| | | sql += _backCustomScript + tail |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(item => { |
| | | // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // } |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | |
| | | sql = sql.replace(/@statusname@/ig, `'开始'`) |
| | | sql = sql.replace(/@work_group@/ig, `'work_group'`) |
| | | sql = sql.replace(/@work_grade@/ig, '0') |
| | | sql = sql.replace(/@start_type@/ig, `'开始'`) |
| | | sql = sql.replace(/@check_type@/ig, `'审核'`) |
| | | sql = sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | |
| | | sql = sql.replace(/@check_userids@/ig, `''`) |
| | | sql = sql.replace(/@notice_userids@/ig, `''`) |
| | | |
| | | sql = sql.replace(/@works_flow_sign@/ig, `''`) |
| | | |
| | | if (flowType === 'start') { |
| | | sql = sql.replace(/@start_type@/ig, `'开始'`) |
| | | } else { |
| | | sql = sql.replace(/@check_type@/ig, `'审核'`) |
| | | sql = sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | |
| | | sql = sql.replace(/@check_userids@/ig, `''`) |
| | | sql = sql.replace(/@notice_userids@/ig, `''`) |
| | | |
| | | sql = sql.replace(/@works_flow_sign@/ig, `''`) |
| | | } |
| | | } |
| | | |
| | | if (skip) { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { formfields, colfields, systemScripts, btn, type, workFlow } = this.props |
| | | const { formfields, colfields, systemScripts, btn, type, workFlow, flowType } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { editItem, skip } = this.state |
| | | const formItemLayout = { |
| | |
| | | {!_type ? <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="公共值,请按照@xxx@格式使用。"><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, lang, time_id, typename, datam</span></Tooltip>, |
| | | {window.GLOB.process && workFlow === 'true' ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="工作流变量,请按照@xxx@格式使用,works_flow_sign 为分支启用高级设置时的标记值。"><span style={{color: '#26C281'}}>works_flow_code, works_flow_name, works_flow_param, works_flow_detail_id, status, statusname, work_group, work_grade, start_type, check_type, notice_type, check_userids, notice_userids, works_flow_sign, </span></Tooltip> : null} |
| | | {window.GLOB.process && workFlow === 'true' ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={`工作流变量,请按照@xxx@格式使用${flowType !== 'start' ? ',works_flow_sign 为分支启用高级设置时的标记值' : ''}。`}><span style={{color: '#26C281'}}>works_flow_code, works_flow_name, works_flow_param, works_flow_detail_id, status, statusname, work_group, work_grade, {flowType === 'start' ? 'start_type,' : 'check_type, notice_type, check_userids, notice_userids, works_flow_sign,'} </span></Tooltip> : null} |
| | | <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, mk_deleted</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="系统变量,系统会定义变量并在单号生成或创建凭证时使用。"><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> |
| | | {formfields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="表单变量,系统会定义变量并赋值。">, <span style={{color: '#8E44AD'}}>{formfields}</span></Tooltip> : ''} |
| | |
| | | _verify.printTempId = '' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | _verify.customverifys.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _verify.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _verify.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | // _verify.customverifys.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // _verify.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // _verify.cbScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | _verify.customverifys.forEach((item, i) => { |
| | | item.$index = i + 1 |
| | |
| | | } |
| | | |
| | | orderSql = (record) => { |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (record.TypeCharOne === 'Lp') { |
| | | if (record.linkField.toLowerCase() === 'bid') { |
| | |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${record.mark || this.props.card.uuid}'+@${record.linkField.toLowerCase()},48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (record.TypeCharOne === 'BN') { |
| | | _ModularDetailCode = `'${record.TypeCharOne}'` |
| | | if (record.linkField.toLowerCase() === 'bid') { |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@${record.linkField.toLowerCase()},48)` |
| | | } |
| | | } else { |
| | | _ModularDetailCode = `'${record.ModularDetailCode}'` |
| | | _lpline = `set @ModularDetailCode= right('${record.ModularDetailCode}',50)` |
| | | } |
| | | |
| | | let sql = `select @BillCode='', @${record.field}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=${_ModularDetailCode}, |
| | | @ModularDetailCode=@ModularDetailCode, |
| | | @Type=${record.Type}, |
| | | @TypeCharOne='${record.TypeCharOne}', |
| | | @TypeCharTwo ='${record.TypeCharTwo}', |
| | |
| | | msg = '自定义脚本' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | verify.customverifys.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | verify.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | verify.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | }) |
| | | } |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | // verify.customverifys.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // verify.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // verify.cbScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | delete verify.limitInvalid |
| | | delete verify.limitText |
| | |
| | | }; |
| | | |
| | | Formatter.prototype.getFormattedQueryFromTokens = function getFormattedQueryFromTokens() { |
| | | var _this = this; |
| | | var that = this; |
| | | var formattedQuery = ""; |
| | | this.tokens.forEach(function (token, index) { |
| | | _this.index = index; |
| | | that.index = index; |
| | | if (token.type === _tokenTypes2["default"].WHITESPACE) { |
| | | // ignore (we do our own whitespace formatting) |
| | | } else if (token.type === _tokenTypes2["default"].LINE_COMMENT) { |
| | | formattedQuery = _this.formatLineComment(token, formattedQuery); |
| | | formattedQuery = that.formatLineComment(token, formattedQuery); |
| | | } else if (token.type === _tokenTypes2["default"].BLOCK_COMMENT) { |
| | | formattedQuery = _this.formatBlockComment(token, formattedQuery); |
| | | formattedQuery = that.formatBlockComment(token, formattedQuery); |
| | | } else if (token.type === _tokenTypes2["default"].RESERVED_TOPLEVEL) { |
| | | formattedQuery = _this.formatToplevelReservedWord(token, formattedQuery); |
| | | _this.previousReservedWord = token; |
| | | formattedQuery = that.formatToplevelReservedWord(token, formattedQuery); |
| | | that.previousReservedWord = token; |
| | | } else if (token.type === _tokenTypes2["default"].RESERVED_NEWLINE) { |
| | | formattedQuery = _this.formatNewlineReservedWord(token, formattedQuery); |
| | | _this.previousReservedWord = token; |
| | | formattedQuery = that.formatNewlineReservedWord(token, formattedQuery); |
| | | that.previousReservedWord = token; |
| | | }else if (token.type === _tokenTypes2["default"].RESERVED) { |
| | | formattedQuery = _this.formatWithSpaces(token, formattedQuery); |
| | | _this.previousReservedWord = token; |
| | | formattedQuery = that.formatWithSpaces(token, formattedQuery); |
| | | that.previousReservedWord = token; |
| | | } else if (token.type === _tokenTypes2["default"].OPEN_PAREN) { |
| | | formattedQuery = _this.formatOpeningParentheses(token, formattedQuery); |
| | | formattedQuery = that.formatOpeningParentheses(token, formattedQuery); |
| | | } else if (token.type === _tokenTypes2["default"].CLOSE_PAREN) { |
| | | formattedQuery = _this.formatClosingParentheses(token, formattedQuery); |
| | | formattedQuery = that.formatClosingParentheses(token, formattedQuery); |
| | | } else if (token.type === _tokenTypes2["default"].PLACEHOLDER) { |
| | | formattedQuery = _this.formatPlaceholder(token, formattedQuery); |
| | | formattedQuery = that.formatPlaceholder(token, formattedQuery); |
| | | } else if (token.value === '$') { |
| | | formattedQuery = _this.formatNewWithSpaces(token, formattedQuery); |
| | | formattedQuery = that.formatNewWithSpaces(token, formattedQuery); |
| | | } else if (token.value === ",") { |
| | | formattedQuery = _this.formatComma(token, formattedQuery); |
| | | formattedQuery = that.formatComma(token, formattedQuery); |
| | | } else if (token.value === ":") { |
| | | formattedQuery = _this.formatWithSpaceAfter(token, formattedQuery); |
| | | formattedQuery = that.formatWithSpaceAfter(token, formattedQuery); |
| | | } else if (token.value === ".") { |
| | | formattedQuery = _this.formatWithoutSpaces(token, formattedQuery); |
| | | formattedQuery = that.formatWithoutSpaces(token, formattedQuery); |
| | | } else if (token.value === ";") { |
| | | formattedQuery = _this.formatQuerySeparator(token, formattedQuery); |
| | | formattedQuery = that.formatQuerySeparator(token, formattedQuery); |
| | | } else { |
| | | formattedQuery = _this.formatWithSpaces(token, formattedQuery); |
| | | formattedQuery = that.formatWithSpaces(token, formattedQuery); |
| | | } |
| | | }); |
| | | return formattedQuery; |
| | |
| | | }; |
| | | |
| | | Tokenizer.prototype.createParenRegex = function createParenRegex(parens) { |
| | | var _this = this; |
| | | var that = this; |
| | | |
| | | return new RegExp("^(" + parens.map(function (p) { |
| | | return _this.escapeParen(p); |
| | | return that.escapeParen(p); |
| | | }).join("|") + ")", "i"); |
| | | }; |
| | | |
| | |
| | | }; |
| | | |
| | | Tokenizer.prototype.getStringNamedPlaceholderToken = function getStringNamedPlaceholderToken(input) { |
| | | var _this2 = this; |
| | | var that2 = this; |
| | | |
| | | return this.getPlaceholderTokenWithKey({ |
| | | input: input, |
| | | regex: this.STRING_NAMED_PLACEHOLDER_REGEX, |
| | | parseKey: function parseKey(v) { |
| | | return _this2.getEscapedPlaceholderKey({ key: v.slice(2, -1), quoteChar: v.slice(-1) }); |
| | | return that2.getEscapedPlaceholderKey({ key: v.slice(2, -1), quoteChar: v.slice(-1) }); |
| | | } |
| | | }); |
| | | }; |
| | |
| | | import md5 from 'md5' |
| | | import { fromJS } from 'immutable' |
| | | import { notification } from 'antd' |
| | | |
| | | export default class MenuUtils { |
| | |
| | | list.forEach(str => { |
| | | str = str.replace(/^\s/, '') |
| | | let strs = str.match(/(\s|=)[a-z0-9_]+\./ig) |
| | | if (strs.length === 2 && (strs[0].replace(/\s|\./g, '') === strs[1].replace(/\s|\./g, ''))) { |
| | | if (strs.length === 2 && (strs[0].replace(/\s|\.|=/g, '') === strs[1].replace(/\s|\.|=/g, ''))) { |
| | | errors.push(str) |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | traversal(config.components) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取执行脚本 |
| | | */ |
| | | export function getAllSqls (conf) { |
| | | let config = fromJS(conf).toJS() |
| | | |
| | | let sqls = [] |
| | | let urlFields = config.urlFields |
| | | let appType = sessionStorage.getItem('appType') |
| | | let process = config.process === 'true' |
| | | |
| | | if (urlFields) { |
| | | urlFields = urlFields.map(n => n.toLowerCase()) |
| | | } |
| | | |
| | | let filterComponent = (components, mainSearch) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | let _mainSearch = mainSearch || [] |
| | | |
| | | if (appType !== 'mob') { |
| | | tab.components.forEach(com => { |
| | | if (com.type !== 'search') return |
| | | |
| | | _mainSearch = com.search || [] |
| | | }) |
| | | } |
| | | filterComponent(tab.components, _mainSearch) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | filterComponent(item.components, mainSearch) |
| | | } else { |
| | | if (item.wrap && item.setting) { |
| | | if (item.wrap.datatype === 'public' || item.wrap.datatype === 'static') { |
| | | item.setting.interType = 'other' |
| | | } |
| | | } |
| | | |
| | | if (appType === 'mob' && item.type !== 'search' && item.type !== 'topbar' && item.search && item.search.length > 0) { |
| | | item.search = [] |
| | | } |
| | | if (appType !== 'mob' && item.search && item.search.length > 0) { |
| | | item.search.forEach(cell => { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { |
| | | let msg = getFormSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } |
| | | |
| | | if (item.setting && item.setting.interType === 'system') { |
| | | if (item.format === 'object') { |
| | | item.setting.laypage = 'false' |
| | | item.setting.$top = true |
| | | } |
| | | |
| | | let msg = getDataSource(item, mainSearch) |
| | | |
| | | sqls.push({uuid: item.uuid, type: 'datasource', ...msg}) |
| | | } else if (item.setting && item.setting.useMSearch === 'true') { |
| | | let searches = item.search || [] |
| | | if (mainSearch.length > 0) { |
| | | searches = [...searches, ...mainSearch] |
| | | } |
| | | item.$searches = fromJS(searches).toJS() |
| | | } |
| | | |
| | | item.action && item.action.forEach(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | resetButton(item, cell) |
| | | }) |
| | | |
| | | if (item.type === 'table') { |
| | | let getCols = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | if (col.type === 'colspan') { |
| | | getCols(col.subcols || []) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | |
| | | resetButton(item, cell) |
| | | }) |
| | | } else if (item.subtype === 'editable' && col.editable === 'true') { |
| | | if (col.editType === 'select' && col.resourceType === '1') { |
| | | let msg = getFormSql(col) |
| | | |
| | | sqls.push({uuid: col.uuid, type: 'tbForm', ...msg}) |
| | | } else if (col.editType === 'popSelect') { |
| | | if (col.pops) { |
| | | col.pops.forEach(n => { |
| | | let msg = getPopSelectSql(n) |
| | | |
| | | sqls.push({uuid: n.uuid, type: 'popSource', ...msg}) |
| | | }) |
| | | } else { |
| | | let msg = getPopSelectSql(col) |
| | | |
| | | sqls.push({uuid: col.uuid, type: 'popSource', ...msg}) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getCols(item.cols) |
| | | |
| | | if (item.subtype === 'editable' && item.submit.intertype === 'system') { |
| | | let msg = getEditTableSql(item.submit, item.cols, item.columns) |
| | | |
| | | sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', ...msg}) |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | |
| | | resetButton(item, cell) |
| | | }) |
| | | |
| | | if (!card.backElements || card.backElements.length === 0) return |
| | | |
| | | card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | |
| | | resetButton(item, cell, true) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | |
| | | resetButton(item, cell) |
| | | }) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | group.subButton.OpenType = 'formSubmit' |
| | | if (!group.subButton.Ot) { |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | | } |
| | | group.subButton.uuid = group.uuid |
| | | group.subButton.modal = { |
| | | fields: group.fields |
| | | } |
| | | |
| | | resetButton(item, group.subButton) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let resetButton = (item, cell, isback) => { |
| | | if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) { |
| | | if (cell.intertype === 'system' || cell.procMode === 'system') { // 系统接口 |
| | | if (item.subtype === 'dualdatacard' && isback) { |
| | | let _item = fromJS(item).toJS() |
| | | _item.columns = _item.subColumns || [] |
| | | _item.setting.primaryKey = _item.setting.subKey |
| | | |
| | | let msg = getSysDefaultSql(cell, _item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'button', ...msg}) |
| | | } else { |
| | | let msg = getSysDefaultSql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'button', ...msg}) |
| | | } |
| | | } |
| | | if (cell.callbackType === 'script' && cell.verify && cell.verify.cbScripts) { |
| | | if (item.subtype === 'dualdatacard' && isback) { |
| | | let _item = fromJS(item).toJS() |
| | | _item.columns = _item.subColumns || [] |
| | | |
| | | let msg = getSysBackSql(cell, _item) |
| | | |
| | | sqls.push({uuid: 'back_' + cell.uuid, type: 'btnCallBack', ...msg}) |
| | | } else { |
| | | let msg = getSysBackSql(cell, item) |
| | | |
| | | sqls.push({uuid: 'back_' + cell.uuid, type: 'btnCallBack', ...msg}) |
| | | } |
| | | } |
| | | if (['pop', 'formSubmit'].includes(cell.OpenType) && cell.modal && cell.modal.fields) { |
| | | cell.modal.fields.forEach(form => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { |
| | | let msg = getFormSql(form) |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'form', ...msg}) |
| | | } else if (form.type === 'popSelect') { |
| | | let msg = getPopSelectSql(form) |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'popSource', ...msg}) |
| | | } |
| | | }) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn') { |
| | | if (cell.intertype === 'system') { |
| | | let msg = getExcelInSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'excelIn', ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'excelOut') { |
| | | if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { |
| | | let msg = getExcelOutSql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'excelOut', ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'funcbutton') { |
| | | if (cell.funcType === 'print') { |
| | | if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { |
| | | let msg = getPrintSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'print', ...msg}) |
| | | } |
| | | if (cell.execMode === 'pop' && cell.modal && cell.modal.fields) { |
| | | cell.modal.fields.forEach(form => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { |
| | | let msg = getFormSql(form) |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'form', ...msg}) |
| | | } else if (form.type === 'popSelect') { |
| | | let msg = getPopSelectSql(form) |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'popSource', ...msg}) |
| | | } |
| | | }) |
| | | } |
| | | } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system') { |
| | | let msg = getPaySql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'pay', ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { |
| | | if (cell.pageTemplate === 'pay' && cell.payMode === 'system') { |
| | | let msg = getPaySql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'pay', ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components) { |
| | | let _mainSearch = [] |
| | | |
| | | if (appType === 'mob') { |
| | | cell.config.components.forEach(item => { |
| | | if (item.type === 'search' && item.wrap.field) { |
| | | _mainSearch.push({ |
| | | type: 'text', |
| | | label: item.wrap.label, |
| | | field: item.wrap.field, |
| | | match: item.wrap.match, |
| | | required: item.wrap.required, |
| | | value: item.wrap.initval || '' |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | cell.config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | _mainSearch = component.search || [] |
| | | }) |
| | | } |
| | | |
| | | filterComponent(cell.config.components, _mainSearch) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let getSearches = (searches) => { |
| | | let sFields = [] |
| | | let query = false |
| | | searches.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | if (item.type === 'group') { |
| | | sFields.push(item.field) |
| | | sFields.push(item.datefield) |
| | | sFields.push(item.datefield + '1') |
| | | } else if (item.type === 'date') { |
| | | if (sFields.includes(item.field)) { |
| | | sFields.push(item.field + '1') |
| | | } else { |
| | | sFields.push(item.field) |
| | | } |
| | | } else if (item.type === 'dateweek') { |
| | | sFields.push(item.field) |
| | | sFields.push(item.field + '1') |
| | | } else if (item.type === 'range') { |
| | | sFields.push(item.field) |
| | | sFields.push(item.field + '1') |
| | | } else if (item.type === 'datemonth') { |
| | | if (item.match === '=') { |
| | | sFields.push(item.field) |
| | | } else { |
| | | sFields.push(item.field) |
| | | sFields.push(item.field + '1') |
| | | } |
| | | } else if (item.type === 'daterange') { |
| | | if (/,/.test(item.field)) { |
| | | sFields.push(item.field.split(',')[0]) |
| | | sFields.push(item.field.split(',')[1]) |
| | | } else { |
| | | sFields.push(item.field) |
| | | sFields.push(item.field + '1') |
| | | } |
| | | } else if (item.type === 'text' || item.type === 'select') { |
| | | item.field.split(',').forEach(field => { |
| | | sFields.push(field) |
| | | }) |
| | | } else { |
| | | sFields.push(item.field) |
| | | } |
| | | |
| | | if (query) return |
| | | |
| | | query = item.query !== 'false' |
| | | }) |
| | | |
| | | return { sFields, query } |
| | | } |
| | | |
| | | let getSysDefaultSql = (btn, component) => { |
| | | let primaryId = '@ID@' |
| | | let BID = '@BID@' |
| | | let verify = btn.verify || {} |
| | | let _actionType = null |
| | | let setting = component.setting || {} |
| | | let columns = component.columns || [] |
| | | let primaryKey = setting.primaryKey || 'id' |
| | | let colreps = [] // 待替换变量集 |
| | | |
| | | if (verify.invalid === 'true') { |
| | | if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { |
| | | verify.invalid = 'false' |
| | | } else if (setting.maxScript && setting.maxScript >= 300) { |
| | | verify.invalid = 'false' |
| | | } else if (!setting.dataresource) { |
| | | verify.invalid = 'false' |
| | | } else if (btn.intertype !== 'system' && btn.procMode !== 'system') { |
| | | verify.invalid = 'false' |
| | | } else if (btn.sqlType === 'insert') { |
| | | verify.invalid = 'false' |
| | | } else if (btn.Ot === 'notRequired') { |
| | | verify.invalid = 'false' |
| | | } |
| | | } |
| | | if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce') { |
| | | if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { |
| | | verify.uniques = [] |
| | | } |
| | | } |
| | | |
| | | if (verify.default !== 'false') { // 判断是否使用默认sql |
| | | _actionType = btn.sqlType |
| | | } |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | |
| | | verify.scripts && verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (item.position === 'init') { |
| | | _initCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } else if (item.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | | |
| | | let _sql = '' |
| | | |
| | | let _initFormfields = [] |
| | | let _declares = [] |
| | | |
| | | let formdata = null |
| | | let formkeys = [] |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { |
| | | formdata = [] |
| | | if (btn.modal && btn.modal.fields) { |
| | | btn.modal.fields.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | let _item = { |
| | | key: item.field, |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | if (_item.type === 'datemonth') { |
| | | _item.type = 'text' |
| | | } else if (_item.type === 'number' || _item.type === 'rate') { |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (_item.type === 'datetime') { |
| | | _item.type = 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | formdata.push(_item) |
| | | }) |
| | | } |
| | | } else if (btn.OpenType === 'form') { |
| | | formdata = [] |
| | | |
| | | let item = { |
| | | type: 'text', |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: 50, |
| | | key: btn.field |
| | | } |
| | | if (btn.formType === 'counter') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } else if (btn.formType === 'switch' || btn.formType === 'radio') { |
| | | if (typeof(btn.openVal) === 'number') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } |
| | | } |
| | | formdata.push(item) |
| | | } |
| | | |
| | | // 获取字段键值对 |
| | | formdata && formdata.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (!formkeys.includes(_key)) { |
| | | formkeys.push(_key) |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | _initFormfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else if (form.type === 'date') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (form.fieldlen && form.fieldlen > 4000) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } else if (form.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declares.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | |
| | | // 表单变量赋值 |
| | | if (_initFormfields.length > 0) { |
| | | _sql += ` |
| | | /* 表单变量赋值 */ |
| | | select ${_initFormfields.join(',')} |
| | | ` |
| | | } |
| | | if (btn.Ot !== 'notRequired' && columns.length > 0) { |
| | | _sql += '@mk_cols_values@' |
| | | } |
| | | |
| | | // 去除禁用的验证 |
| | | if (verify.contrasts) { |
| | | verify.contrasts = verify.contrasts.filter(item => item.status !== 'false') |
| | | } |
| | | if (verify.uniques) { |
| | | verify.uniques = verify.uniques.filter(item => item.status !== 'false') |
| | | } |
| | | if (verify.customverifys) { |
| | | verify.customverifys = verify.customverifys.filter(item => item.status !== 'false') |
| | | } |
| | | if (verify.billcodes) { |
| | | verify.billcodes = verify.billcodes.filter(item => item.status !== 'false') |
| | | } |
| | | |
| | | if (_initCustomScript) { |
| | | _sql += _initCustomScript |
| | | } |
| | | |
| | | // 启用账期验证 |
| | | if (verify.accountdate === 'true') { |
| | | let orgcode = `''` |
| | | let date = `''` |
| | | if (verify.accountfield) { |
| | | orgcode = '@' + verify.accountfield |
| | | } |
| | | if (verify.voucherdate) { |
| | | date = '@' + verify.voucherdate |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 账期验证 */ |
| | | exec s_FIBVoucherDateCheck @OrgCode=${orgcode},@FIBVoucherDate=${date},@ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | if @ErrorCode!='' |
| | | GOTO aaa |
| | | ` |
| | | } |
| | | |
| | | // 失效验证,添加数据时不用 |
| | | if (verify.invalid === 'true') { |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | |
| | | let regoptions = [{ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order || primaryKey |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 1 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }] |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (customScript) { |
| | | _sql += ` |
| | | /* 数据源自定义脚本,请注意变量定义是否重复 */ |
| | | ${customScript} |
| | | ` |
| | | } |
| | | |
| | | if (btn.Ot === 'requiredOnce') { |
| | | _sql += ` |
| | | /* 失效验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${datasource} right join (select ID from dbo.SplitComma(@ID@)) sp |
| | | on tb.${primaryKey} =sp.id where tb.${primaryKey} is null |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='E',@retmsg='数据已失效' |
| | | goto aaa |
| | | end |
| | | ` |
| | | } else { |
| | | _sql += ` |
| | | /* 失效验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid=${primaryKey} from ${datasource} where ${primaryKey}=@ID@ |
| | | If @tbid='' |
| | | Begin |
| | | select @ErrorCode='E',@retmsg='数据已失效' |
| | | goto aaa |
| | | end |
| | | ` |
| | | } |
| | | } |
| | | |
| | | // 比较验证 |
| | | if (verify.contrasts && verify.contrasts.length > 0) { |
| | | verify.contrasts.forEach(item => { |
| | | _sql += ` |
| | | /* 比较验证 */ |
| | | If ${item.frontfield} ${item.operator} ${item.backfield} |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | // 自定义验证 |
| | | verify.customverifys && verify.customverifys.forEach(item => { |
| | | _sql += ` |
| | | /* 自定义验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select top 1 @tbid='X' from (${item.sql}) a |
| | | If @tbid ${item.result === 'true' ? '!=' : '='}'' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | |
| | | // 单号生成,使用上级id(BID)或列表数据,声明变量(检验) |
| | | let _billcodesSql = '' |
| | | if (formdata && verify.billcodes && verify.billcodes.length > 0) { |
| | | verify.billcodes.forEach(item => { |
| | | let _key = item.field.toLowerCase() |
| | | let _linkKey = item.linkField ? item.linkField.toLowerCase() : '' |
| | | |
| | | if (!formkeys.includes(_key)) return // 表单中不含单号生成字段 |
| | | |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` |
| | | } |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` |
| | | } |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` |
| | | } |
| | | |
| | | _billcodesSql += ` |
| | | /* 单号生成 */ |
| | | select @BillCode='', @${_key}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=@ModularDetailCode, |
| | | @Type=${item.Type}, |
| | | @TypeCharOne='${item.TypeCharOne}', |
| | | @TypeCharTwo ='${item.TypeCharTwo}', |
| | | @BillCode =@BillCode output, |
| | | @ErrorCode =@ErrorCode output, |
| | | @retmsg=@retmsg output |
| | | if @ErrorCode!='' |
| | | goto aaa |
| | | set @${_key}=@BillCode |
| | | ` |
| | | }) |
| | | |
| | | if (_actionType !== 'insertOrUpdate') { |
| | | _sql += _billcodesSql |
| | | } |
| | | } |
| | | |
| | | // 唯一性验证,必须存在表单(表单存在时,主键均为单值),必须填写数据源,多行拼接时不可用 |
| | | if (formdata && verify.uniques && verify.uniques.length > 0 && btn.Ot !== 'requiredOnce') { |
| | | verify.uniques.forEach(item => { |
| | | let _fieldValue = [] // 表单键值对field=value |
| | | let _value = [] // 表单值,用于错误提示 |
| | | let _labels = item.fieldlabel.split(',') // 表单提示文字 |
| | | let arr = [] // 验证主键 |
| | | |
| | | item.field.split(',').forEach((_field, index) => { |
| | | let _key = _field.toLowerCase() |
| | | let _val = '' |
| | | |
| | | arr.push(_key) |
| | | if (_key === 'bid') { // 表单中没有bid则使用系统bid变量 |
| | | _val = BID |
| | | } else { |
| | | _val = `'@mk_${_key}_mk@'` |
| | | } |
| | | |
| | | _fieldValue.push(`${_key}=${_val}`) |
| | | _value.push(`${_labels[index] || ''}:${_val || ''}`) |
| | | }) |
| | | |
| | | if (!arr.includes(primaryKey.toLowerCase())) { |
| | | _fieldValue.push(`${primaryKey} !=${primaryId}`) |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 唯一性验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } else if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce' && setting.dataresource) { |
| | | let datasource = setting.dataresource |
| | | if (/\s/.test(datasource)) { // 拼接别名 |
| | | if (!/tb$/.test(datasource)) { |
| | | datasource = '(' + datasource + ') tb' |
| | | } |
| | | } else { |
| | | datasource = datasource + ' tb' |
| | | } |
| | | |
| | | if (setting.customScript) { |
| | | _sql += ` |
| | | /* 数据源自定义脚本,请注意变量定义是否重复 */ |
| | | ${setting.customScript} |
| | | ` |
| | | } |
| | | |
| | | verify.uniques.forEach(item => { |
| | | _sql += ` |
| | | /* 同类数据验证 */ |
| | | Set @tbid='' |
| | | |
| | | Select top 1 @tbid='X' from (select distinct ${item.field},1 as n from ${datasource} inner join (select ID from dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a having sum(n)>1 |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | Set @ErrorCode='E' Set @retmsg='${item.fieldlabel} 值不唯一' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let hasvoucher = false |
| | | |
| | | // 凭证-显示列中选取,必须选行 |
| | | if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'requiredOnce') { |
| | | let _voucher = verify.voucher |
| | | |
| | | hasvoucher = true |
| | | |
| | | _sql += ` |
| | | /* 创建凭证 */ |
| | | exec s_BVoucher_Create |
| | | @Bill ='0', |
| | | @BVoucherType ='${_voucher.BVoucherType}', |
| | | @VoucherTypeOne ='${_voucher.VoucherTypeOne}', |
| | | @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', |
| | | @Type =${_voucher.Type}, |
| | | @UserID=@UserID@, |
| | | @Username=@Username, |
| | | @FullName=@FullName, |
| | | @BVoucher =@BVoucher OUTPUT , |
| | | @FIBVoucherDate =@FIBVoucherDate OUTPUT , |
| | | @FiYear =@FiYear OUTPUT , |
| | | @ErrorCode =@ErrorCode OUTPUT, |
| | | @retmsg=@retmsg OUTPUT |
| | | if @ErrorCode!='' |
| | | GOTO aaa |
| | | ` |
| | | } |
| | | |
| | | let _insertsql = '' |
| | | if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { // 添加语句 |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | let _key = item.key.toLowerCase() |
| | | |
| | | keys.push(_key) |
| | | values.push('@mk_' + _key + '_mk@') |
| | | }) |
| | | |
| | | if (!keys.includes(primaryKey.toLowerCase())) { |
| | | keys.push(primaryKey.toLowerCase()) |
| | | values.push(primaryId) |
| | | } |
| | | if (!keys.includes('createuserid')) { |
| | | keys.push('createuserid') |
| | | values.push('@userid@') |
| | | } |
| | | if (!keys.includes('createuser')) { |
| | | keys.push('createuser') |
| | | values.push('@username') |
| | | } |
| | | if (!keys.includes('createstaff')) { |
| | | keys.push('createstaff') |
| | | values.push('@fullname') |
| | | } |
| | | if (!keys.includes('bid')) { |
| | | keys.push('bid') |
| | | values.push('@BID@') |
| | | } |
| | | |
| | | if (!keys.includes('typename')) { |
| | | keys.push('typename') |
| | | values.push('@typename@') |
| | | } |
| | | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | _insertsql = `insert into ${btn.sql} (${keys}) select ${values};` |
| | | } |
| | | |
| | | let _updatesql = '' |
| | | if (_actionType === 'update' || _actionType === 'audit' || _actionType === 'insertOrUpdate') { // 修改语句 |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | let _key = item.key.toLowerCase() |
| | | |
| | | _arr.push(_key) |
| | | _form.push(_key + '=@mk_' + _key + '_mk@') |
| | | }) |
| | | |
| | | if (_actionType === 'audit') { |
| | | if (!_arr.includes('submitdate')) { |
| | | _form.push('submitdate=getdate()') |
| | | } |
| | | if (!_arr.includes('submituser')) { |
| | | _form.push('submituser=@username') |
| | | } |
| | | if (!_arr.includes('submitstaff')) { |
| | | _form.push('submitstaff=@fullname') |
| | | } |
| | | if (!_arr.includes('submituserid')) { |
| | | _form.push('submituserid=@userid@') |
| | | } |
| | | } else { |
| | | if (!_arr.includes('modifydate')) { |
| | | _form.push('modifydate=getdate()') |
| | | } |
| | | if (!_arr.includes('modifyuser')) { |
| | | _form.push('modifyuser=@username') |
| | | } |
| | | if (!_arr.includes('modifystaff')) { |
| | | _form.push('modifystaff=@fullname') |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | } |
| | | } |
| | | |
| | | if (hasvoucher) { |
| | | if (!_arr.includes('bvoucher')) { |
| | | _form.push('BVoucher=@BVoucher') |
| | | } |
| | | if (!_arr.includes('fibvoucherdate')) { |
| | | _form.push('FIBVoucherDate=@FIBVoucherDate') |
| | | } |
| | | if (!_arr.includes('fiyear')) { |
| | | _form.push('FiYear=@FiYear') |
| | | } |
| | | } |
| | | if (!_arr.includes('typename')) { |
| | | _form.push('typename=@typename@') |
| | | } |
| | | _form = _form.join(',') |
| | | |
| | | let _ID = '=@ID@' |
| | | if (btn.Ot === 'requiredOnce') { |
| | | _ID = ' in (select ID from dbo.SplitComma(@ID@))' |
| | | } |
| | | |
| | | _updatesql = `update ${btn.sql} set ${_form} where ${primaryKey}${_ID};` |
| | | } |
| | | |
| | | if (_prevCustomScript) { |
| | | _sql += _prevCustomScript |
| | | } |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (_actionType === 'insert') { |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | ${_insertsql}` |
| | | } else if (_actionType === 'update' || _actionType === 'audit') { |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | ${_updatesql}` |
| | | } else if (_actionType === 'LogicDelete') { // 逻辑删除 |
| | | let _ID = '=@ID@' |
| | | if (btn.Ot === 'requiredOnce') { |
| | | _ID = ' in (select ID from dbo.SplitComma(@ID@))' |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | update ${btn.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}${_ID};` |
| | | |
| | | } else if (_actionType === 'delete') { // 物理删除 |
| | | let _msg = '' |
| | | if (columns && columns.length > 0 && btn.Ot !== 'notRequired') { |
| | | let _index = 0 |
| | | columns.forEach(col => { |
| | | if (_index >= 4 || col.field === primaryKey) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | _msg += col.label + `=@mk_${col.field}_mk@,` |
| | | _index++ |
| | | }) |
| | | } |
| | | |
| | | let _ID = '=@ID@' |
| | | if (btn.Ot === 'requiredOnce') { |
| | | _ID = ' in (select ID from dbo.SplitComma(@ID@))' |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ |
| | | delete ${btn.sql} where ${primaryKey}${_ID};` |
| | | } else if (_actionType === 'insertOrUpdate') { |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | select @tbid='' |
| | | select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@ |
| | | if @tbid='' |
| | | begin |
| | | ${_billcodesSql} |
| | | ${_insertsql} |
| | | end |
| | | else |
| | | begin |
| | | ${_updatesql} |
| | | end |
| | | ` |
| | | } |
| | | |
| | | if (verify.workFlow === 'true' && verify.flowSql === 'true' && process) { |
| | | if (verify.flowType === 'start') { |
| | | _sql += ` |
| | | /* 工作流异常sql */ |
| | | if @works_flow_error@ != '' |
| | | select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa |
| | | |
| | | /* 工作流默认sql */ |
| | | insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@ |
| | | insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid,typecharone) |
| | | select @ID@,@works_flow_code@,@userid@,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@,'begin' |
| | | ` |
| | | } else { |
| | | let field = '@works_flow_sign_field@' |
| | | let label = '@works_flow_sign_label@' |
| | | |
| | | _sql += ` |
| | | /* 工作流异常sql */ |
| | | if @works_flow_error@ != '' |
| | | select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa |
| | | |
| | | if @works_flow_countersign@ = 'Y' |
| | | begin |
| | | /* 工作流默认sql(会签) */ |
| | | declare @works_flow_statuscharone nvarchar(50),@works_flow_statuschartwo nvarchar(50),@works_flow_statuscharthree nvarchar(50),@works_flow_statuscharfour nvarchar(50),@works_flow_statuscharfive nvarchar(50),@works_flow_key_id nvarchar(50),@works_flow_key_status nvarchar(20),@s_my_works_flow_log_param nvarchar(max),@s_my_works_flow_log_status int,@s_my_works_flow_log_statusname nvarchar(50),@s_my_works_flow_log_detail_id nvarchar(50) |
| | | select @works_flow_statuscharone='',@works_flow_statuschartwo='',@works_flow_statuscharthree='',@works_flow_statuscharfour='',@works_flow_statuscharfive='',@works_flow_key_id='',@works_flow_key_status ='',@s_my_works_flow_log_param='',@s_my_works_flow_log_status=0,@s_my_works_flow_log_statusname='',@s_my_works_flow_log_detail_id='' |
| | | |
| | | select @works_flow_statuscharone=statuscharone,@works_flow_statuschartwo=statuschartwo,@works_flow_statuscharthree=statuscharthree,@works_flow_statuscharfour=statuscharfour,@works_flow_statuscharfive=statuscharfive,@works_flow_key_id=id,@s_my_works_flow_log_param=works_flow_param,@s_my_works_flow_log_status=status,@s_my_works_flow_log_statusname=statusname,@s_my_works_flow_log_detail_id=works_flow_detail_id |
| | | from s_my_works_flow where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | |
| | | if @works_flow_statuscharone + @works_flow_statuschartwo + @works_flow_statuscharthree + @works_flow_statuscharfour + @works_flow_statuscharfive = @works_flow_sign_values@ |
| | | begin |
| | | set @works_flow_key_status='Y' |
| | | end |
| | | |
| | | if @works_flow_key_status='Y' |
| | | begin |
| | | update s_my_works_flow set ${field}=${label},status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} |
| | | where id=@works_flow_key_id |
| | | |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''},${field}) |
| | | select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''},${label} |
| | | |
| | | update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | |
| | | if @check_userids@ != '' |
| | | begin |
| | | insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@check_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) |
| | | end |
| | | if @notice_userids@ != '' |
| | | begin |
| | | update n |
| | | set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n |
| | | inner join (select ID from dbo.SplitComma(@notice_userids@)) s |
| | | on n.userid = s.id |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@notice_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@notice_userids@) |
| | | end |
| | | end |
| | | else |
| | | begin |
| | | update s_my_works_flow set ${field}=${label},modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} |
| | | where id =@works_flow_key_id |
| | | |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''},${field}) |
| | | select @ID@,@works_flow_code@,@works_flow_name@ ,@s_my_works_flow_log_param,@s_my_works_flow_log_status,@s_my_works_flow_log_statusname,@s_my_works_flow_log_detail_id,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''},${label} |
| | | |
| | | update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@ |
| | | end |
| | | end |
| | | else |
| | | begin |
| | | /* 工作流默认sql(或签) */ |
| | | set @retmsg ='' |
| | | select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@ |
| | | |
| | | if @retmsg ='' |
| | | begin |
| | | select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and userid=@userid@ |
| | | |
| | | if @retmsg !='' |
| | | begin |
| | | select @ErrorCode='E', @retmsg='当前单据已审核,请刷新后重试' |
| | | goto aaa |
| | | end |
| | | |
| | | if @dataM@ !='' |
| | | begin |
| | | set @retmsg ='' |
| | | select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | |
| | | if @retmsg != '' |
| | | begin |
| | | goto goto_mk |
| | | end |
| | | end |
| | | |
| | | select @retmsg='页面数据已更新,或没有当前单据的审批权限' |
| | | goto aaa |
| | | end |
| | | |
| | | goto_mk: |
| | | |
| | | set @retmsg='' |
| | | |
| | | update s_my_works_flow set status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} |
| | | where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''}) |
| | | select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''} |
| | | |
| | | if @works_begin_branch@ = 'Y' |
| | | begin |
| | | update s_my_works_flow_role set deleted=0,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and typecharone='begin' |
| | | end |
| | | else |
| | | begin |
| | | update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | end |
| | | |
| | | if @check_userids@ != '' |
| | | begin |
| | | insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@check_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) |
| | | end |
| | | if @notice_userids@ != '' |
| | | begin |
| | | update n |
| | | set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname |
| | | from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n |
| | | inner join (select ID from dbo.SplitComma(@notice_userids@)) s |
| | | on n.userid = s.id |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@notice_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@notice_userids@) |
| | | end |
| | | end |
| | | ` |
| | | } |
| | | |
| | | if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | | } else if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | | |
| | | if (verify.workFlow === 'true' && process) { |
| | | if (verify.flowType === 'start') { |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } else { |
| | | // works_flow_error 流程错误 |
| | | // works_flow_countersign 会签/或签标记 会签为 Y |
| | | // works_begin_branch 驳回至开始分支(line.mknode === 'startEdge') |
| | | // works_flow_sign_field 会签 标记字段 statuscharone/statuschartwo/statuscharthree/statuscharfour/statuscharfive |
| | | // works_flow_sign_label 会签 标记值 ***/***/已审核 |
| | | // works_flow_sign_values 会签标记拼接值(除本人外) |
| | | let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_flow_sign_values', 'works_begin_branch', 'works_flow_sign_label', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'check_type', 'notice_type', 'check_userids', 'notice_userids', 'works_flow_sign'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (btn.procMode === 'system') { |
| | | _sql += ` |
| | | aaa: if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@` |
| | | } else if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (btn.Ot !== 'notRequired' && columns.length > 0) { |
| | | let _initColfields = [] |
| | | columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(_sql)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(_sql)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | if (col.type === 'number') { |
| | | _initColfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else { |
| | | _initColfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) |
| | | } |
| | | }) |
| | | |
| | | // 显示列变量赋值 |
| | | if (_initColfields.length > 0) { |
| | | _sql = _sql.replace('@mk_cols_values@', ` |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields.join(',')} |
| | | `) |
| | | } else { |
| | | _sql = _sql.replace('@mk_cols_values@', '') |
| | | } |
| | | } |
| | | |
| | | let reps = [] |
| | | let decSql = [`@tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50),@mk_deleted int,@bid nvarchar(50)`] |
| | | let secSql = [`@ErrorCode='',@retmsg='', @BillCode='',@BVoucher='',@FIBVoucherDate='',@FiYear='',@ModularDetailCode='', @mk_deleted=1, @bid=@BID@`] |
| | | |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | /* 凭证及用户信息初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | if (/\$check@|@check\$/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$check@/ig, '@mk_check_begin@').replace(/@check\$/ig, '@mk_check_end@') |
| | | reps.push('mk_check_begin', 'mk_check_end') |
| | | } |
| | | if (/@db@/ig.test(_sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | |
| | | return { LText: _sql, reps } |
| | | } |
| | | |
| | | let getSysBackSql = (btn, component) => { |
| | | let verify = btn.verify || {} |
| | | let columns = component.columns || [] |
| | | let colreps = [] // 待替换变量集 |
| | | let _prev = '' |
| | | let _back = '' |
| | | let tables = [] |
| | | let reps = [] |
| | | |
| | | verify.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) { |
| | | tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig)) |
| | | } |
| | | |
| | | if (script.position === 'front') { |
| | | _prev += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _back += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | tables = tables.map(tb => tb.replace(/\s|\(/g, '')) |
| | | |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | | |
| | | let _sql = '' |
| | | |
| | | let _initFormfields = [] |
| | | let _declares = [] |
| | | |
| | | let formdata = null |
| | | let formkeys = [] |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { |
| | | formdata = [] |
| | | if (btn.modal && btn.modal.fields) { |
| | | btn.modal.fields.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | let _item = { |
| | | key: item.field, |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | if (_item.type === 'datemonth') { |
| | | _item.type = 'text' |
| | | } else if (_item.type === 'number' || _item.type === 'rate') { |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (_item.type === 'datetime') { |
| | | _item.type = 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | formdata.push(_item) |
| | | }) |
| | | } |
| | | } else if (btn.OpenType === 'form') { |
| | | formdata = [] |
| | | |
| | | let item = { |
| | | type: 'text', |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: 50, |
| | | key: btn.field |
| | | } |
| | | if (btn.formType === 'counter') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } else if (btn.formType === 'switch' || btn.formType === 'radio') { |
| | | if (typeof(btn.openVal) === 'number') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } |
| | | } |
| | | formdata.push(item) |
| | | } |
| | | |
| | | // 获取字段键值对 |
| | | formdata && formdata.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (!formkeys.includes(_key)) { |
| | | formkeys.push(_key) |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | _initFormfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else if (form.type === 'date') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (form.fieldlen && form.fieldlen > 4000) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } else if (form.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declares.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | |
| | | // 表单变量赋值 |
| | | if (_initFormfields.length > 0) { |
| | | _sql += ` |
| | | /* 表单变量赋值 */ |
| | | select ${_initFormfields.join(',')} |
| | | ` |
| | | } |
| | | |
| | | let testSql = _prev + _back |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (btn.Ot !== 'notRequired' && columns.length > 0) { |
| | | let _initColfields = [] |
| | | columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(testSql)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(testSql)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | if (col.type === 'number') { |
| | | _initColfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else { |
| | | _initColfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) |
| | | } |
| | | }) |
| | | |
| | | // 显示列变量赋值 |
| | | if (_initColfields.length > 0) { |
| | | _sql += ` |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields.join(',')} |
| | | ` |
| | | } |
| | | } |
| | | |
| | | _sql += ` |
| | | ${_prev} |
| | | /* 外部接口入参 */ |
| | | @mk_outer_params@ |
| | | ${_back} |
| | | ` |
| | | |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let syses = ['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'mk_deleted', 'bid', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] |
| | | let secSql = [`@ErrorCode='',@retmsg=''`] |
| | | |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else if (['mk_deleted'].includes(s)) { |
| | | secSql.push(`@mk_deleted int`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | if (['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'].includes(s)) { |
| | | secSql.push(`@${s}=''`) |
| | | } else if (['mk_deleted'].includes(s)) { |
| | | secSql.push(`@mk_deleted=1`) |
| | | } else if (['bid'].includes(s)) { |
| | | secSql.push(`@bid=@BID@`) |
| | | } else { |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | /* 初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(_sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | |
| | | return { LText: _sql, reps, tbs: tables } |
| | | } |
| | | |
| | | let getDataSource = (item, mainSearch = []) => { |
| | | if (!item.setting || item.setting.interType !== 'system') return |
| | | |
| | | let searches = item.search || [] |
| | | if (item.setting.useMSearch === 'true' && mainSearch.length > 0) { |
| | | searches = [...searches, ...mainSearch] |
| | | } |
| | | item.$searches = fromJS(searches).toJS() |
| | | let { sFields, query } = getSearches(searches) |
| | | |
| | | let _columns = [] |
| | | if (item.subtype === 'dualdatacard') { |
| | | _columns = [...item.columns, ...item.subColumns] |
| | | } else if (item.columns) { |
| | | _columns = [...item.columns] |
| | | } |
| | | |
| | | let arr_field = _columns.map(col => col.field).join(',') |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | let _dataresource = '' |
| | | item.scripts && item.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | if (item.setting.execute !== 'false') { |
| | | _dataresource = item.setting.dataresource || '' |
| | | } |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | item.setting.dataresource = _dataresource |
| | | item.setting.customScript = _customScript |
| | | |
| | | let _search = '@search@' |
| | | if (item.setting.queryType === 'statistics' || !query) { |
| | | _search = '' |
| | | } |
| | | |
| | | let testSql = _dataresource + _customScript + _tailScript |
| | | |
| | | let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] |
| | | let secSql = [`@ErrorCode='',@retmsg =''`] |
| | | |
| | | let reps = [] |
| | | if (_customScript || _tailScript) { |
| | | reps.push('UserID', 'time_id') |
| | | } |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(testSql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = `declare ${decSql.join(',')} |
| | | select ${secSql.join(',')}` |
| | | |
| | | // 不需要单引号:orderBy、pageSize、pageIndex、db |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam', 'typename'] |
| | | |
| | | if (item.hasExtend) { |
| | | regs.push('mk_time') |
| | | } |
| | | if (item.type === 'calendar') { |
| | | regs.push('mk_year') |
| | | } |
| | | if (window.GLOB.getLocation) { |
| | | regs.push('mk_longitude', 'mk_latitude') |
| | | } |
| | | if (urlFields) { |
| | | regs.push(...urlFields) |
| | | } |
| | | if (process) { |
| | | regs.push('works_flow_code') |
| | | } |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(testSql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | let LText = '' |
| | | let DateCount = '' |
| | | if (_dataresource) { |
| | | if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } else if (item.setting.laypage === 'true' && item.setting.order) { |
| | | 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 ` |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | if (item.subtype === 'dualdatacard') { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | } |
| | | } else if (item.setting.$top) { |
| | | if (item.setting.order) { |
| | | LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } else { |
| | | LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } else if (item.setting.order) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } else { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } |
| | | |
| | | if (_customScript) { |
| | | _customScript = `${decSql} |
| | | ${_customScript} |
| | | ` |
| | | if (DateCount) { |
| | | DateCount = `${DateCount} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ |
| | | ` |
| | | } else if (LText) { |
| | | LText = `${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | _customScript = `${_customScript} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } |
| | | } else if (_tailScript && DateCount) { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | ` |
| | | DateCount = `${DateCount} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else if (_tailScript) { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | ` |
| | | } |
| | | |
| | | reps = Array.from(new Set(reps)) |
| | | |
| | | // LText = LText.replace(/\n\s{6,8}/g, '\n') |
| | | // DateCount = DateCount.replace(/\n\s{6,8}/g, '\n') |
| | | // _customScript = _customScript.replace(/\n\s{6,8}/g, '\n') |
| | | // LText = LText.replace(/\n\s+\/\*/g, `\n/*`) |
| | | // DateCount = DateCount.replace(/\n\s+\/\*/g, `\n/*`) |
| | | // _customScript = _customScript.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | reps.forEach(n => { |
| | | if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return |
| | | |
| | | LText = LText.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | _customScript = _customScript.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | if (/\$@/ig.test(testSql)) { |
| | | LText = LText.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | _customScript = _customScript.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(testSql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | // let sql = '' |
| | | // let sub_name = '' |
| | | // let tabid = '' |
| | | // let parid = '' |
| | | // let sub_field = '' |
| | | |
| | | // if (item.subtype === 'dualdatacard') { |
| | | // arr_field = item.columns.map(col => col.field).join(',') |
| | | // sub_name = item.setting.subdata |
| | | // tabid = item.setting.primaryKey || '' |
| | | // parid = item.setting.subBID || '' |
| | | // sub_field = item.subColumns.map(col => col.field).join(',') |
| | | // } |
| | | |
| | | // sql += ` |
| | | // SELECT obj_name='data',prm_field='',str_field='', |
| | | // arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' |
| | | // ` |
| | | |
| | | // if (DateCount) { |
| | | // sql += `UNION ALL |
| | | // SELECT obj_name='DateCount',prm_field='total',str_field='', |
| | | // arr_field='',tabid='',parid='',sub_name='',sub_field='' |
| | | // ` |
| | | // } |
| | | |
| | | return {LText, DateCount, customScript: _customScript, reps} |
| | | } |
| | | |
| | | let getExcelInSql = (item) => { |
| | | let btn = item.verify |
| | | let sheet = item.sheet.replace(/@db@/ig, '') |
| | | let database = '' |
| | | if (/@db@/ig.test(item.sheet)) { |
| | | database = '@db@' |
| | | } |
| | | |
| | | let sql = '' |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | 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})`}, |
| | | ] |
| | | |
| | | 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) { |
| | | let textFields = [] |
| | | let numberFields = [] |
| | | let dateFields = [] |
| | | btn.columns.forEach((col) => { |
| | | if (/Nvarchar/ig.test(col.type)) { |
| | | textFields.push(col.Column) |
| | | } else if (/Decimal|int/ig.test(col.type)) { |
| | | numberFields.push(col.Column) |
| | | } else if (/date/ig.test(col.type)) { |
| | | dateFields.push(col.Column) |
| | | } |
| | | }) |
| | | btn.uniques.forEach(unique => { |
| | | if (unique.status === 'false' || !unique.verifyType) return |
| | | |
| | | let _fields = unique.field.split(',') |
| | | let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) |
| | | _fields_ = _fields_.join(' and ') |
| | | |
| | | let _where = [] |
| | | _fields.forEach(f => { |
| | | if (textFields.includes(f)) { |
| | | _where.push(`${f}!=''`) |
| | | } else if (numberFields.includes(f)) { |
| | | _where.push(`${f}!=0`) |
| | | } else if (dateFields.includes(f)) { |
| | | _where.push(`${f}>'1949-10-01'`) |
| | | } |
| | | }) |
| | | _where = _where.length ? `where ${_where.join(' and ')} ` : '' |
| | | |
| | | if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { |
| | | _fields_ += ' and b.deleted=0' |
| | | } |
| | | |
| | | let _afields = [] |
| | | _fields = _fields.map(f => { |
| | | if (numberFields.includes(f)) { |
| | | _afields.push(`cast(a.${f} as nvarchar(50))`) |
| | | return `cast(${f} as nvarchar(50))` |
| | | } else if (dateFields.includes(f)) { |
| | | _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) |
| | | return `CONVERT(nvarchar(50), ${f}, 21)` |
| | | } |
| | | _afields.push(`a.${f}`) |
| | | |
| | | return f |
| | | }) |
| | | |
| | | _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 |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 重复' |
| | | goto aaa |
| | | end |
| | | |
| | | ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' |
| | | Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 与已有数据重复' |
| | | goto aaa |
| | | end` : ''} |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let declarefields = [] |
| | | let fields = [] |
| | | |
| | | btn.columns.forEach(col => { |
| | | if (col.import === 'false') return |
| | | |
| | | if (col.type === 'date') { |
| | | declarefields.push(`${col.Column} Nvarchar(50)`) |
| | | } else { |
| | | declarefields.push(`${col.Column} ${col.type}`) |
| | | } |
| | | fields.push(col.Column) |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _insert = '' |
| | | if (btn.default !== 'false') { |
| | | _insert = ` |
| | | /* 默认sql */ |
| | | Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | ${_initCustomScript} |
| | | |
| | | Insert into #${sheet} (${fields},jskey,BID) |
| | | |
| | | /* excel数据*/ |
| | | @mk_excel_data@ |
| | | |
| | | ${_uniquesql} |
| | | ${_prevCustomScript} |
| | | ${_insert}` |
| | | |
| | | if (btn.workFlow === 'true' && process) { |
| | | if (btn.flowSql === 'true') { |
| | | sql += ` |
| | | /* 工作流异常sql */ |
| | | if @works_flow_error@ != '' |
| | | select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa |
| | | |
| | | /* 工作流默认sql */ |
| | | insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid,typecharone) |
| | | select jskey,@works_flow_code@,@userid@,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@,'begin' |
| | | from #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql += ` |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | worksReFields.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } else { |
| | | sql += ` |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | } |
| | | |
| | | let getEditTableSql = (btn, cols, columns) => { |
| | | let sheet = btn.sheet.replace(/@db@/ig, '') |
| | | let database = '' |
| | | if (/@db@/ig.test(btn.sheet)) { |
| | | database = '@db@' |
| | | } |
| | | |
| | | let forms = [] |
| | | let _fields = {} |
| | | |
| | | columns.forEach(col => { |
| | | _fields[col.field] = col.datatype |
| | | }) |
| | | |
| | | let getColumns = (cols) => { |
| | | cols.forEach(item => { |
| | | if (item.type === 'colspan') { |
| | | getColumns(item.subcols) |
| | | } else if (item.editable === 'true') { |
| | | forms.push({ |
| | | field: item.field, |
| | | type: item.type, |
| | | datatype: _fields[item.field] || 'nvarchar(50)' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getColumns(cols) |
| | | |
| | | let sql = '' |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | 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})`}, |
| | | ] |
| | | |
| | | 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) { |
| | | let textFields = [] |
| | | let numberFields = [] |
| | | let dateFields = [] |
| | | columns.forEach((col) => { |
| | | if (/Nvarchar/ig.test(col.datatype)) { |
| | | textFields.push(col.field) |
| | | } else if (/Decimal|int/ig.test(col.datatype)) { |
| | | numberFields.push(col.field) |
| | | } else if (/date/ig.test(col.datatype)) { |
| | | dateFields.push(col.field) |
| | | } |
| | | }) |
| | | btn.uniques.forEach(unique => { |
| | | if (unique.status === 'false' || !unique.verifyType) return |
| | | |
| | | let _fields = unique.field.split(',') |
| | | let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) |
| | | _fields_ = _fields_.join(' and ') |
| | | |
| | | let _where = [] |
| | | _fields.forEach(f => { |
| | | if (textFields.includes(f)) { |
| | | _where.push(`${f}!=''`) |
| | | } else if (numberFields.includes(f)) { |
| | | _where.push(`${f}!=0`) |
| | | } else if (dateFields.includes(f)) { |
| | | _where.push(`${f}>'1949-10-01'`) |
| | | } |
| | | }) |
| | | _where = _where.length ? `where ${_where.join(' and ')} ` : '' |
| | | |
| | | if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { |
| | | _fields_ += ' and b.deleted=0' |
| | | } |
| | | |
| | | let _afields = [] |
| | | _fields = _fields.map(f => { |
| | | if (numberFields.includes(f)) { |
| | | _afields.push(`cast(a.${f} as nvarchar(50))`) |
| | | return `cast(${f} as nvarchar(50))` |
| | | } else if (dateFields.includes(f)) { |
| | | _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) |
| | | return `CONVERT(nvarchar(50), ${f}, 21)` |
| | | } |
| | | _afields.push(`a.${f}`) |
| | | |
| | | return f |
| | | }) |
| | | |
| | | _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 |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 重复' |
| | | goto aaa |
| | | end |
| | | |
| | | ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' |
| | | Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 与已有数据重复' |
| | | goto aaa |
| | | end` : ''} |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let declarefields = [] |
| | | let fields = [] |
| | | |
| | | forms.forEach(col => { |
| | | let key = col.field.toLowerCase() |
| | | if (key === 'jskey' || key === 'bid' || key === 'data_type') return |
| | | |
| | | declarefields.push(`${col.field} ${col.datatype}`) |
| | | fields.push(col.field) |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _insert = '' |
| | | if (btn.default !== 'false') { |
| | | _insert = ` |
| | | /* 默认sql */ |
| | | Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(256)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | |
| | | ${_initCustomScript} |
| | | Insert into #${sheet} (${fields},jskey,data_type,BID) |
| | | |
| | | /* table数据*/ |
| | | @mk_excel_data@ |
| | | |
| | | ${_uniquesql} |
| | | ${_prevCustomScript} |
| | | ${_insert} |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | } |
| | | |
| | | let getExcelOutSql = (btn, component) => { |
| | | let item = {setting: {}, columns: [], search: [], useMSearch: 'false'} |
| | | |
| | | btn.verify.columns.forEach(col => { |
| | | if (col.output === 'false' || !col.Column || col.Column === '$Index') return |
| | | item.columns.push({ |
| | | field: col.Column |
| | | }) |
| | | }) |
| | | |
| | | if (btn.verify.useSearch !== 'false') { |
| | | item.search = component.$searches |
| | | } |
| | | |
| | | item.setting.interType = 'system' |
| | | item.setting.execute = btn.verify.defaultSql || 'true' |
| | | item.setting.dataresource = btn.verify.dataresource || '' |
| | | item.setting.queryType = btn.verify.queryType |
| | | item.setting.laypage = btn.pagination |
| | | item.setting.order = btn.verify.order || '' |
| | | |
| | | if (btn.Ot === 'requiredOnce') { |
| | | item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' |
| | | } |
| | | |
| | | item.scripts = btn.verify.scripts || [] |
| | | |
| | | let msg = getDataSource(item, []) |
| | | |
| | | return msg |
| | | } |
| | | |
| | | let getPrintSql = (btn) => { |
| | | let item = {setting: {}, columns: btn.verify.columns || [], search: [], useMSearch: 'false'} |
| | | |
| | | item.setting.interType = 'system' |
| | | item.setting.execute = btn.verify.setting.defaultSql || 'true' |
| | | item.setting.dataresource = btn.verify.setting.dataresource || '' |
| | | item.setting.queryType = btn.verify.setting.queryType |
| | | item.setting.laypage = 'false' |
| | | item.setting.order = btn.verify.setting.order || '' |
| | | |
| | | item.scripts = btn.verify.scripts || [] |
| | | |
| | | let msg = getDataSource(item, []) |
| | | |
| | | return msg |
| | | } |
| | | |
| | | let getPaySql = (btn, component) => { |
| | | let _sql = `Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid nvarchar(50)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | ` |
| | | |
| | | btn.verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | _sql += ` |
| | | ${item.sql} |
| | | ` |
| | | }) |
| | | |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BID'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | let regs = ['ID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | syses = syses.map(n => n.toLowerCase()) |
| | | syses.push('tbid') |
| | | |
| | | let colreps = [] |
| | | component.columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (syses.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(_sql)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(_sql)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | decSql.push(`@${col.field} ${col.datatype || 'nvarchar(50)'}`) |
| | | |
| | | if (col.type === 'number') { |
| | | secSql.push(`@${col.field}=@mk_${col.field}_mk@`) |
| | | } else { |
| | | secSql.push(`@${col.field}='@mk_${col.field}_mk@'`) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | _sql = _sql.replace(/@mk_init_declare@/ig, decSql) |
| | | _sql = _sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | _sql = _sql.replace(/\n\s{6,8}/g, '\n') |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(_sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: _sql, reps} |
| | | } |
| | | |
| | | let getFormSql = (item) => { |
| | | let arrfield = [item.valueField, item.valueText] |
| | | |
| | | if (item.type === 'checkcard') { |
| | | arrfield = item.fields ? item.fields.map(f => f.field) : [] |
| | | arrfield.push(item.cardValField) |
| | | if (item.urlField) { |
| | | arrfield.push(item.urlField) |
| | | } else if (item.colorField) { |
| | | arrfield.push(item.colorField) |
| | | } else if (item.parentField) { |
| | | arrfield.push(item.parentField) |
| | | } |
| | | } |
| | | |
| | | if (item.linkField) { |
| | | arrfield.push(item.linkField) |
| | | } |
| | | if (['select', 'radio', 'link', 'checkcard'].includes(item.type) && item.linkSubField && item.linkSubField.length > 0) { |
| | | arrfield.push(...item.linkSubField) |
| | | } else if (item.type === 'text' && item.editType === 'select' && item.linkSubField && item.linkSubField.length > 0) { // 可编辑表 |
| | | arrfield.push(...item.linkSubField) |
| | | } |
| | | if (item.disableField) { |
| | | arrfield.push(item.disableField) |
| | | } |
| | | |
| | | arrfield = Array.from(new Set(arrfield)) |
| | | |
| | | let _datasource = item.dataSource |
| | | let sql = '' |
| | | |
| | | if (/\s/.test(_datasource)) { // 拼接别名 |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | arrfield = arrfield.join(',') |
| | | |
| | | if (item.orderBy) { |
| | | sql = `select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} order by orderfield ${item.orderType}` |
| | | } else { |
| | | sql = `select distinct ${arrfield} from ${_datasource}` |
| | | } |
| | | |
| | | let reps = [] |
| | | |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['mk_departmentcode', 'mk_organization', 'mk_user_type'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(20)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.join(',') |
| | | secSql = secSql.join(',') |
| | | |
| | | if (decSql) { |
| | | sql = `Declare ${decSql} select ${secSql} |
| | | ${sql} |
| | | ` |
| | | } |
| | | |
| | | let regs = ['ID', 'BID', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | } |
| | | |
| | | let getPopSelectSql = (item) => { |
| | | let arrfield = item.columns.map(f => f.field) |
| | | |
| | | if (item.linkSubField && item.linkSubField.length > 0) { |
| | | item.linkSubField.forEach(n => { |
| | | if (!arrfield.includes(n)) { |
| | | arrfield.push(n) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | arrfield = arrfield.join(',') |
| | | if (/\s/.test(item.dataSource)) { // 拼接别名 |
| | | item.dataSource = '(' + item.dataSource + ') tb' |
| | | } |
| | | |
| | | let sql = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let reps = [] |
| | | let sFields = [] |
| | | |
| | | if (item.searchKey) { |
| | | _search = '@search@' |
| | | sFields = item.searchKey.split(',') |
| | | } |
| | | |
| | | // 不需要单引号:orderBy、pageSize、pageIndex、db |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(item.dataSource)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | if (item.laypage === 'true') { |
| | | sql = `/*system_query*/select top @pageSize@ ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${item.dataSource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${item.dataSource} ${_search}` |
| | | |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | } else { |
| | | sql = `/*system_query*/select ${arrfield} from ${item.dataSource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } |
| | | |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['mk_departmentcode', 'mk_organization', 'mk_user_type'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(20)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.join(',') |
| | | secSql = secSql.join(',') |
| | | |
| | | if (decSql) { |
| | | sql = `Declare ${decSql} select ${secSql} |
| | | ${sql} |
| | | ` |
| | | } |
| | | |
| | | reps.forEach(n => { |
| | | if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return |
| | | |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, DateCount, reps} |
| | | } |
| | | |
| | | let _mainSearch = [] |
| | | |
| | | if (appType === 'mob') { |
| | | let search = [] |
| | | let ms = null |
| | | config.components.forEach(item => { |
| | | if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { |
| | | ms = item.search |
| | | } else if (item.type === 'search' && item.wrap.field) { |
| | | search.push({ |
| | | type: 'text', |
| | | field: item.wrap.field, |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (ms) { |
| | | if (ms.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | field: ms.setting.field, |
| | | }) |
| | | } |
| | | search.push(...ms.fields) |
| | | |
| | | ms.groups.forEach(group => { |
| | | if (group.setting.type === 'search') { |
| | | search.push({ |
| | | type: 'text', |
| | | field: group.setting.field, |
| | | }) |
| | | } |
| | | search.push(...group.fields) |
| | | }) |
| | | |
| | | if (search.length > 0) { |
| | | search.forEach(cell => { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { |
| | | let msg = getFormSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (search.length > 0) { |
| | | _mainSearch = search |
| | | } |
| | | } else { |
| | | config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | _mainSearch = component.search || [] |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces && config.interfaces.length > 0) { |
| | | config.interfaces.forEach(m => { |
| | | if (m.status !== 'true' || m.setting.interType !== 'system') return false |
| | | |
| | | m.setting.laypage = 'false' |
| | | m.setting.$top = true |
| | | |
| | | let msg = getDataSource(m, _mainSearch) |
| | | |
| | | sqls.push({uuid: m.uuid, type: 'interface', ...msg}) |
| | | }) |
| | | } |
| | | |
| | | filterComponent(config.components, _mainSearch) |
| | | |
| | | return sqls |
| | | } |
| | |
| | | { reg: /@orderBy@/ig, value: orderBy }, |
| | | { reg: /@pageSize@/ig, value: setting.laypage ? pageSize : '9999' }, |
| | | { reg: /@pageIndex@/ig, value: pageIndex}, |
| | | { reg: /@select\$|\$select@/ig, value: ''}, |
| | | { reg: /\$sum@/ig, value: '/*'}, |
| | | { reg: /@sum\$/ig, value: '*/'}, |
| | | // { reg: /@select\$|\$select@/ig, value: ''}, |
| | | // { reg: /\$sum@/ig, value: '/*'}, |
| | | // { reg: /@sum\$/ig, value: '*/'}, |
| | | { reg: /@ID@/ig, value: `'${id || ''}'`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | |
| | | ) |
| | | |
| | | if (setting.hasExtend) { |
| | | regoptions.push({ reg: /@mk_time@/ig, value: setting.extendTime }) |
| | | regoptions.push({ reg: /@mk_time@/ig, value: `'${setting.extendTime}'` }) |
| | | } |
| | | if (setting.$re_year) { |
| | | regoptions.push({ reg: /@mk_year@/ig, value: year }) |
| | | regoptions.push({ reg: /@mk_year@/ig, value: `'${year}'` }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | // if (window.backend && window.GLOB.CacheData.has('sql_' + setting.uuid)) { |
| | | // let item = window.GLOB.CacheData.get('sql_' + setting.uuid) |
| | | |
| | | // let values = { |
| | | // userid: sessionStorage.getItem('UserID') || '', |
| | | // time_id: Utils.getguid(), |
| | | // 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, |
| | | // orderby: orderBy, |
| | | // pagesize: setting.laypage ? pageSize : '9999', |
| | | // pageindex: pageIndex, |
| | | // id: id || '', |
| | | // bid: BID || '', |
| | | // loginuid: sessionStorage.getItem('LoginUID') || '', |
| | | // sessionuid: localStorage.getItem('SessionUid') || '', |
| | | // appkey: window.GLOB.appkey || '', |
| | | // lang: sessionStorage.getItem('lang'), |
| | | // typename: 'admin', |
| | | // datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | // datam_begin: sessionStorage.getItem('dataM') === 'true' ? '/*' : '', |
| | | // datam_end: sessionStorage.getItem('dataM') === 'true' ? '*/' : '', |
| | | // } |
| | | |
| | | // if (setting.hasExtend) { |
| | | // values.mk_time = setting.extendTime |
| | | // } |
| | | // if (setting.$re_year) { |
| | | // values.mk_year = year |
| | | // } |
| | | // if (window.GLOB.externalDatabase !== null) { |
| | | // values.db = window.GLOB.externalDatabase |
| | | // } |
| | | // if (item.works_flow_code) { |
| | | // values.works_flow_code = item.works_flow_code |
| | | // } |
| | | // item.urlkeys.forEach(key => { |
| | | // values[key] = item.urlparam[key] |
| | | // }) |
| | | |
| | | // let Ltext = item.LText |
| | | // let DateCount = item.DateCount |
| | | // let customScript = item.customScript |
| | | |
| | | // item.reps.forEach(n => { |
| | | // let key = n.toLowerCase() |
| | | // if (values.hasOwnProperty(key)) { |
| | | // Ltext = Ltext.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // DateCount = DateCount.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // customScript = customScript.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // } |
| | | // }) |
| | | |
| | | // if (search.length) { |
| | | |
| | | // } |
| | | // } |
| | | |
| | | param.custom_script = Utils.formatOptions(_customScript, param.exec_type) |
| | | param.LText = Utils.formatOptions(LText, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | |
| | | { reg: /@orderBy@/ig, value: orderBy }, |
| | | { reg: /@pageSize@/ig, value: 999999 }, |
| | | { reg: /@pageIndex@/ig, value: 1}, |
| | | { reg: /\$select@/ig, value: '/*'}, |
| | | { reg: /@select\$/ig, value: '*/'}, |
| | | { reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | // { reg: /\$select@/ig, value: '/*'}, |
| | | // { reg: /@select\$/ig, value: '*/'}, |
| | | // { reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | { reg: /@ID@/ig, value: `''`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | |
| | | * @return {Array} columns 显示列 |
| | | * @return {Boolean} retmsg 是否需要数据返回 |
| | | */ |
| | | export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams) { |
| | | export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false) { |
| | | let primaryId = param.ID |
| | | let BID = param.BID || '' |
| | | let verify = btn.verify || {} |
| | |
| | | } |
| | | |
| | | // 失效验证,添加数据时不用 |
| | | if (verify.invalid === 'true' && moduleParams && moduleParams.dataresource) { |
| | | let datasource = moduleParams.dataresource |
| | | let customScript = moduleParams.customScript || '' |
| | | if (verify.invalid === 'true' && setting.dataresource) { |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | |
| | | let regoptions = [{ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('User_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('Full_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order || primaryKey |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 1 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }] |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (customScript) { |
| | | _sql += ` |
| | |
| | | |
| | | if (!keys.includes(_key)) return // 表单中不含单号生成字段 |
| | | |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | let _val = '' |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _val = BID |
| | | } else if (_data.hasOwnProperty(_linkKey)) { |
| | | _val = _data[_linkKey] |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` |
| | | } |
| | | _ModularDetailCode = `'${item.TypeCharOne + _val}'` |
| | | } else { |
| | | _ModularDetailCode = `'${item.ModularDetailCode}'` |
| | | _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` |
| | | } |
| | | |
| | | let _declare = '' |
| | | // let _declare = '' |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | | _vars.push(_key) |
| | | } |
| | | // if (!_vars.includes(_key)) { |
| | | // _declare = `Declare @${_key} nvarchar(50)` |
| | | // _vars.push(_key) |
| | | // } |
| | | |
| | | _billcodesSql += ` |
| | | /* 单号生成 */ |
| | | ${_declare} |
| | | select @BillCode='', @${_key}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=${_ModularDetailCode}, |
| | | @ModularDetailCode=@ModularDetailCode, |
| | | @Type=${item.Type}, |
| | | @TypeCharOne='${item.TypeCharOne}', |
| | | @TypeCharTwo ='${item.TypeCharTwo}', |
| | |
| | | _value.push(`${_labels[index] || ''}:${_val || ''}`) |
| | | }) |
| | | |
| | | let _verifyType = '' |
| | | if (item.verifyType === 'logic') { |
| | | _verifyType = ' and deleted=0' |
| | | } |
| | | |
| | | if (!arr.includes(primaryKey.toLowerCase())) { |
| | | _fieldValue.push(`${primaryKey} !='${primaryId}'`) |
| | | } |
| | |
| | | _sql += ` |
| | | /* 唯一性验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType} |
| | | select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在' |
| | |
| | | if (data && columns && columns.length > 0 && btn.Ot !== 'notRequired') { |
| | | let _index = 0 |
| | | columns.forEach(col => { |
| | | if (!col.field || col.Hide === 'true' || _index >= 4) return |
| | | if (!col.field || col.Hide === 'true' || _index >= 4 || col.field === primaryKey) return |
| | | _msg += col.label + '=' + data[col.field] + ',' |
| | | _index++ |
| | | }) |
| | |
| | | _sql += _backCustomScript |
| | | } |
| | | |
| | | _sql = _sql.replace(/@works_flow_sign@/ig, `'${sign}'`) |
| | | if (verify.flowType === 'start') { |
| | | _sql = _sql.replace(/@start_type@/ig, `'开始'`) |
| | | } else { |
| | | _sql = _sql.replace(/@works_flow_sign@/ig, `'${sign}'`) |
| | | |
| | | _sql = _sql.replace(/@check_userids@/ig, `'${checkIds.join(',')}'`) |
| | | _sql = _sql.replace(/@notice_userids@/ig, `'${noticeIds.join(',')}'`) |
| | | _sql = _sql.replace(/@check_type@/ig, verify.flowType === 'reject' ? `'驳回'` : `'审核'`) |
| | | _sql = _sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | |
| | | _sql = _sql.replace(/@start_type@/ig, `'开始'`) |
| | | _sql = _sql.replace(/@check_type@/ig, verify.flowType === 'reject' ? `'驳回'` : `'审核'`) |
| | | _sql = _sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | _sql = _sql.replace(/@check_userids@/ig, `'${checkIds.join(',')}'`) |
| | | _sql = _sql.replace(/@notice_userids@/ig, `'${noticeIds.join(',')}'`) |
| | | } |
| | | |
| | | _sql = _sql.replace(/@works_flow_code@/ig, `'${flow.flow_code}'`) |
| | | _sql = _sql.replace(/@works_flow_name@/ig, `'${flow.flow_name}'`) |
| | |
| | | /** |
| | | * @description 生成替换函数列表 |
| | | */ |
| | | export function setGLOBFuncs () { |
| | | window.GLOB.funcs = [] |
| | | if (!window.GLOB.IndexDB) { |
| | | return |
| | | } |
| | | // export function setGLOBFuncs () { |
| | | // window.GLOB.funcs = [] |
| | | // if (!window.GLOB.IndexDB) { |
| | | // return |
| | | // } |
| | | |
| | | let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs') |
| | | // let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs') |
| | | |
| | | objectStore.openCursor().onsuccess = (event) => { |
| | | let cursor = event.target.result |
| | | // objectStore.openCursor().onsuccess = (event) => { |
| | | // let cursor = event.target.result |
| | | |
| | | if (cursor) { |
| | | window.GLOB.funcs.push({ |
| | | func_code: cursor.value.func_code, |
| | | key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql)) |
| | | }) |
| | | cursor.continue() |
| | | } |
| | | } |
| | | } |
| | | // if (cursor) { |
| | | // window.GLOB.funcs.push({ |
| | | // func_code: cursor.value.func_code, |
| | | // key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql)) |
| | | // }) |
| | | // cursor.continue() |
| | | // } |
| | | // } |
| | | // } |
| | |
| | | } |
| | | |
| | | deleteTran = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_sVersion_del', |
| | |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | _this.getTransList() |
| | | that.getTransList() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | enableTran = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_sVersion_sub', |
| | |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | _this.getTransList() |
| | | that.getTransList() |
| | | } else { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | } |
| | | |
| | | deleteApp = (record) => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定删除《' + record.remark + '》吗?', |
| | |
| | | duration: 5 |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | selectApp: null, |
| | | selectSubApp: null, |
| | | loading: true |
| | | }) |
| | | _this.getAppList() |
| | | that.getAppList() |
| | | } else { |
| | | if (result.message.indexOf('kei_no已被菜单使用,不可删除') > -1) { |
| | | result.message = 'kei_no已被菜单使用,不可删除' |
| | |
| | | |
| | | deleteSubApp = (record) => { |
| | | const { selectApp } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 's_kei_addupt', |
| | |
| | | duration: 5 |
| | | }) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | selectSubApp: null, |
| | | loading: true |
| | | }) |
| | | _this.getAppList() |
| | | that.getAppList() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | }) |
| | | |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定要执行吗?', |
| | |
| | | message: '执行成功。', |
| | | duration: 3 |
| | | }) |
| | | _this.setState({ |
| | | that.setState({ |
| | | scriptIndex: 1 |
| | | }, () => { |
| | | _this.getScriptList() |
| | | that.getScriptList() |
| | | }) |
| | | } |
| | | resolve() |
| | |
| | | |
| | | trigger = () => { |
| | | const { config, menu, btnTab } = this.props |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (!config || !menu || !menu.LongParam) { |
| | | notification.warning({ |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execUpdate(resolve, _config) |
| | | that.execUpdate(resolve, _config) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | componentDidMount() { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | if (window.GLOB.sysType !== 'cloud') { |
| | | Object.defineProperty(window, 'debugger', { |
| | |
| | | window.GLOB.breakpoint = value + '' |
| | | sessionStorage.setItem('breakpoint', value) |
| | | } |
| | | _this.debugChange() |
| | | that.debugChange() |
| | | } |
| | | }) |
| | | } |
| | |
| | | window.GLOB.breakpoint = false |
| | | sessionStorage.removeItem('breakpoint') |
| | | |
| | | _this.debugChange() |
| | | that.debugChange() |
| | | } |
| | | } |
| | | } |
| | |
| | | display: none!important; |
| | | } |
| | | } |
| | | .braft-content p { |
| | | margin: 0px!important; |
| | | } |
| | | .ant-table-thead > tr > th { |
| | | color: rgba(0,0,0,1); |
| | | background: transparent!important; |
| | |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | title: `确定删除菜单《${item.MenuName}》吗?`, |
| | | content: '', |
| | |
| | | } |
| | | return Api.getCloudConfig(param).then(res => { |
| | | if (res.status) { |
| | | _this.props.reload() |
| | | that.props.reload() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | |
| | | logout = () => { |
| | | // 退出登录 |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | title: '您确定要退出吗?', |
| | | content: '', |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.history.replace('/login') |
| | | that.props.history.replace('/login') |
| | | window.location.reload() |
| | | }, |
| | | onCancel() {} |
| | |
| | | }, () => {}) |
| | | } |
| | | |
| | | setSystemFuncs = () => { |
| | | if (!window.GLOB.IndexDB) { |
| | | return |
| | | } |
| | | this.getfuncTime().then(res => { |
| | | Api.getSystemFuncs(res.createDate).then(result => { |
| | | if (!result.status) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } else if (result.func_detail && result.func_detail.length > 0) { |
| | | this.writeFuncs(result.func_detail) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // setSystemFuncs = () => { |
| | | // if (!window.GLOB.IndexDB) { |
| | | // return |
| | | // } |
| | | // this.getfuncTime().then(res => { |
| | | // Api.getSystemFuncs(res.createDate).then(result => { |
| | | // if (!result.status) { |
| | | // notification.error({ |
| | | // top: 92, |
| | | // message: result.message, |
| | | // duration: 10 |
| | | // }) |
| | | // } else if (result.func_detail && result.func_detail.length > 0) { |
| | | // this.writeFuncs(result.func_detail) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | writeFuncs = (funcs) => { |
| | | let shim = +sessionStorage.getItem('sys_time_shim') |
| | | let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') |
| | | // writeFuncs = (funcs) => { |
| | | // let shim = +sessionStorage.getItem('sys_time_shim') |
| | | // let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') |
| | | |
| | | let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') |
| | | // let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') |
| | | |
| | | objectStore.clear() |
| | | // objectStore.clear() |
| | | |
| | | funcs.forEach(item => { |
| | | if (!item.key_sql) return |
| | | item.id = item.func_code |
| | | objectStore.add(item) |
| | | }) |
| | | // funcs.forEach(item => { |
| | | // if (!item.key_sql) return |
| | | // item.id = item.func_code |
| | | // objectStore.add(item) |
| | | // }) |
| | | |
| | | let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') |
| | | funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) |
| | | } |
| | | // let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') |
| | | // funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) |
| | | // } |
| | | |
| | | getfuncTime = () => { |
| | | return new Promise((resolve, reject) => { |
| | | let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') |
| | | let request = objectStore.get('funcs') |
| | | // getfuncTime = () => { |
| | | // return new Promise((resolve, reject) => { |
| | | // let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') |
| | | // let request = objectStore.get('funcs') |
| | | |
| | | request.onerror = (event) => { |
| | | console.warn(event) |
| | | reject() |
| | | } |
| | | // request.onerror = (event) => { |
| | | // console.warn(event) |
| | | // reject() |
| | | // } |
| | | |
| | | request.onsuccess = () => { |
| | | if (request.result) { |
| | | resolve(request.result) |
| | | } else { |
| | | let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) |
| | | // request.onsuccess = () => { |
| | | // if (request.result) { |
| | | // resolve(request.result) |
| | | // } else { |
| | | // let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) |
| | | |
| | | add.onerror = () => { |
| | | reject() |
| | | } |
| | | add.onsuccess = () => { |
| | | resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // add.onerror = () => { |
| | | // reject() |
| | | // } |
| | | // add.onsuccess = () => { |
| | | // resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) |
| | | // } |
| | | // } |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | getSmStemp = () => { |
| | | if (!sessionStorage.getItem('msgTemplate')) { |
| | |
| | | }, 100) |
| | | |
| | | setTimeout(() => { |
| | | // positecgroup |
| | | // this.setSystemFuncs() |
| | | this.getSmStemp() |
| | | }, 500) |
| | |
| | | |
| | | import Header from './header' |
| | | import Sidemenu from './sidemenu' |
| | | import { setGLOBFuncs } from '@/utils/utils.js' |
| | | // import { setGLOBFuncs } from '@/utils/utils.js' |
| | | |
| | | import '@/assets/css/design.scss' |
| | | import './index.scss' |
| | |
| | | window.GLOB.breakpoint = false |
| | | window.GLOB.designView = true |
| | | sessionStorage.removeItem('breakpoint') |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: 'Are you sure you want to clear all your history requests?', |
| | | onOk() { |
| | | Api.clearInterfaces() |
| | | |
| | | _this.setState({list: [], historys: []}) |
| | | that.setState({list: [], historys: []}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { langs } from '@/store/options' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | } else if (this.checklog()) { |
| | | if (sessionStorage.getItem('langList') && !config.trans) { |
| | | |
| | | // } else if (window.backend && config.enabled && !config.allSqls) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | config.enabled = true |
| | | delete config.force |
| | | } |
| | | |
| | | // let sqls = [] |
| | | // delete config.allSqls |
| | | // if (window.backend && config.enabled) { |
| | | // sqls = getAllSqls(config) |
| | | |
| | | // config.allSqls = sqls |
| | | // } |
| | | |
| | | if (config.cacheUseful !== 'true') { |
| | | config.components = this.resetSyncQuery(config.components) |
| | |
| | | <PasteController insert={this.insert} /> |
| | | {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null} |
| | | <Button type="primary" id="save-config" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>保存</Button> |
| | | <Button type="default" onClick={this.closeView}>关闭</Button> |
| | | <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : <Spin className="loading-config" size="large" />} |
| | |
| | | > .ant-card { |
| | | >.ant-card-head { |
| | | margin-bottom: 0px; |
| | | position: relative; |
| | | position: sticky; |
| | | top: 0px; |
| | | z-index: 10; |
| | | background: #ffffff; |
| | | .ant-card-head-title { |
| | | color: #1890ff; |
| | | padding: 5px 0; |
| | |
| | | <PasteController insert={this.insert} /> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>保存</Button> |
| | | <Button type="default" onClick={this.closeView}>返回</Button> |
| | | <Button type="default" disabled={menuloading} onClick={this.closeView}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {!comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} |
| | |
| | | > .ant-card { |
| | | >.ant-card-head { |
| | | margin-bottom: 0px; |
| | | position: relative; |
| | | position: sticky; |
| | | top: 0px; |
| | | z-index: 10; |
| | | background: #ffffff; |
| | | .ant-card-head-title { |
| | | color: #1890ff; |
| | | padding: 5px 0; |
| | |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils, { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | } else if (item.type === 'group') { |
| | | item.components = traversal(item.components) |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type)) { |
| | | if (item.wrap.display === 'hidden') { |
| | | item.miniStyle += 'display:none;' |
| | | } |
| | | item.subcards.forEach(card => { |
| | | card.miniStyle = this.transferStyle(card.style) |
| | | card.elements = card.elements.map(cell => { |
| | |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | |
| | | |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | } |
| | | |
| | | deleteItem = () => { |
| | | const _this = this |
| | | const that = this |
| | | const { editItemId, config } = this.state |
| | | |
| | | confirm({ |
| | |
| | | onOk() { |
| | | config.elements = config.elements.filter(item => item.uuid !== editItemId) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | config: config, |
| | | editItemId: config.uuid, |
| | | editItemType: config.type, |
| | | formlist: getpageform(config) |
| | | }, () => { |
| | | _this.resetview() |
| | | that.resetview() |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | deleteMenu = (record) => { |
| | | const { app, appViewList } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | |
| | | message: '操作成功!', |
| | | duration: 3 |
| | | }) |
| | | _this.getMenuList(true) |
| | | that.getMenuList(true) |
| | | |
| | | if (_param) { |
| | | Api.getCloudConfig(_param).then(res => { |
| | |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | _this.setState({appViewList: _appViewList}) |
| | | that.setState({appViewList: _appViewList}) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | initTree = () => { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: '权限树会重新生成,确定执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.getMenuList(true, resolve) |
| | | that.getMenuList(true, resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | syncTree = () => { |
| | | const _this = this |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '同步会根据菜单删除或新增节点,确定执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.syncMenutree(resolve) |
| | | that.syncMenutree(resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | saveTree = () => { |
| | | // const { trees } = this.state |
| | | const _this = this |
| | | const that = this |
| | | |
| | | // if (!trees || trees.length === 0) { |
| | | // notification.warning({ |
| | |
| | | content: '确定执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSave(resolve) |
| | | that.execSave(resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { langs } from '@/store/options' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | } else if (this.checklog()) { |
| | | if (sessionStorage.getItem('langList') && !config.trans) { |
| | | |
| | | // } else if (window.backend && config.enabled && !config.allSqls) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | config.enabled = true |
| | | delete config.force |
| | | } |
| | | |
| | | // let sqls = [] |
| | | // delete config.allSqls |
| | | // if (window.backend && config.enabled) { |
| | | // sqls = getAllSqls(config) |
| | | |
| | | // config.allSqls = sqls |
| | | // } |
| | | |
| | | let tbs = [] |
| | | let btns = this.getMenuMessage(tbs) |
| | |
| | | <PasteBaseTable type="page" insert={this.insert}/> |
| | | {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null} |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>保存</Button> |
| | | <Button type="default" onClick={this.closeView}>关闭</Button> |
| | | <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} |
| | |
| | | > .ant-card { |
| | | >.ant-card-head { |
| | | margin-bottom: 0px; |
| | | position: relative; |
| | | position: sticky; |
| | | top: 0px; |
| | | z-index: 10; |
| | | background: #ffffff; |
| | | .ant-card-head-title { |
| | | color: #1890ff; |
| | | padding: 5px 0; |
| | |
| | | <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>保存</Button> |
| | | <Button type="default" onClick={this.closeView}>返回</Button> |
| | | <Button type="default" disabled={menuloading} onClick={this.closeView}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {!comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} |
| | |
| | | > .ant-card { |
| | | >.ant-card-head { |
| | | margin-bottom: 0px; |
| | | position: relative; |
| | | position: sticky; |
| | | top: 0px; |
| | | z-index: 10; |
| | | background: #ffffff; |
| | | .ant-card-head-title { |
| | | color: #1890ff; |
| | | padding: 5px 0; |