From c39acd25c3e8747be16773a003f519e4ef801640 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 一月 2023 16:44:16 +0800 Subject: [PATCH] 2023-01-17 --- package-lock.json | 51 +++++++ src/tabviews/custom/components/module/voucher/index.jsx | 45 ++++- src/menu/components/group/paste/index.jsx | 4 src/tabviews/custom/components/module/voucher/voucherTable/index.scss | 23 +++ src/menu/pastecontroller/index.jsx | 4 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 2 public/options.json | 12 src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 22 ++ src/tabviews/basetable/index.jsx | 2 src/tabviews/custom/components/module/voucher/voucherTable/index.jsx | 133 ++++++++++++++---- src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 6 src/menu/components/tree/antd-tree/index.jsx | 2 package.json | 1 src/templates/zshare/editTable/index.scss | 3 src/menu/components/tabs/paste/index.jsx | 4 src/utils/utils.js | 18 ++ src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 44 ++++-- 18 files changed, 292 insertions(+), 86 deletions(-) diff --git a/package-lock.json b/package-lock.json index 380e9ac..a469c79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19343,6 +19343,52 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, + "sheetjs-style": { + "version": "0.15.8", + "resolved": "https://registry.npmjs.org/sheetjs-style/-/sheetjs-style-0.15.8.tgz", + "integrity": "sha512-/wRiwnq5ck7aO+zLBs+u5JqQK4agUTIGCS0nxgaMjFl6XdlVaaB/RNJcP6S6Efj3+RYbSZuAoyqmSnbzxfT7Kg==", + "requires": { + "adler-32": "~1.2.0", + "cfb": "^1.1.4", + "codepage": "~1.14.0", + "commander": "~2.17.1", + "crc-32": "~1.2.0", + "exit-on-epipe": "~1.0.1", + "ssf": "~0.10.3", + "wmf": "~1.0.1" + }, + "dependencies": { + "cfb": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", + "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==", + "requires": { + "adler-32": "~1.3.0", + "crc-32": "~1.2.0" + }, + "dependencies": { + "adler-32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz", + "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==" + } + } + }, + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==" + }, + "ssf": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.3.tgz", + "integrity": "sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w==", + "requires": { + "frac": "~1.1.2" + } + } + } + }, "shell-quote": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", @@ -21720,6 +21766,11 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "wmf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz", + "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==" + }, "wolfy87-eventemitter": { "version": "5.2.9", "resolved": "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz", diff --git a/package.json b/package.json index 8963e6d..5ae1493 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "resolve-url-loader": "3.1.0", "sass-loader": "7.2.0", "semver": "6.3.0", + "sheetjs-style": "^0.15.8", "spark-md5": "^3.0.1", "sql-formatter": "^11.0.2", "style-loader": "1.0.0", diff --git a/public/options.json b/public/options.json index 4e405d0..39ac1e9 100644 --- a/public/options.json +++ b/public/options.json @@ -1,12 +1,12 @@ { - "appId": "201912040924165801464FF1788654BC5AC73", - "appkey": "20191106103859640976D6E924E464D029CF0", + "appId": "202108312122504607B107A83F55B40C98CCF", + "appkey": "20210831212235413F287EC3BF489424496C8", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", - "externalDatabase": "", + "externalDatabase": "qqq", "lineColor": "", "filter": "false", - "defaultApp": "mk", + "defaultApp": "mkindustry", "defaultLang": "zh-CN", "WXAppID": "", "WXminiAppID": "", @@ -17,6 +17,6 @@ "transfer": "false", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], - "host": "http://qingqiumarket.cn", - "service": "MKWMS/" + "host": "http://demo.mk9h.cn", + "service": "erp_new/" } \ No newline at end of file diff --git a/src/menu/components/group/paste/index.jsx b/src/menu/components/group/paste/index.jsx index 755b6f3..05b5104 100644 --- a/src/menu/components/group/paste/index.jsx +++ b/src/menu/components/group/paste/index.jsx @@ -24,7 +24,7 @@ pasteSubmit = () => { let appType = sessionStorage.getItem('appType') - let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox'] + let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox'] let types = { login: '鐧诲綍', navbar: '瀵艰埅鏍�', @@ -37,7 +37,7 @@ } if (appType !== 'mob') { - options.push('editable', 'antvG6') + options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/menu/components/tabs/paste/index.jsx b/src/menu/components/tabs/paste/index.jsx index 9a398fa..53b2285 100644 --- a/src/menu/components/tabs/paste/index.jsx +++ b/src/menu/components/tabs/paste/index.jsx @@ -60,7 +60,7 @@ pasteSubmit = () => { const { Tab } = this.props let appType = sessionStorage.getItem('appType') - let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox'] + let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox'] let types = { login: '鐧诲綍', navbar: '瀵艰埅鏍�', @@ -70,7 +70,7 @@ if (appType === 'mob') { options.push('menubar') } else { - options.push('editable', 'antvG6') + options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/menu/components/tree/antd-tree/index.jsx b/src/menu/components/tree/antd-tree/index.jsx index 3dd7abd..c3c8640 100644 --- a/src/menu/components/tree/antd-tree/index.jsx +++ b/src/menu/components/tree/antd-tree/index.jsx @@ -173,7 +173,7 @@ <NormalForm title="鍩烘湰璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}> <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> - <CopyComponent type="normaltable" card={card}/> + <CopyComponent type="tree" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 5c6dcd7..7a49bf2 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -59,7 +59,7 @@ pasteSubmit = () => { let appType = sessionStorage.getItem('appType') - let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'iframe', 'sandbox'] + let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'iframe', 'sandbox'] if (appType === 'mob') { if (sessionStorage.getItem('editMenuType') !== 'popview') { @@ -68,7 +68,7 @@ options.push('menubar') } } else { - options.push('editable', 'antvG6') + options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 7923571..7965a78 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -291,6 +291,8 @@ }) return true + } else { + item.name = (this.props.MenuName || '') } // 鎼滅储鏉′欢鍒濆鍖� diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 2eb3f9c..1b18806 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -20,10 +20,11 @@ BID: '', config: null, loading: false, - data: null, + data: [], disableAdd: false, disableSave: false, typeOptions: [], + subjects: [], charType: '', charInt: '', vouDate: null, @@ -77,7 +78,14 @@ const { config } = this.state if (config.wrap.supBook === MenuID) { - this.setState({ book: data }, () => { + let month = data.months + let vouDate = moment() + + if (month && month < moment().format('YYYY-MM')) { + vouDate = moment(month, 'YYYY-MM').endOf('month') + } + + this.setState({ book: data, vouDate }, () => { this.loadData() }) return @@ -118,7 +126,26 @@ typeOptions: typeOptions, charType: typeOptions[0] ? typeOptions[0].voucher_class : '', charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '', + subjects: res.subjects || [], }) + + setTimeout(() => { + this.getVoucher() + }, 200) + }) + } + + + getVoucher = () => { + let data = [ + {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: ''}, + ] + + this.setState({ + data: data }) } @@ -134,12 +161,8 @@ } - changeVoucherDate = () => { - - } - render() { - const { config, disableSave, disableAdd, typeOptions, charType, charInt, data } = this.state + const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, subjects } = this.state return ( <div className="menu-voucher-wrap" style={config.style}> @@ -153,15 +176,15 @@ {config.wrap.type === 'edit' ? <div className="voucher-body"> <div className="pre-wrap"> <div className="voucher-code"> - <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charInt})}> + <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charint})}> {typeOptions.map(option => - <Select.Option value={option.voucher_class} charInt={option.voucher_char_int}>{option.voucher_char}</Select.Option> + <Select.Option key={option.voucher_char_int} value={option.voucher_class} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> )} </Select> <Input value={charInt} autoComplete="off" onChange={(e) => this.setState({charInt: e.target.value})}/> 鍙� </div> <div className="voucher-date"> - 鏃ユ湡锛�<DatePicker onChange={this.changeVoucherDate}/> + 鏃ユ湡锛�<DatePicker value={vouDate} onChange={(val) => this.setState({vouDate: val})}/> </div> <div className="voucher-affix"> 闄勫崟鎹� <Input autoComplete="off" /> 寮� @@ -169,7 +192,7 @@ <Button type="link" className="" onClick={this.triggerprint}>澶囨敞</Button> </div> </div> - <VoucherTable config={config} data={data}/> + <VoucherTable config={config} subjects={subjects} data={data}/> </div> : null} {config.wrap.type === 'check' ? <div className="voucher-body"> <div className="pre-wrap"> diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx index 8d5240d..b79fdd7 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Table, Modal, Input, InputNumber, notification, message, AutoComplete } from 'antd' +import { Table, Modal, Input, InputNumber, notification, message, AutoComplete, Select } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -78,7 +78,7 @@ if (col.field === 'creditor') { MKEmitter.emit('nextLine', col, record) } else { - let cl = {remark: 'subject', subject: 'debtor', debtor: 'creditor'} + let cl = {remark: 'subjectscode', subjectscode: 'debtor', debtor: 'creditor'} MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid) } }, 50) @@ -89,10 +89,19 @@ if (record.type === 'total') return - this.setState({editing: true, value: record[col.field]}, () => { - let node = document.getElementById(col.uuid + record.uuid) - node && node.select() - }) + if (col.field === 'subjectscode') { + this.setState({editing: true}, () => { + try { + let node = document.getElementById(col.uuid + record.uuid) + node.click() + } catch(e) {} + }) + } else { + this.setState({editing: true, value: record[col.field]}, () => { + let node = document.getElementById(col.uuid + record.uuid) + node && node.select() + }) + } } onBlur = () => { @@ -100,6 +109,8 @@ const { value } = this.state this.setState({editing: false}) + + if (col.field === 'subjectscode') return if (value !== record[col.field]) { let line = {...record, [col.field]: value} @@ -118,12 +129,28 @@ this.setState({value: val}) } - complete = (key, option) => { - this.setState({value: option.props.value}) + complete = (val) => { + this.setState({value: val}, () => { + this.onBlur() + }) + } + + onSelectChange = (val, option) => { + const { col, record } = this.props + + this.setState({editing: false}) + + let line = {...record, ...option.props.extra} + + MKEmitter.emit('changeRecord', col.tableId, line) + + setTimeout(() => { + MKEmitter.emit('tdFocus', 'debtor' + record.uuid) + }, 50) } render() { - let { col, record, className } = this.props + let { col, record, subjects, className } = this.props const { editing } = this.state let children = null @@ -154,15 +181,27 @@ children = <div className="content-wrap" onClick={this.focus}>{val}</div> } } - } else if (col.field === 'subject') { + } else if (col.field === 'subjectscode') { if (record.type === 'total') { colSpan = 0 } else { - let val = record.subject || '' - if (editing) { - children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> + children = <Select + showSearch + defaultValue={record.subjectscode || ''} + dropdownClassName="edit-table-dropdown" + id={col.uuid + record.uuid} + onBlur={this.onBlur} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onSelect={this.onSelectChange} + > + {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subjectscode}>{item.subjectscode + ' ' + item.subjectsname}</Select.Option>))} + </Select> } else { + let val = '' + if (record.subjectscode) { + val = (record.subjectscode || '') + ' ' + (record.subjectsname || '') + } children = <div className="content-wrap" onClick={this.focus}>{val}</div> } } @@ -217,6 +256,7 @@ class VoucherTable extends Component { static propTpyes = { config: PropTypes.object, // 鑿滃崟Id + subjects: PropTypes.array, // 浼氳绉戠洰 BID: PropTypes.any, // 涓昏〃ID data: PropTypes.any, // 琛ㄦ牸鏁版嵁 total: PropTypes.any, // 鎬绘暟 @@ -236,17 +276,7 @@ } UNSAFE_componentWillMount () { - const { config } = this.props - - let data = [ - {remark: '鎻愮幇', subject: '1001 搴撳瓨鐜伴噾', debtor: 124, creditor: ''}, - {remark: '璐叆鍥哄畾璧勪骇', subject: '1001 搴撳瓨鐜伴噾', debtor: '', creditor: 124}, - {remark: '杞粨閿�鍞垚鏈�', subject: '1001 搴撳瓨鐜伴噾', debtor: -524, creditor: ''}, - {remark: '鎻愮幇', subject: '1001 搴撳瓨鐜伴噾', debtor: 34, creditor: ''}, - ] - - data = this.initData(data) - data.push(this.getTotalLine(data)) + const { config, subjects, data } = this.props let columns = [ { @@ -261,12 +291,13 @@ }, { title: '浼氳绉戠洰', - dataIndex: 'subject', - key: 'subject', + dataIndex: 'subjectscode', + key: 'subjectscode', width: '34%', onCell: record => ({ record, - col: {uuid: 'subject', field: 'subject', tableId: config.uuid}, + subjects, + col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, }) }, { @@ -304,8 +335,7 @@ ] this.setState({ - data: data, - edData: fromJS(data).toJS(), + edData: this.resetData(fromJS(data).toJS()), columns, tableId: config.uuid }) @@ -335,8 +365,43 @@ UNSAFE_componentWillReceiveProps(nextProps) { if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { - this.setState({data: nextProps.data || []}) + this.resetData(fromJS(nextProps.data).toJS()) + } else if (!is(fromJS(this.props.subjects), fromJS(nextProps.subjects))) { + this.resetSubjects(nextProps.subjects) } + } + + resetSubjects = (subjects) => { + const { config } = this.props + let columns = fromJS(this.state.columns).toJS() + + this.setState({ + columns: columns.map(col => { + if (col.key === 'subjectscode') { + return { + title: '浼氳绉戠洰', + dataIndex: 'subjectscode', + key: 'subjectscode', + width: '34%', + onCell: record => ({ + record, + subjects, + col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, + }) + } + } + return col + }) + }) + } + + resetData = (data) => { + data = this.initData(data) + data.push(this.getTotalLine(data)) + + this.setState({ + edData: data + }) } initData = (data) => { @@ -349,7 +414,7 @@ if (_data.length < 4) { for (let i = _data.length - 1; i < 4; i++) { - _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''}) + _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) } } return _data @@ -478,7 +543,7 @@ MKEmitter.emit('tdFocus', 'remark' + edData[record.index + 1].uuid) } else { let _data = fromJS(edData).toJS() - let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subject: '', debtor: '', creditor: ''} + let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''} _data.splice(_data.length - 1, 0, line) @@ -512,7 +577,7 @@ if (_data.length < 4) { for (let i = _data.length - 1; i < 4; i++) { - _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''}) + _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) } } @@ -535,7 +600,7 @@ _data.pop() if (record.index === _data.length - 1) { - _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subject: '', debtor: '', creditor: ''}) + _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) } _data.push(this.getTotalLine(_data)) diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.scss b/src/tabviews/custom/components/module/voucher/voucherTable/index.scss index 5114008..4d4702a 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.scss +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.scss @@ -141,6 +141,22 @@ height: 60px; } } + .ant-select { + padding: 0px; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + .ant-select-selection { + height: 100%; + border-radius: 0; + + .ant-select-arrow { + display: none; + } + } + } .editing_table_cell { .ant-input { padding: 0px; @@ -181,3 +197,10 @@ } } } + +.edit-table-dropdown { + .ant-select-dropdown-menu-item { + white-space: unset; + text-overflow: unset; + } +} diff --git a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx index cd65eaa..86891ed 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx @@ -1,7 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { notification } from 'antd' -import * as XLSX from 'xlsx' +import * as XLSX from 'sheetjs-style' import Utils from '@/utils/utils.js' import './index.scss' diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 09ee076..d0cba8c 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -303,7 +303,7 @@ }) } - let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || '')) + let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || ''), this.state.primaryId) if (result.errors) { notification.warning({ diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 8dc3084..3d93b36 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -3,7 +3,7 @@ import moment from 'moment' import { is, fromJS } from 'immutable' import { Button, Modal, notification, message } from 'antd' -import * as XLSX from 'xlsx' +import * as XLSX from 'sheetjs-style' import Utils from '@/utils/utils.js' import options from '@/store/options.js' @@ -602,11 +602,15 @@ let _header = [] let _topRow = {} let colwidth = [] - - columns.forEach(col => { + let requires = [] + + columns.forEach((col, i) => { _header.push(col.Column) _topRow[col.Column] = col.Text colwidth.push({width: col.Width || 20}) + if (col.required === 'true') { + requires.push(i) + } }) let table = [] @@ -638,8 +642,18 @@ }) const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) - + ws['!cols'] = colwidth + + if (requires.length) { + let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + requires.forEach(col => { + if (cols[col]) { + ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }} + } + }) + } + // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} const wb = XLSX.utils.book_new() XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index f288e7d..a4e6142 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -49,7 +49,7 @@ _dec += ',' } - let _sql = `Declare @${btn.sheet} table (${_dec}jskey nvarchar(50) ) + let _sql = `Declare @${btn.sheet.replace(/@db@/ig, '')} table (${_dec}jskey nvarchar(50) ) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` @@ -183,7 +183,7 @@ } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) + param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`) param.LText = param.LText.replace(/\n/g, ' ') // 澶栬仈鏁版嵁搴撴浛鎹� @@ -298,7 +298,7 @@ </Col> <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, {usefulfields} </Form.Item> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 6fe2b7c..ff8e714 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -37,7 +37,7 @@ inputType: 'input', editable: true, unique: true, - width: '17%' + width: '16%' }, { title: '鍚嶇О', @@ -45,7 +45,7 @@ inputType: 'input', editable: true, unique: true, - width: '17%' + width: '16%' }, { title: '鍒楀', @@ -54,7 +54,7 @@ min: 5, max: 200, editable: true, - width: '12%', + width: '10%', render: (text) => text || 20 }, { @@ -63,7 +63,7 @@ inputType: 'select', editable: true, required: false, - width: '14%', + width: '12%', render: (text) => { if (text === 'image') { return '鍥剧墖' @@ -85,7 +85,7 @@ inputType: 'radio', editable: true, required: false, - width: '14%', + width: '12%', render: (text) => { if (text === 'true') { return '鏄�' @@ -114,7 +114,7 @@ inputType: 'radio', editable: true, required: false, - width: '14%', + width: '12%', render: (text) => { if (text !== 'false') { return '鏄�' @@ -126,7 +126,19 @@ {value: 'true', text: '鏄�'}, {value: 'false', text: '鍚�'} ] - } + }, + { + title: '绾㈣壊鏍囬', + dataIndex: 'required', + width: '10%', + editable: true, + inputType: 'radio', + render: (text, record) => record.required === 'true' ? '鏄�' : '鍚�', + options: [ + {value: 'true', text: '鏄�'}, + {value: 'false', text: '鍚�'} + ] + }, ], scriptsColumns: [ { @@ -215,13 +227,12 @@ if (card.intertype !== 'system') { _verify.enable = 'false' } - if (_verify.columns[0] && (!_verify.columns[0].type || !_verify.columns[0].output)) { - _verify.columns = _verify.columns.map(col => { - col.type = col.type || 'text' - col.output = col.output || 'true' - return col - }) - } + _verify.columns = _verify.columns.map(col => { + col.type = col.type || 'text' + col.output = col.output || 'true' + col.required = col.required || 'false' + return col + }) let defaultscript = '' if (!_verify.script && card.intertype === 'system') { @@ -459,6 +470,7 @@ values.uuid = Utils.getuuid() values.abs = 'false' values.output = 'true' + values.required = 'false' verify.columns.push(values) this.setState({ @@ -751,6 +763,7 @@ Width: 20, abs: 'false', output: 'true', + required: 'false', type: 'text', uuid: Utils.getuuid() } @@ -798,6 +811,7 @@ Width: 20, abs: 'false', output: col.output || 'true', + required: col.required || 'false', type: 'text', } @@ -995,7 +1009,7 @@ <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� </Button> - <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙繘琛屾暟鎹鐞嗭紙鍙栫粷瀵瑰�笺�佷繚鐣欏皬鏁颁綅锛夈��</div> + <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙繘琛屾暟鎹鐞嗭紙鍙栫粷瀵瑰�笺�佷繚鐣欏皬鏁颁綅锛夛紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div> <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> </TabPane> {card.intertype === 'system' ? <TabPane tab={ diff --git a/src/templates/zshare/editTable/index.scss b/src/templates/zshare/editTable/index.scss index 7d83deb..a2f12ad 100644 --- a/src/templates/zshare/editTable/index.scss +++ b/src/templates/zshare/editTable/index.scss @@ -13,6 +13,9 @@ .ant-select { width: 100%; } + span.ant-radio + * { + padding-left: 2px; + } > td { padding: 14px 10px; } diff --git a/src/utils/utils.js b/src/utils/utils.js index 2a82699..e7c224d 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -844,7 +844,7 @@ * @return {Object} dict 瀛楀吀椤� * @return {String} BID 涓婄骇Id */ -export function getExcelInSql (item, data, dict, BID) { +export function getExcelInSql (item, data, dict, BID, primaryId) { let btn = item.verify let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] let userName = sessionStorage.getItem('User_Name') || '' @@ -897,20 +897,30 @@ btn.scripts.forEach(script => { if (script.status === 'false') return + let _sql = script.sql + + _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) + _sql = _sql.replace(/@BID@/ig, `'${BID}'`) + _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + _sql = _sql.replace(/@typename@/ig, `'admin'`) + if (script.position === 'init') { _initCustomScript += ` /* 鑷畾涔夎剼鏈� */ - ${script.sql} + ${_sql} ` } else if (script.position === 'front') { _prevCustomScript += ` /* 鑷畾涔夎剼鏈� */ - ${script.sql} + ${_sql} ` } else { _backCustomScript += ` /* 鑷畾涔夎剼鏈� */ - ${script.sql} + ${_sql} ` } }) -- Gitblit v1.8.0