From bc4ee6130db80f8f2020bb3bb7248b6e55ae90cc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 20 三月 2020 17:47:01 +0800 Subject: [PATCH] 2020-03-20 --- src/templates/zshare/searchform/index.scss | 3 src/tabviews/formtab/actionList/index.jsx | 8 src/templates/zshare/formconfig.js | 13 + src/tabviews/zshare/topSearch/index.jsx | 139 +++++++---- src/tabviews/zshare/normalTable/index.jsx | 5 src/templates/formtabconfig/index.jsx | 157 ++++++------ src/components/sidemenu/editthdmenu/index.jsx | 3 src/templates/comtableconfig/index.jsx | 57 ++++ src/templates/subtableconfig/index.jsx | 55 ++++ src/templates/zshare/dragelement/card.jsx | 14 src/tabviews/zshare/actionList/index.jsx | 81 ++++++ src/tabviews/zshare/topSearch/index.scss | 6 src/tabviews/subtable/index.jsx | 34 ++ src/tabviews/subtabtable/index.jsx | 37 ++ src/tabviews/commontable/index.jsx | 41 ++- src/utils/utils.js | 4 src/templates/zshare/searchform/index.jsx | 6 17 files changed, 475 insertions(+), 188 deletions(-) diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 6dfa7e9..45b631b 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -260,7 +260,8 @@ supMenuList: this.props.supMenuList, roleList: this.state.roleList, fstMenuId: this.state.fstMenuId, - fstMenuList: this.state.fstMenuList + fstMenuList: this.state.fstMenuList, + menuSort: (this.props.menulist.length + 1) * 10 // 鏂板缓鑿滃崟璁剧疆鎺掑簭 } }, () => { document.getElementById('root').style.overflowY = 'hidden' diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 0c235d6..ca5f5ff 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -143,7 +143,7 @@ }) config.columns = config.columns.filter(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return true let _black = col.blacklist.filter(v => { return this.props.permRoles.indexOf(v) !== -1 @@ -235,6 +235,13 @@ } }) + let valid = true // 鎼滅储鏉′欢蹇呭~楠岃瘉 + config.search.forEach(field => { + if (field.required === 'true' && !field.initval) { + valid = false + } + }) + this.setState({ loadingview: false, config: config, @@ -247,10 +254,7 @@ search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { this.improveSearch() - if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 - this.setState({ - loading: true - }) + if (config.setting.onload !== 'false' && valid) { // 鍒濆鍖栧彲鍔犺浇 this.loadmaindata() } this.setShortcut() @@ -389,18 +393,29 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ async loadmaindata () { - const { setting, BIDs } = this.state + const { setting, BIDs, search } = this.state let param = '' + + let requireFields = search.filter(item => item.required && !item.value) + + if (requireFields.length > 0) { + notification.warning({ + top: 92, + message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('銆�') + ' !', + duration: 3 + }) + return + } + + this.setState({ + loading: true + }) if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { param = this.getCustomParam() } else { param = this.getDefaultParam() } - - this.setState({ - pickup: false - }) this.handleTableId('mainTable', '', '') @@ -417,6 +432,7 @@ }), total: result.total, loading: false, + pickup: false, BIDs: { ...BIDs, mainTable: '' @@ -547,7 +563,6 @@ if (setting.onload === 'false') { this.setState({ - loading: true, pageIndex: 1, search: searches, setting: {...setting, onload: 'true'} @@ -558,7 +573,6 @@ this.refs.mainTable.resetTable() this.setState({ - loading: true, pageIndex: 1, search: searches }, () => { @@ -580,7 +594,6 @@ } this.setState({ - loading: true, pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -595,7 +608,6 @@ reloadtable = () => { this.refs.mainTable.resetTable() this.setState({ - loading: true, pageIndex: 1 }, () => { this.loadmaindata() @@ -969,6 +981,7 @@ {loadingview && <Spin size="large" />} {searchlist && searchlist.length > 0 ? <MainSearch + ref="mainSearch" dict={this.state.dict} searchlist={searchlist} refreshdata={this.refreshbysearch} diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index decb054..595e2fa 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -186,15 +186,15 @@ if (this.props.menuType === 'HS') { if (btn.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi + res.rduri = options.cloudServiceApi } else if (btn.sysInterface !== 'true') { - param.rduri = btn.interface + res.rduri = btn.interface } } else { if (btn.sysInterface === 'true') { - param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi } else { - param.rduri = btn.interface + res.rduri = btn.interface } } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 01af628..067cc9e 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -139,7 +139,7 @@ }) config.columns = config.columns.filter(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return true let _black = col.blacklist.filter(v => { return this.props.permRoles.indexOf(v) !== -1 @@ -209,6 +209,13 @@ }) } + let valid = true // 鎼滅储鏉′欢蹇呭~楠岃瘉 + config.search.forEach(field => { + if (field.required === 'true' && !field.initval) { + valid = false + } + }) + this.setState({ loadingview: false, config: config, @@ -222,10 +229,7 @@ }, () => { this.improveSearch() - if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 - this.setState({ - loading: true - }) + if (config.setting.onload !== 'false' && (!Tab.supMenu || BID) && valid) { // 鍒濆鍖栧彲鍔犺浇 this.loadmaindata() } }) @@ -335,9 +339,24 @@ * @description 瀛愯〃鏁版嵁鍔犺浇 */ async loadmaindata (bid, type) { - const { setting } = this.state + const { setting, search } = this.state let param = '' let _BID = this.props.BID + + let requireFields = search.filter(item => item.required && !item.value) + + if (requireFields.length > 0) { + notification.warning({ + top: 92, + message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('銆�') + ' !', + duration: 3 + }) + return + } + + this.setState({ + loading: true + }) if (type === 'refresh') { _BID = bid @@ -495,7 +514,6 @@ this.refs.subTable.resetTable() this.setState({ - loading: true, pageIndex: 1, search: searches }, () => { @@ -516,7 +534,6 @@ } this.setState({ - loading: true, pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -531,7 +548,6 @@ reloadtable = () => { this.refs.subTable.resetTable() this.setState({ - loading: true, pageIndex: 1 }, () => { this.loadmaindata() diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index f63a9ca..6abeba9 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -118,7 +118,7 @@ }) config.columns = config.columns.filter(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0) return true + if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return true let _black = col.blacklist.filter(v => { return this.props.permRoles.indexOf(v) !== -1 @@ -188,6 +188,13 @@ }) } + let valid = true // 鎼滅储鏉′欢蹇呭~楠岃瘉 + config.search.forEach(field => { + if (field.required === 'true' && !field.initval) { + valid = false + } + }) + this.setState({ loadingview: false, config: config, @@ -197,11 +204,13 @@ columns: _columns, logcolumns: _logcolumns, arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - loading: true + search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { this.improveSearch() - this.loadmaindata() + + if (config.setting.onload !== 'false' && valid) { // 鍒濆鍖栧彲鍔犺浇 + this.loadmaindata() + } }) } else { this.setState({ @@ -302,8 +311,23 @@ * @description 瀛愯〃鏁版嵁鍔犺浇 */ async loadmaindata () { - const { setting } = this.state + const { setting, search } = this.state let param = '' + + let requireFields = search.filter(item => item.required && !item.value) + + if (requireFields.length > 0) { + notification.warning({ + top: 92, + message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('銆�') + ' !', + duration: 3 + }) + return + } + + this.setState({ + loading: true + }) if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { param = this.getCustomParam() @@ -444,7 +468,6 @@ this.refs.subTable.resetTable() this.setState({ - loading: true, pageIndex: 1, search: searches }, () => { @@ -465,7 +488,6 @@ } this.setState({ - loading: true, pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -480,7 +502,6 @@ reloadtable = () => { this.refs.subTable.resetTable() this.setState({ - loading: true, pageIndex: 1 }, () => { this.loadmaindata() diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 282ad5d..ed8ab47 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -332,7 +332,7 @@ status: false } } else { - _temps[res.tempId] = _temp.config + _temps[res.tempId] = _temp } } else if (!errorMsg) { errorMsg = res @@ -567,9 +567,11 @@ } getPrintConfigParam = (res) => { - let error = '' - let configParam = '' - let _configparam = '' + let error = '' // 閿欒淇℃伅 + let configParam = '' // 妯℃澘閰嶇疆淇℃伅 + let _configparam = '' // 鎵撳嵃閰嶇疆淇℃伅 + let fields = [] // 妯℃澘涓墍闇�瀛楁 + let nonEFields = [] // 闈炵┖瀛楁 if (!res.ConfigParam) { error = '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�' @@ -583,6 +585,7 @@ if (!configParam) { error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�' } else { + let control = configParam.elements.map(element => { let _field = element.field @@ -640,6 +643,15 @@ item.BarcodeHeight = element.qrcodeWidth item.BarcodeLabel = false } + + if (item.Field) { + fields.push(item.Field) + // 鏉$爜浜岀淮鐮佸瓧娈典笉鍙负绌� + if (item.Type === 'qrcode' || item.Type === 'barcode') { + nonEFields.push(item.Field) + } + } + return item }) @@ -670,25 +682,54 @@ return { error: error, - config: _configparam + config: _configparam, + fields: fields, + nonEFields: nonEFields } } execPrint = (item, list, template) => { let _documents = [] + let _errors = [] Object.keys(template).forEach(key => { let _data = list.filter(cell => cell.TemplateID === key) if (_data.length > 0) { + let _fields = Array.from(new Set(template[key].fields)) + let _nonEFields = Array.from(new Set(template[key].nonEFields)) + let lacks = [] + let emptys = [] + + _data.forEach(d => { + _fields.forEach(f => { + if (!d.hasOwnProperty(f)) { + lacks.push(f) + } else if (_nonEFields.includes(f) && !d[f] && d[f] !== 0) { + emptys.push(f) + } + }) + }) + let _cell = { documentID: Utils.getuuid(), contents: [ { data: _data, - templateURL: JSON.stringify(template[key]) + templateURL: JSON.stringify(template[key].config) } ] + } + + if (lacks.length > 0 || emptys.length > 0) { + lacks = Array.from(new Set(lacks)) + emptys = Array.from(new Set(emptys)) + + _errors.push({ + title: template[key].config.Title, + lacks: lacks, + emptys: emptys + }) } _documents.push(_cell) @@ -715,6 +756,34 @@ }) this.setState({loadingUuid: ''}) return + } else if (_errors.length > 0) { + let lackerror = [] + let emptyerror = [] + _errors.forEach(err => { + if (err.lacks.length > 0) { + lackerror.push(`鏁版嵁涓湭鑾峰彇鍒版ā鏉匡紙${err.title}锛�${err.lacks.join('銆�')} 瀛楁`) + } + if (err.emptys.length > 0) { + emptyerror.push(`鏁版嵁涓ā鏉匡紙${err.title}锛� ${err.emptys.join('銆�')} 瀛楁涓嶅彲涓虹┖`) + } + }) + + let msg = [] + if (lackerror.length > 0) { + msg.push(lackerror.join(' ; ')) + } + + if (emptyerror.length > 0) { + msg.push(emptyerror.join(' ; ')) + } + + notification.warning({ + top: 92, + message: msg.join(' ; ') + ' !', + duration: 10 + }) + this.setState({loadingUuid: ''}) + return } if (!socket || socket.readyState !== 1 || socket.url !== 'ws://' + item.verify.linkUrl) { diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 47e52ca..ca4838c 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -248,9 +248,7 @@ <div className="content-fence"> <div className="content-fence-top"> {images.map((url, index) => { - return (<img key={`${index}`} src={url} alt=""/>) - })} - {images.map((url, index) => { + if (!url) return '' return (<img key={`${index}`} src={url} alt=""/>) })} </div> @@ -266,6 +264,7 @@ <div className="content-fence"> <div className="content-fence-left"> {images.map((url, index) => { + if (!url) return '' return (<img key={`${index}`} src={url} alt=""/>) })} </div> diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 3107b87..8c1adb4 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -15,15 +15,19 @@ state = { match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 - style: null, - searchlist: null, - formId: Utils.getuuid() + style: null, // 鎼滅储鏉′欢绫诲瀷 + label: null, // 鎻愮ず鏂囧瓧 + required: null, // 鏄惁蹇呭~ + searchlist: null, // 鎼滅储椤� + formId: Utils.getuuid() // 鎼滅储琛ㄥ崟Id } UNSAFE_componentWillMount () { let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) let match = {} + let label = {} let style = {} + let required = {} let _list = [] let fieldMap = new Map() @@ -34,7 +38,9 @@ fieldMap.set(item.field, true) match[item.field] = item.match + label[item.field] = item.label style[item.field] = item.type + required[item.field] = item.required === 'true' if (item.type === 'select' || item.type === 'link') { item.oriOptions = JSON.parse(JSON.stringify(item.options)) @@ -63,7 +69,9 @@ this.setState({ match: match, + label: label, style: style, + required: required, searchlist: _list }) } @@ -174,7 +182,15 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.input'] + item.label + '!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> ) @@ -182,7 +198,15 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval })( + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( <Select showSearch onChange={(value) => {this.selectChange(item, value)}} @@ -202,11 +226,18 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: _initval })( + {getFieldDecorator(item.field, { + initialValue: _initval, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( <Select showSearch mode="multiple" - // onChange={(value) => {this.selectChange(item, value)}} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} getPopupContainer={() => document.getElementById(this.state.formId)} > @@ -222,7 +253,15 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'days') : null })( + {getFieldDecorator(item.field, { + initialValue: item.initval ? moment().subtract(item.initval, 'days') : null, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> )} </Form.Item> @@ -232,7 +271,15 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'month') : null })( + {getFieldDecorator(item.field, { + initialValue: item.initval ? moment().subtract(item.initval, 'month') : null, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> )} </Form.Item> @@ -242,7 +289,15 @@ fields.push( <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null })( + {getFieldDecorator(item.field, { + initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> )} </Form.Item> @@ -265,7 +320,13 @@ <Form.Item label={item.label}> {getFieldDecorator(item.field, { - initialValue: _defaultValue + initialValue: _defaultValue, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] })( <RangePicker placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} @@ -282,7 +343,7 @@ fields.push( <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> - <Form.Item label={' '} colon={false}> + <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}> <Button type="primary" htmlType="submit"> {this.props.dict['main.search']} </Button> @@ -327,65 +388,39 @@ // 鑾峰彇鎼滅储鏉′欢鍊� let search = [] Object.keys(values).forEach(key => { + let _value = '' if (this.state.style[key] === 'daterange') { - let _value = '' if (values[key].length > 0) { _value = [moment(values[key][0]).format('YYYY-MM-DD'), moment(values[key][1]).format('YYYY-MM-DD')] } - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: _value, - match: this.state.match[key] - }) } else if (this.state.style[key] === 'dateweek') { - let _value = '' if (values[key]) { _value = [moment(values[key]).startOf('week').format('YYYY-MM-DD'), moment(values[key]).endOf('week').format('YYYY-MM-DD')] } - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: _value, - match: this.state.match[key] - }) } else if (this.state.style[key] === 'date') { - let _value = '' if (values[key]) { _value = moment(values[key]).format('YYYY-MM-DD') } - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: _value, - match: this.state.match[key] - }) } else if (this.state.style[key] === 'datemonth') { - let _value = '' if (values[key]) { _value = moment(values[key]).format('YYYY-MM') } - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: _value, - match: this.state.match[key] - }) } else if (this.state.style[key] === 'multiselect') { - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: values[key], - match: this.state.match[key] - }) + _value = values[key] + } else { - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: values[key].replace(/(^\s*|\s*$)/ig, ''), - match: this.state.match[key] - }) + _value = values[key].replace(/(^\s*|\s*$)/ig, '') + } + + search.push({ + type: this.state.style[key], + key: key.replace(/@tail@$/, ''), + value: _value, + label: this.state.label[key], + match: this.state.match[key], + required: this.state.required[key] + }) }) return search } diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index 7a76b0e..556e04d 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -3,7 +3,11 @@ border-bottom: 1px solid #efefef; .ant-form-item { display: flex; - margin-bottom: 10px; + margin-bottom: 0px; + min-height: 60px; + .ant-form-explain { + white-space: nowrap; + } } .ant-form-item-control-wrapper { flex: 1; diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index ae52c66..6058e1a 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -337,6 +337,12 @@ } }) }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) } }) } @@ -348,6 +354,46 @@ this.setState = () => { return } + } + + /** + * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� + */ + reloadTab = () => { + this.setState({ + loading: true, + tabviews: [] + }) + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { + if (res.status) { + this.setState({ + loading: false, + tabviews: res.UserTemp.map(temp => { + return { + uuid: temp.MenuID, + value: temp.MenuID, + text: temp.MenuName, + type: temp.Template, + MenuNo: temp.MenuNo + } + }) + }) + notification.success({ + top: 92, + message: '鍒锋柊鎴愬姛銆�', + duration: 2 + }) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) } /** @@ -1486,6 +1532,10 @@ LongParam: _LongParam, LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) + } + + if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� + param.Sort = menu.menuSort } param.LText = param.LText.join(' union all ') @@ -2712,7 +2762,12 @@ </Collapse> </div> <div className="setting"> - <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ + <Card title={ + <div> + {this.state.dict['header.menu.page.configurable']} + <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} /> + </div> + } bordered={false} extra={ <div> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 42bf32c..cf0047c 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -260,6 +260,12 @@ } }) }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) } }) } @@ -271,6 +277,46 @@ this.setState = () => { return } + } + + /** + * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� + */ + reloadTab = () => { + this.setState({ + loading: true, + tabviews: [] + }) + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { + if (res.status) { + this.setState({ + loading: false, + tabviews: res.UserTemp.map(temp => { + return { + uuid: temp.MenuID, + value: temp.MenuID, + text: temp.MenuName, + type: temp.Template, + MenuNo: temp.MenuNo + } + }) + }) + notification.success({ + top: 92, + message: '鍒锋柊鎴愬姛銆�', + duration: 2 + }) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) } // 椤甸潰杩斿洖 @@ -755,86 +801,40 @@ return } - new Promise(resolve => { - // 寮圭獥锛堣〃鍗曪級绫绘寜閽紝鍏堣幏鍙栨寜閽厤缃俊鎭紝濡傛灉灏氭湭閰嶇疆鎸夐挳鍒欎細鎶ラ敊骞剁粓姝€�� - // 鑾峰彇淇℃伅鍚庣敓鎴愬垹闄ゅ拰鍒涘缓瀛樺偍杩囩▼鐨勮鍙� - if (btn.OpenType === 'pop') { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: btn.uuid - }).then(res => { - let _LongParam = '' - if (res.status && res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + let fields = [] + _config.groups.forEach(group => { + fields = [...fields, ...group.sublist] + }) - if (_LongParam) { - let fields = [] - if (_LongParam.groups.length > 0) { - _LongParam.groups.forEach(group => { - fields = [...fields, ...group.sublist] - }) - } else { - fields = _LongParam.fields - } + let _param = { + funcName: btn.innerFunc, + name: _config.setting.tableName || '', + fields: fields, + menuNo: menu.MenuNo + } - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: fields, - menuNo: menu.MenuNo - } - newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) - } else { - notification.warning({ - top: 92, - message: '寮圭獥锛堣〃鍗曪級鎸夐挳锛岃鍏堥厤缃〃鍗曚俊鎭紒', - duration: 10 - }) - resolve(false) - } - }) - } else { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: '', - menuNo: menu.MenuNo + newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config)) + DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) + + this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { + if (result !== 'success') return + + let isupdate = false + _config.action = _config.action.map(item => { + if (item.uuid === btn.uuid) { + isupdate = true + return btn + } else { + return item } - newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) + }) + + if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 + _config.action.push(btn) } - }).then(res => { - if (!res) return - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { - if (result !== 'success') return - - let isupdate = false - _config.action = _config.action.map(item => { - if (item.uuid === btn.uuid) { - isupdate = true - return btn - } else { - return item - } - }) - - if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 - _config.action.push(btn) - } - - this.setState({ - config: _config - }) + this.setState({ + config: _config }) }) }) @@ -1965,7 +1965,12 @@ </Collapse> </div> <div className="setting"> - <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ + <Card title={ + <div> + {this.state.dict['header.menu.page.configurable']} + <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} /> + </div> + } bordered={false} extra={ <div> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 591fc75..dc7a230 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -284,6 +284,52 @@ } }) }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } + + /** + * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� + */ + reloadTab = () => { + this.setState({ + loading: true, + tabviews: [] + }) + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { + if (res.status) { + this.setState({ + loading: false, + tabviews: res.UserTemp.map(temp => { + return { + uuid: temp.MenuID, + value: temp.MenuID, + text: temp.MenuName, + type: temp.Template, + MenuNo: temp.MenuNo + } + }) + }) + notification.success({ + top: 92, + message: '鍒锋柊鎴愬姛銆�', + duration: 2 + }) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) } }) } @@ -1063,7 +1109,7 @@ // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type delete _config.isAdd - + try { _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) } catch (e) { @@ -2093,7 +2139,12 @@ </Collapse> </div> <div className="setting"> - <Card title={'鏍囩锛堝瓙琛級椤甸潰閰嶇疆'} bordered={false} extra={ + <Card title={ + <div> + 鏍囩锛堝瓙琛級椤甸潰閰嶇疆 + <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} /> + </div> + } bordered={false} extra={ <div> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> diff --git a/src/templates/zshare/dragelement/card.jsx b/src/templates/zshare/dragelement/card.jsx index 9217dc6..9037fc1 100644 --- a/src/templates/zshare/dragelement/card.jsx +++ b/src/templates/zshare/dragelement/card.jsx @@ -92,30 +92,30 @@ {type === 'search' ? <div className="ant-row ant-form-item"> <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> - <label title={card.label}>{card.label}</label> + <label className={card.required === 'true' ? 'ant-form-item-required' : ''} title={card.label}>{card.label}</label> </div> <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} /> : null + <Input style={{marginTop: '4px'}} value={card.initval} /> : null } {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? - <Select defaultValue={_defaultValue}></Select> : null + <Select value={_defaultValue}></Select> : null } {card.type === 'date' ? - <DatePicker defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null + <DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null } {card.type === 'dateweek' ? - <WeekPicker defaultValue={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null + <WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null } {card.type === 'datemonth' ? - <MonthPicker defaultValue={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null + <MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null } {card.type === 'daterange' ? <RangePicker className="data-range" placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} renderExtraFooter={() => 'extra footer'} - defaultValue={_defaultValue} + value={_defaultValue} /> : null } <div className="input-mask"></div> diff --git a/src/templates/zshare/formconfig.js b/src/templates/zshare/formconfig.js index af50705..3aff390 100644 --- a/src/templates/zshare/formconfig.js +++ b/src/templates/zshare/formconfig.js @@ -205,6 +205,19 @@ }] }, { + type: 'radio', + key: 'required', + label: Formdict['header.form.field.required'], + initVal: card.required || 'false', + options: [{ + value: 'true', + text: Formdict['header.form.true'] + }, { + value: 'false', + text: Formdict['header.form.false'] + }] + }, + { type: 'number', key: 'ratio', min: 1, diff --git a/src/templates/zshare/searchform/index.jsx b/src/templates/zshare/searchform/index.jsx index 9cccb1f..54023da 100644 --- a/src/templates/zshare/searchform/index.jsx +++ b/src/templates/zshare/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', 'blacklist'] // 榛樿鏄剧ず椤� + let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required'] // 榛樿鏄剧ず椤� 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', 'blacklist'] + let _options = ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required'] 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', 'blacklist'] + let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display', 'ratio', 'blacklist', 'required'] if (value === '0') { _options = [..._options, 'options', 'quick'] diff --git a/src/templates/zshare/searchform/index.scss b/src/templates/zshare/searchform/index.scss index 64b8351..b027f37 100644 --- a/src/templates/zshare/searchform/index.scss +++ b/src/templates/zshare/searchform/index.scss @@ -4,6 +4,9 @@ padding-left: 6px!important; padding-bottom: 20px; } + // .ant-form-item { + // margin-bottom: 10px; + // } .ant-form-item.text-area { margin-bottom: 0px; .ant-form-item-control-wrapper { diff --git a/src/utils/utils.js b/src/utils/utils.js index cbc715d..a3abb26 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -194,7 +194,9 @@ key: search.field, match: search.match, type: search.type, - value: search.initval + label: search.label, + value: search.initval, + required: search.required === 'true' } if (item.type === 'date') { item.value = item.value ? moment().subtract(item.value, 'days').format('YYYY-MM-DD') : '' -- Gitblit v1.8.0