123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <el-dialog
- :visible.sync="visible"
- :width="width"
- :show-close="false"
- :close-on-click-modal="false"
- :append-to-body="appendToBody"
- @closed="close"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">{{ title }}</div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Close@2x.png"
- alt=""
- @click="visible = false"
- />
- </div>
- </div>
- <slot></slot>
- <div slot="footer" class="dialog-footer" v-if="isShowFooter">
- <slot name="slotBtn"></slot>
- <el-button :loading="disabledBtn" @click="visible = false">{{
- cancelName
- }}</el-button>
- <el-button
- v-if="confirmStatus"
- :loading="disabledBtn"
- type="primary"
- @click="confirmBtn"
- >{{ confirmName }}</el-button
- >
- </div>
- </el-dialog>
- </template>
- <script>
- export default {
- name: "BaseDialog",
- props: {
- title: {
- type: String,
- default: "",
- },
- isShow: {
- type: Boolean,
- default: false,
- },
- width: {
- type: String,
- default: "600px",
- },
- cancelName: {
- type: String,
- default: "取 消",
- },
- confirmName: {
- type: String,
- default: "确 定",
- },
- isShowFooter: {
- type: Boolean,
- default: true,
- },
- appendToBody: {
- type: Boolean,
- default: false,
- },
- disabledBtn: {
- type: Boolean,
- default: false,
- },
- confirmStatus: {
- type: Boolean,
- default: true,
- },
- },
- data() {
- return {};
- },
- methods: {
- confirmBtn() {
- this.$emit("submit");
- },
- close() {
- this.$emit("close");
- },
- },
- computed: {
- visible: {
- get() {
- return this.isShow;
- },
- set(val) {
- this.$emit("update:isShow", false);
- },
- },
- },
- watch: {
- visible(val) {
- // 在此做显示与隐藏的交互
- if (val === false) {
- // 重置操作
- } else {
- // 展示时操作
- }
- },
- },
- };
- </script>
- <style scoped lang="scss">
- /deep/.el-dialog {
- border-radius: 8px;
- .el-dialog__header {
- padding: 0;
- .hearders {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0px 18px 0px 20px;
- border-bottom: 1px solid #e2e2e2;
- .leftTitle {
- font-size: 14px;
- font-weight: bold;
- color: #2f4378;
- }
- .rightBoxs {
- display: flex;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 13px;
- cursor: pointer;
- }
- }
- }
- }
- .el-dialog__footer {
- padding: 0;
- .dialog-footer {
- padding: 0px 40px;
- height: 70px;
- border-top: 1px solid #e2e2e2;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- }
- }
- /deep/.el-button {
- border-radius: 8px;
- }
- </style>
|