<template>
  <el-dialog
    :close-on-click-modal="true"
    :visible.sync="crud.tempShow.printerRequestInfo"
    title="文印申请详情"
    width="60%"
  >
    <el-row>
      <el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="test">
        <label class="el-form-item-label">申请编号 :</label>
        <span class="el-form-item-label">{{ form.taskCode }}</span>
      </el-col>
      <el-col :xs="11" :sm="11" :md="19" :lg="11" :xl="11" class="test">
        <label class="el-form-item-label">任务名称 :</label>
        <span class="el-form-item-label">{{ form.taskName }}</span>
      </el-col>
    </el-row>
    <el-row>
      <el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="test">
        <label class="el-form-item-label">打印文件 :</label>
        <span class="el-form-item-label"><a style="color:-webkit-link !important;" :href="baseApi+ '/file/' + form.file.type + '/' + form.file.realName">{{ form.file.name }}</a></span>
      </el-col>
      <el-col :xs="11" :sm="11" :md="19" :lg="11" :xl="11" class="test">
        <label class="el-form-item-label">申请人 :</label>
        <span class="el-form-item-label">{{ form.requestUser.name }}</span>
      </el-col>
    </el-row>
  </el-dialog>
</template>
<script>
import crudDmPrintingRequest from '@/api/dm/printingRequest/dmPrintingRequest'
import { mapGetters } from 'vuex'
import CRUD, { form, crud } from '@crud/crud'
const defaultForm = { id: null, taskCode: null, taskName: null, file: { name: null, realName: null, path: null, type: null }, requestUser: { name: null }}

export default {
  mixins: [form(defaultForm), crud()],
  // 数据字典
  dicts: ['user_status'],
  cruds() {
    return CRUD({ title: '文印申请', url: 'api/dmPrintingRequest', crudMethod: { ...crudDmPrintingRequest }})
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      devices: [],
      multipleSelection: crud.selectData || [],
      checkInfo: '',
      code: '',
      size: 0,
      page: 0,
      total: 0

    }
  },
  computed: {
    ...mapGetters([
      'baseApi'
    ])
  },
  watch: {
    'crud.openId': {
      handler: function(datainfo) {
        this.$nextTick(function() {
          console.info('crud.selectData', crud.selectData)
          this.getInfo()
        })
      },
      deep: true
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      console.info('this.crud.openId ', this.crud.openId)
      crudDmPrintingRequest.getInfo(this.crud.openId).then(res => {
        this.form = res
      })
    }
  }
}
</script>
