jinlin
2023-12-29 bfa0b90c002d6d01f1442ce6882b426efa077a30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
  <zt-dialog ref="dialog"  @confirm="formSubmit">
    <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
      <zt-form-item label="编号" prop="code" rules="required">
        <el-input v-model="dataForm.code"></el-input>
      </zt-form-item>
      <zt-form-item label="审核人" prop="auditor" rules="required">
        <el-input v-model="dataForm.auditor"></el-input>
      </zt-form-item>
      <zt-form-item label="审核时间" prop="auditorDate" rules="required">
        <el-input v-model="dataForm.auditorDate"></el-input>
      </zt-form-item>
    </el-form>
    <template v-slot:footer>
      <el-button v-if="dataForm.disabled" type="primary" @click="print()">打印</el-button>
    </template>
  </zt-dialog>
</template>
 
<script>
  import qs from "qs";
  import Cookies from "js-cookie";
 
  export default {
    data() {
      return {
        dataForm: {
          id: '',
          configAuditReport:{
            code: '',
            auditor: '',
            auditorDate: '',
          },
          project: {
            softwareIdentity: '',
            softwareName: ''
          },
          problemList:[],
          contentList:[]
        }
      }
    },
    methods: {
      indexFormat(index) {
        return index += 1
      },
      init(id, row) {
        if (id) {
          this.dataForm.id = id
        } else {
          this.dataForm.id = row.id
        }
        if (row.projectId) {
          this.dataForm.projectId = row.projectId
        }
        this.getInfo()
        console.log(this.dataForm.id, this.dataForm.projectId, 'params params')
      },
      // 获取信息
      async getInfo() {
        let params = {
          reportId: this.dataForm.id,
          projectId: this.dataForm.projectId
        }
        let res = await this.$http.get(`/configAuditReport/ConfigAuditReport/getDto`, {params: params})
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
        if(this.dataForm.configAuditReport === null){
          this.dataForm.contractReview={}
        }
        console.log(this.dataForm, "getInfo this.dataForm")
      },
      async print(){
        var params = qs.stringify({
          token: Cookies.get('token'),
          id:this.dataForm.id
        })
        let apiURL = `/configAuditReport/ConfigAuditReport/exportReport`
        window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/configAuditReport/ConfigAuditReport/', this.dataForm)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>