<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>
|