From 822bc67061448c6e3a1eb77d39be4ad2b84b416a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 27 二月 2020 09:36:34 +0800 Subject: [PATCH] 2020-02-27 --- src/tabviews/tableshare/mutilform/index.jsx | 17 src/templates/tableshare/verifycardexcelin/index.scss | 8 src/templates/comtableconfig/actionform/index.jsx | 86 ++++ src/tabviews/formtab/index.jsx | 22 + src/tabviews/formtab/actionList/index.jsx | 16 src/tabviews/formtab/formgroup/index.jsx | 17 src/templates/formtabconfig/index.jsx | 33 ++ src/tabviews/managetable/index.jsx | 12 src/tabviews/tableshare/topSearch/index.jsx | 16 src/templates/comtableconfig/index.jsx | 29 + src/templates/subtableconfig/index.jsx | 18 + src/tabviews/tableshare/actionList/index.jsx | 213 ++++++++++-- /dev/null | 37 -- src/templates/modalconfig/index.jsx | 61 +++ src/api/index.js | 29 + src/tabviews/subtable/index.jsx | 22 + src/tabviews/subtabtable/index.jsx | 21 + src/components/sidemenu/index.jsx | 16 + src/locales/zh-CN/comtable.js | 5 src/templates/tableshare/verifycard/index.jsx | 140 ++++++++ src/locales/en-US/comtable.js | 5 src/templates/tableshare/verifycardexcelin/index.jsx | 50 +++ src/templates/tableshare/formconfig.js | 44 ++ 23 files changed, 755 insertions(+), 162 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 87326a2..f029f03 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -126,26 +126,22 @@ param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' - let _rduri = '' if (sessionStorage.getItem('isEditState') === 'true' && options.cloudServiceApi) { // 缂栬緫鐘舵�侊紝涓斿瓨鍦ㄤ簯绔湴鍧� - _rduri = options.cloudServiceApi + param.rduri = options.cloudServiceApi param.userid = sessionStorage.getItem('CloudUserID') param.SessionUid = sessionStorage.getItem('CloudSessionUid') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (window.GLOB.mainSystemApi) { - _rduri = window.GLOB.mainSystemApi + param.rduri = window.GLOB.mainSystemApi } param.nonc = Utils.getuuid() let keys = Object.keys(param).sort() + keys = keys.filter(key => key !== 'rduri') let values = keys.map(key => key + param[key]).join('') param.sign = md5(values) param.t = new Date().getTime() - - if (_rduri) { - param.rduri = _rduri - } return axios({ url: '/webapi/dostars', @@ -182,13 +178,20 @@ * @param {Boolean} SSO 鏄惁涓哄崟鐐圭櫥褰曞湴鍧� */ getSystemCacheConfig (param, SSO = true) { - param.userid = sessionStorage.getItem('UserID') + param.userid = sessionStorage.getItem('UserID') || '' param.lang = localStorage.getItem('lang') || '' param.SessionUid = sessionStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' - if (window.GLOB.mainSystemApi && SSO) { + if (sessionStorage.getItem('isEditState') === 'true' && SSO) { // 缂栬緫鐘舵�侊紝鍗曠偣鐧诲綍鏈嶅姟鍣ㄤ负浜戠 + if (options.cloudServiceApi) { // 瀛樺湪浜戠鍦板潃鏃讹紝浣跨敤浜戠绯荤粺鍙傛暟 + param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.SessionUid = sessionStorage.getItem('CloudSessionUid') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + } + } else if (window.GLOB.mainSystemApi && SSO) { param.rduri = window.GLOB.mainSystemApi } @@ -231,9 +234,11 @@ param.SessionUid = sessionStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' - // if (param.func === 'RolesAdd') { // 瑙掕壊娣诲姞鏃讹紝浼燼ppkey(澶栭儴鎺ュ彛缁熶竴娣诲姞) - // param.appkey = window.GLOB.appkey || '' - // } + if (sessionStorage.getItem('isEditState') === 'true' && param.rduri === options.cloudServiceApi) { // HS涓嬭彍鍗� + param.userid = sessionStorage.getItem('CloudUserID') + param.SessionUid = sessionStorage.getItem('CloudSessionUid') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + } param.nonc = Utils.getuuid() diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index f586415..23196c0 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -181,6 +181,22 @@ MenuNo: 'sDatasM', MenuName: '鏁版嵁瀛楀吀', text: '鏁版嵁瀛楀吀' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1578900109100np8aqd0a77q3na46oas', + MenuNo: 'sPrintTemplateM', + MenuName: '鎵撳嵃妯℃澘', + text: '鎵撳嵃妯℃澘' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1581734956310scks442ul2d955g9tu5', + MenuNo: 'sVersionM', + MenuName: '浼犺緭鍙风鐞�', + text: '浼犺緭鍙风鐞�' }] }] this.setState({ diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 63275f9..366fe2e 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -210,6 +210,11 @@ 'header.form.pagination': '鍒嗛〉', 'header.form.regular': '姝e垯鏍¢獙', 'header.form.quickadd': '蹇嵎娣诲姞', + 'header.form.funcbutton': '鍔熻兘鎸夐挳', + 'header.form.funcType': '鍔熻兘绫诲瀷', + 'header.form.func.changeuser': '鍒囨崲鐢ㄦ埛', + 'header.form.func.print': '鎵撳嵃', + 'header.form.execMode': '鎵ц鏂瑰紡', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index daf9837..1a83d96 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -210,6 +210,11 @@ 'header.form.pagination': '鍒嗛〉', 'header.form.regular': '姝e垯鏍¢獙', 'header.form.quickadd': '蹇嵎娣诲姞', + 'header.form.funcbutton': '鍔熻兘鎸夐挳', + 'header.form.funcType': '鍔熻兘绫诲瀷', + 'header.form.func.changeuser': '鍒囨崲鐢ㄦ埛', + 'header.form.func.print': '鎵撳嵃', + 'header.form.execMode': '鎵ц鏂瑰紡', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index cbb9056..decb054 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -3,6 +3,7 @@ import moment from 'moment' import { Button, Modal, notification, message } from 'antd' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import Api from '@/api' import './index.scss' @@ -10,6 +11,7 @@ class MainAction extends Component { static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS MenuID: PropTypes.string, // 鑿滃崟ID primaryId: PropTypes.string, // 涓婚敭 actions: PropTypes.array, // 鎸夐挳缁� @@ -182,10 +184,18 @@ // 澶栭儴璇锋眰 _outParam = JSON.parse(JSON.stringify(res)) - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - res.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } if (btn.outerFunc) { diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx index 20dce01..53b8369 100644 --- a/src/tabviews/formtab/formgroup/index.jsx +++ b/src/tabviews/formtab/formgroup/index.jsx @@ -95,19 +95,22 @@ return group }) - let error = false - _groups = _groups.map(group => { group.sublist = group.sublist.map(item => { if (item.type === 'link') { let supItem = _formlist.filter(form => form.field === item.linkField)[0] + // 鍏宠仈鏄剧ず鍒椾腑鐨勫瓧娈靛�硷紝閫氳繃璇ュ�艰繃婊や笅鎷夐�夐」 if (!supItem && data && data.hasOwnProperty(item.linkField)) { supItem = {initval: data[item.linkField]} } if (!supItem) { - error = true + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌琛ㄥ崟銆�' + item.label + '銆嬪叧鑱斿瓧娈碉紒', + duration: 10 + }) } else { item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) } @@ -117,14 +120,6 @@ return group }) - - if (error) { - notification.warning({ - top: 92, - message: '鍏宠仈鑿滃崟璁剧疆閿欒锛�', - duration: 10 - }) - } this.setState({ readtype: readtype, diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index e0a108c..fd2dafa 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -9,6 +9,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import FormGroup from './formgroup' import FormAction from './actionList' @@ -21,6 +22,7 @@ class NormalTable extends Component { static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS // MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 // MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 MenuID: PropTypes.string, // 鑿滃崟Id @@ -106,7 +108,9 @@ // } // 鏉冮檺杩囨护 - config.action = config.action.filter(item => permAction[item.uuid]) + if (this.props.menuType !== 'HS') { + config.action = config.action.filter(item => permAction[item.uuid]) + } // config.tabgroups.forEach(group => { // if (!config[group]) return // config[group] = config[group].filter(tab => permAction[tab.uuid]) @@ -363,10 +367,18 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { + param.rduri = setting.interface + } } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } } param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey @@ -551,6 +563,7 @@ } {hasform ? <FormAction + menuType={this.props.menuType} logcolumns={[]} setting={setting} actions={actions} @@ -578,6 +591,7 @@ {_tab.type === 'SubTable' ? <SubTable Tab={_tab} + menuType={this.props.menuType} MenuID={_tab.linkTab} SupMenuID={this.props.MenuID} refreshtabs={this.state.refreshtabs} diff --git a/src/tabviews/managesubtable/index.jsx b/src/tabviews/managesubtable/index.jsx deleted file mode 100644 index 2f5ddc9..0000000 --- a/src/tabviews/managesubtable/index.jsx +++ /dev/null @@ -1,696 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import {connect} from 'react-redux' -import { is, fromJS } from 'immutable' -import { notification, Spin, Modal, Button} from 'antd' -import moment from 'moment' -import Api from '@/api' -import SubTable from '@/tabviews/subtable/subTable' -import SubAction from '@/tabviews/tableshare/actionList' -import SubSearch from '@/tabviews/tableshare/topSearch' -import asyncComponent from '@/utils/asyncLoadComponent' -import NotFount from '@/components/404' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' -import Utils from '@/utils/utils.js' -import './index.scss' - -const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) - -class SubTabViewTable extends Component { - static propTpyes = { - Tab: PropTypes.object, // 鏍囩淇℃伅 - BID: PropTypes.string, // 涓婄骇鏁版嵁ID - BData: PropTypes.any, // 涓婄骇鏁版嵁 - MenuID: PropTypes.string, // 鑿滃崟Id - SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id - ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID - handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d - handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 - refreshtabs:PropTypes.any - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - loadingview: true, // 椤甸潰鍔犺浇涓� - viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 - lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 - config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: null, // 鎼滅储鏉′欢 - actions: null, // 鎸夐挳闆� - columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) - arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� - total: 0, // 鎬绘暟 - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - configMap: {}, // 椤甸潰閰嶇疆淇℃伅锛氫笅鎷夈�佹寜閽瓑 - popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� - popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 - visible: false // 寮规鏄剧ず闅愯棌鎺у埗 - } - - /** - * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { - this.refs.subTable.resetTable() - this.loadmaindata(nextProps.BID, 'refresh') - } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { - this.reloadtable() - } - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - const { Tab, BID } = this.props - - let param = { - func: 'sPC_Get_LongParam', - MenuID: this.props.MenuID - } - let result = await Api.getSystemCacheConfig(param) - if (result.status) { - let config = '' - - try { // 閰嶇疆淇℃伅瑙f瀽 - config = window.decodeURIComponent(window.atob(result.LongParam)) - config = JSON.parse(config) - } catch (e) { - config = '' - } - - // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� - if (!config) { - this.setState({ - loadingview: false, - viewlost: true - }) - return - } - - // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 - if (!config.enabled) { - this.setState({ - loadingview: false, - viewlost: true, - lostmsg: this.state.dict['main.view.unenabled'] - }) - return - } - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() - - // 鏉冮檺杩囨护 - // config.action = config.action.filter(item => permAction[item.uuid]) - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - config.columns.forEach(col => { - if (col.field) { - _arrField.push(col.field) - - _logcolumns.push(col) - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach(col => { - if (_hideCol.includes(col.uuid)) return - - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] - _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) - } - }) - _col.subColumn = subColumn - _columns.push(_col) - } else { - _columns.push(col) - } - }) - - let _actions = config.action.filter(item => item.position === 'toolbar') // 杩囨护宸ュ叿鏍忔寜閽� - let _operations = config.action.filter(item => item.position === 'grid') // 娣诲姞鎿嶄綔鍒楋紙瀛樺湪鏃讹級 - - if (config.gridBtn && config.gridBtn.display && _operations.length > 0) { - _columns.push({ - ...config.gridBtn, - operations: _operations - }) - } - - this.setState({ - loadingview: false, - config: config, - setting: config.setting, - searchlist: config.search, - actions: _actions, - columns: _columns, - logcolumns: _logcolumns, - arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - }, () => { - this.improveSearch() - - if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 - this.setState({ - loading: true - }) - this.loadmaindata() - } - }) - } else { - this.setState({ - loadingview: false, - viewlost: true - }) - notification.warning({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鎼滅储鏉′欢涓嬫媺閫夐」棰勫姞杞� - */ - improveSearch = () => { - let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) - let deffers = [] - searchlist.forEach(item => { - if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return - if (item.setAll === 'true') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: this.state.dict['main.all'] - }) - } - - if (item.resourceType === '1' && item.dataSource) { - let _option = Utils.getSelectQueryOptions(item) - let _sql = Utils.formatOptions(_option.sql) - let isSSO = item.database === 'sso' - - let param = { - func: 'sPC_Get_SelectedList', - LText: _sql, - obj_name: 'data', - arr_field: _option.field - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - let defer = new Promise(resolve => { - Api.getSystemCacheConfig(param, isSSO).then(res => { - res.search = item - resolve(res) - }) - }) - deffers.push(defer) - } else if (item.resourceType === '1' && !item.dataSource) { - notification.warning({ - top: 92, - message: item.label + ': ' + this.state.dict['main.datasource.settingerror'], - duration: 10 - }) - } - }) - - if (deffers.length === 0) { - this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) - return - } - - Promise.all(deffers).then(result => { - result.forEach(res => { - if (res.status) { - searchlist = searchlist.map(item => { - if (item.uuid === res.search.uuid) { - res.data.forEach(cell => { - let _item = { - key: Utils.getuuid(), - Value: cell[res.search.valueField], - Text: cell[res.search.valueText] - } - - if (res.search.type === 'link') { - _item.parentId = cell[res.search.linkField] - } - - item.options.push(_item) - }) - } - return item - }) - } else { - notification.warning({ - top: 92, - message: res.search.label + ':' + res.message, - duration: 10 - }) - } - }) - this.setState({searchlist}) - }) - } - - /** - * @description 瀛愯〃鏁版嵁鍔犺浇 - */ - async loadmaindata (bid, type) { - const { setting } = this.state - let param = '' - let _BID = this.props.BID - - if (type === 'refresh') { - _BID = bid - if (!bid) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 - this.setState({ - data: [], - total: 0, - loading: false - }) - - return - } - } - - if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { - param = this.getCustomParam(_BID) - } else { - param = this.getDefaultParam(_BID) - } - - this.handleTableId() - - let result = await Api.genericInterface(param) - if (result.status) { - this.setState({ - data: result.data.map((item, index) => { - item.key = index - return item - }), - total: result.total, - loading: false - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 15 - }) - } - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = (BID) => { - const { pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.formatCustomMainSearch(search) - - let param = { - PageIndex: pageIndex, - PageSize: pageSize, - OrderCol: orderBy || setting.order, - BID: BID, - ..._search - } - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { - param.rduri = setting.interface - } - - param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� - */ - getDefaultParam = (BID) => { - const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - BID: BID, - appkey: window.GLOB.appkey || '' - } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 - let fieldmap = new Map() - let options = search.map(item => { - let _field = item.key - - if (fieldmap.has(_field)) { - _field = _field + '1' - } - - fieldmap.set(item.key, true) - - return { - reg: new RegExp('@' + _field, 'ig'), - value: item.value - } - }) - - options.reverse() - - options.forEach(item => { - _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) - }) - - _search = '' - } - - let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` - let DateCount = `select count(1) as total from ${_dataresource} ${_search}` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = Utils.formatOptions(DateCount) - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - this.refs.subTable.resetTable() - - this.setState({ - loading: true, - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' - } - sorter.order = _chg[sorter.order] - } - - this.setState({ - loading: true, - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - this.refs.subTable.resetTable() - this.setState({ - loading: true, - pageIndex: 1 - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ - loadingview: true, - viewlost: false, - lostmsg: '', - config: null, - searchlist: null, - actions: null, - columns: null, - arr_field: '', - setting: null, - data: null, - total: 0, - loading: false, - pageIndex: 1, - pageSize: 10, - orderBy: '', - search: '', - configMap: {} - }, () => { - this.loadconfig() - }) - } - - /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (btn, type) => { - if (btn.execSuccess === 'grid' && type === 'success') { - this.reloadtable() - } else if (btn.execError === 'grid' && type === 'error') { - this.reloadtable() - } else if (btn.execSuccess === 'view' && type === 'success') { - this.reloadview() - } else if (btn.execError === 'view' && type === 'error') { - this.reloadview() - } else if (btn.popClose === 'grid' && type === 'pop') { - this.reloadtable() - } else if (btn.popClose === 'view' && type === 'pop') { - this.reloadview() - } else if (btn.popClose === 'maingrid' && type === 'pop') { - this.props.handleMainTable('maingrid') - } else if (btn.popClose === 'equaltab' && type === 'pop') { - this.reloadtable() - this.props.handleMainTable('equaltab') - } else if (btn.execSuccess === 'maingrid' && type === 'success') { - this.props.handleMainTable('maingrid') - } else if (btn.execSuccess === 'equaltab' && type === 'success') { - this.reloadtable() - this.props.handleMainTable('equaltab') - } - } - - /** - * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� - */ - getexceloutparam = () => { - const { Tab } = this.props - const { arr_field, orderBy, search, setting} = this.state - - return { - arr_field: arr_field, - orderBy: orderBy || setting.order, - search: search, - menuName: Tab.label - } - } - - /** - * @description 鑾峰彇琛ㄦ牸閫夋嫨椤� - */ - gettableselected = () => { - let data = [] - this.refs.subTable.state.selectedRowKeys.forEach(item => { - data.push(this.refs.subTable.props.data[item]) - }) - return data - } - - /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.refs.subButton.actionTrigger(btn, record) - } - - /** - * @description 琛ㄦ牸Id鍙樺寲 - */ - handleTableId = (id = '', data = '') => { - this.props.handleTableId(this.props.Tab.uuid, id, data) - } - - /** - * @description 瑙﹀彂鎸夐挳寮圭獥锛堟爣绛鹃〉锛� - */ - triggerPopview = (btn, data) => { - this.setState({ - popAction: btn, - popData: data[0] ? data[0] : null, - visible: true - }) - } - - popclose = () => { - this.setState({ - visible: false - }) - this.refreshbyaction(this.state.popAction, 'pop') - } - - UNSAFE_componentWillMount () { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - render() { - const { setting, searchlist, actions, columns, loadingview, viewlost } = this.state - - return ( - <div className="subtable" id={'subtable' + this.props.MenuID}> - {loadingview && <Spin size="large" />} - {searchlist && searchlist.length > 0 ? - <SubSearch - refreshdata={this.refreshbysearch} - searchlist={searchlist} - dict={this.state.dict} - /> : null - } - {actions && - <SubAction - ref="subButton" - type="sub" - setting={setting} - actions={actions} - Tab={this.props.Tab} - BID={this.props.BID} - BData={this.props.BData} - dict={this.state.dict} - MenuID={this.props.SupMenuID} - logcolumns={this.state.logcolumns} - ContainerId={this.props.ContainerId} - refreshdata={this.refreshbyaction} - triggerPopview={this.triggerPopview} - getexceloutparam={this.getexceloutparam} - gettableselected={this.gettableselected} - /> - } - {columns && - <SubTable - ref="subTable" - dict={this.state.dict} - MenuID={this.props.MenuID} - setting={setting} - columns={columns} - data={this.state.data} - total={this.state.total} - loading={this.state.loading} - refreshdata={this.refreshbytable} - buttonTrigger={this.buttonTrigger} - handleTableId={this.handleTableId} - /> - } - <Modal - className="popview-modal" - title={this.state.popAction.label} - width={'80vw'} - maskClosable={false} - visible={this.state.visible} - onCancel={this.popclose} - footer={[ - <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> - ]} - destroyOnClose - > - {<SubTabTable - BID={this.props.BID} - BData={this.props.BData} - SupMenuID={this.props.MenuID} - ContainerId={this.props.ContainerId} - MenuID={this.state.popAction.linkTab} - ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} - refreshSupView={this.reloadtable} - />} - </Modal> - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} - </div> - ) - } -} - -const mapStateToProps = (state) => { - return { - permAction: state.permAction - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(SubTabViewTable) \ No newline at end of file diff --git a/src/tabviews/managesubtable/index.scss b/src/tabviews/managesubtable/index.scss deleted file mode 100644 index 74096d3..0000000 --- a/src/tabviews/managesubtable/index.scss +++ /dev/null @@ -1,37 +0,0 @@ -.subtable { - position: relative; - min-height: 200px; - padding-top: 16px; - > .top-search { - padding: 0 0px 20px; - } - > .button-list { - padding: 10px 0px 5px; - } - .box404 { - padding-top: 30px; - } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } - > .ant-spin { - position: absolute; - left: calc(50% - 22px); - top: 100px; - } -} -.popview-modal { - .ant-modal-body { - min-height: 300px; - } -} \ No newline at end of file diff --git a/src/tabviews/managetable/index.jsx b/src/tabviews/managetable/index.jsx index 3e9a357..89a9c42 100644 --- a/src/tabviews/managetable/index.jsx +++ b/src/tabviews/managetable/index.jsx @@ -9,6 +9,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import asyncComponent from '@/utils/asyncLoadComponent' import {refreshTabView, modifyTabview} from '@/store/action' @@ -363,9 +364,9 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { param.rduri = setting.interface } @@ -862,6 +863,7 @@ ref="mainButton" BID="" type="main" + menuType="HS" setting={setting} actions={actions} dict={this.state.dict} @@ -915,6 +917,7 @@ } key={`${index}`}> {_tab.type === 'SubTable' ? <SubTable + menuType="HS" Tab={_tab} MenuID={_tab.linkTab} SupMenuID={this.props.MenuID} @@ -952,6 +955,7 @@ > {<SubTabTable BID={''} + menuType="HS" SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BData={this.state.BIDs['mainTabledata'] || ''} @@ -982,7 +986,7 @@ </Modal> {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> : null} - {view === 'formtab' ? <FormTab MenuID={this.state.tabBtn.uuid} param={this.state.tabParam} refresh={this.refreshbyformtab}/> : null} + {view === 'formtab' ? <FormTab menuType="HS" MenuID={this.state.tabBtn.uuid} param={this.state.tabParam} refresh={this.refreshbyformtab}/> : null} </div> ) } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index a86dfc6..3edd335 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -13,12 +13,14 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import './index.scss' const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) class SubTabViewTable extends Component { static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS Tab: PropTypes.object, // 鏍囩淇℃伅 BID: PropTypes.string, // 涓婄骇鏁版嵁ID BData: PropTypes.any, // 涓婄骇鏁版嵁 @@ -114,7 +116,9 @@ let colMap = new Map() // 鏉冮檺杩囨护 - config.action = config.action.filter(item => permAction[item.uuid]) + if (this.props.menuType !== 'HS') { + config.action = config.action.filter(item => permAction[item.uuid]) + } // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { @@ -348,10 +352,18 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { + param.rduri = setting.interface + } } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } } param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey @@ -625,6 +637,7 @@ <SubAction ref="subButton" type="sub" + menuType={this.props.menuType} setting={setting} actions={actions} Tab={this.props.Tab} @@ -669,6 +682,7 @@ > {<SubTabTable BID={this.props.BID} + menuType={this.props.menuType} BData={this.props.BData} SupMenuID={this.props.MenuID} ContainerId={this.props.ContainerId} diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 2b52ef8..45be7c4 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -12,10 +12,12 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import './index.scss' class SubTabModalTable extends Component { static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS ID: PropTypes.string, // 涓婄骇鏁版嵁ID BID: PropTypes.string, // 涓婁笂绾ф暟鎹甀D BData: PropTypes.any, // 涓婁笂绾ф暟鎹� @@ -94,7 +96,9 @@ let colMap = new Map() // 鏉冮檺杩囨护 - config.action = config.action.filter(item => permAction[item.uuid]) + if (this.props.menuType !== 'HS') { + config.action = config.action.filter(item => permAction[item.uuid]) + } // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { @@ -299,10 +303,18 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - if (setting.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { + param.rduri = setting.interface + } } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } } param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey @@ -588,6 +600,7 @@ <SubAction ref="subtabButton" type="subtab" + menuType={this.props.menuType} setting={setting} actions={actions} BID={this.props.BID} diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 8d12a45..6ca24fb 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -6,6 +6,7 @@ import MutilForm from '@/tabviews/tableshare/mutilform' import ExcelIn from '../excelin' import Utils from '@/utils/utils.js' +import options from '@/store/options.js' import Api from '@/api' import './index.scss' @@ -13,6 +14,7 @@ class MainAction extends Component { static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� @@ -164,6 +166,12 @@ window.open(url) } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { this.props.triggerPopview(item, data) + } else if (item.OpenType === 'funcbutton') { + if (item.funcType === 'changeuser') { + this.changeUser(item, data) + } else if (item.funcType === 'print') { + this.triggerPrint(item, data) + } } else { notification.warning({ top: 92, @@ -171,6 +179,75 @@ duration: 10 }) } + } + + /** + * @description 瑙﹀彂鎵撳嵃 + */ + triggerPrint = (item, data) => { + // socket = new WebSocket('ws://127.0.0.1:13529') + + // // 鎵撳紑Socket + // socket.onopen = function(event) { + // // 鐩戝惉娑堟伅 + // socket.onmessage = function(event) + // { + // //鍙栨墦鍗版満淇℃伅鐨勮繑鍥炴槸鍦ㄨ繖閲�,鎵�浠ョ涓�娆$殑鎵撳嵃姣旇緝楹荤儲,鐪嬫槸涓嶆槸鍙互鍦ㄨ皟鎵撳嵃鍓嶅厛鍒ゆ柇浣犳湁娌℃湁瀛樻墦鍗版満鍚� + // //,娌℃湁灏辫皟getPrinters鏉ュ彇鎵撳嵃鏈哄幓璁剧疆,瑕佹槸璋冧簡鎵撳嵃鍐嶈皟鍙栨墦鍗版満,绗竴鏉℃墦鍗颁换鍔″氨瑕佸湪杩欓噷閲嶅彂,灏卞お楹荤儲浜� + // //鎻愬墠鍙栨墦鍗版満灏卞彧鑳界敤127.0.0.1:13529鏉ュ彇,杩欎釜鍦板潃灏辫鍐欐浜� + // console.log('Client received a message',event); + // }; + + // // 鐩戝惉Socket鐨勫叧闂� + // socket.onclose = function(event) + // { + // console.log('Client notified socket has closed',event); + // }; + + // }; + } + + /** + * @description 鍒囨崲鐢ㄦ埛 + */ + changeUser = (btn, data) => { + const { setting } = this.props + + let param = { + BID: this.props.BID, + func: 'webapi_ChangeUser', + appkey: window.GLOB.appkey || '', + rduri: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } + + param[setting.primaryKey] = data[0][setting.primaryKey] + + confirm({ + title: this.props.dict['main.action.confirm.tip'], + onOk() { + return new Promise(resolve => { + Api.genericInterface(param).then(res => { + resolve() + if (res.status) { + sessionStorage.setItem('avatar', res.icon || '') + sessionStorage.setItem('UserID', res.UserID) + sessionStorage.setItem('SessionUid', Utils.getuuid()) + sessionStorage.setItem('LoginUID', res.LoginUID) + sessionStorage.setItem('User_Name', res.UserName) + + window.location.reload() + } else { + notification.error({ + top: 92, + message: res.message || res.ErrMesg, + duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 + }) + } + }) + }) + }, + onCancel() {} + }) } /** @@ -511,11 +588,20 @@ // 澶栭儴璇锋眰 _outParam = JSON.parse(JSON.stringify(res)) - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - res.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } + // res.method = btn.method if (btn.outerFunc) { res.func = btn.outerFunc @@ -585,15 +671,15 @@ }) } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず - } else if (res.Relogin === 'true') { // 鍒囨崲鐢ㄦ埛鍔熻兘 - sessionStorage.setItem('avatar', res.icon || '') - sessionStorage.setItem('UserID', res.UserID) - sessionStorage.setItem('SessionUid', Utils.getuuid()) - sessionStorage.setItem('LoginUID', res.LoginUID) - sessionStorage.setItem('User_Name', res.UserName) + // } else if (res.Relogin === 'true') { // 鍒囨崲鐢ㄦ埛鍔熻兘 + // sessionStorage.setItem('avatar', res.icon || '') + // sessionStorage.setItem('UserID', res.UserID) + // sessionStorage.setItem('SessionUid', Utils.getuuid()) + // sessionStorage.setItem('LoginUID', res.LoginUID) + // sessionStorage.setItem('User_Name', res.UserName) - window.location.reload() - return + // window.location.reload() + // return } if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { @@ -939,10 +1025,18 @@ // 澶栭儴璇锋眰 _outParam = JSON.parse(JSON.stringify(res)) - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - res.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } if (btn.outerFunc) { @@ -1022,10 +1116,19 @@ }) } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - param.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } param.appkey = window.GLOB.appkey || '' @@ -1099,10 +1202,18 @@ delete res.message delete res.status - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - res.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } if (btn.outerFunc) { @@ -1153,11 +1264,21 @@ } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) - if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + + if (this.props.menuType === 'HS') { + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + param.rduri = btn.interface + } } else { - param.rduri = btn.interface + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } } + param.appkey = window.GLOB.appkey || '' @@ -1196,9 +1317,38 @@ let colwidth = [] let hidecolumns = [] + + let verifyColumn = {} // 璁板綍楠岃瘉淇℃伅涓殑Excel鍒楅厤缃� + if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { + btn.verify.columns.forEach(col => { + verifyColumn[col.Column] = col + }) + } + logcolumns.forEach(col => { if (col.Hide === 'true') { hidecolumns.push(col.field) + return + } + if (!data[0].hasOwnProperty(col.field)) return + if (_topRow[col.field]) return + + if (verifyColumn[col.field]) { // 浼樺厛浣跨敤楠岃瘉淇℃伅涓殑鍒楄缃� + _header.push(col.field) + _topRow[col.field] = verifyColumn[col.field].Text + + colwidth.push({width: verifyColumn[col.field].Width}) + } else { + _header.push(col.field) + _topRow[col.field] = col.label + + let _colwidth = Math.floor(col.Width / 6) + + if (!_colwidth || _colwidth < 5) { + _colwidth = 5 + } + + colwidth.push({width: _colwidth}) } }) @@ -1214,23 +1364,6 @@ colwidth.push({width: col.Width}) }) } - - logcolumns.forEach(col => { - if (col.Hide === 'true') return - if (!data[0].hasOwnProperty(col.field)) return - if (_topRow[col.field]) return - - _header.push(col.field) - _topRow[col.field] = col.label - - let _colwidth = Math.floor(col.Width / 6) - - if (!_colwidth || _colwidth < 5) { - _colwidth = 5 - } - - colwidth.push({width: _colwidth}) - }) Object.keys(data[0]).forEach(key => { if (hidecolumns.includes(key)) return diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index ea7f0d8..7a130e4 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -121,18 +121,21 @@ return item }) - let error = false - formlist = formlist.map(item => { if (item.type === 'link') { let supItem = formlist.filter(form => form.field === item.linkField)[0] + // 鍏宠仈鏄剧ず鍒椾腑鐨勫瓧娈靛�硷紝閫氳繃璇ュ�艰繃婊や笅鎷夐�夐」 if (!supItem && data && data.hasOwnProperty(item.linkField)) { supItem = {initval: data[item.linkField]} } if (!supItem) { - error = true + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌琛ㄥ崟銆�' + item.label + '銆嬪叧鑱斿瓧娈碉紒', + duration: 10 + }) } else { item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) } @@ -140,14 +143,6 @@ return item }) - - if (error) { - notification.warning({ - top: 92, - message: this.props.dict['main.form.link.error'], - duration: 10 - }) - } this.setState({ readtype: readtype, diff --git a/src/tabviews/tableshare/topSearch/index.jsx b/src/tabviews/tableshare/topSearch/index.jsx index 0a479b8..4222f5a 100644 --- a/src/tabviews/tableshare/topSearch/index.jsx +++ b/src/tabviews/tableshare/topSearch/index.jsx @@ -43,14 +43,16 @@ _list.push(item) }) - let error = false - _list = _list.map(item => { if (item.type === 'link') { let supItem = _list.filter(form => form.field === item.linkField)[0] if (!supItem) { - error = true + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌鎼滅储鏉′欢銆�' + item.label + '銆嬪叧鑱斿瓧娈碉紒', + duration: 10 + }) } else { item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) } @@ -58,14 +60,6 @@ return item }) - - if (error) { - notification.warning({ - top: 92, - message: '鍏宠仈鑿滃崟璁剧疆閿欒锛�', - duration: 10 - }) - } this.setState({ match: match, diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 9adcb57..36a4f25 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -20,6 +20,7 @@ formlist: null, // 琛ㄥ崟淇℃伅 openType: null, // 鎵撳紑鏂瑰紡 interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮� + funcType: null, // 鍔熻兘绫诲瀷 position: null, // 鎸夐挳浣嶇疆 reqOptionSgl: [{ value: 'requiredSgl', @@ -69,21 +70,28 @@ UNSAFE_componentWillMount () { - let _opentype = '' - let _intertype = '' - let _position = '' - let _tabType = '' - let _options = null + let _opentype = '' // 鎵撳紑鏂瑰紡 + let _intertype = '' // 鎺ュ彛绫诲瀷 + let _position = '' // 鎸夐挳浣嶇疆 + let _tabType = '' // 鎸夐挳涓哄脊绐楋紙鏍囩锛夋椂锛屾爣绛剧殑绫诲瀷 + let _funcType = '' // 鍔熻兘鎸夐挳绫诲瀷 + let _options = null // 閫夐」鍒楄〃 this.props.formlist.forEach(form => { if (form.key === 'OpenType') { - _opentype = form.initVal + if (this.props.card.execMode) { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡 + _opentype = 'funcbutton' + } else { + _opentype = form.initVal + } } else if (form.key === 'intertype') { _intertype = form.initVal } else if (form.key === 'position') { _position = form.initVal } else if (form.key === 'tabType') { _tabType = form.initVal + } else if (form.key === 'funcType') { + _funcType = form.initVal } }) @@ -109,6 +117,18 @@ } else { _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] } + } else if (_opentype === 'funcbutton') { + if (!_funcType) { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (_funcType === 'changeuser') { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (_funcType === 'print') { + if (_intertype === 'outer') { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } else { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } + } } else { if (_intertype === 'outer') { _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] @@ -120,6 +140,7 @@ openType: _opentype, interType: _intertype, position: _position, + funcType: _funcType, formlist: this.props.formlist.map(item => { if (item.key === 'class') { item.options = btnClasses @@ -147,7 +168,10 @@ }, ..._tabs ] + } else if (item.key === 'OpenType') { + item.initVal = _opentype } + item.hidden = !_options.includes(item.key) return item }) @@ -175,7 +199,7 @@ */ openTypeChange = (key, value) => { if (key === 'OpenType') { - let _options = [] + let _options = null if (value === 'innerpage') { _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] } else if (value === 'outerpage') { @@ -195,6 +219,18 @@ _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] } else { _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] + } + } else if (value === 'funcbutton') { + if (!this.state.funcType) { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (this.state.funcType === 'changeuser') { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (this.state.funcType === 'print') { + if (this.state.interType === 'outer') { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } else { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } } } else { if (this.state.interType === 'inner') { @@ -280,12 +316,38 @@ }, ..._tabs ] - _fieldval.linkTab = '' } return item }) }, () => { this.props.form.setFieldsValue(_fieldval) + }) + } else if (key === 'funcType') { + let _options = null + if (!value) { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (value === 'changeuser') { + _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] + } else if (value === 'print') { + if (this.state.interType === 'outer') { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } else { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } + } + + this.setState({ + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + if (item.hidden) return item + + if (item.key === 'Ot' && value === 'print') { + item.options = this.state.reqOptionsMutil + } + + return item + }) }) } } @@ -306,6 +368,12 @@ _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] } else { _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] + } + } else if (openType === 'funcbutton') { + if (value === 'outer') { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + } else { + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } } else { if (value === 'inner') { @@ -526,6 +594,8 @@ values.Ot = 'notRequired' } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d values.linkTab = Utils.getuuid() + } else if (values.OpenType === 'funcbutton' && values.funcType === 'print') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡 + values.OpenType = values.execMode } if (values.innerFunc === '' && values.sql === '') { diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index fb223e3..b7f966c 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1448,6 +1448,23 @@ card: '', }) }) + } else if (card.execMode) { + this.verifyRef.handleConfirm().then(res => { + + config.action = config.action.map(item => { + if (item.uuid === card.uuid) { + item.verify = res + } + + return item + }) + + this.setState({ + profileVisible: false, + config: config, + card: '', + }) + }) } else { let _verify = this.verifyRef.state.verify @@ -1803,7 +1820,8 @@ } }).then(resp => { if (resp === false) return - + let localParam = JSON.parse(JSON.stringify(param)) + Api.getSystemConfig(param).then(response => { if (response.status) { this.setState({ @@ -1821,6 +1839,14 @@ this.props.reloadmenu() this.submitAction(btnParam, tabParam) + + localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' + delete localParam.LongParam + delete localParam.PageParam + delete localParam.Template + delete localParam.Sort + + Api.getLocalConfig(localParam) } else { this.setState({ menuloading: false, @@ -3007,6 +3033,7 @@ <VerifyCardExcelIn card={this.state.card} dict={this.state.dict} + columns={this.state.config.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} /> : null } diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index ebde15e..064cd75 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -360,13 +360,19 @@ } handleSearch = (card) => { + const {menu} = this.props const { config } = this.state let _inputfields = [] + let _linkableFields = [] + let _formfields = [] // 璁剧疆涓嬫媺鑿滃崟鍙叧鑱斿瓧娈� config.groups.forEach(group => { let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') _inputfields = [..._inputfields, ...sublist] + + let suplist = group.sublist.filter(item => item.type === 'select' || item.type === 'link') + _formfields = [..._formfields, ...suplist] }) if (card.linkSubField && card.linkSubField.length > 0) { @@ -374,10 +380,35 @@ card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) } + let uniq = new Map() + _formfields.forEach(item => { + if (item.field && !uniq.has(item.field)) { + uniq.set(item.field, true) + + _linkableFields.push({ + value: item.field, + text: item.label + ' (琛ㄥ崟)' + }) + } + }) + + if (menu.LongParam) { + menu.LongParam.columns.forEach(col => { + if (col.field && !uniq.has(col.field)) { + uniq.set(col.field, true) + + _linkableFields.push({ + value: col.field, + text: col.label + ' (鏄剧ず鍒�)' + }) + } + }) + } + this.setState({ modaltype: 'search', card: card, - formlist: getModalForm(card, _inputfields) + formlist: getModalForm(card, _inputfields, _linkableFields) }) } diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 716b5bc..36a5db4 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -373,18 +373,75 @@ * 3銆佽缃紪杈戝弬鏁伴」-formlist */ handleForm = (card) => { + const {menu, tabConfig, subTabConfig} = this.props + const { config } = this.state let _inputfields = [] + let _linkableFields = [] + let _formfields = [] - // 璁剧疆涓嬫媺鑿滃崟鍙叧鑱斿瓧娈� + // 璁剧疆涓嬫媺鑿滃崟鍙叧鑱斿瓧娈�(涓婄骇涓庝笅绾�) if (config.groups.length > 0) { config.groups.forEach(group => { let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') _inputfields = [..._inputfields, ...sublist] + + let suplist = group.sublist.filter(item => item.type === 'select' || item.type === 'link') + _formfields = [..._formfields, ...suplist] }) } else { _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number') + + _formfields = config.fields.filter(item => item.type === 'select' || item.type === 'link') } + + let uniq = new Map() + _formfields.forEach(item => { + if (item.field && !uniq.has(item.field)) { + uniq.set(item.field, true) + + _linkableFields.push({ + value: item.field, + text: item.label + ' (琛ㄥ崟)' + }) + } + }) + + if (subTabConfig) { + subTabConfig.columns.forEach(col => { + if (col.field && !uniq.has(col.field)) { + uniq.set(col.field, true) + + _linkableFields.push({ + value: col.field, + text: col.label + ' (鏄剧ず鍒�)' + }) + } + }) + } else if (tabConfig) { + tabConfig.columns.forEach(col => { + if (col.field && !uniq.has(col.field)) { + uniq.set(col.field, true) + + _linkableFields.push({ + value: col.field, + text: col.label + ' (鏄剧ず鍒�)' + }) + } + }) + } else if (menu.LongParam) { + menu.LongParam.columns.forEach(col => { + if (col.field && !uniq.has(col.field)) { + uniq.set(col.field, true) + + _linkableFields.push({ + value: col.field, + text: col.label + ' (鏄剧ず鍒�)' + }) + } + }) + } + if (card.linkSubField && card.linkSubField.length > 0) { let fields = _inputfields.map(item => item.field) card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) @@ -393,7 +450,7 @@ this.setState({ visible: true, card: card, - formlist: getModalForm(card, _inputfields, !!this.props.editTab) + formlist: getModalForm(card, _inputfields, _linkableFields, !!this.props.editTab) }) } diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index c76954e..b45efaa 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1203,6 +1203,23 @@ card: '' }) }) + } else if (card.execMode) { + this.verifyRef.handleConfirm().then(res => { + + config.action = config.action.map(item => { + if (item.uuid === card.uuid) { + item.verify = res + } + + return item + }) + + this.setState({ + profileVisible: false, + config: config, + card: '', + }) + }) } else { let _verify = this.verifyRef.state.verify @@ -2387,6 +2404,7 @@ <VerifyCardExcelIn card={this.state.card} dict={this.state.dict} + columns={this.state.config.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} /> : null } diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js index b02eba8..ad81410 100644 --- a/src/templates/tableshare/formconfig.js +++ b/src/templates/tableshare/formconfig.js @@ -268,8 +268,43 @@ }, { value: 'outerpage', text: Formdict['header.form.newpage.outer'] + }, { + value: 'funcbutton', + text: Formdict['header.form.funcbutton'] }] - }, { + }, + { + type: 'select', + key: 'funcType', + label: Formdict['header.form.funcType'], + initVal: card.funcType || '', + required: true, + options: [{ + value: 'changeuser', + text: Formdict['header.form.func.changeuser'] + }, { + value: 'print', + text: Formdict['header.form.func.print'] + }] + }, + { + type: 'select', + key: 'execMode', + label: Formdict['header.form.execMode'], + initVal: card.execMode || 'exec', + required: true, + options: [{ + value: 'exec', + text: Formdict['header.form.exec'] + }, { + value: 'prompt', + text: Formdict['header.form.prompt'] + }, { + value: 'pop', + text: Formdict['header.form.popform'] + }] + }, + { type: 'select', key: 'tabType', label: Formdict['header.form.tabType'], @@ -750,7 +785,7 @@ * @param {*} card * @param {*} inputfields */ -export function getModalForm (card, inputfields, subtable = false) { +export function getModalForm (card, inputfields, linkableFields, subtable = false) { let _openType = [] let _fieldlength = 50 @@ -875,12 +910,13 @@ readonly: false }, { - type: 'text', + type: 'select', key: 'linkField', label: Formdict['header.form.linkField'], initVal: card.linkField || '', required: true, - readonly: false + readonly: false, + options: linkableFields }, { type: 'text', diff --git a/src/templates/tableshare/verifycard/index.jsx b/src/templates/tableshare/verifycard/index.jsx index ebc1365..2f24da8 100644 --- a/src/templates/tableshare/verifycard/index.jsx +++ b/src/templates/tableshare/verifycard/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip } from 'antd' +import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Input, Select } from 'antd' import moment from 'moment' import Api from '@/api' @@ -33,6 +33,8 @@ orderModular: [], orderModularDetail: [], voucher: [], + templates: [], + selectimg: '', voucherDetail: [], uniqueColumns: [ { @@ -380,7 +382,8 @@ customverifys: _verify.customverifys || [], billcodes: _verify.billcodes || [], voucher: _verify.voucher || {enabled: false}, - scripts: _verify.scripts || [] + scripts: _verify.scripts || [], + Template: _verify.Template || '' } }) @@ -634,6 +637,64 @@ voucherDetail: result[1].data }) }) + + if (this.props.card.execMode) { + let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 + union select ID,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 ) a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + on a.PrintTempNO=b.PrintTempNO + left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c + on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` + + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(_sql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + Api.getSystemConfig(param).then(res => { + if (res.status) { + let temps = res.data.map(temp => { + return { + value: temp.ID, + text: temp.PN, + img: temp.Images + } + }) + + let Template = this.state.verify.Template + let selectimg = '' + let selectTemp = temps.filter(temp => temp.value === Template)[0] + + if (!selectTemp) { + Template = '' + } else { + selectimg = selectTemp.img + } + + this.setState({ + selectimg: selectimg, + templates: temps, + verify: { + ...this.state.verify, + Template: Template + } + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } } uniqueChange = (values) => { @@ -983,7 +1044,39 @@ }) } + changeTemplate = (val) => { + const { templates } = this.state + + let temp = templates.filter(temp => temp.value === val)[0] + + this.setState({ + selectimg: temp.img + }) + } + + handleConfirm = () => { + const { verify } = this.state + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let _verify = {...verify, ...values} + + resolve(_verify) + } else { + notification.warning({ + top: 92, + message: '閾炬帴鍦板潃涓庢墦鍗版ā鏉夸笉鍙负绌�!', + duration: 10 + }) + } + }) + }) + } + render() { + const { getFieldDecorator } = this.props.form + const { verify, fields, uniqueColumns, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state const formItemLayout = { labelCol: { @@ -1002,7 +1095,7 @@ <TabPane tab="鍩虹楠岃瘉" key="1"> <Form {...formItemLayout}> <Row gutter={24}> - <Col span={12}> + <Col span={8}> <Form.Item label={ <Tooltip placement="bottomLeft" title={'榛樿sql鎵ц椤哄簭涓鸿嚜瀹氫箟鑴氭湰涔嬪墠'}> <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> @@ -1015,7 +1108,7 @@ </Radio.Group> </Form.Item> </Col> - <Col span={12}> + <Col span={8}> <Form.Item label={'璐︽湡楠岃瘉'}> <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> <Radio value="true">寮�鍚�</Radio> @@ -1023,7 +1116,7 @@ </Radio.Group> </Form.Item> </Col> - <Col span={12}> + <Col span={8}> <Form.Item label={'澶辨晥楠岃瘉'}> <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> <Radio value="true">寮�鍚�</Radio> @@ -1031,6 +1124,43 @@ </Radio.Group> </Form.Item> </Col> + {this.props.card.execMode ? <Col span={8}> + <Form.Item label={'閾炬帴鍦板潃'}> + {getFieldDecorator('linkUrl', { + initialValue: verify.linkUrl || '127.0.0.1:13529', + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + '閾炬帴鍦板潃!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} + {this.props.card.execMode ? <Col span={8}> + <Form.Item label={'鎵撳嵃妯℃澘'}> + {getFieldDecorator('Template', { + initialValue: verify.Template || '', + rules: [ + { + required: true, + message: this.props.dict['form.required.select'] + '鎵撳嵃妯℃澘!' + } + ] + })( + <Select onChange={this.changeTemplate}> + {this.state.templates.map((option, key) => + <Select.Option id={key} key={key} value={option.value}> + {option.text} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> : null} + {this.state.selectimg ? <Col span={9}> + <img style={{width: '90%', marginBottom: '25px'}} src={this.state.selectimg} alt=""/> + </Col> : null} </Row> </Form> </TabPane> diff --git a/src/templates/tableshare/verifycardexcelin/index.jsx b/src/templates/tableshare/verifycardexcelin/index.jsx index e5b8a3e..7c57b0d 100644 --- a/src/templates/tableshare/verifycardexcelin/index.jsx +++ b/src/templates/tableshare/verifycardexcelin/index.jsx @@ -12,6 +12,7 @@ class VerifyCard extends Component { static propTpyes = { + columns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� card: PropTypes.object, } @@ -153,6 +154,52 @@ range: _verify.range || 0, columns: _columns, scripts: _verify.scripts || [] + } + }) + } + + columnFieldInput = () => { + const { columns } = this.props + const { verify } = this.state + + let _columns = JSON.parse(JSON.stringify(verify.columns)) + + let _cols = _columns.map(col => col.Column ) + + columns.forEach(col => { + if (col.field && !_cols.includes(col.field)) { + let _type = 'Nvarchar(50)' + let _limit = '50' + if (col.type === 'number' && col.decimal === 0) { + _type = 'Int' + _limit = '' + } else if (col.type === 'number') { + _type = 'Decimal(18,' + col.decimal + ')' + _limit = col.decimal + } + + let _cell = { + uuid: col.uuid, + Column: col.field, + Text: col.label, + type: _type, + limit: _limit, + required: 'true' + } + + if (_type !== 'Nvarchar(50)') { + _cell.min = 0 + _cell.max = 999999 + } + + _columns.push(_cell) + } + }) + + this.setState({ + verify: { + ...verify, + columns: _columns } }) } @@ -441,6 +488,9 @@ columnChange={this.columnChange} wrappedComponentRef={(inst) => this.columnForm = inst} /> + <Button className="excel-col-add" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput} type="primary"> + 蹇嵎娣诲姞 + </Button> <Table bordered rowKey="uuid" diff --git a/src/templates/tableshare/verifycardexcelin/index.scss b/src/templates/tableshare/verifycardexcelin/index.scss index 63ab4c0..8878aa6 100644 --- a/src/templates/tableshare/verifycardexcelin/index.scss +++ b/src/templates/tableshare/verifycardexcelin/index.scss @@ -50,4 +50,12 @@ padding: 0 5px; cursor: pointer; } + .ant-tabs-tabpane { + position: relative; + .excel-col-add { + position: absolute; + right: 0; + top: 90px; + } + } } \ No newline at end of file -- Gitblit v1.8.0