From b883ae5d7d46fc7a3503236f16a250c2264ea7c7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 29 九月 2022 17:45:25 +0800 Subject: [PATCH] 2022-09-29 --- src/menu/components/table/edit-table/columns/tableIn/index.jsx | 27 src/menu/components/share/sourcecomponent/inputform/index.jsx | 4 src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx | 12 src/menu/components/card/table-card/index.jsx | 72 -- src/utils/utils-custom.js | 4 src/menu/components/chart/chart-custom/index.jsx | 1 src/menu/datasource/index.jsx | 5 src/menu/components/chart/antv-bar/index.jsx | 28 - src/menu/components/chart/antv-scatter/index.jsx | 27 - src/views/systemfunc/header/index.jsx | 2 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 123 ---- src/assets/css/design.scss | 7 src/views/mobdesign/index.jsx | 4 src/menu/components/table/edit-table/index.jsx | 1 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 28 src/menu/components/carousel/data-card/index.jsx | 49 - src/menu/sysinterface/index.jsx | 132 ++-- src/menu/datasource/verifycard/index.jsx | 17 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 28 src/menu/components/share/usercomponent/index.jsx | 2 src/menu/components/card/balcony/index.jsx | 8 src/tabviews/custom/components/card/prop-card/index.jsx | 6 src/menu/sysinterface/index.scss | 26 src/menu/components/card/cardcellcomponent/index.jsx | 2 src/menu/components/card/data-card/options.jsx | 22 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 200 ------- src/menu/datasource/verifycard/settingform/index.jsx | 212 ++++--- src/menu/components/carousel/prop-card/index.jsx | 72 -- src/menu/components/card/data-card/index.jsx | 62 -- src/menu/components/share/actioncomponent/index.jsx | 7 src/menu/components/chart/antv-pie/index.jsx | 1 src/templates/sharecomponent/settingcomponent/settingform/index.scss | 7 /dev/null | 45 - src/tabviews/custom/components/carousel/prop-card/index.jsx | 6 src/tabviews/custom/components/card/balcony/index.jsx | 6 src/menu/components/card/prop-card/index.jsx | 79 -- src/menu/components/table/base-table/index.jsx | 40 - src/templates/zshare/customscript/index.jsx | 8 src/menu/components/table/normal-table/index.jsx | 54 -- src/views/systemfunc/header/index.scss | 6 40 files changed, 383 insertions(+), 1,059 deletions(-) diff --git a/src/assets/css/design.scss b/src/assets/css/design.scss index c615204..75dd933 100644 --- a/src/assets/css/design.scss +++ b/src/assets/css/design.scss @@ -84,9 +84,4 @@ height: 200px; } } -.mk-color-move { - .color-sketch-block { - position: relative; - top: 7px; - } -} + diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx index 6cec481..fb7ec08 100644 --- a/src/menu/components/card/balcony/index.jsx +++ b/src/menu/components/card/balcony/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Checkbox } from 'antd' -import { PlusOutlined, PlusSquareOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SettingOutlined, ToolOutlined } from '@ant-design/icons' +import { PlusOutlined, PlusSquareOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SettingOutlined, ToolOutlined, ClockCircleOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -100,7 +100,6 @@ updateComponent = (card) => { card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -269,11 +268,10 @@ <CopyComponent type="balcony" card={card}/> <PasteComponent options={['action', 'customCardElement']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} /> - <ClockComponent config={card} updateConfig={this.updateComponent}/> + {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> - {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} - {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} + {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> } trigger="hover"> <ToolOutlined /> diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index ce15a0c..4d67454 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -487,8 +487,6 @@ if (card.OpenType === 'popview' || card.verify || card.modal) { card.$parentId = cardCell.uuid card.$side = side || '' - - // MKEmitter.emit('logButton', cards.uuid, card) } _this.setState({ diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 09d308d..4526506 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -16,7 +16,6 @@ const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CardComponent = asyncComponent(() => import('../cardcomponent')) const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) @@ -64,7 +63,6 @@ scripts: [], action: [], search: [], - btnlog: [], subcards: [{ uuid: Utils.getuuid(), setting: { width: appType === 'mob' ? 24 : 6, type: 'simple'}, @@ -147,7 +145,6 @@ componentDidMount () { MKEmitter.addListener('submitModal', this.handleSave) - // MKEmitter.addListener('logButton', this.logButton) } shouldComponentUpdate (nextProps, nextState) { @@ -162,20 +159,8 @@ return } MKEmitter.removeListener('submitModal', this.handleSave) - // MKEmitter.removeListener('logButton', this.logButton) } - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - /** * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ @@ -184,7 +169,6 @@ card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -342,10 +326,6 @@ onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - // if (card.btnlog) { - // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) - // } - _this.updateComponent(card) if (appType === 'mob') return @@ -478,47 +458,6 @@ this.updateComponent(card) } - - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.subcards.forEach(col => { - // if (item.$parentId === col.uuid) { - // if (item.$side !== 'back') { - // col.elements = col.elements ? [...col.elements, item] : [item] - // } else { - // col.backElements = col.backElements ? [...col.backElements, item] : [item] - // } - // done = true - // } - // }) - // } - - // if (!done) { - // card.action = card.action ? [...card.action, item] : [item] - // } - - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } addCard = (copy) => { let card = fromJS(this.state.card).toJS() @@ -779,7 +718,6 @@ <CopyComponent type="datacard" card={card}/> <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 7db4e04..7297108 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -9,6 +9,12 @@ let MenuType = '' let menu = fromJS(window.GLOB.customMenu).toJS() let laypage = setting && setting.laypage !== 'false' + let interfaces = (menu.interfaces || []).map(item => { + return { + value: item.uuid, + label: item.name + } + }) if (menu.parentId === 'BillPrintTemp') { MenuType = 'billPrint' @@ -82,14 +88,25 @@ options: [ {value: 'dynamic', label: '鍔ㄦ��', priKeyType: 'static'}, {value: 'static', label: '闈欐��', priKeyType: 'static'}, + {value: 'public', label: '鍏叡鏁版嵁婧�', priKeyType: 'static'}, ], linkFields: ['priKeyType'], controlFields: [ {field: 'goback', values: ['dynamic']}, - {field: 'empty', values: ['dynamic']}, + {field: 'empty', values: ['dynamic', 'public']}, {field: 'jump', values: ['dynamic']}, {field: 'supModule', values: ['static']}, + {field: 'publicId', values: ['public']}, ], + forbid: subtype !== 'propcard' + }, + { + type: 'select', + field: 'publicId', + label: '鏁版嵁婧�', + initval: wrap.publicId || '', + required: true, + options: interfaces, forbid: subtype !== 'propcard' }, { @@ -160,6 +177,9 @@ {ParentID: 'dynamic', value: 'static', label: '闈欐�佸��'}, {ParentID: 'dynamic', value: 'dynamic', label: '鍔ㄦ�佸��'}, {ParentID: 'dynamic', value: 'joint', label: '鎷兼帴鍊�'}, + {ParentID: 'public', value: 'static', label: '闈欐�佸��'}, + {ParentID: 'public', value: 'dynamic', label: '鍔ㄦ�佸��'}, + {ParentID: 'public', value: 'joint', label: '鎷兼帴鍊�'}, ], forbid: subtype !== 'propcard' }, diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index daf0cb9..1411a72 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Modal } from 'antd' -import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' +import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, ClockCircleOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -17,7 +17,6 @@ const CardComponent = asyncComponent(() => import('../cardcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -72,7 +71,6 @@ elements: [], backElements: [] }], - btnlog: [], } if (card.config) { @@ -109,7 +107,6 @@ } componentDidMount () { - // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -124,7 +121,6 @@ this.setState = () => { return } - // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -145,18 +141,6 @@ }) } - // 鎸夐挳鍘嗗彶璁板綍 - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - /** * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ @@ -165,7 +149,6 @@ card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -236,6 +219,9 @@ } }) } else { + // if (card.wrap.datatype === 'dynamic') { + + // } // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' // if (supModule === 'empty') { // supModule = '' @@ -345,10 +331,6 @@ onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - // if (card.btnlog) { - // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) - // } - _this.updateComponent(card) if (appType === 'mob') return @@ -424,53 +406,6 @@ this.updateComponent(card) } - - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.subcards.forEach(col => { - // if (item.$parentId === col.uuid) { - // if (item.$side !== 'back') { - // col.elements = col.elements ? [...col.elements, item] : [item] - // } else { - // col.backElements = col.backElements ? [...col.backElements, item] : [item] - // } - // done = true - // } - // }) - // } - - // card.btnlog = logs - - // this.setState({ card: {...card, subcards: []} }, () => { - // this.updateComponent(card) - // }) - // if (!done) { - // notification.warning({ - // top: 92, - // message: '闄勫睘鍗$墖宸插垹闄わ紒', - // duration: 2 - // }) - // } else { - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } move = (item, direction) => { let card = fromJS(this.state.card).toJS() @@ -631,12 +566,10 @@ <CopyComponent type="propcard" card={card}/> <PasteComponent options={['cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} - <ClockComponent config={card} updateConfig={this.updateComponent}/> + {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> - {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} - {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} + {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> } trigger="hover"> <ToolOutlined /> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 689e208..8bf2fda 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -18,7 +18,6 @@ const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) @@ -71,7 +70,6 @@ elements: [] }], action: [], - btnlog: [], } if (card.config) { @@ -150,24 +148,12 @@ } } - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - /** * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ updateComponent = (card) => { card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -210,14 +196,6 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - // } else { - // cell.modal.fields.forEach(m => { - // if (m.type === 'linkMain' && !supModule) { - // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - // } - // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -266,10 +244,6 @@ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - - // if (card.btnlog) { - // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) - // } _this.updateComponent(card) @@ -358,51 +332,6 @@ // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储 MKEmitter.emit('addSearch', card.uuid, newcard) } - - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.subcards.forEach(col => { - // if (item.$parentId === col.uuid) { - // if (item.$side !== 'back') { - // col.elements = col.elements ? [...col.elements, item] : [item] - // } else { - // col.backElements = col.backElements ? [...col.backElements, item] : [item] - // } - // done = true - // } - // }) - // } - - // card.btnlog = logs - - // this.updateComponent(card) - // if (!done) { - // notification.warning({ - // top: 92, - // message: '闄勫睘鍗$墖宸插垹闄わ紒', - // duration: 2 - // }) - // } else { - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } move = (item, direction) => { let card = fromJS(this.state.card).toJS() @@ -589,7 +518,6 @@ <CopyComponent type="tablecard" card={card}/> <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index 0a4ad64..a1f1edf 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -15,7 +15,6 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) @@ -56,7 +55,6 @@ style: { borderWidth: '1px', borderColor: '#e8e8e8', marginTop: '8px', marginBottom: '8px', height: '300px' }, columns: [], scripts: [], - btnlog: [], subcards: [{ uuid: Utils.getuuid(), setting: {}, @@ -109,24 +107,12 @@ } } - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - /** * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ updateComponent = (card) => { card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -215,10 +201,6 @@ onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - // if (card.btnlog) { - // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) - // } - _this.updateComponent(card) if (appType === 'mob') return @@ -251,36 +233,6 @@ this.updateComponent(_card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // card.subcards.forEach(col => { - // col.elements = [...col.elements, item] - // if (item.$parentId === col.uuid) { - // col.elements = [...col.elements, item] - // } - // }) - - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - getWrapForms = () => { const { card } = this.state @@ -311,7 +263,6 @@ </NormalForm> <CopyComponent type="datacard" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)}/> diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index 685c304..7941f46 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Modal, Carousel } from 'antd' -import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' +import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, ClockCircleOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -17,7 +17,6 @@ const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) @@ -62,8 +61,7 @@ setting: {}, style: {}, elements: [], - }], - btnlog: [], + }] } if (card.config) { @@ -96,7 +94,6 @@ } componentDidMount () { - // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -111,7 +108,6 @@ this.setState = () => { return } - // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -132,24 +128,12 @@ }) } - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - /** * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ updateComponent = (card) => { card.width = card.wrap.width card.name = card.wrap.name - card.btnlog = [] if (window.GLOB.styling && card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� this.setState({ @@ -263,10 +247,6 @@ onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - // if (card.btnlog) { - // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) - // } - _this.updateComponent(card) if (appType === 'mob') return @@ -323,49 +303,6 @@ this.updateComponent(card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.subcards.forEach(col => { - // if (item.$parentId === col.uuid) { - // col.elements = [...col.elements, item] - // done = true - // } - // }) - // } - - // card.btnlog = logs - - // this.setState({ card: {...card, subcards: []} }, () => { - // this.updateComponent(card) - // }) - // if (!done) { - // notification.warning({ - // top: 92, - // message: '闄勫睘鍗$墖宸插垹闄わ紒', - // duration: 2 - // }) - // } else { - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - move = (item, direction) => { let card = fromJS(this.state.card).toJS() @@ -419,12 +356,11 @@ <CopyComponent type="propcard" card={card}/> <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> + {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> - {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} - {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} + {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> } trigger="hover"> <ToolOutlined/> diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index acd5cc0..bf52288 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -18,7 +18,6 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -91,7 +90,6 @@ search: [], action: [], plot: _plot, - btnlog: [], } if (card.config) { @@ -1228,7 +1226,6 @@ card.width = card.plot.width card.name = card.plot.name - card.btnlog = [] card.errors = [] let columns = card.columns.map(c => c.field) @@ -1345,30 +1342,6 @@ this.updateComponent(_card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // card.action = card.action ? [...card.action, item] : [item] - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -1390,7 +1363,6 @@ <CopyComponent type="line" card={card}/> <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 1fdd69b..29df74f 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -83,7 +83,6 @@ search: [], action: [], plot: _plot, - btnlog: [], } if (card.config) { diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index e5b1dfa..de84e0e 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -16,7 +16,6 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -78,7 +77,6 @@ search: [], action: [], plot: _plot, - btnlog: [], } if (card.config) { @@ -363,30 +361,6 @@ this.updateComponent(_card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // card.action = card.action ? [...card.action, item] : [item] - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -408,7 +382,6 @@ <CopyComponent type="line" card={card}/> <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> diff --git a/src/menu/components/chart/chart-custom/index.jsx b/src/menu/components/chart/chart-custom/index.jsx index 8de9dd0..b4ecf35 100644 --- a/src/menu/components/chart/chart-custom/index.jsx +++ b/src/menu/components/chart/chart-custom/index.jsx @@ -70,7 +70,6 @@ search: [], action: [], plot: _plot, - btnlog: [], } if (card.config) { diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 550fc4f..82785e7 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -293,15 +293,10 @@ _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) - let btnlog = config.btnlog || [] - if (card.OpenType === 'popview' || card.verify || card.modal) { - btnlog.push(card) - } - _this.setState({ actionlist: _actionlist }, () => { - _this.props.updateaction({...config, action: _actionlist, btnlog}) + _this.props.updateaction({...config, action: _actionlist}) }) if (card.origin || appType === 'mob') return diff --git a/src/menu/components/share/logcomponent/index.jsx b/src/menu/components/share/logcomponent/index.jsx deleted file mode 100644 index 8130e93..0000000 --- a/src/menu/components/share/logcomponent/index.jsx +++ /dev/null @@ -1,132 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal, Button, Popconfirm, Table } from 'antd' -import { RedoOutlined, CloseOutlined, RollbackOutlined } from '@ant-design/icons' - -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import MKEmitter from '@/utils/events.js' -import './index.scss' - -const { confirm } = Modal - -class DataSource extends Component { - static propTpyes = { - btnlog: PropTypes.array, - handlelog: PropTypes.func - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - appType: sessionStorage.getItem('appType'), - visible: false, - data: [], - columns: [ - { - title: '鎸夐挳鍚嶇О', - dataIndex: 'label', - width: '40%' - }, - { - title: '鎸夐挳绫诲瀷', - dataIndex: 'OpenType', - width: '40%' - }, - { - title: '鎿嶄綔', - align: 'center', - width: '20%', - dataIndex: 'operation', - render: (text, record) => - (<div style={{textAlign: 'center'}}> - <Popconfirm - overlayClassName="popover-confirm" - title="纭畾鎭㈠璁板綍鍚楋紵" - onConfirm={() => this.revert(record)} - > - <span title="鎭㈠" style={{color: '#26C281', fontSize: '16px', marginRight: '5px', cursor: 'pointer', padding: '5px'}}><RedoOutlined /></span> - </Popconfirm> - <Popconfirm - overlayClassName="popover-confirm" - title="纭畾娓呴櫎璁板綍鍚楋紵" - onConfirm={() => this.handleDelete(record)} - > - <span title="娓呴櫎" style={{color: '#ff4d4f', fontSize: '16px', cursor: 'pointer', padding: '5px'}}><CloseOutlined /></span> - </Popconfirm> - </div>) - } - ], - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - trigger = () => { - this.setState({ - visible: true, - data: fromJS(this.props.btnlog).toJS() - }) - } - - revert = (item) => { - const { appType } = this.state - const data = this.state.data.filter(d => d.uuid !== item.uuid) - - this.setState({data}) - this.props.handlelog('revert', data, item) - - if (appType === 'mob' || (appType === 'pc' && item.OpenType !== 'popview')) return - - MKEmitter.emit('thawButtons', item.uuid) - } - - handleDelete = (item) => { - if (item) { - const data = this.state.data.filter(d => d.uuid !== item.uuid) - - this.setState({data}) - this.props.handlelog('delete', data, null) - } else { - const _this = this - - confirm({ - content: '纭畾娓呯┖璁板綍鍚楋紵', - onOk() { - _this.setState({data: []}) - _this.props.handlelog('delete', [], null) - }, - onCancel() {} - }) - } - } - - render () { - const { btnlog } = this.props - const { visible, dict, data, columns } = this.state - - return ( - <div className={'btn-log-wrap' + (btnlog && btnlog.length > 0 ? ' tip-sign' : '')}> - <RollbackOutlined title="瑙i櫎鍐荤粨" onClick={this.trigger} /> - <Modal - wrapClassName="popview-modal" - title="鍘嗗彶璁板綍" - visible={visible} - width={700} - maskClosable={false} - onCancel={() => { this.setState({ visible: false }) }} - footer={[ - <Button key="close" onClick={() => { this.setState({ visible: false }) }}>{dict['model.close']}</Button> - ]} - destroyOnClose - > - <Button disabled={data.length === 0} style={{float: 'right', marginBottom: '5px', position: 'relative', zIndex: 1}} onClick={() => this.handleDelete()} type="primary">娓呯┖</Button> - <Table bordered rowKey="uuid" dataSource={data} columns={columns} pagination={false}/> - </Modal> - </div> - ) - } -} - -export default DataSource \ No newline at end of file diff --git a/src/menu/components/share/logcomponent/index.scss b/src/menu/components/share/logcomponent/index.scss deleted file mode 100644 index 9c974d2..0000000 --- a/src/menu/components/share/logcomponent/index.scss +++ /dev/null @@ -1,33 +0,0 @@ -.btn-log-wrap { - position: relative; - display: inline-block; - - >.anticon-rollback { - color: purple; - } - .operation { - text-align: center; - .revert { - color: #26C281; - margin-right: 10px; - cursor: pointer; - padding: 5px; - } - .close { - color: #ff4d4f; - cursor: pointer; - padding: 5px; - } - } -} -.btn-log-wrap.tip-sign::after { - content: ' '; - position: absolute; - top: -2px; - right: 2px; - height: 8px; - width: 8px; - border-radius: 100%; - background: #ff5b05; - z-index: 1; -} \ No newline at end of file diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx index 729dda2..7652431 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.jsx +++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx @@ -18,9 +18,7 @@ class PopSource extends Component { static propTpyes = { - btnlog: PropTypes.array, - keyword: PropTypes.string, - handlelog: PropTypes.func + keyword: PropTypes.string } state = { diff --git a/src/menu/components/share/usercomponent/index.jsx b/src/menu/components/share/usercomponent/index.jsx index c8d4d93..429e0a8 100644 --- a/src/menu/components/share/usercomponent/index.jsx +++ b/src/menu/components/share/usercomponent/index.jsx @@ -16,7 +16,7 @@ class UserComponent extends Component { static propTpyes = { - btnlog: PropTypes.array + config: PropTypes.object } state = { diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx index c4ed949..41b1ec1 100644 --- a/src/menu/components/table/base-table/index.jsx +++ b/src/menu/components/table/base-table/index.jsx @@ -71,7 +71,6 @@ { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, ], scripts: [], - btnlog: [], isNew: true } @@ -399,44 +398,6 @@ this.updateComponent(card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.cols.forEach(col => { - // if (col.type !== 'action') return - // if (item.$parentId === col.uuid) { - // col.elements = col.elements ? [...col.elements, item] : [item] - // done = true - // } - // }) - // } - - // if (!done) { - // card.action = card.action ? [...card.action, item] : [item] - // } - - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - getWrapForms = () => { const { wrap, action, columns, cols } = this.state.card @@ -493,7 +454,6 @@ <CopyComponent type="normaltable" card={card}/> <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index 3f1c391..69d1200 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -196,6 +196,17 @@ } componentDidMount () { + this.getsysScript() + } + + getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -214,13 +225,17 @@ Api.getSystemConfig(_sParam).then(res => { if (res.status) { + let _scripts = res.data.map(item => { + return { + name: item.funcname, + value: window.decodeURIComponent(window.atob(item.longparam)) + } + }) + + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ - systemScripts: res.data.map(item => { - return { - name: item.funcname, - value: window.decodeURIComponent(window.atob(item.longparam)) - } - }) + systemScripts: _scripts }) } else { notification.warning({ diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index f1c9345..54d6647 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -68,7 +68,6 @@ { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, ], scripts: [], - btnlog: [], submit: {intertype: 'system', default: 'true', innerFunc: '', execSuccess: 'grid', execError: 'never', scripts: [], uniques: []}, isNew: true } diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index a2448ee..d7377cd 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -22,7 +22,6 @@ const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const ColumnComponent = asyncComponent(() => import('./columns')) class TableCardEditComponent extends Component { @@ -75,7 +74,6 @@ { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, ], scripts: [], - btnlog: [], isNew: true } @@ -145,7 +143,6 @@ componentDidMount () { MKEmitter.addListener('submitModal', this.handleSave) - // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('completeSave', this.completeSave) } @@ -161,7 +158,6 @@ return } MKEmitter.removeListener('submitModal', this.handleSave) - // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('completeSave', this.completeSave) } @@ -299,17 +295,6 @@ this.props.updateConfig(_card) } - // logButton = (id, item) => { - // const { card } = this.state - - // if (id !== card.uuid) return - - // let btnlog = card.btnlog || [] - // btnlog.push(item) - - // this.updateComponent({...card, btnlog}) - // } - changeStyle = () => { const { card } = this.state @@ -424,44 +409,6 @@ this.updateComponent(card) } - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // let done = false - // if (item.$parentId) { - // card.cols.forEach(col => { - // if (col.type !== 'action') return - // if (item.$parentId === col.uuid) { - // col.elements = col.elements ? [...col.elements, item] : [item] - // done = true - // } - // }) - // } - - // if (!done) { - // card.action = card.action ? [...card.action, item] : [item] - // } - - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } - getWrapForms = () => { const { wrap, action, columns, cols } = this.state.card @@ -522,7 +469,6 @@ <CopyComponent type="normaltable" card={card}/> <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index eb4f54b..e71780a 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -40,6 +40,11 @@ const { config } = this.props const { appType } = this.state + if (config.type === 'interface') { // 鍏叡鏁版嵁婧愪笉浣跨敤鎼滅储 + this.setState({visible: true}) + return + } + let search = [] let menu = fromJS(window.GLOB.customMenu).toJS() diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 74152b1..85eb070 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -202,6 +202,13 @@ } getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -220,17 +227,15 @@ Api.getSystemConfig(_sParam).then(res => { if (res.status) { - let _scripts = [] - - res.data.forEach(item => { - let _item = { + let _scripts = res.data.map(item => { + return { name: item.funcname, value: window.decodeURIComponent(window.atob(item.longparam)) } - - _scripts.push(_item) }) + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ systemScripts: _scripts }) diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index cc9c58e..5104ee6 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import { fromJS } from 'immutable' import { Form, Row, Col, Input, Radio, Tooltip, notification, Select, InputNumber, Cascader } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' @@ -22,18 +23,15 @@ } state = { - interType: this.props.setting.interType || 'system', - laypage: this.props.setting.laypage || 'true', + setting: null, modules: [], - usefulFields: [], - useMSearch: this.props.setting.useMSearch || 'false', - sysInterface: this.props.setting.sysInterface || 'false', - supModule: this.props.setting.supModule || [], + innerRules: [], + innertip: '', appType: sessionStorage.getItem('appType') } UNSAFE_componentWillMount () { - const { config } = this.props + const { config, setting } = this.props let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, config.uuid) || [] @@ -43,17 +41,36 @@ }) let usefulFields = sessionStorage.getItem('permFuncField') + let innerRules = [] + let innertip = '' if (usefulFields) { try { usefulFields = JSON.parse(usefulFields) + + if (usefulFields.length > 0) { + innertip = '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') + let str = '^(' + usefulFields.join('|') + ')' + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') + + innerRules.push({ + pattern: _patten, + message: formRule.func.innerMessage + }) + } } catch (e) { - usefulFields = [] + innerRules = [] } - } else { - usefulFields = [] } - this.setState({modules, usefulFields}) + let _setting = fromJS(setting).toJS() + _setting.interType = setting.interType || 'system' + _setting.laypage = setting.laypage || 'true' + _setting.useMSearch = setting.useMSearch || 'false' + _setting.sysInterface = setting.sysInterface || 'false' + _setting.supModule = setting.supModule || [] + _setting.execute = setting.execute || 'true' + + this.setState({modules, innerRules, innertip, setting: _setting}) } handleConfirm = () => { @@ -69,15 +86,7 @@ } // 鏁版嵁婧愬墠绔獙璇� - if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) { - notification.warning({ - top: 92, - message: '璇峰~鍐欏唴閮ㄥ嚱鏁版垨鏁版嵁婧愶紒', - duration: 5 - }) - reject() - return - } else if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { + if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { let _quot = values.dataresource.match(/'{1}/g) let _lparen = values.dataresource.match(/\({1}/g) let _rparen = values.dataresource.match(/\){1}/g) @@ -133,35 +142,21 @@ }) } - onRadioChange = (e, key) => { - let value = e.target.value + onOptionChange = (value, key) => { + let setting = fromJS(this.state.setting).toJS() + setting[key] = value - if (key === 'interType') { - this.setState({ - interType: value - }) - } - } - - onSysInter = (e) => { - let value = e.target.value - - this.setState({ - sysInterface: value - }) - if (value === 'true') { + this.setState({setting}) + + if (key === 'sysInterface' && value === 'true') { this.props.form.setFieldsValue({interface: window.GLOB.mainSystemApi}) } } - changeSupModule = (val) => { - this.setState({supModule: val}) - } - render() { - const { setting, columns, config } = this.props + const { columns, config } = this.props const { getFieldDecorator } = this.props.form - const { interType, modules, useMSearch, laypage, supModule, usefulFields, appType, sysInterface } = this.state + const { setting, modules, innerRules, appType, innertip } = this.state const formItemLayout = { labelCol: { @@ -174,24 +169,23 @@ } } - let tooltip = null - let rules = [] - - if (usefulFields.length > 0) { - tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') - let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') - - rules.push({ - pattern: _patten, - message: formRule.func.innerMessage - }) - } - return ( <div className="model-datasource-setting-form-box"> <Form {...formItemLayout} className="model-setting-form"> <Row gutter={24}> + {config.type === 'interface' ? <Col span={8}> + <Form.Item label="鏁版嵁婧愬悕绉�"> + {getFieldDecorator('name', { + initialValue: setting.name, + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + '鏁版嵁婧愬悕绉�!' + } + ] + })(<Input placeholder={''} autoComplete="off" />)} + </Form.Item> + </Col> : null} <Col span={8}> <Form.Item label="琛ㄥ悕"> {getFieldDecorator('tableName', { @@ -212,7 +206,7 @@ <Col span={8}> <Form.Item label="鎺ュ彛绫诲瀷"> {getFieldDecorator('interType', { - initialValue: interType, + initialValue: setting.interType, rules: [ { required: true, @@ -220,17 +214,17 @@ }, ] })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'interType')}}> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'interType')}}> <Radio value="system">绯荤粺</Radio> <Radio value="inner">鍐呴儴</Radio> <Radio value="outer">澶栭儴</Radio> </Radio.Group>)} </Form.Item> </Col> - {interType === 'outer' ? <Col span={8}> + {setting.interType === 'outer' ? <Col span={8}> <Form.Item label="绯荤粺鎺ュ彛"> {getFieldDecorator('sysInterface', { - initialValue: sysInterface, + initialValue: setting.sysInterface, rules: [ { required: true, @@ -238,15 +232,15 @@ } ] })( - <Radio.Group onChange={this.onSysInter}> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'sysInterface')}}> <Radio value="true">鏄�</Radio> <Radio value="false">鍚�</Radio> </Radio.Group>)} </Form.Item> </Col> : null} - {interType === 'inner' ? <Col span={8}> - <Form.Item label={tooltip ? - <Tooltip placement="topLeft" title={tooltip}> + {setting.interType === 'inner' ? <Col span={8}> + <Form.Item label={innertip ? + <Tooltip placement="topLeft" title={innertip}> <QuestionCircleOutlined className="mk-form-tip" /> 鍐呴儴鍑芥暟 </Tooltip> : '鍐呴儴鍑芥暟' @@ -258,25 +252,25 @@ required: true, message: this.props.dict['form.required.input'] + '鍐呴儴鍑芥暟!' }, - ...rules + ...innerRules ] })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} - {interType === 'outer' ? <Col className="outer-interface" span={24}> + {setting.interType === 'outer' ? <Col className="outer-interface" span={24}> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { - initialValue: setting.interface || (sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), + initialValue: setting.interface || (setting.sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), rules: [ { - required: sysInterface !== 'true' ? true : false, + required: setting.sysInterface !== 'true' ? true : false, message: this.props.dict['form.required.input'] + '鎺ュ彛鍦板潃!' } ] - })(<TextArea rows={2} readOnly={sysInterface === 'true'}/>)} + })(<TextArea rows={2} readOnly={setting.sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {interType === 'outer' && sysInterface !== 'true' ? <Col className="outer-interface" span={24}> + {setting.interType === 'outer' && setting.sysInterface !== 'true' ? <Col className="outer-interface" span={24}> <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃"> <QuestionCircleOutlined className="mk-form-tip" /> 姝e紡鍦板潃 @@ -287,17 +281,14 @@ })(<TextArea rows={2}/>)} </Form.Item> </Col> : null} - {interType === 'outer' ? <Col span={8}> + {setting.interType === 'outer' ? <Col span={8}> <Form.Item label="澶栭儴鍑芥暟"> {getFieldDecorator('outerFunc', { - initialValue: setting.outerFunc || '', - rules: [ - - ] + initialValue: setting.outerFunc || '' })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} - {interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> + {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={ <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''锛涙煡璇㈡浛鎹㈢ $select@ -> /* 鎴� ''銆� @select$ -> */ 鎴� ''锛涚粺璁℃浛鎹㈢ $sum@ -> /* 鎴� ''銆� @sum$ -> */ 鎴� ''銆俙}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -305,11 +296,17 @@ </Tooltip> }> {getFieldDecorator('dataresource', { - initialValue: setting.dataresource || '' + initialValue: setting.dataresource || '', + rules: [ + { + required: setting.execute !== 'false' ? true : false, + message: this.props.dict['form.required.input'] + '鏁版嵁婧�!' + } + ] })(<CodeMirror />)} </Form.Item> </Col> : null} - {interType === 'system' ? <Col span={8}> + {setting.interType === 'system' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'鏌ヨ鏃讹紝鎼滅储鏉′欢浠here鏉′欢鎷兼帴杩涘叆sql锛岀粺璁℃椂锛屽皢鏁版嵁婧愪腑浠モ�淍+鎼滅储瀛楁+@鈥濈殑鍐呭锛屼互鎼滅储鏉′欢涓殑鍊艰繘琛屾浛鎹㈠悗锛屾彁浜ゆ煡璇紝娉細鏌ヨ绫诲瀷浠呭湪浣跨敤绯荤粺鍑芥暟鏃舵湁鏁堛��'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -354,18 +351,18 @@ })(<Input placeholder={'ID asc, UID desc'} autoComplete="off" />)} </Form.Item> </Col> : null} - {interType === 'system' ? <Col span={8}> + {setting.interType === 'system' ? <Col span={8}> <Form.Item label="榛樿sql"> {getFieldDecorator('execute', { - initialValue: setting.execute || 'true' + initialValue: setting.execute })( - <Radio.Group> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'execute')}}> <Radio value="true">鎵ц</Radio> <Radio value="false">涓嶆墽琛�</Radio> </Radio.Group>)} </Form.Item> </Col> : null} - {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> + {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -373,7 +370,7 @@ </Tooltip> }> {getFieldDecorator('supModule', { - initialValue: supModule, + initialValue: setting.supModule, rules: [ { required: true, @@ -381,7 +378,7 @@ } ] })( - <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> + <Cascader options={modules} onChange={(val) => {this.onOptionChange(val, 'supModule')}} expandTrigger="hover" placeholder="" /> )} </Form.Item> </Col> : null} @@ -390,14 +387,14 @@ {getFieldDecorator('laypage', { initialValue: setting.laypage || 'true' })( - <Radio.Group onChange={(e) => this.setState({laypage: e.target.value})}> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'laypage')}}> <Radio value="true">鏄�</Radio> <Radio value="false">鍚�</Radio> </Radio.Group> )} </Form.Item> </Col> : null} - {config.pageable && laypage !== 'false' ? <Col span={8}> + {config.pageable && setting.laypage !== 'false' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title="閫夋嫨鍒嗛〉鏃舵湁鏁堛��"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -416,7 +413,7 @@ </Form.Item> </Col> : null} {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */} - {!['navbar'].includes(config.type) && !['editable'].includes(config.subtype) && (!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}> + {!['navbar', 'interface'].includes(config.type) && !['editable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -433,7 +430,7 @@ )} </Form.Item> </Col> : null} - {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}> + {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -443,14 +440,14 @@ {getFieldDecorator('useMSearch', { initialValue: setting.useMSearch || 'true' })( - <Radio.Group onChange={(e) => this.setState({useMSearch: e.target.value})}> + <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'useMSearch')}}> <Radio value="true">浣跨敤</Radio> <Radio value="false">涓嶄娇鐢�</Radio> </Radio.Group> )} </Form.Item> </Col> : null} - {!['navbar', 'balcony', 'menubar'].includes(config.type) && useMSearch === 'true' && appType !== 'mob' ? <Col span={8}> + {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && setting.useMSearch === 'true' && appType !== 'mob' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'澶栧眰鎼滅储鏉′欢鏀瑰彉鏃讹紝鏄惁鍒锋柊褰撳墠缁勪欢鏁版嵁銆�'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -478,7 +475,7 @@ </Radio.Group>)} </Form.Item> </Col> - {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}> + {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) ? <Col span={8}> <Form.Item label="鍒濆鍖栨暟鎹�"> {getFieldDecorator('onload', { initialValue: setting.onload || 'true' @@ -490,6 +487,39 @@ )} </Form.Item> </Col> : null} + {config.type === 'interface' ? <Col span={8}> + <Form.Item label="瀹氭椂鍣�"> + {getFieldDecorator('timer', { + initialValue: setting.timer || '' + })( + <Select onChange={(value) => {this.onOptionChange(value, 'timer')}}> + <Select.Option value=""> 鏃� </Select.Option> + <Select.Option value="2s"> 2绉� </Select.Option> + <Select.Option value="5s"> 5绉� </Select.Option> + <Select.Option value="15s"> 15绉� </Select.Option> + <Select.Option value="30s"> 30绉� </Select.Option> + <Select.Option value="1min"> 1鍒嗛挓 </Select.Option> + <Select.Option value="5min"> 5鍒嗛挓 </Select.Option> + <Select.Option value="10min"> 10鍒嗛挓 </Select.Option> + <Select.Option value="15min"> 15鍒嗛挓 </Select.Option> + <Select.Option value="30min"> 30鍒嗛挓 </Select.Option> + <Select.Option value="1hour"> 1灏忔椂 </Select.Option> + </Select> + )} + </Form.Item> + </Col> : null} + {config.type === 'interface' && setting.timer ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="瀹氭椂鍣ㄦ墽琛屾鏁般�傛敞锛�0琛ㄧず娌℃湁闄愬埗銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鎵ц娆℃暟 + </Tooltip> + }> + {getFieldDecorator('timerRepeats', { + initialValue: setting.timerRepeats || 0 + })(<InputNumber min={0} max={500} precision={0} />)} + </Form.Item> + </Col> : null} </Row> </Form> </div> diff --git a/src/menu/sysinterface/index.jsx b/src/menu/sysinterface/index.jsx index e221366..797dc2c 100644 --- a/src/menu/sysinterface/index.jsx +++ b/src/menu/sysinterface/index.jsx @@ -1,14 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, Button, Popconfirm, message } from 'antd' -import { StopTwoTone, ApiOutlined, CopyOutlined, EditOutlined, CheckCircleTwoTone, DeleteOutlined } from '@ant-design/icons' +import { Modal, Button, Popconfirm, message, notification } from 'antd' +import { StopTwoTone, DatabaseOutlined, CopyOutlined, CheckCircleTwoTone, DeleteOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import asyncComponent from '@/utils/asyncComponent' import './index.scss' -const SettingForm = asyncComponent(() => import('./settingform')) +const DataSource = asyncComponent(() => import('@/menu/datasource')) const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) class InterfaceController extends Component { @@ -19,12 +19,10 @@ state = { visible: false, - setvisible: false, interfaces: [], - card: null, columns: [ { - title: '鎺ュ彛鍚嶇О', + title: '鍚嶇О', dataIndex: 'name', width: '50%' }, @@ -53,8 +51,9 @@ dataIndex: 'operation', render: (text, record) => (<div style={{textAlign: 'center'}}> - <span onClick={() => this.handleEdit(record)} style={{color: '#1890ff', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><EditOutlined /></span> - <span onClick={() => {this.copy(record)}} style={{color: '#26C281', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><CopyOutlined /></span> + <DataSource config={record} updateConfig={this.update}/> + <span onClick={() => this.handleStatus(record)} style={{color: '#8E44AD', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><SwapOutlined /></span> + <span onClick={() => this.copy(record)} style={{color: '#26C281', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><CopyOutlined /></span> <Popconfirm overlayClassName="popover-confirm" title="纭畾鍒犻櫎锛�" @@ -107,8 +106,46 @@ }) } - handleEdit = (record) => { - this.setState({card: record, setvisible: true}) + handleStatus = (record) => { + const { config } = this.props + + if (record.status === 'false') { + if (record.setting.interType === 'system' && record.setting.execute !== 'false' && !record.setting.dataresource) { + notification.warning({ + top: 92, + message: '鏈缃暟鎹簮锛屼笉鍙惎鐢紒', + duration: 5 + }) + return + } else if (!record.setting.primaryKey) { + notification.warning({ + top: 92, + message: '鏈缃富閿紝涓嶅彲鍚敤锛�', + duration: 5 + }) + return + } else if (record.columns.length === 0) { + notification.warning({ + top: 92, + message: '鏈坊鍔犲瓧娈甸泦锛屼笉鍙惎鐢紒', + duration: 5 + }) + return + } + } + + record = fromJS(record).toJS() + record.status = record.status === 'false' ? 'true' : 'false' + + let interfaces = this.state.interfaces.map(item => { + if (item.uuid !== record.uuid) { + return item + } + return record + }) + + this.setState({ interfaces }) + this.props.updateConfig({...config, interfaces}) } deleteScript = (record) => { @@ -126,37 +163,25 @@ this.props.updateConfig({...config, interfaces}) } - settingSave = () => { + update = (record) => { const { config } = this.props - const { card } = this.state - let interfaces = fromJS(this.state.interfaces).toJS() - this.settingRef.handleConfirm().then(res => { - interfaces = interfaces.map(item => { - if (item.uuid === card.uuid) { - res.uuid = item.uuid + if (record.setting.primaryKey && record.columns.length > 0) { + record.status = 'true' + } else if (record.columns.length === 0) { + record.status = 'false' + } + record.name = record.setting.name - if (res.procMode !== 'inner' && res.preScripts && res.preScripts.filter(item => item.status !== 'false').length === 0) { - message.warning('鏈缃墠缃剼鏈紝涓嶅彲鍚敤锛�') - res.status = 'false' - } else if (res.callbackType === 'script' && res.cbScripts && res.cbScripts.filter(item => item.status !== 'false').length === 0) { - message.warning('鏈缃洖璋冭剼鏈紝涓嶅彲鍚敤锛�') - res.status = 'false' - } - - return res - } + let interfaces = this.state.interfaces.map(item => { + if (item.uuid !== record.uuid) { return item - }) - - this.setState({ - card: null, - setvisible: false, - interfaces - }) - - this.props.updateConfig({...config, interfaces}) + } + return record }) + + this.setState({ interfaces }) + this.props.updateConfig({...config, interfaces}) } addInterface = () => { @@ -165,11 +190,14 @@ interfaces.push({ uuid: Utils.getuuid(), - name: 'interface ' + (interfaces.length + 1), - procMode: 'script', - callbackType: 'script', - preScripts: [], - cbScripts: [] + name: '鏁版嵁婧�' + (interfaces.length + 1), + status: 'false', + format: 'array', + type: 'interface', + pageable: false, + setting: { interType: 'system', name: '鏁版嵁婧�' + (interfaces.length + 1), status: 'false' }, + columns: [], + scripts: [], }) this.setState({ @@ -179,13 +207,13 @@ } render() { - const { visible, setvisible, columns, interfaces, card } = this.state + const { visible, columns, interfaces } = this.state return ( <div className="mk-sys-interface" style={{display: 'inline-block'}}> - <Button className="mk-border-green" onClick={this.trigger}><ApiOutlined /> 鎺ュ彛绠$悊</Button> + <Button className="mk-border-green" onClick={this.trigger}><DatabaseOutlined /> 鍏叡鏁版嵁婧�</Button> <Modal - title="鎺ュ彛绠$悊" + title="鍏叡鏁版嵁婧�" wrapClassName="interface-controller-modal" visible={visible} width={800} @@ -198,21 +226,9 @@ ]} destroyOnClose > - <Button key="add-interface" className="mk-border-green" onClick={this.addInterface}> 娣诲姞 </Button> + <PlusOutlined key="add-interface" onClick={this.addInterface}/> {/* <div style={{fontSize: '12px', position: 'relative', top: '20px'}}>娉細鎺ュ彛鎵ц瀹屾垚鍚庯紝浼氳Е鍙戦粯璁や笉鍔犺浇鐨勭粍浠跺埛鏂版暟鎹��</div> */} - <EditTable key="manage-interface" actions={['move', 'copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> - </Modal> - <Modal - title={card ? card.name : '鎺ュ彛'} - wrapClassName="interface-edit-modal" - visible={setvisible} - width={900} - maskClosable={false} - onOk={this.settingSave} - onCancel={() => { this.setState({ setvisible: false })}} - destroyOnClose - > - <SettingForm config={card} wrappedComponentRef={(inst) => this.settingRef = inst}/> + <EditTable key="manage-interface" actions={['copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> </Modal> </div> ) diff --git a/src/menu/sysinterface/index.scss b/src/menu/sysinterface/index.scss index c4d74b5..50b4f4d 100644 --- a/src/menu/sysinterface/index.scss +++ b/src/menu/sysinterface/index.scss @@ -1,20 +1,22 @@ .interface-controller-modal { - >.ant-modal >.ant-modal-content >.ant-modal-body { + .ant-modal-body { min-height: 400px; - >.mk-border-green { + >.anticon-plus { float: right; position: relative; z-index: 1; - margin-bottom: 10px; + margin: 0px 10px 10px; + font-size: 20px; + color: #26C281; + } + .model-datasource { + position: relative; + top: 0; + color: #1890ff; + display: inline-block; + > .anticon-setting { + font-size: 16px; + } } } } -.interface-edit-modal { - .ant-modal { - top: 70px; - } - .ant-modal-body { - min-height: 300px; - padding-top: 5px; - } -} \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/baseform/index.jsx b/src/menu/sysinterface/settingform/baseform/index.jsx deleted file mode 100644 index ea3b695..0000000 --- a/src/menu/sysinterface/settingform/baseform/index.jsx +++ /dev/null @@ -1,260 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import { formRule } from '@/utils/option.js' -import './index.scss' - -const { TextArea } = Input - -class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.object, // 鏁版嵁婧愰厤缃� - updateStatus: PropTypes.func, // 鐘舵�佹洿鏂� - } - - state = { - procMode: 'script', - funcTooltip: '', - funcRules: [] - } - - UNSAFE_componentWillMount () { - const { setting } = this.props - - let usefulFields = sessionStorage.getItem('permFuncField') - if (usefulFields) { - try { - usefulFields = JSON.parse(usefulFields) - } catch (e) { - usefulFields = [] - } - } else { - usefulFields = [] - } - - let tooltip = null - let rules = [] - - if (usefulFields.length > 0) { - tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') - let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') - - rules.push({ - pattern: _patten, - message: formRule.func.innerMessage - }) - } - - this.setState({ - procMode: setting.procMode || 'script', - funcTooltip: tooltip, - funcRules: rules - }) - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - onRadioChange = (e, key) => { - let value = e.target.value - - if (key === 'procMode') { - this.setState({ - procMode: value - }) - } - this.props.updateStatus({[key]: value}) - } - - render() { - const { setting, dict } = this.props - const { getFieldDecorator } = this.props.form - const { funcRules, funcTooltip, procMode } = this.state - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="model-table-datasource-setting-form-box"> - <Form {...formItemLayout} className="model-setting-form"> - <Row gutter={24}> - <Col span={12}> - <Form.Item label="鎺ュ彛鍚�"> - {getFieldDecorator('name', { - initialValue: setting.name || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '鎺ュ彛鍚�!' - }, - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鐘舵��"> - {getFieldDecorator('status', { - initialValue: setting.status || 'true' - })( - <Radio.Group> - <Radio value="true">鍚敤</Radio> - <Radio value="false">绂佺敤</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鍙傛暟澶勭悊"> - {getFieldDecorator('procMode', { - initialValue: procMode, - rules: [ - { - required: true, - message: dict['form.required.select'] + '鍙傛暟澶勭悊鏂瑰紡!' - }, - ] - })( - <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onRadioChange(e, 'procMode')}}> - <Radio value="script">鍓嶇疆鑴氭湰</Radio> - <Radio value="inner">鍓嶇疆鍑芥暟</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - {procMode === 'inner' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title={funcTooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍓嶇疆鍑芥暟 - </Tooltip> - }> - {getFieldDecorator('prevFunc', { - initialValue: setting.prevFunc || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '鍓嶇疆鍑芥暟!' - }, - { - max: formRule.func.max, - message: formRule.func.maxMessage - }, - ...funcRules - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - <Col className="data-source" span={24}> - <Form.Item label="娴嬭瘯鍦板潃"> - {getFieldDecorator('interface', { - initialValue: setting.interface || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '娴嬭瘯鍦板潃!' - }, - ] - })(<TextArea rows={2} />)} - </Form.Item> - </Col> - <Col className="data-source" span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="姝e紡绯荤粺鎵�浣跨敤鐨勭殑鎺ュ彛鍦板潃銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 姝e紡鍦板潃 - </Tooltip> - }> - {getFieldDecorator('proInterface', { - initialValue: setting.proInterface || '' - })(<TextArea rows={2} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="璇锋眰鏂瑰紡"> - {getFieldDecorator('method', { - initialValue: setting.method || 'post', - rules: [ - { - required: true, - message: dict['form.required.select'] + '璇锋眰鏂瑰紡!' - }, - ] - })( - <Radio.Group> - <Radio value="get">GET</Radio> - <Radio value="post">POST</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title={'濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 璺ㄥ煙璇锋眰 - </Tooltip> - }> - {getFieldDecorator('cross', { - initialValue: setting.cross || 'true' - })( - <Radio.Group> - <Radio value="true">鏀寔</Radio> - <Radio value="false">涓嶆敮鎸�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鍥炶皟鏂瑰紡"> - {getFieldDecorator('callbackType', { - initialValue: setting.callbackType || 'script' - })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}> - <Radio value="default">榛樿鑴氭湰</Radio> - <Radio value="script">鑷畾涔夎剼鏈�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鍥炶皟琛ㄥ悕"> - {getFieldDecorator('cbTable', { - initialValue: setting.cbTable || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '鍥炶皟琛ㄥ悕!' - }, - { - max: 50, - message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!' - } - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> - </Row> - </Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/baseform/index.scss b/src/menu/sysinterface/settingform/baseform/index.scss deleted file mode 100644 index aeabe5f..0000000 --- a/src/menu/sysinterface/settingform/baseform/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.model-table-datasource-setting-form-box { - position: relative; - - .model-setting-form { - .data-source { - .ant-form-item-label { - width: 16.5%; - } - .ant-form-item-control-wrapper { - width: 83.5%; - } - .CodeMirror { - height: 150px; - } - } - } -} \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/index.jsx b/src/menu/sysinterface/settingform/index.jsx deleted file mode 100644 index 6309ec8..0000000 --- a/src/menu/sysinterface/settingform/index.jsx +++ /dev/null @@ -1,179 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, notification, Tabs } from 'antd' - -import asyncComponent from '@/utils/asyncComponent' -import BaseForm from './baseform' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import './index.scss' - -const { TabPane } = Tabs -const SimpleScript = asyncComponent(() => import('./simplescript')) - -class SettingForm extends Component { - static propTpyes = { - config: PropTypes.object, // 椤甸潰閰嶇疆淇℃伅 - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - formlist: [], - btnloading: false, - activeKey: 'setting', - setting: null, - defaultSql: '', - status: {} - } - - UNSAFE_componentWillMount() { - const { config } = this.props - - let _setting = fromJS(config).toJS() - let _preScripts = _setting.preScripts || [] - let _cbScripts = _setting.cbScripts || [] - - this.setState({ - setting: _setting, - preScripts: _preScripts, - cbScripts: _cbScripts, - status: fromJS(_setting).toJS() - }) - } - - - handleConfirm = () => { - const { activeKey, setting, preScripts, cbScripts } = this.state - - let _loading = false - if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { - notification.warning({ - top: 92, - message: '瀛樺湪鏈繚瀛樿剼鏈紝璇风偣鍑荤‘瀹氫繚瀛橈紝鎴栫偣鍑诲彇娑堟斁寮冧慨鏀癸紒', - duration: 5 - }) - return Promise.reject() - } - - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - if (activeKey === 'setting') { - return new Promise((resolve, reject) => { - this.settingForm.handleConfirm().then(res => { - resolve({...res, preScripts, cbScripts}) - }, () => { - reject() - }) - }) - } else { - return new Promise((resolve) => { - resolve({...setting, preScripts, cbScripts}) - }) - } - } - - // 鏍囩鍒囨崲 - changeTab = (val) => { - const { activeKey } = this.state - - let _loading = false - if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { - notification.warning({ - top: 92, - message: '瀛樺湪鏈繚瀛樿剼鏈紝璇风偣鍑荤‘瀹氫繚瀛橈紝鎴栫偣鍑诲彇娑堟斁寮冧慨鏀癸紒', - duration: 5 - }) - return - } - - if (activeKey === 'setting') { - this.settingForm.handleConfirm().then(res => { - this.setState({ - setting: res, - activeKey: val - }) - }) - } else { - this.setState({ - activeKey: val - }) - } - } - - // 鍓嶇疆鑴氭湰鏇存柊 - preScriptsUpdate = (preScripts) => { - this.setState({preScripts}) - } - - // 鍚庣疆鑴氭湰鏇存柊 - cbScriptsUpdate = (cbScripts) => { - this.setState({cbScripts}) - } - - updateStatus = (status) => { - this.setState({status: {...this.state.status, ...status}}) - } - - render() { - const { dict, activeKey, setting, preScripts, cbScripts, status } = this.state - - return ( - <div className="model-interface-form-box" id="model-interface-form-body"> - <Tabs activeKey={activeKey} onChange={this.changeTab}> - <TabPane tab="鎺ュ彛璁剧疆" key="setting"> - <BaseForm - dict={dict} - setting={setting} - updateStatus={this.updateStatus} - wrappedComponentRef={(inst) => this.settingForm = inst} - /> - </TabPane> - <TabPane tab={ - <span> - 鍓嶇疆鑴氭湰 - {preScripts.length ? <span className="count-tip">{preScripts.length}</span> : null} - </span> - } disabled={status.procMode !== 'script'} key="prescripts"> - <SimpleScript - dict={dict} - type="front" - setting={setting} - scripts={preScripts} - scriptsUpdate={this.preScriptsUpdate} - wrappedComponentRef={(inst) => this.preScriptsForm = inst} - /> - </TabPane> - <TabPane tab={ - <span> - 鍥炶皟鑴氭湰 - {cbScripts.length ? <span className="count-tip">{cbScripts.length}</span> : null} - </span> - } disabled={status.callbackType !== 'script'} key="cbscripts"> - <SimpleScript - dict={dict} - type="back" - setting={setting} - scripts={cbScripts} - scriptsUpdate={this.cbScriptsUpdate} - wrappedComponentRef={(inst) => this.cbScriptsForm = inst} - /> - </TabPane> - </Tabs> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/index.scss b/src/menu/sysinterface/settingform/index.scss deleted file mode 100644 index 4d9d692..0000000 --- a/src/menu/sysinterface/settingform/index.scss +++ /dev/null @@ -1,61 +0,0 @@ -.model-interface-form-box { - position: relative; - - >.ant-spin { - position: absolute; - top: 150px; - left: calc(50% - 16px); - } - .count-tip { - position: absolute; - top: 0px; - color: #1890ff; - font-size: 12px; - } - .model-table-setting-form { - .textarea { - .ant-form-item-label { - width: 16.3%; - } - .ant-form-item-control-wrapper { - width: 83.33333333%; - } - } - .text-area { - .CodeMirror { - height: 150px; - } - } - } - .operation-btn { - display: inline-block; - font-size: 16px; - padding: 0 5px; - cursor: pointer; - } - td { - word-break: break-all; - } - .setting-custom-back { - position: absolute; - top: -20px; - left: -10px; - font-size: 16px; - z-index: 1; - cursor: pointer; - padding: 10px; - color: rgb(24, 144, 255); - } - .to-custom-script { - float: right; - color: #1890ff; - margin-right: 12px; - margin-top: 15px; - cursor: pointer; - border: 0; - box-shadow: unset; - } - .ant-tabs-nav-wrap { - text-align: center; - } -} \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/simplescript/index.jsx b/src/menu/sysinterface/settingform/simplescript/index.jsx deleted file mode 100644 index 9f13e66..0000000 --- a/src/menu/sysinterface/settingform/simplescript/index.jsx +++ /dev/null @@ -1,454 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Row, Col, Button, notification, Select, Popconfirm, Typography, Modal, Radio, Tooltip } from 'antd' -import { StopTwoTone, SwapOutlined, EditOutlined, CheckCircleTwoTone, DeleteOutlined } from '@ant-design/icons' -import moment from 'moment' - -import Utils from '@/utils/utils.js' -import Api from '@/api' -import SettingUtils from '../utils' -import CodeMirror from '@/templates/zshare/codemirror' -import asyncComponent from '@/utils/asyncComponent' -import './index.scss' - -const { Paragraph } = Typography -const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) - -class CustomForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - type: PropTypes.string, // 鑴氭湰绫诲瀷 - setting: PropTypes.object, // 璁剧疆 - scripts: PropTypes.array, // 鑷畾涔夎剼鏈垪琛� - scriptsChange: PropTypes.func, // 鑷畾涔夎剼鏈垏鎹㈡椂楠岃瘉 - scriptsUpdate: PropTypes.func // 琛ㄥ崟 - } - - state = { - editItem: null, - loading: false, - systemScripts: [], - scriptsColumns: [ - { - title: 'SQL', - dataIndex: 'sql', - width: '60%', - render: (text) => { - let title = text.match(/^\s*\/\*.+\*\//) - title = title && title[0] ? title[0] : '' - let _text = title ? text.replace(title, '') : text - - return ( - <div> - {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} - <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> - </div> - ) - } - }, - { - title: '鎵ц浣嶇疆', - dataIndex: 'position', - width: '13%', - render: (text, record) => { - if (record.position === 'front') { - return 'sql鍓�' - } else { - return 'sql鍚�' - } - } - }, - { - title: '鐘舵��', - dataIndex: 'status', - width: '12%', - render: (text, record) => record.status === 'false' ? - ( - <div> - 绂佺敤 - <StopTwoTone style={{marginLeft: '5px'}} twoToneColor="#ff4d4f" /> - </div> - ) : - ( - <div> - 鍚敤 - <CheckCircleTwoTone style={{marginLeft: '5px'}} twoToneColor="#52c41a" /> - </div> - ) - }, - { - title: '鎿嶄綔', - align: 'center', - width: '15%', - dataIndex: 'operation', - render: (text, record) => - (<div style={{textAlign: 'center'}}> - <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> - <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span> - <Popconfirm - overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} - onConfirm={() => this.handleDelete(record) - }> - <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> - </Popconfirm> - </div>) - } - ] - } - - UNSAFE_componentWillMount() { - const { scripts } = this.props - - let scriptsColumns = fromJS(this.state.scriptsColumns).toJS() - - this.setState({ - scripts: fromJS(scripts).toJS(), - scriptsColumns - }) - } - - componentDidMount () { - this.getsysScript() - } - - getsysScript = () => { - let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` - - _scriptSql = Utils.formatOptions(_scriptSql) - - let _sParam = { - func: 'sPC_Get_SelectedList', - LText: _scriptSql, - obj_name: 'data', - arr_field: 'funcname,longparam' - } - - _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 - - Api.getSystemConfig(_sParam).then(res => { - if (res.status) { - let _scripts = res.data.map(item => { - let _item = { - name: item.funcname, - value: window.decodeURIComponent(window.atob(item.longparam)) - } - return _item - }) - - this.setState({ - systemScripts: _scripts - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - handleCancel = () => { - this.setState({ - editItem: null - }) - this.props.form.setFieldsValue({ - sql: '' - }) - } - - handleConfirm = () => { - const { scripts, editItem } = this.state - - let _sql = this.props.form.getFieldValue('sql') - - if (!_sql) { - notification.warning({ - top: 92, - message: '璇峰~鍐欒嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } else if (/^\s+$/.test(_sql)) { - notification.warning({ - top: 92, - message: '鑷畾涔夎剼鏈笉鍙负绌猴紒', - duration: 5 - }) - return - } - - let values = { - uuid: editItem && editItem.uuid ? editItem.uuid : Utils.getuuid(), - sql: _sql, - } - - if (this.props.form.getFieldValue('position')) { - values.position = this.props.form.getFieldValue('position') - } - - let _quot = values.sql.match(/'{1}/g) - let _lparen = values.sql.match(/\({1}/g) - let _rparen = values.sql.match(/\){1}/g) - - _quot = _quot ? _quot.length : 0 - _lparen = _lparen ? _lparen.length : 0 - _rparen = _rparen ? _rparen.length : 0 - - if (_quot % 2 !== 0) { - notification.warning({ - top: 92, - message: 'sql涓璡'蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - return - } else if (_lparen !== _rparen) { - notification.warning({ - top: 92, - message: 'sql涓�()蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - return - } else if (/--/ig.test(values.sql)) { - notification.warning({ - top: 92, - message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇瀛楃 -- 锛屾敞閲婅鐢� /*鍐呭*/', - duration: 5 - }) - return - } - - let error = Utils.verifySql(values.sql, 'customscript') - - if (error) { - notification.warning({ - top: 92, - message: 'sql涓笉鍙娇鐢�' + error, - duration: 5 - }) - return - } - - let _scripts = fromJS(scripts).toJS() - - if (editItem && editItem.uuid) { - _scripts = _scripts.map(item => { - if (item.uuid === values.uuid) { - return values - } else { - return item - } - }) - } else { - _scripts.push(values) - } - - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: SettingUtils.getCustomDebugSql(_scripts) - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - - this.setState({loading: true}) - Api.genericInterface(param).then(result => { - if (result.status) { - this.setState({ - loading: false, - scripts: _scripts, - editItem: null - }) - - this.props.scriptsUpdate(_scripts) - this.props.form.setFieldsValue({ - sql: '' - }) - } else { - this.setState({loading: false}) - Modal.error({ - title: result.message - }) - } - }) - } - - selectScript = (value, option) => { - if (!value || !option) return - let _sql = this.props.form.getFieldValue('sql') - if (_sql) { - _sql = _sql + ` - - ` - } - - _sql = _sql.replace(/\s{6}$/, '') - _sql = _sql + `/*${option.props.children}*/ - ` - _sql = _sql.replace(/\s{4}$/, '') - _sql = _sql + value - - this.props.form.setFieldsValue({ - sql: _sql - }) - } - - handleEdit = (record) => { - const { type } = this.props - this.setState({ - editItem: record - }) - - if (type === 'front') { - this.props.form.setFieldsValue({ - sql: record.sql - }) - } else { - this.props.form.setFieldsValue({ - sql: record.sql, - position: record.position || 'back' - }) - } - - this.scrolltop() - } - - scrolltop = () => { - let node = document.getElementById('model-interface-form-body').parentNode - - if (node && node.scrollTop) { - let inter = Math.ceil(node.scrollTop / 10) - - let timer = setInterval(() => { - if (node.scrollTop - inter > 0) { - node.scrollTop = node.scrollTop - inter - } else { - node.scrollTop = 0 - clearInterval(timer) - } - }, 10) - } - } - - changeScripts = (scripts) => { - this.setState({scripts}) - this.props.scriptsUpdate(scripts) - } - - handleStatus = (record) => { - let scripts = fromJS(this.state.scripts).toJS() - record.status = record.status === 'false' ? 'true' : 'false' - - scripts = scripts.map(item => { - if (item.uuid === record.uuid) { - return record - } else { - return item - } - }) - - this.setState({scripts}) - this.props.scriptsUpdate(scripts) - } - - handleDelete = (record) => { - let scripts = fromJS(this.state.scripts).toJS() - scripts = scripts.filter(item => item.uuid !== record.uuid) - - this.setState({ scripts }) - this.props.scriptsUpdate(scripts) - } - - render() { - const { setting, scripts, type } = this.props - const { getFieldDecorator } = this.props.form - const { scriptsColumns, systemScripts } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="modal-menu-setting-script"> - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={8}> - <Form.Item label={'鍥炶皟琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> - {setting.cbTable} - </Form.Item> - </Col> - <Col span={16}> - <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0}}> - ErrorCode, retmsg - </Form.Item> - </Col> - <Col span={24} className="sqlfield"> - <Form.Item label={'鍙敤瀛楁'}> - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip> - </Form.Item> - </Col> - {type === 'back' ? <Col span={8} style={{whiteSpace: 'nowrap'}}> - <Form.Item style={{marginBottom: 0}} label="鎵ц浣嶇疆"> - {getFieldDecorator('position', { - initialValue: 'front' - })( - <Radio.Group> - <Radio value="front">sql鍓�</Radio> - <Radio value="back">sql鍚�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - <Col span={10} className="quick-add"> - <Form.Item label={'蹇嵎娣诲姞'} style={{marginBottom: 0}}> - <Select - allowClear - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={this.selectScript} - > - {type === 'back' ? <Select.Option key="default" value={`declare @${setting.cbTable} table (mk_api_key nvarchar(100),mk_level nvarchar(10),mk_id nvarchar(50),mk_bid nvarchar(50))\n/*@${setting.cbTable}_data table (mk_level nvarchar(10),mk_id nvarchar(50),mk_bid nvarchar(50))*/`}>榛樿sql</Select.Option> : null} - {systemScripts.map((option, i) => - <Select.Option style={{whiteSpace: 'normal'}} key={i} value={option.value}>{option.name}</Select.Option> - )} - </Select> - </Form.Item> - </Col> - <Col span={6} className="add"> - <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginTop: 5, marginBottom: 15, marginLeft: 30}}> - 淇濆瓨 - </Button> - <Button onClick={this.handleCancel} style={{marginTop: 5, marginBottom: 15, marginLeft: 10}}> - 鍙栨秷 - </Button> - </Col> - <Col span={24} className="sql"> - <Form.Item label={'sql'}> - {getFieldDecorator('sql', { - initialValue: '' - })(<CodeMirror />)} - </Form.Item> - </Col> - </Row> - </Form> - <EditTable data={scripts} actions={['move']} columns={scriptsColumns} onChange={this.changeScripts}/> - </div> - ) - } -} - -export default Form.create()(CustomForm) \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/simplescript/index.scss b/src/menu/sysinterface/settingform/simplescript/index.scss deleted file mode 100644 index 945809b..0000000 --- a/src/menu/sysinterface/settingform/simplescript/index.scss +++ /dev/null @@ -1,45 +0,0 @@ -.modal-menu-setting-script { - .sqlfield { - .ant-form-item { - margin-bottom: 5px; - } - .ant-form-item-control { - line-height: 24px; - } - .ant-form-item-label { - line-height: 25px; - } - .ant-form-item-children { - line-height: 22px; - } - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - } - } - .quick-add { - .ant-col-sm-8 { - width: 26%; - } - .ant-col-sm-16 { - width: 74%; - } - } - .sql { - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - padding-top: 4px; - } - .CodeMirror { - height: 350px; - } - } - div.ant-typography { - margin-bottom: 0; - } -} \ No newline at end of file diff --git a/src/menu/sysinterface/settingform/utils.jsx b/src/menu/sysinterface/settingform/utils.jsx deleted file mode 100644 index c532c3f..0000000 --- a/src/menu/sysinterface/settingform/utils.jsx +++ /dev/null @@ -1,45 +0,0 @@ - -export default class SettingUtils { - /** - * @description 鐢熸垚鍓嶇疆鎴栧悗缃鍙� - * @return {String} scripts 鑴氭湰 - */ - static getCustomDebugSql (scripts) { - let sql = '' - let _customScript = '' - - scripts.forEach(script => { - if (script.status === 'false') return - - _customScript += ` - ${script.sql} - ` - }) - - if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' - ${_customScript} - ` - } - - _customScript = _customScript.replace(/@\$|\$@/ig, '') - _customScript = _customScript.replace(/@userName@|@fullName@/ig, `''`) - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ - ` - } - sql = sql.replace(/\n\s{8}/ig, '\n') - console.info(sql) - - return sql - } -} \ No newline at end of file diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index c00e0fa..19ec765 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -50,7 +50,7 @@ BID = BData.$BID || '' } - if (_config.wrap.datatype !== 'static') { + if (_config.wrap.datatype === 'dynamic') { _sync = _config.setting.sync === 'true' if (_sync && data) { @@ -113,7 +113,7 @@ config: _config, arr_field: _config.columns.map(col => col.field).join(','), }, () => { - if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') { + if (_config.wrap.datatype === 'dynamic' && _config.setting && _config.setting.sync !== 'true') { setTimeout(() => { this.loadData() }, _config.setting.delay || 0) @@ -130,7 +130,7 @@ MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - if (config.timer) { + if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) } diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 71a8068..b40f01e 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -51,7 +51,7 @@ BID = BData.$BID || '' } - if (_config.wrap.datatype !== 'static') { + if (_config.wrap.datatype === 'dynamic') { _sync = _config.setting.sync === 'true' if (_sync && data) { @@ -122,7 +122,7 @@ config: _config, arr_field: _config.columns.map(col => col.field).join(','), }, () => { - if (_config.wrap.datatype !== 'static' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { + if (_config.wrap.datatype === 'dynamic' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { setTimeout(() => { this.loadData() }, _config.setting.delay || 0) @@ -142,7 +142,7 @@ MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - if (config.timer) { + if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) } diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index fc913f1..c5b37fe 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -48,7 +48,7 @@ BID = BData.$BID || '' } - if (_config.setting && _config.wrap.datatype !== 'static') { + if (_config.setting && _config.wrap.datatype === 'dynamic') { _sync = _config.setting.sync === 'true' if (_sync && data) { @@ -97,7 +97,7 @@ config: _config, arr_field: _config.columns.map(col => col.field).join(','), }, () => { - if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { + if (_config.wrap.datatype === 'dynamic' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { setTimeout(() => { this.loadData() }, _config.setting.delay || 0) @@ -113,7 +113,7 @@ MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - if (config.timer) { + if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { this.loadData('timer') diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 5d026be..1361104 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -277,6 +277,17 @@ } componentDidMount () { + this.getsysScript() + } + + getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -290,18 +301,21 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { + let _scripts = res.data.map(item => { + return { + name: item.funcname, + value: window.decodeURIComponent(window.atob(item.longparam)) + } + }) + + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ - systemScripts: res.data.map(item => { - return { - name: item.funcname, - value: window.decodeURIComponent(window.atob(item.longparam)) - } - }) + systemScripts: _scripts }) } else { notification.warning({ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 62d925c..7d5942b 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -294,6 +294,17 @@ } componentDidMount () { + this.getsysScript() + } + + getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -307,18 +318,21 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { + let _scripts = res.data.map(item => { + return { + name: item.funcname, + value: window.decodeURIComponent(window.atob(item.longparam)) + } + }) + + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ - systemScripts: res.data.map(item => { - return { - name: item.funcname, - value: window.decodeURIComponent(window.atob(item.longparam)) - } - }) + systemScripts: _scripts }) } else { notification.warning({ diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index e80b861..30dc05c 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -27,8 +27,6 @@ state = { interType: 'system', - procMode: 'script', - requestMode: 'system', sysInterface: 'false', controlField: '', tableType: '', @@ -66,8 +64,6 @@ this.setState({ interType: setting.interType || 'system', - procMode: setting.procMode || 'script', - requestMode: setting.requestMode || 'system', controlField: setting.controlField || '', sysInterface: setting.sysInterface || 'false', tableType: setting.tableType, @@ -172,14 +168,6 @@ this.setState({ interType: value }) - } else if (key === 'procMode') { - this.setState({ - procMode: value - }) - } else if (key === 'requestMode') { - this.setState({ - requestMode: value - }) } else if (key === 'sysInterface') { this.setState({ sysInterface: value @@ -204,7 +192,7 @@ render() { const { setting, dict, menu, config, columns } = this.props const { getFieldDecorator } = this.props.form - const { interType, funcRules, funcTooltip, procMode, requestMode, tableType, controlField, sysInterface } = this.state + const { interType, funcRules, funcTooltip, tableType, controlField, sysInterface } = this.state const formItemLayout = { labelCol: { @@ -252,7 +240,6 @@ <Radio value="system">绯荤粺</Radio> <Radio value="inner">鍐呴儴</Radio> <Radio value="outer">澶栭儴</Radio> - <Radio value="custom">鑷畾涔�</Radio> </Radio.Group>)} </Form.Item> </Col> @@ -286,47 +273,7 @@ </Radio.Group>)} </Form.Item> </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label="鍙傛暟澶勭悊"> - {getFieldDecorator('procMode', { - initialValue: procMode, - rules: [ - { - required: true, - message: dict['form.required.select'] + '鍙傛暟澶勭悊鏂瑰紡!' - }, - ] - })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'procMode')}}> - <Radio value="script">鍓嶇疆鑴氭湰</Radio> - <Radio value="inner">鍓嶇疆鍑芥暟</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'custom' && procMode === 'inner' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title={funcTooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍓嶇疆鍑芥暟 - </Tooltip> - }> - {getFieldDecorator('prevFunc', { - initialValue: setting.prevFunc || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '鍓嶇疆鍑芥暟!' - }, - { - max: formRule.func.max, - message: formRule.func.maxMessage - }, - ...funcRules - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - {interType === 'outer' || interType === 'custom' ? <Col className="mk-through-line3" span={24}> + {interType === 'outer' ? <Col className="mk-through-line3" span={24}> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || (interType === 'outer' && sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), @@ -339,7 +286,7 @@ })(<TextArea rows={2} readOnly={interType === 'outer' && sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {(interType === 'outer' && sysInterface !== 'true') || interType === 'custom' ? <Col className="mk-through-line3" span={24}> + {interType === 'outer' && sysInterface !== 'true' ? <Col className="mk-through-line3" span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="姝e紡绯荤粺鎵�浣跨敤鐨勭殑鎺ュ彛鍦板潃銆�"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -351,41 +298,7 @@ })(<TextArea rows={2} />)} </Form.Item> </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label="璇锋眰鏂瑰紡"> - {getFieldDecorator('method', { - initialValue: setting.method || 'post', - rules: [ - { - required: true, - message: dict['form.required.select'] + '璇锋眰鏂瑰紡!' - }, - ] - })( - <Radio.Group> - <Radio value="get">GET</Radio> - <Radio value="post">POST</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label="鏁版嵁璇锋眰"> - {getFieldDecorator('requestMode', { - initialValue: requestMode, - rules: [ - { - required: true, - message: dict['form.required.select'] + '鏁版嵁璇锋眰鏂瑰紡!' - }, - ] - })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'requestMode')}}> - <Radio value="system">绯荤粺鍑芥暟</Radio> - <Radio value="inner">鍐呴儴鍑芥暟</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'inner' || (interType === 'custom' && requestMode === 'inner') ? <Col span={8}> + {interType === 'inner' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={funcTooltip}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -424,7 +337,7 @@ })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} - {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={24} className="mk-through-line3"> + {interType === 'system' ? <Col span={24} className="mk-through-line3"> <Form.Item help={'鏁版嵁ID锛�' + menu.MenuID} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } label={ <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''锛涙煡璇㈡浛鎹㈢ $select@ -> /* 鎴� ''銆� @select$ -> */ 鎴� ''锛涚粺璁℃浛鎹㈢ $sum@ -> /* 鎴� ''銆� @sum$ -> */ 鎴� ''銆俙}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -436,7 +349,7 @@ })(<CodeMirror />)} </Form.Item> </Col> : null} - {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={8}> + {interType === 'system' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'鏌ヨ鏃讹紝鎼滅储鏉′欢浠here鏉′欢鎷兼帴杩涘叆sql锛岀粺璁℃椂锛屽皢鏁版嵁婧愪腑浠モ�淍+鎼滅储瀛楁+@鈥濈殑鍐呭锛屼互鎼滅储鏉′欢涓殑鍊艰繘琛屾浛鎹㈠悗锛屾彁浜ゆ煡璇紝娉細鏌ヨ绫诲瀷浠呭湪浣跨敤绯荤粺鍑芥暟鏃舵湁鏁堛��'}> <QuestionCircleOutlined className="mk-form-tip" /> @@ -452,7 +365,7 @@ </Radio.Group>)} </Form.Item> </Col> : null} - {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={8}> + {interType === 'system' ? <Col span={8}> <Form.Item label="榛樿sql"> {getFieldDecorator('default', { initialValue: setting.default || 'true' @@ -496,77 +409,6 @@ })(<Input placeholder={'ID asc, UID desc'} autoComplete="off" />)} </Form.Item> </Col> - {interType === 'custom' ? <Col span={8}> - <Form.Item label="鍥炶皟鏂瑰紡"> - {getFieldDecorator('callbackType', { - initialValue: setting.callbackType || 'script' - })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}> - <Radio value="default">榛樿鑴氭湰</Radio> - <Radio value="script">鑷畾涔夎剼鏈�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label="鍥炶皟琛ㄥ悕"> - {getFieldDecorator('cbTable', { - initialValue: setting.cbTable || '', - rules: [ - { - required: true, - message: dict['form.required.input'] + '鍥炶皟琛ㄥ悕!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title={'鍚屾鎵ц锛氬閮ㄦ帴鍙h皟鐢ㄦ垚鍔熷悗鍐嶈姹傛暟鎹紱寮傛鎵ц锛氬閮ㄦ帴鍙h皟鐢ㄤ笌璇锋眰鏁版嵁鍚屾椂杩涜銆�'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鎵ц鏂瑰紡 - </Tooltip> - }> - {getFieldDecorator('execType', { - initialValue: setting.execType || 'sync' - })( - <Radio.Group> - <Radio value="sync">鍚屾</Radio> - <Radio value="async">寮傛</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title={'濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 璺ㄥ煙璇锋眰 - </Tooltip> - }> - {getFieldDecorator('cross', { - initialValue: setting.cross || 'true' - })( - <Radio.Group> - <Radio value="true">鏀寔</Radio> - <Radio value="false">涓嶆敮鎸�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {interType === 'custom' ? <Col span={8}> - <Form.Item label="鎵ц娆℃暟"> - {getFieldDecorator('execTime', { - initialValue: setting.execTime || 'once' - })( - <Radio.Group> - <Radio value="always">濮嬬粓</Radio> - <Radio value="once">涓�娆�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} <Col span={8}> <Form.Item label="鏄惁鍒嗛〉"> {getFieldDecorator('laypage', { @@ -688,22 +530,6 @@ </Radio.Group>)} </Form.Item> </Col> - {/* <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鍦ㄦ悳绱㈡潯浠跺瓨鍦ㄦ椂锛屾槸鍚︽樉绀烘悳绱㈠拰閲嶇疆鎸夐挳銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鎼滅储鎸夐挳 - </Tooltip> - }> - {getFieldDecorator('show', { - initialValue: setting.show || 'true' - })( - <Radio.Group> - <Radio value="true">鏄剧ず</Radio> - <Radio value="false">闅愯棌</Radio> - </Radio.Group>)} - </Form.Item> - </Col> */} {tableType !== '' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title="褰撴寜閽墽琛屽畬鎴愬苟杩斿洖涓婚敭鍊兼椂锛岄粯璁ら�変腑涓婚敭鍊煎搴旇銆傛敞锛氬湪鍚敤鏃犱汉鍊煎畧鍔熻兘鏃舵棤鏁堛��"> @@ -733,18 +559,6 @@ })(<InputNumber min={1} max={500} precision={0} />)} </Form.Item> </Col> - {/* <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title="楂樼骇鎼滅储寮圭獥鐨勫搴︼紝娉細褰撳搴﹀�煎皬浜�100鏃惰〃绀哄崰绐楀彛鐨勭櫨鍒嗘瘮锛屽ぇ浜�100鏃惰〃绀哄搴︾殑缁濆鍊笺��"> - <QuestionCircleOutlined className="mk-form-tip" /> - 楂樼骇鎼滅储 - </Tooltip> - }> - {getFieldDecorator('advanceWidth', { - initialValue: setting.advanceWidth || 1000 - })(<InputNumber min={10} max={3000} precision={0}/>)} - </Form.Item> - </Col> */} <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title="鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�"> diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index deae870..3ae2a2c 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -17,7 +17,6 @@ const { Paragraph } = Typography const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) const CustomScript = asyncComponent(() => import('@/templates/zshare/customscript')) -const SimpleScript = asyncComponent(() => import('./simplescript')) class SettingForm extends Component { static propTpyes = { @@ -48,8 +47,6 @@ let _setting = fromJS(config.setting).toJS() let _scripts = _setting.scripts || [] - let _preScripts = _setting.preScripts || [] - let _cbScripts = _setting.cbScripts || [] _setting.default = _setting.default || 'true' // 榛樿sql _setting.sysInterface = _setting.sysInterface || 'false' // 鏄惁涓虹郴缁熸帴鍙� @@ -90,9 +87,6 @@ _search = _search ? 'where ' + _search : '' let status = fromJS(_setting).toJS() - status.requestMode = status.requestMode || 'system' - status.procMode = status.procMode || 'script' - status.callbackType = status.callbackType || 'script' let regoptions = this.getRegOptions(search) if (config.urlFields && config.urlFields.length > 0) { @@ -111,12 +105,6 @@ _scripts.forEach(item => { item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) }) - _preScripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - _cbScripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) if (_setting.dataresource) { _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) } @@ -130,8 +118,6 @@ regoptions: regoptions, // 鎼滅储鏉′欢锛屾鍒欐浛鎹� columns: columns, scripts: _scripts, - preScripts: _preScripts, - cbScripts: _cbScripts, status }) } @@ -241,18 +227,9 @@ } handleConfirm = (trigger) => { - const { activeKey, setting, scripts, preScripts, cbScripts } = this.state + const { activeKey, setting, scripts } = this.state - let _loading = false if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { notification.warning({ top: 92, message: '瀛樺湪鏈繚瀛樿剼鏈紝璇风偣鍑荤‘瀹氫繚瀛橈紝鎴栫偣鍑诲彇娑堟斁寮冧慨鏀癸紒', @@ -274,7 +251,7 @@ }, () => { this.sqlverify(() => { this.setState({loading: false}) - resolve({...res, scripts, preScripts, cbScripts}) + resolve({...res, scripts}) }, () => { this.setState({loading: false}) reject() @@ -289,7 +266,7 @@ return new Promise((resolve, reject) => { this.sqlverify(() => { this.setState({loading: false}) - resolve({...setting, scripts, preScripts, cbScripts}) + resolve({...setting, scripts}) }, () => { this.setState({loading: false}) reject() @@ -298,7 +275,7 @@ } else { this.setState({loading: false}) return new Promise((resolve) => { - resolve({...setting, scripts, preScripts, cbScripts}) + resolve({...setting, scripts}) }) } } @@ -306,7 +283,7 @@ sqlverify = (_resolve, _reject, type, uscripts) => { const { setting, scripts, arr_field, regoptions, search } = this.state - if (setting.interType !== 'system' && setting.requestMode !== 'system') { // 涓嶄娇鐢ㄧ郴缁熸帴鍙f椂锛屼笉闇�瑕乻ql楠岃瘉 + if (setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熸帴鍙f椂锛屼笉闇�瑕乻ql楠岃瘉 _resolve() return } @@ -382,18 +359,9 @@ // 鏍囩鍒囨崲 changeTab = (val) => { - const { activeKey, search, arr_field, setting } = this.state + const { activeKey, search, arr_field } = this.state - let _loading = false if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { notification.warning({ top: 92, message: '瀛樺湪鏈繚瀛樿剼鏈紝璇风偣鍑荤‘瀹氫繚瀛橈紝鎴栫偣鍑诲彇娑堟斁寮冧慨鏀癸紒', @@ -402,43 +370,9 @@ return } - if (activeKey !== 'setting') { - if (setting.interType !== 'system' && setting.requestMode !== 'system' && val === 'scripts') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } else if (setting.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { - notification.warning({ - top: 92, - message: '浣跨敤鑷畾涔夋帴鍙f椂锛屾墠鍙互璁剧疆鍓嶇疆鎴栧洖璋冭剼鏈紒', - duration: 5 - }) - return - } - } - if (activeKey === 'setting') { let _defaultSql = '' this.settingForm.handleConfirm().then(res => { - if (res.interType !== 'system' && res.requestMode !== 'system' && val === 'scripts') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } else if (res.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { - notification.warning({ - top: 92, - message: '浣跨敤鑷畾涔夋帴鍙f椂锛屾墠鍙互璁剧疆鍓嶇疆鎴栧洖璋冭剼鏈紒', - duration: 5 - }) - return - } - if (res.dataresource) { let _dataresource = res.dataresource @@ -534,16 +468,6 @@ scriptsUpdate = (scripts) => { this.setState({scripts}) } - - // 鍓嶇疆鑴氭湰鏇存柊 - preScriptsUpdate = (preScripts) => { - this.setState({preScripts}) - } - - // 鍚庣疆鑴氭湰鏇存柊 - cbScriptsUpdate = (cbScripts) => { - this.setState({cbScripts}) - } handleDelete = (item) => { const { script, scripts } = this.state @@ -573,7 +497,7 @@ render() { const { config, menu, dict } = this.props - const { loading, activeKey, setting, defaultSql, columns, scripts, preScripts, cbScripts, status, regoptions, visible, script, scriptValue } = this.state + const { loading, activeKey, setting, defaultSql, columns, scripts, status, visible, script, scriptValue } = this.state return ( <div className="model-table-setting-form-box"> @@ -596,7 +520,7 @@ 鑷畾涔夎剼鏈� {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} </span> - } disabled={!(status.interType === 'system' || (status.interType === 'custom' && status.requestMode === 'system'))} key="scripts" id="mk-setting-scripts"> + } disabled={status.interType !== 'system'} key="scripts" id="mk-setting-scripts"> {scripts.length ? <BorderOutlined className="full-scripts" onClick={() => { if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { notification.warning({ @@ -618,37 +542,6 @@ scriptsChange={this.scriptsChange} scriptsUpdate={this.scriptsUpdate} wrappedComponentRef={(inst) => this.scriptsForm = inst} - /> - </TabPane> - <TabPane tab={ - <span> - 鍓嶇疆鑴氭湰 - {preScripts.length ? <span className="count-tip">{preScripts.length}</span> : null} - </span> - } disabled={status.interType !== 'custom' || status.procMode !== 'script'} key="prescripts"> - <SimpleScript - dict={dict} - setting={setting} - scripts={preScripts} - regoptions={regoptions} - urlFields={config.urlFields} - searches={this.props.search} - scriptsUpdate={this.preScriptsUpdate} - wrappedComponentRef={(inst) => this.preScriptsForm = inst} - /> - </TabPane> - <TabPane tab={ - <span> - 鍥炶皟鑴氭湰 - {cbScripts.length ? <span className="count-tip">{cbScripts.length}</span> : null} - </span> - } disabled={status.interType !== 'custom' || status.callbackType !== 'script'} key="cbscripts"> - <SimpleScript - dict={dict} - setting={setting} - scripts={cbScripts} - scriptsUpdate={this.cbScriptsUpdate} - wrappedComponentRef={(inst) => this.cbScriptsForm = inst} /> </TabPane> </Tabs> diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.scss b/src/templates/sharecomponent/settingcomponent/settingform/index.scss index 8790751..57831fe 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.scss +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.scss @@ -27,6 +27,13 @@ } } } + .mk-color-move { + height: 40px; + .color-sketch-block { + position: relative; + top: 7px; + } + } .operation-btn { display: inline-block; font-size: 16px; diff --git a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx index 8b00a43..8cdffeb 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx @@ -152,6 +152,13 @@ } getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -170,13 +177,14 @@ Api.getSystemConfig(_sParam).then(res => { if (res.status) { let _scripts = res.data.map(item => { - let _item = { + return { name: item.funcname, value: window.decodeURIComponent(window.atob(item.longparam)) } - return _item }) + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ systemScripts: _scripts }) diff --git a/src/templates/zshare/customscript/index.jsx b/src/templates/zshare/customscript/index.jsx index ecaa177..c5d3eb8 100644 --- a/src/templates/zshare/customscript/index.jsx +++ b/src/templates/zshare/customscript/index.jsx @@ -122,6 +122,12 @@ } getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` _scriptSql = Utils.formatOptions(_scriptSql) @@ -147,6 +153,8 @@ return _item }) + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + this.setState({ systemScripts: _scripts }) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index eca6187..88da467 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -590,7 +590,7 @@ } if (item.btnlog) { - item.btnlog = [] + item.btnlog = null } let oriUids = {} @@ -870,7 +870,7 @@ } if (item.btnlog) { - item.btnlog = [] + item.btnlog = null } let oriUids = {} diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 8e6f9a1..4402d28 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -664,7 +664,7 @@ backElements: [] } ], - headerStyle: {}, parentId: '', width: 24, scripts: [], btnlog: [], pageable: false, + headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, wrap: {name: 'logo', width: 24, datatype: 'static', cardType: '', blacklist: []}, name: 'logo', floor: 1, switchable: true, setting:{interType: 'system'}, tabId: '', style:{paddingTop: '8vh', paddingBottom: '10vh'}, dataName: Utils.getuuid(), format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] @@ -696,7 +696,7 @@ backElements: [] } ], - headerStyle: {}, parentId: '', width: 24, scripts: [], btnlog: [], pageable: false, + headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, wrap: {name: 'Power', width: 24, datatype: 'static', cardType: '', blacklist: []}, name: 'Power', floor: 1, switchable: true, setting:{interType: 'system'}, tabId: '', style:{}, dataName: Utils.getuuid(), format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] diff --git a/src/views/systemfunc/header/index.jsx b/src/views/systemfunc/header/index.jsx index 1d793a5..c146a84 100644 --- a/src/views/systemfunc/header/index.jsx +++ b/src/views/systemfunc/header/index.jsx @@ -32,13 +32,13 @@ <header className="sys-header-container ant-menu-dark"> <div className="header-logo"><img src={MainLogo} alt=""/></div> <div className="title">HS</div> - <div className="close" onClick={() => window.close()}>鍏抽棴</div> <div className="header-setting"> <img src={this.state.avatar} alt=""/> <span> <span className="username">{this.state.userName}</span> </span> </div> + <div className="close" onClick={() => window.close()}>鍏抽棴</div> </header> ) } diff --git a/src/views/systemfunc/header/index.scss b/src/views/systemfunc/header/index.scss index 5311911..9cd8426 100644 --- a/src/views/systemfunc/header/index.scss +++ b/src/views/systemfunc/header/index.scss @@ -31,11 +31,11 @@ } .close { - position: absolute; + float: right; font-size: 16px; color: #ffffff; - right: 90px; - top: 12px; + margin-top: 13px; + margin-right: 15px; cursor: pointer; } -- Gitblit v1.8.0