SelectDialog.vue 1.9 KB
<template>
  <GLDialog class="select-dialog" :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" :labelWidth="labelWidth" labelPaddingRight="0" :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
    },
    labelWidth: {
      type: String,
      default: '154px'
    }
  },

  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">
.select-dialog {
  .dialog-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;

    span {
      white-space: nowrap;
    }

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