From a70940450c021a47e69abdf8fa8f7f98594601cc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 13 十二月 2019 17:36:54 +0800 Subject: [PATCH] 2019-12-13 --- src/assets/img/card-bg7.jpg | 0 src/components/header/index.jsx | 37 +- src/assets/img/card-bg8.jpg | 0 src/locales/zh-CN/share.js | 4 src/templates/comtableconfig/index.jsx | 11 src/templates/comtableconfig/searchform/index.jsx | 189 +++++------- src/templates/modalconfig/modalform/index.jsx | 16 src/templates/modalconfig/index.jsx | 4 src/api/index.js | 4 src/assets/img/card-bg6.jpg | 0 src/templates/modalconfig/dragelement/index.jsx | 11 src/assets/img/card-bg2.jpg | 0 src/locales/zh-CN/comtable.js | 3 src/tabviews/commontable/index.jsx | 114 ++++--- src/templates/comtableconfig/dragelement/index.jsx | 28 - src/templates/modalconfig/dragelement/card.jsx | 4 src/locales/en-US/comtable.js | 3 src/utils/utils.js | 79 +++-- src/templates/comtableconfig/actionform/index.jsx | 53 --- src/templates/modalconfig/index.scss | 2 src/locales/zh-CN/main.js | 1 src/components/header/editmenu/index.scss | 75 ++++ src/assets/img/card-bg5.jpg | 0 src/templates/comtableconfig/source.jsx | 10 src/components/header/editmenu/index.jsx | 21 + src/components/header/resetpwd/index.jsx | 4 src/store/options.js | 4 src/tabviews/commontable/mutilform/index.jsx | 4 src/templates/modalconfig/source.jsx | 3 src/components/404/index.jsx | 6 src/assets/img/card-bg4.jpg | 0 src/components/sidemenu/menuelement/index.scss | 17 src/locales/en-US/share.js | 4 src/utils/option.js | 131 ++++++++ src/assets/img/card-image1.png | 0 35 files changed, 494 insertions(+), 348 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index db17b3b..c74c629 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -109,7 +109,7 @@ return axios({ url: '/local/dostar', data: { - func: 'ResetPassword', + func: 's_PwdUpt', userid: sessionStorage.getItem('UserID'), OriginPwd: originpwd, NewPwd: newpwd @@ -118,7 +118,7 @@ } /** - * @description 鑾峰彇绯荤粺閰嶇疆锛屽鍔燼ppkey + * @description 鑾峰彇鎴栦慨鏀圭郴缁熼厤缃紝澧炲姞appkey */ getSystemConfig (param) { param.userid = sessionStorage.getItem('UserID') diff --git a/src/assets/img/card-bg2.jpg b/src/assets/img/card-bg2.jpg new file mode 100644 index 0000000..3cd8f33 --- /dev/null +++ b/src/assets/img/card-bg2.jpg Binary files differ diff --git a/src/assets/img/card-bg4.jpg b/src/assets/img/card-bg4.jpg new file mode 100644 index 0000000..ab1d71d --- /dev/null +++ b/src/assets/img/card-bg4.jpg Binary files differ diff --git a/src/assets/img/card-bg5.jpg b/src/assets/img/card-bg5.jpg new file mode 100644 index 0000000..b00fb34 --- /dev/null +++ b/src/assets/img/card-bg5.jpg Binary files differ diff --git a/src/assets/img/card-bg6.jpg b/src/assets/img/card-bg6.jpg new file mode 100644 index 0000000..a384cc9 --- /dev/null +++ b/src/assets/img/card-bg6.jpg Binary files differ diff --git a/src/assets/img/card-bg7.jpg b/src/assets/img/card-bg7.jpg new file mode 100644 index 0000000..b101bae --- /dev/null +++ b/src/assets/img/card-bg7.jpg Binary files differ diff --git a/src/assets/img/card-bg8.jpg b/src/assets/img/card-bg8.jpg new file mode 100644 index 0000000..70c0af3 --- /dev/null +++ b/src/assets/img/card-bg8.jpg Binary files differ diff --git a/src/assets/img/card-image1.png b/src/assets/img/card-image1.png new file mode 100644 index 0000000..724a358 --- /dev/null +++ b/src/assets/img/card-image1.png Binary files differ diff --git a/src/components/404/index.jsx b/src/components/404/index.jsx index ac68a67..397b7d5 100644 --- a/src/components/404/index.jsx +++ b/src/components/404/index.jsx @@ -1,6 +1,10 @@ import React, {Component} from 'react' import Lostsvg from '@/components/lostsvg' +import zhCN from '@/locales/zh-CN/share.js' +import enUS from '@/locales/en-US/share.js' import './index.scss' + +const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS class NotFound extends Component { render () { @@ -11,7 +15,7 @@ <Lostsvg /> </div> <div className="ant-result-title">404</div> - <div className="ant-result-subtitle">鎶辨瓑锛屼綘璁块棶鐨勯〉闈笉瀛樺湪锛岃鑱旂郴绠$悊鍛樸��</div> + <div className="ant-result-subtitle">{this.props.msg ? this.props.msg : _dict['view.notFound']}</div> </div> </main> ) diff --git a/src/components/header/editmenu/index.jsx b/src/components/header/editmenu/index.jsx index 6b35dc4..ad4a74e 100644 --- a/src/components/header/editmenu/index.jsx +++ b/src/components/header/editmenu/index.jsx @@ -309,7 +309,26 @@ render () { return ( <div className="header-edit-box"> - <div className="mask"></div> + <div className="mask"> + <div className="tipcard card1"> + 鎷栧姩涓�绾ц彍鍗曞彲璋冩暣椤哄簭锛岄『搴忚皟鏁村悗锛岃鐐瑰嚮纭畾鎸夐挳淇濆瓨銆� + </div> + <div className="tipcard card2"> + 榧犳爣缁忚繃鑿滃崟鏃朵細鏄剧ず缂栬緫鍥炬爣锛岀偣鍑荤紪杈戝彲淇敼鍜屽垹闄よ彍鍗曘�� + </div> + <div className="tipcard card3"> + 鐐瑰嚮瑙i櫎鍐荤粨鎸夐挳锛屽彲杩樺師宸插垹闄ょ殑涓�绾ц彍鍗曘�� + </div> + <div className="tipcard card4"> + 鐐瑰嚮娣诲姞鍥炬爣锛屽彲鏂板涓�绾ц彍鍗曘�� + </div> + <div className="tipcard card5"> + <p>缂栬緫鐘舵�佷腑锛屼竴绾ц彍鍗曚箣澶栧尯鍩熶細閿佸畾锛屾煡鐪嬬郴缁熸暟鎹鐐瑰嚮銆�</p> + <div> + <a target="blank" href="#/main" >鏂伴〉闈�</a> + </div> + </div> + </div> {this.props.menulist && <DndProvider backend={HTML5Backend}> <DragElement dict={this.state.dict} diff --git a/src/components/header/editmenu/index.scss b/src/components/header/editmenu/index.scss index aea2ae9..5be7f5a 100644 --- a/src/components/header/editmenu/index.scss +++ b/src/components/header/editmenu/index.scss @@ -5,6 +5,79 @@ left: 0px; right: 0px; bottom: 0px; - background-color: rgba(0, 0, 0, 0.25); + .tipcard { + position: absolute; + min-height: 100px; + font-size: 16px; + border-radius: 6px; + background-size: 100% 100%; + background-repeat: no-repeat; + padding: 15px; + } + .card1 { + left: 30%; + top: 20vh; + width: 230px; + min-height: 100px; + background-image: url('../../../assets/img/card-bg2.jpg'); + color: #000000; + font-style: oblique; + } + .card2 { + left: 60%; + top: 20vh; + width: 230px; + min-height: 100px; + background-image: url('../../../assets/img/card-bg5.jpg'); + color: #000000; + padding: 20px 30px; + font-style: oblique; + } + .card3 { + left: 30%; + top: 50vh; + width: 230px; + min-height: 140px; + background-image: url('../../../assets/img/card-bg8.jpg'); + color: #000000; + padding: 20px 30px; + font-style: oblique; + } + .card4 { + left: 60%; + top: 50vh; + width: 230px; + min-height: 140px; + background-image: url('../../../assets/img/card-bg7.jpg'); + color: #000000; + padding: 20px 30px; + font-style: oblique; + } + .card5 { + right: 5%; + top: 20vh; + width: 130px; + min-height: 240px; + background-image: url('../../../assets/img/card-bg6.jpg'); + color: #000000; + padding: 40px 15px 10px; + p { + margin: 0 0 5px; + } + div { + text-align: center; + a { + display: inline-block; + color: #fff; + padding: 2px 10px; + border-radius: 4px; + background-color: #1890ff; + border-color: #1890ff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12); + -webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045); + box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045); + } + } + } } } \ No newline at end of file diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index d9d7865..752bfe3 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -3,17 +3,17 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import {Dropdown, Menu, Icon, Modal, message, Form, notification, Switch } from 'antd' -import md5 from 'md5' +import moment from 'moment' +import {Dropdown, Menu, Icon, Modal, Form, notification, Switch } from 'antd' import asyncComponent from '@/utils/asyncComponent' import {toggleCollapse, modifyMainMenu, resetState, resetDebug, resetEditState, resetEditLevel, logout} from '@/store/action' -import Resetpwd from '@/components/resetpwd' import Api from '@/api' import zhCN from '@/locales/zh-CN/header.js' import enUS from '@/locales/en-US/header.js' import Utils from '@/utils/utils.js' import logourl from '@/assets/img/main-logo.png' import avatar from '@/assets/img/avatar.jpg' +import Resetpwd from './resetpwd' import './index.scss' const EditMenu = asyncComponent(() => import('./editmenu')) @@ -50,12 +50,6 @@ }) } - md5Password (pwd) { - // md5瀵嗙爜鍔犲瘑 - const salt = 'minkesoft' - return md5(md5(pwd + salt)) - } - resetPwdSubmit = () => { this.formRef.handleConfirm().then(res => { this.setState({ @@ -66,17 +60,26 @@ } async resetPwdSubmitexec (param) { - // 閲嶇疆瀵嗙爜鎻愪氦锛屽叧闂ā鎬佹锛屾竻绌鸿〃鍗曟暟鎹� - let password = this.md5Password(param.originpwd) - let newpassword = this.md5Password(param.password) - let result = await Api.resetpassword(password, newpassword) + let _param = { + func: 's_PwdUpt', + LText: `select '${param.originpwd}','${param.password}'` + } + + _param.LText = Utils.formatOptions(_param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 鏃堕棿鎴� + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5瀵嗛挜 + + let result = await Api.getSystemConfig(_param) if (result.status) { this.setState({ visible: false, confirmLoading: false }) - this.formRef.resetfrom() - message.success(this.state.dict['header.password.resetsuccess']) + notification.success({ + top: 92, + message: this.state.dict['header.password.resetsuccess'], + duration: 5 + }) } else { notification.warning({ top: 92, @@ -94,7 +97,6 @@ this.setState({ visible: false }) - this.formRef.resetfrom() } logout = () => { @@ -182,7 +184,7 @@ // 鑾峰彇涓昏彍鍗� let result = await Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}) if (result.status) { - // console.log(result.Roles) + } } @@ -276,6 +278,7 @@ onOk={this.resetPwdSubmit} confirmLoading={this.state.confirmLoading} onCancel={this.handleCancel} + destroyOnClose > <Resetpwd dict={this.state.dict} wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/> </Modal> diff --git a/src/components/resetpwd/index.jsx b/src/components/header/resetpwd/index.jsx similarity index 97% rename from src/components/resetpwd/index.jsx rename to src/components/header/resetpwd/index.jsx index 62d43b8..448aea7 100644 --- a/src/components/resetpwd/index.jsx +++ b/src/components/header/resetpwd/index.jsx @@ -31,10 +31,6 @@ }) } - resetfrom = () => { - this.props.form.resetFields() - } - handleConfirmBlur = e => { const { value } = e.target this.setState({ confirmDirty: this.state.confirmDirty || !!value }) diff --git a/src/components/sidemenu/menuelement/index.scss b/src/components/sidemenu/menuelement/index.scss index 6569346..7a53089 100644 --- a/src/components/sidemenu/menuelement/index.scss +++ b/src/components/sidemenu/menuelement/index.scss @@ -46,7 +46,9 @@ .close { position: absolute; right: 0; - top: 0; + top: 1px; + font-size: 16px; + color: #ff4d4f; cursor: pointer; :hover { color: #ffffff; @@ -54,17 +56,10 @@ } .edit { position: absolute; - right: 0; - bottom: 1px; - cursor: pointer; - :hover { - color: #ffffff; - } - } - .close { - position: absolute; - right: 0; + right: 23px; top: 1px; + font-size: 16px; + color: #1890ff; cursor: pointer; :hover { color: #ffffff; diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 49ddb25..e9f48bf 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -96,7 +96,8 @@ 'header.form.pop': '寮圭獥', 'header.form.popform': '寮圭獥锛堣〃鍗曪級', 'header.form.popview': '寮圭獥锛堥〉闈級', - 'header.form.tab': '鏂版爣绛鹃〉', + 'header.form.tab': '鏍囩椤�', + 'header.form.currenttab': '褰撳墠鑿滃崟', 'header.form.excelIn': 'Excel瀵煎叆', 'header.form.excelOut': 'Excel瀵煎嚭', 'header.form.newpage': '鏂伴〉闈�', diff --git a/src/locales/en-US/share.js b/src/locales/en-US/share.js new file mode 100644 index 0000000..ed2f705 --- /dev/null +++ b/src/locales/en-US/share.js @@ -0,0 +1,4 @@ +export default { + 'view.notFound': '鎶辨瓑锛屼綘璁块棶鐨勯〉闈笉瀛樺湪锛岃鑱旂郴绠$悊鍛樸��', + 'date.empty': '绌�' +} \ No newline at end of file diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index 541e349..6eb9119 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -96,7 +96,8 @@ 'header.form.pop': '寮圭獥', 'header.form.popform': '寮圭獥锛堣〃鍗曪級', 'header.form.popview': '寮圭獥锛堥〉闈級', - 'header.form.tab': '鏂版爣绛鹃〉', + 'header.form.tab': '鏍囩椤�', + 'header.form.currenttab': '褰撳墠鑿滃崟', 'header.form.excelIn': 'Excel瀵煎叆', 'header.form.excelOut': 'Excel瀵煎嚭', 'header.form.newpage': '鏂伴〉闈�', diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js index d5d3dd5..bfd369d 100644 --- a/src/locales/zh-CN/main.js +++ b/src/locales/zh-CN/main.js @@ -18,6 +18,7 @@ 'main.action.primarykey.repetition': '瀛樺湪澶氫釜涓婚敭锛�', 'main.action.primarykey.repetitionbid': '瀛樺湪澶氫釜BID锛�', 'main.column.operation': '鎿嶄綔', + 'main.view.unenabled': '鎶辨瓑锛屼綘璁块棶鐨勯〉闈㈡湭鍚敤锛岃鑱旂郴绠$悊鍛樸��', 'form.required.input': '璇疯緭鍏�', 'form.required.select': '璇烽�夋嫨' } \ No newline at end of file diff --git a/src/locales/zh-CN/share.js b/src/locales/zh-CN/share.js new file mode 100644 index 0000000..ed2f705 --- /dev/null +++ b/src/locales/zh-CN/share.js @@ -0,0 +1,4 @@ +export default { + 'view.notFound': '鎶辨瓑锛屼綘璁块棶鐨勯〉闈笉瀛樺湪锛岃鑱旂郴绠$悊鍛樸��', + 'date.empty': '绌�' +} \ No newline at end of file diff --git a/src/store/options.js b/src/store/options.js index d378bc0..eabd2ff 100644 --- a/src/store/options.js +++ b/src/store/options.js @@ -1,4 +1,6 @@ // 绯荤粺閰嶇疆 export default { - AppId: '201912040924165801464FF1788654BC5AC73' + AppId: '201912040924165801464FF1788654BC5AC73', + cloudDatabase: 'sqlserver', + localDatabase: 'mysql' } \ No newline at end of file diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 082ad93..893367c 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -16,14 +16,15 @@ export default class NormalTable extends Component { static propTpyes = { - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id + MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuID: PropTypes.string // 鑿滃崟Id } state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - loadingview: true, - viewlost: false, + loadingview: true, // 椤甸潰鍔犺浇涓� + viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 + lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, searchlist: null, actions: null, @@ -41,39 +42,51 @@ configMap: {} } + /** + * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 + */ async loadconfig () { - // 鑾峰彇涓昏彍鍗� let param = { func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } let result = await Api.getSystemCacheConfig(param) if (result.status && result.LongParam) { - let config = window.decodeURIComponent(window.atob(result.LongParam)) + let config = '' - try { + try { // 閰嶇疆淇℃伅瑙f瀽 + config = window.decodeURIComponent(window.atob(result.LongParam)) config = JSON.parse(config) - this.setState({ - loadingview: false - }) } catch (e) { - this.setState({ - loadingview: false, - viewlost: true - }) + config = '' + } + + // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� + if (!config) { notification.warning({ top: 92, message: this.state.dict['main.page.settingerror'], duration: 10 }) + return } - let _search = Utils.mainjointsearchkey(config.search) - let _arrField = [] - let _columns = [] - let _hideCol = [] + // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 + if (!config.enabled) { + this.setState({ + loadingview: false, + viewlost: true, + lostmsg: this.state.dict['main.view.unenabled'] + }) + return + } + + let _arrField = [] // 瀛楁闆� + let _columns = [] // 鏄剧ず鍒� + let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) @@ -86,8 +99,10 @@ 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 = [] @@ -103,31 +118,26 @@ } }) - let _actions = config.action.filter(item => item.position === 'toolbar') - // let _operation = config.action.filter(item => item.position === 'grid') + // 娣诲姞鎿嶄綔鍒楋紙瀛樺湪鏃讹級锛堟湭缁忚繃鏉冮檺杩囨护锛� + if (config.gridBtn && config.gridBtn.display) { + _columns.push({ + ...config.gridBtn, + operations: config.action.filter(item => item.position === 'grid') + }) + } - // if (_operation.length > 0) { - // _columns.push({ - // Align: 'center', - // uuid: Utils.getuuid(), - // IsSort: 'false', - // Width: 120, - // type: 'action', - // style: 'button', - // label: this.state.dict['main.column.operation'], - // operations: _operation - // }) - // } + // 杩囨护宸ュ叿鏍忔寜閽紙鏈粡杩囨潈闄愯繃婊わ級 + let _actions = config.action.filter(item => item.position === 'toolbar') this.setState({ + loadingview: false, config: config, setting: config.setting, searchlist: config.search, actions: _actions, columns: _columns, arr_field: _arrField.join(','), - search: _search ? 'where (' + _search + ')' : '', - // orderColumn: config.setting.orderColumn, + search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 loading: true }, () => { this.improveSearch() @@ -255,7 +265,9 @@ async loadmaindata () { const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state - console.log(setting) + + let _search = Utils.joinMainSearchkey(search) + _search = _search ? 'where (' + _search + ')' : '' // 鑾峰彇鍒楄〃鏁版嵁 let param = { func: setting.innerFunc || 'sPC_Get_TableData', @@ -265,8 +277,8 @@ let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order - let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` - let DateCount = `select count(1) as total from ${setting.dataresource} ${search}` + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + let DateCount = `select count(1) as total from ${setting.dataresource} ${_search}` console.log(LText) param.LText = Utils.formatOptions(LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' @@ -284,17 +296,20 @@ loading: false }) } else { + // this.setState({ + // data: [1,2,3,4,5,6,7,8,9,10].map((item, index) => { + // let cell = {} + // this.state.config.columns.forEach(column => { + // if (!column.field) return + // cell[column.field] = 'test' + item + // }) + // cell.key = index + // return cell + // }), + // total: 329, + // loading: false + // }) this.setState({ - data: [1,2,3,4,5,6,7,8,9,10].map((item, index) => { - let cell = {} - this.state.config.columns.forEach(column => { - if (!column.field) return - cell[column.field] = 'test' + item - }) - cell.key = index - return cell - }), - total: 329, loading: false }) notification.error({ @@ -307,12 +322,11 @@ refreshbysearch = (searches) => { // 鎼滅储鏉′欢鍙樺寲 - let search = Utils.mainjointsearchkey(searches) this.refs.mainTable.resetTable() this.setState({ loading: true, - search: search ? 'where (' + search + ')' : '' + search: searches }, () => { this.loadmaindata() }) @@ -412,7 +426,7 @@ </div> </div> </BackTop> - {viewlost ? <NotFount /> : null} + {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) } diff --git a/src/tabviews/commontable/mutilform/index.jsx b/src/tabviews/commontable/mutilform/index.jsx index 42e091b..391eb45 100644 --- a/src/tabviews/commontable/mutilform/index.jsx +++ b/src/tabviews/commontable/mutilform/index.jsx @@ -57,8 +57,8 @@ const fields = [] let cols = 2 - if (this.props.form.setting && this.props.form.setting.cols) { - cols = parseInt(this.props.form.setting.cols) + if (this.props.action.setting && this.props.action.setting.cols) { + cols = parseInt(this.props.action.setting.cols) if (cols > 3 || cols < 1) { cols = 2 } diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 7903f59..14250ea 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -1,61 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' +import { btnIcons, btnClasses } from '@/utils/option.js' import './index.scss' const { TextArea } = Input - -const btnIcons = [{ - MenuID: '', - text: 'unset' -}, { - MenuID: 'plus', - text: 'plus' -}, { - MenuID: 'plus-circle', - text: 'plus-circle' -}, { - MenuID: 'edit', - text: 'edit' -}, { - MenuID: 'form', - text: 'form' -}, { - MenuID: 'close', - text: 'close' -}, { - MenuID: 'close-circle', - text: 'close-circle' -}, { - MenuID: 'delete', - text: 'delete' -}] - -const btnClasses = [{ - MenuID: 'default', - text: '榛樿锛堥粦杈圭櫧搴曪級' -}, { - MenuID: 'primary', - text: '钃濊壊' -}, { - MenuID: 'yellow', - text: '榛勮壊' -}, { - MenuID: 'danger', - text: '绾㈣壊' -}, { - MenuID: 'green', - text: '缁胯壊' -}, { - MenuID: 'dgreen', - text: '娣辩豢鑹�' -}, { - MenuID: 'purple', - text: '绱壊' -}, { - MenuID: 'gray', - text: '鐏拌壊' -}] class MainSearch extends Component { static propTpyes = { diff --git a/src/templates/comtableconfig/dragelement/index.jsx b/src/templates/comtableconfig/dragelement/index.jsx index aef3aae..53de9b3 100644 --- a/src/templates/comtableconfig/dragelement/index.jsx +++ b/src/templates/comtableconfig/dragelement/index.jsx @@ -19,7 +19,7 @@ } const findCard = id => { - const card = cards.filter(c => `${c.id}` === id)[0] + const card = cards.filter(c => `${c.uuid}` === id)[0] return { card, index: cards.indexOf(card), @@ -42,13 +42,7 @@ copycard.uuid = Utils.getuuid() copycard.origin = false copycard.label = copycard.label + '(copy)' - - let indexes = cards.map(car => { return car.id }) - let newid = 0 - while (indexes.includes(newid)) { - newid++ - } - copycard.id = newid + copycard.originCard = card copyElement(copycard) @@ -127,16 +121,9 @@ } } - let indexes = cards.map(car => {return car.id}) - let newid = 0 - while (indexes.includes(newid)) { - newid++ - } - newcard.id = newid - - let targetId = indexes.length > 0 ? indexes[indexes.length - 1] : 0 + let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 if (target) { - targetId = target.id + targetId = target.uuid } const { index: overIndex } = findCard(`${targetId}`) @@ -187,7 +174,7 @@ {type === 'action' && cards.map(card => ( <Card key={card.uuid} - id={`${card.id}`} + id={`${card.uuid}`} type={type} card={card} moveCard={moveCard} @@ -201,8 +188,7 @@ {type === 'search' && cards.map(card => ( <Col key={card.uuid} span={6}> <Card - key={card.uuid} - id={`${card.id}`} + id={`${card.uuid}`} type={type} card={card} moveCard={moveCard} @@ -229,7 +215,7 @@ {column.map(card => ( <Card key={card.uuid} - id={`${card.id}`} + id={`${card.uuid}`} type={type} card={card} moveCard={moveCard} diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index fc39bd3..7ef6d02 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -147,6 +147,9 @@ }, { MenuID: 'newpage', text: this.state.dict['header.form.newpage'] + }, { + MenuID: 'currenttab', + text: this.state.dict['header.form.currenttab'] }] } ] @@ -1742,8 +1745,6 @@ }) let _columns = [...columnsMap.values()] - let indexes = items.map(card => {return card.id}) - let id = Math.max(...indexes, 0) + 1 _columns.forEach(item => { if (item.selected) { @@ -1760,7 +1761,6 @@ } let newcard = { - id: id, uuid: Utils.getuuid(), label: item.label, field: item.field, @@ -1780,7 +1780,6 @@ } items.push(newcard) - id++ } }) } else { @@ -1798,13 +1797,10 @@ }) let _columns = [...columnsMap.values()] - let indexes = items.map(card => {return card.id}) - let id = Math.max(...indexes, 0) _columns.forEach(item => { if (item.selected) { let newcard = { - id: id, uuid: Utils.getuuid(), Align: 'left', label: item.label, @@ -1816,7 +1812,6 @@ } items.push(newcard) - id++ } }) } diff --git a/src/templates/comtableconfig/searchform/index.jsx b/src/templates/comtableconfig/searchform/index.jsx index c151d01..94f3db4 100644 --- a/src/templates/comtableconfig/searchform/index.jsx +++ b/src/templates/comtableconfig/searchform/index.jsx @@ -1,77 +1,87 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd' +import { dateOptions, matchReg } from '@/utils/option.js' import EditTable from '../editable' import './index.scss' const { TextArea } = Input -const matchReg = { - text: [{ - value: 'like', - text: 'like' - }, { - value: 'not like', - text: 'not like' - }, { - value: '=', - text: '=' - }], - select: [{ - value: '=', - text: '=' - }, { - value: 'like', - text: 'like' - }, { - value: 'not like', - text: 'not like' - }], - date: [{ - value: '>=', - text: '>=' - }, { - value: '<=', - text: '<=' - }, { - value: '>', - text: '>' - }, { - value: '<', - text: '<' - }, { - value: '=', - text: '=' - }], - daterange: [{ - value: 'between', - text: 'between' - }] -} class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - formlist: PropTypes.any, - card: PropTypes.object + dict: PropTypes.object, // 瀛楀吀椤� + formlist: PropTypes.any, // 琛ㄥ崟 + card: PropTypes.object // 鎼滅储鏉′欢淇℃伅 } state = { - openType: null, - resourceType: null, - formlist: null, - dateoptions: { - date: [{value: '', text: '绌�'}, {value: '0', text: '褰撳ぉ'}, {value: 1, text: '鍓嶄竴澶�'}, {value: 3, text: '鍓嶄笁澶�'}, {value: 7, text: '鍓嶄竷澶�'}, {value: 30, text: '鍓�30澶�'}], - dateweek: [{value: '', text: '绌�'}, {value: '0', text: '鏈懆'}, {value: 1, text: '涓婂懆'}, {value: 3, text: '鍓嶄笁鍛�'}, {value: 7, text: '鍓嶄竷鍛�'}], - datemonth: [{value: '', text: '绌�'}, {value: '0', text: '鏈湀'}, {value: 1, text: '涓婃湀'}, {value: 3, text: '鍓嶄笁鏈�'}, {value: 7, text: '鍓嶄竷鏈�'}], - daterange: [{value: '', text: '绌�'}, {value: '0', text: '浠婂ぉ'}, {value: 1, text: '鏄ㄥぉ'}, {value: 3, text: '鍓嶄笁澶�'}, {value: 7, text: '鍓嶄竷澶�'}, {value: 30, text: '鍓�30澶�'}], - } + openType: null, // 鎼滅储鏉′欢鏄剧ず绫诲瀷 + resourceType: null, // 涓嬫媺鎼滅储鏃讹紝閫夐」鏉ユ簮绫诲瀷 + formlist: null // 琛ㄥ崟 } + /** + * @description 琛ㄥ崟棰勫鐞� + * 1銆佹牴鎹〃鍗曠被鍨嬶紝鏄剧ず琛ㄥ崟鍙紪杈戦」 + * 2銆佷笅鎷夐�夋嫨锛屾牴鎹暟鎹簮绫诲瀷鏄剧ず鐩稿叧閰嶇疆 + */ + UNSAFE_componentWillMount () { + const { formlist } = this.props + + 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'] // 榛樿鏄剧ず椤� + + if ((type === 'select' || type === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 + _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] + } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙� + _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] + } + + if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斾笂绾х殑瀛楁鍚� + _options = [..._options, 'linkField'] + } + + this.setState({ + openType: type, + resourceType: resourceType, + formlist: formlist.map(form => { + // 琛ㄥ崟涓哄垵濮嬪�煎瓧娈碉紝涓旀暟鎹被鍨嬪睘浜庢椂闂寸被鍨嬫椂锛岃缃垵濮嬪�间负涓嬫媺閫夋嫨锛屽苟閲嶇疆閫夋嫨椤� + if (form.key === 'initval' && dateOptions.hasOwnProperty(type)) { + form.options = dateOptions[type] + form.type = 'select' + } + // 琛ㄥ崟涓哄尮閰嶅瓧娈垫椂锛屾牴鎹笉鍚岀殑绫诲瀷锛屾樉绀哄搴旂殑鍖归厤瑙勫垯 + if (form.key === 'match') { + if (type === 'text') { + form.options = matchReg.text + } else if (type === 'select' || type === 'link') { + form.options = matchReg.select + } else if (type === 'date' || type === 'datemonth') { + form.options = matchReg.date + } else if (type === 'dateweek' || type === 'daterange') { + form.options = matchReg.daterange + } + } + form.hidden = !_options.includes(form.key) + return form + }) + }) + } + + /** + * @description 鎼滅储鏉′欢绫诲瀷鍒囨崲 + */ openTypeChange = (key, value) => { + const { resourceType } = this.state + if (key === 'type') { let _options = ['label', 'field', 'initval', 'type', 'match'] - if (value === 'select' || value === 'link') { // 鍒囨崲绫诲瀷涓洪�夋嫨鎴栧叧鑱旀椂锛屾潵婧愰粯璁や负鑷畾涔� + + if ((value === 'select' || value === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] + } else if ((value === 'select' || value === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙� + _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] } if (value === 'link') { @@ -80,21 +90,19 @@ this.setState({ openType: value, - resourceType: '0', formlist: this.state.formlist.map(form => { - form.hidden = !_options.includes(form.key) + form.hidden = !_options.includes(form.key) // 闅愯棌琛ㄥ崟 + if (form.key === 'initval') { - if (this.state.dateoptions.hasOwnProperty(value)) { - form.options = this.state.dateoptions[value] + if (dateOptions.hasOwnProperty(value)) { // 鏍规嵁鎼滅储鏉′欢绫诲瀷锛岄�夋嫨鍒濆鍊肩殑绫诲瀷鍙婃暟鎹� + form.options = dateOptions[value] form.type = 'select' } else { form.type = 'text' } - form.initVal = '' + form.initVal = '' // 鎼滅储鏉′欢绫诲瀷鍒囨崲鏃讹紝鍒濆鍊肩疆绌� form.hidden = true - } - - if (form.key === 'match') { + } else if (form.key === 'match') { // 鎼滅储鏉′欢绫诲瀷鍒囨崲鏃讹紝鍖归厤瑙勫垯绫诲瀷瀵瑰簲鍒囨崲 if (value === 'text') { form.options = matchReg.text } else if (value === 'select' || value === 'link') { @@ -106,18 +114,20 @@ } form.hidden = true } + return form }) }, () => { this.setState({ formlist: this.state.formlist.map(form => { + if (form.key === 'initval') { form.hidden = false - } - if (form.key === 'match') { + } else if (form.key === 'match') { form.initVal = form.options[0].value form.hidden = false } + return form }) }) @@ -125,11 +135,16 @@ } } + /** + * @description 鏁版嵁婧愮被鍨嬪垏鎹� + */ onChange = (e, key) => { const { openType } = this.state let value = e.target.value + if (key === 'resourceType') { let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'setAll', 'display'] + if (value === '0') { _options = [..._options, 'options'] } else if (value === '1') { @@ -298,50 +313,6 @@ } }) }) - } - - resetForm = (formlist) => { - if (!formlist) return - 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'] // 榛樿鏄剧ず椤� - if ((type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮 - _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] - } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮 - _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] - } - - if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� - _options = [..._options, 'linkField'] - } - - this.setState({ - openType: type, - resourceType: resourceType, - formlist: formlist.map(form => { - if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { - form.options = this.state.dateoptions[type] - form.type = 'select' - } - if (form.key === 'match') { - if (type === 'text') { - form.options = matchReg.text - } else if (type === 'select' || type === 'link') { - form.options = matchReg.select - } else if (type === 'date' || type === 'datemonth') { - form.options = matchReg.date - } else if (type === 'dateweek' || type === 'daterange') { - form.options = matchReg.daterange - } - } - form.hidden = !_options.includes(form.key) - return form - }) - }) - } - - UNSAFE_componentWillMount () { - this.resetForm(this.props.formlist) } render() { diff --git a/src/templates/comtableconfig/source.jsx b/src/templates/comtableconfig/source.jsx index 195337b..1b7d63e 100644 --- a/src/templates/comtableconfig/source.jsx +++ b/src/templates/comtableconfig/source.jsx @@ -23,7 +23,6 @@ search: [ { origin: true, - id: 0, uuid: Utils.getuuid(), label: 'label', field: '', @@ -42,7 +41,6 @@ display: 'dropdown' }, { origin: true, - id: 1, uuid: Utils.getuuid(), label: 'label', field: '', @@ -61,7 +59,6 @@ display: 'dropdown' }, { origin: true, - id: 2, uuid: Utils.getuuid(), label: 'label', field: '', @@ -83,7 +80,6 @@ action: [ { origin: true, - id: 0, uuid: Utils.getuuid(), label: 'add', intertype: 'inner', @@ -105,7 +101,6 @@ class: 'green' }, { origin: true, - id: 1, uuid: Utils.getuuid(), label: 'update', intertype: 'inner', @@ -127,7 +122,6 @@ class: 'purple' }, { origin: true, - id: 2, uuid: Utils.getuuid(), label: 'delete', intertype: 'inner', @@ -152,7 +146,6 @@ columns: [ { origin: true, - id: 0, uuid: Utils.getuuid(), Align: 'left', label: 'label', @@ -163,7 +156,6 @@ Width: 120 }, { origin: true, - id: 1, uuid: Utils.getuuid(), Align: 'left', label: 'label', @@ -174,7 +166,6 @@ Width: 120 }, { origin: true, - id: 2, uuid: Utils.getuuid(), Align: 'left', label: 'label', @@ -185,7 +176,6 @@ Width: 120 }, { origin: true, - id: 3, uuid: Utils.getuuid(), Align: 'left', label: 'label', diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx index 6d143be..9546c1e 100644 --- a/src/templates/modalconfig/dragelement/card.jsx +++ b/src/templates/modalconfig/dragelement/card.jsx @@ -59,10 +59,10 @@ <div className="page-card" style={{ opacity: opacity}}> <div ref={node => drag(drop(node))}> {<div className="ant-row ant-form-item"> - <div className="ant-col ant-form-item-label"> + <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> <label title={card.label}>{card.label}</label> </div> - <div className="ant-col ant-form-item-control-wrapper"> + <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> {card.type === 'text' && <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> } diff --git a/src/templates/modalconfig/dragelement/index.jsx b/src/templates/modalconfig/dragelement/index.jsx index 5b7cd29..c4f68e7 100644 --- a/src/templates/modalconfig/dragelement/index.jsx +++ b/src/templates/modalconfig/dragelement/index.jsx @@ -26,7 +26,7 @@ } const findCard = id => { - const card = cards.filter(c => `${c.id}` === id)[0] + const card = cards.filter(c => `${c.uuid}` === id)[0] return { card, index: cards.indexOf(card), @@ -79,11 +79,9 @@ newcard.readonly = 'false' newcard.required = 'false' - newcard.id = Utils.getuuid() - - let targetId = cards.length > 0 ? cards[cards.length - 1].id : 0 + let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 if (target) { - targetId = target.id + targetId = target.uuid } const { index: overIndex } = findCard(`${targetId}`) @@ -115,8 +113,7 @@ {cards.map(card => ( <Col key={card.uuid} span={_cols}> <Card - key={card.uuid} - id={`${card.id}`} + id={`${card.uuid}`} card={card} moveCard={moveCard} editCard={editCard} diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 54ac9ba..0b30439 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -254,7 +254,7 @@ let element = null _config.groups.forEach(item => { item.sublist = item.sublist.filter(cell => { - if (cell.id !== elementId) { + if (cell.uuid !== elementId) { return true } else { element = cell @@ -755,7 +755,6 @@ let _additems = _columns.map(item => { // 寰幆娣诲姞鏂板瀛楁 return { - id: Utils.getuuid(), uuid: Utils.getuuid(), label: item.label, field: item.field, @@ -800,7 +799,6 @@ _columns.forEach(item => { // 寰幆娣诲姞鏂板瀛楁 if (item.selected) { let newcard = { - id: Utils.getuuid(), uuid: Utils.getuuid(), label: item.label, field: item.field, diff --git a/src/templates/modalconfig/index.scss b/src/templates/modalconfig/index.scss index 5f506f0..7d93103 100644 --- a/src/templates/modalconfig/index.scss +++ b/src/templates/modalconfig/index.scss @@ -210,7 +210,7 @@ display: flex; margin-bottom: 0px; .ant-form-item-label { - width: 100px; + // width: 100px; height: 40px; label { width: 100%; diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/modalconfig/modalform/index.jsx index aa96845..5ce3d76 100644 --- a/src/templates/modalconfig/modalform/index.jsx +++ b/src/templates/modalconfig/modalform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' +import { dateOptions } from '@/utils/option.js' import EditTable from '../editable' import './index.scss' @@ -16,12 +17,7 @@ state = { openType: null, resourceType: null, - formlist: null, - dateoptions: { - date: [{value: '', text: '绌�'}, {value: '0', text: '褰撳ぉ'}, {value: 1, text: '鍓嶄竴澶�'}, {value: 3, text: '鍓嶄笁澶�'}, {value: 7, text: '鍓嶄竷澶�'}, {value: 30, text: '鍓�30澶�'}], - datemonth: [{value: '', text: '绌�'}, {value: '0', text: '鏈湀'}, {value: 1, text: '涓婃湀'}, {value: 3, text: '鍓嶄笁鏈�'}, {value: 6, text: '鍓嶅叚鏈�'}], - datetime: [{value: '', text: '绌�'}, {value: '0', text: '鐜板湪'}, {value: 1, text: '鏄ㄥぉ'}, {value: 3, text: '鍓嶄笁澶�'}, {value: 7, text: '鍓嶄竷澶�'}, {value: 30, text: '鍓�30澶�'}], - } + formlist: null } UNSAFE_componentWillMount () { @@ -47,8 +43,8 @@ openType: type, resourceType: resourceType, formlist: formlist.map(form => { - if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { - form.options = this.state.dateoptions[type] + if (dateOptions.hasOwnProperty(type) && form.key === 'initval') { + form.options = dateOptions[type] form.type = 'select' } else if (type === 'number' && form.key === 'initval') { form.type = 'number' @@ -81,8 +77,8 @@ formlist: this.state.formlist.map(form => { form.hidden = !_options.includes(form.key) if (form.key === 'initval') { - if (this.state.dateoptions.hasOwnProperty(value)) { - form.options = this.state.dateoptions[value] + if (dateOptions.hasOwnProperty(value)) { + form.options = dateOptions[value] form.type = 'select' form.initVal = '' } else if (value === 'number') { diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index 860f9af..42d37ef 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -18,7 +18,6 @@ fields: [ { origin: true, - id: Utils.getuuid(), uuid: Utils.getuuid(), label: 'label', field: '', @@ -37,7 +36,6 @@ required: 'false' }, { origin: true, - id: Utils.getuuid(), uuid: Utils.getuuid(), label: 'label', field: '', @@ -56,7 +54,6 @@ required: 'false' }, { origin: true, - id: Utils.getuuid(), uuid: Utils.getuuid(), label: 'label', field: '', diff --git a/src/utils/option.js b/src/utils/option.js new file mode 100644 index 0000000..96301ce --- /dev/null +++ b/src/utils/option.js @@ -0,0 +1,131 @@ +import zhCN from '@/locales/zh-CN/share.js' +import enUS from '@/locales/en-US/share.js' + +const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS + +export const dateOptions = { + date: [ + {value: '', text: _dict['date.empty']}, + {value: '0', text: '褰撳ぉ'}, + {value: 1, text: '鍓嶄竴澶�'}, + {value: 3, text: '鍓嶄笁澶�'}, + {value: 7, text: '鍓嶄竷澶�'}, + {value: 30, text: '鍓�30澶�'} + ], + dateweek: [ + {value: '', text: _dict['date.empty']}, + {value: '0', text: '鏈懆'}, + {value: 1, text: '涓婂懆'}, + {value: 3, text: '鍓嶄笁鍛�'}, + {value: 7, text: '鍓嶄竷鍛�'} + ], + datemonth: [ + {value: '', text: _dict['date.empty']}, + {value: '0', text: '鏈湀'}, + {value: 1, text: '涓婃湀'}, + {value: 3, text: '鍓嶄笁鏈�'}, + {value: 7, text: '鍓嶄竷鏈�'} + ], + daterange: [ + {value: '', text: _dict['date.empty']}, + {value: '0', text: '浠婂ぉ'}, + {value: 1, text: '鏄ㄥぉ'}, + {value: 3, text: '鍓嶄笁澶�'}, + {value: 7, text: '鍓嶄竷澶�'}, + {value: 30, text: '鍓�30澶�'} + ], + datetime: [ + {value: '', text: _dict['date.empty']}, + {value: '0', text: '鐜板湪'}, + {value: 1, text: '鏄ㄥぉ'}, + {value: 3, text: '鍓嶄笁澶�'}, + {value: 7, text: '鍓嶄竷澶�'}, + {value: 30, text: '鍓�30澶�'} + ] +} + +export const matchReg = { // 鍖归厤瑙勫垯 + text: [{ + value: 'like', + text: 'like' + }, { + value: 'not like', + text: 'not like' + }, { + value: '=', + text: '=' + }], + select: [{ + value: '=', + text: '=' + }, { + value: 'like', + text: 'like' + }, { + value: 'not like', + text: 'not like' + }], + date: [{ + value: '>=', + text: '>=' + }, { + value: '<=', + text: '<=' + }], + daterange: [{ + value: 'between', + text: 'between' + }] +} + +export const btnIcons = [{ + MenuID: '', + text: 'unset' +}, { + MenuID: 'plus', + text: 'plus' +}, { + MenuID: 'plus-circle', + text: 'plus-circle' +}, { + MenuID: 'edit', + text: 'edit' +}, { + MenuID: 'form', + text: 'form' +}, { + MenuID: 'close', + text: 'close' +}, { + MenuID: 'close-circle', + text: 'close-circle' +}, { + MenuID: 'delete', + text: 'delete' +}] + +export const btnClasses = [{ + MenuID: 'default', + text: '榛樿锛堥粦杈圭櫧搴曪級' +}, { + MenuID: 'primary', + text: '钃濊壊' +}, { + MenuID: 'yellow', + text: '榛勮壊' +}, { + MenuID: 'danger', + text: '绾㈣壊' +}, { + MenuID: 'green', + text: '缁胯壊' +}, { + MenuID: 'dgreen', + text: '娣辩豢鑹�' +}, { + MenuID: 'purple', + text: '绱壊' +}, { + MenuID: 'gray', + text: '鐏拌壊' +}] diff --git a/src/utils/utils.js b/src/utils/utils.js index 1102b7c..d561d04 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -189,37 +189,45 @@ } /** + * @description 鍒濆鍖栨悳绱㈡潯浠� + * @param {Array} searches 鎼滅储鏉′欢 + * @return {String} searches 鏍煎紡鍖栧悗缁撴灉 + */ + static initMainSearch (searches) { + if (!searches || searches.length === 0) return [] + + let newsearches = [] + searches.forEach(search => { + let item = { + key: search.field, + match: search.match, + type: search.type, + value: search.initval + } + if (item.type === 'date') { + item.value = item.value ? moment().subtract(item.value, 'days').format('YYYY-MM-DD') : '' + } else if (item.type === 'datemonth') { + item.value = item.value ? moment().subtract(item.value, 'month').format('YYYY-MM') : '' + } else if (item.type === 'dateweek') { + item.value = item.value ? [moment().subtract(item.value * 7, 'days').startOf('week').format('YYYY-MM-DD'), + moment().subtract(item.value * 7, 'days').endOf('week').format('YYYY-MM-DD')] : '' + } else if (item.type === 'daterange') { + item.value = item.value ? [moment().subtract(item.value, 'days').format('YYYY-MM-DD'), + moment().subtract(item.value === 1 ? 1 : 0, 'days').format('YYYY-MM-DD')] : '' + } + newsearches.push(item) + }) + + return newsearches + } + + /** * @description 鎷兼帴鎼滅储鏉′欢 * @param {Array} searches 鎼滅储鏉′欢 * @return {String} searchText 鎷兼帴缁撴灉 */ - static mainjointsearchkey (searches) { + static joinMainSearchkey (searches) { if (!searches || searches.length === 0) return '' - - if (searches[0].hasOwnProperty('initval')) { - let newsearches = [] - searches.forEach(search => { - let item = { - key: search.field, - match: search.match, - type: search.type, - value: search.initval - } - if (item.type === 'date') { - item.value = item.value ? moment().subtract(item.value, 'days').format('YYYY-MM-DD') : '' - } else if (item.type === 'datemonth') { - item.value = item.value ? moment().subtract(item.value, 'month').format('YYYY-MM') : '' - } else if (item.type === 'dateweek') { - item.value = item.value ? [moment().subtract(item.value * 7, 'days').startOf('week').format('YYYY-MM-DD'), - moment().subtract(item.value * 7, 'days').endOf('week').format('YYYY-MM-DD')] : '' - } else if (item.type === 'daterange') { - item.value = item.value ? [moment().subtract(item.value, 'days').format('YYYY-MM-DD'), - moment().subtract(item.value === 1 ? 1 : 0, 'days').format('YYYY-MM-DD')] : '' - } - newsearches.push(item) - }) - searches = newsearches - } let searchText = '' searches.forEach(item => { @@ -231,15 +239,26 @@ let str = item.match === '=' ? '' : '%' // eslint-disable-next-line searchText += item.key + ' ' + item.match + ' ' + '\'' + str + item.value + str + '\'' - } else if (item.type === 'date' || item.type === 'datemonth') { + } else if (item.type === 'date') { + let timetail = ' 00:00:00.000' + if (item.match === '<' || item.match === '<=') { + timetail = ' 23:59:59.999' + } + // eslint-disable-next-line + searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + timetail + '\')' + } else if (item.type === 'datemonth') { // eslint-disable-next-line searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')' } else if (item.type === 'dateweek') { + let stimetail = ' 00:00:00.000' + let etimetail = ' 23:59:59.999' // eslint-disable-next-line - searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')' + searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')' } else if (item.type === 'daterange') { + let stimetail = ' 00:00:00.000' + let etimetail = ' 23:59:59.999' // eslint-disable-next-line - searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')' + searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')' } else { // eslint-disable-next-line searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')' @@ -363,7 +382,7 @@ /* select top 10 * from sProcExcep order by id desc - declare @UserName nvarchar(50),@FullName nvarchar(50) + declare @UserName nvarchar(50),@FullName nvarchar(50) select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID ${form} -- Gitblit v1.8.0