检测文件更新

This commit is contained in:
许允枞 2025-02-08 16:12:27 +08:00
parent 4637325572
commit c304e53d29
2 changed files with 134 additions and 58 deletions
src/views/partner

View File

@ -8,6 +8,14 @@ export function listInspectionFile(query) {
params: query
})
}
// 查询inspectionFile列表(权限)
export function listByPermission(query) {
return request({
url: '/inspectionFile/inspectionFile/listByPermission',
method: 'get',
params: query
})
}
// 根据文件id获取有权限的用户id
export function getUserIdsByFileId(query) {
return request({
@ -40,6 +48,13 @@ export function getInspectionFile(id) {
method: 'get'
})
}
// 查询inspectionFile修改记录
export function getFileRecord(id) {
return request({
url: '/system/fileRecord/get/' + id,
method: 'get'
})
}
// 新增inspectionFile
export function addInspectionFile(data) {

View File

@ -51,49 +51,6 @@
</el-col>
</el-row>
<!-- <el-table v-loading="loading" :data="inspectionFileList" @selection-change="handleSelectionChange">-->
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="" align="center" prop="id" />-->
<!-- <el-table-column label="类型1文件夹2文件" align="center" prop="type" />-->
<!-- <el-table-column label="文件名称" align="center" prop="fileName" />-->
<!-- <el-table-column label="文件路径" align="center" prop="filePath" />-->
<!-- <el-table-column label="提醒时间" align="center" prop="warnTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.warnTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['inspectionFile:inspectionFile:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['inspectionFile:inspectionFile:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- <pagination-->
<!-- v-show="total>0"-->
<!-- :total="total"-->
<!-- :page.sync="queryParams.pageNum"-->
<!-- :limit.sync="queryParams.pageSize"-->
<!-- @pagination="getList"-->
<!-- />-->
<div class="content-box">
<el-card class="box-card" v-for="(item, index) in inspectionFileList" :key="index">
@ -108,7 +65,10 @@
<div class="bjandshanchu">
<div class="one" @click="handleE(item)">编辑</div>
<div class="two" v-if="item.type == '2'" @click="downloadFile(item)">下载</div>
<div class="two" @click="clickStaff(item.id)">分配权限</div>
<div class="two" @click="clickStaff(item.id)" v-hasPermi="['inspectionFile:inspectionFilePermis:edit']">
分配权限
</div>
<div class="two" @click="drawerShow(item.id)">历史版本</div>
<div class="three" @click="Deleteanniu(item.id)">删除</div>
</div>
</el-card>
@ -130,6 +90,28 @@
</div>
</el-dialog>
<el-drawer
title="修改记录"
:visible.sync="drawer"
>
<div style="height: 200px; padding: 10px;">
<el-steps direction="vertical" >
<el-step v-for="(item, index) in drawerData" :key="index" :title="'记录 ' + (index + 1)" status="process">
<template #description>
<div class="step-content">
<div class="step-file-name">文件名称{{ item.fileName }}</div>
<div class="step-time">修改时间{{ formatDate(item.createTime) }}</div>
<div class="step-time">提醒时间{{ formatDate(item.warnTime) }}</div>
<div class="step-download" @click="downloadFile(item)" v-if="item.type == '2'">📂 下载历史文件</div>
</div>
</template>
</el-step>
</el-steps>
</div>
</el-drawer>
<!-- 添加或修改inspectionFile对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
@ -179,7 +161,7 @@ import {
getInspectionFile,
delInspectionFile,
addInspectionFile,
updateInspectionFile, listStaff, assignAuthority, getUserIdsByFileId
updateInspectionFile, listStaff, assignAuthority, getUserIdsByFileId, listByPermission, getFileRecord
} from "../api/file";
import inspFileUpload from '@/components/FileUpload/index.vue'
@ -204,6 +186,7 @@ export default {
inspectionFileList: [],
//
title: "",
drawer: false,
//
open: false,
//
@ -226,20 +209,31 @@ export default {
//
staffList: [],
selectStaffList: [],
fileId: ''
fileId: '',
drawerData: {},
};
},
created() {
this.getList();
this.listByPermission()
},
methods: {
formatDate(timestamp) {
if (!timestamp) return "";
const date = new Date(timestamp);
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`;
},
backFile() {
if (this.fatherId) {
getInspectionFile(this.fatherId).then(response => {
this.queryParams.fatherId = response.data.fatherId
this.fatherId = response.data.fatherId
this.queryParams.pageNum = 1
this.getList()
const data = {
fatherId: this.fatherId,
fileName: this.fatherId === '' || this.fatherId == null || this.fatherId === undefined ? this.queryParams.fileName : ''
}
this.getFolderList(data)
});
}
@ -250,6 +244,28 @@ export default {
this.isShow = true
this.getStaffList()
},
drawerShow(id) {
getFileRecord(id).then(response => {
this.drawer = true
this.drawerData = response.data
})
},
/** 查询inspectionFile列表 */
// getList() {
// this.loading = true;
// this.queryParams.params = {};
// // if (null != this.daterangeWarnTime && '' != this.daterangeWarnTime) {
// // 123
// // this.queryParams.params["beginWarnTime"] = this.daterangeWarnTime[0];
// // this.queryParams.params["endWarnTime"] = this.daterangeWarnTime[1];
// // }
// listInspectionFile(this.queryParams).then(response => {
// this.inspectionFileList = response.data;
// this.queryParams.fatherId = response.data[0].fatherId;
// // this.total = response.total;
// this.loading = false;
// });
// },
/** 查询inspectionFile列表 */
getList() {
this.loading = true;
@ -259,20 +275,20 @@ export default {
// this.queryParams.params["beginWarnTime"] = this.daterangeWarnTime[0];
// this.queryParams.params["endWarnTime"] = this.daterangeWarnTime[1];
// }
listInspectionFile(this.queryParams).then(response => {
this.inspectionFileList = response.data.records;
this.queryParams.fatherId = response.data.records[0].fatherId;
this.total = response.total;
listByPermission(this.queryParams).then(response => {
this.inspectionFileList = response.data;
this.queryParams.fatherId = response.data[0].fatherId;
this.loading = false;
});
},
getFolderList(data) {
this.loading = true;
listInspectionFile(data).then(response => {
this.inspectionFileList = response.data.records;
if (response.data.records.length > 0) {
this.queryParams.fatherId = response.data.records[0].fatherId;
this.total = response.total;
// listInspectionFile(data).then(response => {
listByPermission(data).then(response => {
this.inspectionFileList = response.data;
if (response.data.length > 0) {
this.queryParams.fatherId = response.data[0].fatherId;
// this.total = response.total;
this.loading = false;
}
});
@ -299,18 +315,19 @@ export default {
})
},
/**根据文件id获取有权限的用户id*/
getUserIdsByFileId(fileId){
getUserIdsByFileId(fileId) {
const data = {
fileId: fileId
}
getUserIdsByFileId(data).then(res => {
this.selectStaffList = res.data
console.log('当前文件权限', this.selectStaffList)
})
},
downloadFile(item) {
// <a>
// const link = document.createElement('a');
let href = "https://www.nuoyunr.com/minio" + item.filePath; //
let href = "https://www.nuoyunr.com/minio/" + item.filePath; //
// var lastIndexOf = item.filePath.lastIndexOf(".");
// link.download = item.fileName+item.filePath.substr(lastIndexOf); //
window.open(href);
@ -381,6 +398,10 @@ export default {
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!this.form.filePath && this.form.type == "2") {
this.$modal.msgError("请上传文件");
return false;
}
if (valid) {
if (this.form.id != null) {
updateInspectionFile(this.form).then(response => {
@ -484,4 +505,44 @@ export default {
color: #F56C6C;
cursor: pointer;
}
/* 增加步骤间距 */
.custom-step {
margin-bottom: 35px;
}
/* 统一样式容器 */
.step-content {
display: flex;
flex-direction: column;
gap: 8px; /* 调整子元素间距 */
padding: 5px 0;
}
/* 时间样式 */
.step-time {
font-size: 14px;
//color: #666;
}
/* 文件名称高亮 */
.step-file-name {
font-weight: bold;
font-size: 15px;
}
/* 下载按钮样式 */
.step-download {
font-size: 14px;
color: #409EFF;
cursor: pointer;
text-decoration: underline;
}
.step-download:hover {
color: #307ec7;
}
/deep/.el-drawer__header {
font-size: 22px;
}
</style>