fuliqi
2025-02-11 c4ec0fac48c9bef59fadba87404ea3d4bf9e087c
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
<template>
  <div>
    <el-dialog :before-close="cancelAuditing" title="工单审核" :visible.sync="auditingOpen" width="1000px" append-to-body>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form ref="auditingForm" :model="auditingForm" :rules="auditingRules" label-width="80px">
            <el-form-item label="工单号" prop="workOrderNo">
              <el-input v-model="auditingForm.workOrderNo" disabled/>
            </el-form-item>
            <el-form-item label="故障点位" prop="source">
              <el-input v-model="auditingForm.source" disabled/>
            </el-form-item>
            <el-form-item label="运维单位" prop="unitName">
              <el-input v-model="auditingForm.unitName" disabled/>
            </el-form-item>
            <el-form-item label="审核结果" prop="auditingResult">
              <el-radio-group v-model="auditingForm.auditingResult">
                <el-radio label="AUDITING_SUCCESS">通过</el-radio>
                <el-radio label="AUDITING_FAIL">驳回</el-radio>
              </el-radio-group>
 
            </el-form-item>
            <el-form-item label="审核备注" prop="auditingRemark">
              <el-input v-model="auditingForm.auditingRemark" type="textarea" maxlength="30" show-word-limit/>
            </el-form-item>
          </el-form>
        </el-col>
        <el-col :span="14" style="max-height: 500px; overflow-y: auto">
          <el-timeline v-if="ywConditions && ywConditions.length > 0">
            <el-timeline-item v-for="(condition, index) in ywConditions" :key="index"
                              :timestamp="condition.unitName + '___' + condition.createTime" placement="top"
            >
              <el-card>
                <div v-html="condition.ywCondition"></div>
                <div v-for="item in condition.ywProofMaterials != null ? condition.ywProofMaterials.split(',') : condition.ywProofMaterials"
                     :key="item.id">
                  <el-image
                    v-if="isImageFile(item)"
                    :src="getPreview(item)"
                    :preview-src-list="[getPreview(item)]"
                    fit="cover"
                    style="width: 100px; height: 100px; margin: 5px;"
                  >
                  </el-image>
                  <el-link
                    v-else
                    type="primary"
                    :underline="false"
                    @click="handleDownload(item)"
                  >
                    {{ getFileName(item) }}
                  </el-link>
                </div>
              </el-card>
            </el-timeline-item>
          </el-timeline>
          <el-empty v-else description="没有处理记录"></el-empty>
        </el-col>
      </el-row>
 
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelAuditing">取 消</el-button>
        <el-button type="primary" @click="submitAuditing">审 核</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { auditing } from '@/api/platform/work-order'
export default {
  name: "WorkOrderAuditing",
  props: {
    auditingOpen: {
      type: Boolean,
      required: true,
      default: false
    },
    dataForm: {
      type: Object,
      required: true,
    },
    ywConditions: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {
      auditingForm: {},
      auditingRules: {
        auditingResult: [
          { required: true, message: '审核结果不能为空', trigger: 'blur' }
        ]
      },
    }
  },
  methods: {
    getPreview(url) {
      // 使用全局配置的图片前缀
      return this.$img + url;
    },
    isImageFile(url) {
      const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp'];
      return imageExtensions.some(ext =>
        url.toLowerCase().endsWith(ext)
      );
    },
    getFileName(url) {
      return url.substring(url.lastIndexOf('/') + 1);
    },
    /** 下载按钮操作 */
    handleDownload(data) {
      this.$download.resource(data)
    },
    // 提交审核
    submitAuditing() {
      this.$refs['auditingForm'].validate(valid => {
        if (valid) {
          auditing(this.auditingForm).then(res => {
            this.$emit('close', false);
            this.$modal.msgSuccess('操作成功')
            this.$emit('getList', false);
          })
        }
      })
    },
    // 取消审核
    cancelAuditing() {
      this.auditingForm = {}
      this.$emit('close');
    },
  },
  watch: {
    dataForm: {
      handler(n, o) {
        this.auditingForm = n
      },
      deep: true
    }
  }
}
</script>
 
<style scoped>
</style>