<template>
  <admin-modal title="进度跟踪" :visible.sync="visible" :loading="loading" :footer="null" @on-cancel="handleCancel">
    <ApprovalProcessTrack ref="approvalProcessTrackRef" />
  </admin-modal>
</template>

<script>
import ApprovalProcessTrack from './ApprovalProcessTrack'
import {
  RESET_APPROVAL_PROCESS_INFO_AND_RULES,
  SET_APPROVAL_PROCESS_INFO
} from '@/components/hrhx/approval/utils/set-process-rules.js'
export default {
  name: 'ApprovalProcessTrackModal',
  components: { ApprovalProcessTrack },
  data() {
    return {
      visible: false,
      loading: false
    }
  },
  methods: {
    async openModal(record) {
      this.visible = true
      const id = record.businessId
      if (record.procDefCategory === '物资计划') {
        SET_APPROVAL_PROCESS_INFO(data.value)
      }
      this.$nextTick(() => {
        this.$refs.approvalProcessTrackRef.getInit()
      })
    },

    handleCancel() {
      RESET_APPROVAL_PROCESS_INFO_AND_RULES()
      this.visible = false
    }
  }
}
</script>
