From 0c1c59933e95c4c691d6ba3d11bf4aef98fe9e8d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 15 四月 2020 15:37:44 +0800 Subject: [PATCH] 2020-04-15 --- public/options.txt | 0 src/tabviews/formtab/formgroup/index.jsx | 5 src/templates/zshare/verifycardexcelout/index.jsx | 22 +++ src/templates/formtabconfig/index.jsx | 27 ++- src/templates/zshare/verifycard/index.jsx | 84 +++++++---- src/templates/zshare/verifycard/uniqueform/index.jsx | 3 src/templates/comtableconfig/index.jsx | 92 +------------ src/templates/zshare/verifycard/customscript/index.jsx | 4 src/templates/subtableconfig/index.jsx | 75 ++-------- src/templates/zshare/verifycardexcelin/index.jsx | 41 ++--- src/templates/zshare/verifycard/billcodeform/index.jsx | 3 src/templates/zshare/verifycardexcelin/customscript/index.jsx | 3 src/templates/zshare/verifycard/customform/index.jsx | 3 src/templates/zshare/verifycard/contrastform/index.jsx | 3 src/templates/formtabconfig/dragelement/card.jsx | 2 src/templates/zshare/verifycardexcelin/uniqueform/index.jsx | 3 16 files changed, 139 insertions(+), 231 deletions(-) diff --git a/public/options.text b/public/options.txt similarity index 100% rename from public/options.text rename to public/options.txt diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx index 515d800..3d9d77d 100644 --- a/src/tabviews/formtab/formgroup/index.jsx +++ b/src/tabviews/formtab/formgroup/index.jsx @@ -658,7 +658,8 @@ } render() { - const { groups, setting } = this.props + const { setting } = this.props + const { groups } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -673,7 +674,7 @@ let _width = (setting && setting.width) || 100 let keys = groups.map(group => group.uuid) - + return ( <Form {...formItemLayout} className="form-tab-form-field"> <Collapse diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 2eed00d..8a7c53b 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1396,98 +1396,22 @@ verifySubmit = () => { const { card } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) - - if (card.OpenType === 'excelIn') { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '', - }) - }) - } else if (card.execMode) { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '', - }) - }) - } else { - let _verify = this.verifyRef.state.verify - let _loading = this.verifyRef.state.updateloading - if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { - notification.warning({ - top: 92, - message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', - duration: 10 - }) - return - } else if (card.OpenType === 'excelOut') { - let _cols = _verify.columns.map(col => col.Column) - let _vcols = Array.from(new Set(_cols)) - if (_cols.length > _vcols.length) { - notification.warning({ - top: 92, - message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!', - duration: 10 - }) - - return - } - } - + this.verifyRef.handleConfirm().then(res => { config.action = config.action.map(item => { if (item.uuid === card.uuid) { - item.verify = _verify + item.verify = res } return item }) - if (_loading) { - let _this = this - - confirm({ - content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋, - okText: this.state.dict['header.confirm'], - cancelText: this.state.dict['header.cancel'], - onOk() { - _this.setState({ - profileVisible: false, - config: config, - card: '', - }) - }, - onCancel() {} - }) - } else { - this.setState({ - profileVisible: false, - config: config, - card: '', - }) - } - } + this.setState({ + profileVisible: false, + config: config, + card: '' + }) + }) } /** diff --git a/src/templates/formtabconfig/dragelement/card.jsx b/src/templates/formtabconfig/dragelement/card.jsx index 00f0036..abc46da 100644 --- a/src/templates/formtabconfig/dragelement/card.jsx +++ b/src/templates/formtabconfig/dragelement/card.jsx @@ -143,7 +143,7 @@ } </div> {type === 'action' ? <Icon className="edit" title="缂栬緫" type="edit" onClick={edit} /> : null} - {type === 'action' && card.btnType === 'confirm' && card.intertype === 'inner' && !card.innerFunc ? + {type === 'action' && card.btnType !== 'cancel' ? <Icon className="edit profile" title="鏍¢獙瑙勫垯" type="profile" onClick={profile} /> : null } {type === 'action' && card.btnType !== 'confirm' && card.btnType !== 'cancel' && <Icon className="edit close" title="鍒犻櫎" type="close" onClick={del} />} diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 08f9acb..5afda6c 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -1009,20 +1009,21 @@ verifySubmit = () => { const { card } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) - let _verify = this.verifyRef.state.verify - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = _verify - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '', + this.verifyRef.handleConfirm().then(res => { + config.action = config.action.map(item => { + if (item.uuid === card.uuid) { + item.verify = res + } + + return item + }) + + this.setState({ + profileVisible: false, + config: config, + card: '' + }) }) } diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index b99b32b..1cccb43 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -25,6 +25,7 @@ import GridBtnForm from '@/templates/zshare/gridbtnform' import EditCard from '@/templates/zshare/editcard' import VerifyCard from '@/templates/zshare/verifycard' +import VerifyCardPrint from '@/templates/zshare/verifycardprint' import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin' import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout' import MenuForm from '@/templates/zshare/menuform' @@ -1067,67 +1068,11 @@ const { card } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) - if (card.OpenType === 'excelIn') { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '' - }) - }) - } else if (card.execMode) { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '', - }) - }) - } else { - let _verify = this.verifyRef.state.verify - - if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { - notification.warning({ - top: 92, - message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', - duration: 10 - }) - return - } else if (card.OpenType === 'excelOut') { - let _cols = _verify.columns.map(col => col.Column) - let _vcols = Array.from(new Set(_cols)) - if (_cols.length > _vcols.length) { - notification.warning({ - top: 92, - message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!', - duration: 10 - }) - - return - } - } - + this.verifyRef.handleConfirm().then(res => { + config.action = config.action.map(item => { if (item.uuid === card.uuid) { - item.verify = _verify + item.verify = res } return item @@ -1138,7 +1083,7 @@ config: config, card: '' }) - } + }) } /** @@ -2646,7 +2591,7 @@ onCancel={() => { this.setState({ profileVisible: false }) }} destroyOnClose > - {this.state.card && this.state.card.OpenType !== 'excelIn' ? + {this.state.card && !this.state.card.execMode && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? <VerifyCard floor="subtable" card={this.state.card} @@ -2655,6 +2600,14 @@ wrappedComponentRef={(inst) => this.verifyRef = inst} /> : null } + {this.state.card && this.state.card.execMode ? + <VerifyCardPrint + card={this.state.card} + dict={this.state.dict} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> : null + } {this.state.card && this.state.card.OpenType === 'excelIn' ? <VerifyCardExcelIn card={this.state.card} diff --git a/src/templates/zshare/verifycard/billcodeform/index.jsx b/src/templates/zshare/verifycard/billcodeform/index.jsx index dd6ec73..544c8da 100644 --- a/src/templates/zshare/verifycard/billcodeform/index.jsx +++ b/src/templates/zshare/verifycard/billcodeform/index.jsx @@ -180,11 +180,10 @@ values.linkFieldName = _billField ? _billField.label : '' } - this.props.orderChange(values) this.setState({ editItem: null }, () => { - + this.props.orderChange(values) let _usedfields = this.props.billcodes.map(item => item.field) this.setState({ diff --git a/src/templates/zshare/verifycard/contrastform/index.jsx b/src/templates/zshare/verifycard/contrastform/index.jsx index dbff28f..d2ce501 100644 --- a/src/templates/zshare/verifycard/contrastform/index.jsx +++ b/src/templates/zshare/verifycard/contrastform/index.jsx @@ -35,9 +35,10 @@ if (!err) { values.uuid = this.state.editItem ? this.state.editItem.uuid : '' - this.props.contrastChange(values) this.setState({ editItem: null + }, () => { + this.props.contrastChange(values) }) this.props.form.setFieldsValue({ frontfield: '', diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index d021f37..13e2f93 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -86,10 +86,11 @@ this.setState({loading: true}) Api.getLocalConfig(param).then(res => { if (res.status) { - this.props.customChange(values) this.setState({ loading: false, editItem: null + }, () => { + this.props.customChange(values) }) this.props.form.setFieldsValue({ sql: '', diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 5a0532e..b56f0b6 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -32,7 +32,6 @@ }) } - handleConfirm = () => { // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { @@ -86,10 +85,11 @@ this.setState({loading: true}) Api.getLocalConfig(param).then(res => { if (res.status) { - this.props.scriptsChange(values) this.setState({ loading: false, editItem: null + }, () => { + this.props.scriptsChange(values) }) this.props.form.setFieldsValue({ sql: '' diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 9d8f8bf..396c41e 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -15,6 +15,7 @@ import './index.scss' const { TabPane } = Tabs +const { confirm } = Modal class VerifyCard extends Component { static propTpyes = { @@ -27,7 +28,6 @@ } state = { - updateloading: false, // 淇敼涓� initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� verify: {}, fields: [], @@ -772,25 +772,6 @@ }) } - updateChange = () => { - let _loading = false - if (this.customForm && this.customForm.state.editItem) { - _loading = true - } else if (this.uniqueForm && this.uniqueForm.state.editItem) { - _loading = true - } else if (this.orderForm && this.orderForm.state.editItem) { - _loading = true - } else if (this.scriptsForm && this.scriptsForm.state.editItem) { - _loading = true - } else if (this.contrastForm && this.contrastForm.state.editItem) { - _loading = true - } - - this.setState({ - updateloading: _loading - }) - } - uniqueChange = (values) => { let verify = JSON.parse(JSON.stringify(this.state.verify)) @@ -809,8 +790,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -832,8 +811,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -855,8 +832,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -878,8 +853,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -901,8 +874,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -960,10 +931,6 @@ } }, 10) } - - this.setState({ - updateloading: true - }) } handleStatus = (record, type) => { @@ -1165,6 +1132,55 @@ }) } + handleConfirm = () => { + let verify = JSON.parse(JSON.stringify(this.state.verify)) + + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + if (verify.default === 'false' && verify.scripts.length === 0) { + notification.warning({ + top: 92, + message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', + duration: 10 + }) + return + } + + let _loading = false + if (this.customForm && this.customForm.state.editItem) { + _loading = true + } else if (this.uniqueForm && this.uniqueForm.state.editItem) { + _loading = true + } else if (this.orderForm && this.orderForm.state.editItem) { + _loading = true + } else if (this.scriptsForm && this.scriptsForm.state.editItem) { + _loading = true + } else if (this.contrastForm && this.contrastForm.state.editItem) { + _loading = true + } + + if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { + _loading = true + } else if (this.customForm && this.customForm.props.form.getFieldValue('sql')) { + _loading = true + } + + if (_loading) { + confirm({ + content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋, + okText: this.props.dict['header.confirm'], + cancelText: this.props.dict['header.cancel'], + onOk() { + resolve(verify) + }, + onCancel() {} + }) + } else { + resolve(verify) + } + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ diff --git a/src/templates/zshare/verifycard/uniqueform/index.jsx b/src/templates/zshare/verifycard/uniqueform/index.jsx index 7a57963..bd175b6 100644 --- a/src/templates/zshare/verifycard/uniqueform/index.jsx +++ b/src/templates/zshare/verifycard/uniqueform/index.jsx @@ -46,9 +46,10 @@ values.fieldlabel = values.fieldlabel.join(',') values.field = values.field.join(',') - this.props.uniqueChange(values) this.setState({ editItem: null + }, () => { + this.props.uniqueChange(values) }) this.props.form.setFieldsValue({ field: [], diff --git a/src/templates/zshare/verifycardexcelin/customscript/index.jsx b/src/templates/zshare/verifycardexcelin/customscript/index.jsx index c1fa819..d436de3 100644 --- a/src/templates/zshare/verifycardexcelin/customscript/index.jsx +++ b/src/templates/zshare/verifycardexcelin/customscript/index.jsx @@ -137,10 +137,11 @@ this.setState({loading: true}) Api.getLocalConfig(param).then(res => { if (res.status) { - this.props.scriptsChange(values) this.setState({ loading: false, editItem: null + }, () => { + this.props.scriptsChange(values) }) this.props.form.setFieldsValue({ sql: '' diff --git a/src/templates/zshare/verifycardexcelin/index.jsx b/src/templates/zshare/verifycardexcelin/index.jsx index c249aeb..9ae2d2e 100644 --- a/src/templates/zshare/verifycardexcelin/index.jsx +++ b/src/templates/zshare/verifycardexcelin/index.jsx @@ -20,7 +20,6 @@ } state = { - updateloading: false, // 淇敼涓� verify: {}, excelColumns: [ { @@ -283,8 +282,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -306,8 +303,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -329,23 +324,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() - }) - } - - updateChange = () => { - let _loading = false - if (this.columnForm && this.columnForm.state.editItem) { - _loading = true - } else if (this.scriptsForm && this.scriptsForm.state.editItem) { - _loading = true - } else if (this.uniqueForm && this.uniqueForm.state.editItem) { - _loading = true - } - - this.setState({ - updateloading: _loading }) } @@ -386,10 +364,6 @@ } }, 10) } - - this.setState({ - updateloading: true - }) } handleStatus = (record, type) => { @@ -518,7 +492,20 @@ } } - if (this.state.updateloading) { + let _loading = false + if (this.columnForm && this.columnForm.state.editItem) { + _loading = true + } else if (this.scriptsForm && this.scriptsForm.state.editItem) { + _loading = true + } else if (this.uniqueForm && this.uniqueForm.state.editItem) { + _loading = true + } + + if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { + _loading = true + } + + if (_loading) { confirm({ content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋, okText: this.props.dict['header.confirm'], diff --git a/src/templates/zshare/verifycardexcelin/uniqueform/index.jsx b/src/templates/zshare/verifycardexcelin/uniqueform/index.jsx index 2f0827f..47d36b3 100644 --- a/src/templates/zshare/verifycardexcelin/uniqueform/index.jsx +++ b/src/templates/zshare/verifycardexcelin/uniqueform/index.jsx @@ -46,9 +46,10 @@ values.fieldlabel = values.fieldlabel.join(',') values.field = values.field.join(',') - this.props.uniqueChange(values) this.setState({ editItem: null + }, () => { + this.props.uniqueChange(values) }) this.props.form.setFieldsValue({ field: [], diff --git a/src/templates/zshare/verifycardexcelout/index.jsx b/src/templates/zshare/verifycardexcelout/index.jsx index b43b33e..8eda501 100644 --- a/src/templates/zshare/verifycardexcelout/index.jsx +++ b/src/templates/zshare/verifycardexcelout/index.jsx @@ -190,6 +190,28 @@ }) } + handleConfirm = () => { + let verify = JSON.parse(JSON.stringify(this.state.verify)) + + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + let _cols = verify.columns.map(col => col.Column) + let _vcols = Array.from(new Set(_cols)) + + if (_cols.length > _vcols.length) { + notification.warning({ + top: 92, + message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!', + duration: 10 + }) + + return + } + + resolve(verify) + }) + } + render() { const { verify, excelColumns } = this.state const formItemLayout = { -- Gitblit v1.8.0