From 8acfcd6e349ef2d1b797a7483940a2f3f2dfcfe6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 03 二月 2024 17:49:25 +0800 Subject: [PATCH] Merge branch 'develop' --- src/menu/components/tree/antd-tree/options.jsx | 4 src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx | 14 src/menu/components/share/markcomponent/index.jsx | 7 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 7 src/menu/components/chart/antv-scatter/chartcompile/index.jsx | 187 -- src/views/menudesign/printmenuform/index.jsx | 12 src/tabviews/custom/popview/index.jsx | 38 src/menu/components/table/edit-table/options.jsx | 10 src/tabviews/zshare/actionList/shareLink/index.jsx | 193 +++ src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx | 135 +- src/menu/components/table/edit-table/columns/editColumn/index.jsx | 23 src/menu/datasource/verifycard/index.jsx | 17 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 10 src/menu/components/form/formaction/formconfig.jsx | 53 src/tabviews/custom/components/card/cardcellList/index.jsx | 9 src/tabviews/custom/components/card/prop-card/index.jsx | 2 src/menu/components/card/cardcellcomponent/index.jsx | 8 src/menu/components/card/data-card/options.jsx | 12 src/components/editor/index.jsx | 1 src/menu/components/form/tab-form/index.jsx | 14 src/tabviews/custom/components/table/normal-table/index.jsx | 4 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 24 src/tabviews/zshare/mutilform/index.jsx | 37 src/menu/components/share/actioncomponent/actionform/index.jsx | 10 src/tabviews/custom/index.jsx | 38 src/menu/components/table/edit-table/columns/index.jsx | 29 src/menu/datasource/verifycard/utils.jsx | 9 package-lock.json | 18 src/menu/components/chart/antv-dashboard/chartcompile/index.jsx | 195 --- src/tabviews/zshare/topSearch/index.jsx | 179 ++ src/menu/components/form/formaction/actionform/index.jsx | 10 src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 12 src/tabviews/custom/popview/index.scss | 10 src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx | 129 - src/menu/components/form/simple-form/index.jsx | 14 src/tabviews/custom/components/table/edit-table/index.jsx | 8 src/tabviews/zshare/actionList/index.jsx | 10 src/api/index.js | 28 src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx | 9 src/tabviews/custom/components/form/simple-form/index.jsx | 24 src/menu/components/chart/antv-dashboard/chartcompile/index.scss | 7 src/menu/components/table/edit-table/index.jsx | 2 src/templates/zshare/codemirror/index.jsx | 2 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 1 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 99 - src/menu/components/table/base-table/columns/editColumn/index.jsx | 2 src/menu/components/form/step-form/index.jsx | 14 public/manifest.json | 2 src/menu/components/share/colsControl/index.scss | 14 src/menu/datasource/verifycard/settingform/index.jsx | 17 src/tabviews/zshare/actionList/shareLink/index.scss | 0 src/tabviews/zshare/topSearch/mkDatePicker/index.jsx | 38 src/menu/components/share/colsControl/index.jsx | 8 src/utils/utils-datamanage.js | 36 src/components/mkPicture/index.scss | 3 src/tabviews/zshare/normalTable/index.jsx | 2 src/menu/components/share/pasteforms/index.jsx | 2 src/utils/utils-custom.js | 8 src/views/menudesign/homeform/index.jsx | 13 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 2 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 2 src/tabviews/basetable/index.jsx | 34 src/tabviews/custom/index.scss | 8 src/views/billprint/index.jsx | 27 src/menu/components/share/colsControl/markform/index.jsx | 2 src/menu/components/chart/antv-scatter/chartcompile/index.scss | 5 src/tabviews/zshare/actionList/normalbutton/index.jsx | 43 src/tabviews/custom/components/card/data-card/index.jsx | 8 src/components/mkPicture/index.jsx | 17 src/menu/components/card/double-data-card/options.jsx | 12 src/tabviews/custom/components/module/voucher/index.jsx | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 127 ++ src/tabviews/basetable/index.scss | 10 src/menu/debug/index.jsx | 28 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 6 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 12 src/menu/datasource/verifycard/settingform/index.scss | 9 src/tabviews/custom/components/table/base-table/index.jsx | 8 src/views/design/header/index.scss | 36 src/menu/components/table/normal-table/options.jsx | 11 src/components/header/index.jsx | 5 src/tabviews/custom/components/card/double-data-card/index.jsx | 7 src/tabviews/zshare/topSearch/mkSelect/index.jsx | 4 src/menu/components/chart/chart-custom/chartcompile/index.jsx | 6 src/tabviews/custom/components/share/normalTable/index.jsx | 6 src/components/normalform/modalform/mkTable/index.jsx | 13 src/tabviews/custom/components/share/normalheader/index.jsx | 9 src/menu/components/share/markcomponent/index.scss | 14 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 6 src/tabviews/zshare/actionList/exportPdf/index.jsx | 29 src/utils/utils.js | 224 ++- src/index.js | 2 src/menu/components/share/pastecomponent/index.jsx | 6 src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx | 2 src/templates/zshare/formconfig.jsx | 9 src/menu/components/table/base-table/options.jsx | 10 src/templates/zshare/verifycard/index.jsx | 695 +++++------ src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx | 70 /dev/null | 10 src/menu/components/card/cardcellcomponent/formconfig.jsx | 12 src/tabviews/custom/components/card/balcony/index.jsx | 2 package.json | 3 src/templates/zshare/verifycard/baseform/index.jsx | 6 src/utils/option.js | 2 104 files changed, 1,975 insertions(+), 1,409 deletions(-) diff --git a/package-lock.json b/package-lock.json index 48029da..f2a6340 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8409,6 +8409,11 @@ "iconv-lite": "~0.4.13" } }, + "encryptlong": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/encryptlong/-/encryptlong-3.1.4.tgz", + "integrity": "sha512-nx+om7MXaSBSBPBNKKPrOWMot/C0L0Ru8dy9WTyjO5k8Wo+1hsnK0d8uX1UjctkgcgEWhkKhVScniYDjXvnKgw==" + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -12764,6 +12769,11 @@ } } }, + "jsencrypt": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz", + "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -14930,6 +14940,14 @@ } } }, + "node-rsa": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", + "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", + "requires": { + "asn1": "^0.2.4" + } + }, "node-sass": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.12.0.tgz", diff --git a/package.json b/package.json index 07d00b5..bad35c0 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "dragact": "^0.2.12", "echarts": "^5.2.1", "echarts-for-react": "^2.0.15-beta.1", + "encryptlong": "^3.1.4", "eslint": "^6.1.0", "eslint-config-react-app": "^5.0.1", "eslint-loader": "2.2.1", @@ -73,12 +74,14 @@ "jest-watch-typeahead": "0.3.1", "js-table2excel": "^1.0.3", "jsbarcode": "^3.11.3", + "jsencrypt": "^3.3.2", "jspdf": "^2.5.1", "jssha": "^3.2.0", "jszip": "^3.10.0", "md5": "^2.2.1", "mini-css-extract-plugin": "0.5.0", "moment": "^2.24.0", + "node-rsa": "^1.1.1", "node-sass": "^4.12.0", "optimize-css-assets-webpack-plugin": "5.0.3", "pnp-webpack-plugin": "1.5.0", diff --git a/public/manifest.json b/public/manifest.json index 75ffd6a..aa4803e 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,5 +6,5 @@ "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff", - "mk_version": "20240102" + "mk_version": "20240203" } diff --git a/src/api/index.js b/src/api/index.js index cb9a698..cc5223d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -645,7 +645,7 @@ param.sign = md5(values) param.t = new Date().getTime(); - ['arr_field', 'LText_field', 'custom_script', 'LText1', 'LText', 'LText2', 'DateCount'].forEach(key => { + ['arr_field', 'custom_script', 'LText', 'DateCount'].forEach(key => { if (param[key]) { let val = param[key] delete param[key] @@ -755,7 +755,7 @@ param = this.encryptParam(param) axios({ - url: token.interface, + url: `${token.interface}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(res => { @@ -804,7 +804,7 @@ param = this.encryptParam(param) axios({ - url: token.interface, + url: `${token.interface}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(res => { @@ -834,7 +834,7 @@ * @description 鑾峰彇涓氬姟閫氱敤鎺ュ彛 * 璁块棶 'https://sso.mk9h.cn/webapi/dostars'鎴栦簯绔椂锛屼紶鍏serid銆丩oginUID */ - genericInterface (param) { + genericInterface (param, script = '', position) { param.userid = param.userid || sessionStorage.getItem('UserID') || '' param.lang = param.lang || sessionStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' @@ -859,7 +859,25 @@ } } - if (param.$login) { + if (script) { + try { + // eslint-disable-next-line + let func = new Function('axios', 'Api', 'param', 'position', 'systemType', script) + let promise = func(axios, this, param, position, window.GLOB.systemType) + + if (promise instanceof Promise) { + return promise + } + } catch (e) { + console.warn(e) + } + + return Promise.resolve({ + status: false, + message: '鑷畾涔夎剼鏈墽琛岄敊璇�', + ErrCode: 'E' + }) + } else if (param.$login) { let rduri = param.rduri || '' delete param.$login diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx index fb02a69..ede20dc 100644 --- a/src/components/editor/index.jsx +++ b/src/components/editor/index.jsx @@ -4,7 +4,6 @@ import BraftEditor from 'braft-editor' import 'braft-editor/dist/index.css' import 'braft-extensions/dist/table.css' -// import 'braft-editor/dist/output.css' import Table from 'braft-extensions/dist/table' import SparkMD5 from 'spark-md5' import moment from 'moment' diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 7bc1c43..1600d6b 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -31,7 +31,8 @@ searchkey: '', thdMenuList: [], debug: sessionStorage.getItem('debug') === 'true' && window.GLOB.memberLevel > 0, - collapse: sessionStorage.getItem('collapse') === 'true' + collapse: sessionStorage.getItem('collapse') === 'true', + lang: sessionStorage.getItem('lang') || '' } UNSAFE_componentWillMount () { @@ -788,7 +789,7 @@ </Dropdown> {/* 缂栬緫鐘舵�佺櫥褰� */} <Modal - title="鐧诲綍寮�鍙戞満" + title={<span>鐧诲綍寮�鍙戞満{this.state.lang === 'en-US' ? <span style={{color: 'red'}}>锛堣嫳鏂囷級</span> : ''}</span>} visible={this.state.loginVisible} onOk={this.loginSubmit} width={'430px'} diff --git a/src/components/mkPicture/index.jsx b/src/components/mkPicture/index.jsx index e4b8f39..6ddb479 100644 --- a/src/components/mkPicture/index.jsx +++ b/src/components/mkPicture/index.jsx @@ -9,6 +9,7 @@ class MkPicture extends Component { static propTpyes = { style: PropTypes.object, + lostTip: PropTypes.bool, scale: PropTypes.bool, url: PropTypes.string, urls: PropTypes.array, @@ -20,24 +21,26 @@ } UNSAFE_componentWillMount() { - const { url } = this.props + const { url, lostTip } = this.props if (url) { this.setState({url: url, lost: false}) this.checkUrl(url) } else { - this.setState({url: LostPng, lost: true}) + this.setState({url: lostTip ? LostPng: '', lost: true}) } } UNSAFE_componentWillReceiveProps (nextProps) { + const { lostTip } = this.props + if (nextProps.url) { if (nextProps.url !== this.state.url) { this.setState({url: nextProps.url, lost: false}) this.checkUrl(nextProps.url) } } else { - this.setState({url: LostPng, lost: true}) + this.setState({url: lostTip ? LostPng: '', lost: true}) } } @@ -63,9 +66,15 @@ } render() { - const { style, scale, urls } = this.props + const { style, scale, urls, lostTip } = this.props const { url, lost } = this.state + if (!lostTip && !url) { + return ( + <div className="ant-mk-picture empty" style={style}></div> + ) + } + return ( <div className={'ant-mk-picture' + (scale ? ' scale' : '') + (lost ? ' lost' : '')} diff --git a/src/components/mkPicture/index.scss b/src/components/mkPicture/index.scss index 3d6e51e..8922f76 100644 --- a/src/components/mkPicture/index.scss +++ b/src/components/mkPicture/index.scss @@ -6,6 +6,9 @@ .ant-mk-picture.lost { background-size: contain!important; } +.ant-mk-picture.empty { + background: transparent!important; +} .ant-mk-picture.scale { cursor: zoom-in; } \ No newline at end of file diff --git a/src/components/normalform/modalform/mkTable/index.jsx b/src/components/normalform/modalform/mkTable/index.jsx index 1baf22f..341e32a 100644 --- a/src/components/normalform/modalform/mkTable/index.jsx +++ b/src/components/normalform/modalform/mkTable/index.jsx @@ -276,7 +276,18 @@ columns.forEach(col => { if (col.unique !== true || !unique) return - let _index = newData.findIndex(item => record.uuid !== item.uuid && record[col.dataIndex] === item[col.dataIndex]) + let _index = newData.findIndex(item => { + if (record.uuid === item.uuid) return false + + if (col.inputType === 'cascader') { + if (!Array.isArray(record[col.dataIndex]) || !Array.isArray(item[col.dataIndex])) { + return false + } + return record[col.dataIndex].toString() === item[col.dataIndex].toString() + } + + return record[col.dataIndex] === item[col.dataIndex] + }) if (_index > -1) { notification.warning({ diff --git a/src/index.js b/src/index.js index 17fcdf1..246d3bb 100644 --- a/src/index.js +++ b/src/index.js @@ -35,7 +35,7 @@ if (!config) return if (config.defaultApp) { - if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { + if (/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent)) { window.location.replace(window.location.href.split(/(index.html)+/ig)[0].replace('admin/', '') + 'mob/index.html#/index') return } diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 3d140fc..1a96928 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -164,7 +164,10 @@ } else { _options.push('value') } - if (this.record.eleType === 'video' && this.record.posterType) { + + if (this.record.eleType === 'picture' && this.record.noValue === 'show') { + _options.push('lostTip') + } else if (this.record.eleType === 'video' && this.record.posterType) { if (this.record.posterType === 'dynamic') { _options.push('posterField') } else { @@ -341,7 +344,7 @@ return item }) }) - } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType'].includes(key)) { + } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue'].includes(key)) { let _options = this.getOptions() this.setState({ diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 2f83093..f0464b2 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -675,6 +675,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'alignItems', label: '鍨傜洿瀵归綈', initVal: card.alignItems || '', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index f0249c1..b58ca78 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -245,6 +245,10 @@ } else if (_card.eleType === 'picture') { _card.style = style delete _card.style.backgroundImage + delete _card.style.paddingTop + delete _card.style.paddingBottom + delete _card.style.paddingLeft + delete _card.style.paddingRight } else { _card.style = style } @@ -415,6 +419,10 @@ res.innerHeight = res.barHeight + (res.displayValue === 'true' ? fontSize + 2 : 0) } else if (res.eleType === 'picture') { delete res.style.backgroundImage + delete res.style.paddingTop + delete res.style.paddingBottom + delete res.style.paddingLeft + delete res.style.paddingRight } return res diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 3d2fa34..d220750 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -187,6 +187,7 @@ ], controlFields: [ {field: 'slidetip', values: ['slide']}, + {field: 'maxPageSize', values: ['page']}, ], forbid: subtype === 'propcard' }, @@ -621,6 +622,17 @@ forbid: !!appType || subtype !== 'datacard' || isprint }, { + type: 'number', + field: 'maxPageSize', + label: '姣忛〉鏈�澶ф暟', + initval: wrap.maxPageSize || '', + min: 10, + max: 500, + precision: 0, + required: false, + forbid: !laypage || appType === 'mob' || subtype !== 'datacard' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx index 591c305..91625de 100644 --- a/src/menu/components/card/double-data-card/options.jsx +++ b/src/menu/components/card/double-data-card/options.jsx @@ -75,6 +75,7 @@ ], controlFields: [ {field: 'slidetip', values: ['slide']}, + {field: 'maxPageSize', values: ['page']}, ], }, { @@ -273,6 +274,17 @@ forbid: !!appType || isprint }, { + type: 'number', + field: 'maxPageSize', + label: '姣忛〉鏈�澶ф暟', + initval: wrap.maxPageSize || '', + min: 10, + max: 500, + precision: 0, + required: false, + forbid: !laypage || appType === 'mob' + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 3b9d0e8..f0b3e10 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -407,27 +407,11 @@ value: 'false', label: '闅愯棌' }] - // }, { - // type: 'radio', - // field: 'transpose', - // label: '鍙樻崲', - // initval: card.transpose || 'false', - // tooltip: '妯旱鍧愭爣杞翠氦鎹�', - // forbid: card.chartType === 'line', - // required: false, - // options: [{ - // value: 'true', - // label: '鏄�' - // }, { - // value: 'false', - // label: '鍚�' - // }] }, { type: 'radio', field: 'show', label: '鏄剧ず', initval: card.show || 'value', - // tooltip: '褰撲娇鐢ㄨ嚜瀹氫箟璁剧疆鏃讹紝鍙湪鏄剧ず锛堝��/%锛夊鍗曠嫭璁剧疆鏄剧ず绫诲瀷銆傛敞锛氳嚜瀹氫箟涓虹┖鏃朵娇鐢ㄦ澶勮缃��', required: false, options: [{ value: 'value', @@ -450,34 +434,6 @@ controlFields: [ {field: 'labelColor', values: ['true']} ] - // }, { - // type: 'radio', - // field: 'labelColor', - // label: '鏍囨敞棰滆壊', - // initval: card.labelColor || 'system', - // tooltip: '浣跨敤绯荤粺鑹叉椂锛屼娇鐢ㄨ壊绯婚�夐」璁剧疆鐨勭郴缁熼鑹诧紝浣跨敤鑷畾涔変负棰滆壊璁剧疆涓畾涔夌殑鍥惧舰棰滆壊銆�', - // required: false, - // options: [{ - // value: 'system', - // label: '绯荤粺' - // }, { - // value: 'custom', - // label: '鑷畾涔�' - // }] - // }, { - // type: 'radio', - // field: 'labelValue', - // label: '鏍囨敞鍊�', - // initval: card.labelValue || 'default', - // tooltip: '鏍囨敞鍊肩殑鏄剧ず瑙勫垯銆�', - // required: false, - // options: [{ - // value: 'default', - // label: '榛樿' - // }, { - // value: 'zero', - // label: '闅愯棌 0 鍊�' - // }], }, { type: 'radio', field: 'adjust', @@ -533,20 +489,6 @@ value: 'false', label: '涓嶆樉绀�' }] - // }, { - // type: 'radio', - // field: 'coordinate', - // label: '鍧愭爣', - // initval: card.coordinate || 'angle', - // required: false, - // forbid: card.chartType === 'line', - // options: [{ - // value: 'angle', - // label: '浜岀淮鍧愭爣' - // }, { - // value: 'polar', - // label: '鏋佸潗鏍�' - // }] }, { type: 'checkbox', field: 'axis', @@ -585,47 +527,6 @@ controlFields: [ {field: 'color', notNull: true}, ] - // }, { - // type: 'radio', - // field: 'grid', - // label: '缃戞牸绾�', - // initval: card.grid || 'show', - // required: false, - // options: [{ - // value: 'show', - // label: '鏄剧ず' - // }, { - // value: 'hidden', - // label: '闅愯棌' - // }] - // }, { - // type: 'radio', - // field: 'y_line', - // label: 'y杞磋竟绾�', - // initval: card.y_line || 'hidden', - // tooltip: '鍥惧舰宸︿晶鎴栧彸渚х殑杈圭嚎銆�', - // required: false, - // options: [{ - // value: 'show', - // label: '鏄剧ず' - // }, { - // value: 'hidden', - // label: '闅愯棌' - // }] - // }, { - // type: 'radio', - // field: 'download', - // label: '瀵煎嚭鍥剧墖', - // initval: card.download || 'forbid', - // required: false, - // forbid: appType === 'mob', - // options: [{ - // value: 'forbid', - // label: '绂佺敤' - // }, { - // value: 'enable', - // label: '鍚敤' - // }] }, { type: 'radio', field: 'empty', diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx index b54089c..748ad3f 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx @@ -20,24 +20,24 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -46,43 +46,42 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint @@ -101,24 +100,24 @@ return [ { type: 'text', - key: 'label', + field: 'label', label: '鎸囨爣鍚嶇О', - initVal: card.label || '', + initval: card.label || '', required: false }, { type: 'select', - key: 'valueField', + field: 'valueField', label: '鏄剧ず鍊�', - initVal: card.valueField || '', + initval: card.valueField || '', required: true, options: yfields }, { type: 'number', - key: 'maxValue', + field: 'maxValue', label: '鏈�澶у��', - initVal: card.maxValue || 100, + initval: card.maxValue || 100, tooltip: '浠〃鐩樻渶澶у埢搴﹀��', min: 0, max: 999999, @@ -127,9 +126,9 @@ }, { type: 'number', - key: 'tickInterval', + field: 'tickInterval', label: '闂撮殧', - initVal: card.tickInterval || 10, + initval: card.tickInterval || 10, tooltip: '浠〃鐩樺埢搴﹂棿闅斿�笺��', min: 0, max: 999999, @@ -138,56 +137,58 @@ }, { type: 'radio', - key: 'percent', + field: 'percent', label: '鐧惧垎鐜�', - initVal: card.percent || 'true', + initval: card.percent || 'true', required: false, options: [{ value: 'true', - text: '浣跨敤' + label: '浣跨敤' }, { value: 'false', - text: '涓嶄娇鐢�' + label: '涓嶄娇鐢�' }] // }, { // type: 'radio', - // key: 'download', + // field: 'download', // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', + // initval: card.download || 'forbid', // required: false, // forbid: appType === 'mob', // options: [{ // value: 'forbid', - // text: '绂佺敤' + // label: '绂佺敤' // }, { // value: 'enable', - // text: '鍚敤' + // label: '鍚敤' // }] }, // { // type: 'radio', - // key: 'empty', + // field: 'empty', // label: '绌哄�奸殣钘�', - // initVal: card.empty || 'show', + // initval: card.empty || 'show', // tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', // required: false, // options: [ - // {value: 'show', text: '鍚�'}, - // {value: 'hidden', text: '鏄�'}, + // {value: 'show', label: '鍚�'}, + // {value: 'hidden', label: '鏄�'}, // ], // }, { type: 'color', - key: 'tickColor', + field: 'tickColor', label: '鍒诲害绾�', - initVal: card.tickColor || '#CBCBCB', + initval: card.tickColor || '', + allowClear: true, required: false }, { type: 'color', - key: 'labelColor', + field: 'labelColor', label: '鎸囨爣棰滆壊', - initVal: card.labelColor || '#545454', + initval: card.labelColor || '', + allowClear: true, required: false } ] @@ -206,25 +207,25 @@ return [ { type: 'select', - key: 'labelField', + field: 'labelField', label: '鎸囨爣', - initVal: card.labelField || '', + initval: card.labelField || '', required: true, options: xfields }, { type: 'select', - key: 'valueField', + field: 'valueField', label: '鍊�', - initVal: card.valueField || '', + initval: card.valueField || '', required: true, options: yfields }, { type: 'number', - key: 'maxValue', + field: 'maxValue', label: '鏈�澶у��', - initVal: card.maxValue || 100, + initval: card.maxValue || 100, min: 0, max: 999999, decimal: 1, @@ -232,9 +233,9 @@ }, { type: 'number', - key: 'radius', + field: 'radius', label: '澶栫幆', - initVal: card.radius || 75, + initval: card.radius || 75, tooltip: '鍥惧舰鎵�鍗犲尯鍩熺殑鐧惧垎鐜囥��', min: 30, max: 100, @@ -243,9 +244,9 @@ }, { type: 'number', - key: 'fontSize', + field: 'fontSize', label: '瀛椾綋澶у皬', - initVal: card.fontSize || 28, + initval: card.fontSize || 28, min: 12, max: 300, decimal: 0, @@ -253,44 +254,46 @@ }, { type: 'radio', - key: 'percent', + field: 'percent', label: '鐧惧垎鐜�', - initVal: card.percent || 'true', + initval: card.percent || 'true', required: false, options: [{ value: 'true', - text: '浣跨敤' + label: '浣跨敤' }, { value: 'false', - text: '涓嶄娇鐢�' + label: '涓嶄娇鐢�' }] // }, { // type: 'radio', - // key: 'download', + // field: 'download', // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', + // initval: card.download || 'forbid', // required: false, // forbid: appType === 'mob', // options: [{ // value: 'forbid', - // text: '绂佺敤' + // label: '绂佺敤' // }, { // value: 'enable', - // text: '鍚敤' + // label: '鍚敤' // }] }, { type: 'color', - key: 'backColor', + field: 'backColor', label: '鑳屾櫙鑹�', - initVal: card.backColor || '#ebedf0', + initval: card.backColor || '', + allowClear: true, required: false }, { type: 'color', - key: 'labelColor', + field: 'labelColor', label: '瀛椾綋棰滆壊', - initVal: card.labelColor || '#8c8c8c', + initval: card.labelColor || '', + allowClear: true, required: false } ] diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx index 71f4cc1..e1d3c40 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx @@ -1,19 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, notification, Tabs, Button } from 'antd' -import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import { Modal, Form, notification, Tabs, Button } from 'antd' +import { EditOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import { getBaseForm, getOptionForm, getRadioOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' -import ColorSketch from '@/mob/colorsketch' import './index.scss' const { TabPane } = Tabs const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) class LineChartDrawerForm extends Component { static propTpyes = { @@ -61,156 +60,20 @@ }) } - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - const fields = [] - - if (!formlist) { - return fields - } - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group disabled={item.readonly}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - })} - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'color') { - fields.push( - <Col span={12} key={index} className="color-col"> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })( - <ColorSketch /> - )} - </Form.Item> - </Col> - ) - } - }) - return fields - } - onSubmit = () => { const { config } = this.props const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} - - this.setState({ - plot: _plot, - visible: false - }) - - this.props.plotchange({...config, plot: _plot}) - } + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} + + this.setState({ + plot: _plot, + visible: false + }) + + this.props.plotchange({...config, plot: _plot}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -236,15 +99,13 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} - this.setState({ - plot: _plot, - view: tab - }) - } + this.setState({ + plot: _plot, + view: tab + }) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -295,20 +156,10 @@ render() { const { config } = this.props - const { visible, plot, colorColumns, view, baseFormlist } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 6 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 18 } - } - } + const { visible, plot, colorColumns, view, baseFormlist, formlist } = this.state return ( - <div className="line-chart-drawer-form"> + <div className="dashboard-chart-drawer-form"> <EditOutlined title="缂栬緫" onClick={this.showDrawer} /> <Modal wrapClassName="mk-pop-modal" @@ -322,12 +173,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> - <Form {...formItemLayout}> - <Row gutter={16}>{this.getFields()}</Row> - </Form> + <ModalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/> </TabPane> {plot ? <TabPane tab="棰滆壊璁剧疆" key="color"> <div> diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.scss b/src/menu/components/chart/antv-dashboard/chartcompile/index.scss index 9707fbb..c6b58b1 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.scss +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.scss @@ -1,15 +1,10 @@ -.line-chart-drawer-form { +.dashboard-chart-drawer-form { display: inline-block; > .anticon-edit { color: #1890ff; } } .menu-chart-edit-box { - .color-sketch-block { - position: relative; - top: 5px; - width: 240px; - } .color-add { float: right; margin-bottom: 10px; diff --git a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx index bf6ed7b..66afe79 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx @@ -20,24 +20,24 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -46,43 +46,42 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint @@ -103,126 +102,90 @@ return [ { type: 'select', - key: 'gender', + field: 'gender', label: '绫诲瀷', - initVal: card.gender || '', + initval: card.gender || '', required: true, options: xfields }, { type: 'select', - key: 'Xaxis', + field: 'Xaxis', label: 'X-杞�', - initVal: card.Xaxis || '', + initval: card.Xaxis || '', required: true, options: columns }, { type: 'select', - key: 'Yaxis', + field: 'Yaxis', label: 'Y-杞�', - initVal: card.Yaxis || '', + initval: card.Yaxis || '', required: true, options: yfields }, { type: 'radio', - key: 'shape', + field: 'shape', label: '褰㈢姸', - initVal: card.shape || 'circle', + initval: card.shape || 'circle', required: false, options: [{ value: 'circle', - text: 'circle' + label: '鍦嗗舰' }, { value: 'square', - text: 'square' + label: '鏂瑰舰' }] }, { type: 'radio', - key: 'tooltip', + field: 'tooltip', label: '鎮诞鎻愮ず', - initVal: card.tooltip || 'true', + initval: card.tooltip || 'true', required: false, options: [{ value: 'true', - text: '鏄剧ず' + label: '鏄剧ず' }, { value: 'false', - text: '闅愯棌' + label: '闅愯棌' }] - // }, { - // type: 'radio', - // key: 'download', - // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', - // required: false, - // forbid: appType === 'mob', - // options: [{ - // value: 'forbid', - // text: '绂佺敤' - // }, { - // value: 'enable', - // text: '鍚敤' - // }] }, { type: 'radio', - key: 'empty', + field: 'empty', label: '绌哄�奸殣钘�', - initVal: card.empty || 'show', + initval: card.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, options: [ - {value: 'show', text: '鍚�'}, - {value: 'hidden', text: '鏄�'}, + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, ], }, { type: 'text', - key: 'Xunit', + field: 'Xunit', label: 'X杞村崟浣�', - initVal: card.Xunit || '', + initval: card.Xunit || '', required: false }, { type: 'text', - key: 'Yunit', + field: 'Yunit', label: 'Y杞村崟浣�', - initVal: card.Yunit || '', + initval: card.Yunit || '', required: false }, { type: 'color', - key: 'color', - label: '鑹茬郴', - initVal: card.color || 'rgba(0, 0, 0, 0.65)', - tooltip: '鍧愭爣杞存彁绀烘枃瀛楀強绀轰緥鐨勯鑹层��', + field: 'lineColor', + label: '鍧愭爣杞撮鑹�', + initval: card.lineColor || '', + tooltip: '鍧愭爣杞寸嚎鐨勯鑹层��', + allowClear: true, required: false } - // , { - // type: 'select', - // key: 'interaction', - // label: '浜や簰鏁堟灉', - // initVal: card.interaction || [], - // multi: true, - // required: false, - // forbid: appType === 'mob', - // options: [ - // { value: 'element-active', label: '鍏冪礌鑱氱劍' }, - // { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, - // { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, - // // { value: 'active-region', label: '鑳屾櫙妗�' }, - // { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, - // { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, - // { value: 'legend-filter', label: '鍥句緥杩囨护' }, - // { value: 'legend-active', label: '鍥句緥鑱氱劍' }, - // { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, - // { value: 'brush', label: '閫夋杩囨护' }, - // ] - // } ] } diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx index 4d829ba..307f6b6 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx @@ -1,16 +1,15 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, Tabs } from 'antd' -import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import { Modal, Form, Tabs } from 'antd' +import { EditOutlined } from '@ant-design/icons' import { getBaseForm, getOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' -import ColorSketch from '@/mob/colorsketch' import './index.scss' const { TabPane } = Tabs -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) class LineChartDrawerForm extends Component { static propTpyes = { @@ -39,156 +38,20 @@ }) } - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - const fields = [] - - if (!formlist) { - return fields - } - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field || option.value}> - {option.label || option.text} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group disabled={item.readonly}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - })} - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'color') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })( - <ColorSketch /> - )} - </Form.Item> - </Col> - ) - } - }) - return fields - } - onSubmit = () => { const { config } = this.props const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} - this.setState({ - plot: _plot, - visible: false - }) + this.setState({ + plot: _plot, + visible: false + }) - this.props.plotchange({...config, plot: _plot}) - } + this.props.plotchange({...config, plot: _plot}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -208,13 +71,11 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - this.setState({ - plot: {...plot, ...values}, - view: tab - }) - } + this.normalRef.handleConfirm().then(values => { + this.setState({ + plot: {...plot, ...values}, + view: tab + }) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -228,17 +89,7 @@ render() { const { config } = this.props - const { view, visible, baseFormlist } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 6 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 18 } - } - } + const { view, visible, baseFormlist, formlist } = this.state return ( <div className="line-chart-drawer-form"> @@ -255,12 +106,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> - <Form {...formItemLayout}> - <Row gutter={16}>{this.getFields()}</Row> - </Form> + <ModalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/> </TabPane> </Tabs> </Modal> diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.scss b/src/menu/components/chart/antv-scatter/chartcompile/index.scss index 5518e39..7100c66 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/index.scss +++ b/src/menu/components/chart/antv-scatter/chartcompile/index.scss @@ -5,11 +5,6 @@ } } .menu-chart-edit-box { - .color-sketch-block { - position: relative; - top: 5px; - width: 240px; - } .color-add { float: right; margin-bottom: 10px; diff --git a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx index 724fe6a..7294517 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx @@ -20,35 +20,35 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'radio', - key: 'chartType', + field: 'chartType', label: '鍥捐〃绫诲瀷', - initVal: card.chartType || 'antv', + initval: card.chartType || 'antv', required: true, options: [ - { value: 'antv', text: 'antv' }, - { value: 'echarts', text: 'echarts' } + { value: 'antv', label: 'antv5.0' }, + { value: 'echarts', label: 'echarts' } ] }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -57,67 +57,45 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint - }, - // { - // type: 'cascader', - // key: 'linkmenu', - // label: '鍏宠仈鑿滃崟', - // initVal: card.linkmenu || [], - // tooltip: '鍦ㄤ娇鐢ㄦ煴褰㈠浘涓旀湭鍚敤鑷畾涔夎缃椂鏈夋晥銆�', - // required: false, - // forbid: appType === 'pc' || appType === 'mob', - // options: menulist - // }, - // { - // type: 'select', - // key: 'linkmenu', - // label: '鍏宠仈鑿滃崟', - // initVal: card.linkmenu || '', - // tooltip: '鍙屽嚮鏌辩姸鍥撅紝浼氭墦寮�鍏宠仈鐨勮彍鍗曘��', - // required: false, - // forbid: appType !== 'pc', - // options: menulist - // }, - + } ] } \ No newline at end of file diff --git a/src/menu/components/chart/chart-custom/chartcompile/index.jsx b/src/menu/components/chart/chart-custom/chartcompile/index.jsx index 5ab0fa2..562c075 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/index.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/index.jsx @@ -9,7 +9,7 @@ // import './index.scss' const { TabPane } = Tabs -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) class CustomChartDrawerForm extends Component { @@ -104,10 +104,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> {plot ? <TabPane tab="JS" key="JS"> - {plot.chartType === 'antv' ? <div>鍏ュ弬锛欳hart銆� DataSet銆� wrap锛坉om鑺傜偣锛夈�乨ata銆� config</div> : <div>鍏ュ弬锛歟charts銆� DataSet銆� wrap锛坉om鑺傜偣锛夈�� data銆� config</div>} + {plot.chartType === 'antv' ? <div>鍏ュ弬锛欳hart銆� chartId锛坉om鑺傜偣id锛夈�乨ata銆� config</div> : <div>鍏ュ弬锛歟charts銆� chartId锛坉om鑺傜偣id锛夈�� data銆� config</div>} <CodeMirror mode="text/javascript" theme="cobalt" value={plot.script} onChange={this.onChange} /> </TabPane> : null} </Tabs> diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 69ca082..09c15d7 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -57,10 +57,13 @@ } else if (this.record.type === 'close' || this.record.type === 'reset') { shows = ['typeName', 'label'] } else { - shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 閫夐」鍒楄〃 + shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'formCache'] // 閫夐」鍒楄〃 if (this.record.execSuccess === 'never') { shows.push('resetForms') + } + if (this.record.syncComponent && this.record.syncComponent[0]) { + shows.push('syncDelay') } if (this.record.intertype === 'custom') { shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify', 'ContentType', 'outerBlacklist') @@ -102,6 +105,9 @@ shows.push('innerFunc') } else { shows.push('sql', 'sqlType') + if (this.record.execSuccess === 'never' && this.record.resetForms && this.record.resetForms[0]) { + shows.push('returnValue') + } } if (this.record.linkmenu && this.record.linkmenu !== 'goback') { @@ -260,7 +266,7 @@ message: '璇疯緭鍏�' + item.label + '!' } ] - })(<InputNumber min={0} max={10000} precision={0} onPressEnter={this.handleSubmit}/>)} + })(<InputNumber min={0} max={10000} placeholder={item.placeholder || ''} precision={0} onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> ) diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index f6800ae..1a4e306 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -127,10 +127,17 @@ fields.forEach(item => { if (item.type !== 'text' && item.type !== 'number') return - resets.push({ - value: item.field, - text: item.label - }) + if (item.label !== item.field) { + resets.push({ + value: item.field, + text: item.label + ' (' + item.field + ')' + }) + } else { + resets.push({ + value: item.field, + text: item.label + }) + } }) return [ @@ -467,6 +474,15 @@ options: modules }, { + type: 'number', + key: 'syncDelay', + label: '鍒锋柊寤惰繜', + initVal: card.syncDelay, + tooltip: '鍚屾鍒锋柊缁勪欢鐨勫欢杩熸椂闂达紝鍗曚綅姣銆�', + // placeholder: '鍗曚綅姣', + required: false + }, + { type: 'cascader', key: 'anchors', label: '璺宠浆閿氱偣', @@ -497,6 +513,20 @@ }, { type: 'radio', + key: 'returnValue', + label: '鏇存柊琛ㄥ崟', + initVal: card.returnValue || 'false', + tooltip: '涓庨噸缃〃鍗曢厤鍚堜娇鐢紝寮�鍚椂锛屽繀椤诲湪鑷畾涔夎剼鏈腑杩斿洖鏁版嵁锛岀敤浜庢浛鎹㈠瓧娈甸泦鍜屽~鍏呰〃鍗曘��', + options: [{ + value: 'false', + text: '绂佺敤' + }, { + value: 'true', + text: '鍚敤' + }] + }, + { + type: 'radio', key: 'reload', label: '涓婁竴椤�', initVal: card.reload || 'false', @@ -510,5 +540,20 @@ text: '鍒锋柊' }] }, + // { + // type: 'radio', + // key: 'formCache', + // label: '琛ㄥ崟缂撳瓨', + // initVal: card.formCache || 'false', + // tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + // required: false, + // options: [{ + // value: 'false', + // text: '涓嶆竻绌�' + // }, { + // value: 'clear', + // text: '娓呯┖' + // }] + // }, ] } diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index b5e6fb1..3a0bf93 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -140,6 +140,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true @@ -161,6 +168,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 47e1fb8..dd919dc 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -147,6 +147,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true @@ -168,6 +175,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index 9368450..66e8181 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -159,6 +159,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true @@ -180,6 +187,13 @@ if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) } + if (item.subButton.verify && !item.subButton.output) { + if (item.subButton.verify.noteEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (item.subButton.verify.emailEnable === 'true') { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 0c97afe..2239c41 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -14,9 +14,9 @@ const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) const acTyOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'], + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton', 'formCache'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], @@ -505,6 +505,8 @@ } else if (_funcType === 'refund') { shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) + } else if (_funcType === 'shareLink') { + shows.push('shortUrl', 'shareUrl', 'shareProUrl', 'shareTip') // } else if (_funcType === 'expPdf') { // shows.push('exportType') } @@ -525,7 +527,7 @@ shows.push('reason') } } - } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) { + } else if (openType !== 'funcbutton' || !['expPdf', 'shareLink'].includes(this.record.funcType)) { if (openType !== 'excelOut') { reOptions.control = [ { value: '', text: '鏃�' }, diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index be2b2cd..24a4df8 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -162,6 +162,7 @@ { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -205,6 +206,7 @@ { value: 'clearCache', text: '娓呯┖鏈湴閰嶇疆' }, { value: 'copyurl', text: '澶嶅埗閾炬帴鍦板潃' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'logout', text: '閫�鍑�' }, { value: 'goBack', text: '杩斿洖' }, ] @@ -766,6 +768,43 @@ }] }, { + type: 'radio', + key: 'shortUrl', + label: '鐭摼鎺�', + initVal: card.shortUrl || 'false', + options: [{ + value: 'false', + text: '绂佺敤' + }, { + value: 'true', + text: '鍚敤' + }] + }, + { + type: 'textarea', + key: 'shareUrl', + label: '閾炬帴鍦板潃', + initVal: card.shareUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: true + }, + { + type: 'textarea', + key: 'shareProUrl', + label: '姝e紡閾炬帴', + initVal: card.shareProUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: false + }, + { + type: 'text', + key: 'shareTip', + label: '鍒嗕韩鎻愮ず', + initVal: card.shareTip || '', + tooltip: '鍒嗕韩鏃跺鐢ㄦ埛鐨勬彁绀轰俊鎭��', + required: false + }, + { type: 'number', key: 'width', min: 0, @@ -1236,6 +1275,21 @@ }, { type: 'radio', + key: 'formCache', + label: '琛ㄥ崟缂撳瓨', + initVal: card.formCache || 'false', + tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + required: false, + options: [{ + value: 'false', + text: '涓嶆竻绌�' + }, { + value: 'clear', + text: '娓呯┖' + }] + }, + { + type: 'radio', key: 'hidden', label: '闅愯棌', initVal: card.hidden || 'false', @@ -1386,6 +1440,7 @@ dataIndex: 'syncComId', inputType: 'cascader', editable: true, + unique: true, required: true, extends: [{key: 'label', value: 'label'}], width: '70%', @@ -1461,6 +1516,7 @@ { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -1932,17 +1988,54 @@ // }] // }, { - type: 'number', - key: 'width', - min: 1, - max: 24, - precision: 0, - label: '瀹藉害', - initVal: card.width || 12, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', - forbid: card.eleType !== 'button', + type: 'radio', + key: 'shortUrl', + label: '鐭摼鎺�', + initVal: card.shortUrl || 'false', + options: [{ + value: 'false', + text: '绂佺敤' + }, { + value: 'true', + text: '鍚敤' + }] + }, + { + type: 'textarea', + key: 'shareUrl', + label: '閾炬帴鍦板潃', + initVal: card.shareUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', required: true }, + { + type: 'textarea', + key: 'shareProUrl', + label: '姝e紡閾炬帴', + initVal: card.shareProUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: false + }, + { + type: 'text', + key: 'shareTip', + label: '鍒嗕韩鎻愮ず', + initVal: card.shareTip || '', + tooltip: '鍒嗕韩鏃跺鐢ㄦ埛鐨勬彁绀轰俊鎭��', + required: false + }, + // { + // type: 'number', + // key: 'width', + // min: 1, + // max: 24, + // precision: 0, + // label: '瀹藉害', + // initVal: card.width || 12, + // tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + // forbid: card.eleType !== 'button', + // required: true + // }, { type: 'radio', key: 'show', @@ -2232,6 +2325,21 @@ }, { type: 'radio', + key: 'formCache', + label: '琛ㄥ崟缂撳瓨', + initVal: card.formCache || 'false', + tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + required: false, + options: [{ + value: 'false', + text: '涓嶆竻绌�' + }, { + value: 'clear', + text: '娓呯┖' + }] + }, + { + type: 'radio', key: 'hidden', label: '闅愯棌', initVal: card.hidden || 'false', @@ -2286,6 +2394,7 @@ title: '缁勪欢', dataIndex: 'syncComId', inputType: 'cascader', + unique: true, editable: true, required: true, extends: [{key: 'label', value: 'label'}], diff --git a/src/menu/components/share/colsControl/index.jsx b/src/menu/components/share/colsControl/index.jsx index 8b0ec42..f7967b9 100644 --- a/src/menu/components/share/colsControl/index.jsx +++ b/src/menu/components/share/colsControl/index.jsx @@ -272,10 +272,16 @@ } render() { + const { config } = this.props const { colsCtrls, columns, visible, cols, searches } = this.state + let className = '' + if (config.colsCtrls && config.colsCtrls.length) { + className = 'cols-ctrls' + } + return ( - <div style={{display: 'inline-block'}}> + <div style={{display: 'inline-block'}} className={className}> <ApartmentOutlined style={{color: '#13c2c2'}} title="鏄剧ず鍒楁帶鍒�" onClick={this.resetMark} /> <Modal wrapClassName="column-control-modal-wrap" diff --git a/src/menu/components/share/colsControl/index.scss b/src/menu/components/share/colsControl/index.scss index ae2b530..6d2bbed 100644 --- a/src/menu/components/share/colsControl/index.scss +++ b/src/menu/components/share/colsControl/index.scss @@ -27,4 +27,18 @@ background: rgba(0, 0, 0, 0); } } +} +.cols-ctrls { + position: relative; +} +.cols-ctrls::after { + content: ' '; + display: block; + position: absolute; + top: 0; + right: 7px; + width: 4px; + height: 4px; + border-radius: 4px; + background-color: red; } \ No newline at end of file diff --git a/src/menu/components/share/colsControl/markform/index.jsx b/src/menu/components/share/colsControl/markform/index.jsx index e718f56..7a29c8d 100644 --- a/src/menu/components/share/colsControl/markform/index.jsx +++ b/src/menu/components/share/colsControl/markform/index.jsx @@ -115,7 +115,7 @@ 鍙栨秷 </Button> : null} </Col> - {targetKeys ? <Col span={18}> + {targetKeys ? <Col span={18} style={{clear: 'left'}}> <Form.Item label="鏄剧ず鍒�"> {getFieldDecorator('cols', { initialValue: [], diff --git a/src/menu/components/share/markcomponent/index.jsx b/src/menu/components/share/markcomponent/index.jsx index a88f98e..7185bea 100644 --- a/src/menu/components/share/markcomponent/index.jsx +++ b/src/menu/components/share/markcomponent/index.jsx @@ -414,8 +414,13 @@ render() { const { marks, markColumns, visible, options, signs } = this.state + let className = '' + if (this.props.type === 'line' && this.props.marks.length) { + className = 'mk-line-marks' + } + return ( - <div style={{display: 'inline-block'}}> + <div style={{display: 'inline-block'}} className={className}> <AntDesignOutlined className="profile" title="鏍囪" onClick={this.resetMark} /> <Modal wrapClassName="mark-modal-wrap" diff --git a/src/menu/components/share/markcomponent/index.scss b/src/menu/components/share/markcomponent/index.scss index e92c10a..c4663e0 100644 --- a/src/menu/components/share/markcomponent/index.scss +++ b/src/menu/components/share/markcomponent/index.scss @@ -22,4 +22,18 @@ background: rgba(0, 0, 0, 0); } } +} +.mk-line-marks { + position: relative; +} +.mk-line-marks::after { + content: ' '; + display: block; + position: absolute; + top: 0; + right: 7px; + width: 4px; + height: 4px; + border-radius: 4px; + background-color: red; } \ No newline at end of file diff --git a/src/menu/components/share/normalform/index.jsx b/src/menu/components/share/normalform/index.jsx deleted file mode 100644 index 56c3f9a..0000000 --- a/src/menu/components/share/normalform/index.jsx +++ /dev/null @@ -1,150 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Tooltip, InputNumber, Select, Radio, Cascader } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import asyncComponent from '@/utils/asyncComponent' -import './index.scss' - -const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) -const StyleInput = asyncComponent(() => import('@/components/normalform/modalform/styleInput')) - -class SettingForm extends Component { - static propTpyes = { - formlist: PropTypes.array, // 琛ㄥ崟 - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - state = { - formlist: [], - } - - UNSAFE_componentWillMount() { - const { formlist } = this.props - - this.setState({formlist: fromJS(formlist).toJS()}) - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - optionChange = (item, val) => { - if (item.key === 'click') { - this.setState({formlist: fromJS(this.state.formlist).toJS().map(cell => { - if (!['menu', 'menuType', 'open', 'joint', 'menus'].includes(cell.key)) return cell - - if (val === 'menu') { - cell.hidden = !['menu', 'open', 'joint'].includes(cell.key) - } else if (val === 'menus') { - cell.hidden = !['menuType', 'open', 'joint', 'menus'].includes(cell.key) - } else { - cell.hidden = true - } - - return cell - })}) - } - } - - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - - const fields = [] - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - let content = null - let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> : item.label - - if (item.type === 'text') { - content = (<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit}/>) - } else if (item.type === 'number') { - content = (<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>) - } else if (item.type === 'styleInput') { - content = (<StyleInput config={item}/>) - } else if (item.type === 'select') { - content = (<Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field || option.value}> - {option.label || option.text} - </Select.Option> - )} - </Select>) - } else if (item.type === 'radio') { - content = (<Radio.Group onChange={(e) => this.optionChange(item, e.target.value)}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.field || option.value}>{option.label || option.text}</Radio> - ) - })} - </Radio.Group>) - } else if (item.type === 'cascader') { - content = (<Cascader options={item.options} placeholder=""/>) - } else if (item.type === 'table') { - content = (<MKTable columns={item.columns || []} actions={item.actions || []}/>) - } - - if (!content) return - - fields.push( - <Col span={item.span || 12} key={index}> - <Form.Item label={label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: item.required, - message: (item.type === 'select' || item.type === 'cascader' ? '璇烽�夋嫨' : '璇疯緭鍏�') + item.label + '!' - } - ] - })(content)} - </Form.Item> - </Col> - ) - }) - - return fields - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="plot-base-wrap"> - <Form {...formItemLayout}><Row gutter={16}>{this.getFields()}</Row></Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/share/normalform/index.scss b/src/menu/components/share/normalform/index.scss deleted file mode 100644 index 4b2bfcd..0000000 --- a/src/menu/components/share/normalform/index.scss +++ /dev/null @@ -1,10 +0,0 @@ -.plot-base-wrap { - .ant-col-24 { - .ant-form-item-label { - width: 16.5%; - } - .ant-form-item-control-wrapper { - width: 83.5%; - } - } -} \ No newline at end of file diff --git a/src/menu/components/share/pastecomponent/index.jsx b/src/menu/components/share/pastecomponent/index.jsx index 7f0b88c..a96fa09 100644 --- a/src/menu/components/share/pastecomponent/index.jsx +++ b/src/menu/components/share/pastecomponent/index.jsx @@ -114,6 +114,10 @@ return } + if (res.copyType === 'editcols') { + res.copyType = 'cols' + } + let type = res.copyType let config = fromJS(this.props.config).toJS() @@ -168,7 +172,7 @@ } else if (type === 'cols') { config.cols = config.cols.filter(col => !col.origin) - if (config.subtype === 'normaltable' && res.cols.length === 1) { + if ((config.subtype === 'normaltable' || config.subtype === 'editable') && res.cols.length === 1) { config.cols.push(...res.cols) } else { let keys = config.cols.map(col => (col.field || '$empty')) diff --git a/src/menu/components/share/pasteforms/index.jsx b/src/menu/components/share/pasteforms/index.jsx index 6cf98a8..180304b 100644 --- a/src/menu/components/share/pasteforms/index.jsx +++ b/src/menu/components/share/pasteforms/index.jsx @@ -38,6 +38,8 @@ if (res.copyType === 'form') { delete res.copyType res = {fields: [res]} + } else if (res.copyType === 'simpleform') { + res = {fields: res.subcards[0].fields} } res.fields = res.fields || [] diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index afb5789..44db9f8 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -401,6 +401,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'perspective', label: '瀛楁閫忚', initVal: card.perspective || '', diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx index 3c5bc6b..e4494c0 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -13,7 +13,7 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span', 'lostTip'], video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx index 38d54a9..9da8a3a 100644 --- a/src/menu/components/table/base-table/options.jsx +++ b/src/menu/components/table/base-table/options.jsx @@ -210,6 +210,16 @@ required: false }, { + type: 'number', + field: 'maxPageSize', + label: '姣忛〉鏈�澶ф暟', + initval: wrap.maxPageSize || '', + min: 10, + max: 500, + precision: 0, + required: false + }, + { type: 'radio', field: 'cacheSearch', label: '鎼滅储缂撳瓨', diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 9f4eb5c..48a01c1 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -93,6 +93,16 @@ label: card.label + '锛堜笅涓�琛岋級' }) + if (wrap.commit === 'change') { + editCols.push({ + field: '$noActX', + label: '鏃犲姩浣�', + disabled: card.editType !== 'select' + }) + } else if (card.enter === '$noActX') { + card.enter = '$noAct' + } + return [ { type: 'text', diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index 1077a06..7458ba3 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -217,6 +217,21 @@ } } else if (key === 'format' && value === 'percent') { this.props.form.setFieldsValue({postfix: '%'}) + } else if (key === 'editType') { + let _options = this.getOptions() + + this.setState({ + formlist: this.state.formlist.map(item => { + if (item.key === 'enter' && item.options && item.options[item.options.length - 1].field === '$noActX') { + item.options[item.options.length - 1].disabled = value !== 'select' + } + + item.initVal = this.record[item.key] + item.hidden = !_options.includes(item.key) + + return item + }) + }) } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort'].includes(key)) { let _options = this.getOptions() @@ -331,7 +346,7 @@ getPopupContainer={() => document.getElementById('edit-table-column-winter')} > {options.map((option, i) => - <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> + <Select.Option key={i} disabled={option.disabled === true} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> {(option.text || option.label || option.MenuName)} </Select.Option> )} @@ -521,6 +536,12 @@ } } + if (values.type === 'text' && values.editable === 'true') { + if (values.editType !== 'select' && values.enter === '$noActX') { + values.enter = '$noAct' + } + } + if (values.dataSource) { let pass = checkSQL(values.dataSource) diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index a141757..9275f2e 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -38,6 +38,32 @@ this.props.updateCol({...column, marks: vals}) } + copycolumn = () => { + const { column } = this.props + + let oInput = document.createElement('input') + let val = { + copyType: 'editcols', + cols: [column] + } + + let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId') + if (srcid) { + val.$srcId = srcid + } + + oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + oInput.className = 'oInput' + oInput.style.display = 'none' + + message.success('澶嶅埗鎴愬姛銆�') + + document.body.removeChild(oInput) + } + shouldComponentUpdate (nextProps, nextState) { if (this.props.rowSpan !== nextProps.rowSpan || this.props.colSpan !== nextProps.colSpan) { @@ -77,6 +103,7 @@ {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + <CopyOutlined title="澶嶅埗鏄剧ず鍒�" style={{color: '#26C281'}} onClick={this.copycolumn} /> {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> @@ -520,7 +547,7 @@ let oInput = document.createElement('input') let val = { - copyType: 'cols', + copyType: 'editcols', cols: columns.filter(col => !col.origin) } diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index 7c38a7a..e005989 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -361,7 +361,7 @@ <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="editable" card={card}/> - <PasteComponent config={card} options={['action', 'search', 'form', 'cols']} updateConfig={this.updateComponent} /> + <PasteComponent config={card} options={['action', 'search', 'form', 'editcols']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <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/options.jsx b/src/menu/components/table/edit-table/options.jsx index bf3537a..9ff9cf7 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -221,6 +221,16 @@ options: columns }, { + type: 'number', + field: 'maxPageSize', + label: '姣忛〉鏈�澶ф暟', + initval: wrap.maxPageSize || '', + min: 10, + max: 500, + precision: 0, + required: false + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index ccd6013..b535832 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -361,6 +361,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'perspective', label: '瀛楁閫忚', initVal: card.perspective || '', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 8c88120..e2900f5 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -14,7 +14,7 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span', 'lostTip'], video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'blacklist', 'aspectRatio'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx index 4c8ba91..2d8f748 100644 --- a/src/menu/components/table/normal-table/options.jsx +++ b/src/menu/components/table/normal-table/options.jsx @@ -253,6 +253,17 @@ required: false }, { + type: 'number', + field: 'maxPageSize', + label: '姣忛〉鏈�澶ф暟', + initval: wrap.maxPageSize || '', + min: 10, + max: 500, + precision: 0, + required: false, + forbid: appType === 'mob' + }, + { type: 'radio', field: 'empty', label: '绌哄�奸殣钘�', diff --git a/src/menu/components/tree/antd-tree/options.jsx b/src/menu/components/tree/antd-tree/options.jsx index d7e9f39..d8b6a7e 100644 --- a/src/menu/components/tree/antd-tree/options.jsx +++ b/src/menu/components/tree/antd-tree/options.jsx @@ -129,10 +129,10 @@ initval: wrap.permission || 'false', required: false, options: [ - {value: 'true', label: '鍚敤'}, + {value: 'true', label: !appType ? '缁ф壙鑿滃崟' : '鍚敤'}, {value: 'false', label: '绂佺敤'}, ], - forbid: !appType || ispop + forbid: ispop }, { type: 'radio', diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index a8e84f7..fd6a079 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -564,6 +564,23 @@ }) return Promise.reject() } + } else if (config.subtype === 'editable') { + let _arr = [] + columns.forEach(col => { + let key = col.field.toLowerCase() + if (['jskey', 'data_type', 'bid'].includes(key)) { + _arr.push(col.field) + } + }) + + if (_arr.length > 0) { + notification.warning({ + top: 92, + message: '瀛楁闆嗕腑涓嶅彲浣跨敤' + _arr.join('銆�') + '锛佹敞锛氭瀛楁涓烘彁浜ゆ椂鐨勭郴缁熷瓧娈点��', + duration: 5 + }) + return Promise.reject() + } } return new Promise((resolve, reject) => { diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 5f5d523..d52d420 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -264,7 +264,7 @@ </Radio.Group>)} </Form.Item> </Col> - {setting.interType === 'outer' ? <Col span={8}> + {setting.interType === 'outer' ? <Col span={8} className="compact"> <Form.Item label={ <Tooltip placement="topLeft" title="涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -284,6 +284,7 @@ <Radio value="false">涓氬姟</Radio> <Radio value="true">鍗曠偣</Radio> <Radio value="external">澶栭儴</Radio> + <Radio value="custom">鑷畾涔�</Radio> </Radio.Group>)} </Form.Item> </Col> : null} @@ -332,7 +333,7 @@ })(<KeyInterface type="develop"/>)} </Form.Item> </Col> : null} - {setting.interType === 'outer' && setting.sysInterface === 'false' ? <Col className="outer-interface" span={24}> + {setting.interType === 'outer' && (setting.sysInterface === 'false' || setting.sysInterface === 'custom') ? <Col className="outer-interface" span={24}> <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 姝e紡鍦板潃 @@ -354,6 +355,18 @@ })(<KeyInterface type="product"/>)} </Form.Item> </Col> : null} + {setting.interType === 'outer' && setting.sysInterface === 'custom' ? <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="澶栭儴鎺ュ彛鍏ュ弬鍙婂嚭鍙傜殑鑷畾涔夊鐞嗐��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鑷畾涔夎剼鏈� + </Tooltip> + }> + {getFieldDecorator('js_script', { + initialValue: setting.js_script || '' + })(<CodeMirror mode="text/javascript" theme="cobalt" />)} + </Form.Item> + </Col> : null} {setting.interType === 'outer' ? <Col span={8}> <Form.Item label="澶栭儴鍑芥暟"> {getFieldDecorator('outerFunc', { diff --git a/src/menu/datasource/verifycard/settingform/index.scss b/src/menu/datasource/verifycard/settingform/index.scss index bdd6da1..87630fa 100644 --- a/src/menu/datasource/verifycard/settingform/index.scss +++ b/src/menu/datasource/verifycard/settingform/index.scss @@ -17,6 +17,15 @@ .ant-radio-group { white-space: nowrap; } + .compact { + padding-left: 0px!important; + .ant-radio-group { + span.ant-radio + * { + padding-left: 6px; + padding-right: 6px; + } + } + } .outer-interface { .ant-form-item-label { width: 10.5%; diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index 3fc26be..724e9ca 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -75,7 +75,8 @@ } 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 = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_customScript} ` } @@ -151,7 +152,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_dataresource} ${_tailScript} aaa: @@ -159,7 +161,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_dataresource}` } diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx index afaf6ae..adc227a 100644 --- a/src/menu/debug/index.jsx +++ b/src/menu/debug/index.jsx @@ -1776,10 +1776,14 @@ item.setting.interType = 'system' item.setting.execute = btn.verify.defaultSql || 'true' item.setting.dataresource = btn.verify.dataresource || '' - item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' + item.setting.primaryKey = btn.verify.primaryKey || '' item.setting.queryType = btn.verify.queryType item.setting.laypage = btn.pagination item.setting.order = btn.verify.order || '' + + if (btn.Ot === 'requiredOnce') { + item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' + } item.scripts = btn.verify.scripts || [] @@ -1811,9 +1815,20 @@ item.$searches = fromJS(searches).toJS() searches = formatSearch(searches) - let _columns = item.columns || [] + let _columns = [] if (item.subtype === 'dualdatacard') { _columns = [...item.columns, ...item.subColumns] + } else if (item.columns) { + _columns = [...item.columns] + } + + if (item.setting.primaryKey) { + let key = item.setting.primaryKey.toLowerCase() + if (_columns.findIndex(cell => cell.field.toLowerCase() === key) === -1) { + _columns.push({ + field: item.setting.primaryKey + }) + } } let arr_field = _columns.map(col => col.field).join(',') @@ -1866,7 +1881,8 @@ let sql = '' if (_customScript) { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_customScript} ${_dataresource} ${_tailScript} @@ -1875,7 +1891,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_dataresource} ${_tailScript} aaa: @@ -1883,7 +1900,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_dataresource}` } diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 444c709..83f496c 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -346,11 +346,6 @@ item.name = (MenuName || '') } - // 鎼滅储鏉′欢鍒濆鍖� - Utils.initSearchVal(item) - - item.$searches = Utils.initMainSearch(item.search) - if (item.setting.supModule) { let pid = item.setting.supModule.pop() if (pid && pid !== 'empty') { @@ -359,6 +354,11 @@ item.setting.supModule = '' } } + + // 鎼滅储鏉′欢鍒濆鍖� + Utils.initSearchVal(item) + + item.$searches = Utils.initMainSearch(item.search) let statFields = [] let getCols = (cols) => { @@ -506,12 +506,24 @@ } if (cell.verify && cell.verify.preHandle === 'true') { - try { - // eslint-disable-next-line - let func = new Function('btn', 'systemType', cell.verify.pre_func) - func(cell, window.GLOB.systemType) - } catch (e) { - console.warn(e) + let script = cell.verify.pre_func + if (!/#position-/.test(script) || /#position-init/.test(script)) { + try { + // eslint-disable-next-line + let func = new Function('btn', 'position', 'systemType', script) + func(cell, 'init', window.GLOB.systemType) + } catch (e) { + console.warn(e) + } + } + if (/#position-inner/.test(script)) { + cell.$innerScript = script + } + if (/#position-outer/.test(script)) { + cell.$outerScript = script + } + if (/#position-callback/.test(script)) { + cell.$callbackScript = script } } diff --git a/src/tabviews/basetable/index.scss b/src/tabviews/basetable/index.scss index be83043..cd48d98 100644 --- a/src/tabviews/basetable/index.scss +++ b/src/tabviews/basetable/index.scss @@ -31,15 +31,7 @@ left: calc(50% - 16px); top: calc(50vh - 70px); } - - .common-table-copy { - position: fixed; - z-index: 2; - bottom: 65px; - right: 30px; - width: 40px; - height: 40px; - } + .ant-btn-link:hover { opacity: 0.8; } diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index b6fc340..d3b0ce0 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -360,7 +360,7 @@ if (config.wrap.datatype === 'static') { this.setState({ - data: {$$BID: BID || '', $$BData: BData, $$empty: true}, + data: {$$BID: BID || '', $$BData: BData, $$empty: true, $$time: new Date().getTime()}, }) return } else if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index a958493..84fb9b8 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -24,6 +24,7 @@ const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf')) +const ShareLink = asyncComponent(() => import('@/tabviews/zshare/actionList/shareLink')) const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) const BarCode = asyncComponent(() => import('@/components/barcode')) const QrCode = asyncComponent(() => import('@/components/qrcode')) @@ -701,7 +702,7 @@ urls.forEach((u, i) => { contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> - <MkPicture style={_imagestyle} scale={scale} url={u} urls={urls}/> + <MkPicture style={_imagestyle} lostTip={card.lostTip !== 'false'} scale={scale} url={u} urls={urls}/> </div> </div>) }) @@ -1107,6 +1108,12 @@ MkButton = <ExportPdf btn={card} /> + } else if (card.funcType === 'shareLink') { + MkButton = <ShareLink + BID={data.$$BID} + btn={card} + selectedData={_data} + /> } else if (card.funcType === 'addline' || card.funcType === 'delline') { MkButton = <EditLine btn={card} diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 4315f80..1955b65 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -154,6 +154,10 @@ pageOptions.push(size) pageOptions = pageOptions.sort((a, b) => a - b) } + + if (_config.wrap.maxPageSize) { + pageOptions = pageOptions.filter(item => item <= _config.wrap.maxPageSize) + } } let _data = [] @@ -701,7 +705,9 @@ if (!config.setting.supModule || config.setting.supModule !== MenuID) return if (id !== this.state.BID || id !== '') { this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { - this.loadData() + if (!config.checkBid) { + this.loadData() + } }) } } diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index df7f722..6ae8f77 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -170,6 +170,9 @@ pageOptions.push(size) pageOptions = pageOptions.sort((a, b) => a - b) } + if (_config.wrap.maxPageSize) { + pageOptions = pageOptions.filter(item => item <= _config.wrap.maxPageSize) + } } if (_config.wrap.zHeight) { @@ -543,7 +546,9 @@ if (!config.setting.supModule || config.setting.supModule !== MenuID) return if (id !== this.state.BID || id !== '') { this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { - this.loadData() + if (!config.checkBid) { + this.loadData() + } }) } } diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 82064c3..1319e6d 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -495,7 +495,7 @@ if (config.wrap.datatype === 'static') { this.setState({ - data: {$$BID: BID || '', $$BData: BData, $$empty: true}, + data: {$$BID: BID || '', $$BData: BData, $$empty: true, $$time: new Date().getTime()}, }) if (!btn) { diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx index 6444785..a400204 100644 --- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx @@ -205,20 +205,6 @@ )} </Form.Item> </Col> : null} - {nodetype === 'node' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鏍囪灏嗕綔涓鸿妭鐐笽D"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鏍囪 - </Tooltip> - }> - {getFieldDecorator('sign', { - initialValue: data.sign || '' - })( - <Input placeholder="" autoComplete="off"/> - )} - </Form.Item> - </Col> : null} <Col span={24}> <Form.Item label="澶囨敞"> {getFieldDecorator('remark', { diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 2968377..a844a2c 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -70,6 +70,10 @@ let _group = _config.subcards[0] + if (_config.wrap.refocus) { + _group.setting.refocus = _config.wrap.refocus + } + if (_group.subButton.enable === 'false' && (!_group.closeButton || _group.closeButton.enable !== 'true') && (!_group.resetButton || _group.resetButton.enable !== 'true')) { _group.subButton.style.display = 'none' _group.$button = 'no-button' @@ -213,15 +217,27 @@ /** * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� - * @param {*} menuId // 鑿滃崟Id - * @param {*} position // 鍒锋柊浣嶇疆 - * @param {*} btn // 鎵ц鐨勬寜閽� */ - refreshByButtonResult = (menuId, position, btn, id) => { + refreshByButtonResult = (menuId, position, btn, id, lines, res) => { const { config, group, BID } = this.state if (config.uuid !== menuId) return + if (position === 'resetData') { + let _data = fromJS(this.state.data || {}).toJS() + + Object.keys(_data).forEach(key => { + let _key = key.toLowerCase() + if (typeof(res[_key]) !== 'undefined') { + _data[key] = res[_key] + } + }) + + this.setState({ + data: _data + }) + return + } if (position === 'grid' && config.wrap.refocus) { let _group = fromJS(group).toJS() _group.setting.focus = config.wrap.refocus diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 361e710..8c282b4 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -1166,7 +1166,7 @@ <div className="voucher-code"> <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({status: 'change', charType: val, charName: option.props.charName, charInt: option.props.charint})}> {typeOptions.map(option => - <Select.Option key={option.voucher_char_int} value={option.voucher_class} charName={option.voucher_char} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> + <Select.Option key={option.id} value={option.voucher_class} charName={option.voucher_char} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> )} </Select> <InputNumber precision={0} min={1} value={charInt} autoComplete="off" onChange={(val) => this.setState({status: 'change', charInt: val})}/> 鍙� diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 01eacd8..5f6859a 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -268,7 +268,7 @@ <div> {photos.map((url, i) => ( <Col key={i} span={col.span || 24}> - <MkPicture style={{paddingTop, backgroundSize: col.backgroundSize || 'cover'}} scale={scale} url={url} urls={photos}/> + <MkPicture lostTip={col.lostTip !== 'false'} style={{paddingTop, backgroundSize: col.backgroundSize || 'cover'}} scale={scale} url={url} urls={photos}/> </Col> ))} </div> @@ -566,6 +566,10 @@ pageOptions = pageOptions.sort((a, b) => a - b) } + if (setting.maxPageSize) { + pageOptions = pageOptions.filter(item => item <= setting.maxPageSize) + } + let allColumns = null if (colsCtrls) { rowspans = null diff --git a/src/tabviews/custom/components/share/normalheader/index.jsx b/src/tabviews/custom/components/share/normalheader/index.jsx index 0b19275..34f8a6b 100644 --- a/src/tabviews/custom/components/share/normalheader/index.jsx +++ b/src/tabviews/custom/components/share/normalheader/index.jsx @@ -27,7 +27,14 @@ }) } - shouldComponentUpdate (nextProps, nextState) { return false } + shouldComponentUpdate (nextProps, nextState) { + const { config } = this.props + + if (config.checkBid && this.props.BID !== nextProps.BID) { + return true + } + return false + } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 7f975c1..7c86fca 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -137,7 +137,7 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) - let result = await Api.genericInterface(param) + let result = await Api.genericInterface(param, setting.js_script) if (result.status) { if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { let _pageIndex = Math.ceil(result.total / pageSize) @@ -566,8 +566,10 @@ BID: id, BData: data }, () => { - this.loadmaindata(true, 'true') - this.getStatFieldsValue() + if (!setting.checkBid) { + this.loadmaindata(true, 'true') + this.getStatFieldsValue() + } }) } } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index d2f11ed..77c9061 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -584,9 +584,11 @@ BID: id, BData: data }, () => { - setTimeout(() => { - this.loadmaindata(true, 'true') - }, setting.delay || 0) + if (!setting.checkBid) { + setTimeout(() => { + this.loadmaindata(true, 'true') + }, setting.delay || 0) + } }) } } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 9a9d454..57dba86 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -55,7 +55,7 @@ this.node.blur() - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return if (/\$next/.test(config.enter)) { MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) @@ -191,7 +191,7 @@ this.props.onChange(values) - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return if (/\$next/.test(config.enter)) { MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) @@ -283,9 +283,11 @@ this.props.onChange(values, val) + if (config.enter === '$noActX') return + this.node.blur() - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return setTimeout(() => { if (/\$next/.test(config.enter)) { @@ -308,7 +310,7 @@ const { config, lineId } = this.props if (config.$ctrl) { - MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid, true) } setTimeout(() => { @@ -408,7 +410,7 @@ this.node.blur() - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return if (/\$next/.test(config.enter)) { MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) @@ -536,7 +538,7 @@ this.node.blur() - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return setTimeout(() => { if (/\$next/.test(config.enter)) { @@ -1471,6 +1473,10 @@ pageOptions = pageOptions.sort((a, b) => a - b) } + if (setting.maxPageSize) { + pageOptions = pageOptions.filter(item => item <= setting.maxPageSize) + } + let allColumns = null if (colsCtrls) { allColumns = [..._columns] @@ -1550,7 +1556,11 @@ MKEmitter.removeListener('changeRecord' + tableId, this.changeRecord) } - colBlur = (lineId) => { + colBlur = (lineId, colId, defer) => { + if (defer && this.focusId === lineId && this.colId !== colId) { + return + } + this.blurId = lineId this.focusId = '' diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx index 47eb46b..4428a97 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx @@ -292,7 +292,7 @@ this.props.onBlur && this.props.onBlur() - if (config.enter === '$noAct') return + if (/\$noAct/.test(config.enter)) return setTimeout(() => { if (/\$next/.test(config.enter)) { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 595c5e5..676488a 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -784,7 +784,9 @@ BID: id, BData: data }, () => { - this.loadmaindata(true, 'true') + if (!setting.checkBid) { + this.loadmaindata(true, 'true') + } }) } } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 7bc164c..aa98810 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -563,13 +563,6 @@ item.type = 'card' } - // 鎼滅储鏉′欢鍒濆鍖� - if (item.search) { - Utils.initSearchVal(item) - - item.$searches = Utils.initMainSearch(item.search) - } - if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢 item.setting.supModule = item.supNodes[0].componentId } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { @@ -579,6 +572,13 @@ } else { item.setting.supModule = '' } + } + + // 鎼滅储鏉′欢鍒濆鍖� + if (item.search) { + Utils.initSearchVal(item) + + item.$searches = Utils.initMainSearch(item.search) } let pass = skip @@ -919,12 +919,24 @@ } if (cell.verify && cell.verify.preHandle === 'true') { - try { - // eslint-disable-next-line - let func = new Function('btn', 'systemType', cell.verify.pre_func) - func(cell, window.GLOB.systemType) - } catch (e) { - console.warn(e) + let script = cell.verify.pre_func + if (!/#position-/.test(script) || /#position-init/.test(script)) { + try { + // eslint-disable-next-line + let func = new Function('btn', 'position', 'systemType', script) + func(cell, 'init', window.GLOB.systemType) + } catch (e) { + console.warn(e) + } + } + if (/#position-inner/.test(script)) { + cell.$innerScript = script + } + if (/#position-outer/.test(script)) { + cell.$outerScript = script + } + if (/#position-callback/.test(script)) { + cell.$callbackScript = script } } diff --git a/src/tabviews/custom/index.scss b/src/tabviews/custom/index.scss index b2f1683..79e986d 100644 --- a/src/tabviews/custom/index.scss +++ b/src/tabviews/custom/index.scss @@ -32,14 +32,6 @@ top: calc(50vh - 70px); } - .common-table-copy { - position: fixed; - z-index: 2; - bottom: 65px; - right: 30px; - width: 40px; - height: 40px; - } .ant-btn-link:hover { opacity: 0.8; } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 2012480..403cace 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -323,13 +323,6 @@ } } - // 鎼滅储鏉′欢鍒濆鍖� - if (item.search) { - Utils.initSearchVal(item) - - item.$searches = Utils.initMainSearch(item.search) - } - if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢 item.setting.supModule = item.supNodes[0].componentId } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { @@ -339,6 +332,13 @@ } else { item.setting.supModule = '' } + } + + // 鎼滅储鏉′欢鍒濆鍖� + if (item.search) { + Utils.initSearchVal(item) + + item.$searches = Utils.initMainSearch(item.search) } // 鏉冮檺杩囨护 @@ -636,12 +636,24 @@ } if (cell.verify && cell.verify.preHandle === 'true') { - try { - // eslint-disable-next-line - let func = new Function('btn', 'systemType', cell.verify.pre_func) - func(cell, window.GLOB.systemType) - } catch (e) { - console.warn(e) + let script = cell.verify.pre_func + if (!/#position-/.test(script) || /#position-init/.test(script)) { + try { + // eslint-disable-next-line + let func = new Function('btn', 'position', 'systemType', script) + func(cell, 'init', window.GLOB.systemType) + } catch (e) { + console.warn(e) + } + } + if (/#position-inner/.test(script)) { + cell.$innerScript = script + } + if (/#position-outer/.test(script)) { + cell.$outerScript = script + } + if (/#position-callback/.test(script)) { + cell.$callbackScript = script } } diff --git a/src/tabviews/custom/popview/index.scss b/src/tabviews/custom/popview/index.scss index c3e4b31..b6314b4 100644 --- a/src/tabviews/custom/popview/index.scss +++ b/src/tabviews/custom/popview/index.scss @@ -31,15 +31,7 @@ left: calc(50% - 16px); top: calc(50vh - 70px); } - - .common-table-copy { - position: fixed; - z-index: 2; - bottom: 65px; - right: 30px; - width: 40px; - height: 40px; - } + .ant-btn-link:hover { opacity: 0.8; } diff --git a/src/tabviews/zshare/actionList/exportPdf/index.jsx b/src/tabviews/zshare/actionList/exportPdf/index.jsx index 3887535..8a8ad2e 100644 --- a/src/tabviews/zshare/actionList/exportPdf/index.jsx +++ b/src/tabviews/zshare/actionList/exportPdf/index.jsx @@ -6,7 +6,6 @@ import moment from 'moment' import JsPDF from 'jspdf' -import Api from '@/api' import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' @@ -103,34 +102,6 @@ this.setState({ loading: false }) - }) - } - - getInnerData = (params) => { - let param = params.shift() - - Api.genericInterface(param).then(res => { - if (res.status) { - this.downloadZipImage(res.data, this.props.btn.urlkey).then((res) => { - if (params.length === 0) { - if (res) { - this.execError({ErrCode: res}) - } else { - this.execSuccess() - } - } else { - this.getInnerData(params) - } - }, (err) => { - if (params.length === 0) { - this.execError({ErrCode: err}) - } else { - this.getInnerData(params) - } - }) - } else { - this.execError(res) - } }) } diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 7d59c20..3993d7e 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -19,6 +19,7 @@ const FuncZip = asyncComponent(() => import('./funczip')) const EditLine = asyncComponent(() => import('./editLine')) const ExportPdf = asyncComponent(() => import('./exportPdf')) +const ShareLink = asyncComponent(() => import('./shareLink')) class ActionList extends Component { static propTpyes = { @@ -196,6 +197,15 @@ btn={item} /> ) + } else if (item.funcType === 'shareLink') { + return ( + <ShareLink + key={item.uuid} + BID={BID} + btn={item} + selectedData={selectedData} + /> + ) } else if (item.funcType === 'addline' || item.funcType === 'delline') { return ( <EditLine diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 2a624a8..6c4548b 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1124,6 +1124,12 @@ if (btn.intertype === 'system') { params = this.getSystemParam(data, formdata) + if (btn.returnValue === 'true') { + params = params.map(item => { + item.script_type = 'Y' + return item + }) + } } else { params = this.getInnerParam(data, formdata) } @@ -1295,7 +1301,7 @@ return } - Api.genericInterface(param).then(res => { + Api.genericInterface(param, btn.$innerScript, 'inner').then(res => { record.mk_api_key = res.mk_api_key || '' if (res.status) { @@ -1535,7 +1541,7 @@ param.menuname = param.menuname + '(鍥炶皟)' } - Api.genericInterface(param).then(res => { + Api.genericInterface(param, btn.$callbackScript, 'callback').then(res => { if (res.status) { this.triggerNote(res, param.ID) // 娑堟伅 @@ -1892,7 +1898,7 @@ return } - Api.genericInterface(param).then(res => { + Api.genericInterface(param, btn.$innerScript, 'inner').then(res => { if (res.status) { if ((res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) && params.length === 0) { this.execSuccess(res) @@ -1990,7 +1996,7 @@ } } - Api.genericInterface(result).then(res => { + Api.genericInterface(result, btn.$outerScript, 'outer').then(res => { if (!res) return // LoginError鏃朵腑鏂姹� if (ver_token && res.ErrCode === 'token_error') { res.ErrCode = 'E' @@ -2082,7 +2088,7 @@ param.menuname = param.menuname + '(鍥炶皟)' } - Api.genericInterface(param).then(res => { + Api.genericInterface(param, btn.$callbackScript, 'callback').then(res => { if (res.status) { this.triggerNote(res, param.ID) // 娑堟伅 @@ -2226,7 +2232,19 @@ const { autoMatic } = this.state if (btn.resetForms) { - MKEmitter.emit('resetForms', btn.uuid) + let data = {} + + Object.keys(res).forEach(key => { + data[key.toLowerCase()] = res[key] + }) + + delete data.errcode + delete data.errmesg + delete data.message + delete data.status + + MKEmitter.emit('resetForms', btn.uuid, data) + MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'resetData', btn, null, null, data) } if (this.preCallback) { @@ -2326,6 +2344,10 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } + if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 + window.GLOB.CacheMap = new Map() + } + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 MKEmitter.emit('reloadMenuView', tabId, 'table') return @@ -2357,7 +2379,14 @@ } else if (/\$focus/.test(btn.syncComponentId)) { MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1]) } else { - MKEmitter.emit('reloadData', btn.syncComponentId) + if (btn.syncDelay) { + this.delayTimer && clearTimeout(this.delayTimer) + this.delayTimer = setTimeout(() => { + MKEmitter.emit('reloadData', btn.syncComponentId) + }, btn.syncDelay) + } else { + MKEmitter.emit('reloadData', btn.syncComponentId) + } } } diff --git a/src/tabviews/zshare/actionList/shareLink/index.jsx b/src/tabviews/zshare/actionList/shareLink/index.jsx new file mode 100644 index 0000000..e4bd407 --- /dev/null +++ b/src/tabviews/zshare/actionList/shareLink/index.jsx @@ -0,0 +1,193 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, notification, message, Modal } from 'antd' +import md5 from 'md5' + +import Api from '@/api' +import MKEmitter from '@/utils/events.js' +import MkIcon from '@/components/mk-icon' + +// import './index.scss' + +class ShareLink extends Component { + static propTpyes = { + BID: PropTypes.string, + btn: PropTypes.object, + selectedData: PropTypes.any + } + + state = { + loading: false + } + + componentDidMount () { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (triggerId) => { + const { btn, BID, selectedData } = this.props + const { loading } = this.state + + if (loading) return + if (triggerId && btn.uuid !== triggerId) return + + if (window.GLOB.systemType === 'production' && !btn.shareProUrl) { + notification.warning({ + top: 92, + message: '灏氭湭璁剧疆姝e紡绯荤粺閾炬帴鍦板潃锛�', + duration: 5 + }) + return + } + + let bid = BID || '' + let id = '' + if (selectedData && selectedData[0]) { + id = selectedData[0].$$uuid || '' + } + + let url = btn.shareUrl + if (window.GLOB.systemType === 'production') { + url = btn.shareProUrl + } + + url = url.replace(/@BID@/ig, bid).replace(/@ID@/ig, id) + + if (btn.shortUrl === 'true') { + this.setState({ + loading: true + }, () => { + this.getShortUrl(url) + }) + } else { + this.copyUrl(url) + } + } + + getShortUrl = (url) => { + let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) + let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) + + let param = { + func: 's_url_db_adduptdel', + appkey: window.GLOB.appkey, + userid: _id, + LoginUID: _id, + type: 'add_only', + validity: 15, + linkurl: url, + nonc: '' + new Date().getTime(), + id: md5(url + window.GLOB.appkey) + } + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + values += key + param[key] + }) + param.sign = md5(values) + param.t = new Date().getTime() + + Api.directRequest({ + url: _rduri + '/s_url_db_adduptdel', + method: 'post', + data: JSON.stringify(param) + }).then(res => { + this.setState({ + loading: false + }) + + if (res.status && res.id) { + this.copyUrl('https://mk9h.cn/m.asp?m=' + res.id) + } else { + notification.warning({ + top: 92, + message: res.message || '閾炬帴鐢熸垚澶辫触锛�', + duration: 5 + }) + } + }, () => { + this.setState({ + loading: false + }) + }) + } + + copyUrl = (url) => { + const { btn } = this.props + + let oInput = document.createElement('input') + oInput.value = url + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + + if (btn.shareTip) { + Modal.success({ + title: btn.shareTip + }) + } else { + message.success('宸插鍒跺埌鍓垏鏉裤��') + } + } + + render() { + const { btn } = this.props + const { loading } = this.state + + let label = '' + let icon = '' + let type = 'link' + let className = '' + let style = {...btn.style} + + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } + + return ( + <Button + type={type} + title={btn.show === 'icon' ? btn.label : ''} + style={style} + loading={loading} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) + } +} + +export default ShareLink \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/shareLink/index.scss b/src/tabviews/zshare/actionList/shareLink/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/tabviews/zshare/actionList/shareLink/index.scss diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 61dbda9..8a3b8e9 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -47,7 +47,8 @@ send_type: '', timestamp: '', n_id: '', - focusId: '' + focusId: '', + reFocusId: '' } record = {} @@ -680,14 +681,24 @@ focusItem = fieldMap.get(action.setting.focus) } - this.setState({ formlist, ID, focusId: focusItem ? focusItem.uuid : '' }, () => { + let reFocusItem = null + if (action.setting.refocus && fieldMap.has(action.setting.refocus)) { + reFocusItem = fieldMap.get(action.setting.refocus) + } + + this.setState({ + formlist, + ID, + focusId: focusItem ? focusItem.uuid : '', + reFocusId: reFocusItem ? reFocusItem.uuid : '' + }, () => { if (unload) return if (focusItem) { if (focusItem.type === 'text' || focusItem.type === 'number') { setTimeout(() => { MKEmitter.emit('mkFC', 'focus', focusItem.uuid) - }, 50) + }, 20) } else { setTimeout(() => { MKEmitter.emit('mkFC', 'focus', focusItem.uuid) @@ -722,9 +733,9 @@ MKEmitter.removeListener('resetForms', this.resetForms) } - resetForms = (id) => { + resetForms = (id, data) => { const { action } = this.props - const { focusId } = this.state + const { focusId, reFocusId } = this.state if (id !== action.uuid) return @@ -735,8 +746,14 @@ if (item.type !== 'text' && item.type !== 'number') return item if (resetForms.includes(item.field)) { - item.initval = item.orgval - this.record[item.field] = item.orgval + let key = item.field.toLowerCase() + if (typeof(data[key]) !== 'undefined') { + item.initval = data[key] + this.record[item.field] = data[key] + } else { + item.initval = item.orgval + this.record[item.field] = item.orgval + } } return item @@ -760,10 +777,10 @@ }) }) - if (focusId || this.submitId) { + if (reFocusId || focusId || this.submitId) { setTimeout(() => { - MKEmitter.emit('mkFC', 'focus', this.submitId || focusId) - }, 50) + MKEmitter.emit('mkFC', 'focus', this.submitId || reFocusId || focusId) + }, 20) } } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 300e98e..44d6ab9 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -655,7 +655,7 @@ return ( <div className="picture-col"> {photos.map((url, i) => (<Col key={i} span={item.span || 24}> - <MkPicture style={style} scale={scale} url={url} urls={photos}/> + <MkPicture lostTip={item.lostTip !== 'false'} style={style} scale={scale} url={url} urls={photos}/> </Col>))} </div> ) diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index eda97f6..c3cfc0b 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -25,8 +25,8 @@ class MainSearch extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 + BID: PropTypes.any, + config: PropTypes.object } state = { @@ -121,6 +121,40 @@ item.advanced = false } + if (item.checkShift && !item.initval) { + let d = '' + if (window.GLOB.CacheData.has(item.$supId)) { + d = window.GLOB.CacheData.get(item.$supId) + d = d[item.dateShift] || '' + if (d) { + d = moment(d).format('YYYY-MM-DD') + d = d === 'Invalid date' ? '' : d + } + } + + if (d) { + if (item.type === 'daterange') { + if (item.$initval === 'week') { + item.initval = [moment(d).startOf('week').format(item.format), moment(d).endOf('week').format(item.format)].join(',') + } else if (item.$initval === 'month') { + item.initval = [moment(d).startOf('month').format(item.format), moment(d).endOf('month').format(item.format)].join(',') + } else if (item.$initval === 'lastMonth') { + item.initval = [moment(d).subtract(1, 'months').startOf('month').format(item.format), moment(d).subtract(1, 'months').endOf('month').format(item.format)].join(',') + } else { + try { + let _initval = JSON.parse(item.$initval) + let _vals = [moment(d).subtract(_initval[0], 'days').format(item.format), moment(d).subtract(_initval[1], 'days').format(item.format)] + item.initval = _vals.join(',') + } catch (e) { + item.initval = '' + } + } + } else { + item.initval = moment(d).subtract(item.$initval, 'month').format('YYYY-MM') + } + } + } + if (item.type === 'group') { record[item.field] = item.initType record[item.datefield] = item.initval @@ -144,24 +178,34 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - _option.sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) + let exec = true + if (item.checkBid) { + item.sql = _option.sql + item.arr_field = _option.field - if (window.GLOB.debugger === true) { - console.info(_option.sql) + exec = !!BID } - // 娴嬭瘯绯荤粺鍗曚釜璇锋眰 - if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && !window.GLOB.systemType) { - deForms.push({ - ...item, - arr_field: _option.field, - data_sql: Utils.formatOptions(_option.sql) - }) - } else { // 鍚堝苟璇锋眰锛屽尯鍒嗘湰鍦板強绯荤粺 - if (item.database === 'sso') { - mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) - } else { - localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) + if (exec) { + _option.sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) + + if (window.GLOB.debugger === true) { + console.info(_option.sql) + } + + // 娴嬭瘯绯荤粺鍗曚釜璇锋眰 + if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && !window.GLOB.systemType) { + deForms.push({ + ...item, + arr_field: _option.field, + data_sql: Utils.formatOptions(_option.sql) + }) + } else { // 鍚堝苟璇锋眰锛屽尯鍒嗘湰鍦板強绯荤粺 + if (item.database === 'sso') { + mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) + } else { + localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) + } } } } @@ -233,11 +277,84 @@ searchlist: _list }, () => { if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { - this.improveSimpleSearch(deForms) + this.improveSimpleSearch(deForms, false) } else if (mainItems.length > 0 || localItems.length > 0) { this.improveSearch(mainItems, localItems) } }) + } + + UNSAFE_componentWillReceiveProps(nextProps) { + const { config, BID } = this.props + + if (config.checkBid && nextProps.BID !== BID) { + this.resetOptions(nextProps.BID) + } + } + + resetOptions = (BID) => { + let deForms = [] + let searchlist = fromJS(this.state.searchlist).toJS().map(item => { + if (item.checkBid) { + let sql = item.sql.replace(/@BID@/ig, `'${BID || ''}'`) + + if (window.GLOB.debugger === true) { + console.info(sql) + } + + deForms.push({ + ...item, + arr_field: item.arr_field, + data_sql: Utils.formatOptions(sql) + }) + } else if (item.checkShift) { + let d = '' + if (window.GLOB.CacheData.has(item.$supId)) { + d = window.GLOB.CacheData.get(item.$supId) + d = d[item.dateShift] || '' + if (d) { + d = moment(d).format('YYYY-MM-DD') + d = d === 'Invalid date' ? '' : d + } + } + + if (d) { + if (item.type === 'daterange') { + if (item.$initval === 'week') { + item.initval = [moment(d).startOf('week').format(item.format), moment(d).endOf('week').format(item.format)].join(',') + } else if (item.$initval === 'month') { + item.initval = [moment(d).startOf('month').format(item.format), moment(d).endOf('month').format(item.format)].join(',') + } else if (item.$initval === 'lastMonth') { + item.initval = [moment(d).subtract(1, 'months').startOf('month').format(item.format), moment(d).subtract(1, 'months').endOf('month').format(item.format)].join(',') + } else { + try { + let _initval = JSON.parse(item.$initval) + let _vals = [moment(d).subtract(_initval[0], 'days').format(item.format), moment(d).subtract(_initval[1], 'days').format(item.format)] + item.initval = _vals.join(',') + } catch (e) { + item.initval = '' + } + } + } else { + item.initval = moment(d).subtract(item.$initval, 'month').format('YYYY-MM') + } + } + } + + return item + }) + + if (deForms.length > 0) { + this.improveSimpleSearch(deForms, true, searchlist) + } else { + this.setState({ + searchlist: searchlist + }) + + setTimeout(() => { + this.handleSubmit() + }, 20) + } } resetCheckcard = (item) => { @@ -364,12 +481,12 @@ delete result.message delete result.status - this.resetSearch(result) + this.resetSearch(result, false) }) } // 娴嬭瘯绯荤粺鍗曚釜璇锋眰涓嬫媺閫夐」 - improveSimpleSearch = (deForms) => { + improveSimpleSearch = (deForms, trigger, searchlist) => { if (deForms.length === 0) return let deffers = deForms.map((item, index) => { @@ -421,13 +538,13 @@ delete result.message delete result.status - this.resetSearch(result) + this.resetSearch(result, trigger, searchlist) }) } - resetSearch = (result) => { - let trigger = false - let _searchlist = fromJS(this.state.searchlist).toJS().map(item => { + resetSearch = (result, submit, searchlist) => { + let trigger = submit + let _searchlist = fromJS(searchlist || this.state.searchlist).toJS().map(item => { if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = [] let map = new Map() @@ -492,9 +609,13 @@ item.options = item.oriOptions } - if (item.$first && item.options.length > 0) { - item.initval = item.options[0].Value - trigger = true + if (item.$first) { + if (item.options.length > 0) { + item.initval = item.options[0].Value + trigger = true + } else { + item.initval = '' + } } return item @@ -507,7 +628,7 @@ if (trigger) { setTimeout(() => { this.handleSubmit() - }, 10) + }, 20) } } @@ -567,7 +688,7 @@ } else if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { content = (<MKSelect config={item} onChange={(val, defer) => this.recordChange(val, defer, item)} />) } else if (item.type === 'date' || item.type === 'datemonth' || item.type === 'dateweek' || item.type === 'daterange') { - content = (<MKDatePicker config={item} onChange={(val) => this.recordChange(val, false, item)} />) + content = (<MKDatePicker config={item} onChange={(val, defer) => this.recordChange(val, defer, item)} />) } else if (item.type === 'group') { field = item.datefield content = <DateGroup position={index} config={item} onChange={(val, type) => this.dateGroupChange(val, type, item)} /> diff --git a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx index c086876..fc67c7d 100644 --- a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx +++ b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx @@ -15,28 +15,16 @@ const config = props.config let mode = 'date' - let format = 'YYYY-MM-DD' + let format = config.format || 'YYYY-MM-DD' if (config.type === 'datemonth') { mode = 'month' - format = 'YYYY-MM' } else if (config.type === 'week') { mode = 'week' - format = 'YYYY-MM-DD' - } else { - if (config.type === 'daterange') { - mode = 'daterange' - } - if (config.precision === 'day') { - format = 'YYYY-MM-DD' - } else if (config.precision === 'hour') { - format = 'YYYY-MM-DD HH' - } else if (config.precision === 'minute') { - format = 'YYYY-MM-DD HH:mm' - } else if (config.precision === 'second') { - format = 'YYYY-MM-DD HH:mm:ss' - } + } else if (config.type === 'daterange') { + mode = 'daterange' } + let value = config.initval || null if (mode === 'daterange') { @@ -62,6 +50,20 @@ return !is(fromJS(this.state), fromJS(nextState)) } + UNSAFE_componentWillReceiveProps (nextProps) { + const { config } = this.props + + if (config.checkShift && nextProps.config.initval && nextProps.config.initval !== config.initval) { + let val = nextProps.config.initval.split(',') + + this.setState({ + value: [moment(val[0], config.format), moment(val[1], config.format)] + }) + + this.props.onChange(nextProps.config.initval, true) + } + } + componentWillUnmount () { this.setState = () => { return @@ -78,9 +80,9 @@ if (_val && !_val[0]) { _val = '' } - this.props.onChange(_val ? `${moment(_val[0]).format(format)},${moment(_val[1]).format(format)}` : '') + this.props.onChange(_val ? `${moment(_val[0]).format(format)},${moment(_val[1]).format(format)}` : '', false) } else { - this.props.onChange(val ? moment(val).format(format) : '') + this.props.onChange(val ? moment(val).format(format) : '', false) } } diff --git a/src/tabviews/zshare/topSearch/mkSelect/index.jsx b/src/tabviews/zshare/topSearch/mkSelect/index.jsx index 87000f4..4dcfe0a 100644 --- a/src/tabviews/zshare/topSearch/mkSelect/index.jsx +++ b/src/tabviews/zshare/topSearch/mkSelect/index.jsx @@ -47,10 +47,12 @@ options: fromJS(nextProps.config.options).toJS() }) - if (config.$first && nextProps.config.initval) { + if (config.type !== 'multiselect') { this.setState({ value: nextProps.config.initval }) + + this.props.onChange(nextProps.config.initval, true) } } } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 710956c..73f4f11 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -40,7 +40,7 @@ } }) - let declare = `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 =''` + let declare = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address=''` if (verify.defaultSql === 'false') { _dataresource = '' diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 1509c78..1a8128f 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -26,7 +26,6 @@ class VerifyCard extends Component { static propTpyes = { floor: PropTypes.any, // 鏄惁涓哄瓙琛� - btnTab: PropTypes.any, // 琛ㄥ崟鏍囩椤碉紙鎸夐挳锛夊弬鏁� config: PropTypes.any, // 琛ㄥ崟鏍囩椤靛弬鏁� card: PropTypes.object, columns: PropTypes.array diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx index 1998688..c414f14 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx @@ -20,7 +20,8 @@ }) 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 = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${declareSql} ${_customScript} ` @@ -72,7 +73,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${declareSql} ${_dataresource} ${_tailScript} @@ -81,7 +83,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${declareSql} ${_dataresource}` } diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 2a87811..cd13077 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -240,6 +240,10 @@ } shows.push('linkField') reRequired.linkField = false + } else if (type === 'daterange' || type === 'datemonth') { + if (this.record.initval) { + shows.push('dateShift') + } } if (dateOptions.hasOwnProperty(type)) { // 鏍规嵁鎼滅储鏉′欢绫诲瀷锛岄�夋嫨鍒濆鍊肩殑绫诲瀷鍙婃暟鎹� @@ -509,7 +513,7 @@ rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] - if (item.key === 'field' || item.key === 'datefield') { + if (item.key === 'field' || item.key === 'datefield' || item.key === 'dateShift') { rules.push({ pattern: (type === 'text' || type === 'select' || type === 'daterange') ? formRule.field.multipattern : formRule.field.pattern, message: formRule.field.message diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index 199a33e..846ae2f 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -16,7 +16,8 @@ }) 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 = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_customScript} ` } @@ -108,7 +109,8 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `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 ='' + sql = `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 ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' ${_dataresource}` } diff --git a/src/templates/zshare/codemirror/index.jsx b/src/templates/zshare/codemirror/index.jsx index db428e7..0980534 100644 --- a/src/templates/zshare/codemirror/index.jsx +++ b/src/templates/zshare/codemirror/index.jsx @@ -144,6 +144,8 @@ _sql = _sql.replace(item.id, item.value) }) + _sql = _sql.replace(/,\n\s*/g, ',') + this.setState({display: false, defaultVal: _sql}, () => { this.setState({display: true}) }) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index c306270..6f2c88b 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -467,6 +467,15 @@ forbid: appType === 'mob' }, { + type: 'text', + key: 'dateShift', + label: '鏃ユ湡鍋忕Щ', + initVal: card.dateShift || '', + tooltip: '鍙互濉叆涓婄骇瀛楁锛岀敤浜庢帶鍒跺垵濮嬪�硷紝渚嬪锛氫笂绾у瓧娈靛�间负2023-12-10锛屽垵濮嬪�间负鏈湀锛屽垯鍒濆鍖洪棿涓� 2023-12-01 ~ 2023-12-31銆�', + required: false, + forbid: appType === 'mob' + }, + { type: 'radio', key: 'precision', label: '绮剧‘搴�', diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index e9f2311..c408e74 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -137,7 +137,7 @@ } else if (verify.accountdate === 'true' && !verify.accountfield) { error = '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�' } else if (verify.preHandle === 'true' && !verify.pre_func) { - error = '寮�鍚寜閽澶勭悊鏃讹紝闇�瑕佸~鍐欏鐞嗗嚱鏁帮紒' + error = '寮�鍚嚜瀹氫箟鑴氭湰鏃讹紝闇�瑕佸~鍐欏鐞嗗嚱鏁帮紒' } else if (verify.wxNote === 'true') { if (!verify.wxTemplateId) { error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕侀�夋嫨娑堟伅妯℃澘锛�' @@ -697,9 +697,9 @@ <Col span={24}></Col> <Col span={8}> <Form.Item label={ - <Tooltip placement="topRight" title="杩愯鏃朵慨鏀规寜閽弬鏁帮紝鍏ュ弬涓猴紙btn, systemType锛夈�傛敞锛歴ystemType涓虹郴缁熺被鍨嬶紝姝e紡绯荤粺涓簆roduction"> + <Tooltip placement="topRight" title="杩愯鏃朵慨鏀规寜閽弬鏁帮紝鍏ュ弬涓猴紙btn, position, systemType锛�,鏍囪#position-(init,inner,outer,callback)"> <QuestionCircleOutlined className="mk-form-tip" /> - 鎸夐挳棰勫鐞� + 鑷畾涔夎剼鏈� </Tooltip> }> <Radio.Group value={verify.preHandle || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'preHandle')}}> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index a74034f..606f277 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -30,7 +30,6 @@ class VerifyCard extends Component { static propTpyes = { - btnTab: PropTypes.any, // 琛ㄥ崟鏍囩椤碉紙鎸夐挳锛夊弬鏁� config: PropTypes.any, // 琛ㄥ崟鏍囩椤靛弬鏁� card: PropTypes.object, // 鎸夐挳淇℃伅 columns: PropTypes.array @@ -598,7 +597,7 @@ } UNSAFE_componentWillMount() { - const { columns, config, card, btnTab } = this.props + const { columns, config, card } = this.props const { appType } = this.state let _verify = fromJS(card.verify || {}).toJS() @@ -703,105 +702,131 @@ oriVerify: fromJS(_verify).toJS() }) - if (card.intertype === 'inner') { - return + if (card.intertype === 'inner') return + + let _fields = [] + if (card.OpenType === 'form') { + _fields.push({ + field: card.field, + label: card.label, + type: 'text' + }) + } else if (card.modal && (card.OpenType === 'pop' || !card.OpenType)) { + _fields = card.modal.fields || [] } - new Promise(resolve => { - let _fields = [] - if (card.OpenType === 'form') { - _fields.push({ - field: card.field, - label: card.label, - type: 'text' - }) - resolve(_fields) - } else if (card.modal && (card.OpenType === 'pop' || !card.OpenType)) { - _fields = card.modal.fields || [] - resolve(_fields) - // } else if (card.OpenType === 'pop') { - // Api.getCloudConfig({ - // func: 'sPC_Get_LongParam', - // MenuID: card.uuid - // }).then(res => { - // if (res.status) { - // let _LongParam = '' - // if (res.LongParam) { - // try { - // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - // } catch (e) { - // console.warn('Parse Failure') - // _LongParam = '' - // } - // } - - // if (!_LongParam) { - // message.warning('鏈幏鍙栧埌琛ㄥ崟淇℃伅锛岄儴鍒嗛獙璇佸皢鏃犳硶璁剧疆锛�') - // } else { - // _LongParam = updateForm(_LongParam) - // _fields = _LongParam.fields || [] - // } - // } else { - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 5 - // }) - // } - // resolve(_fields) - // }) + let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid', 'mk_deleted'] + let _declare = ['@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)', '@mk_deleted int'] + let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'', '@mk_deleted=1'] + let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) + let hasBid = false + + _usefulfields = [] + + fieldArr.push('bid') + + let verIndex = _fields.findIndex(item => item.type === 'vercode') + if (verIndex > -1) { + _fields = fromJS(_fields).toJS() + _fields.splice(verIndex, 0, { + type: 'text', + fieldlength: 50, + writein: 'false', + field: 'mk_timestamp' + }, { + type: 'text', + fieldlength: 50, + writein: 'false', + field: 'mk_send_type' + }, { + type: 'text', + fieldlength: 50, + writein: 'false', + field: 'mk_n_id' + }) + } + + _fields = _fields.filter(_f => _f.field) + _fields.forEach(_f => { + if (_f.field.toLowerCase() === 'bid') { + hasBid = true + } + + if (fieldArr.includes(_f.field.toLowerCase())) return + + fieldArr.push(_f.field.toLowerCase()) + + _usefulfields.push(_f.field) + + let _fieldlen = _f.fieldlength || 50 + + if (_f.type === 'number') { + _fieldlen = _f.decimal ? _f.decimal : 0 + } + + if (_fieldlen > 4000) { + _fieldlen = 'max' + } + + let _type = `nvarchar(${_fieldlen})` + + if (_f.type.match(/date/ig)) { + _type = 'datetime' + _select.push(`@${_f.field}='1949-10-01'`) + } else if (_f.type === 'number') { + _type = `decimal(18,${_fieldlen})` + _select.push(`@${_f.field}=0`) + } else if (_f.declare === 'decimal') { + _type = `decimal(18,${_f.decimal || 0})` + _select.push(`@${_f.field}=0`) + } else if (_f.type === 'rate') { + _type = `decimal(18,2)` + _select.push(`@${_f.field}=0`) } else { - resolve(_fields) - } - }).then(_fields => { - let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid', 'mk_deleted'] - let _declare = ['@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)', '@mk_deleted int'] - let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'', '@mk_deleted=1'] - let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) - let hasBid = false - - _usefulfields = [] - - fieldArr.push('bid') - - let verIndex = _fields.findIndex(item => item.type === 'vercode') - if (verIndex > -1) { - _fields = fromJS(_fields).toJS() - _fields.splice(verIndex, 0, { - type: 'text', - fieldlength: 50, - writein: 'false', - field: 'mk_timestamp' - }, { - type: 'text', - fieldlength: 50, - writein: 'false', - field: 'mk_send_type' - }, { - type: 'text', - fieldlength: 50, - writein: 'false', - field: 'mk_n_id' - }) + _select.push(`@${_f.field}=''`) } - _fields = _fields.filter(_f => _f.field) - _fields.forEach(_f => { - if (_f.field.toLowerCase() === 'bid') { - hasBid = true + _declare.push(`@${_f.field} ${_type}`) + }) + + let uniqueFields = fromJS(_fields).toJS() + + if (!hasBid) { // 鍞竴鎬ч獙璇佹坊鍔燘ID + uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) + _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) + } + + let unionFields = fromJS(_fields).toJS() + let formArr = _fields.map(_f => _f.field.toLowerCase()) + + if (card.Ot !== 'notRequired' && columns) { + columns.forEach(_f => { + if (!_f.field) return + + let key = _f.field.toLowerCase() + + if (!formArr.includes(key)) { + formArr.push(key) + unionFields.push(_f) } - if (fieldArr.includes(_f.field.toLowerCase())) return + if (fieldArr.includes(key)) return - fieldArr.push(_f.field.toLowerCase()) - + fieldArr.push(key) _usefulfields.push(_f.field) - let _fieldlen = _f.fieldlength || 50 + if (_f.datatype) { // 鑷畾涔夊瓧娈� + if (/decimal/ig.test(_f.datatype)) { + _select.push(`@${_f.field}=0`) + } else { + _select.push(`@${_f.field}=''`) + } - if (_f.type === 'number') { - _fieldlen = _f.decimal ? _f.decimal : 0 + _declare.push(`@${_f.field} ${_f.datatype}`) + return } + + let _fieldlen = _f.fieldlength || 50 if (_fieldlen > 4000) { _fieldlen = 'max' @@ -809,17 +834,13 @@ let _type = `nvarchar(${_fieldlen})` - if (_f.type.match(/date/ig)) { - _type = 'datetime' - _select.push(`@${_f.field}='1949-10-01'`) - } else if (_f.type === 'number') { - _type = `decimal(18,${_fieldlen})` - _select.push(`@${_f.field}=0`) - } else if (_f.declare === 'decimal') { - _type = `decimal(18,${_f.decimal || 0})` - _select.push(`@${_f.field}=0`) - } else if (_f.type === 'rate') { - _type = `decimal(18,2)` + if (_f.type === 'number') { + _type = `decimal(18,${_f.decimal ? _f.decimal : 0})` + } else if (_f.type === 'picture' || _f.type === 'textarea') { + _type = `nvarchar(${_fieldlen})` + } + + if (_f.type === 'number') { _select.push(`@${_f.field}=0`) } else { _select.push(`@${_f.field}=''`) @@ -827,271 +848,206 @@ _declare.push(`@${_f.field} ${_type}`) }) + } - let uniqueFields = fromJS(_fields).toJS() + let _sql = `Declare ${_declare.join(', ')} + Select ${_select.join(', ')} + ` - if (!hasBid) { // 鍞竴鎬ч獙璇佹坊鍔燘ID - uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) - _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) - } + // 榛樿sql + let _defaultsql = '' + let _insertsql = '' + let _updatesql = '' + let _primaryKey = config.setting.primaryKey || 'id' - let hasColumn = false - if (columns && columns.length > 0) { - if (btnTab) { // 琛ㄥ崟鏍囩 - hasColumn = btnTab.Ot !== 'notRequired' - } else if (card.Ot !== 'notRequired') { - hasColumn = true - } - } + if (this.props.side === 'sub') { + _primaryKey = config.setting.subKey || 'id' + } - let unionFields = fromJS(_fields).toJS() - let formArr = _fields.map(_f => _f.field.toLowerCase()) + if (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate') { + let keys = [] + let values = [] - if (hasColumn) { - columns.forEach(_f => { - if (_f.field && !formArr.includes(_f.field.toLowerCase())) { - formArr.push(_f.field.toLowerCase()) - unionFields.push(_f) - } - if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return + _fields.forEach(item => { + if (!item.field || item.writein === 'false') return - fieldArr.push(_f.field.toLowerCase()) - _usefulfields.push(_f.field) + keys.push(item.field.toLowerCase()) - if (_f.datatype) { // 鑷畾涔夊瓧娈� - if (/decimal/ig.test(_f.datatype)) { - _select.push(`@${_f.field}=0`) - } else { - _select.push(`@${_f.field}=''`) - } - - _declare.push(`@${_f.field} ${_f.datatype}`) - return - } - - let _fieldlen = _f.fieldlength || 50 - - if (_fieldlen > 4000) { - _fieldlen = 'max' - } - - let _type = `nvarchar(${_fieldlen})` - - if (_f.type === 'number') { - _type = `decimal(18,${_f.decimal ? _f.decimal : 0})` - } else if (_f.type === 'picture' || _f.type === 'textarea') { - _type = `nvarchar(${_fieldlen})` - } - - if (_f.type === 'number') { - _select.push(`@${_f.field}=0`) - } else { - _select.push(`@${_f.field}=''`) - } - - _declare.push(`@${_f.field} ${_type}`) - }) - } - - let _sql = `Declare ${_declare.join(', ')} - Select ${_select.join(', ')} - ` - - // 榛樿sql - let _defaultsql = '' - let _insertsql = '' - let _updatesql = '' - let _primaryKey = config.setting.primaryKey || 'id' - - if (this.props.side === 'sub') { - _primaryKey = config.setting.subKey || 'id' - } - - if (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate') { - let keys = [] - let values = [] - - _fields.forEach(item => { - if (!item.field || item.writein === 'false') return - - keys.push(item.field.toLowerCase()) - - if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') { - values.push('@BID@') - } else { - values.push('@' + item.field) - } - }) - - if (!keys.includes(_primaryKey.toLowerCase())) { - keys.push(_primaryKey.toLowerCase()) - values.push('@ID@') - } - if (!keys.includes('createuserid')) { - keys.push('createuserid') - values.push('@userid@') - } - if (!keys.includes('createuser')) { - keys.push('createuser') - values.push('@username') - } - if (!keys.includes('createstaff')) { - keys.push('createstaff') - values.push('@fullname') - } - if (!keys.includes('bid')) { - keys.push('bid') + if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') { values.push('@BID@') - } - if (!keys.includes('typename')) { - keys.push('typename') - values.push('@typename@') - } - - keys = keys.join(', ') - values = values.join(', ') - _insertsql = `insert into ${card.sql} (${keys}) select ${values};` - } - - if (card.sqlType === 'update' || card.sqlType === 'audit' || card.sqlType === 'insertOrUpdate') { - let _form = [] - let _arr = [] - - _fields.forEach(item => { - if (!item.field || item.writein === 'false' || item.uuid === 'BID') return - - _arr.push(item.field.toLowerCase()) - if (item.field.toLowerCase() === 'bid') { - _form.push(item.field + '=@BID@') - } else { - _form.push(item.field + '=@' + item.field) - } - }) - - if (this.props.card.sqlType === 'audit') { - if (!_arr.includes('submitdate')) { - _form.push('submitdate=getdate()') - } - if (!_arr.includes('submituser')) { - _form.push('submituser=@username') - } - if (!_arr.includes('submitstaff')) { - _form.push('submitstaff=@fullname') - } - if (!_arr.includes('submituserid')) { - _form.push('submituserid=@userid@') - } - if (!_arr.includes('typename')) { - _form.push(`typename=@typename@`) - } } else { - if (!_arr.includes('modifydate')) { - _form.push('modifydate=getdate()') - } - if (!_arr.includes('modifyuser')) { - _form.push('modifyuser=@username') - } - if (!_arr.includes('modifystaff')) { - _form.push('modifystaff=@fullname') - } - if (!_arr.includes('modifyuserid')) { - _form.push('modifyuserid=@userid@') - } - if (!_arr.includes('typename')) { - _form.push(`typename=@typename@`) - } + values.push('@' + item.field) } - - if (_verify.voucher && _verify.voucher.enabled) { - if (!_arr.includes('bvoucher')) { - _form.push('BVoucher=@BVoucher') - } - if (!_arr.includes('fibvoucherdate')) { - _form.push('FIBVoucherDate=@FIBVoucherDate') - } - if (!_arr.includes('fiyear')) { - _form.push('FiYear=@FiYear') - } - } - - _form = _form.join(', ') - _updatesql = `update ${card.sql} set ${_form} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` - } - - if (card.sqlType === 'insert') { - _defaultsql = _insertsql - } else if (card.sqlType === 'update' || card.sqlType === 'audit') { - _defaultsql = _updatesql - } else if (card.sqlType === 'insertOrUpdate') { - _defaultsql += `select @tbid='' - select @tbid='X' from ${card.sql} where ${_primaryKey}=@ID@ - if @tbid='' - begin - ${_insertsql} - end - else - begin - ${_updatesql} - end - ` - } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') { - let _voucher = '' - if (_verify.voucher && _verify.voucher.enabled) { - _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' - } - _defaultsql = `update ${card.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@${_voucher} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` - } else if (card.sqlType === 'delete') { - let _msg = '' - if (columns && columns.length > 0 && card.Ot !== 'notRequired') { - let _index = 0 - columns.forEach(col => { - if (!col.field || col.Hide === 'true' || _index >= 4) return - - _msg += col.label + '=\'\',' - _index++ - }) - } - _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` - } - - let _columns = [] - if (columns) { - _columns = fromJS(columns).toJS() - let hasbid = false - _columns = _columns.filter(col => { - if (col.field && col.field.toLowerCase() === 'bid') { - hasbid = true - } - - return !!col.field - }) - - if (!hasbid) { - _columns.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) - } - } - - this.setState({ - fields: _fields, - columnsFields: _columns, - initsql: _sql, - defaultsql: _defaultsql, - usefulfields: _usefulfields.join(', '), - uniqueColumns: this.state.uniqueColumns.map(col => { - if (col.dataIndex === 'field') { - col.options = uniqueFields - } - return col - }), - onceUniqueColumns: this.state.onceUniqueColumns.map(col => { - if (col.dataIndex === 'field') { - col.options = _columns - } - return col - }), - unionFields, - uniqueFields }) + + if (!keys.includes(_primaryKey.toLowerCase())) { + keys.push(_primaryKey.toLowerCase()) + values.push('@ID@') + } + if (!keys.includes('createuserid')) { + keys.push('createuserid') + values.push('@userid@') + } + if (!keys.includes('createuser')) { + keys.push('createuser') + values.push('@username') + } + if (!keys.includes('createstaff')) { + keys.push('createstaff') + values.push('@fullname') + } + if (!keys.includes('bid')) { + keys.push('bid') + values.push('@BID@') + } + if (!keys.includes('typename')) { + keys.push('typename') + values.push('@typename@') + } + + keys = keys.join(', ') + values = values.join(', ') + _insertsql = `insert into ${card.sql} (${keys}) select ${values};` + } + + if (card.sqlType === 'update' || card.sqlType === 'audit' || card.sqlType === 'insertOrUpdate') { + let _form = [] + let _arr = [] + + _fields.forEach(item => { + if (!item.field || item.writein === 'false' || item.uuid === 'BID') return + + _arr.push(item.field.toLowerCase()) + if (item.field.toLowerCase() === 'bid') { + _form.push(item.field + '=@BID@') + } else { + _form.push(item.field + '=@' + item.field) + } + }) + + if (this.props.card.sqlType === 'audit') { + if (!_arr.includes('submitdate')) { + _form.push('submitdate=getdate()') + } + if (!_arr.includes('submituser')) { + _form.push('submituser=@username') + } + if (!_arr.includes('submitstaff')) { + _form.push('submitstaff=@fullname') + } + if (!_arr.includes('submituserid')) { + _form.push('submituserid=@userid@') + } + if (!_arr.includes('typename')) { + _form.push(`typename=@typename@`) + } + } else { + if (!_arr.includes('modifydate')) { + _form.push('modifydate=getdate()') + } + if (!_arr.includes('modifyuser')) { + _form.push('modifyuser=@username') + } + if (!_arr.includes('modifystaff')) { + _form.push('modifystaff=@fullname') + } + if (!_arr.includes('modifyuserid')) { + _form.push('modifyuserid=@userid@') + } + if (!_arr.includes('typename')) { + _form.push(`typename=@typename@`) + } + } + + if (_verify.voucher && _verify.voucher.enabled) { + if (!_arr.includes('bvoucher')) { + _form.push('BVoucher=@BVoucher') + } + if (!_arr.includes('fibvoucherdate')) { + _form.push('FIBVoucherDate=@FIBVoucherDate') + } + if (!_arr.includes('fiyear')) { + _form.push('FiYear=@FiYear') + } + } + + _form = _form.join(', ') + _updatesql = `update ${card.sql} set ${_form} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` + } + + if (card.sqlType === 'insert') { + _defaultsql = _insertsql + } else if (card.sqlType === 'update' || card.sqlType === 'audit') { + _defaultsql = _updatesql + } else if (card.sqlType === 'insertOrUpdate') { + _defaultsql += `select @tbid='' + select @tbid='X' from ${card.sql} where ${_primaryKey}=@ID@ + if @tbid='' + begin + ${_insertsql} + end + else + begin + ${_updatesql} + end + ` + } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') { + let _voucher = '' + if (_verify.voucher && _verify.voucher.enabled) { + _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' + } + _defaultsql = `update ${card.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@${_voucher} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` + } else if (card.sqlType === 'delete') { + let _msg = '' + if (columns && columns.length > 0 && card.Ot !== 'notRequired') { + let _index = 0 + columns.forEach(col => { + if (!col.field || col.Hide === 'true' || _index >= 4) return + + _msg += col.label + '=\'\',' + _index++ + }) + } + _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` + } + + let _columns = [] + if (columns) { + _columns = fromJS(columns).toJS() + let hasbid = false + _columns = _columns.filter(col => { + if (col.field && col.field.toLowerCase() === 'bid') { + hasbid = true + } + + return !!col.field + }) + + if (!hasbid) { + _columns.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) + } + } + + this.setState({ + fields: _fields, + columnsFields: _columns, + initsql: _sql, + defaultsql: _defaultsql, + usefulfields: _usefulfields.join(', '), + uniqueColumns: this.state.uniqueColumns.map(col => { + if (col.dataIndex === 'field') { + col.options = uniqueFields + } + return col + }), + onceUniqueColumns: this.state.onceUniqueColumns.map(col => { + if (col.dataIndex === 'field') { + col.options = _columns + } + return col + }), + unionFields, + uniqueFields }) } @@ -1287,6 +1243,8 @@ } scriptsChange = (values) => { + const { columns, card } = this.props + let verify = fromJS(this.state.verify).toJS() if (values.uuid) { @@ -1302,6 +1260,35 @@ verify.scripts.push(values) } + if (/@bvoucher(\s|\))/ig.test(values.sql)) { + if (verify.voucher && verify.voucher.enabled) { + + } else if (card.Ot !== 'notRequired' && columns) { + let hasvoucher = false + columns.forEach(_f => { + if (!_f.field) return + + if (_f.field.toLowerCase() === 'bvoucher') { + hasvoucher = true + } + }) + + if (!hasvoucher) { + notification.warning({ + top: 92, + message: '鏈惎鐢ㄥ垱寤哄嚟璇侊紝涓斿瓧娈甸泦涓笉瀛樺湪鍑瘉瀛楁锛坆voucher锛夈��', + duration: 5 + }) + } + } else { + notification.warning({ + top: 92, + message: '鏈惎鐢ㄥ垱寤哄嚟璇侊紝涓斿瓧娈甸泦涓笉瀛樺湪鍑瘉瀛楁锛坆voucher锛夈��', + duration: 5 + }) + } + } + MKEmitter.emit('editLineId', values.uuid) this.setState({ verify }) diff --git a/src/utils/option.js b/src/utils/option.js index 6d71ffd..54180b1 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -1,6 +1,4 @@ import nortable from '@/assets/img/normaltable.jpg' -// import mainsubtable from '@/assets/img/mainsubtable.jpg' -// import treepage from '@/assets/img/treepage.jpg' import customImg from '@/assets/img/custom.jpg' import newpage from '@/assets/img/newpage.jpg' import rolemanage from '@/assets/img/rolemanage.jpg' diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index d08226b..b95c0eb 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1648,6 +1648,14 @@ } } } + + if (['pop', 'prompt', 'exec'].includes(cell.OpenType) && cell.verify && !cell.output) { + if (cell.verify.noteEnable === 'true') { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊肩煭淇″彂閫佹棤鏁堬紒`}) + } else if (cell.verify.emailEnable === 'true') { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊奸偖浠跺彂閫佹棤鏁堬紒`}) + } + } } if (card.$c_ac) { diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index eef1007..5b82a9a 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -69,6 +69,12 @@ } else { param.$token = setting.exInterface || '' } + } else if (setting.sysInterface === 'custom') { + if (window.GLOB.systemType === 'production') { + param.rduri = setting.proInterface + } else { + param.rduri = setting.interface + } } else { if (window.GLOB.systemType === 'production' && setting.proInterface) { param.rduri = setting.proInterface @@ -278,9 +284,9 @@ param.menuname = setting.$name } - param.custom_script = Utils.formatOptions(_customScript) - param.LText = Utils.formatOptions(LText) - param.DateCount = Utils.formatOptions(DateCount) + param.custom_script = Utils.formatOptions(_customScript, param.exec_type) + param.LText = Utils.formatOptions(LText, param.exec_type) + param.DateCount = Utils.formatOptions(DateCount, param.exec_type) if (setting.sub_field) { param.sub_name = setting.subdata @@ -301,10 +307,6 @@ param.s_debug_type = 'Y' } - if (window.GLOB.forcedUpdate) { - param.s_version_up = 'true' - } - if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) @@ -312,6 +314,8 @@ if (setting.tableName === 's_custom_script' && window.GLOB.mainSystemApi) { param.rduri = window.GLOB.mainSystemApi } + } else if (window.GLOB.forcedUpdate) { + param.s_version_up = 'true' } return param @@ -516,7 +520,6 @@ /** * @description 鐢熸垚sPC_Get_structured_data璇锋眰鍙傛暟 - * 1銆佹妸澶ф帴鍙PC_Get_structured_data鐨刲text鎷嗘垚涓変唤锛岀涓�娈碉細@LText1锛岀浜屾@LText锛岀涓夋@LText2 */ export function getStructuredParams (params, config, BID) { let LText_field = [] @@ -564,8 +567,6 @@ let param = { func: 'sPC_Get_structured_data', - LText: _LText.join(' union all '), - LText_field: LText_field.join(' union all '), BID: BID, username: sessionStorage.getItem('User_Name') || '', fullName: sessionStorage.getItem('Full_Name') || '' @@ -575,12 +576,13 @@ param.menuname = config.MenuName } - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText1 = LText1 - param.LText = LText - param.LText2 = LText2 - param.LText_field = Utils.formatOptions(param.LText_field) + param.exec_type = 'y' + param.LText = Utils.formatOptions(_LText.join(' union all ')) + param.custom_script = Utils.formatOptions(LText_field.join(' union all ')) + // param.LText1 = LText1 + // param.LText = LText + // param.LText2 = LText2 + // param.LText_field = Utils.formatOptions(param.LText_field) if (config.cacheUseful === 'true') { param.time_type = config.timeUnit @@ -592,7 +594,7 @@ } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) return param } \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js index 3177c1d..fb3811a 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1,6 +1,7 @@ import React from 'react' import moment from 'moment' import md5 from 'md5' +// import NodeRSA from 'node-rsa' const formatKeys = [ { key: 'select', value: ' msltk ' }, @@ -119,10 +120,8 @@ * @description sql鍔犲瘑 * @return {String} value */ - static formatOptions (value) { + static formatOptions (value, exec_type = '') { if (!value) return '' - - let salt = 'minKe' // 鐩愬�� value = value.replace(/\n/ig, ' \n ') // 鏇挎崲鍏抽敭瀛� @@ -136,13 +135,43 @@ if (window.GLOB.externalDatabase !== null) { value = value.replace(/@db@/ig, window.GLOB.externalDatabase) } - // encode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛� - value = window.btoa(window.encodeURIComponent(value)) - // 鎻掑叆瀛楃 - let index = Math.floor(value.length / 2) - value = value.slice(0, index) + salt + value.slice(index) - // base64鍔犲瘑 - value = window.btoa(value) + + // if (exec_type === 'x') { + // // let publicKey = `-----BEGIN PUBLIC KEY----- + // // MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwGxFURiCrk5a2xfWuM3W + // // 2lkS3ioZhUFXpkK1inMivItsA/J8MTaBB3EAVxC29xdVCU+xOzs512PuD2b1sjzX + // // jwO6kx433NtB2okqGiP4RkzhEJHwdyc9dPUKdjirDznUWI9R7WayAf5Z4COhMsj2 + // // IbkyJgkb6Ivn0UgU0GSWc92HqJJmnb3Ti2gk6A2+oybz2RE3+xB/yOaNu3xav4yi + // // xxo6harVLNBiaU+D7aDed1W3kE20gLOnEAvcLMjpe3n/QvF5RtELsm3T+vH3TIT2 + // // GI9+8cT20NZ2d7i41+j/AQZiPJNS3MVmc3aIhuyCOsNPLmvbZZi1KPSJIqkCwdEg + // // mQIDAQAB + // // -----END PUBLIC KEY-----` + + // // let pubKey = new NodeRSA(publicKey, 'pkcs8-public') + + // // value = window.encodeURIComponent(value) + // // value = pubKey.encrypt(value, 'base64') + + // // const priKey = new NodeRSA(privateKey, 'pkcs8-private') + // // const res = priKey.decrypt(value, 'utf8') + // } else { + // encode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛� + // let str = window.encodeURIComponent(value) + + // if (str.length % 3 === 1) { + // str += '%2F*123*%2F' + // } else if (str.length % 3 === 2) { + // str += '%2F*12*%2F' + // } + + value = window.btoa(window.encodeURIComponent(value)) + // 鎻掑叆瀛楃 + let salt = 'minKe' // 鐩愬�� + let index = Math.floor(value.length / 2) + value = value.slice(0, index) + salt + value.slice(index) + // base64鍔犲瘑 + value = window.btoa(value) + // } return value } @@ -169,59 +198,6 @@ // return value // } - - /** - * @description sPC_TableData_InUpDe sql鍔犲瘑 - * @return {String} value - */ - static sPCInUpDeFormatOptions (value) { - if (!value) return {LText: '', LText1: '', LText2: ''} - let salt = 'minKe' // 鐩愬�� - - value = value.replace(/\n/ig, ' \n ') - // 鏇挎崲鍏抽敭瀛� - formatKeys.forEach(item => { - let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') - value = value.replace(reg, item.value) - }) - - // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛� - value = value.replace(/%/ig, ' mpercent ') - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - value = value.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - let encodesql = (val) => { - if (!val) return '' - - let _value = window.btoa(window.encodeURIComponent(val)) - - // 鎻掑叆瀛楃 - let index = Math.floor(_value.length / 2) - _value = _value.slice(0, index) + salt + _value.slice(index) - - // base64鍔犲瘑 - return window.btoa(_value) - } - - let len = value.length - // 娉細LText 涓� LText1 椤哄簭棰犲�� - if (len > 1000) { - let limit = Math.floor(len / 3) - return { - LText1: encodesql(value.substring(0, limit)), - LText: encodesql(value.substring(limit, limit * 2)), - LText2: encodesql(value.substring(limit * 2)) - } - } else { - return { - LText1: '', - LText: encodesql(value), - LText2: '' - } - } - } /** * @description 鍒濆鍖栨悳绱㈡潯浠跺垵濮嬪�� @@ -260,10 +236,44 @@ format = 'YYYY-MM-DD HH:mm:ss' } + item.format = format item.initval = item.initval ? moment().subtract(item.initval, 'days').format(format) : '' } else if (item.type === 'datemonth') { - item.initval = item.initval ? moment().subtract(item.initval, 'month').format('YYYY-MM') : '' + item.format = 'YYYY-MM' + + if (item.initval) { + if (!item.dateShift) { + item.initval = moment().subtract(item.initval, 'month').format('YYYY-MM') + } else { + item.$initval = item.initval + item.$supId = config.$pageId + if (config.setting && config.setting.supModule) { + item.$supId = config.setting.supModule + + config.checkBid = true + config.setting.checkBid = true + item.checkShift = true + } + + item.initval = '' + + let d = '' + if (window.GLOB.CacheData.has(item.$supId)) { + d = window.GLOB.CacheData.get(item.$supId) + d = d[item.dateShift] || '' + if (d) { + d = moment(d).format('YYYY-MM-DD') + d = d === 'Invalid date' ? '' : d + } + } + + if (d) { + item.initval = moment(d).subtract(item.initval, 'month').format('YYYY-MM') + } + } + } } else if (item.type === 'dateweek') { + item.format = 'YYYY-MM-DD' item.initval = item.initval ? moment().subtract(item.initval * 7, 'days').format('YYYY-MM-DD') : '' } else if (item.type === 'daterange') { let format = 'YYYY-MM-DD' @@ -276,19 +286,66 @@ } else if (item.precision === 'second') { format = 'YYYY-MM-DD HH:mm:ss' } - if (item.initval === 'week') { - item.initval = [moment().startOf('week').format(format), moment().endOf('week').format(format)].join(',') - } else if (item.initval === 'month') { - item.initval = [moment().startOf('month').format(format), moment().endOf('month').format(format)].join(',') - } else if (item.initval === 'lastMonth') { - item.initval = [moment().subtract(1, 'months').startOf('month').format(format), moment().subtract(1, 'months').endOf('month').format(format)].join(',') - } else if (item.initval) { - try { - let _initval = JSON.parse(item.initval) - let _vals = [moment().subtract(_initval[0], 'days').format(format), moment().subtract(_initval[1], 'days').format(format)] - item.initval = _vals.join(',') - } catch (e) { + + item.format = format + + if (item.initval) { + if (!item.dateShift) { + if (item.initval === 'week') { + item.initval = [moment().startOf('week').format(format), moment().endOf('week').format(format)].join(',') + } else if (item.initval === 'month') { + item.initval = [moment().startOf('month').format(format), moment().endOf('month').format(format)].join(',') + } else if (item.initval === 'lastMonth') { + item.initval = [moment().subtract(1, 'months').startOf('month').format(format), moment().subtract(1, 'months').endOf('month').format(format)].join(',') + } else if (item.initval) { + try { + let _initval = JSON.parse(item.initval) + let _vals = [moment().subtract(_initval[0], 'days').format(format), moment().subtract(_initval[1], 'days').format(format)] + item.initval = _vals.join(',') + } catch (e) { + item.initval = '' + } + } + } else { + item.$initval = item.initval + item.$supId = config.$pageId + if (config.setting && config.setting.supModule) { + item.$supId = config.setting.supModule + + config.checkBid = true + config.setting.checkBid = true + item.checkShift = true + } + item.initval = '' + + let d = '' + if (window.GLOB.CacheData.has(item.$supId)) { + d = window.GLOB.CacheData.get(item.$supId) + d = d[item.dateShift] || '' + if (d) { + d = moment(d).format('YYYY-MM-DD') + d = d === 'Invalid date' ? '' : d + } + } + + if (d) { + if (item.$initval === 'week') { + item.initval = [moment(d).startOf('week').format(format), moment(d).endOf('week').format(format)].join(',') + } else if (item.$initval === 'month') { + item.initval = [moment(d).startOf('month').format(format), moment(d).endOf('month').format(format)].join(',') + } else if (item.$initval === 'lastMonth') { + item.initval = [moment(d).subtract(1, 'months').startOf('month').format(format), moment(d).subtract(1, 'months').endOf('month').format(format)].join(',') + } else { + try { + let _initval = JSON.parse(item.$initval) + let _vals = [moment(d).subtract(_initval[0], 'days').format(format), moment(d).subtract(_initval[1], 'days').format(format)] + item.initval = _vals.join(',') + } catch (e) { + item.initval = '' + } + } + } } } } else if (item.type === 'group') { @@ -348,9 +405,16 @@ item.initval = '' item.initType = '' } - } else if ((item.type === 'select' || item.type === 'link') && item.initval === '$first' && item.resourceType === '1') { - item.initval = '' - item.$first = true + } else if ((item.type === 'select' || item.type === 'link') && item.resourceType === '1') { + if (/@BID@/ig.test(item.dataSource) && config.setting && config.setting.supModule) { + config.checkBid = true + config.setting.checkBid = true + item.checkBid = true + } + if (item.initval === '$first') { + item.initval = '' + item.$first = true + } } item.oriInitval = item.initval @@ -2286,7 +2350,7 @@ z_debug_end: select @ErrorCode='E',@retmsg='debug_end' goto aaa` } - if (retmsg) { + if (retmsg || btn.returnValue === 'true') { _sql += ` aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@` diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index fd83600..d64cb91 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -44,7 +44,8 @@ visible: false, rePos: false, loading: false, - auto: true + auto: true, + ismob: /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent) } UNSAFE_componentWillMount() { @@ -166,8 +167,6 @@ sessionStorage.setItem('LoginUID', result.LoginUID || '') sessionStorage.setItem('dataM', 'false') - this.getMenuParam() - // 鑾峰彇绯荤粺淇℃伅 let _param = { func: 's_Get_style', @@ -198,6 +197,8 @@ document.getElementsByTagName('head')[0].appendChild(link) } } + + this.getMenuParam() }) } else { notification.warning({ @@ -249,6 +250,10 @@ lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭鍚敤锛岃鑱旂郴绠$悊鍛樸��' }) return + } + + if (config.webTitle) { + document.title = config.webTitle } config.style = config.style || {} @@ -837,8 +842,6 @@ let param = { func: 'sPC_Get_structured_data', - LText: LText.join(' union all '), - LText_field: LText_field.join(' union all '), BID: BID || '', username: userName, fullName: fullName @@ -848,10 +851,12 @@ param.menuname = MenuName } - param.LText = Utils.formatOptions(param.LText) - param.LText_field = Utils.formatOptions(param.LText_field) + param.exec_type = 'y' + param.LText = Utils.formatOptions(LText.join(' union all ')) + param.custom_script = Utils.formatOptions(LText_field.join(' union all ')) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) return param } @@ -1319,7 +1324,7 @@ } render() { - const { loadingview, viewlost, config, pages, auto, rePos, loading } = this.state + const { loadingview, viewlost, config, pages, auto, rePos, loading, ismob } = this.state return ( <div className="bill-print-wrap" > @@ -1329,8 +1334,8 @@ </div> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} {config && window.GLOB.breakpoint ? <DebugTable /> : null} - {pages && !loadingview && !viewlost ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null} - {!loadingview && !viewlost ? <div className="refresh-button"><Button icon="reload" size="large" shape="circle" onClick={this.reload}></Button></div> : null} + {pages && !loadingview && !viewlost && !ismob ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null} + {!loadingview && !viewlost && !ismob ? <div className="refresh-button"><Button icon="reload" size="large" shape="circle" onClick={this.reload}></Button></div> : null} </div> ) } diff --git a/src/views/design/header/index.scss b/src/views/design/header/index.scss index aef0f9b..13545dc 100644 --- a/src/views/design/header/index.scss +++ b/src/views/design/header/index.scss @@ -65,24 +65,24 @@ } } - .header-menu.level4 { - li { - cursor: default; - &:hover { - span { - cursor: default; - color: rgba(255, 255, 255, 0.65); - border-bottom: none; - } - } - &.active { - span { - color: #ffffff; - border-bottom: 4px solid #1890ff; - } - } - } - } + // .header-menu.level4 { + // li { + // cursor: default; + // &:hover { + // span { + // cursor: default; + // color: rgba(255, 255, 255, 0.65); + // border-bottom: none; + // } + // } + // &.active { + // span { + // color: #ffffff; + // border-bottom: 4px solid #1890ff; + // } + // } + // } + // } .header-setting { float: right; diff --git a/src/views/menudesign/homeform/index.jsx b/src/views/menudesign/homeform/index.jsx index 427ff91..354951b 100644 --- a/src/views/menudesign/homeform/index.jsx +++ b/src/views/menudesign/homeform/index.jsx @@ -126,6 +126,19 @@ <Row> <Col span={24}> <Form.Item label={ + <Tooltip placement="topLeft" title="棣栭〉涓嶈繘琛屾潈闄愭帶鍒躲��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鏉冮檺楠岃瘉 + </Tooltip> + }> + <Radio.Group value={'false'} disabled={true}> + <Radio value="true">浣跨敤</Radio> + <Radio value="false">涓嶄娇鐢�</Radio> + </Radio.Group> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label={ <Tooltip placement="topLeft" title="鏁版嵁浼氱紦瀛樺埌鐢ㄦ埛鏈湴锛屾柟渚块〉闈㈠揩閫熷憟鐜般��"> <QuestionCircleOutlined className="mk-form-tip" /> 鏈湴缂撳瓨 diff --git a/src/views/menudesign/printmenuform/index.jsx b/src/views/menudesign/printmenuform/index.jsx index 315cbe0..5809dcd 100644 --- a/src/views/menudesign/printmenuform/index.jsx +++ b/src/views/menudesign/printmenuform/index.jsx @@ -257,6 +257,18 @@ })(<Input onChange={(e) => this.selectChange('callNo', e.target.value)}/>)} </Form.Item> </Col> : null} + <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍙嚜瀹氫箟鍦ㄦ祻瑙堝櫒鏍囬鏍忎腑鏄剧ず鐨勭綉椤垫爣棰樸��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 缃戦〉鏍囬 + </Tooltip> + }> + {getFieldDecorator('webTitle', { + initialValue: config.webTitle || '' + })(<Input onChange={(e) => this.selectChange('webTitle', e.target.value)}/>)} + </Form.Item> + </Col> </Row> </Form> ) -- Gitblit v1.8.0