From de516477e7c11d667b3d77f6a37b5df8e893bd29 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 22 二月 2022 09:50:45 +0800 Subject: [PATCH] 2022-02-22 --- src/menu/components/module/voucher/options.jsx | 83 +++++++++++ src/tabviews/custom/components/card/cardcellList/index.jsx | 4 src/tabviews/custom/components/module/voucher/index.jsx | 67 +++++++++ src/views/pcdesign/index.jsx | 1 src/templates/zshare/verifycard/index.jsx | 2 src/assets/mobimg/voucher.jpg | 0 src/menu/components/module/voucher/index.jsx | 164 +++++++++++++++++++++++ src/menu/components/share/actioncomponent/actionform/index.jsx | 6 src/tabviews/custom/components/module/voucher/index.scss | 13 + src/tabviews/custom/index.jsx | 7 + src/menu/components/module/voucher/index.scss | 41 +++++ src/menu/menushell/card.jsx | 3 src/views/mobdesign/index.jsx | 1 src/views/menudesign/index.jsx | 1 src/menu/modulesource/option.jsx | 2 src/templates/zshare/verifycard/index.scss | 1 src/utils/utils.js | 4 17 files changed, 394 insertions(+), 6 deletions(-) diff --git a/src/assets/mobimg/voucher.jpg b/src/assets/mobimg/voucher.jpg new file mode 100644 index 0000000..82a4512 --- /dev/null +++ b/src/assets/mobimg/voucher.jpg Binary files differ diff --git a/src/menu/components/module/voucher/index.jsx b/src/menu/components/module/voucher/index.jsx new file mode 100644 index 0000000..e150d22 --- /dev/null +++ b/src/menu/components/module/voucher/index.jsx @@ -0,0 +1,164 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Popover } from 'antd' +import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' + +// import asyncComponent from '@/utils/asyncComponent' +import asyncIconComponent from '@/utils/asyncIconComponent' +import MKEmitter from '@/utils/events.js' +import getWrapForm from './options' + +import './index.scss' + +const NormalForm = asyncIconComponent(() => import('@/components/normalform')) +// const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) + +class Voucher extends Component { + static propTpyes = { + card: PropTypes.object, + deletecomponent: PropTypes.func, + updateConfig: PropTypes.func, + } + + state = { + card: null, + back: false + } + + UNSAFE_componentWillMount () { + const { card } = this.props + + if (card.isNew) { + let _card = { + uuid: card.uuid, + type: card.type, + tabId: card.tabId || '', + parentId: card.parentId || '', + dataName: card.dataName || '', + format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 + pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� + switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� + width: card.width || 12, + name: '鍑瘉', + subtype: card.subtype, + // setting: { interType: 'system' }, + wrap: { name: '鍑瘉', title: '', width: card.width || 12, type: 'edit' }, + style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, + headerStyle: {}, + columns: [], + scripts: [], + } + + this.setState({ + card: _card + }) + this.props.updateConfig(_card) + } else { + this.setState({ + card: fromJS(card).toJS() + }) + } + } + + componentDidMount () { + MKEmitter.addListener('submitStyle', this.getStyle) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('submitStyle', this.getStyle) + } + + /** + * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 + */ + updateComponent = (component) => { + this.setState({ + card: component + }) + + component.width = component.wrap.width + component.name = component.wrap.name + + this.props.updateConfig(component) + } + + changeStyle = () => { + const { card } = this.state + + MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + } + + getStyle = (comIds, style) => { + const { card } = this.state + + if (comIds[0] !== card.uuid || comIds.length !== 1) return + + let _card = {...card, style} + + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } + + /** + * @description 鏇存柊鎼滅储鏉′欢閰嶇疆淇℃伅 + */ + updateconfig = (config) => { + this.setState({ + card: config + }) + this.props.updateConfig(config) + } + + getWrapForms = () => { + const { card } = this.state + + return getWrapForm(card.wrap, card.uuid) + } + + updateWrap = (res) => { + let _card = {...this.state.card, wrap: res} + _card.switchable = res.type !== 'edit' + + this.updateComponent(_card) + } + + render() { + const { card } = this.state + + return ( + <div className="menu-voucher-box" style={card.style} id={card.uuid}> + {/* <NormalHeader config={card} updateComponent={this.updateComponent}/> */} + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <NormalForm title="鍩烘湰璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}> + <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> + </NormalForm> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> + <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> + </div> + } trigger="hover"> + <ToolOutlined /> + </Popover> + <div className="voucher-box"> + jjj + </div> + </div> + ) + } +} + +export default Voucher \ No newline at end of file diff --git a/src/menu/components/module/voucher/index.scss b/src/menu/components/module/voucher/index.scss new file mode 100644 index 0000000..c5f6e98 --- /dev/null +++ b/src/menu/components/module/voucher/index.scss @@ -0,0 +1,41 @@ +.menu-voucher-box { + position: relative; + box-sizing: border-box; + background: #ffffff; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + min-height: 150px; + overflow-y: auto; + + .anticon-tool { + position: absolute; + z-index: 2; + font-size: 16px; + right: 1px; + top: 1px; + cursor: pointer; + padding: 5px; + background: rgba(255, 255, 255, 0.55); + } + .empty-content { + text-align: center; + font-size: 30px; + margin: 0; + line-height: 90px; + color: #bcbcbc; + } +} +.menu-voucher-box::after { + display: block; + content: ' '; + clear: both; +} +.menu-voucher-box:hover { + z-index: 1; + box-shadow: 0px 0px 4px #1890ff; +} +.menu-voucher-box::-webkit-scrollbar { + display: none; +} + diff --git a/src/menu/components/module/voucher/options.jsx b/src/menu/components/module/voucher/options.jsx new file mode 100644 index 0000000..df667c8 --- /dev/null +++ b/src/menu/components/module/voucher/options.jsx @@ -0,0 +1,83 @@ +import { fromJS } from 'immutable' +import MenuUtils from '@/utils/utils-custom.js' + +/** + * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 + */ +export default function (wrap, id) { + let roleList = sessionStorage.getItem('sysRoles') + let appType = sessionStorage.getItem('appType') + + let menu = fromJS(window.GLOB.customMenu).toJS() + let modules = MenuUtils.getSupModules(menu.components, id) || [] + + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch (e) { + roleList = [] + } + } else { + roleList = [] + } + + const wrapForm = [ + // { + // type: 'text', + // field: 'title', + // label: '鏍囬', + // initval: wrap.title || '', + // required: false + // }, + { + type: 'radio', + field: 'type', + label: '绫诲瀷', + initval: wrap.type || 'edit', + required: true, + options: [ + {value: 'edit', label: '缂栬緫'}, + {value: 'check', label: '鏌ョ湅'}, + ] + }, + { + type: 'text', + field: 'name', + label: '缁勪欢鍚嶇О', + initval: wrap.name || '', + tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', + required: true + }, + { + type: 'number', + field: 'width', + label: '瀹藉害', + initval: wrap.width || 24, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + min: 1, + max: 24, + precision: 0, + required: true + }, + { + type: 'cascader', + field: 'supModule', + label: '涓婄骇缁勪欢', + initval: wrap.supModule || [], + required: false, + options: modules, + allowClear: true, + }, + { + type: 'multiselect', + field: 'blacklist', + label: '榛戝悕鍗�', + initval: wrap.blacklist || [], + required: false, + options: roleList, + forbid: !!appType + }, + ] + + return wrapForm +} \ No newline at end of file diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 88eeb84..3d0d78e 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -296,7 +296,11 @@ if (this.record.pageTemplate === 'custom') { shows.push('url', 'joint') } else if (this.record.pageTemplate === 'linkpage') { - shows.push('linkmenu', 'joint') + shows.push('linkmenu') + + if (Ot === 'requiredSgl') { + shows.push('joint') + } reRequired.linkmenu = true reTooltip.linkmenu = '' diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index df3650e..2331154 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -26,6 +26,7 @@ const CodeSandbox = asyncComponent(() => import('@/menu/components/code/sandbox')) const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) +const Voucher = asyncComponent(() => import('@/menu/components/module/voucher')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index @@ -105,6 +106,8 @@ return (<Timeline card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'chart') { return (<CustomChart card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'module' && card.subtype === 'voucher') { + return (<Voucher card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } return ( diff --git a/src/menu/modulesource/option.jsx b/src/menu/modulesource/option.jsx index c9a112a..1c30b6f 100644 --- a/src/menu/modulesource/option.jsx +++ b/src/menu/modulesource/option.jsx @@ -25,6 +25,7 @@ import chart from '@/assets/mobimg/chart.png' import tree from '@/assets/mobimg/tree.png' import timeline from '@/assets/mobimg/timeline.png' +import Voucher from '@/assets/mobimg/voucher.jpg' // 缁勪欢閰嶇疆淇℃伅 export const menuOptions = [ @@ -57,4 +58,5 @@ { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '瀵屾枃鏈�', width: 24, forbid: ['billPrint'] }, { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '鑷畾涔�', width: 24 }, { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '鍒嗙粍', width: 24, forbid: ['billPrint'] }, + { type: 'menu', url: Voucher, component: 'module', subtype: 'voucher', title: '鍑瘉', width: 24, forbid: ['billPrint'] }, ] diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index c564e14..149d043 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -622,8 +622,8 @@ if (val !== '') { val = `${card.prefix || ''}${val}${card.postfix || ''}` - if (card.eval === 'false' && /\s/ig.test(val)) { - val = val.replace(/\s/ig, ' ') + if (card.eval === 'false') { + val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') val = <span dangerouslySetInnerHTML={{__html: val}}></span> } } diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx new file mode 100644 index 0000000..0abd8f6 --- /dev/null +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -0,0 +1,67 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +// import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' + +// import MKEmitter from '@/utils/events.js' + +import './index.scss' + +class VoucherModule extends Component { + static propTpyes = { + BID: PropTypes.any, // 鐖剁骇Id + config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 + } + + state = { + BID: '', // 涓昏〃ID + config: null, // 鍥捐〃閰嶇疆淇℃伅 + loading: false, // 鏁版嵁鍔犺浇鐘舵�� + data: null, // 鏁版嵁 + searchkey: null, // 杩囨护鏉′欢 + } + + UNSAFE_componentWillMount () { + const { config, BID } = this.props + + this.setState({ + config: fromJS(config).toJS(), + BID: BID || '', + }, () => { + this.loadData() + }) + } + + componentDidMount () { + + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + loadData = () => { + + } + + render() { + const { config } = this.state + + return ( + <div className="menu-voucher-wrap" style={config.style}> + + </div> + ) + } +} + +export default VoucherModule \ No newline at end of file diff --git a/src/tabviews/custom/components/module/voucher/index.scss b/src/tabviews/custom/components/module/voucher/index.scss new file mode 100644 index 0000000..5a70b9e --- /dev/null +++ b/src/tabviews/custom/components/module/voucher/index.scss @@ -0,0 +1,13 @@ +.menu-voucher-wrap { + position: relative; + box-sizing: border-box; + background: #ffffff; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + min-height: 150px; + overflow-y: auto; + +} + + diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 406c381..419377f 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -40,6 +40,7 @@ const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) const CustomChart = asyncComponent(() => import('./components/chart/custom-chart')) const TimeLine = asyncComponent(() => import('./components/timeline/normal-timeline')) +const Voucher = asyncComponent(() => import('./components/module/voucher')) class CustomPage extends Component { static propTpyes = { @@ -1170,6 +1171,12 @@ <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> </Col> ) + } else if (item.type === 'module' && item.subtype === 'voucher') { + return ( + <Col span={item.width} key={item.uuid}> + <Voucher config={item} BID={_bid} /> + </Col> + ) } else { return null } diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index c88c681..b2e3886 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -683,7 +683,7 @@ if (_f.type.match(/date/ig)) { _type = 'datetime' - _select.push(`@${_f.field}='1900-01-01'`) + _select.push(`@${_f.field}='1949-10-01'`) } else if (_f.type === 'number') { _type = `decimal(18,${_fieldlen})` _select.push(`@${_f.field}=0`) diff --git a/src/templates/zshare/verifycard/index.scss b/src/templates/zshare/verifycard/index.scss index d6fec13..da0eef1 100644 --- a/src/templates/zshare/verifycard/index.scss +++ b/src/templates/zshare/verifycard/index.scss @@ -171,6 +171,7 @@ } .code-mirror-area { border-radius: 0; + width: calc(95vw - 240px); } } .sqlfield { diff --git a/src/utils/utils.js b/src/utils/utils.js index e195f6b..24ebbb6 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1395,7 +1395,7 @@ } _initFormfields.push(`@${_key}=${val}`) } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { - _initFormfields.push(`@${_key}='${form.value || '1900-01-01'}'`) + _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) } else { _initFormfields.push(`@${_key}='${form.value}'`) } @@ -1440,7 +1440,7 @@ let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' if (col.datatype && /^date/ig.test(col.datatype) && !_val) { - _val = '1900-01-01' + _val = '1949-10-01' } _initvars.push(_key) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 66e4dc9..dcc8745 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -936,6 +936,7 @@ return } + if (['voucher'].includes(item.subtype)) return if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 0f6728d..5ff6ea4 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1406,6 +1406,7 @@ swipes.push(item.name) } + if (['voucher'].includes(item.subtype)) return if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return if (['menubar'].includes(item.type) && item.wrap.datatype !== 'dynamic') return diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 2147a54..5310e0e 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1500,6 +1500,7 @@ return } + if (['voucher'].includes(item.subtype)) return if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return -- Gitblit v1.8.0