From 1795b3d924b95da49cf22003f4a4f8ffaa2dbda3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 31 八月 2023 22:34:42 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/datasource/verifycard/settingform/index.scss | 9 +++ /dev/null | 0 src/views/tabledesign/menuform/index.jsx | 30 +++++++-- src/components/header/index.jsx | 2 src/templates/zshare/verifycard/baseform/index.jsx | 31 ++++++++++ src/menu/datasource/verifycard/settingform/index.jsx | 11 +++ src/templates/zshare/verifycard/index.jsx | 12 ++++ src/templates/zshare/verifycard/customscript/index.jsx | 10 +++ src/views/menudesign/menuform/index.jsx | 23 +++++++ 9 files changed, 119 insertions(+), 9 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 7db59b7..4ad3d8a 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -228,7 +228,7 @@ MKEmitter.emit('modifyTabs', menu) } else { setTimeout(() => { - this.openTab(times) + this.openTab(menu, times) }, 200) } } diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 9e2cc1d..3255937 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -180,6 +180,16 @@ this.props.updateStatus(setting) } + addProcess = () => { + let _sql = this.props.form.getFieldValue('dataresource') + + _sql = _sql + `\n/* select a.*,case when isnull(w.remark,'')='' then a.remark else w.remark end as remark_w,case when isnull(w.statusname,'')='' then a.statusname else w.statusname end as statusname_w,w.status as status_w from 鏁版嵁婧� a left join (select * from s_my_works_flow where works_flow_code='娴佺▼缂栫爜' and deleted=0) w on a.id=w.works_flow_id where isnull(w.status,0)=0 */` + + this.props.form.setFieldsValue({ + dataresource: _sql + }) + } + render() { const { columns, config } = this.props const { getFieldDecorator } = this.props.form @@ -350,6 +360,7 @@ </Form.Item> </Col> : null} {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> + {window.GLOB.process ? <span className="process-btn" onClick={this.addProcess}>宸ヤ綔娴�</span> : null} <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" /> diff --git a/src/menu/datasource/verifycard/settingform/index.scss b/src/menu/datasource/verifycard/settingform/index.scss index fbc8fed..bc66156 100644 --- a/src/menu/datasource/verifycard/settingform/index.scss +++ b/src/menu/datasource/verifycard/settingform/index.scss @@ -25,4 +25,13 @@ width: 89.5%; } } + + .process-btn { + position: absolute; + top: -22px; + font-size: 12px; + right: 15px; + color: #1890ff; + cursor: pointer; + } } \ No newline at end of file diff --git a/src/menu/process/index.jsx b/src/menu/process/index.jsx deleted file mode 100644 index 9b9db65..0000000 --- a/src/menu/process/index.jsx +++ /dev/null @@ -1,136 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal, Tooltip, notification } from 'antd' -import { QuestionCircleOutlined, PlusOutlined, CloseOutlined } from '@ant-design/icons' - -import SettingForm from './settingform' -import './index.scss' - -const { confirm } = Modal - -class ProcessComponent extends Component { - static propTpyes = { - config: PropTypes.any, - updateConfig: PropTypes.func - } - - state = { - visible: false, - urlFields: this.props.config.urlFields || [] - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - editDataSource = () => { - this.setState({ - visible: true - }) - } - - verifySubmit = () => { - const { urlFields } = this.state - const { config } = this.props - - this.verifyRef.handleConfirm().then(res => { - if (urlFields.filter(field => field === res.field).length > 0) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 5 - }) - return - } - - let _urlFields = [...urlFields, res.field] - - this.setState({ - visible: false, - urlFields: _urlFields - }) - - if (window.GLOB.urlFields) { - window.GLOB.urlFields = _urlFields - } - - this.props.updateConfig({...config, urlFields: _urlFields}) - }) - } - - deleteField = (field) => { - let config = JSON.stringify(this.props.config) - const _this = this - - if (new RegExp(field, 'ig').test(config)) { - confirm({ - title: `閰嶇疆涓瓨鍦ˊ${field}@锛岀‘瀹氬垹闄ゅ悧锛焋, - content: '', - onOk() { - _this.execDelete(field) - }, - onCancel() {} - }) - } else { - this.execDelete(field) - } - } - - execDelete = (_field) => { - const { config } = this.props - let _urlFields = this.state.urlFields.filter(field => field !== _field) - - this.setState({ - urlFields: _urlFields - }) - - if (window.GLOB.urlFields) { - window.GLOB.urlFields = _urlFields - } - - this.props.updateConfig({...config, urlFields: _urlFields}) - } - - render () { - const { visible, urlFields } = this.state - - return ( - <div className="url-field-component"> - <div className="field-plus"> - <Tooltip placement="topLeft" title="椤甸潰鍙帴鏀剁殑鍙傛暟瀛楁锛屽湪鏌ヨ鏁版嵁婧愭垨鑷畾涔夎剼鏈腑浣跨敤 @瀛楁@ 鎺ユ敹銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - url鍙橀噺 - </Tooltip> - <PlusOutlined title="娣诲姞" onClick={() => this.editDataSource()} /> - </div> - <div> - {urlFields.map((field, index) => { - return ( - <div className="field-item" key={index}> - <CloseOutlined title="鍒犻櫎" onClick={() => this.deleteField(field)} /> - {field} - </div> - ) - })} - </div> - <Modal - title="瀛楁娣诲姞" - visible={visible} - width={500} - maskClosable={false} - onOk={this.verifySubmit} - onCancel={() => { this.setState({ visible: false }) }} - destroyOnClose - > - <SettingForm - inputSubmit={this.verifySubmit} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default ProcessComponent \ No newline at end of file diff --git a/src/menu/process/index.scss b/src/menu/process/index.scss deleted file mode 100644 index 0f1ad12..0000000 --- a/src/menu/process/index.scss +++ /dev/null @@ -1,25 +0,0 @@ -.url-field-component { - margin-bottom: 15px; - .field-plus { - line-height: 35px; - padding-left: 16px; - >.anticon-plus { - color: #26C281; - padding: 2px 5px; - margin-left: 5px; - } - } - .field-item { - position: relative; - border: 1px solid #e8e8e8; - padding: 5px 10px; - border-radius: 4px; - - >.anticon-close { - position: absolute; - right: 5px; - top: 3px; - font-size: 13px; - } - } -} \ No newline at end of file diff --git a/src/menu/process/settingform/index.jsx b/src/menu/process/settingform/index.jsx deleted file mode 100644 index 2c3784e..0000000 --- a/src/menu/process/settingform/index.jsx +++ /dev/null @@ -1,82 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Input } from 'antd' - -// import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - 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() - } - } - - componentDidMount() { - try { - let _input = document.getElementById('field') - if (_input.focus) { - _input.focus() - } - } catch (e) { - console.warn('focus error锛�') - } - } - - render() { - const { getFieldDecorator } = this.props.form - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 14 } - } - } - - return ( - <div className="url-field-form"> - <Form {...formItemLayout}> - <Form.Item label="瀛楁鍚�"> - {getFieldDecorator('field', { - initialValue: '', - rules: [ - { - required: true, - message: '璇疯緭鍏ュ瓧娈靛悕!' - }, - { - pattern: /^[a-zA-Z0-9_]*$/ig, - message: '瀛楁鍙娇鐢ㄨ嫳鏂囥�佹暟瀛楁垨_' - } - ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/process/settingform/index.scss b/src/menu/process/settingform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/menu/process/settingform/index.scss +++ /dev/null diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 611e4ef..fa89694 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -427,6 +427,37 @@ </Form.Item> </Col> : null} <Col span={24}></Col> + {window.GLOB.process ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title="鍦ㄨ彍鍗曞紑鍚伐浣滄祦鏃舵湁鏁堛��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 宸ヤ綔娴� + </Tooltip> + }> + <Radio.Group value={verify.workFlow} onChange={(e) => {this.onOptionChange(e.target.value, 'workFlow')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + {window.GLOB.process && verify.workFlow === 'true' ? <Col span={8}> + <Form.Item label="绫诲瀷"> + <Radio.Group value={verify.flowType} onChange={(e) => {this.onOptionChange(e.target.value, 'flowType')}}> + <Radio value="start">鍙戣捣</Radio> + <Radio value="approval">瀹℃壒</Radio> + <Radio value="reject">椹冲洖</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + {window.GLOB.process && verify.workFlow === 'true' ? <Col span={8}> + <Form.Item label="榛樿sql锛堝伐浣滄祦锛�"> + <Radio.Group value={verify.flowSql} onChange={(e) => {this.onOptionChange(e.target.value, 'flowSql')}}> + <Radio value="true">鎵ц</Radio> + <Radio value="false">涓嶆墽琛�</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + <Col span={24}></Col> <Col span={8}> <Form.Item label={ <Tooltip placement="bottomLeft" title={'璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�'}> diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index cb530d4..5d49e8c 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -251,6 +251,8 @@ } selectScript = (value, option) => { + // const { flowType } = this.props + if (!value || !option) return let _sql = this.props.form.getFieldValue('sql') @@ -261,6 +263,11 @@ _sql = _sql + ` ` + } + + if (value === 'flowSql') { + value = `insert into s_my_works_flow ( works_flow_id,works_flow_code,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) + select @ID@,'娴佺▼缂栫爜','涓嬩竴姝ヨ鐢ㄥ埌鐨勫弬鏁颁覆','鑱屽憳鍒嗙粍','娴佺▼鑺傜偣id','鑱屽憳绛夌骇',@bid@,@UserID@,@UserName,@FullName` } _sql = _sql.replace(/\s{6}$/, '') @@ -275,7 +282,7 @@ } render() { - const { usefulfields, systemScripts, btn, type } = this.props + const { usefulfields, systemScripts, btn, type, workFlow } = this.props const { getFieldDecorator } = this.props.form const { editItem, skip } = this.state const formItemLayout = { @@ -341,6 +348,7 @@ getPopupContainer={() => document.getElementById('verify-custom-scripts' + _type)} > <Select.Option key="default" value={this.props.defaultsql}>榛樿sql</Select.Option> + {window.GLOB.process && workFlow === 'true' ? <Select.Option key="flow" value="flowSql">榛樿sql锛堝伐浣滄祦锛�</Select.Option> : null} <Select.Option key="debugger" value={`z_debug: select @ErrorCode='E',@retmsg='娴嬭瘯鏂偣' goto aaa`}> 娴嬭瘯鏂偣 </Select.Option> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 36a5450..477f98b 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -571,6 +571,16 @@ _verify.scripts = _verify.scripts || [] _verify.cbScripts = _verify.cbScripts || [] + if (window.GLOB.process) { + _verify.workFlow = _verify.workFlow || 'false' + _verify.flowType = _verify.flowType || 'approval' + _verify.flowSql = _verify.flowSql || 'true' + } else { + delete _verify.workFlow + delete _verify.flowType + delete _verify.flowSql + } + if (appType === 'mob') { _verify.printEnable = 'false' _verify.printTempId = '' @@ -1666,6 +1676,8 @@ <CustomScript btn={this.props.card} initsql={this.state.initsql} + workFlow={verify.workFlow} + flowType={verify.flowType} customScripts={verify.scripts} defaultsql={this.state.defaultsql} usefulfields={this.state.usefulfields} diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx index 0a0e3ba..235f6b1 100644 --- a/src/views/menudesign/menuform/index.jsx +++ b/src/views/menudesign/menuform/index.jsx @@ -25,11 +25,15 @@ } UNSAFE_componentWillMount () { + const { config } = this.props + if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) { this.setMenus() } else { this.getMenus() } + + window.GLOB.process = config.process === 'true' } setMenus = () => { @@ -196,6 +200,8 @@ if (typeof(value) !== 'number') { value = '' } + } else if (key === 'process') { + window.GLOB.process = value === 'true' } this.props.updateConfig({...config, [key]: value}) } @@ -396,6 +402,23 @@ </Col> : null} <Col span={24}> <Form.Item label={ + <Tooltip placement="topLeft" title="寮�鍚悗鍙湪鎸夐挳鍙婃暟鎹簮璁剧疆娴佺▼鍙傛暟銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 宸ヤ綔娴� + </Tooltip> + }> + {getFieldDecorator('process', { + initialValue: config.process || 'false' + })( + <Radio.Group onChange={(e) => {this.selectChange('process', e.target.value)}}> + <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/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx index 9c128c1..84553b2 100644 --- a/src/views/tabledesign/menuform/index.jsx +++ b/src/views/tabledesign/menuform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, notification, Switch } from 'antd' +import { Form, Row, Col, Input, Select, notification, Switch, Radio } from 'antd' import Api from '@/api' import './index.scss' @@ -24,11 +24,15 @@ } UNSAFE_componentWillMount () { + const { config } = this.props + if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) { this.setMenus() } else { this.getMenus() } + + window.GLOB.process = config.process === 'true' } setMenus = () => { @@ -191,12 +195,12 @@ this.props.form.setFieldsValue({parentId: _id}) this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) }) - } else if (key === 'parentId') { - this.props.updateConfig({...config, parentId: value}) - } else if (key === 'OpenType') { - this.props.updateConfig({...config, OpenType: value}) - } else if (key === 'hidden') { - this.props.updateConfig({...config, hidden: value}) + } else { + if (key === 'process') { + window.GLOB.process = value === 'true' + } + + this.props.updateConfig({...config, [key]: value}) } } @@ -332,6 +336,18 @@ </Form.Item> </Col> <Col span={24}> + <Form.Item label="宸ヤ綔娴�"> + {getFieldDecorator('process', { + initialValue: config.process || 'false' + })( + <Radio.Group onChange={(e) => {this.selectChange('process', e.target.value)}}> + <Radio value="true">浣跨敤</Radio> + <Radio value="false">涓嶄娇鐢�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> <Form.Item label={'闅愯棌鑿滃崟'}> <Switch checkedChildren={'鏄�'} checked={config.hidden === 'true'} unCheckedChildren={'鍚�'} onChange={(value) => { this.selectChange('hidden', value + '') -- Gitblit v1.8.0