fix: BUG修改

This commit is contained in:
kun 2023-12-04 19:09:46 +08:00
parent 92c560ed8b
commit b09575a867
5 changed files with 136 additions and 26 deletions

View File

@ -421,3 +421,18 @@ export const bigEntItemAll = (params: any) => {
export const cameraAdjust = (params: any) => {
return http.post(BASEURL + `/xmgl/video/controlling`, params);
};
// 项目列表管理--附件列表查看
export const fileShowList = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/page`, params);
};
// 项目列表管理--附件添加
export const fileShowAdd = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/add`, params);
};
// 项目列表管理--附件删除
export const fileShowDelete = (params: any) => {
return http.post(BASEURL + `/gov/engineeringAnnex/delete`, params);
};

View File

@ -1,21 +1,27 @@
<template>
<el-dialog title="查看文件列表" width="70%" v-model="visible1" show-close>
<div>
<div style="width: 90%; margin: 0 auto">
<el-table
:data="annexFiles"
class="el-table"
:header-cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }"
<div style="width: 100%; height: 500px">
<el-button type="primary" @click="addAnnexData" style="margin-left: 20px">新增</el-button>
<ProTable
ref="proTable"
title="附件列表"
:columns="columns"
:requestApi="getTableList"
:dataCallback="dataCallback"
:tool-button="false"
:pagination="true"
background
:isShowSearch="true"
:onReset="true"
>
<el-table-column type="index" label="序号" width="200" />
<el-table-column prop="dictValue" label="附件名称" />
<el-table-column label="操作" width="200">
<template #default="{ row }">
<el-button type="primary" link size="small" @click="onAppendix(row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<template #operation="{ row }">
<el-button type="primary" link @click="onAppendix(row)"
><img src="@/assets/images/tableIcon/look.png" alt="" class="configureIcon" /><span>查看</span></el-button
>
<el-button type="primary" link :icon="Delete" @click="handleDeleteItem(row)">删除</el-button>
</template>
</ProTable>
</div>
</div>
@ -25,7 +31,22 @@
</span>
</template>
</el-dialog>
<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 />
</el-form-item> -->
<el-form-item label="名称:" prop="name">
<el-input v-model="addFormData.name" placeholder="请输入" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="saveAnnexAdd(formRef)"> 确定 </el-button>
<el-button type="primary" @click="addDialogVisible = false"> 取消 </el-button>
</span>
</template>
</el-dialog>
<el-dialog v-model="dialogVisible" title="查看附件" width="30%" show-close>
<el-upload
ref="upload"
@ -62,23 +83,94 @@
</el-dialog>
</template>
<script setup lang="tsx" name="readonlyDialog">
import { onMounted, watch, ref } from "vue";
import { getIdEngApproveList } from "@/api/modules/goverment";
import { onMounted, watch, ref, reactive } from "vue";
import { getIdEngApproveList, fileShowList, fileShowAdd, fileShowDelete } from "@/api/modules/goverment";
import { getDicList, exportApp } from "@/api/modules/jxjview";
import { ElMessage, ElMessageBox } from "element-plus";
import { ElMessage, ElMessageBox, FormInstance, FormRules } from "element-plus";
import { useDownload } from "@/hooks/useDownload";
import { GlobalStore } from "@/stores";
import ProTable from "@/components/ProTable/index.vue";
import { ColumnProps } from "@/components/ProTable/interface";
import { Delete } from "@element-plus/icons-vue";
import { jxj_User } from "@/api/types";
import { useHandleData } from "@/hooks/useHandleData";
const emits = defineEmits(["update:fileListVisible"]);
const props = defineProps(["relativeId", "fileListVisible"]);
const props = defineProps(["relativeId", "engineeringSn", "fileListVisible"]);
const formRef = ref<FormInstance>();
const rules = reactive<FormRules>({
name: {
required: true,
message: "请输入",
trigger: "blur"
}
});
const addFormData = ref({
name: ""
});
// ProTable 便
const proTable = ref();
//
const columns: ColumnProps[] = [
{ type: "index", label: "序号", width: 400 },
{
prop: "annexName",
label: "附件名称"
},
{ prop: "operation", label: "操作" }
];
const store = GlobalStore();
const baseUrl = import.meta.env.VITE_API_URL;
const headers = ref({ Authorization: "Bearer " + store.token });
const current = ref([]);
const addDialogVisible = ref(false);
const dialogVisible = ref(false);
const annexFiles = ref([]);
const visible1 = ref(false);
const form = ref({});
const addressList = ref({});
//
const handleDeleteItem = async (params: jxj_User.ResUserList) => {
await useHandleData(fileShowDelete, { id: params.id }, `删除【${params.annexName}`);
proTable.value.getTableList();
};
//
const saveAnnexAdd = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
await fileShowAdd({ engineeringSn: props.engineeringSn, annexName: addFormData.value.name });
ElMessage.success("保存成功");
proTable.value.getTableList();
addDialogVisible.value = false;
} else {
console.log("error submit!", fields);
ElMessage({
showClose: true,
message: "请完善表单信息!",
type: "error"
});
}
});
};
//
const addAnnexData = () => {
formRef.value?.clearValidate();
addDialogVisible.value = true;
};
const dataCallback = (data: any) => {
// console.log(data);
return {
list: data.records,
total: Number(data.total),
pageNo: Number(data.current),
pageSize: Number(data.size)
};
};
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
console.log(newParams);
return fileShowList(newParams);
};
const uploadSuccess = (response: any) => {
ElMessage.success("上传成功");
// formData.value.videoUrl = response.result.url;
@ -125,6 +217,7 @@ watch(
onMounted(async () => {
const res2 = await getDicList({ dictType: "attachment_name" });
annexFiles.value = res2.result.map(item => ({ ...item, files: [] }));
proTable.value.getTableList();
});
</script>
<style scoped lang="scss">
@ -172,10 +265,4 @@ onMounted(async () => {
:deep(.el-input--suffix) {
width: 100%;
}
.test :deep(.el-input__wrapper) {
box-shadow: 0 0 0 0;
}
.test :deep(.el-input__inner) {
text-align: center;
}
</style>

View File

@ -56,6 +56,7 @@
<fileListDialog
v-model:fileListVisible="fileListVisible"
:relativeId="relativeId"
:engineeringSn="engineeringSn"
@confirm="childrenDataUpdate"
></fileListDialog>
</div>
@ -147,6 +148,7 @@ const childrenDataUpdate = () => {
const proTable = ref();
//
const onFileList = (row: any) => {
engineeringSn.value = row.engineeringSn;
relativeId.value = row.id;
fileListVisible.value = true;
};

View File

@ -207,9 +207,14 @@ onMounted(async () => {
padding-bottom: 15px;
border: 1px solid white;
.title {
height: 70px;
// height: 70px;
font-family: "siyuan_Bold";
span {
display: inline-block;
width: 95%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28px;
color: white;
}

View File

@ -140,6 +140,7 @@ onMounted(async () => {
<style scoped lang="scss">
.projectInfoBox {
height: 236px;
overflow-y: scroll;
font-family: "Source Han Sans CN-Regular", "Source Han Sans CN";
font-size: 16px;
font-weight: 400;