From 5c8860f3cd8921e7eb0da7749628e9dc669b3203 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 三月 2020 10:19:16 +0800 Subject: [PATCH] 2020-03-17 --- src/tabviews/tableshare/verifycard/index.jsx | 21 src/views/printTemplate/option.js | 48 +++ src/tabviews/formtab/index.jsx | 37 + src/views/printTemplate/index.jsx | 8 src/templates/tableshare/columnform/index.jsx | 36 + src/templates/formtabconfig/index.jsx | 13 src/tabviews/tableshare/verifycard/index.scss | 6 src/templates/comtableconfig/index.jsx | 8 src/tabviews/tableshare/actionList/index.jsx | 109 +++++- src/templates/modalconfig/index.jsx | 13 src/templates/tableshare/dragelement/card.jsx | 2 src/tabviews/subtable/index.jsx | 53 ++ src/templates/tableshare/searchform/index.jsx | 26 + src/tabviews/subtabtable/index.jsx | 53 ++ src/locales/zh-CN/comtable.js | 1 src/tabviews/commontable/index.jsx | 57 +++ src/locales/en-US/comtable.js | 1 src/assets/css/main.scss | 21 + src/views/printTemplate/mutilform/index.jsx | 93 ++++- src/components/sidemenu/editthdmenu/index.jsx | 1 src/templates/subtableconfig/index.jsx | 8 src/tabviews/commontable/index.scss | 8 src/tabviews/tableshare/verifycard/actionform/index.jsx | 188 ++++++------ src/templates/tableshare/formconfig.js | 30 + src/templates/ushare/modalform/index.jsx | 22 src/views/login/index.jsx | 13 26 files changed, 635 insertions(+), 241 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 2d5cbe3..e02d81b 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -202,4 +202,23 @@ } .ant-tooltip.middle { max-width: 320px!important; -} \ No newline at end of file +} + +// 鍏宠仈閫夋嫨 +.ant-cascader-menus { + z-index: 1090!important; + .ant-cascader-menu::-webkit-scrollbar { + width: 7px; + } + .ant-cascader-menu::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); + background: rgba(0, 0, 0, 0.13); + } + .ant-cascader-menu::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + } +} diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 327e280..9cf82a0 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -690,6 +690,7 @@ this.setState({ roleList: res.Roles.map(role => { return { + uuid: Utils.getuuid(), value: role.RoleID, text: role.RoleName } diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index d673147..6673dd9 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -225,6 +225,7 @@ 'header.form.maxRows': '鏈�澶ц鏁�', 'header.form.paste': '绮樿创', 'header.form.ratio': '姣斾緥', + 'header.form.blacklist': '榛戝悕鍗�', '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 95185fa..306e6d2 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -225,6 +225,7 @@ 'header.form.maxRows': '鏈�澶ц鏁�', 'header.form.paste': '绮樿创', 'header.form.ratio': '姣斾緥', + 'header.form.blacklist': '榛戝悕鍗�', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 1d30b9b..5fb9c5f 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -9,17 +9,18 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' -import asyncComponent from '@/utils/asyncComponent' +// import asyncComponent from '@/utils/asyncComponent' import asyncLoadComponent from '@/utils/asyncLoadComponent' import {refreshTabView, modifyTabview} from '@/store/action' import MainTable from './mainTable' +import MainAction from '@/tabviews/tableshare/actionList' import VerifyCard from '@/tabviews/tableshare/verifycard' import MainSearch from '@/tabviews/tableshare/topSearch' import NotFount from '@/components/404' import './index.scss' -const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) +// const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable')) const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable')) const FormTab = asyncLoadComponent(() => import('@/tabviews/formtab')) @@ -80,6 +81,7 @@ MenuID: this.props.MenuID } let result = await Api.getSystemCacheConfig(param) + if (result.status) { let config = '' let userConfig = '' @@ -127,6 +129,35 @@ config[group] = config[group].filter(tab => permAction[tab.linkTab]) }) + // 瀛楁鏉冮檺榛戝悕鍗� + config.search = config.search.filter(item => { + if (!item.blacklist || item.blacklist.length === 0) return true + + let _black = item.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + + config.columns = config.columns.filter(col => { + if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + + let _black = col.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + if (userConfig) { config.setting = {...config.setting, ...userConfig.setting} let _actions = {} @@ -149,8 +180,8 @@ let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 - let _actions = [] // 宸ュ叿鏍忔寜閽� - let _operations = [] // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級 + let _actions = [] // 宸ュ叿鏍忔寜閽� + let _operations = [] // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級 config.action.forEach(item => { if (item.execMode) { @@ -176,10 +207,6 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - - // if () { // 鏉冮檺榛戝悕鍗� - // col.Hide = 'true' - // } _logcolumns.push(col) } @@ -262,11 +289,12 @@ let istrigger = false actions.forEach(item => { - if (!item.shortcut || istrigger) return + if (!item.shortcut || typeof(item.shortcut) !== 'object' || istrigger) return - if (preKey === item.shortcut && keyCode === item.shortcutkey) { + if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { e.preventDefault() istrigger = true + this.refs.mainButton.actionTrigger(item) } }) @@ -897,6 +925,9 @@ this.setState({ settingVisible: false, confirmLoading: false + }, () => { + window.GLOB.CacheMap = new Map() + this.reloadview() }) }) }) @@ -946,7 +977,7 @@ /> : null } {actions && setting.onload !== 'false' ? - <div style={{minHeight: '45px'}}> + <div style={{minHeight: '25px'}}> <MainAction ref="mainButton" BID="" @@ -956,6 +987,7 @@ actions={actions} dict={this.state.dict} MenuID={this.props.MenuID} + permRoles={this.props.permRoles} logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} @@ -1101,7 +1133,8 @@ return { tabviews: state.tabviews, refreshTab: state.refreshTab, - permAction: state.permAction + permAction: state.permAction, + permRoles: state.permRoles } } diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 89fdea4..0f2e924 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -52,7 +52,7 @@ position: relative; .main-pickup { position: absolute; - right: 20px; + right: 55px; top: -22px; z-index: 1; } @@ -60,8 +60,8 @@ position: absolute; z-index: 1; right: 20px; - top: -50px; - font-size: 16px; + top: -23px; + font-size: 18px; padding: 3px; cursor: pointer; } @@ -86,7 +86,7 @@ } } .commontable.pick-control { - >.button-list { + .button-list { padding-right: 140px; } } diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index ad702d5..cf03b8e 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -90,17 +90,6 @@ return } - let _arrField = [config.setting.primaryKey] // 瀛楁闆� , 榛樿娣诲姞涓婚敭 - - config.groups.forEach(group => { - group.sublist.forEach(item => { - if (!item.field) return - - _arrField.push(item.field) - }) - }) - _arrField = _arrField.join(',') - // 鏉冮檺杩囨护 if (this.props.param.menuType !== 'HS') { config.action = config.action.filter(item => permAction[item.uuid]) @@ -110,6 +99,29 @@ config[group] = config[group].filter(tab => permAction[tab.linkTab]) }) } + + let _arrField = [config.setting.primaryKey] // 瀛楁闆� , 榛樿娣诲姞涓婚敭 + + config.groups.forEach(group => { + group.sublist = group.sublist.filter(item => { + if (!item.blacklist || item.blacklist.length === 0) { + _arrField.push(item.field) + return true + } + + let _black = item.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + _arrField.push(item.field) + return true + } + }) + }) + _arrField = _arrField.join(',') this.setState({ config: config, @@ -694,7 +706,8 @@ return { tabviews: state.tabviews, refreshTab: state.refreshTab, - permAction: state.permAction + permAction: state.permAction, + permRoles: state.permRoles } } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 5a14bc9..afbeaf9 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -4,20 +4,24 @@ import { is, fromJS } from 'immutable' import { notification, Spin, Modal, Button, Switch} from 'antd' import moment from 'moment' + import Api from '@/api' -import SubTable from './subTable' -import SubSearch from '@/tabviews/tableshare/topSearch' -import asyncLoadComponent from '@/utils/asyncLoadComponent' -import asyncComponent from '@/utils/asyncComponent' -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 options from '@/store/options.js' + +import SubTable from './subTable' +import SubAction from '@/tabviews/tableshare/actionList' +import SubSearch from '@/tabviews/tableshare/topSearch' +import asyncLoadComponent from '@/utils/asyncLoadComponent' +// import asyncComponent from '@/utils/asyncComponent' +import NotFount from '@/components/404' + import './index.scss' const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable')) -const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) +// const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) class SubTabViewTable extends Component { static propTpyes = { @@ -120,6 +124,35 @@ // 鏉冮檺杩囨护 if (this.props.menuType !== 'HS') { config.action = config.action.filter(item => permAction[item.uuid]) + + // 瀛楁鏉冮檺榛戝悕鍗� + config.search = config.search.filter(item => { + if (!item.blacklist || item.blacklist.length === 0) return true + + let _black = item.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + + config.columns = config.columns.filter(col => { + if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + + let _black = col.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) } // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid @@ -664,7 +697,7 @@ /> : null } {actions ? - <div style={{minHeight: '45px'}}> + <div style={{minHeight: '25px'}}> <SubAction ref="subButton" type="sub" @@ -676,9 +709,10 @@ BData={this.props.BData} dict={this.state.dict} MenuID={this.props.SupMenuID} + permRoles={this.props.permRoles} logcolumns={this.state.logcolumns} - ContainerId={this.props.ContainerId} refreshdata={this.refreshbyaction} + ContainerId={this.props.ContainerId} triggerPopview={this.triggerPopview} getexceloutparam={this.getexceloutparam} gettableselected={this.gettableselected} @@ -737,7 +771,8 @@ const mapStateToProps = (state) => { return { - permAction: state.permAction + permAction: state.permAction, + permRoles: state.permRoles } } diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 23910cf..c8c0d50 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -4,18 +4,22 @@ import { is, fromJS } from 'immutable' import { notification, Spin} from 'antd' import moment from 'moment' + import Api from '@/api' -import asyncComponent from '@/utils/asyncComponent' -import SubTable from '@/tabviews/subtable/subTable' -import SubSearch from '@/tabviews/tableshare/topSearch' -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 options from '@/store/options.js' + +// import asyncComponent from '@/utils/asyncComponent' +import SubTable from '@/tabviews/subtable/subTable' +import SubAction from '@/tabviews/tableshare/actionList' +import SubSearch from '@/tabviews/tableshare/topSearch' +import NotFount from '@/components/404' + import './index.scss' -const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) +// const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) class SubTabModalTable extends Component { static propTpyes = { @@ -100,6 +104,35 @@ // 鏉冮檺杩囨护 if (this.props.menuType !== 'HS') { config.action = config.action.filter(item => permAction[item.uuid]) + + // 瀛楁鏉冮檺榛戝悕鍗� + config.search = config.search.filter(item => { + if (!item.blacklist || item.blacklist.length === 0) return true + + let _black = item.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + + config.columns = config.columns.filter(col => { + if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + + let _black = col.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) } // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid @@ -615,7 +648,7 @@ /> : null } {actions ? - <div style={{minHeight: '45px'}}> + <div style={{minHeight: '25px'}}> <SubAction ref="subtabButton" type="subtab" @@ -623,11 +656,12 @@ setting={setting} actions={actions} BID={this.props.BID} - BData={this.props.BData} dict={this.state.dict} + BData={this.props.BData} MenuID={this.props.SupMenuID} - ContainerId={this.props.ContainerId} + permRoles={this.props.permRoles} refreshdata={this.refreshbyaction} + ContainerId={this.props.ContainerId} gettableselected={this.gettableselected} /> </div> : null @@ -656,7 +690,8 @@ const mapStateToProps = (state) => { return { - permAction: state.permAction + permAction: state.permAction, + permRoles: state.permRoles } } diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index ad7dd32..1bbb6e4 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -28,8 +28,9 @@ ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� triggerPopview: PropTypes.func, // 寮圭獥鏍囩椤佃Е鍙� - getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 - gettableselected: PropTypes.func // 鑾峰彇琛ㄦ牸涓暟鎹� + getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 + gettableselected: PropTypes.func, // 鑾峰彇琛ㄦ牸涓暟鎹� + permRoles: PropTypes.any // 鐢ㄦ埛鏉冮檺鍒楄〃 } state = { @@ -234,36 +235,56 @@ } let printlist = [] - let templates = [] + let templates = [btn.verify.Template] this.setState({loadingUuid: btn.uuid}) new Promise(resolve => { if (btn.intertype === 'inner' && !btn.innerFunc) { formdata.TemplateID = btn.verify.Template - templates.push(btn.verify.Template) if (btn.Ot === 'notRequired') { - printlist.push(formdata) + if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { + for (let i = 0; i < formdata.printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(formdata))) + } + } else { + printlist.push(formdata) + } } else { - printlist = data.map(cell => { + data.forEach(cell => { let _cell = {...cell, ...formdata} - return _cell + if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { + for (let i = 0; i < formdata.printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(_cell))) + } + } else { + printlist.push(_cell) + } }) } resolve('getTemp') } else { this.getprintdata(btn, data, formdata, formlist).then(result => { - printlist = result.list.map(item => { - if (item.TemplateID) { - templates.push(item.TemplateID) - } else { - item.TemplateID = btn.verify.Template - } - return item - }) + result.list.forEach(item => { + let _cell = item.data + if (_cell.TemplateID) { + templates.push(_cell.TemplateID) + } else { + _cell.TemplateID = btn.verify.Template + } + + if (item.count && typeof(item.count) === 'number' && item.count > 1) { + for (let i = 0; i < item.count; i++) { + printlist.push(JSON.parse(JSON.stringify(_cell))) + } + } else { + printlist.push(_cell) + } + }) + resolve(result.next) }) } @@ -280,8 +301,8 @@ ID: tempId } - if (options.cloudServiceApi) { - param.rduri = options.cloudServiceApi.replace('dostars', 'dostar') + if (window.GLOB.mainSystemApi) { // 浠庡崟鐐圭櫥褰曟湇鍔″櫒鍙栨墦鍗伴厤缃俊鎭� + param.rduri = window.GLOB.mainSystemApi } Api.getLocalConfig(param).then(result => { @@ -389,7 +410,9 @@ let errorMsg = '' result.forEach(res => { if (res.status) { - _list.push(res.data) + res.data.forEach(_item => { + _list.push({data: _item, count: res.printCount}) + }) } else { errorMsg = res } @@ -471,8 +494,12 @@ return Api.genericInterface(res) }).then(response => { if (!response) return - // 鍥炶皟璇锋眰 + if (response.status) { + response.data.forEach(_item => { + _list.push({data: _item, count: response.printCount}) + }) + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� if (params.length === 0) { _resolve({next: 'getTemp', list: _list}) @@ -494,7 +521,9 @@ Api.genericInterface(param).then(res => { if (res.status) { - _list.push(res.data) + res.data.forEach(_item => { + _list.push({data: _item, count: res.printCount}) + }) if (params.length === 0) { _resolve({next: 'getTemp', list: _list}) @@ -526,11 +555,17 @@ error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�' } else { let control = configParam.elements.map(element => { + let _field = element.field + + if (_field === 'other_field') { + _field = element.cusfield || '' + } + let item = { Name: element.name || '', Type: element.type, Value: element.value || '', - Field: element.field || '', + Field: _field, Left: element.left, Top: element.top, Width: element.width, @@ -1333,6 +1368,38 @@ btnloading: false }) } else { + if (_LongParam.groups.length > 0) { + _LongParam.groups.forEach(group => { + group.sublist = group.sublist.filter(cell => { + if (!cell.blacklist || cell.blacklist.length === 0) return true + + let _black = cell.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + }) + } else { + _LongParam.fields = _LongParam.fields.filter(cell => { + if (!cell.blacklist || cell.blacklist.length === 0) return true + + let _black = cell.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + } + this.setState({ configMap: {...configMap, [action.uuid]: _LongParam}, execAction: {..._LongParam, ...execAction} diff --git a/src/tabviews/tableshare/verifycard/actionform/index.jsx b/src/tabviews/tableshare/verifycard/actionform/index.jsx index a3fb165..7f9581b 100644 --- a/src/tabviews/tableshare/verifycard/actionform/index.jsx +++ b/src/tabviews/tableshare/verifycard/actionform/index.jsx @@ -1,8 +1,36 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Button, Input } from 'antd' +import { Form, Row, Col, Select, Button, Input, Cascader } from 'antd' import './index.scss' +const shortkeycode = { + 65: 'A', + 66: 'B', + 67: 'C', + 68: 'D', + 69: 'E', + 70: 'F', + 71: 'G', + 72: 'H', + 73: 'I', + 74: 'J', + 75: 'K', + 76: 'L', + 77: 'M', + 78: 'N', + 79: 'O', + 80: 'P', + 81: 'Q', + 82: 'R', + 83: 'S', + 84: 'T', + 85: 'U', + 86: 'V', + 87: 'W', + 88: 'X', + 89: 'Y', + 90: 'Z' +} class UniqueForm extends Component { static propTpyes = { @@ -12,22 +40,52 @@ state = { editItem: null, // 缂栬緫鍏冪礌 - shortcut: '' + shortcutOptions: null + } + + UNSAFE_componentWillMount () { + let keys = ['shift', 'ctrl', 'alt'] + let _options = [] + + keys.forEach(item => { + let _op = { + value: item, + label: item, + children: [] + } + Object.keys(shortkeycode).forEach(key => { + if (item === 'ctrl' && (key === '67' || key === '86')) return + if (item === 'alt' && key === '65') return + + _op.children.push({ + value: +key, + label: shortkeycode[key] + }) + }) + + _options.push(_op) + }) + + this.setState({ + shortcutOptions: _options + }) } edit = (record) => { this.setState({ - editItem: record, - shortcut: record.shortcut || '' + editItem: record }, () => { - let item = { - label: record.label, - shortcut: record.shortcut + let _shortcut = record.shortcut || [] + + if (typeof(record.shortcut) !== 'object') { + _shortcut = [] } - if (record.shortcut) { - item.shortcutkey = record.shortcutkey + let item = { + label: record.label, + shortcut: _shortcut } + if (record.OpenType === 'funcbutton' && record.funcType === 'print') { item.printer = record.printer || '' } @@ -44,28 +102,14 @@ values.uuid = this.state.editItem ? this.state.editItem.uuid : '' this.props.actionChange(values) + this.setState({ - editItem: null, - shortcut: '' + editItem: null }, () => { this.props.form.setFieldsValue({ - shortcut: '', + shortcut: [], label: '' }) - }) - } - }) - } - - shortcutChange = (value) => { - this.setState({ - shortcut: value - }, () => { - let shortkey = this.props.form.getFieldValue('shortcutkey') - - if (shortkey && ((value === 'alt' && shortkey === 65) || (value === 'ctrl' && (shortkey === 67 || shortkey === 86))) ) { - this.props.form.setFieldsValue({ - shortcutkey: '' }) } }) @@ -90,15 +134,34 @@ return ( <Form {...formItemLayout} className="verify-form" id="verifycard1"> <Row gutter={24}> - <Col span={7}> + <Col span={10}> <Form.Item label={'鍚嶇О'}> {getFieldDecorator('label', { initialValue: '', })(<Input placeholder="" autoComplete="off" disabled />)} </Form.Item> </Col> + <Col span={10}> + <Form.Item label={'蹇嵎閿�'}> + {getFieldDecorator('shortcut', { + initialValue: [] + })( + <Cascader + displayRender={label => label.join(' + ')} + options={this.state.shortcutOptions} + /> + )} + </Form.Item> + </Col> + <Col span={4} className="add"> + <Form.Item label=" " colon={false} > + <Button onClick={this.handleConfirm} type="primary" className="add-row"> + 纭畾 + </Button> + </Form.Item> + </Col> {hasprint ? - <Col span={7}> + <Col span={10}> <Form.Item label={'鎵撳嵃鏈�'}> {getFieldDecorator('printer', { initialValue: '', @@ -118,75 +181,6 @@ </Form.Item> </Col> : null } - <Col span={7}> - <Form.Item label={'蹇嵎閿�'}> - {getFieldDecorator('shortcut', { - initialValue: '' - })( - <Select onChange={(value) => {this.shortcutChange(value)}}> - <Select.Option value=""> 绌� </Select.Option> - <Select.Option value="shift"> shift </Select.Option> - <Select.Option value="ctrl"> ctrl </Select.Option> - <Select.Option value="alt"> alt </Select.Option> - </Select> - )} - </Form.Item> - </Col> - {hasprint ? <Col span={3} className="add"> - <Button onClick={this.handleConfirm} type="primary" className="add-row"> - 纭畾 - </Button> - </Col> : null} - {this.state.shortcut ? - <Col span={7}> - <Form.Item label={'缁勫悎閿�'}> - {getFieldDecorator('shortcutkey', { - initialValue: '', - rules: [ - { - required: true, - message: '璇烽�夋嫨缁勫悎閿�!' - } - ] - })( - <Select> - <Select.Option value=""> 绌� </Select.Option> - {this.state.shortcut !== 'alt' ? <Select.Option value={65}> A </Select.Option> : null} - <Select.Option value={66}> B </Select.Option> - {this.state.shortcut !== 'ctrl' ? <Select.Option value={67}> C </Select.Option> : null} - <Select.Option value={68}> D </Select.Option> - <Select.Option value={69}> E </Select.Option> - <Select.Option value={70}> F </Select.Option> - <Select.Option value={71}> G </Select.Option> - <Select.Option value={72}> H </Select.Option> - <Select.Option value={73}> I </Select.Option> - <Select.Option value={74}> J </Select.Option> - <Select.Option value={75}> K </Select.Option> - <Select.Option value={76}> L </Select.Option> - <Select.Option value={77}> M </Select.Option> - <Select.Option value={78}> N </Select.Option> - <Select.Option value={79}> O </Select.Option> - <Select.Option value={80}> P </Select.Option> - <Select.Option value={81}> Q </Select.Option> - <Select.Option value={82}> R </Select.Option> - <Select.Option value={83}> S </Select.Option> - <Select.Option value={84}> T </Select.Option> - <Select.Option value={85}> U </Select.Option> - {this.state.shortcut !== 'ctrl' ? <Select.Option value={86}> V </Select.Option> : null} - <Select.Option value={87}> W </Select.Option> - <Select.Option value={88}> X </Select.Option> - <Select.Option value={89}> Y </Select.Option> - <Select.Option value={90}> Z </Select.Option> - </Select> - )} - </Form.Item> - </Col> : null - } - {!hasprint ? <Col span={3} className="add"> - <Button onClick={this.handleConfirm} type="primary" className="add-row"> - 纭畾 - </Button> - </Col> : null} </Row> </Form> ) diff --git a/src/tabviews/tableshare/verifycard/index.jsx b/src/tabviews/tableshare/verifycard/index.jsx index 199789e..705a486 100644 --- a/src/tabviews/tableshare/verifycard/index.jsx +++ b/src/tabviews/tableshare/verifycard/index.jsx @@ -67,23 +67,23 @@ { title: '鍚嶇О', dataIndex: 'label', - width: '20%' + width: '25%' }, { title: '蹇嵎閿�', dataIndex: 'shortcut', - width: '20%' - }, - { - title: '缁勫悎閿�', - dataIndex: 'shortcutkey', - width: '20%', - render: (text, record) => keycode[text] || '' + width: '25%', + render: (text, record) => { + if (!record.shortcut || typeof(record.shortcut) !== 'object') return '' + let _text = keycode[record.shortcut[1]] + + return record.shortcut[0] + ' + ' + _text + } }, { title: '鎵撳嵃鏈�', dataIndex: 'printer', - width: '20%' + width: '30%' }, { title: '鎿嶄綔', @@ -100,7 +100,7 @@ UNSAFE_componentWillMount() { const { config } = this.props - + this.setState({ config: JSON.parse(JSON.stringify(config)) }) @@ -144,6 +144,7 @@ _config.action = _config.action.map(cell => { if (item.uuid === cell.uuid) { + cell.printer = cell.printer || data.defaultPrinter cell.printers = printers.map(print => { return { diff --git a/src/tabviews/tableshare/verifycard/index.scss b/src/tabviews/tableshare/verifycard/index.scss index e9b51d0..d751b21 100644 --- a/src/tabviews/tableshare/verifycard/index.scss +++ b/src/tabviews/tableshare/verifycard/index.scss @@ -34,7 +34,11 @@ } } .add { - padding-top: 4px; + padding-top: 0px; + } + .ant-input-disabled { + color: rgba(0, 0, 0, 0.75); + cursor: default; } } .custom-table .ant-empty { diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 305ebaf..e63a3fa 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -385,10 +385,12 @@ * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� */ handleSearch = (card) => { + const { menu } = this.props + this.setState({ modaltype: 'search', card: card, - formlist: getSearchForm(card) + formlist: getSearchForm(card, menu.roleList) }) } @@ -413,11 +415,13 @@ * @description 鏄剧ず鍒椾笌鍚堝苟鍒楃紪杈戯紝鑾峰彇琛ㄥ崟淇℃伅 */ handleColumn = (card) => { + const { menu } = this.props + if (card.type !== 'colspan') { this.setState({ modaltype: 'columns', card: card, - formlist: getColumnForm(card) + formlist: getColumnForm(card, menu.roleList) }) } else { this.setState({ diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 7b93ee2..8e8a69a 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -426,10 +426,21 @@ }) } + let roleList = [] + if (menu.roleList && menu.roleList.length > 0) { + roleList = menu.roleList.map(role => { + return { + uuid: role.uuid, + field: role.value, + label: role.text + } + }) + } + this.setState({ modaltype: 'search', card: card, - formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields) + formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, false, roleList) }) } diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 4f50489..586a09a 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -464,11 +464,22 @@ card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) } + let roleList = [] + if (menu.roleList && menu.roleList.length > 0) { + roleList = menu.roleList.map(role => { + return { + uuid: role.uuid, + field: role.value, + label: role.text + } + }) + } + this.setState({ visible: true, modalType: type, card: card, - formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, !!this.props.editTab) + formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, !!this.props.editTab, roleList) }) } diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 3445cb6..5cb81ea 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -380,10 +380,12 @@ * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� */ handleSearch = (card) => { + const { menu } = this.props + this.setState({ modaltype: 'search', card: card, - formlist: getSearchForm(card) + formlist: getSearchForm(card, menu.roleList) }) } @@ -408,11 +410,13 @@ * @description 鏄剧ず鍒椾笌鍚堝苟鍒楃紪杈戯紝鑾峰彇琛ㄥ崟淇℃伅 */ handleColumn = (card) => { + const { menu } = this.props + if (card.type !== 'colspan') { this.setState({ modaltype: 'columns', card: card, - formlist: getColumnForm(card) + formlist: getColumnForm(card, menu.roleList) }) } else { this.setState({ diff --git a/src/templates/tableshare/columnform/index.jsx b/src/templates/tableshare/columnform/index.jsx index 16991dc..9ce8399 100644 --- a/src/templates/tableshare/columnform/index.jsx +++ b/src/templates/tableshare/columnform/index.jsx @@ -18,14 +18,14 @@ UNSAFE_componentWillMount () { let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal - let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength'] + let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist'] if (_type === 'text') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'] } else if (_type === 'number') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist'] } else if (_type === 'textarea') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'] } this.setState({ @@ -56,14 +56,14 @@ typeChange = (key, value) => { if (key === 'type') { - let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength'] + let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist'] if (value === 'text') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'] } else if (value === 'number') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist'] } else if (value === 'textarea') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'] } this.setState({ @@ -222,6 +222,26 @@ </Form.Item> </Col> ) + } else if (item.type === 'multiselect') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {item.options.map((option, i) => + <Select.Option id={i} key={i} value={option.value}>{option.text}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + ) } }) return fields diff --git a/src/templates/tableshare/dragelement/card.jsx b/src/templates/tableshare/dragelement/card.jsx index ab0ea27..9217dc6 100644 --- a/src/templates/tableshare/dragelement/card.jsx +++ b/src/templates/tableshare/dragelement/card.jsx @@ -81,6 +81,8 @@ hasProfile = true } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { hasProfile = true + } else if (card.funcType === 'print') { + hasProfile = true } } diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js index 57410cd..af50705 100644 --- a/src/templates/tableshare/formconfig.js +++ b/src/templates/tableshare/formconfig.js @@ -7,7 +7,7 @@ * @description 鑾峰彇鎼滅储鏉′欢琛ㄥ崟閰嶇疆淇℃伅 * @param {*} card */ -export function getSearchForm (card) { +export function getSearchForm (card, roleList = []) { return [ { type: 'text', @@ -221,6 +221,14 @@ initVal: '', required: false, options: [] + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList } ] } @@ -587,7 +595,7 @@ * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� * @param {*} card */ -export function getColumnForm (card) { +export function getColumnForm (card, roleList = []) { return [ { type: 'text', @@ -789,6 +797,14 @@ label: Formdict['header.form.field.length'], initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), required: false + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList } ] } @@ -798,7 +814,7 @@ * @param {*} card * @param {*} inputfields */ -export function getModalForm (card, inputfields, linkableFields, linksupFields, subtable = false) { +export function getModalForm (card, inputfields, linkableFields, linksupFields, subtable = false, roleList = []) { let _openType = [] let _fieldlength = 50 @@ -1122,6 +1138,14 @@ label: Formdict['header.form.linkForm'], initVal: card.linkSubField || [], options: inputfields + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList } ] } \ No newline at end of file diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx index adba3f1..ddae793 100644 --- a/src/templates/tableshare/searchform/index.jsx +++ b/src/templates/tableshare/searchform/index.jsx @@ -32,7 +32,7 @@ let type = formlist.filter(cell => cell.key === 'type')[0].initVal let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal - let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio'] // 榛樿鏄剧ず椤� + let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist'] // 榛樿鏄剧ず椤� if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 _options = [..._options, 'resourceType', 'options', 'display', 'quick'] @@ -104,7 +104,7 @@ const { resourceType } = this.state if (key === 'type') { - let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio'] + let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist'] if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 _options = [..._options, 'resourceType', 'options', 'display', 'quick'] @@ -189,7 +189,7 @@ let value = e.target.value if (key === 'resourceType') { - let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display', 'ratio'] + let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display', 'ratio', 'blacklist'] if (value === '0') { _options = [..._options, 'options', 'quick'] @@ -365,6 +365,26 @@ <EditTable data={item.initVal} type={this.state.openType} ref="editTable"/> </Col> ) + } else if (item.type === 'multiselect') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {item.options.map((option, i) => + <Select.Option id={i} key={i} value={option.value}>{option.text}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + ) } }) diff --git a/src/templates/ushare/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx index 993b39d..cc3aad0 100644 --- a/src/templates/ushare/modalform/index.jsx +++ b/src/templates/ushare/modalform/index.jsx @@ -54,16 +54,16 @@ } }) - let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 榛樿鏄剧ず椤� + let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'] // 榛樿鏄剧ず椤� if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮 _options = [..._options, 'resourceType', 'options', 'quick'] } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮 _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] } else if (type === 'number') { - _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] + _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist'] } else if (type === 'fileupload') { - _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] + _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist'] } else if (type === 'textarea') { _options = [..._options, 'fieldlength', 'maxRows'] } else if (type === 'text') { @@ -77,9 +77,9 @@ } else if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� _options = [..._options, 'setAll', 'linkField'] } else if (type === 'funcvar') { // 璁剧疆涓哄嚱鏁板彉閲忔椂锛屼笉闇�瑕佸叾浠栦俊鎭� - _options = ['label', 'field', 'type'] + _options = ['label', 'field', 'type', 'blacklist'] } else if (type === 'linkMain') { - _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] + _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist'] } if (type !== 'funcvar' && type !== 'linkMain') { @@ -134,16 +134,16 @@ openTypeChange = (key, value) => { if (key === 'type') { - let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] + let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'] if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮 _options = [..._options, 'resourceType', 'options', 'quick'] } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮 _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] } else if (value === 'number') { - _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] + _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist'] } else if (value === 'fileupload') { - _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] + _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist'] } else if (value === 'textarea') { _options = [..._options, 'fieldlength', 'maxRows'] } else if (value === 'text') { @@ -157,9 +157,9 @@ } else if (value === 'link') { _options = [..._options, 'setAll', 'linkField'] } else if (value === 'funcvar') { - _options = ['label', 'field', 'type'] + _options = ['label', 'field', 'type', 'blacklist'] } else if (value === 'linkMain') { - _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] + _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist'] } if (value !== 'funcvar' && value !== 'linkMain') { @@ -267,7 +267,7 @@ const { openType } = this.state let value = e.target.value if (key === 'resourceType') { - let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin'] + let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin', 'blacklist'] if (value === '0') { _options = [..._options, 'options', 'quick'] } else if (value === '1') { diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index e226e96..259edc4 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -13,7 +13,7 @@ import './index.scss' const LoginForm = asyncComponent(() => import('./loginform')) -const Action = asyncComponent(() => import('@/tabviews/tableshare/actionList')) +// const Action = asyncComponent(() => import('@/tabviews/tableshare/actionList')) const iszhCN = !localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN' class Login extends Component { @@ -57,9 +57,6 @@ async loginsubmit (param) { // 鐧诲綍鎻愪氦 - // let password = this.md5Password(param.password) - // let result = await Api.loginsystem(param.username, param.password) - // if (!result.IsError) { let res = await Api.getusermsg(param.username, param.password) if (res.status) { sessionStorage.setItem('UserID', res.UserID) @@ -90,12 +87,6 @@ isDisabled: false }) } - // } else { - // message.warning(result.Message) - // this.setState({ - // isDisabled: false - // }) - // } } componentDidMount () { @@ -164,7 +155,7 @@ } <p dangerouslySetInnerHTML={{ __html: this.state.ICP.replace(/\s/ig, ' ') }}></p> </div> - {this.state.loaded ? <div style={{position: 'fixed', bottom: '-1000px'}}><Action setting={{}} actions={[]} /></div> : null } + {/* {this.state.loaded ? <div style={{position: 'fixed', bottom: '-1000px'}}><Action setting={{}} actions={[]} /></div> : null } */} </div> ) } diff --git a/src/views/printTemplate/index.jsx b/src/views/printTemplate/index.jsx index 8072f48..5134fa3 100644 --- a/src/views/printTemplate/index.jsx +++ b/src/views/printTemplate/index.jsx @@ -430,12 +430,18 @@ _fields.push({ value: item.FieldName, - text: item.FieldDec, + text: item.FieldDec + '(' + item.FieldName + ')', type: item.FieldType }) } }) + _fields.push({ + value: 'other_field', + text: '鍏朵粬', + type: '' + }) + this.setState({ fields: _fields }) diff --git a/src/views/printTemplate/mutilform/index.jsx b/src/views/printTemplate/mutilform/index.jsx index 2d3dbf0..1d209f4 100644 --- a/src/views/printTemplate/mutilform/index.jsx +++ b/src/views/printTemplate/mutilform/index.jsx @@ -16,16 +16,53 @@ formlist: PropTypes.array // input鍥炶溅鎻愪氦 } + state = { + formlist: null, + type: 'box' + } + + UNSAFE_componentWillMount () { + this.setState({ + formlist: this.props.formlist + }) + } + UNSAFE_componentWillReceiveProps(nextProps) { if (!is(fromJS(this.props.editItem), fromJS(nextProps.editItem))) { this.setState({}, () => { let fieldsvalue = {} + let isCusField = false + let type = 'box' + nextProps.formlist.forEach(item => { + if (item.type === 'title') { + type = item.class + } + if (!item.key) return + if (item.key === 'field' && item.initval === 'other_field') { + isCusField = true + } fieldsvalue[item.key] = item.initval }) - this.props.form.setFieldsValue(fieldsvalue) + + this.setState({ + type: type, + formlist: nextProps.formlist.map(item => { + if (item.key === 'cusfield' && isCusField) { + item.hidden = false + } + + return item + }) + }, () => { + if (!isCusField) { + delete fieldsvalue.cusfield + } + this.props.form.setFieldsValue(fieldsvalue) + }) + }) } } @@ -38,6 +75,28 @@ width: option.width, height: option.height }) + } else if (item.key === 'field') { + if (value === 'other_field') { + this.setState({ + formlist: this.state.formlist.map(item => { + if (item.key === 'cusfield') { + item.hidden = false + } + + return item + }) + }) + } else { + this.setState({ + formlist: this.state.formlist.map(item => { + if (item.key === 'cusfield') { + item.hidden = true + } + + return item + }) + }) + } } this.handleSubmit() } @@ -48,14 +107,20 @@ delete _param.uuid delete _param.url + if (_param.field !== 'other_field') { + delete _param.cusfield + } + this.props.form.setFieldsValue(_param) } getFields() { const { getFieldDecorator } = this.props.form + const { type, formlist } = this.state const fields = [] - this.props.formlist.forEach((item, index) => { + formlist.forEach((item, index) => { + if (item.hidden) return if (item.type === 'title') { fields.push( @@ -67,23 +132,11 @@ ) } else if (item.type === 'text') { let _rules = [] - if (item.regular) { - if (item.regular === 'number') { - _rules = [{ - pattern: /^[0-9]*$/ig, - message: formRule.input.numbermsg - }] - } else if (item.regular === 'letter') { - _rules = [{ - pattern: /^[a-zA-Z]*$/ig, - message: formRule.input.lettermsg - }] - } else if (item.regular === 'letter&number') { - _rules = [{ - pattern: /^[a-zA-Z0-9]*$/ig, - message: formRule.input.letternummsg - }] - } + if (item.key === 'value' && type === 'barcode') { + _rules = [{ + pattern: /^[a-zA-Z0-9]*$/ig, + message: '鏉$爜鍊煎繀椤讳负鏁板瓧鎴栧瓧姣嶏紒' + }] } fields.push( <Col span={24} key={index}> @@ -93,7 +146,7 @@ rules: [ { required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' + message: '璇疯緭鍏�' + item.label + '瀛楁!' }, { max: 512, diff --git a/src/views/printTemplate/option.js b/src/views/printTemplate/option.js index ca9317b..fbf2b1c 100644 --- a/src/views/printTemplate/option.js +++ b/src/views/printTemplate/option.js @@ -288,6 +288,7 @@ item.align = 'left' item.vertialAlign = 'top' } else if (type === 'barcode') { + item.value = '' item.url = url item.barcodeType = 'code128' item.barcodeWidth = Math.floor(width * 0.6) @@ -295,6 +296,7 @@ item.barcodeLabel = 'true' item.fontSize = Math.floor(12 * (boxwidth / 210)) } else if (type === 'qrcode') { + item.value = '' item.url = url item.qrcodeType = 'qrcode' item.qrcodeWidth = Math.floor(height * 0.6) @@ -313,6 +315,7 @@ type: 'title', label: '绫诲瀷', initval: '鏂囨湰', + class: 'text', required: false }, { @@ -336,6 +339,14 @@ initval: item.field || '', required: false, options: fields + }, + { + type: 'text', + key: 'cusfield', + label: '鑷畾涔�', + initval: item.cusfield || '', + required: true, + hidden: true }, { type: 'number', @@ -466,6 +477,7 @@ type: 'title', label: '绫诲瀷', initval: '鏉″舰鐮�', + class: 'barcode', required: false }, { @@ -476,12 +488,27 @@ required: false }, { + type: 'text', + key: 'value', + label: '鍐呭', + initval: item.value || '', + required: false + }, + { type: 'select', key: 'field', label: '鍏宠仈瀛楁', initval: item.field, - required: true, + required: false, options: fields + }, + { + type: 'text', + key: 'cusfield', + label: '鑷畾涔�', + initval: item.cusfield || '', + required: true, + hidden: true }, { type: 'number', @@ -612,6 +639,7 @@ type: 'title', label: '绫诲瀷', initval: '浜岀淮鐮�', + class: 'qrcode', required: false }, { @@ -622,12 +650,27 @@ required: false }, { + type: 'text', + key: 'value', + label: '鍐呭', + initval: item.value || '', + required: false + }, + { type: 'select', key: 'field', label: '鍏宠仈瀛楁', initval: item.field, - required: true, + required: false, options: fields + }, + { + type: 'text', + key: 'cusfield', + label: '鑷畾涔�', + initval: item.cusfield || '', + required: true, + hidden: true }, { type: 'number', @@ -734,6 +777,7 @@ type: 'title', label: '绫诲瀷', initval: '鍥剧墖', + class: 'image', required: false }, { -- Gitblit v1.8.0