SelectDialog.vue 1.9 KB
<template>
  <GLDialog :title="dialogConfig.title" mode="small" :visible.sync="visible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" :okText="dialogConfig.okText" :cancelText="dialogConfig.cancelText">
    <div class="dialog-wrap" v-loading="loading">
      <glsxCombiForm ref="editFormRef" :formObj="batchForm" :formData="editFormData" :formRules="editRules" formRef="editChildRef"></glsxCombiForm>
    </div>
  </GLDialog>
</template>

<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
  name: 'SelectDialog',
  props: {
    dialogConfig: {
      type: Object,
      default: () => {
        return {
          title: '提示',
          okText: '确定',
          cancelText: '取消'
        }
      }
    },
    visible: {
      type: Boolean,
      default: false
    },
    batchForm: {
      type: Object,
      default: () => { }
    },
    editFormData: {
      type: Array,
      default: () => []
    },
    editRules: {
      type: Object,
      default: () => { }
    },
    loading: {
      type: Boolean,
      default: false
    }
  },

  components: {
    glsxCombiForm
  },

  data() {
    return {}
  },

  methods: {
    confirmPriceChange() {
      this.$refs.editFormRef.$refs.editChildRef.validate(valid => {
        if (valid) {
          this.$emit('confirm', this.batchForm)
        }
      })
    },
    handleClose() {
      this.$emit('handleClose')
    }
  }
}
</script>
<style lang="scss">
.dialog-wrap {
  display: flex;
  // align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;

  span {
    white-space: nowrap;
    margin-right: 8px;
  }

  // /deep/ .el-input {
  //   &,
  //   .el-input__inner {
  //     width: 100px;
  //   }

  //   .el-input-group__append {
  //     box-sizing: border-box;
  //     padding: 0 11px;

  //     span {
  //       margin: 0;
  //     }
  //   }
  // }
}
</style>