From 1b913a7b9ceace4909594225a201efe9fbae93d3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 三月 2022 23:07:19 +0800 Subject: [PATCH] 2022-03-09 --- src/pc/components/navbar/normal-navbar/index.jsx | 1 src/tabviews/zshare/topSearch/index.jsx | 28 ++ src/utils/utils-custom.js | 55 ++++ src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx | 20 + src/mob/modalconfig/source.jsx | 2 public/options.json | 14 src/menu/components/share/searchcomponent/dragsearch/card.jsx | 73 ++++-- src/locales/zh-CN/model.js | 1 src/locales/en-US/model.js | 1 src/views/mobdesign/index.jsx | 3 src/utils/utils.js | 139 ++++++++++-- src/assets/css/main.scss | 35 ++ src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx | 22 + src/mob/components/menubar/normal-menubar/menucomponent/index.jsx | 1 src/menu/components/card/cardcellcomponent/index.jsx | 38 +-- src/mob/components/navbar/normal-navbar/menus/drags/card.jsx | 1 src/views/pcdesign/index.jsx | 3 src/templates/zshare/formconfig.jsx | 24 ++ src/mob/searchconfig/searchdragelement/card.jsx | 10 src/menu/components/search/main-search/dragsearch/card.jsx | 20 + src/mob/components/menubar/normal-menubar/menucomponent/options.jsx | 17 + src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx | 22 + src/pc/createview/index.jsx | 6 src/menu/components/share/actioncomponent/index.jsx | 2 /dev/null | 17 - src/tabviews/zshare/mutilform/index.jsx | 1 src/menu/components/card/cardcellcomponent/formconfig.jsx | 9 src/mob/components/topbar/normal-navbar/index.jsx | 13 - src/templates/modalconfig/source.jsx | 2 src/tabviews/zshare/topSearch/mkDatePicker/index.jsx | 23 + src/pc/createview/settingform/index.jsx | 26 ++ src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 4 32 files changed, 470 insertions(+), 163 deletions(-) diff --git a/public/options.json b/public/options.json index 792a858..f317ad5 100644 --- a/public/options.json +++ b/public/options.json @@ -1,17 +1,17 @@ { - "appId": "202108312122504607B107A83F55B40C98CCF", - "appkey": "20210831212235413F287EC3BF489424496C8", + "appId": "201912040924165801464FF1788654BC5AC73", + "appkey": "20191106103859640976D6E924E464D029CF0", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", "externalDatabase": "false", "lineColor": "", "filter": "false", - "defaultApp": "mkindustry", + "defaultApp": "mk", "defaultLang": "zh-CN", "WXAppID": "", "debugger": false, - "licenseKey": "7EFE13KIKLILIJB64C12", - "probation": "2021-12-31", - "host": "http://demo.mk9h.cn", - "service": "erp_new/" + "licenseKey": "", + "probation": "", + "host": "http://qingqiumarket.cn", + "service": "MKWMS/" } \ No newline at end of file diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index a137096..85ccbe3 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -123,15 +123,18 @@ } // 閲嶇疆鏃堕棿鎻掍欢鏃堕棿婊氬姩鏉� -.ant-calendar-time-picker-select:hover::-webkit-scrollbar { +.ant-calendar-time-picker-select { + overflow-y: auto; +} +.ant-calendar-time-picker-select::-webkit-scrollbar { width: 7px; } -.ant-calendar-time-picker-select:hover::-webkit-scrollbar-thumb { +.ant-calendar-time-picker-select::-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-calendar-time-picker-select:hover::-webkit-scrollbar-track { +.ant-calendar-time-picker-select::-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); @@ -163,7 +166,7 @@ width: 100%; display: inline-block; .ant-calendar-picker { - width: 100%; + width: 100%!important; } } .ant-calendar-picker-container { @@ -443,4 +446,26 @@ // } // .ant-table.ant-table-mini .ant-table-tbody > tr > td { // padding: 4px 4px; -// } \ No newline at end of file +// } +.mk-date-picker.minute { + .ant-calendar-time-picker-combobox { + .ant-calendar-time-picker-select { + width: 50%; + } + + >.ant-calendar-time-picker-select:last-child { + display: none; + } + } +} +.mk-date-picker.hour { + .ant-calendar-time-picker-combobox { + .ant-calendar-time-picker-select { + width: 100%; + } + + >.ant-calendar-time-picker-select:not(:first-child) { + display: none; + } + } +} \ No newline at end of file diff --git a/src/components/mutilform/index.jsx b/src/components/mutilform/index.jsx deleted file mode 100644 index 11ff99a..0000000 --- a/src/components/mutilform/index.jsx +++ /dev/null @@ -1,211 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber, Select, DatePicker } from 'antd' -import moment from 'moment' -import './index.scss' - -const dateFormat = 'YYYY-MM-DD' -const timeFormat = 'YYYY-MM-DD HH:mm:ss' - -class MainSearch extends Component { - static propTpyes = { - formlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object, // 瀛楀吀椤� - data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - cols: PropTypes.number - } - - state = { - formats: null, // 浜嬩欢鏍¢獙瑙勫垯 - datatype: null - } - - UNSAFE_componentWillMount () { - let formats = {} - let datatype = {} - this.props.formlist.forEach(item => { - if (item.InputType === 'date') { - formats[item.FieldName] = dateFormat - } else if (item.InputType === 'datetime') { - formats[item.FieldName] = timeFormat - } - datatype[item.FieldName] = item.InputType - }) - this.setState({ - formats: formats, - datatype: datatype - }) - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - this.props.formlist.forEach((item, index) => { - if (item.Hide !== 'false') return // input闅愯棌 - - let validate = item.Validate ? JSON.parse(item.Validate) : {} // 妫�楠屾槸鍚﹀繀濉� - let _required = validate.required || false - if (item.InputType === 'text') { // 鏂囨湰 - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.Label}> - {getFieldDecorator(item.FieldName, { - initialValue: this.props.data ? this.props.data[item.FieldName] : item.InitVal, - rules: [ - { - required: _required, - message: this.props.dict['form.required.input'] + item.Label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} - </Form.Item> - </Col> - ) - } else if (item.InputType === 'spinner') { // 鏁板瓧 - validate.min = (validate.min || validate.min === 0) ? validate.min : -Infinity - validate.max = (validate.max || validate.max === 0) ? validate.max : Infinity - validate.precision = (validate.precision || validate.precision === 0) ? validate.precision : '' - let _initval = (this.props.data ? this.props.data[item.FieldName] : item.InitVal) || 0 - let model = <InputNumber initialValue={_initval} disabled={item.readonly} min={validate.min} max={validate.max} /> - - if (validate.precision === +validate.precision) { // 鏁版嵁绮惧害 - model = <InputNumber initialValue={_initval} disabled={item.readonly} min={validate.min} max={validate.max} precision={validate.precision} /> - } - - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.Label}> - {getFieldDecorator(item.FieldName, { - initialValue: _initval, - rules: [ - { - required: _required, - message: this.props.dict['form.required.input'] + item.Label + '!' - } - ] - })(model)} - </Form.Item> - </Col> - ) - } else if (item.InputType === 'select') { // 涓嬫媺鎼滅储 - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.Label}> - {getFieldDecorator(item.FieldName, { - initialValue: this.props.data ? this.props.data[item.FieldName] : item.InitVal, - rules: [ - { - required: _required, - message: this.props.dict['form.required.select'] + item.Label + '!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - getPopupContainer={() => document.getElementById('form-box')} - > - {item.DynOptions.map(option => - <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.InputType === 'date') { // 鏃堕棿鎼滅储 - let _initval = this.props.data ? this.props.data[item.FieldName] : item.InitVal - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.Label}> - {getFieldDecorator(item.FieldName, { - initialValue: _initval ? moment(_initval, dateFormat) : null, - rules: [ - { - required: _required, - message: this.props.dict['form.required.select'] + item.Label + '!' - } - ] - })( - <DatePicker getCalendarContainer={() => document.getElementById('form-box')} format={dateFormat} /> - )} - </Form.Item> - </Col> - ) - } else if (item.InputType === 'datetime') { - let _initval = this.props.data ? this.props.data[item.FieldName] : item.InitVal - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.Label}> - {getFieldDecorator(item.FieldName, { - initialValue: _initval ? moment(_initval, timeFormat) : null, - rules: [ - { - required: _required, - message: this.props.dict['form.required.select'] + item.Label + '!' - } - ] - })( - <DatePicker showTime format={timeFormat} /> - )} - </Form.Item> - </Col> - ) - } - }) - - return fields - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let formdata = {} - Object.keys(values).forEach(key => { - if (values[key] && typeof(values[key]) === 'object') { - formdata[key] = moment(values[key]).format(this.state.formats[key]) - } else if (values[key] || values[key] === 0) { - if (this.state.datatype[key] === 'spinner') { - formdata[key] = parseFloat(values[key]) - } else { - formdata[key] = values[key].replace(/\t|\v|\n|\r/g,'') - } - } else { - formdata[key] = '' - } - }) - resolve(formdata) - } else { - reject(err) - } - }) - }) - } - - handleReset = () => { - // 閲嶇疆 - this.props.form.resetFields() - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - return ( - <Form {...formItemLayout} className="ant-advanced-search-form" id="form-box"> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/components/mutilform/index.scss b/src/components/mutilform/index.scss deleted file mode 100644 index 9914d8e..0000000 --- a/src/components/mutilform/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.ant-advanced-search-form.main-search { - padding: 0px 24px 20px; - border-bottom: 1px solid #d9d9d9; - .ant-form-item { - display: flex; - margin-bottom: 10px; - } - .ant-form-item-control-wrapper { - flex: 1; - } - .ant-form-item-label { - width: 100px; - } -} -.ant-advanced-search-form { - position: relative; -} diff --git a/src/components/simpleform/index.jsx b/src/components/simpleform/index.jsx deleted file mode 100644 index f5f752d..0000000 --- a/src/components/simpleform/index.jsx +++ /dev/null @@ -1,198 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber, Select, DatePicker } from 'antd' -import moment from 'moment' -import './index.scss' - -const dateFormat = 'YYYY-MM-DD' -const timeFormat = 'YYYY-MM-DD HH:mm:ss' - -class MainSearch extends Component { - static propTpyes = { - formlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object, // 瀛楀吀椤� - cols: PropTypes.number - } - - state = { - formats: null, // 浜嬩欢鏍¢獙瑙勫垯 - datatype: null - } - - UNSAFE_componentWillMount () { - let formats = {} - let datatype = {} - this.props.formlist.forEach(item => { - if (item.InputType === 'date') { - formats[item.FieldName] = dateFormat - } else if (item.InputType === 'datetime') { - formats[item.FieldName] = timeFormat - } - datatype[item.FieldName] = item.InputType - }) - this.setState({ - formats: formats, - datatype: datatype - }) - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - this.props.formlist.forEach((item, index) => { - if (item.type === 'text') { - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'spinner') { // 鏁板瓧 - let min = item.hasOwnProperty('validate') && item.validate.hasOwnProperty('min') ? item.validate.min : -Infinity - let max = item.hasOwnProperty('validate') && item.validate.hasOwnProperty('max') ? item.validate.max : Infinity - let model = <InputNumber initialValue={item.initVal || 0} disabled={item.readonly} min={min} max={max} /> - - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || 0, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(model)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - getPopupContainer={() => document.getElementById('form-box')} - > - {item.options.map(option => - <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'date') { // 鏃堕棿鎼滅储 - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal ? moment(item.initVal, dateFormat) : null, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <DatePicker getCalendarContainer={() => document.getElementById('form-box')} format={dateFormat} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'datetime') { - fields.push( - <Col span={24 / this.props.cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal ? moment(item.initVal, timeFormat) : null, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <DatePicker showTime format={timeFormat} /> - )} - </Form.Item> - </Col> - ) - } - }) - - return fields - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let formdata = {} - Object.keys(values).forEach(key => { - if (values[key] && typeof(values[key]) === 'object') { - formdata[key] = moment(values[key]).format(this.state.formats[key]) - } else if (values[key] || values[key] === 0) { - if (this.state.datatype[key] === 'spinner') { - formdata[key] = parseFloat(values[key]) - } else { - formdata[key] = values[key].replace(/\t|\v|\n|\r/g,'') - } - } else { - formdata[key] = '' - } - }) - resolve(formdata) - } else { - reject(err) - } - }) - }) - } - - handleReset = () => { - // 閲嶇疆 - this.props.form.resetFields() - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - return ( - <Form {...formItemLayout} className="ant-advanced-search-form" id="form-box"> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/components/simpleform/index.scss b/src/components/simpleform/index.scss deleted file mode 100644 index 9914d8e..0000000 --- a/src/components/simpleform/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.ant-advanced-search-form.main-search { - padding: 0px 24px 20px; - border-bottom: 1px solid #d9d9d9; - .ant-form-item { - display: flex; - margin-bottom: 10px; - } - .ant-form-item-control-wrapper { - flex: 1; - } - .ant-form-item-label { - width: 100px; - } -} -.ant-advanced-search-form { - position: relative; -} diff --git a/src/locales/en-US/model.js b/src/locales/en-US/model.js index 4421fbf..12c2d81 100644 --- a/src/locales/en-US/model.js +++ b/src/locales/en-US/model.js @@ -100,7 +100,6 @@ 'model.form.link': 'Linkage menu', 'model.form.linkform': 'Linkage form', 'model.form.dateday': 'Date(Day)', - 'model.form.datetime': 'Date(Second)', 'model.form.dateweek': 'Date(Week)', 'model.form.datemonth': 'Date(Month)', 'model.form.daterange': 'Date(Range)', diff --git a/src/locales/zh-CN/model.js b/src/locales/zh-CN/model.js index 0cc3079..59648cb 100644 --- a/src/locales/zh-CN/model.js +++ b/src/locales/zh-CN/model.js @@ -100,7 +100,6 @@ 'model.form.link': '鑱斿姩鑿滃崟', 'model.form.linkform': '鍏宠仈琛ㄥ崟', 'model.form.dateday': '鏃ユ湡锛堝ぉ锛�', - 'model.form.datetime': '鏃ユ湡锛堝垎/绉掞級', 'model.form.dateweek': '鏃ユ湡锛堝懆锛�', 'model.form.datemonth': '鏃ユ湡锛堟湀锛�', 'model.form.daterange': '鏃ユ湡锛堝尯闂达級', diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 2d675a2..498c1c4 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -465,15 +465,6 @@ // { value: 'self', text: '褰撳墠椤甸潰' } // ] // }, - // { - // type: 'select', - // key: 'copyMenuId', - // label: '澶嶅埗鑿滃崟', - // initVal: card.copyMenuId || '', - // required: false, - // forbid: !isApp, - // options: appMenus - // }, { type: 'select', key: 'linkurl', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index f388d44..dbe882a 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -525,33 +525,23 @@ if ((sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') === 'true')) return - if (btn.eleType === 'button') { - if (btn.OpenType === 'pop' || btn.execMode === 'pop') { - if (!btn.modal) { - btn.modal = { - setting: { title: btn.label, width: appType === 'mob' ? 100 : 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' }, - tables: [], - groups: [], - fields: [] - } + if (btn.OpenType === 'pop' || btn.execMode === 'pop') { + if (!btn.modal) { + btn.modal = { + setting: { title: btn.label, width: appType === 'mob' ? 100 : 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' }, + tables: [], + groups: [], + fields: [] } - - MKEmitter.emit('changeModal', cards, btn) - } else if (btn.OpenType === 'popview') { - MKEmitter.emit('changePopview', cards, btn) - } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'page') { - MKEmitter.emit('changeEditMenu', {MenuID: btn.uuid, copyMenuId: btn.copyMenuId}) - } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'linkpage') { - MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu}) - } else { - this.handleElement(item) } + + MKEmitter.emit('changeModal', cards, btn) + } else if (btn.OpenType === 'popview') { + MKEmitter.emit('changePopview', cards, btn) + } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'linkpage') { + MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu}) } else { - if (btn.link === 'page') { - MKEmitter.emit('changeEditMenu', {MenuID: btn.uuid, copyMenuId: btn.copyMenuId}) - } else if (btn.link === 'linkpage') { - MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu}) - } + this.handleElement(item) } } diff --git a/src/menu/components/search/main-search/dragsearch/card.jsx b/src/menu/components/search/main-search/dragsearch/card.jsx index 3ab0c51..1508196 100644 --- a/src/menu/components/search/main-search/dragsearch/card.jsx +++ b/src/menu/components/search/main-search/dragsearch/card.jsx @@ -69,13 +69,31 @@ } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { formItem = (<Select value={_defaultValue}></Select>) } else if (card.type === 'date') { - formItem = (<Input style={{marginTop: '4px'}} placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} />) + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + formItem = (<DatePicker format={format} value={card.initval ? moment().subtract(card.initval, 'days') : null} />) } else if (card.type === 'dateweek') { formItem = (<WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} />) } else if (card.type === 'datemonth') { formItem = (<MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} />) } else if (card.type === 'daterange') { + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + formItem = (<RangePicker + format={format} className="data-range" placeholder={['BeginTime', 'EndTime']} renderExtraFooter={() => 'extra footer'} diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 1504bbf..6f5275c 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -410,8 +410,6 @@ if (element.OpenType === 'pop' || element.OpenType === 'popview' || element.execMode === 'pop') { this.props.setSubConfig(element) - } else if (element.OpenType === 'innerpage' && element.pageTemplate === 'page') { - MKEmitter.emit('changeEditMenu', {MenuID: element.uuid, copyMenuId: element.copyMenuId}) } else if (element.OpenType === 'innerpage' && element.pageTemplate === 'linkpage') { MKEmitter.emit('changeEditMenu', {MenuID: element.linkmenu}) } else { diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 19b27ed..650c5b6 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -58,6 +58,51 @@ } } + let formItem = null + if (card.type === 'text') { + if (card.inputType !== 'search') { + formItem = <Input placeholder={card.label} value={card.initval} /> + } else { + formItem = <Search placeholder={card.label} value={card.initval} enterButton/> + } + + } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { + formItem = <Select placeholder={card.label} value={_defaultValue}></Select> + } else if (card.type === 'date') { + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + formItem = <DatePicker format={format} placeholder={card.label} value={card.initval ? moment().subtract(card.initval, 'days') : null} /> + } else if (card.type === 'dateweek') { + formItem = <WeekPicker placeholder={card.label} value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> + } else if (card.type === 'datemonth') { + formItem = <MonthPicker placeholder={card.label} value={card.initval ? moment().subtract(card.initval, 'month') : null} /> + } else if (card.type === 'daterange') { + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + + formItem = <RangePicker + format={format} + className="data-range" + placeholder={['BeginTime', 'EndTime']} + renderExtraFooter={() => 'extra footer'} + value={_defaultValue} + /> + } else if (card.type === 'group') { + formItem = <DateGroup card={card} /> + } + return ( <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -74,33 +119,7 @@ label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} > - {card.type === 'text' && card.inputType !== 'search' ? - <Input placeholder={card.label} value={card.initval} /> : null - } - {card.type === 'text' && card.inputType === 'search' ? - <Search placeholder={card.label} value={card.initval} enterButton/> : null - } - {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? - <Select placeholder={card.label} value={_defaultValue}></Select> : null - } - {card.type === 'date' ? - <DatePicker placeholder={card.label} value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null - } - {card.type === 'dateweek' ? - <WeekPicker placeholder={card.label} value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null - } - {card.type === 'datemonth' ? - <MonthPicker placeholder={card.label} value={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null - } - {card.type === 'daterange' ? - <RangePicker - className="data-range" - placeholder={['BeginTime', 'EndTime']} - renderExtraFooter={() => 'extra footer'} - value={_defaultValue} - /> : null - } - {card.type === 'group' ? <DateGroup card={card} /> : null } + {formItem} </Form.Item> </div> </div> diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx index 2fe6362..45740d0 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx @@ -110,6 +110,7 @@ MKEmitter.emit('changeEditMenu', { MenuID: card.setting.type === 'linkmenu' ? card.setting.linkMenuId : card.uuid, copyMenuId: card.setting.type === 'menu' ? card.setting.copyMenuId : '', + clearMenu: card.setting.clearMenu || 'true', MenuNo: card.setting.MenuNo || '', MenuName: card.setting.name, }) diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx index fd5ce24..b3d567f 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx @@ -64,7 +64,22 @@ initval: setting.copyMenuId || '', tooltip: '澶嶅埗鑿滃崟浠呭湪褰撳墠鑿滃崟鍒涘缓鏃舵湁鏁堛��', required: false, - options: menulist + options: menulist, + controlFields: [ + {field: 'clearMenu', notNull: true}, + ], + }, + { + type: 'radio', + field: 'clearMenu', + label: '娓呯┖鍏宠仈鑿滃崟', + initval: setting.clearMenu || 'true', + tooltip: '澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��', + required: false, + options: [ + {value: 'true', label: '鏄�'}, + {value: 'false', label: '鍚�'} + ] }, { type: 'select', diff --git a/src/mob/components/navbar/normal-navbar/menus/drags/card.jsx b/src/mob/components/navbar/normal-navbar/menus/drags/card.jsx index 11e395f..fe9dd41 100644 --- a/src/mob/components/navbar/normal-navbar/menus/drags/card.jsx +++ b/src/mob/components/navbar/normal-navbar/menus/drags/card.jsx @@ -36,6 +36,7 @@ MKEmitter.emit('changeEditMenu', { MenuID: card.property === 'linkmenu' ? card.linkMenuId : card.MenuID, copyMenuId: card.property === 'menu' ? card.copyMenuId : '', + clearMenu: card.clearMenu || 'true', MenuNo: card.MenuNo, MenuName: card.name }) diff --git a/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx b/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx index 441de0a..70e6d2f 100644 --- a/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx +++ b/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx @@ -18,6 +18,7 @@ state = { property: this.props.menu.property || 'menu', + copyMenu: this.props.menu.copyMenuId || '', appMenus: [], } @@ -75,7 +76,7 @@ render() { const { menu, cols } = this.props const { getFieldDecorator } = this.props.form - const { property, appMenus } = this.state + const { property, appMenus, copyMenu } = this.state const formItemLayout = { labelCol: { @@ -210,12 +211,29 @@ {getFieldDecorator('copyMenuId', { initialValue: menu.copyMenuId || '' })( - <Select> + <Select allowClear onChange={(val) => this.setState({copyMenu: val})}> {appMenus.map(item => (<Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName}</Select.Option>))} </Select> )} </Form.Item> </Col> : null} + {property === 'menu' && copyMenu ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 娓呯┖鍏宠仈鑿滃崟 + </Tooltip> + }> + {getFieldDecorator('clearMenu', { + initialValue: menu.clearMenu || 'true' + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} </Row> </Form> ) diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index 6888fcc..6fcaff3 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -130,19 +130,6 @@ } } - changeMenu = (menu) => { - if (menu.property === 'link') { - window.open(menu.link) - } else { - MKEmitter.emit('changeEditMenu', { - MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, - copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', - MenuNo: menu.MenuNo, - MenuName: menu.name, - }) - } - } - getSearch = (config) => { const { card } = this.state diff --git a/src/mob/modalconfig/source.jsx b/src/mob/modalconfig/source.jsx index 6fafc89..60d8632 100644 --- a/src/mob/modalconfig/source.jsx +++ b/src/mob/modalconfig/source.jsx @@ -72,7 +72,7 @@ }, { type: 'form', - label: CommonDict['model.form.datetime'], + label: '鏃ユ湡锛堝垎/绉掞級', subType: 'datetime', url: '' }, diff --git a/src/mob/searchconfig/searchdragelement/card.jsx b/src/mob/searchconfig/searchdragelement/card.jsx index 20a0b9a..48d90df 100644 --- a/src/mob/searchconfig/searchdragelement/card.jsx +++ b/src/mob/searchconfig/searchdragelement/card.jsx @@ -47,10 +47,18 @@ let formItem = null if (card.type === 'date') { + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } formItem = (<div className="am-list-item"> <div className="am-list-line"> {card.labelShow !== 'false' ? <div className="am-input-label">{card.label}</div> : null} - <div className="am-input-control">{card.initval ? moment().subtract(card.initval, 'days').format('YYYY-MM-DD') : '璇烽�夋嫨'}</div> + <div className="am-input-control">{card.initval ? moment().subtract(card.initval, 'days').format(format) : '璇烽�夋嫨'}</div> <div className="am-list-extra"><RightOutlined /></div> </div> </div>) diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index 558f823..0c8d24e 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -140,6 +140,7 @@ MKEmitter.emit('changeEditMenu', { MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', + clearMenu: menu.clearMenu || 'true', MenuNo: menu.MenuNo, MenuName: menu.name, }) diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx index 39da53f..b57fb2b 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx +++ b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx @@ -15,6 +15,7 @@ state = { property: this.props.menu.property || 'menu', + copyMenu: this.props.menu.copyMenuId || '', appMenus: [], } @@ -72,7 +73,7 @@ render() { const { menu } = this.props const { getFieldDecorator } = this.props.form - const { property, appMenus } = this.state + const { property, appMenus, copyMenu } = this.state const formItemLayout = { labelCol: { @@ -193,12 +194,29 @@ {getFieldDecorator('copyMenuId', { initialValue: menu.copyMenuId || '' })( - <Select allowClear> + <Select allowClear onChange={(val) => this.setState({copyMenu: val})}> {appMenus.map(item => (<Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName}</Select.Option>))} </Select> )} </Form.Item> </Col> : null} + {property === 'menu' && copyMenu ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 娓呯┖鍏宠仈鑿滃崟 + </Tooltip> + }> + {getFieldDecorator('clearMenu', { + initialValue: menu.clearMenu || 'true' + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} </Row> </Form> ) diff --git a/src/pc/createview/index.jsx b/src/pc/createview/index.jsx index bff41f3..4b73505 100644 --- a/src/pc/createview/index.jsx +++ b/src/pc/createview/index.jsx @@ -29,8 +29,6 @@ verifySubmit = () => { this.verifyRef.handleConfirm().then(res => { - - let parMenuId = sessionStorage.getItem('kei_no') + sessionStorage.getItem('typename') + sessionStorage.getItem('lang') let menuId = Utils.getuuid() @@ -163,7 +161,7 @@ } if (_config.components) { - config.components = MenuUtils.resetConfig(_config.components) + config.components = MenuUtils.resetConfig(_config.components, res.clearMenu === 'true') config.tables = _config.tables || [] config.style = _config.style || {} config.statusBarbgColor = _config.statusBarbgColor || '' @@ -208,7 +206,7 @@ <Modal title="鏂板缓椤甸潰" visible={visible} - width={500} + width={600} maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} diff --git a/src/pc/createview/settingform/index.jsx b/src/pc/createview/settingform/index.jsx index a8e54c8..638c2a5 100644 --- a/src/pc/createview/settingform/index.jsx +++ b/src/pc/createview/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Input, Tooltip } from 'antd' +import { Form, Row, Col, Select, Input, Tooltip, Radio } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import './index.scss' @@ -11,7 +11,8 @@ } state = { - appMenus: [] + appMenus: [], + copymenuId: '' } UNSAFE_componentWillMount () { @@ -44,7 +45,7 @@ render() { const { getFieldDecorator } = this.props.form - const { appMenus } = this.state + const { appMenus, copymenuId } = this.state const formItemLayout = { labelCol: { @@ -113,7 +114,7 @@ {getFieldDecorator('copymenuId', { initialValue: '' })( - <Select allowClear showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> + <Select allowClear showSearch onChange={(val) => this.setState({copymenuId: val})} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> {appMenus.map(option => <Select.Option key={option.MenuID} value={option.MenuID}>{option.MenuName}</Select.Option> )} @@ -121,6 +122,23 @@ )} </Form.Item> </Col> + {copymenuId ? <Col span={20}> + <Form.Item label={ + <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 娓呯┖鍏宠仈鑿滃崟 + </Tooltip> + }> + {getFieldDecorator('clearMenu', { + initialValue: 'true' + })( + <Radio.Group> + <Radio value={'true'}>鏄�</Radio> + <Radio value={'false'}>鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} </Row> </Form> ) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index db7d74f..b50c803 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -82,6 +82,7 @@ if (item.field && data && data[item.field]) { item.message = data[item.field] } + delete item.field return true } diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 8f02a8b..316dca4 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -116,7 +116,15 @@ } if (item.advanced && item.initval) { - advanceValues.push({field: item.field, type: item.type, label: item.label, value: item.initval}) + let val = item.initval + if (item.precision === 'hour') { + if (/,/ig.test(val)) { + val = val.split(',').map(m => m + ':00').join(',') + } else { + val = val + ':00' + } + } + advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) } if (item.type === 'group') { @@ -580,7 +588,15 @@ record[item.field] = item.initval } if (item.advanced && item.initval) { - advanceValues.push({field: item.field, type: item.type, label: item.label, value: item.initval}) + let val = item.initval + if (item.precision === 'hour') { + if (/,/ig.test(val)) { + val = val.split(',').map(m => m + ':00').join(',') + } else { + val = val + ':00' + } + } + advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) } return item @@ -667,6 +683,7 @@ label: item.label, match: item.match, required: item.required, + precision: item.precision || '', forbid: item.$forbid }) } @@ -684,6 +701,13 @@ let val = this.record[item.field] if (val || val === 0) { + if (item.precision === 'hour') { + if (/,/ig.test(val)) { + val = val.split(',').map(m => m + ':00').join(',') + } else { + val = val + ':00' + } + } advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) } }) diff --git a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx index 4ebc9b2..859be1a 100644 --- a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx +++ b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx @@ -23,9 +23,19 @@ } else if (config.type === 'week') { mode = 'week' format = 'YYYY-MM-DD' - } else if (config.type === 'daterange') { - mode = 'daterange' - format = 'YYYY-MM-DD' + } else { + if (config.type === 'daterange') { + mode = 'daterange' + } + if (config.precision === 'day') { + format = 'YYYY-MM-DD' + } else if (config.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (config.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (config.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } } let value = config.initval || null @@ -43,6 +53,7 @@ this.state = { value, mode, + precision: config.precision || 'day', format } } @@ -74,16 +85,16 @@ } render() { - const { value, mode } = this.state + const { value, mode, format, precision } = this.state if (mode === 'date') { - return <DatePicker value={value} onChange={this.onChange}/> + return <DatePicker dropdownClassName={'mk-date-picker ' + precision} value={value} showTime={format !== 'YYYY-MM-DD'} format={format} onChange={this.onChange}/> } else if (mode === 'month') { return <MonthPicker value={value} onChange={this.onChange}/> } else if (mode === 'week') { return <WeekPicker value={value} onChange={this.onChange}/> } else if (mode === 'daterange') { - return <RangePicker placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} value={value} onChange={this.onChange}/> + return <RangePicker dropdownClassName={'mk-date-picker ' + precision} placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} showTime={format !== 'YYYY-MM-DD'} format={format} value={value} onChange={this.onChange}/> } } } diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index 0f50944..6588fed 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -136,7 +136,7 @@ }, { type: 'form', - label: CommonDict['model.form.datetime'], + label: '鏃ユ湡锛堝垎/绉掞級', subType: 'datetime', }, { diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx index e8f7af2..75bf193 100644 --- a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx +++ b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx @@ -76,13 +76,31 @@ } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { formItem = (<Select value={_defaultValue}></Select>) } else if (card.type === 'date') { - formItem = (<DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} />) + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + formItem = (<DatePicker format={format} value={card.initval ? moment().subtract(card.initval, 'days') : null} />) } else if (card.type === 'dateweek') { formItem = (<WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} />) } else if (card.type === 'datemonth') { formItem = (<MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} />) } else if (card.type === 'daterange') { + let format = 'YYYY-MM-DD' + if (card.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (card.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (card.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + formItem = (<RangePicker + format={format} className="data-range" placeholder={['BeginTime', 'EndTime']} renderExtraFooter={() => 'extra footer'} diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index a1adcca..c1496f5 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -98,11 +98,11 @@ select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query'], multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query'], - date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], + date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision'], checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'borderColor', 'required', 'Hide', 'labelShow', 'advanced', 'query'], dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], - daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], + daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision'], group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query'], range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query'] } diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index a6f9ec0..65e24c3 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -651,6 +651,25 @@ }, { type: 'radio', + key: 'precision', + label: '绮剧‘搴�', + initVal: card.precision || 'day', + options: [{ + value: 'day', + text: '澶�' + }, { + value: 'hour', + text: '灏忔椂' + }, { + value: 'minute', + text: '鍒嗛挓' + }, { + value: 'second', + text: '绉�' + }] + }, + { + type: 'radio', key: 'required', label: Formdict['model.required'], initVal: card.required || 'false', @@ -746,6 +765,7 @@ key: 'advanced', label: '楂樼骇鎼滅储', initVal: card.advanced || 'false', + tooltip: '鍦ㄩ殣钘忔悳绱㈡寜閽椂锛岄珮绾ф悳绱㈡棤鏁堛��', forbid: appType === 'mob', options: [{ value: 'true', @@ -2270,7 +2290,7 @@ text: Formdict['model.form.datemonth'] }, { value: 'datetime', - text: Formdict['model.form.datetime'] + text: '鏃ユ湡锛堝垎/绉掞級' }, { value: 'textarea', text: Formdict['model.form.textarea'] @@ -2335,7 +2355,7 @@ text: Formdict['model.form.datemonth'] }, { value: 'datetime', - text: Formdict['model.form.datetime'] + text: '鏃ユ湡锛堝垎/绉掞級' }, { value: 'textarea', text: Formdict['model.form.textarea'] diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 9053815..4ad2bfd 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -332,7 +332,7 @@ * @description 閲嶇疆鑿滃崟閰嶇疆锛岄〉闈㈡暣浣撳鍒� * @return {String} components 閰嶇疆淇℃伅 */ - static resetConfig = (components, uuids = {}) => { + static resetConfig = (components, uuids = {}, clear = false) => { return components.map(item => { if (item.type === 'navbar') { return item @@ -352,31 +352,59 @@ cell.parentId = item.uuid return cell }) - tab.components = this.resetConfig(tab.components, uuids) + tab.components = this.resetConfig(tab.components, uuids, clear) }) } else if (item.type === 'group') { item.components = item.components.map(cell => { cell.parentId = item.uuid return cell }) - item.components = this.resetConfig(item.components, uuids) + item.components = this.resetConfig(item.components, uuids, clear) } else if (item.type === 'menubar') { item.subMenus = item.subMenus.map(cell => { cell.uuid = this.getuuid() + if (clear && cell.setting.type === 'linkmenu') { + cell.setting.type = 'menu' + cell.setting.linkMenuId = '' + } return cell }) } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { item.subcards.forEach(card => { card.uuid = this.getuuid() + + if (clear) { + if (card.setting.click === 'menu') { + card.setting.click = '' + card.setting.menu = '' + } else if (card.setting.click === 'menus') { + card.setting.click = '' + card.setting.menuType = '' + delete card.menus + } + } + if (card.elements) { card.elements = card.elements.map(cell => { cell.uuid = this.getuuid() + + if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { + cell.pageTemplate = '' + cell.linkmenu = '' + } + return cell }) } if (card.backElements) { card.backElements = card.backElements.map(cell => { cell.uuid = this.getuuid() + + if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { + cell.pageTemplate = '' + cell.linkmenu = '' + } + return cell }) } @@ -385,6 +413,12 @@ if (item.elements) { item.elements = item.elements.map(cell => { cell.uuid = this.getuuid() + + if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { + cell.pageTemplate = '' + cell.linkmenu = '' + } + return cell }) } @@ -398,11 +432,18 @@ } else if (c.type === 'custom' && c.elements) { c.elements = c.elements.map(cell => { cell.uuid = this.getuuid() + return cell }) } else if (c.type === 'action' && c.elements) { c.elements = c.elements.map(cell => { cell.uuid = this.getuuid() + + if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { + cell.pageTemplate = '' + cell.linkmenu = '' + } + return cell }) } @@ -456,6 +497,11 @@ oriUids[cell.uuid] = _uuid cell.uuid = _uuid + if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { + cell.pageTemplate = '' + cell.linkmenu = '' + } + return cell }) } @@ -476,6 +522,9 @@ return cell }) } + if (clear && item.wrap.menus) { + item.wrap.menus = [] + } } else if (item.search) { item.search = item.search.map(cell => { cell.uuid = this.getuuid() diff --git a/src/utils/utils.js b/src/utils/utils.js index 460b65f..2b99084 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -251,20 +251,43 @@ item.$forbid = item.query === 'false' if (item.type === 'date') { // 鏃堕棿鎼滅储 - item.initval = item.initval ? moment().subtract(item.initval, 'days').format('YYYY-MM-DD') : '' + item.precision = item.precision || 'day' + let format = 'YYYY-MM-DD' + if (item.precision === 'day') { + + } else if (item.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (item.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (item.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } + + item.initval = item.initval ? moment().subtract(item.initval, 'days').format(format) : '' } else if (item.type === 'datemonth') { item.initval = item.initval ? moment().subtract(item.initval, 'month').format('YYYY-MM') : '' } else if (item.type === 'dateweek') { item.initval = item.initval ? moment().subtract(item.initval * 7, 'days').format('YYYY-MM-DD') : '' } else if (item.type === 'daterange') { + item.precision = item.precision || 'day' + let format = 'YYYY-MM-DD' + if (item.precision === 'day') { + + } else if (item.precision === 'hour') { + format = 'YYYY-MM-DD HH' + } else if (item.precision === 'minute') { + format = 'YYYY-MM-DD HH:mm' + } else if (item.precision === 'second') { + format = 'YYYY-MM-DD HH:mm:ss' + } if (item.initval === 'week') { - item.initval = [moment().startOf('week').format('YYYY-MM-DD'), moment().endOf('week').format('YYYY-MM-DD')].join(',') + item.initval = [moment().startOf('week').format(format), moment().endOf('week').format(format)].join(',') } else if (item.initval === 'month') { - item.initval = [moment().startOf('month').format('YYYY-MM-DD'), moment().endOf('month').format('YYYY-MM-DD')].join(',') + item.initval = [moment().startOf('month').format(format), moment().endOf('month').format(format)].join(',') } else if (item.initval) { try { let _initval = JSON.parse(item.initval) - let _vals = [moment().subtract(_initval[0], 'days').format('YYYY-MM-DD'), moment().subtract(_initval[1], 'days').format('YYYY-MM-DD')] + let _vals = [moment().subtract(_initval[0], 'days').format(format), moment().subtract(_initval[1], 'days').format(format)] item.initval = _vals.join(',') } catch (e) { item.initval = '' @@ -358,6 +381,7 @@ label: cell.label, value: cell.initval, required: cell.required, + precision: cell.precision || '', forbid: cell.$forbid } @@ -398,10 +422,18 @@ let _val = item.value || '' if (_val) { - if (item.match === '<' || item.match === '<=') { - _val = moment(_val, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' - } else if (item.match === '>' || item.match === '>=') { - _val = _val + ' 00:00:00.000' + if (item.precision === 'day') { + if (item.match === '<' || item.match === '<=') { + _val = moment(_val, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + } else if (item.match === '>' || item.match === '>=') { + _val = _val + ' 00:00:00.000' + } + } else if (item.precision === 'hour') { + _val = _val + ':00:00.000' + } else if (item.precision === 'minute') { + _val = _val + ':00.000' + } else if (item.precision === 'second') { + _val = _val + '.000' } } @@ -437,8 +469,20 @@ let _endval = '' if (item.value) { let val = item.value.split(',') - _startval = val[0] + ' 00:00:00.000' - _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + + if (item.precision === 'day') { + _startval = val[0] + ' 00:00:00.000' + _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + } else if (item.precision === 'hour') { + _startval = val[0] + ':00:00.000' + _endval = val[1] + ':00:00.000' + } else if (item.precision === 'minute') { + _startval = val[0] + ':00.000' + _endval = val[1] + ':00.000' + } else if (item.precision === 'second') { + _startval = val[0] + '.000' + _endval = val[1] + '.000' + } } newsearches[item.key] = _startval @@ -479,14 +523,25 @@ searchText += `'${item.value}' ${item.match} '%'+${item.key}+'%'` } else if (item.type === 'date') { let _val = item.value - let timetail = ' 00:00:00.000' + let timetail = '' let _match = item.match if (item.match === '<' || item.match === '<=') { // 鏃堕棿涓�<=鏃讹紝鍖归厤鍚庝竴澶╃殑0鐐癸紝鍖归厤鏂瑰紡涓�< _match = '<' - _val = moment(_val, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') - } else if (item.match === '=') { + if (item.precision === 'day') { + _val = moment(_val, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + } + } + if (item.match === '=') { timetail = '' + } else if (item.precision === 'day') { + timetail = ' 00:00:00.000' + } else if (item.precision === 'hour') { + timetail = ':00:00.000' + } else if (item.precision === 'minute') { + timetail = ':00.000' + } else if (item.precision === 'second') { + timetail = '.000' } searchText += '(' + item.key + ' ' + _match + ' \'' + _val + timetail + '\')' @@ -502,8 +557,22 @@ searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')' } else if (item.type === 'daterange') { let val = item.value.split(',') - let _startval = val[0] + ' 00:00:00.000' - let _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + let _startval = '' + let _endval = '' + + if (item.precision === 'day') { + _startval = val[0] + ' 00:00:00.000' + _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + } else if (item.precision === 'hour') { + _startval = val[0] + ':00:00.000' + _endval = val[1] + ':00:00.000' + } else if (item.precision === 'minute') { + _startval = val[0] + ':00.000' + _endval = val[1] + ':00.000' + } else if (item.precision === 'second') { + _startval = val[0] + '.000' + _endval = val[1] + '.000' + } searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')' } else if (item.type === 'range') { @@ -543,10 +612,24 @@ fieldmap.set(item.key, true) if (item.type === 'date') { - if (['>=', '>'].includes(item.match)) { - item.value = item.value ? item.value + ' 00:00:00.000' : '1970-01-01 00:00:00.000' - } else if (['<=', '<'].includes(item.match)) { - item.value = item.value ? moment(item.value, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' : '2050-01-01 00:00:00.000' + if (!item.value) { + if (['>=', '>'].includes(item.match)) { + item.value = '1970-01-01 00:00:00.000' + } else if (['<=', '<'].includes(item.match)) { + item.value = '2050-01-01 00:00:00.000' + } + } else if (search.precision === 'day') { + if (['>=', '>'].includes(item.match)) { + item.value = item.value + ' 00:00:00.000' + } else if (['<=', '<'].includes(item.match)) { + item.value = moment(item.value, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + } + } else if (search.precision === 'hour') { + item.value = item.value + ':00:00.000' + } else if (search.precision === 'minute') { + item.value = item.value + ':00.000' + } else if (search.precision === 'second') { + item.value = item.value + '.000' } options.push(item) @@ -577,11 +660,23 @@ } else if (item.type === 'daterange') { let _startval = '1970-01-01 00:00:00.000' let _endval = '2050-01-01 00:00:00.000' - + if (item.value) { let val = item.value.split(',') - _startval = val[0] + ' 00:00:00.000' - _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + + if (search.precision === 'day') { + _startval = val[0] + ' 00:00:00.000' + _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' + } else if (search.precision === 'hour') { + _startval = val[0] + ':00:00.000' + _endval = val[1] + ':00:00.000' + } else if (search.precision === 'minute') { + _startval = val[0] + ':00.000' + _endval = val[1] + ':00.000' + } else if (search.precision === 'second') { + _startval = val[0] + '.000' + _endval = val[1] + '.000' + } } let copy = JSON.parse(JSON.stringify(item)) diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 5ff6ea4..f630a78 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -264,6 +264,7 @@ let param = { MenuID: menu.MenuID, copyMenuId: menu.copyMenuId || '', + clearMenu: menu.clearMenu !== 'false', type: 'view' } @@ -747,7 +748,7 @@ } } } else { - config.components = MenuUtils.resetConfig(config.components) + config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu) config.enabled = false message.success('澶嶅埗鎴愬姛锛屼繚瀛樺悗鐢熸晥銆�') } diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 5310e0e..2c4121e 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -215,6 +215,7 @@ let param = { MenuID: menu.MenuID, copyMenuId: menu.copyMenuId || '', + clearMenu: menu.clearMenu !== 'false', type: 'view' } @@ -747,7 +748,7 @@ } } } else { - config.components = MenuUtils.resetConfig(config.components) + config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu) config.enabled = false message.success('澶嶅埗鎴愬姛锛屼繚瀛樺悗鐢熸晥銆�') } -- Gitblit v1.8.0