From 4313d9ccea6534b1da71baa1bf499f045d3c1f0b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 七月 2022 00:57:55 +0800 Subject: [PATCH] 2022-07-08 --- src/views/design/index.jsx | 33 ++ src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 18 src/tabviews/zshare/actionList/funczip/index.jsx | 7 src/templates/zshare/formconfig.jsx | 1 src/templates/zshare/verifycard/baseform/index.scss | 0 src/templates/zshare/verifycard/index.jsx | 302 +++++------------------- src/templates/zshare/verifycard/billcodeform/index.jsx | 5 public/options.json | 1 src/setupProxy.js | 23 - src/menu/components/chart/antv-bar/index.jsx | 18 src/api/index.js | 46 +++ src/templates/zshare/verifycard/baseform/index.jsx | 250 ++++++++++++++++++++ public/README.txt | 1 13 files changed, 418 insertions(+), 287 deletions(-) diff --git a/public/README.txt b/public/README.txt index 6079784..b3f88fd 100644 --- a/public/README.txt +++ b/public/README.txt @@ -10,6 +10,7 @@ defaultApp -- 榛樿搴旂敤锛岀郴缁熼粯璁ゆ墦寮�鏌愪釜瀛愬簲鐢ㄦ椂闇�濉啓搴旂敤缂栫爜 defaultLang -- 鎵撳紑鐨勫瓙搴旂敤璇█绫诲瀷锛岄粯璁や负zh-CN WXAppID -- 浣跨敤鍏紬鍙锋椂锛岀粦瀹氱殑鍏紬鍙稩D +WXminiAppID -- 浣跨敤寰俊灏忕▼搴忔椂锛岀粦瀹氱殑灏忕▼搴廔D debugger -- 鍊间负true鏃跺紑鍚皟璇曟ā寮忥紝寮�鍚悗绉诲姩绔瓙搴旂敤涓細鏈夋帶鍒跺彴 licenseKey -- 璁稿彲瀵嗛挜锛屽湪鍐呴儴缃戠粶涓娇鐢ㄧ郴缁熸椂锛屼細璺宠繃epc楠岃瘉 probation -- 璇曠敤鏈燂紙YYYY-MM-DD锛夛紝鍦ㄦ寮忕郴缁熶腑锛岃瘯鐢ㄦ湡鍐呰皟鐢ㄧ郴缁熸帴鍙g殑鑴氭湰浼氳褰曚笅鏉� diff --git a/public/options.json b/public/options.json index 32d0ee7..523da64 100644 --- a/public/options.json +++ b/public/options.json @@ -9,6 +9,7 @@ "defaultApp": "mk", "defaultLang": "zh-CN", "WXAppID": "", + "WXminiAppID": "", "debugger": false, "licenseKey": "", "probation": "", diff --git a/src/api/index.js b/src/api/index.js index 66895b6..10a19bd 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -29,7 +29,7 @@ axios.interceptors.request.use((config) => { if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult') || config.url.includes('wxNativePay')) { config.data = qs.stringify(config.data) - } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) { + } else if (config.url.includes('doupload') || config.url.includes('dopreload')) { config.headers = { 'Content-Type': 'multipart/form-data' } } else if (config.method === 'post' && config.data) { config.data = JSON.stringify(config.data) @@ -111,9 +111,32 @@ * @description 寰俊涓氬姟璇锋眰 */ wxRequest (url, method, param) { - let _url = window.GLOB.location + ':8080/' + window.GLOB.service + url + let _url = document.location.origin + '/' + window.GLOB.service + url + if (process.env.NODE_ENV !== 'production') { + _url = document.location.origin + '/' + url + } + + if (param) { + return axios({ + url: _url, + method, + data: param + }) + } + + return axios({ + url: _url, + method + }) + } + + /** + * @description 寰俊涓氬姟璇锋眰 + */ + wxNginxRequest (url, method, param) { + let _url = window.GLOB.location + ':8080/' + url if (process.env.NODE_ENV === 'production') { - _url = document.location.origin + ':8080/' + window.GLOB.service + url + _url = document.location.origin + ':8080/' + url } if (param) { @@ -122,12 +145,12 @@ method, data: param }) - } else { - return axios({ - url: _url, - method - }) } + + return axios({ + url: _url, + method + }) } /** @@ -895,8 +918,13 @@ * @description 鑾峰彇寰俊鏀粯浜岀淮鐮� */ getWxNativePay (param) { + let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/wxNativePay' + if (process.env.NODE_ENV !== 'production') { + _url = document.location.origin + '/wxpay/wxNativePay' + } + return axios({ - url: '/wxpay/wxNativePay', + url: _url, method: 'post', data: param }) diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 0f5c231..ca919d0 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -788,13 +788,17 @@ } } - const view2 = chart.createView({ - region: { - start: { x: 0, y: 0 }, - end: { x: 1, y: 1 } - }, - padding - }) + let view2 = chart // 鏃犵嫭绔嬫煴鐘跺浘鏃朵笉鍋氬垎闈� + + if (Bar_axis.length) { + view2 = chart.createView({ + region: { + start: { x: 0, y: 0 }, + end: { x: 1, y: 1 } + }, + padding + }) + } view2.data(dv.rows) diff --git a/src/setupProxy.js b/src/setupProxy.js index 3902dd3..4d69c53 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -1,9 +1,7 @@ -// const proxy = require('http-proxy-middleware') -// const host = 'http://qingqiumarket.cn' -// const service = 'mkwms/' +const proxy = require('http-proxy-middleware') +const options = require('../public/options.json') -module.exports = function(app) {} -// module.exports = function(app) { +module.exports = function(app) { // app.use(proxy('/webapi', { // target: `${host}/${service}webapi`, // secure: false, @@ -32,14 +30,11 @@ // } // })) -// app.use(proxy('/wxpay', { -// target: `${host}/${service}wxpay`, -// secure: false, -// changeOrigin: true, -// pathRewrite: { -// '^/wxpay': '/' -// } -// })) + app.use(proxy('/wxpay', { + target: `${options.host}/${options.service}`, + secure: false, + changeOrigin: true + })) // app.use(proxy('/trans', { // target: `${host}/${service}`, @@ -52,4 +47,4 @@ // secure: false, // changeOrigin: true // })) -// } \ No newline at end of file +} \ No newline at end of file diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 8865db9..6f769fa 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -1329,13 +1329,17 @@ } } - const view2 = chart.createView({ - region: { - start: { x: 0, y: 0 }, - end: { x: 1, y: 1 } - }, - padding - }) + let view2 = chart + + if (plot.Bar_axis) { + view2 = chart.createView({ + region: { + start: { x: 0, y: 0 }, + end: { x: 1, y: 1 } + }, + padding + }) + } view2.data(dv.rows) view2.legend(false) diff --git a/src/tabviews/zshare/actionList/funczip/index.jsx b/src/tabviews/zshare/actionList/funczip/index.jsx index 12f24ae..2b4316f 100644 --- a/src/tabviews/zshare/actionList/funczip/index.jsx +++ b/src/tabviews/zshare/actionList/funczip/index.jsx @@ -123,13 +123,6 @@ 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 }) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 083043a..316b3c8 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -878,7 +878,6 @@ */ export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { let columns = (config.columns || []).filter(col => col.field) - usefulFields = [] let opentypes = [ { diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx new file mode 100644 index 0000000..0ef512f --- /dev/null +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -0,0 +1,250 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { is, fromJS } from 'immutable' +import { Form, Row, Col, Select, Radio, Tooltip } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' + +// import './index.scss' + +class BillCodeForm extends Component { + static propTpyes = { + card: PropTypes.object, + verify: PropTypes.object, + unionFields: PropTypes.array, + notes: PropTypes.array, + onChange: PropTypes.func + } + + state = { + wxTemps: [], + miniTemps: [], + } + + UNSAFE_componentWillMount() { + + } + + componentDidMount() { + let wxTemps = sessionStorage.getItem('wxTemplates') + let miniTemps = sessionStorage.getItem('wxMiniTemplates') + + wxTemps = wxTemps ? JSON.parse(wxTemps) : [] + miniTemps = miniTemps ? JSON.parse(miniTemps) : [] + + this.setState({wxTemps, miniTemps}) + } + + handleConfirm = () => { + const { verify } = this.props + + let error = '' + if (verify.noteEnable === 'true' && !verify.noteCode) { // 寮�鍚煭淇℃椂锛岄渶瑕佹ā鏉跨紪鐮� + error = '寮�鍚煭淇℃椂锛岄渶瑕侀�夋嫨鐭俊妯℃澘锛�' + } else if (verify.accountdate === 'true' && !verify.accountfield) { + error = '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�' + } else if (verify.wxNote === 'true') { + if (!verify.wxTemplateId) { + error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕侀�夋嫨娑堟伅妯℃澘锛�' + } + } + + return error + } + + onOptionChange = (value, key) => { + const { verify } = this.props + + let _verify = {...verify, [key]: value} + + if (_verify.noteEnable !== 'true') { + _verify.noteCode = '' + } + if (_verify.accountdate !== 'true') { + _verify.accountfield = '' + _verify.voucherdate = '' + } + if (_verify.wxNote !== 'true') { + _verify.wxTemplateId = '' + } + + this.props.onChange(_verify) + } + + onNoteCodeChange = (val, option) => { + const { verify } = this.props + + let _verify = {...verify, noteCode: val, noteId: option.props.id} + + this.props.onChange(_verify) + } + + onWxTemplateChange = (val) => { + const { verify } = this.props + + let _verify = {...verify, wxTemplateId: val} + + this.props.onChange(_verify) + } + + render() { + const { unionFields, verify, notes, card } = this.props + // const { getFieldDecorator } = this.props.form + const { wxTemps } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout}> + <Row gutter={24}> + {card.sqlType !== 'custom' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'榛樿sql鎵ц椤哄簭涓鸿嚜瀹氫箟鑴氭湰涔嬪墠'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 榛樿sql + </Tooltip> + }> + <Radio.Group value={verify.default} onChange={(e) => {this.onOptionChange(e.target.value, 'default')}}> + <Radio value="true">鎵ц</Radio> + <Radio value="false">涓嶆墽琛�</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + <Col span={8}> + <Form.Item label={'澶辨晥楠岃瘉'}> + <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'璐︽湡楠岃瘉'}> + <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e.target.value, 'accountdate')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> + {verify.accountdate === 'true' ? <Col span={8}> + <Form.Item label={'楠岃瘉鍏徃'} required> + <Select defaultValue={verify.accountfield || ''} onChange={(val) => {this.onOptionChange(val, 'accountfield')}}> + {unionFields.map(option => + <Select.Option key={option.uuid} value={option.field}> + {option.label} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} + {verify.accountdate === 'true' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title={'楠岃瘉鏃ユ湡涓虹┖鏃讹紝榛樿涓哄綋澶┿��'}> + <QuestionCircleOutlined className="mk-form-tip" /> + 楠岃瘉鏃ユ湡 + </Tooltip> + }> + <Select allowClear defaultValue={verify.voucherdate || ''} onChange={(val) => {this.onOptionChange(val, 'voucherdate')}}> + {unionFields.map(option => + <Select.Option key={option.uuid} value={option.field}> + {option.label} + </Select.Option> + )} + </Select> + </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.noteEnable} onChange={(e) => {this.onOptionChange(e.target.value, '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> + } required> + <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.target.value, '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.target.value, '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.wxNote} onChange={(e) => {this.onOptionChange(e.target.value, 'wxNote')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> + {verify.wxNote === 'true' ? <Col span={8}> + <Form.Item label="娑堟伅妯℃澘" required> + <Select value={verify.wxTemplateId} onSelect={this.onWxTemplateChange}> + {wxTemps.map(option => + <Select.Option key={option.template_id} value={option.template_id}> + {option.title} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} + </Row> + </Form> + ) + } +} + +export default Form.create()(BillCodeForm) \ No newline at end of file diff --git a/src/templates/zshare/verifycard/baseform/index.scss b/src/templates/zshare/verifycard/baseform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/templates/zshare/verifycard/baseform/index.scss diff --git a/src/templates/zshare/verifycard/billcodeform/index.jsx b/src/templates/zshare/verifycard/billcodeform/index.jsx index c33ab64..b8368eb 100644 --- a/src/templates/zshare/verifycard/billcodeform/index.jsx +++ b/src/templates/zshare/verifycard/billcodeform/index.jsx @@ -6,8 +6,7 @@ import './index.scss' - -class UniqueForm extends Component { +class BillCodeForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� btn: PropTypes.object, // 鎸夐挳淇℃伅 @@ -377,4 +376,4 @@ } } -export default Form.create()(UniqueForm) \ No newline at end of file +export default Form.create()(BillCodeForm) \ No newline at end of file diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 698016c..a0ba650 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' -import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, BorderOutlined } from '@ant-design/icons' +import { Form, Tabs, Row, Col, Button, Popconfirm, notification, Modal, message, InputNumber, Typography } from 'antd' +import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, BorderOutlined } from '@ant-design/icons' import Toast from 'antd-mobile/es/components/toast' import Dialog from 'antd-mobile/es/components/dialog' import moment from 'moment' @@ -10,6 +10,7 @@ import Api from '@/api' import Utils from '@/utils/utils.js' import options from '@/store/options.js' +import BaseForm from './baseform' import UniqueForm from './uniqueform' import ContrastForm from './contrastform' import CustomForm from './customform' @@ -39,6 +40,8 @@ state = { initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� + verifyInter: 'system', // 鎺ュ彛绫诲瀷 + activeKey: 'base', appType: sessionStorage.getItem('appType'), notes: [], // 鐭俊妯℃澘 setting: null, @@ -550,6 +553,7 @@ } _verify.default = _verify.default || 'true' + _verify.wxNote = _verify.wxNote || 'false' // 鍏紬鍙锋秷鎭帹閫佹槸鍚﹀紑鍚� _verify.noteEnable = _verify.noteEnable || 'false' // 鐭俊鍙戦�佹槸鍚﹀紑鍚� _verify.noteType = _verify.noteType || 'N' // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級 _verify.noteTemp = _verify.noteTemp || 'Y' // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級 @@ -590,7 +594,11 @@ item.$index = i + 1 }) + let verifyInter = card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? 'system' : 'inner' + this.setState({ + activeKey: verifyInter === 'system' ? 'base' : 'tip', + verifyInter: verifyInter, setting: config.setting || {}, verify: _verify, oriVerify: fromJS(_verify).toJS() @@ -1147,39 +1155,6 @@ this.setState({ verify }) } - onNoteCodeChange = (val, option) => { - const { verify } = this.state - - this.setState({ - verify: {...verify, noteCode: val, noteId: option.props.id} - }) - } - - onOptionChange = (e, key) => { - const { verify } = this.state - let value = e.target.value - - this.setState({ - verify: {...verify, [key]: value} - }) - } - - changeAccField = (val) => { - const { verify } = this.state - - this.setState({ - verify: {...verify, accountfield: val} - }) - } - - changeAccDate = (val) => { - const { verify } = this.state - - this.setState({ - verify: {...verify, voucherdate: val} - }) - } - handleDelete = (record, type) => { const { verify } = this.state @@ -1383,8 +1358,21 @@ handleConfirm = () => { const { card } = this.props - const { setting } = this.state + const { setting, activeKey } = this.state let verify = fromJS(this.state.verify).toJS() + + if (activeKey === 'base') { + let msg = this.baseForm.handleConfirm() + + if (msg) { + notification.warning({ + top: 92, + message: msg, + duration: 5 + }) + return Promise.reject() + } + } // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { @@ -1392,13 +1380,6 @@ notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', - duration: 5 - }) - return - } else if (verify.accountdate === 'true' && !verify.accountfield) { - notification.warning({ - top: 92, - message: '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�', duration: 5 }) return @@ -1422,12 +1403,6 @@ msg = '鑷畾涔夎剼鏈�' } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { msg = '鑷畾涔夎剼鏈�' - } - - if (verify.noteEnable === 'true' && !verify.noteCode) { // 寮�鍚煭淇℃椂锛岄渶瑕佹ā鏉跨紪鐮� - verify.noteEnable = 'false' - } else if (verify.noteEnable !== 'true' && verify.noteCode) { - verify.noteCode = '' } if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { @@ -1477,6 +1452,26 @@ }) } + changeTab = (val) => { + const { activeKey } = this.state + + if (activeKey === 'base') { + let msg = this.baseForm.handleConfirm() + + if (msg) { + notification.warning({ + top: 92, + message: msg, + duration: 5 + }) + return + } + } + this.setState({ + activeKey: val + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -1488,7 +1483,7 @@ render() { const { card } = this.props - const { verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state + const { activeKey, verifyInter, verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -1502,201 +1497,30 @@ return ( <div id="verify-card-box-tab"> - <Tabs defaultActiveKey="1" className="verify-card-box"> - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> + {verifyInter === 'system' ? <TabPane tab={ <span> 鍩虹楠岃瘉 {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null} </span> - } key="1"> - <Form {...formItemLayout}> - <Row gutter={24}> - {this.props.card.sqlType !== 'custom' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="bottomLeft" title={'榛樿sql鎵ц椤哄簭涓鸿嚜瀹氫箟鑴氭湰涔嬪墠'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 榛樿sql - </Tooltip> - }> - <Radio.Group value={verify.default} onChange={(e) => {this.onOptionChange(e, 'default')}}> - <Radio value="true">鎵ц</Radio> - <Radio value="false">涓嶆墽琛�</Radio> - </Radio.Group> - </Form.Item> - </Col> : null} - <Col span={8}> - <Form.Item label={'璐︽湡楠岃瘉'}> - <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> - <Radio value="true">寮�鍚�</Radio> - <Radio value="false">涓嶅紑鍚�</Radio> - </Radio.Group> - </Form.Item> - </Col> - {verify.accountdate === 'true' ? <Col span={8}> - <Form.Item label={'楠岃瘉鍏徃'} required> - <Select defaultValue={verify.accountfield || ''} onChange={this.changeAccField}> - {unionFields.map(option => - <Select.Option key={option.uuid} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - </Form.Item> - </Col> : null} - {verify.accountdate === 'true' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="bottomLeft" title={'楠岃瘉鏃ユ湡涓虹┖鏃讹紝榛樿涓哄綋澶┿��'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 楠岃瘉鏃ユ湡 - </Tooltip> - }> - <Select allowClear defaultValue={verify.voucherdate || ''} onChange={this.changeAccDate}> - {unionFields.map(option => - <Select.Option key={option.uuid} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - </Form.Item> - </Col> : null} - <Col span={8}> - <Form.Item label={'澶辨晥楠岃瘉'}> - <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> - <Radio value="true">寮�鍚�</Radio> - <Radio value="false">涓嶅紑鍚�</Radio> - </Radio.Group> - </Form.Item> - </Col> - <Col span={24}></Col> - <Col span={8}> - <Form.Item label={ - <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍙戦�佺煭淇� - </Tooltip> - }> - <Radio.Group value={verify.noteEnable} 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} - {/* <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> + } key="base"> + <BaseForm card={card} unionFields={unionFields} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> 姣旇緝楠岃瘉 {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null} </span> - } key="2x"> + } key="contrasts"> <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/> <EditTable actions={['edit', 'move', 'copy', 'del', 'status']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> 鑷畾涔夐獙璇� {verify.customverifys.length ? <span className="count-tip">{verify.customverifys.length}</span> : null} </span> - } key="3"> + } key="customverifys"> <CustomForm dict={this.props.dict} btn={this.props.card} @@ -1707,12 +1531,12 @@ /> <EditTable actions={['move']} data={verify.customverifys} columns={customColumns} onChange={(customverifys) => {this.setState({verify: {...verify, customverifys}})}}/> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> 鍗曞彿鐢熸垚 {verify.billcodes.length ? <span className="count-tip">{verify.billcodes.length}</span> : null} </span> - } key="4"> + } key="billcodes"> <BillcodeForm fields={fields} btn={this.props.card} @@ -1726,12 +1550,12 @@ /> <EditTable actions={['move']} data={verify.billcodes} columns={orderColumns} onChange={(billcodes) => {this.setState({verify: {...verify, billcodes}})}}/> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> {card.Ot !== 'requiredOnce' ? '鍞竴鎬ч獙璇�' : '鍚岀被鏁版嵁楠岃瘉'} {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} </span> - } key="2"> + } key="uniques"> <UniqueForm btn={card} fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields} @@ -1740,12 +1564,12 @@ /> <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> 鍒涘缓鍑瘉 {verify.voucher && verify.voucher.enabled ? <span className="count-tip">1</span> : null} </span> - } key="5"> + } key="voucher"> <VoucherForm dict={this.props.dict} voucher={voucher} @@ -1756,12 +1580,12 @@ wrappedComponentRef={(inst) => this.voucherForm = inst} /> </TabPane> : null} - {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ + {verifyInter === 'system' ? <TabPane tab={ <span> 鑷畾涔夎剼鏈� {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} </span> - } key="6"> + } key="scripts"> <BorderOutlined className="full-scripts" onClick={() => { if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { notification.warning({ @@ -1791,7 +1615,7 @@ 鍥炶皟鑴氭湰 {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null} </span> - } key="6a"> + } key="cbScripts"> <CallBackCustomScript btn={this.props.card} dict={this.props.dict} @@ -1804,7 +1628,7 @@ /> <EditTable actions={['move']} data={verify.cbScripts} columns={cbScriptsColumns} onChange={(cbScripts) => {this.setState({verify: {...verify, cbScripts}})}}/> </TabPane> : null} - <TabPane tab="淇℃伅鎻愮ず" key="7"> + <TabPane tab="淇℃伅鎻愮ず" key="tip"> <Form {...formItemLayout}> <Row gutter={24}> <Col offset={6} span={6}> diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index 8942896..049b7da 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -3,6 +3,7 @@ import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' +import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import Header from './header' import { setGLOBFuncs } from '@/utils/utils.js' @@ -16,6 +17,38 @@ class Design extends Component { componentDidMount() { setGLOBFuncs() + + // 鑾峰彇寰俊鍏紬鍙峰強灏忕▼搴忔秷鎭ā鏉� + if (!sessionStorage.getItem('wxTemplates')) { + Api.wxRequest('wxpay/getaccesstoken', 'get').then(res => { + let wxtoken = res.oa_access_token || '' + let minitoken = res.mini_access_token || '' + + if (wxtoken) { + Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { + if (res.template_list) { + let temps = res.template_list.filter(item => item.primary_industry) + sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) + } else { + sessionStorage.setItem('wxTemplates', JSON.stringify([])) + } + }) + } else { + sessionStorage.setItem('wxTemplates', JSON.stringify([])) + } + if (minitoken) { + Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { + if (res.errmsg === 'ok' && res.data) { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) + } else { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + } + }) + } else { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + } + }) + } } render () { -- Gitblit v1.8.0