rk
2025-09-22 cf2391a86bdea88196d49cd33949570f74c0985d
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<template>
  <GlobalAlertWindow
    :title="title"
    :visible.sync="visible"
    :confirm-working="isWorking"
    v-loading="isUploading"
    element-loading-text="文件上传中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.8)"
    @confirm="submit"
  >
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      label-width="125px"
      label-suffix=":"
      inline
    >
      <div>
        <el-form-item
          label="评分"
          prop="expertScore"
        >
          <el-input
            placeholder="请输入评分"
            v-model="form.expertScore"
          />
        </el-form-item>
      </div>
      <div>
        <el-form-item label="评分报告上传" prop="multiFileDTOs">
          <div v-if="form.multiFileDTOs.length" class="data-list">
            <FileLink
              :links="form.multiFileDTOs"
              linkName="url"
            />
            <!-- <div v-for="(item, index) in form.multiFileDTOs" :key="index">
              <FileLink
                :link="item.url"
                :name="item.name"
                @deleteAction="deleteFile(index)"
              />
            </div> -->
          </div>
          <div>
            <el-button type="primary" icon="el-icon-upload" @click="$refs.upFile.click()">上传资料</el-button>
          </div>
        </el-form-item>
        <input type="file" @change="upFiles" ref="upFile" style="display: none;" />
      </div>
    </el-form>
  </GlobalAlertWindow>
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalAlertWindow from '@/components/common/GlobalAlertWindow'
import { checkExpertDeclares } from '@/api/business/declares'
import { upload } from '@/api/system/common'
export default {
  name: 'GiveMarkWindow',
  extends: BaseOpera,
  components: { GlobalAlertWindow },
  data () {
    return {
      isUploading: false,
      // 表单数据
      form: {
        multiFileDTOs: [],
        expertScore: '',
        declareId: '',
      },
      // 验证规则
      rules: {
        expertScore: [
          { required: true, message: '请输入评分', trigger: 'blur' }
        ],
        multiFileDTOs: [
        { required: true, message: '请先上传评分报告上传', trigger: 'blur' }
        ]
      },
      approveResults: [
        // 2审核通过、3退回修改、4审核驳回
        { label:'审核通过', value: '2' },
        { label:'退回修改', value: '3' },
        { label:'审核驳回', value: '4' }
      ]
    }
  },
  created () {
    
  },
  methods: {
    open (title, target) {
      this.title = title
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.resetFields()
        this.form.declareId = target.declareId
      })
    },
    upFiles(file) {
      const formdate = new FormData()
      formdate.append('file', file.target.files[0])
      formdate.append('folder', 'znzz/project_file')
      this.isUploading = true
      upload(formdate)
        .then(res => {
          this.form.multiFileDTOs.push({
            name: res.originname,
            fileurl: res.imgaddr,
            url: res.url
          })
          console.log(this.form);
        })
        .catch(err => {
          console.log(err)
        })
        .finally(() => this.isUploading = false)
      this.$refs.upFile.value = null
    },
    submit() {
      this.$refs.form.validate(
        v=>{
          if (!v) {
            return
          }
          this.isWorking = true
          checkExpertDeclares({
            ...this.form
          })
            .then( res => {
              console.log(res)
              this.$emit('success')
            })
            .catch (err => {
              this.$message.error(err.message)
            })
            .finally(() => {
              this.isWorking = false
              this.visible = false
            })
      })
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import "@/assets/style/alertstyle.scss";
.data-list {
  margin-top: 3px;
  margin-bottom: 20px;
}
</style>