检测文件更新

This commit is contained in:
许允枞 2025-02-06 18:02:36 +08:00
parent f86f41ccbe
commit 4637325572
3 changed files with 443 additions and 334 deletions

View File

@ -8,6 +8,30 @@ export function listInspectionFile(query) {
params: query
})
}
// 根据文件id获取有权限的用户id
export function getUserIdsByFileId(query) {
return request({
url: '/inspectionFile/inspectionFile/getUserIdsByFileId',
method: 'get',
params: query
})
}
// 给文件分配权限
export function assignAuthority(data) {
return request({
url: '/inspectionFile/inspectionFile/assignAuthority',
method: 'post',
data: data
})
}
export function listStaff(query) {
return request({
url: '/inspectionStaff/list',
method: 'get',
params: query
})
}
// 查询inspectionFile详细
export function getInspectionFile(id) {

View File

@ -80,16 +80,15 @@
<!-- v-hasPermi="['system:equInfo:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['system:equInfo:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>

View File

@ -1,14 +1,14 @@
<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!-- <el-form-item label="文件名称" prop="fileName">-->
<!-- <el-input-->
<!-- v-model="queryParams.fileName"-->
<!-- placeholder="请输入文件名称"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="提醒时间">-->
<!-- <el-date-picker-->
<!-- v-model="daterangeWarnTime"-->
@ -20,11 +20,11 @@
<!-- end-placeholder="结束日期"-->
<!-- ></el-date-picker>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@ -35,7 +35,8 @@
size="mini"
@click="handleAdd"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
@ -45,7 +46,8 @@
size="mini"
@click="backFile()"
>返回</el-button>
>返回
</el-button>
</el-col>
</el-row>
@ -97,26 +99,37 @@
<el-card class="box-card" v-for="(item, index) in inspectionFileList" :key="index">
<div v-if="item.type == 1" @click="fatherji(item.id)">
<img src="../../../assets/images/wenjianjia.png" style="width: 100px;height: 100px;">
<div>{{ item.fileName }}</div>
</div>
<div v-if="item.type == 2">
<img src="../../../assets/images/wenjian.png" style="width: 100px;height: 100px;">
<div>{{ item.fileName }}</div>
</div>
<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="three" @click="Deleteanniu(item.id)">删除</div>
</div>
</el-card>
</div>
<el-dialog title="分配权限" :visible.sync="isShow" width="600px" append-to-body>
<el-select v-model="selectStaffList" multiple filterable placeholder="请选择">
<el-option
v-for="item in staffList"
:key="item.id"
:label="item.nickname"
:value="item.id">
</el-option>
</el-select>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelStaff"> </el-button>
<el-button type="primary" @click="saveStaff"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改inspectionFile对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
@ -161,8 +174,15 @@
</template>
<script>
import { listInspectionFile, getInspectionFile, delInspectionFile, addInspectionFile, updateInspectionFile } from "../api/file";
import {
listInspectionFile,
getInspectionFile,
delInspectionFile,
addInspectionFile,
updateInspectionFile, listStaff, assignAuthority, getUserIdsByFileId
} from "../api/file";
import inspFileUpload from '@/components/FileUpload/index.vue'
export default {
name: "InspectionFile",
components: {inspFileUpload},
@ -178,7 +198,6 @@
multiple: true,
//
showSearch: true,
//
total: 0,
// inspectionFile
@ -187,6 +206,8 @@
title: "",
//
open: false,
//
isShow: false,
//
daterangeWarnTime: [],
//
@ -201,8 +222,11 @@
//
form: {},
//
rules: {
}
rules: {},
//
staffList: [],
selectStaffList: [],
fileId: ''
};
},
created() {
@ -220,17 +244,21 @@
}
},
clickStaff(fileId) {
this.fileId = fileId
this.isShow = true
this.getStaffList()
},
/** 查询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];
}
// 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.records;
this.queryParams.fatherId = response.data.records[0].fatherId;
@ -238,13 +266,46 @@
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;
this.loading = false;
}
});
},
fatherji(id) {
this.oldFatherId = this.fatherId
this.fatherId = id
this.queryParams.fatherId = id
this.inspectionFileList = []
this.queryParams.pageNum =1
this.getList()
const data = {
pageNum: 1,
pageSize: 10,
fatherId: id
}
this.getFolderList(data)
},
getStaffList() {
const data = {
pageNum: 1,
pageSize: 100000
}
listStaff(data).then(res => {
this.staffList = res.data.records
this.getUserIdsByFileId(this.fileId)
})
},
/**根据文件id获取有权限的用户id*/
getUserIdsByFileId(fileId){
const data = {
fileId: fileId
}
getUserIdsByFileId(data).then(res => {
this.selectStaffList = res.data
})
},
downloadFile(item) {
// <a>
@ -338,6 +399,24 @@
}
});
},
/** 分配文件权限给对应用户 */
saveStaff() {
console.log(this.selectStaffList, "66666666666666")
const data = {
userIds: this.selectStaffList,
fileId: this.fileId
}
assignAuthority(data).then(res => {
this.$modal.msgSuccess("分配权限成功")
})
this.selectStaffList = []
this.isShow = false
},
/** 取消按钮 */
cancelStaff() {
this.selectStaffList = []
this.isShow = false
},
//
Deleteanniu(id) {
this.$modal.confirm('是否确认删除inspectionFile编号为"' + id + '"的数据项?').then(function () {
@ -345,7 +424,8 @@
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 删除按钮操作 */
handleDelete(row) {
@ -355,7 +435,8 @@
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
@ -373,6 +454,7 @@
box-sizing: border-box;
width: 100%;
}
.box-card {
width: 160px;
@ -380,20 +462,24 @@
margin-bottom: 15px;
margin-right: 15px;
}
.bjandshanchu {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.one {
color: #67C23A;
cursor: pointer;
}
.two {
color: #409EFF;
cursor: pointer;
}
.three {
color: #F56C6C;
cursor: pointer;