element 弹框关闭报错

<template>
  <el-container style="padding: 00px 20px 0px 20px">
    <el-dialog
      title="售电公司注册审批记录"
      :visible.sync="innerVisible"
      width="60%"
      @close="closeDialog"
      :close-on-click-modal="true"
      :modal="false"
    >
    </el-dialog>
  </el-container>
</template>

<script>
import FlowNodeInsInfoRegApi from '@/api/pxf-service-imarketservice/imarketMemberManage/registerCheck/FlowNodeInsInfoRegApi'
import moment from 'moment'
export default {
  props: {
    accessVisible: Boolean,
    membersRegInfo: {
      type: Object,
      default: function() {
        return {}
      }
    },
    states: {
      type: Object,
      default: function() {
        return {}
      }
    },
    processNum: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      innerVisible: false,
      mmFlowNodeInsInfoRegList: [],
      scopeFlowNodeInsInfoRegList: [],
      scopeInfos: [],
      scopeProcessNum: '',
      scopeAll: '',
    }
  },
  watch: {

    accessVisible(newValue) {
      this.innerVisible = newValue
    }
  },
  mounted() {
    if (this.accessVisible) {
      this.init()
      this.queryByProcessNum(this.processNum, 1)
      this.queryByProcessNum(this.scopeProcessNum, 0)
    }
  },
  methods: {
    closeDialog() {
      this.$emit('close-dialog')
    },
    close() {
      this.$emit('update:visible') // 传递关闭事件
      this.$emit('close-dialog')
    },
    closeModal(e) {
      if (this.visible) {
        document.querySelector('.dialog').contains(e.target) ? '' : this.close() // 判断点击的落点在不在dialog对话框内,如果在对话框外就调用this.close()方法关闭对话框
      }
    },
    init() {
      this.scopeInfos = this.membersRegInfo.scopeInfos.filter(item => item.isRegAdd !== 1 && item.state !== '01')
      // 默认第一业务范围
      this.scopeProcessNum = ''
      if (this.scopeInfos.length > 0) {
        if (this.scopeProcessNum === '') {
          this.scopeProcessNum = this.scopeInfos[0].processNum
        }
      }
      // 拼接所有业务范围
      this.scopeAll = ''
      this.membersRegInfo.scopeInfos.forEach((item) => {
        this.scopeAll += item.name + ''
      })
      if (this.scopeAll.indexOf('') > -1) {
        this.scopeAll = this.scopeAll.substr(0, this.scopeAll.length - 1)
      }
    },
    queryByProcessNum(processNum, isRegAdd) {
      if (!processNum) {
        return
      }
      FlowNodeInsInfoRegApi.queryByProcessNum(processNum).then(result => {
        if (isRegAdd === 1) {
          this.mmFlowNodeInsInfoRegList = result.data
        } else {
          this.scopeFlowNodeInsInfoRegList = result.data
        }
      }).catch(err => {
        console.log(err)
      })
    },
    applicationDateFormat(row) {
      var date = row.applicationDate
      if (!date) {
        return ''
      }
      return moment(date).format('YYYY-MM-DD')
    },
    dateFormat(row, column) {
      var date = row[column.property]
      if (!date) {
        return ''
      }
      return moment(date).format('YYYY-MM-DD HH:mm:ss')
    },
    close() {
      this.$emit('close-dialog')
    },
    formatterState(row, column) {
      var state = row[column.property]
      return this.states[state]
    }
  }
}
</script>

<style scoped>

</style>

猜你喜欢

转载自www.cnblogs.com/javascript9527/p/11823047.html