From be22457344d6d3fc079de2a4f0a1e06e4c0f85c3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 06 七月 2022 22:55:14 +0800 Subject: [PATCH] 2022-07-06 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 13 + src/views/interface/header/index.jsx | 3 src/tabviews/zshare/actionList/funczip/index.jsx | 448 ++++++++++++++++++++++++++++++++++ package-lock.json | 20 src/views/login/loginform.jsx | 2 src/templates/zshare/formconfig.jsx | 40 ++ src/menu/components/share/actioncomponent/formconfig.jsx | 10 src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 7 src/templates/zshare/verifycard/index.jsx | 71 +++++ src/tabviews/zshare/actionList/funcMegvii/index.jsx | 4 src/menu/components/share/actioncomponent/index.jsx | 4 src/menu/components/share/actioncomponent/actionform/index.jsx | 7 src/tabviews/zshare/actionList/funczip/index.scss | 26 ++ src/tabviews/zshare/actionList/index.jsx | 14 + src/api/index.js | 23 + src/tabviews/zshare/actionList/funczip/mock.js | 27 ++ package.json | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 17 18 files changed, 699 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index d03c7e7..33515f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9261,6 +9261,11 @@ "schema-utils": "^1.0.0" } }, + "file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -10746,7 +10751,7 @@ "immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" }, "immer": { "version": "1.10.0", @@ -12430,14 +12435,14 @@ } }, "jszip": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.6.0.tgz", - "integrity": "sha512-jgnQoG9LKnWO3mnVNBnfhkh0QknICd1FGSrXcgrl67zioyJ4wgx25o9ZqwNtrROSflGBCGYnJfjrIyRIby1OoQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.0.tgz", + "integrity": "sha512-LDfVtOLtOxb9RXkYOwPyNBTQDL4eUbqahtoY6x07GiDJHwSYvn8sHHIw8wINImV3MqbMNve2gSuM1DDqEKk09Q==", "requires": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", - "set-immediate-shim": "~1.0.1" + "setimmediate": "^1.0.5" } }, "killable": { @@ -18842,11 +18847,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, "set-value": { "version": "2.0.1", diff --git a/package.json b/package.json index 8eab051..6e1cd73 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "eslint-plugin-react-hooks": "^1.6.1", "exceljs": "^4.2.1", "file-loader": "3.0.1", + "file-saver": "^2.0.5", "fs-extra": "7.0.1", "html-webpack-plugin": "4.0.0-beta.5", "html2canvas": "^1.0.0-rc.7", @@ -60,6 +61,7 @@ "js-table2excel": "^1.0.3", "jsbarcode": "^3.11.3", "jssha": "^3.2.0", + "jszip": "^3.10.0", "md5": "^2.2.1", "mini-css-extract-plugin": "0.5.0", "moment": "^2.24.0", diff --git a/src/api/index.js b/src/api/index.js index bdaed71..66895b6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -108,6 +108,29 @@ } /** + * @description 寰俊涓氬姟璇锋眰 + */ + wxRequest (url, method, param) { + let _url = window.GLOB.location + ':8080/' + window.GLOB.service + url + if (process.env.NODE_ENV === 'production') { + _url = document.location.origin + ':8080/' + window.GLOB.service + url + } + + if (param) { + return axios({ + url: _url, + method, + data: param + }) + } else { + return axios({ + url: _url, + method + }) + } + } + + /** * @description 鐩存帴璇锋眰 * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁� */ diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 8a076cb..4a1fae8 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -383,6 +383,11 @@ shows.push('reload') } else if (_funcType === 'megvii') { shows.push('subFunc', 'progress') + } else if (_funcType === 'filezip') { + reOptions.Ot = requireOptions + reRequired.innerFunc = false + + shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey') } else if (_funcType === 'pay') { shows.push('payType', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) @@ -670,7 +675,7 @@ ] if (item.key === 'innerFunc') { - let str = '^(' + item.fields.join('|') + ')' + let str = item.fields && item.fields.length ? '^(' + item.fields.join('|') + ')' : '^' let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') rules.push( { pattern: _patten, message: formRule.func.innerMessage }, diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 324781d..1a74d4d 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -89,6 +89,7 @@ { value: 'print', text: '鏍囩鎵撳嵃' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, + { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] if (isApp) { @@ -303,6 +304,15 @@ required: false, }, { + type: 'text', + key: 'urlkey', + label: '鍦板潃瀛楁', + initVal: card.urlkey || '', + tooltip: '鍥剧墖锛堟枃浠讹級閾炬帴鐨勫瓧娈靛悕銆�', + required: false, + readonly: false + }, + { type: 'select', key: 'pageTemplate', label: Formdict['model.form.newpage.type'], diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index aed95d3..8d5a172 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -173,6 +173,10 @@ let functip = <div> <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p> </div> + + if (!ableField) { // 鏃犲瓧娈甸檺鍒� + functip = '' + } let menulist = sessionStorage.getItem('fstMenuList') if (menulist) { diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index e0d6d11..00b8a4e 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -23,6 +23,7 @@ const ChangeUserButton = asyncComponent(() => import('@/tabviews/zshare/actionList/changeuserbutton')) const PrintButton = asyncComponent(() => import('@/tabviews/zshare/actionList/printbutton')) const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) +const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const BarCode = asyncElementComponent(() => import('@/components/barcode')) const QrCode = asyncElementComponent(() => import('@/components/qrcode')) const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) @@ -887,6 +888,18 @@ /> </Col> ) + } else if (card.funcType === 'filezip') { + return ( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <FuncZip + btn={card} + BID={data.$$BID} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) } } } diff --git a/src/tabviews/zshare/actionList/funcMegvii/index.jsx b/src/tabviews/zshare/actionList/funcMegvii/index.jsx index d2d9145..246c2b5 100644 --- a/src/tabviews/zshare/actionList/funcMegvii/index.jsx +++ b/src/tabviews/zshare/actionList/funcMegvii/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { withRouter } from 'react-router' import { is, fromJS } from 'immutable' import { Button, Modal, notification, message, Progress } from 'antd' import CryptoJS from 'crypto-js' @@ -129,7 +128,6 @@ loading: true, lines: data }) - this.getIpList() } @@ -545,4 +543,4 @@ } } -export default withRouter(FuncButton) \ No newline at end of file +export default FuncButton \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/funczip/index.jsx b/src/tabviews/zshare/actionList/funczip/index.jsx new file mode 100644 index 0000000..12f24ae --- /dev/null +++ b/src/tabviews/zshare/actionList/funczip/index.jsx @@ -0,0 +1,448 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, Modal, notification, message, Progress } from 'antd' +import JSZip from 'jszip' +import { saveAs } from 'file-saver' + +import Utils from '@/utils/utils.js' +import Api from '@/api' +import MKEmitter from '@/utils/events.js' +import MkIcon from '@/components/mk-icon' + +import './index.scss' + +class FuncZip extends Component { + static propTpyes = { + btn: PropTypes.object, // 鎸夐挳 + disabled: PropTypes.any, // 琛屾寜閽鐢� + } + + state = { + loading: false, + disabled: false, + loadingNumber: '', + loadingTotal: '', + hidden: false, + visible: false + } + + UNSAFE_componentWillMount () { + const { btn, selectedData } = this.props + let disabled = false + + if (btn.controlField && selectedData && selectedData.length > 0) { // 琛ㄦ牸涓寜閽殣钘忔帶鍒� + selectedData.forEach(item => { + let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' + if (btn.controlVals.includes(s)) { + disabled = true + } + }) + this.setState({hidden: disabled && btn.control === 'hidden'}) + } + + if (this.props.disabled || disabled) { + this.setState({disabled: true}) + } + } + + componentDidMount () { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) + } + + UNSAFE_componentWillReceiveProps (nextProps) { + const { btn, selectedData } = this.props + + let disabled = false + if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { + if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 琛ㄦ牸涓寜閽殣钘忔帶鍒� + nextProps.selectedData.forEach(item => { + let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' + if (btn.controlVals.includes(s)) { + disabled = true + } + }) + } + this.setState({hidden: disabled && btn.control === 'hidden'}) + } + + if (nextProps.disabled || disabled) { + this.setState({disabled: true}) + } else { + this.setState({disabled: false}) + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (triggerId, record, type) => { + const { Tab, BID, btn, selectedData, setting } = this.props + const { loading, disabled } = this.state + + if (loading || disabled) return + if (triggerId && btn.uuid !== triggerId) return + + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { + notification.warning({ + top: 92, + message: '闇�瑕佷笂绾т富閿�硷紒', + duration: 5 + }) + return + } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) { + return + } + + let data = record || selectedData || [] + + if (btn.Ot !== 'notRequired' && data.length === 0) { + notification.warning({ + top: 92, + message: '璇烽�夋嫨琛岋紒', + duration: 5 + }) + return + } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { + notification.warning({ + top: 92, + message: '璇烽�夋嫨鍗曡鏁版嵁锛�', + duration: 5 + }) + return + } + + // Api.wxRequest('wxpay/getaccesstoken', 'get').then(res => { + // let token = res.oa_access_token + + // Api.wxRequest(`cgi-bin/template/get_all_private_template?access_token=${token}`, 'get') + + // }) + + this.setState({ + loading: true + }) + + if (btn.innerFunc) { + let params = [] + let param = { + func: btn.innerFunc, + BID: BID || '' + } + + if (btn.Ot === 'notRequired') { + params.push(param) + } else if (btn.Ot === 'requiredSgl') { + param.ID = data[0].$$uuid || '' + params.push(param) + } else if (btn.Ot === 'required') { + params = data.map(item => { + return { + ...param, + ID: item.$$uuid || '' + } + }) + } else if (btn.Ot === 'requiredOnce') { + param.ID = data.map(item => item.$$uuid || '').filter(Boolean).join(',') + params.push(param) + } + + this.getInnerData(params) + } else { + this.downloadZipImage(data, btn.urlkey).then((res) => { + if (res) { + this.execError({ErrCode: res}) + } else { + this.execSuccess() + } + }, (err) => { + this.execError({ErrCode: err}) + }) + } + } + + 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) + } + }) + } + + downloadZipImage = (imgArr, imgKey = '') => { + let images = [] + if (imgArr && imgArr.length > 0) { + let names = [] + let imgs = [] + imgArr.forEach(item => { + let itemImg = imgKey ? item[imgKey] : item + + if (!itemImg || !/^data:image|jpg$|jpeg$|png$|gif$/.test(itemImg)) return + if (imgs.includes(itemImg)) return + + let name = Utils.getguid() + '.png' + + if (/.(jpg|jpeg|png|gif)$/.test(itemImg)) { + let _name = itemImg.replace(/.*\//ig, '') + if (!names.includes(_name)) { + name = _name + } + } + + imgs.push(itemImg) + names.push(name) + + images.push({url: itemImg, name: name}) + }) + } + + if (images.length === 0) { + return Promise.reject('01') + } + + const zip = new JSZip() + const imgFolder = zip.folder('images') // 鍒涘缓images鏂囦欢澶� + + return new Promise((resolve, reject) => { + let deffers = images.map((img) => { + return new Promise(resolve => { + this.getBase64(img.url).then((base64) => { + if (base64) { + base64 = base64.split('base64,')[1] + imgFolder.file(img.name, base64, { + base64: true + }) + resolve(true) + } else { + resolve(false) + } + }) + }) + }) + + Promise.all(deffers).then((res) => { + let hasSuccess = res.filter((m) => m).length > 0 + let hasError = res.filter((m) => !m).length > 0 + + if (hasSuccess) { + zip.generateAsync({ + type: 'blob' + }).then((blob) => { + saveAs(blob, Utils.getguid() + '.zip') + if (hasError) { + resolve('02') + } else { + resolve('') + } + }) + } else { + reject('03') + } + }) + }) + } + + /** + * 灏嗗浘鐗囪浆鎹㈡垚base64 骞惰繑鍥炶矾寰� + * @param img + * @param {number} width 璋冪敤鏃朵紶鍏ュ叿浣撳儚绱犲�硷紝鎺у埗澶у皬 ,涓嶄紶鍒欓粯璁ゅ浘鍍忓ぇ灏� + * @param {number} height + * @returns {string} + */ + getBase64Image = (img, width = 0, height = 0) => { + const canvas = document.createElement('canvas') + canvas.width = width ? width : img.width + canvas.height = height ? height : img.height + + const ctx = canvas.getContext('2d') + ctx.drawImage(img, 0, 0, canvas.width, canvas.height) + const dataURL = canvas.toDataURL() + return dataURL + } + + /** + * 鍔犺浇鍥剧墖 鍔犺浇鎴愬姛鍚庣粡鍥剧墖杩斿洖 + * @param img + * @returns {Promise<any>} + */ + getBase64 = (img) => { + if (/^data:image/.test(img)) { + return Promise.resolve(img) + } else { + const image = new Image() + image.crossOrigin = '*' + image.src = img + return new Promise((resolve, reject) => { + image.onload = () => { + let base64 = '' + try { + base64 = this.getBase64Image(image) + } catch (e) { + base64 = '' + } + resolve(base64) + } + image.onerror = () => { + resolve('') + } + }) + } + } + + /** + * @description 鎿嶄綔鎴愬姛鍚庡鐞� + * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� + * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� + * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� + * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execSuccess = () => { + const { btn } = this.props + + this.setState({ + loading: false, + loadingNumber: '', + loadingTotal: '' + }) + + if (btn.execSuccess !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + } + } + + /** + * @description 鎿嶄綔澶辫触鍚庡鐞� + */ + execError = (res) => { + const { btn } = this.props + + this.setState({ + loading: false, + loadingNumber: '', + loadingTotal: '' + }) + + if (res.ErrCode === '01') { + message.error('鏈幏鍙栧埌涓嬭浇鏂囦欢銆�') + return + } else if (res.ErrCode === '02') { + Modal.error({ + title: '閮ㄥ垎鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + }) + return + } else if (res.ErrCode === '03') { + Modal.error({ + title: '鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + }) + return + } else if (res.ErrCode === 'E') { + Modal.error({ + title: res.message || res.ErrMesg, + }) + } else if (res.ErrCode === 'N') { + notification.error({ + top: 92, + message: res.message || res.ErrMesg, + duration: 10 + }) + } else if (res.ErrCode === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: res.message || res.ErrMesg, + duration: 10 + }) + } else if (res.ErrCode === 'NM') { + message.error(res.message || res.ErrMesg) + } + + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } + } + + render() { + const { btn } = this.props + const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state + + if (hidden) return null + + let label = '' + let icon = '' + let type = 'link' + let className = '' + + 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 + } + + if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) { + label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label + } + + return ( + <> + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} + </> + ) + } +} + +export default FuncZip \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/funczip/index.scss b/src/tabviews/zshare/actionList/funczip/index.scss new file mode 100644 index 0000000..8eccbd6 --- /dev/null +++ b/src/tabviews/zshare/actionList/funczip/index.scss @@ -0,0 +1,26 @@ +.ip-list-modal { + .ip-item { + display: inline-block; + border: 1px solid #d9d9d9; + padding: 10px; + height: 100px; + width: calc(33% - 20px); + margin: 10px; + cursor: pointer; + .ip { + color: #000000; + } + .remark { + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + } + .ip-item.active { + border-color: var(--mk-sys-color); + box-shadow: 0 0 2px var(--mk-sys-color); + } +} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/funczip/mock.js b/src/tabviews/zshare/actionList/funczip/mock.js new file mode 100644 index 0000000..669ad8e --- /dev/null +++ b/src/tabviews/zshare/actionList/funczip/mock.js @@ -0,0 +1,27 @@ +export const mockdata = { + data: [ + { + "recognition_type": "staff", + "id": "2226169", + "type": "persons", + "is_admin": "true", + "person_name": "king", + "card_number": "mk001", + "person_code": "2018", + "id_number": "130982193002054729", + "group_list": "1", + "face_data":"" + }, + { + "recognition_type": "staff", + "id": "3272487", + "is_admin": 'false', + "person_name": "jinfei", + "card_number": "mk002", + "person_code": "02", + "id_number": "", + "group_list": "1", + "face_data": "" + } + ] +} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 3b4c230..addbbd0 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -15,6 +15,7 @@ const ChangeUserButton = asyncComponent(() => import('./changeuserbutton')) const PrintButton = asyncComponent(() => import('./printbutton')) const FuncMegvii = asyncComponent(() => import('./funcMegvii')) +const FuncZip = asyncComponent(() => import('./funczip')) class ActionList extends Component { static propTpyes = { @@ -164,6 +165,19 @@ selectedData={selectedData} /> ) + } else if (item.funcType === 'filezip') { + return ( + <FuncZip + key={item.uuid} + show={item.show || 'actionList'} + disabled={lock || false} + BID={BID} + Tab={Tab} + btn={item} + setting={setting} + selectedData={selectedData} + /> + ) } } return null diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 296ae6e..d44dc4a 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1530,14 +1530,15 @@ }) } - if (btn.verify && btn.verify.noteEnable === 'true') { - this.sendMessage() - } - let id = '' if (btn.output) { id = res.mk_b_id || res[btn.output] || '' } + + if (btn.verify && btn.verify.noteEnable === 'true' && id) { + this.sendMessage(id) + } + if (res.mk_icon) { sessionStorage.setItem('avatar', res.mk_icon) } @@ -1595,13 +1596,14 @@ } } - sendMessage = () => { + sendMessage = (id) => { const { btn : { verify } } = this.props let param = { func: 's_get_sms_local', TypeCharOne: verify.noteTemp, // N涓嶅悓鍐呭锛孻鐩稿悓鍐呭 - TypeCharTwo: verify.noteType // N瀹氭椂锛孻瀹炴椂 + TypeCharTwo: verify.noteType, // N瀹氭椂锛孻瀹炴椂 + upid: id } param.LText = Utils.formatOptions(Utils.getuuid()) @@ -1680,13 +1682,14 @@ } if (Ltext.length === 0) return + Ltext = Ltext.join(';') _param.LText = window.btoa(window.encodeURIComponent(Ltext)) _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - _param.rduri = 'http://sso.mk9h.cn/webapi/dostars' + _param.rduri = 'https://sso.mk9h.cn/webapi/dostars' _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index c7167db..2f62125 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -275,6 +275,11 @@ shows.push('refreshTab') } else if (_funcType === 'megvii') { shows.push('subFunc', 'progress') + } else if (_funcType === 'filezip') { + reOptions.Ot = requireOptions + reRequired.innerFunc = false + + shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey') } } @@ -512,7 +517,7 @@ ] if (item.key === 'innerFunc') { - let str = '^(' + item.fields.join('|') + ')' + let str = item.fields && item.fields.length ? '^(' + item.fields.join('|') + ')' : '^' let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') rules.push( { pattern: _patten, message: formRule.func.innerMessage }, diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index ceac80c..083043a 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -13,6 +13,17 @@ export function getTreeSettingForm (setting, usefulFields = [], MenuID) { let str = '^(' + usefulFields.join('|') + ')' let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') + let rules = [{ + max: formRule.func.max, + message: formRule.func.maxMessage + }] + + if (usefulFields.length > 0) { + rules.push({ + pattern: _patten, + message: formRule.func.innerMessage + }) + } return [ { @@ -103,19 +114,11 @@ key: 'innerFunc', label: Formdict['header.form.innerFunc'], initVal: setting.innerFunc || '', - tooltip: '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', '), + tooltip: usefulFields.length ? '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') : '', placement: 'bottomLeft', required: false, readonly: false, - rules: [ - { - pattern: _patten, - message: formRule.func.innerMessage - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - } - ] + rules: rules }, { type: 'datasource', @@ -875,6 +878,7 @@ */ export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { let columns = (config.columns || []).filter(col => col.field) + usefulFields = [] let opentypes = [ { @@ -971,6 +975,9 @@ }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' + }, { + value: 'filezip', + text: '鏂囦欢鍘嬬缉鍖�' }] }, { // 鏃疯闈㈡澘鏈烘帴鍙� 寰呮墿灞� @@ -1050,9 +1057,18 @@ key: 'innerFunc', label: Formdict['header.form.innerFunc'], initVal: card.innerFunc || '', - tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬨�俙, + tooltip: usefulFields.length ? `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬨�俙 : '', fields: usefulFields, required: card.intertype === 'inner', + readonly: false + }, + { + type: 'text', + key: 'urlkey', + label: '鍦板潃瀛楁', + initVal: card.urlkey || '', + tooltip: '鍥剧墖锛堟枃浠讹級閾炬帴鐨勫瓧娈靛悕銆�', + required: false, readonly: false }, { @@ -1462,7 +1478,7 @@ key: 'preFunc', label: '鍓嶇疆鍑芥暟', initVal: card.preFunc || '', - tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙, + tooltip: usefulFields.length ? `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙 : '', fields: usefulFields, required: false, readonly: false diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 47d2230..698016c 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1567,6 +1567,7 @@ </Radio.Group> </Form.Item> </Col> + <Col span={24}></Col> <Col span={8}> <Form.Item label={ <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}> @@ -1581,7 +1582,12 @@ </Form.Item> </Col> {verify.noteEnable === 'true' ? <Col span={8}> - <Form.Item label="鐭俊妯℃澘"> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={<span>鐭俊妯℃澘娣诲姞鍦板潃锛�<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">浜戜腑蹇�</a>->搴旂敤鏈嶅姟->寮�鍙戣�呬腑蹇�->鐭俊妯℃澘銆�</span>}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鐭俊妯℃澘 + </Tooltip> + }> <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}> {notes.map(option => <Select.Option key={option.value} id={option.id} value={option.value}> @@ -1605,13 +1611,74 @@ </Form.Item> </Col> : null} {verify.noteEnable === 'true' ? <Col span={8}> - <Form.Item label="鐭俊鍐呭"> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'褰撳悜澶氫釜鐢ㄦ埛鍙戦�佺煭淇℃椂锛岀煭淇″唴瀹规槸鍚︾浉鍚屻��'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鐭俊鍐呭 + </Tooltip> + }> <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e, 'noteTemp')}}> <Radio value="Y">鐩稿悓</Radio> <Radio value="N">涓嶅悓</Radio> </Radio.Group> </Form.Item> </Col> : null} + {/* <Col span={24}></Col> + <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍏紬鍙锋秷鎭� + </Tooltip> + }> + <Radio.Group value={verify.wxEnable} onChange={(e) => {this.onOptionChange(e, 'noteEnable')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> + {verify.noteEnable === 'true' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={<span>鐭俊妯℃澘娣诲姞鍦板潃锛�<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">浜戜腑蹇�</a>->搴旂敤鏈嶅姟->寮�鍙戣�呬腑蹇�->鐭俊妯℃澘銆�</span>}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鐭俊妯℃澘 + </Tooltip> + }> + <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}> + {notes.map(option => + <Select.Option key={option.value} id={option.id} value={option.value}> + {option.name} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} + {verify.noteEnable === 'true' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'瀹炴椂鍙戦�佹渶澶氬悓鏃跺彂閫�5涓敤鎴凤紝瀹氭椂鍙戦�佹渶澶氬悓鏃跺彂閫�100涓敤鎴枫��'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍙戦�佹柟寮� + </Tooltip> + }> + <Radio.Group value={verify.noteType} onChange={(e) => {this.onOptionChange(e, 'noteType')}}> + <Radio value="Y">瀹炴椂</Radio> + <Radio value="N">瀹氭椂</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + {verify.noteEnable === 'true' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'褰撳悜澶氫釜鐢ㄦ埛鍙戦�佺煭淇℃椂锛岀煭淇″唴瀹规槸鍚︾浉鍚屻��'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 鐭俊鍐呭 + </Tooltip> + }> + <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e, 'noteTemp')}}> + <Radio value="Y">鐩稿悓</Radio> + <Radio value="N">涓嶅悓</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} */} </Row> </Form> </TabPane> : null} diff --git a/src/views/interface/header/index.jsx b/src/views/interface/header/index.jsx index 9767fb5..903325e 100644 --- a/src/views/interface/header/index.jsx +++ b/src/views/interface/header/index.jsx @@ -1,5 +1,4 @@ import React, {Component} from 'react' -import { withRouter } from 'react-router-dom' import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' @@ -36,4 +35,4 @@ } } -export default withRouter(Header) \ No newline at end of file +export default Header \ No newline at end of file diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index cd4e3be..899f6d0 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -299,7 +299,7 @@ param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`) param.secretkey = md5(`${param.LText}mingke${param.timestamp}`) - param.rduri = 'http://sso.mk9h.cn/webapi/dostars' + param.rduri = 'https://sso.mk9h.cn/webapi/dostars' param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' -- Gitblit v1.8.0