From e469a34f26637e177854b960bbd35c900ce0daff Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 30 一月 2023 15:50:34 +0800 Subject: [PATCH] 2023-01-30 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 42 +++++++ src/menu/components/share/actioncomponent/actionform/index.jsx | 13 + src/tabviews/custom/components/module/voucher/voucherTable/index.jsx | 170 ++++++++++++++++++++++++++++++++- src/tabviews/zshare/actionList/index.jsx | 1 src/tabviews/custom/components/module/voucher/index.jsx | 9 + src/tabviews/custom/components/module/voucher/index.scss | 3 src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 11 + src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx | 7 + src/tabviews/custom/components/module/voucher/voucherTable/index.scss | 21 ++++ 9 files changed, 256 insertions(+), 21 deletions(-) diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 5c0a14c..fd2da26 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -17,7 +17,7 @@ prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], - excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', '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'], tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width', 'hidden'], innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], @@ -328,6 +328,7 @@ } } else if (openType === 'excelOut') { reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') + reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value)) if (this.record.intertype === 'outer') { shows.push('innerFunc', 'sysInterface', 'outerFunc') @@ -352,6 +353,9 @@ } if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { shows.push('resetPageIndex') + } + if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') { + this.record.Ot = 'notRequired' } } else if (openType === 'popview') { reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) @@ -466,7 +470,7 @@ } if (appType === 'mob') { - if (Ot !== 'notRequired') { + if (Ot !== 'notRequired' && openType !== 'excelOut') { shows.push('control') reOptions.control = [ { value: '', text: '鏃�' }, @@ -481,7 +485,7 @@ } } } else { - if (Ot !== 'notRequired') { + if (Ot !== 'notRequired' && openType !== 'excelOut') { reOptions.control = [ { value: '', text: '鏃�' }, { value: 'disabled', text: '绂佺敤' }, @@ -566,6 +570,7 @@ _fieldval.label = '瀵煎嚭Excel' _fieldval.class = 'dgreen' _fieldval.execSuccess = 'never' + _fieldval.Ot = 'notRequired' this.record.Ot = 'notRequired' this.record.label = '瀵煎嚭Excel' this.record.class = 'dgreen' @@ -930,7 +935,7 @@ values.icon = 'scan' } } else if (values.OpenType === 'excelOut') { - values.Ot = 'notRequired' + values.Ot = values.Ot || 'notRequired' } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) { if ((values.Ot === 'requiredOnce' || card.Ot === 'requiredOnce') && card.Ot !== values.Ot) { values.verify.uniques = [] diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index c7cfe01..a36f5ef 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -27,7 +27,9 @@ charType: '', charInt: '', vouDate: null, - book: null + book: null, + username: sessionStorage.getItem('User_Name'), + change: false } UNSAFE_componentWillMount () { @@ -196,7 +198,7 @@ {remark: '鎻愮幇', subjectscode: '1001', subjectsname: '搴撳瓨鐜伴噾', debtor: 124, creditor: ''}, {remark: '璐叆鍥哄畾璧勪骇', subjectscode: '1001', subjectsname: '搴撳瓨鐜伴噾', debtor: '', creditor: 124}, {remark: '杞粨閿�鍞垚鏈�', subjectscode: '1001', subjectsname: '搴撳瓨鐜伴噾', debtor: -524, creditor: ''}, - {remark: '鎻愮幇', subjectscode: '1001', subjectsname: '搴撳瓨鐜伴噾', debtor: 34, creditor: ''}, + {remark: '鎻愮幇', subjectscode: '1001', subjectsname: '搴撳瓨鐜伴噾', debtor: 34, creditor: '', i: Math.random()}, ] this.setState({ @@ -217,7 +219,7 @@ } render() { - const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate } = this.state + const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, username } = this.state return ( <div className="menu-voucher-wrap" style={config.style}> @@ -265,6 +267,7 @@ </div> <VoucherTable config={config} data={data}/> </div> : null} + <div className="user">鍒跺崟浜猴細{username}</div> </div> ) } diff --git a/src/tabviews/custom/components/module/voucher/index.scss b/src/tabviews/custom/components/module/voucher/index.scss index 1760ed9..c57ba0c 100644 --- a/src/tabviews/custom/components/module/voucher/index.scss +++ b/src/tabviews/custom/components/module/voucher/index.scss @@ -73,6 +73,9 @@ border-color: var(--mk-sys-color); color: #ffffff; } + .user { + padding: 15px 30px 0px; + } } .mk-vcode-dropdown { diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx index 2a636f1..7ed2901 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx @@ -122,6 +122,8 @@ state = { editing: false, visible: false, + counting: false, + priceing: false } componentDidMount () { @@ -276,8 +278,13 @@ setTimeout(() => { this.setState({visible: true}) }, 100) + } else if (line.count_type === 'Y') { + this.setState({counting: true, value: line.count || 0}, () => { + let node = document.getElementById(col.uuid + record.uuid + 'count') + node && node.select() + }) } else { - this.setState({editing: false}) + this.setState({editing: false, visible: false, counting: false, priceing: false}) setTimeout(() => { MKEmitter.emit('tdFocus', 'debtor' + record.uuid) }, 50) @@ -290,9 +297,17 @@ MKEmitter.emit('changeRecord', col.tableId, fromJS(res).toJS()) this.setState({editing: false, visible: false}) - setTimeout(() => { - MKEmitter.emit('tdFocus', 'debtor' + res.uuid) - }, 50) + + if (res.count_type === 'Y') { + this.setState({counting: true, value: res.count || 0}, () => { + let node = document.getElementById(col.uuid + res.uuid + 'count') + node && node.select() + }) + } else { + setTimeout(() => { + MKEmitter.emit('tdFocus', 'debtor' + res.uuid) + }, 50) + } } cancel = () => { @@ -315,9 +330,99 @@ this.setState({editing: false, visible: false}) } + editCount = (e) => { + const { col, record } = this.props + e.stopPropagation() + + this.setState({counting: true, value: record.count || 0}, () => { + let node = document.getElementById(col.uuid + record.uuid + 'count') + node && node.select() + }) + } + + editPrice = (e) => { + const { col, record } = this.props + e.stopPropagation() + + this.setState({priceing: true, value: record.price || 0}, () => { + let node = document.getElementById(col.uuid + record.uuid + 'price') + node && node.select() + }) + } + + countPress = () => { + const { col, record } = this.props + const { value } = this.state + + let line = {...record} + line.count = value || 0 + + if (isNaN(line.count)) { + line.count = 0 + } + + MKEmitter.emit('changeRecord', col.tableId, line) + + this.setState({counting: false, priceing: true, value: line.price || 0}, () => { + let node = document.getElementById(col.uuid + record.uuid + 'price') + node && node.select() + }) + } + + countBlur = () => { + const { col, record } = this.props + const { value } = this.state + + this.setState({counting: false}) + + let line = {...record} + line.count = value || 0 + + if (isNaN(line.count)) { + line.count = 0 + } + + MKEmitter.emit('changeRecord', col.tableId, line) + } + + pricePress = () => { + const { col, record } = this.props + const { value } = this.state + + let line = {...record} + line.price = value || 0 + + if (isNaN(line.price)) { + line.price = 0 + } + + MKEmitter.emit('changeRecord', col.tableId, line) + + this.setState({priceing: false}) + setTimeout(() => { + MKEmitter.emit('tdFocus', 'debtor' + record.uuid) + }, 50) + } + + priceBlur = () => { + const { col, record } = this.props + const { value } = this.state + + this.setState({priceing: false}) + + let line = {...record} + line.price = value || 0 + + if (isNaN(line.price)) { + line.price = 0 + } + + MKEmitter.emit('changeRecord', col.tableId, line) + } + render() { let { col, record, className } = this.props - const { editing, visible } = this.state + const { editing, visible, counting, priceing } = this.state let children = null let colSpan = 1 @@ -385,7 +490,54 @@ } }) } - children = <div className="content-wrap" onClick={this.focus}>{val}</div> + + if (record.count_type === 'Y') { + if (counting) { + children = <div className="content-wrap" onClick={this.focus}> + <div>{val}</div> + <div className="count-wrap"> + <span style={{marginRight: '5px'}}> + <span>鏁伴噺锛�</span> + <span><InputNumber className="inner-input" id={col.uuid + record.uuid + 'count'} defaultValue={record.count || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.countPress} onBlur={this.countBlur}/></span> + </span> + <span onClick={this.editPrice}> + <span>鍗曚环锛�</span> + <span>{record.price || 0}</span> + </span> + </div> + </div> + } else if (priceing) { + children = <div className="content-wrap" onClick={this.focus}> + <div>{val}</div> + <div className="count-wrap"> + <span style={{marginRight: '5px'}} onClick={this.editCount}> + <span>鏁伴噺锛�</span> + <span>{record.count || 0}</span> + </span> + <span> + <span>鍗曚环锛�</span> + <span><InputNumber className="inner-input" id={col.uuid + record.uuid + 'price'} defaultValue={record.price || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.pricePress} onBlur={this.priceBlur}/></span> + </span> + </div> + </div> + } else { + children = <div className="content-wrap" onClick={this.focus}> + <div>{val}</div> + <div className="count-wrap"> + <span style={{marginRight: '5px'}} onClick={this.editCount}> + <span>鏁伴噺锛�</span> + <span>{record.count || 0}</span> + </span> + <span onClick={this.editPrice}> + <span>鍗曚环锛�</span> + <span>{record.price || 0}</span> + </span> + </div> + </div> + } + } else { + children = <div className="content-wrap" onClick={this.focus}>{val}</div> + } } } } else if (col.field === 'debtor') { @@ -557,7 +709,11 @@ data.push(this.getTotalLine(data)) this.setState({ - edData: data + edData: [] + }, () => { + this.setState({ + edData: data + }) }) } diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.scss b/src/tabviews/custom/components/module/voucher/voucherTable/index.scss index 091a093..7c3dcd3 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.scss +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.scss @@ -94,6 +94,10 @@ height: 100%; font-size: 13px; font-weight: bold; + + .count-wrap { + text-align: right; + } } .money-uint { height: 100%; @@ -129,7 +133,7 @@ border-radius: 0; resize: none; } - .ant-input-number { + .ant-input-number:not(.inner-input) { height: 60px; border-radius: 0; @@ -141,6 +145,21 @@ height: 60px; } } + .ant-input-number.inner-input { + display: inline-block; + width: 40px; + border-radius: 0; + height: 24px; + + .ant-input-number-handler-wrap { + display: none; + } + .ant-input-number-input { + border-radius: 0; + height: 22px; + padding: 0 5px; + } + } .ant-select { padding: 0px; position: absolute; diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 3d93b36..41f9ddb 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -18,6 +18,7 @@ static propTpyes = { BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 + selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� @@ -776,6 +777,7 @@ * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� */ getExcelCustomParam = (orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { + const { btn, selectedData } = this.props let _search = Utils.formatCustomMainSearch(search) let param = { @@ -786,6 +788,13 @@ // 鏁版嵁绠$悊鏉冮檺 if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' + } + + if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { + let primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') + if (primaryId) { + param.ID = primaryId + } } if (this.props.BID) { @@ -804,17 +813,19 @@ * @description 鑾峰彇榛樿瀛樺偍杩囩▼璇锋眰鍙傛暟 */ getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { - const { setting, btn } = this.props + const { setting, btn, selectedData, BID } = this.props let defaultSql = setting.execute || setting.default || 'true' let customScript = setting.customScript || '' let _dataresource = setting.dataresource || '' let queryType = setting.queryType + let primaryKey = setting.primaryKey || 'ID' if (btn.verify.dataType === 'custom') { defaultSql = btn.verify.defaultSql || 'true' _dataresource = btn.verify.dataresource || '' queryType = btn.verify.queryType + primaryKey = btn.verify.primaryKey || 'ID' if (/\s/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' @@ -857,8 +868,8 @@ param.dataM = 'Y' } - if (this.props.BID) { - param.BID = this.props.BID + if (BID) { + param.BID = BID } let userName = sessionStorage.getItem('User_Name') || '' @@ -914,6 +925,16 @@ _search = '' } + let primaryId = '' + if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { + primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') + if (_search && primaryId) { + _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + } else if (primaryId) { + _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + } + } + let LText = '' if (defaultSql !== 'false' && !pagination) { @@ -949,6 +970,21 @@ ` } + LText = LText.replace(/@ID@/ig, `'${primaryId || ''}'`) + param.custom_script = param.custom_script.replace(/@ID@/ig, `'${primaryId || ''}'`) + LText = LText.replace(/@BID@/ig, `'${BID}'`) + param.custom_script = param.custom_script.replace(/@BID@/ig, `'${BID}'`) + LText = LText.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + param.custom_script = param.custom_script.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + LText = LText.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + param.custom_script = param.custom_script.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + LText = LText.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + param.custom_script = param.custom_script.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + LText = LText.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + param.custom_script = param.custom_script.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + LText = LText.replace(/@typename@/ig, `'admin'`) + param.custom_script = param.custom_script.replace(/@typename@/ig, `'admin'`) + // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { param.custom_script && console.info(`${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${param.custom_script}`) diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 94ab9c5..10871f6 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -94,6 +94,7 @@ btn={item} BData={BData} setting={setting} + selectedData={selectedData} /> ) } else if (item.OpenType === 'popview') { diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index eaefc28..13bf576 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -18,7 +18,7 @@ prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'], exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'hidden'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'hidden'], - excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search', 'hidden'], + excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'clickouter', 'hidden'], tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'linkmenu', 'hidden'], innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position', 'hidden'], @@ -232,6 +232,7 @@ } } else if (openType === 'excelOut') { reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') + reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value)) if (this.record.intertype === 'outer') { shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') @@ -249,6 +250,9 @@ } else if (this.record.intertype === 'inner') { shows.push('innerFunc') reRequired.innerFunc = true + } + if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') { + this.record.Ot = 'notRequired' } } else if (openType === 'popview') { reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) @@ -317,7 +321,7 @@ reOptions.Ot = requireOptions.filter(op => op.value === 'requiredSgl') } - if (Ot !== 'notRequired') { + if (Ot !== 'notRequired' && openType !== 'excelOut') { reOptions.control = [ { value: '', text: '鏃�' }, { value: 'disabled', text: '绂佺敤' }, @@ -387,6 +391,7 @@ _fieldval.label = '瀵煎嚭Excel' _fieldval.class = 'dgreen' _fieldval.execSuccess = 'never' + _fieldval.Ot = 'notRequired' this.record.Ot = 'notRequired' this.record.label = '瀵煎嚭Excel' this.record.class = 'dgreen' @@ -683,7 +688,7 @@ values.position = values.position || 'toolbar' if (values.OpenType === 'excelOut') { - values.Ot = 'notRequired' + values.Ot = values.Ot || 'notRequired' } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d values.linkTab = Utils.getuuid() } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx index 557bf84..c4df36d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx @@ -199,6 +199,13 @@ </Form.Item> </Col> : null} {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> + <Form.Item label="涓婚敭"> + {getFieldDecorator('primaryKey', { + initialValue: setting.primaryKey || 'ID', + })(<Input placeholder={''} autoComplete="off" />)} + </Form.Item> + </Col> : null} + {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> <Form.Item label="鎺掑簭鏂瑰紡"> {getFieldDecorator('order', { initialValue: setting.order || '', -- Gitblit v1.8.0