张诺
2 天以前 d2f590cfed0e874daa758d5e5548d17de8b3c772
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
<template>
  <div>
    <el-dialog
      title="上传"
      v-model="dialogVisitable"
      width="400px"
      @close="cancel"
    >
      <div class="upload-container">
        <div class="form-container">
          <div class="title">生产前</div>
          <fileUpload
            :statusType="0"
            ref="beforeProductionRef"
            :fileSize="1024"
            :fileType="['mp3', 'mp4', 'avi', 'mov', 'mkv']"
            :limit="10"
            :drag="false"
            v-model:modelValue="beforeModelValue"
          >
          </fileUpload>
        </div>
        <div class="form-container">
          <div class="title">生产后</div>
          <fileUpload
            :statusType="1"
            ref="afterProductionRef"
            :fileSize="1024"
            :fileType="['mp3', 'mp4', 'avi', 'mov', 'mkv']"
            :limit="10"
            :drag="false"
            v-model:modelValue="afterModelValue"
          >
          </fileUpload>
        </div>
        <div class="form-container">
          <div class="title">生产问题</div>
          <fileUpload
            :statusType="2"
            ref="issueProductionRef"
            :fileSize="1024"
            :fileType="['mp3', 'mp4', 'avi', 'mov', 'mkv']"
            :limit="10"
            :drag="false"
            v-model:modelValue="issueModelValue"
          >
          </fileUpload>
        </div>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="submitForm">保存</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
 
<script setup>
import { reactive, ref } from "vue";
import {ElMessage} from "element-plus";
import fileUpload from "@/components/FileUpload/index.vue";
import {uploadInspectionTask} from "@/api/inspectionManagement/index.js";
 
const emit = defineEmits(['closeDia']);
const dialogVisitable = ref(false);
const { proxy } = getCurrentInstance()
const beforeModelValue = ref([]);
const afterModelValue = ref([]);
const issueModelValue = ref([]);
const beforeProductionRef = ref(null);
const afterProductionRef = ref(null);
const issueProductionRef = ref(null);
 
const submitForm = async () => {
  let arr = [];
  if (beforeModelValue.value.length > 0) {
    arr.push(...beforeModelValue.value);
  }
  if (afterModelValue.value.length > 0) {
    arr.push(...afterModelValue.value);
  }
  if (issueModelValue.value.length > 0) {
    arr.push(...issueModelValue.value);
  }
  // 提交数据
  infoData.value.storageBlobDTO = arr;
  await uploadInspectionTask({...infoData.value});
  cancel()
  ElMessage.success("提交成功");
};
const infoData = ref(null);
// 打开弹框
const openDialog = async (row) => {
  infoData.value = row;
  dialogVisitable.value = true;
};
// 关闭合并表单
const cancel = () => {
  proxy.resetForm("formRef");
  dialogVisitable.value = false;
  emit("closeDia");
};
defineExpose({ openDialog });
</script>
 
<style scoped lang="scss">
.upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border: 1px solid #dcdfe6;
  box-sizing: border-box;
  .form-container {
    flex: 1;
    width: 100%;
    margin-bottom: 20px;
  }
}
.title {
  font-size: 14px;
  color: #165dff;
  line-height: 20px;
  font-weight: 600;
  padding-left: 10px;
  position: relative;
  margin: 6px 0;
}
.title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px; /* 调整垂直位置 */
  width: 4px; /* 小数条宽度 */
  height: 14px; /* 小数条高度 */
  background-color: #165dff; /* 蓝色 */
}
</style>