| | |
| | | @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="primary" @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> |
| | |
| | | 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 // 是否可编辑 |
| | | } |
| | | }, |
| | |
| | | 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') |
| | | } |
| | | } |
| | |
| | | }, |
| | | 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里面的form |
| | | 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 |
| | |
| | | } |
| | | |
| | | if (this.$parent.init) { |
| | | console.log(id, row, this.stepMarker, 'id row') |
| | | this.$parent.init(id, row) |
| | | } |
| | | if (id && this.$parent.getInfo) { |
| | |
| | | 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') |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | this.$emit('confirm') |
| | | this.$emit('confirm', submitType) |
| | | } |
| | | }, |
| | | open() { |
| | |
| | | /deep/ .el-dialog { |
| | | position: fixed; |
| | | margin-top: 0 !important; |
| | | top:50% !important; |
| | | top: 50% !important; |
| | | left: 50% !important; |
| | | transform: translate(-50%, -50%); |
| | | width: 50%; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |