buhuazhen
9 天以前 80fdc24e3aa75ad5368b533860769a1a1bd6c9b2
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
<script setup>
import SimpleMultiFileUpload from "@/components/FileUpload/SimpleMultiFileUpload.vue"
import {ref, defineExpose} from "vue"
import {ElMessage, ElMessageBox} from "element-plus";
import {findFileListByIds} from "@/plugins/download.js"
import {save} from "@/api/personnelManagement/employeeRecord.js"
 
const ids = ref([])
const fileList = ref([])
const contract = ref({})
const openDialog = (row, type) => {
  dialogFormVisible.value = true;
  contract.value = row
  //查询出附件信息进行显示 row.attachUpload
  fileList.value = []
  if(row.attachUpload){
    findFileListByIds(row.attachUpload.split(",")).then(res => {
      fileList.value = res.data
      ids.value = fileList.value.map(it => it.id)
    })
  }
}
 
 
 
const closeDia = () => {
  emit('close')
  dialogFormVisible.value = false
};
 
const saveDia = async () => {
  // 提交保存
  await save({
    id: contract.value.id,
    attachUpload: ids.value.join(',')
  }).then(res => {
    if (res.code === 200){
      ElMessage.success("操作成功");
    }
  })
  closeDia()
}
 
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false)
defineExpose({
  openDialog
})
</script>
 
<template>
  <div>
    <el-dialog
        v-model="dialogFormVisible"
        title="上传附件"
        width="50%"
        @close="closeDia"
    >
            <template #footer>
              <div class="dialog-footer">
              <el-button @click="closeDia">取消</el-button>
              <el-button @click="saveDia">保存</el-button>
              </div>
            </template>
          <SimpleMultiFileUpload
              :key="contract.id"
          v-model:ids="ids"
          v-model:file-list="fileList"
          />
    </el-dialog>
  </div>
</template>
 
<style scoped lang="scss">
 
</style>