| | |
| | | } |
| | | |
| | | /** |
| | | * @description 清空后端缓存 |
| | | */ |
| | | cacheInterface (param) { |
| | | param.userid = sessionStorage.getItem('UserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | let url = '/webapi/excache' |
| | | if (param.rduri && !window.GLOB.transfer) { |
| | | url = param.rduri |
| | | delete param.rduri |
| | | } |
| | | |
| | | param = this.encryptParam(param) |
| | | |
| | | return axios({ |
| | | url: url, |
| | | method: 'post', |
| | | data: JSON.stringify(param), |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 上传base64 |
| | | * @param {String} base64 base64图片编码 |
| | | */ |
| | |
| | | } |
| | | |
| | | if (/#\/hs$/.test(window.location.href)) { // hs下不打印脚本 |
| | | config.systemRun = '' // hs 不使用后端替换 |
| | | GLOB.debugger = false |
| | | |
| | | if (GLOB.mainSystemApi) { |
| | |
| | | if (GLOB.cloudServiceApi) { |
| | | GLOB.mainSystemApi = GLOB.cloudServiceApi |
| | | } |
| | | |
| | | if (config.systemRun === 'backend') { |
| | | config.systemRun = '' // hs 不使用后端替换 |
| | | GLOB.backend = true |
| | | } |
| | | } |
| | | |
| | | if (process.env.NODE_ENV === 'production') { // 用于校验是否存在开发权限 |
New file |
| | |
| | | import React, { Component } from 'react' |
| | | import { notification } from 'antd' |
| | | import * as XLSX from 'sheetjs-style' |
| | | import { DownloadOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | // import './index.scss' |
| | | |
| | | class ExcelOutColumns extends Component { |
| | | /** |
| | | * @description 导出字段集 |
| | | */ |
| | | actionTrigger = () => { |
| | | const { data, setting } = this.props |
| | | |
| | | if (data.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段集不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let columns = [{ |
| | | Column: 'label', |
| | | Text: '名称' |
| | | }, { |
| | | Column: 'field', |
| | | Text: '字段' |
| | | }, { |
| | | Column: 'datatype', |
| | | Text: '数据类型' |
| | | }] |
| | | |
| | | let table = [] |
| | | let _header = [] |
| | | let _topRow = {} |
| | | let colwidth = [] |
| | | |
| | | columns.forEach(col => { |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | colwidth.push({wch: 25}) |
| | | }) |
| | | |
| | | table.push(_topRow) |
| | | |
| | | data.forEach((item) => { |
| | | let _row = {} |
| | | |
| | | columns.forEach((col) => { |
| | | let val = item[col.Column] |
| | | _row[col.Column] = val |
| | | }) |
| | | |
| | | table.push(_row) |
| | | }) |
| | | |
| | | const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) |
| | | |
| | | ws['!cols'] = colwidth |
| | | ws['!rows'] = Array(table.length).fill({hpx: 18}) |
| | | |
| | | const wb = XLSX.utils.book_new() |
| | | XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') |
| | | |
| | | XLSX.writeFile(wb, `${setting.tableName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`) |
| | | } |
| | | |
| | | render() { |
| | | return (<DownloadOutlined className="columns-out" onClick={this.actionTrigger}/>) |
| | | } |
| | | } |
| | | |
| | | export default ExcelOutColumns |
| | |
| | | const { Search } = Input |
| | | const { confirm } = Modal |
| | | |
| | | const ExcelOut = asyncComponent(() => import('./excelout')) |
| | | const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | |
| | | type="fields" |
| | | updatefield={this.updatefields} |
| | | /> |
| | | <ExcelOut data={columns} setting={setting}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> |
| | | </TabPane> : <TabPane tab={ |
| | | <span> |
| | |
| | | </span> |
| | | } key="columns"> |
| | | <div className="base-table-columns"></div> |
| | | <ExcelOut data={columns} setting={setting}/> |
| | | <EditTable actions={[]} searchKey={searchKey} type="datasourcefield" data={columns} columns={colColumns}/> |
| | | </TabPane>} |
| | | {config.subtype === 'dualdatacard' ? <TabPane tab={ |
| | |
| | | type="fields" |
| | | updatefield={this.updateSubfields} |
| | | /> |
| | | <ExcelOut data={subColumns} setting={setting}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.subdatasource = inst} data={subColumns} columns={colColumns} onChange={(subColumns) => this.setState({subColumns})}/> |
| | | </TabPane> : null} |
| | | <TabPane tab={ |
| | |
| | | margin-right: 5px; |
| | | cursor: pointer; |
| | | } |
| | | .columns-out { |
| | | float: right; |
| | | position: relative; |
| | | z-index: 2; |
| | | right: 5px; |
| | | height: 0px; |
| | | top: -15px; |
| | | color: rgb(24, 144, 255); |
| | | } |
| | | .columns-out + .modal-edit-table { |
| | | .ant-table-thead { |
| | | .copy-control { |
| | | top: -18px; |
| | | right: 30px; |
| | | .anticon-copy { |
| | | margin-right: 12px; |
| | | } |
| | | .anticon-delete { |
| | | margin-left: 12px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .full-scripts { |
| | | position: absolute; |
| | |
| | | const { config } = this.props |
| | | const { value, err } = this.state |
| | | |
| | | return ( |
| | | <InputNumber |
| | | title={err} |
| | | className={err ? 'has-error' : ''} |
| | | ref={ref => this.node = ref} |
| | | precision={config.decimal || 0} |
| | | value={value} |
| | | onChange={(value) => this.onChange(value)} |
| | | onPressEnter={this.enterPress} |
| | | onFocus={this.onFocus} |
| | | onBlur={this.onBlur} |
| | | /> |
| | | ) |
| | | if (!config.decimal && config.decimal !== 0) { |
| | | return ( |
| | | <InputNumber |
| | | title={err} |
| | | className={err ? 'has-error' : ''} |
| | | ref={ref => this.node = ref} |
| | | value={value} |
| | | onChange={(value) => this.onChange(value)} |
| | | onPressEnter={this.enterPress} |
| | | onFocus={this.onFocus} |
| | | onBlur={this.onBlur} |
| | | /> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <InputNumber |
| | | title={err} |
| | | className={err ? 'has-error' : ''} |
| | | ref={ref => this.node = ref} |
| | | precision={config.decimal} |
| | | value={value} |
| | | onChange={(value) => this.onChange(value)} |
| | | onPressEnter={this.enterPress} |
| | | onFocus={this.onFocus} |
| | | onBlur={this.onBlur} |
| | | /> |
| | | ) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | _item.datatype = _item.declareType || 'datetime' |
| | | } else { |
| | | _item.datatype = item.datatype |
| | | } |
| | | if (_item.type === 'number' && item.type === 'number') { |
| | | _item.decimal = item.decimal || 0 |
| | | } |
| | | |
| | | forms.push(_item) |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + submit.$menuId)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + submit.$menuId) |
| | | if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_submit_' + submit.$menuId)) { |
| | | let ex = window.GLOB.CacheData.get('sql_submit_' + submit.$menuId) |
| | | let param = this.getExps(ex, submit, data, forms) |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | |
| | | _resolve() |
| | | }) |
| | | } else if (params.length <= 20 && btn.execType !== 'single') { |
| | | if (window.backend && params[0].$backend && (!btn.verify || (btn.verify.printEnable !== 'true' && !btn.output))) { |
| | | params = [{ |
| | | $backend: true, |
| | | data: params.map(item => item.data[0]) |
| | | }] |
| | | } |
| | | |
| | | let deffers = params.map((param, i) => { |
| | | return new Promise(resolve => { |
| | | setTimeout(() => { |
| | |
| | | _resolve() |
| | | } else { |
| | | if (params.length === 0) { |
| | | this.clearBackCache() |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | |
| | | _resolve() |
| | | } else { |
| | | if (params.length === 0) { |
| | | this.clearBackCache() |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | |
| | | _resolve() |
| | | } else { |
| | | if (params.length === 0) { |
| | | this.clearBackCache() |
| | | this.execSuccess(re) |
| | | _resolve() |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | clearBackCache = () => { |
| | | if (!window.GLOB.backend) return |
| | | |
| | | Api.cacheInterface({}).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message || '缓存清空失败!', |
| | | duration: 5 |
| | | }) |
| | | } else if (window.GLOB.localSystemApi) { |
| | | Api.cacheInterface({rduri: window.GLOB.localSystemApi.replace('dostars', 'excache')}).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message || '缓存清空失败!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 操作成功后处理 |
| | | * 1、excel导出,成功后取消导出按钮加载中状态 |
| | |
| | | Promise.all(deffers).then(result => { |
| | | let errorMsg = '' |
| | | result.forEach(res => { |
| | | if (!res.status) { |
| | | if (!res.status && !errorMsg) { |
| | | errorMsg = res |
| | | } |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | let miniable = '' |
| | | if (window.GLOB.WXApps) { |
| | | let apps = window.GLOB.WXApps.filter(app => app.appType === 'miniProgram') |
| | | |
| | | if (apps.length > 1) { |
| | | miniable = apps.map(app => `${app.appId}(${app.appName})`) |
| | | miniable = miniable.join(';') |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | |
| | | </Col> : null} |
| | | {verify.wxNoteLink === 'miniProgram' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="top" title="可指定跳转小程序的ID,未设置时默认使用配置文件中的小程序ID。"> |
| | | <Tooltip placement="top" title={'可指定跳转小程序的ID,未设置时默认使用配置文件中的小程序ID。' + miniable}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 小程序ID |
| | | </Tooltip> |
| | |
| | | |
| | | if (item.subtype === 'editable' && item.submit.intertype === 'system') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | let msg = getEditTableSql(item.submit, item.cols, item.columns) |
| | | let msg = getEditTableSql(item.submit, item.cols, item.columns, item.setting) |
| | | |
| | | sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', ...msg}) |
| | | } |
| | |
| | | return {LText: sql, md5: md5(sql), reps} |
| | | } |
| | | |
| | | let getEditTableSql = (btn, cols, columns) => { |
| | | let getEditTableSql = (btn, cols, columns, setting) => { |
| | | let sheet = btn.sheet.replace(/@db@/ig, '') |
| | | let database = '' |
| | | if (/@db@/ig.test(btn.sheet)) { |
| | |
| | | } |
| | | |
| | | let forms = [] |
| | | let _fields = {} |
| | | |
| | | columns.forEach(col => { |
| | | _fields[col.field] = col.datatype |
| | | }) |
| | | let _forms = {} |
| | | let index = 0 |
| | | |
| | | 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)' |
| | | }) |
| | | item.$sort = index |
| | | _forms[item.field] = item |
| | | index++ |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getColumns(cols) |
| | | |
| | | |
| | | columns.forEach(item => { |
| | | if (item.field === setting.primaryKey) return |
| | | |
| | | if (_forms[item.field]) { |
| | | let _item = {..._forms[item.field]} |
| | | if (_item.editType === 'date') { |
| | | _item.datatype = _item.declareType || 'datetime' |
| | | } else { |
| | | _item.datatype = item.datatype |
| | | } |
| | | |
| | | forms.push(_item) |
| | | } else { |
| | | forms.push({...item, $sort: 999}) |
| | | } |
| | | }) |
| | | |
| | | forms.sort((a, b) => a.$sort - b.$sort) |
| | | |
| | | let sql = '' |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | |
| | | } else if (_tailScript) { |
| | | component.setting.sync = 'false' |
| | | } |
| | | component.dataName = 'mk' + component.uuid.slice(-18) |
| | | |
| | | // floor 组件的层级 |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if (component.setting.sync === 'true') { |
| | | component.dataName = 'mk' + component.uuid.slice(-18) |
| | | let param = this.getDefaultParam(component) |
| | | _pars.push(param) |
| | | } else if (component.subtype !== 'dualdatacard') { |
| | |
| | | _pars = this.getFormatParam(_pars, config.MenuName) |
| | | |
| | | if (_pars) { |
| | | _pars.componentId = 'union' |
| | | _pars.componentId = '' |
| | | params.unshift(_pars) |
| | | } else if (window.backend && config.allSqls && params.length > 0) { |
| | | let data = [] |
| | | params = params.filter(item => { |
| | | if (!item.$backend || item.public) return true |
| | | |
| | | item.data[0].exps.forEach(cell => { |
| | | if (cell.key === 'mk_obj_name') { |
| | | cell.value = 'mk' + item.componentId.slice(-18) |
| | | } |
| | | }) |
| | | data.push(item.data[0]) |
| | | return false |
| | | }) |
| | | if (data.length > 0) { |
| | | params.push({ |
| | | $backend: true, |
| | | componentId: '', |
| | | data |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (config.everyPCount && !config.printPage) { // 兼容 |
| | |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(item).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | if (res.ErrCode !== '-2') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve() |
| | | } else { |
| | | let _data = { $$empty: true } |
| | |
| | | } |
| | | if (res.ErrCode === 'version_up') { |
| | | this.reloadTabs() |
| | | } else { |
| | | } else if (res.ErrCode !== '-2') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | |
| | | _results.forEach(res => { |
| | | if ((res.componentId === item.uuid || res.componentId === item.componentId) && res.data) { |
| | | item.dataArray = fromJS(res.data).toJS() |
| | | } else if (res.componentId === 'union' && res[item.dataName]) { |
| | | } else if (res[item.dataName]) { |
| | | let data = res[item.dataName] |
| | | if (!Array.isArray(data)) { |
| | | data = [data] |