From 43008f1240d6568a3364721bb01fc7e31b33d147 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 24 十二月 2023 23:39:51 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/zshare/verifycard/index.jsx | 178 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 141 insertions(+), 37 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 00076a1..a74034f 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Form, Tabs, Row, Col, Button, Popconfirm, notification, Modal, message, InputNumber, Typography } from 'antd' -import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined } from '@ant-design/icons' +import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, ConsoleSqlOutlined } from '@ant-design/icons' import Toast from 'antd-mobile/es/components/toast' import Dialog from 'antd-mobile/es/components/dialog' import moment from 'moment' @@ -18,7 +18,7 @@ import BillcodeForm from './billcodeform' import VoucherForm from './voucherform' import asyncComponent from '@/utils/asyncComponent' -import { updateForm } from '@/utils/utils-update.js' +// import { updateForm } from '@/utils/utils-update.js' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -114,6 +114,34 @@ <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) + }, + { + dataIndex: 'sqlRender', + render: (record) => { + let _fieldValue = [] + let _value = [] + let _labels = record.fieldlabel.split(',') + + record.field.split(',').forEach((_field, index) => { + let _key = _field.toLowerCase() + _fieldValue.push(`${_key}=${_key === 'bid' ? '@BID@' : ''}`) + _value.push(`${_labels[index] || ''}锛歺xx`) + }) + + let _verifyType = '' + if (record.verifyType === 'logic') { + _verifyType = ' and deleted=0' + } + + let sql = `select @tbid='', @ErrorCode='',@retmsg='' + select @tbid='X' from ${this.props.card.sql} where ${_fieldValue.join(' and ')}${_verifyType} + If @tbid!='' + Begin + select @ErrorCode='${record.errorCode}',@retmsg='${_value.join(', ')} 宸插瓨鍦�' + goto aaa + end` + return sql.split(/\n\s{10}/ig).map(n => n.replace(/^\s{2}/ig, ' ')) + } } ], onceUniqueColumns: [ @@ -151,6 +179,27 @@ </div> ) }, + { + dataIndex: 'sqlRender', + render: (record) => { + let primaryKey = 'id' + + if (this.props.config && this.props.config.setting && this.props.config.setting.primaryKey) { + primaryKey = this.props.config.setting.primaryKey + } + + let sql = `Set @tbid='' + Select top 1 @tbid='X' from (select distinct ${record.field},1 as n from (鏁版嵁婧�) tb inner join (select ID from dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a having sum(n)>1 + + If @tbid!='' + Begin + Set @ErrorCode='E' Set @retmsg='${record.fieldlabel} 鍊间笉鍞竴' + goto aaa + end` + + return sql.split(/\n\s{10}/ig).map(n => n.replace(/^\s{2}/ig, ' ')) + } + } ], contrastColumns: [ { @@ -163,7 +212,7 @@ { title: '杩愮畻绗�', dataIndex: 'operator', - width: '14%', + width: '13%', editable: true, inputType: 'select', options: [ @@ -187,14 +236,14 @@ { title: '鎻愮ず淇℃伅', dataIndex: 'errmsg', - width: '14%', + width: '13%', inputType: 'input', editable: true }, { title: '鎶ラ敊缂栫爜', dataIndex: 'errorCode', - width: '14%', + width: '13%', editable: true, inputType: 'select', options: [ @@ -224,6 +273,18 @@ <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) + }, + { + dataIndex: 'sqlRender', + render: (record) => { + let sql = `If ${record.frontfield} ${record.operator} ${record.backfield} + Begin + select @ErrorCode='${record.errorCode}',@retmsg='${record.errmsg}' + goto aaa + end` + + return sql.split(/\n\s{10}/ig).map(n => n.replace(/^\s{2}/ig, ' ')) + } } ], customColumns: [ @@ -530,6 +591,7 @@ }> <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> </Popconfirm> + <span className="operation-btn" title="SQL" onClick={() => this.orderSql(record)} style={{color: '#1890ff'}}><ConsoleSqlOutlined /></span> </div>) } ] @@ -657,37 +719,37 @@ } 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 = '' - } - } + // } 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) - }) + // if (!_LongParam) { + // message.warning('鏈幏鍙栧埌琛ㄥ崟淇℃伅锛岄儴鍒嗛獙璇佸皢鏃犳硶璁剧疆锛�') + // } else { + // _LongParam = updateForm(_LongParam) + // _fields = _LongParam.fields || [] + // } + // } else { + // notification.warning({ + // top: 92, + // message: res.message, + // duration: 5 + // }) + // } + // resolve(_fields) + // }) } else { resolve(_fields) } @@ -752,6 +814,9 @@ _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)` @@ -1131,6 +1196,45 @@ duration: 5 }) } + }) + } + + orderSql = (record) => { + let _ModularDetailCode = '' + let _lpline = '' + if (record.TypeCharOne === 'Lp') { + if (record.linkField.toLowerCase() === 'bid') { + _lpline = `set @ModularDetailCode= 'Lp'+ right('${record.mark || this.props.card.uuid}'+@BID@,48)` + } else { + _lpline = `set @ModularDetailCode= 'Lp'+ right('${record.mark || this.props.card.uuid}'+@${record.linkField.toLowerCase()},48)` + } + _ModularDetailCode = '@ModularDetailCode' + } else if (record.TypeCharOne === 'BN') { + _ModularDetailCode = `'${record.TypeCharOne}'` + } else { + _ModularDetailCode = `'${record.ModularDetailCode}'` + } + + let sql = `select @BillCode='', @${record.field}='', @ModularDetailCode='' + ${_lpline} + exec s_get_BillCode + @ModularDetailCode=${_ModularDetailCode}, + @Type=${record.Type}, + @TypeCharOne='${record.TypeCharOne}', + @TypeCharTwo ='${record.TypeCharTwo}', + @BillCode =@BillCode output, + @ErrorCode =@ErrorCode output, + @retmsg=@retmsg output + if @ErrorCode!='' + goto aaa + set @${record.field}=@BillCode` + + Modal.info({ + title: '', + width: 500, + className: 'sql-example', + icon: null, + content: sql.split(/\n\s{4}/ig).map((n, index) => <div key={index} dangerouslySetInnerHTML={{ __html: n.replace(/\s/ig, ' ') }} style={{whiteSpace: 'nowrap'}}></div>) }) } @@ -1603,7 +1707,7 @@ </span> } key="contrasts"> <ContrastForm contrastChange={this.contrastChange}/> - <EditTable actions={['edit', 'move', 'copy', 'del', 'status']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> + <EditTable actions={['edit', 'move', 'copy', 'del', 'status', 'sql']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> </TabPane> : null} {verifyInter === 'system' ? <TabPane tab={ <span> @@ -1649,7 +1753,7 @@ fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields} uniqueChange={this.uniqueChange} /> - <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> + <EditTable actions={['edit', 'move', 'del', 'status', 'sql']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> </TabPane> : null} {verifyInter === 'system' ? <TabPane tab={ <span> -- Gitblit v1.8.0