fix: BUG修改

This commit is contained in:
kun 2023-12-05 10:08:33 +08:00
parent b09575a867
commit b3cf69647d
3 changed files with 77 additions and 36 deletions

View File

@ -436,3 +436,13 @@ export const fileShowAdd = (params: any) => {
export const fileShowDelete = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/delete`, params);
};
// 项目列表管理--根据ID查询附件文件列表
export const annexFileList = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/queryById`, params);
};
// 项目列表管理--保存附件文件列表
export const annexFileSave = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/batchUpdateFile`, params);
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog title="查看文件列表" width="70%" v-model="visible1" show-close>
<div>
<div class="table-content">
<div style="width: 100%; height: 500px">
<el-button type="primary" @click="addAnnexData" style="margin-left: 20px">新增</el-button>
<ProTable
@ -31,7 +31,7 @@
</span>
</template>
</el-dialog>
<el-dialog v-model="addDialogVisible" title="添加附件" width="30%" show-close>
<el-dialog v-model="addDialogVisible" title="添加附件名称" width="30%" show-close>
<el-form ref="formRef" :model="addFormData" label-width="100px" :rules="rules" size="default">
<!-- <el-form-item label="项目名称:">
<el-input v-model="editProjectName" disabled />
@ -62,29 +62,30 @@
</el-upload>
<el-table
:data="current"
height="180"
height="200"
class="el-table"
:header-cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center', height: '60px' }"
>
<el-table-column prop="fileName" label="文件名称" />
<el-table-column label="操作" width="200">
<template #default="{ row }">
<template #default="{ row, $index }">
<el-button type="primary" link size="small" @click="onDowmload(row)">下载</el-button>
<el-button type="primary" link size="small" @click="onDowmload(row)">删除</el-button>
<el-button type="primary" link size="small" @click="deleteFile($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> 关闭 </el-button>
<el-button type="primary" @click="saveAnnexFile"> 保存 </el-button>
<el-button type="primary" @click="dialogVisible = false"> 取消 </el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="tsx" name="readonlyDialog">
import { onMounted, watch, ref, reactive } from "vue";
import { getIdEngApproveList, fileShowList, fileShowAdd, fileShowDelete } from "@/api/modules/goverment";
import { fileShowList, fileShowAdd, fileShowDelete, annexFileList, annexFileSave } from "@/api/modules/goverment";
import { getDicList, exportApp } from "@/api/modules/jxjview";
import { ElMessage, ElMessageBox, FormInstance, FormRules } from "element-plus";
import { useDownload } from "@/hooks/useDownload";
@ -96,6 +97,7 @@ import { jxj_User } from "@/api/types";
import { useHandleData } from "@/hooks/useHandleData";
const emits = defineEmits(["update:fileListVisible"]);
const props = defineProps(["relativeId", "engineeringSn", "fileListVisible"]);
const selectedAnnex = ref(); //
const formRef = ref<FormInstance>();
const rules = reactive<FormRules>({
name: {
@ -121,17 +123,30 @@ const columns: ColumnProps[] = [
const store = GlobalStore();
const baseUrl = import.meta.env.VITE_API_URL;
const headers = ref({ Authorization: "Bearer " + store.token });
const current = ref([]);
const current = ref<any>([]);
const addDialogVisible = ref(false);
const dialogVisible = ref(false);
const annexFiles = ref([]);
const visible1 = ref(false);
const form = ref({});
const addressList = ref({});
//
const saveAnnexFile = async () => {
let requestData = {
id: selectedAnnex.value.id,
annexFileList: current.value,
annexName: selectedAnnex.value.annexName,
engineeringSn: selectedAnnex.value.engineeringSn
};
const res = await annexFileSave(requestData);
console.log(res);
if (res.code == 200) {
ElMessage.success("保存成功");
dialogVisible.value = false;
}
};
//
const handleDeleteItem = async (params: jxj_User.ResUserList) => {
await useHandleData(fileShowDelete, { id: params.id }, `删除【${params.annexName}`);
proTable.value.getTableList();
proTable.value?.getTableList();
};
//
const saveAnnexAdd = async (formEl: FormInstance | undefined) => {
@ -140,7 +155,7 @@ const saveAnnexAdd = async (formEl: FormInstance | undefined) => {
if (valid) {
await fileShowAdd({ engineeringSn: props.engineeringSn, annexName: addFormData.value.name });
ElMessage.success("保存成功");
proTable.value.getTableList();
proTable.value?.getTableList();
addDialogVisible.value = false;
} else {
console.log("error submit!", fields);
@ -172,9 +187,21 @@ const getTableList = (params: any) => {
return fileShowList(newParams);
};
const uploadSuccess = (response: any) => {
console.log(response);
ElMessage.success("上传成功");
// formData.value.videoUrl = response.result.url;
// fileList.value = [{ name: response.result.originalFilename, url: response.result.downloadPath }];
current.value.push({
createTime: response.result.createTime,
extendName: response.result.ext,
fileId: response.result.id,
fileName: response.result.originalFilename,
fileSize: response.result.size,
fileUrl: response.result.url
});
};
//
const deleteFile = (index: any) => {
console.log(index);
current.value.splice(index, 1);
};
const onDowmload = row => {
ElMessageBox.confirm("确认下载数据?", "温馨提示", { type: "warning" }).then(() =>
@ -182,29 +209,21 @@ const onDowmload = row => {
);
};
//
const onAppendix = row => {
const onAppendix = async (row: any) => {
console.log(row);
selectedAnnex.value = row;
const res = await annexFileList({ id: row.id });
console.log(res);
if (res && res.result) {
current.value = res.result.annexFileList;
} else {
current.value = [];
}
dialogVisible.value = true;
current.value = form.value.annexFiles.filter(item => item.label == row.dictLabel);
};
const getDataDetail = async () => {
// console.log(row);
const res = await getIdEngApproveList({ id: props.relativeId });
form.value = res.result;
addressList.value = {
province: res.result.province,
city: res.result.city,
district: res.result.district
};
form.value.position = `${"经度:" + res.result.longitude + ",纬度:" + res.result.latitude}`;
console.log(props.relativeId);
};
watch(
() => props.fileListVisible,
(n, o) => {
if (n) {
getDataDetail();
}
visible1.value = n;
}
);
@ -217,10 +236,17 @@ watch(
onMounted(async () => {
const res2 = await getDicList({ dictType: "attachment_name" });
annexFiles.value = res2.result.map(item => ({ ...item, files: [] }));
proTable.value.getTableList();
proTable.value?.getTableList();
});
</script>
<style scoped lang="scss">
.table-content {
:deep() {
.theme-transform {
display: none;
}
}
}
.el-table {
width: calc(100% - 20px);
margin-left: 20px;
@ -229,6 +255,11 @@ onMounted(async () => {
.el-table_main {
padding: 2% 4% 0 4%;
}
:deep() {
.cell {
line-height: 30px;
}
}
:deep(.el-tabs--card > .el-tabs__header) {
border-bottom: none;
}

View File

@ -140,12 +140,12 @@ const columns: ColumnProps[] = [
const relativeId = ref("");
const detailsDialog = ref(false);
const approvalTitle = ref("");
// ProTable 便
const proTable = ref();
const childrenDataUpdate = () => {
console.log(666);
proTable.value.getTableList();
};
// ProTable 便
const proTable = ref();
//
const onFileList = (row: any) => {
engineeringSn.value = row.engineeringSn;