From 1772fc5e211f9e9e0ab4cdc6c29b436aac178c2a Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期五, 23 二月 2024 12:19:55 +0800 Subject: [PATCH] 修改 --- web/packages/components/zt-dialog/src/zt-dialog.vue | 68 +++++++++++++++++++++++++--------- 1 files changed, 50 insertions(+), 18 deletions(-) diff --git a/web/packages/components/zt-dialog/src/zt-dialog.vue b/web/packages/components/zt-dialog/src/zt-dialog.vue index f2c28e0..b8b85eb 100644 --- a/web/packages/components/zt-dialog/src/zt-dialog.vue +++ b/web/packages/components/zt-dialog/src/zt-dialog.vue @@ -12,11 +12,28 @@ @close="onClose"> <slot></slot> <template slot="footer"> - <el-button @click="visible = false" v-show="editAble">{{ $t('cancel') }}</el-button> - <el-button type="primary" @click="formSubmit()" v-preventReClick v-show="editAble && hasConfirm">{{ $t('confirm') - }} - </el-button> - <el-button type="info" @click="close()" v-show="!editAble">{{ $t('close') }}</el-button> + <template v-if="isView"> + <el-button type="info" @click="close()">{{ $t('close') }}</el-button> + </template> + <template v-else> + <template v-if="stepMarker && stepMarker.indexOf('first')>0"> + <el-button type="warning" @click="formSubmit('zc')">鏆傚瓨</el-button> + <el-button type="warning" @click="formSubmit('tj')" v-if="">鎻愪氦 + </el-button> + </template> + <template v-else-if="stepMarker"> + <el-button type="warning" @click="formSubmit('zc')">鏆傚瓨</el-button> + <el-button type="warning" @click="formSubmit('bl')">鍔炵悊</el-button> + </template> + <el-button v-else-if="hasConfirm" type="primary" @click="formSubmit('qd')" v-preventReClick>{{ + $t('confirm') }} + </el-button> + <el-button v-else-if="editAble" type="warning" @click="formSubmit('bc')">淇濆瓨 + </el-button> + + <el-button type="info" @click="visible = false" v-if="editAble||stepMarker">{{ $t('cancel') }}</el-button> + <el-button type="info" @click="close()" v-else>{{ $t('close') }}</el-button> + </template> <slot name="footer"></slot> </template> </el-dialog> @@ -32,23 +49,33 @@ type: String, default: '1' }, + stepMarker: {}, appendToBody: { type: Boolean, default: false }, hasConfirm: { type: Boolean, - default: true + default: false }, editAble: { type: Boolean, default: true + }, + hasSubmit: { + type: Boolean, + default: false + }, + hasSave: { + type: Boolean, + default: false } }, data() { return { dataFormBack: null, - visible: false + visible: false, + isView: false, //editAble: true // 鏄惁鍙紪杈� } }, @@ -58,7 +85,7 @@ return this.title } else if (!this.editAble) { return this.$t('view') - } else if(this.$parent.dataForm!==undefined) { + } else if (this.$parent.dataForm !== undefined) { return !this.$parent.dataForm.id ? this.$t('add') : this.$t('update') } } @@ -68,16 +95,17 @@ }, methods: { init(id, row, isView) { + this.isView = isView + + this.$nextTick(() => { // 娓呯┖琛ㄥ崟鏍¢獙 - console.log(this.$parent.$refs.dataForm,id, row, isView,'this.$parent.$refs.dataForm') + console.log(this.$parent.$refs.dataForm, id, row, isView, 'this.$parent.$refs.dataForm') if (this.$parent.$refs.dataForm) { // dialog閲岄潰鐨刦orm this.$parent.$refs.dataForm.resetFields() } - this.editAble = isView !== true // 鏄惁鍙紪杈� - // 璁剧疆dialog鐖堕〉闈㈠垵濮嬪寲琛ㄥ崟 this.$parent.dataForm = cloneDeep(this.dataFormBack) if (this.$parent.dataForm) { this.$parent.dataForm.id = id @@ -85,6 +113,7 @@ } if (this.$parent.init) { + console.log(id, row, this.stepMarker, 'id row') this.$parent.init(id, row) } if (id && this.$parent.getInfo) { @@ -94,12 +123,12 @@ this.open() }, // 琛ㄥ崟鎻愪氦 - formSubmit() { + formSubmit(submitType) { let dataForm = this.$parent.$refs.dataForm if (dataForm) { dataForm.validate(async valid => { if (valid) { - this.$emit('confirm') + this.$emit('confirm', submitType) } else { this.$nextTick(() => { let isError = document.getElementsByClassName('is-error') @@ -114,7 +143,7 @@ } }) } else { - this.$emit('confirm') + this.$emit('confirm', submitType) } }, open() { @@ -137,7 +166,7 @@ /deep/ .el-dialog { position: fixed; margin-top: 0 !important; - top:50% !important; + top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: 50%; @@ -153,9 +182,10 @@ width: 60%; position: fixed; margin-top: 0 !important; - top:50% !important; + top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); + .el-form > .el-form-item, .el-form .el-collapse-item__content > .el-form-item { width: 50%; float: left; @@ -168,9 +198,10 @@ width: 75%; position: fixed; margin-top: 0 !important; - top:50% !important; + top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); + .el-form > .el-form-item, .el-form .el-collapse-item__content > .el-form-item { //width: 33.33333%; float: left; @@ -183,9 +214,10 @@ width: 90%; position: fixed; margin-top: 0 !important; - top:50% !important; + top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); + .el-form > .el-form-item, .el-form .el-collapse-item__content > .el-form-item { //width: 33.33333%; float: left; -- Gitblit v1.9.1