检测文件更新

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,30 +1,30 @@
<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-item label="提醒时间">-->
<!-- <el-date-picker-->
<!-- v-model="daterangeWarnTime"-->
<!-- style="width: 240px"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- type="daterange"-->
<!-- range-separator="-"-->
<!-- start-placeholder="开始日期"-->
<!-- 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 :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"-->
<!-- style="width: 240px"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- type="daterange"-->
<!-- range-separator="-"-->
<!-- start-placeholder="开始日期"-->
<!-- 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-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,96 +46,108 @@
size="mini"
@click="backFile()"
>返回</el-button>
>返回
</el-button>
</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>-->
<!-- <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"-->
<!-- />-->
<!-- <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" >
<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="three" @click="Deleteanniu(item.id)">删除</div>
</div>
</el-card>
<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>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- <el-form-item label="店铺主键" prop="partnerId">-->
<!-- <el-input v-model="form.partnerId" placeholder="请输入店铺主键" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="父节点" prop="fatherId">-->
<!-- <el-input v-model="form.fatherId" placeholder="请输入父节点" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="店铺主键" prop="partnerId">-->
<!-- <el-input v-model="form.partnerId" placeholder="请输入店铺主键" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="父节点" prop="fatherId">-->
<!-- <el-input v-model="form.fatherId" placeholder="请输入父节点" />-->
<!-- </el-form-item>-->
<el-form-item label="文件名称" prop="fileName">
<el-input v-model="form.fileName" placeholder="请输入文件名称" />
<el-input v-model="form.fileName" placeholder="请输入文件名称"/>
</el-form-item>
<el-form-item label="类型" prop="type" v-if="this.title ==='新增'">
<el-radio-group v-model="form.type">
<el-radio :label="'1'">文件夹</el-radio>
<el-radio :label="'2'">文件</el-radio>
</el-radio-group>
<el-radio-group v-model="form.type">
<el-radio :label="'1'">文件夹</el-radio>
<el-radio :label="'2'">文件</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="文件路径" v-if="form.type==='2'" prop="filePath">
<insp-file-upload
@ -161,241 +174,314 @@
</template>
<script>
import { listInspectionFile, getInspectionFile, delInspectionFile, addInspectionFile, updateInspectionFile } from "../api/file";
import inspFileUpload from '@/components/FileUpload/index.vue'
export default {
name: "InspectionFile",
components:{inspFileUpload},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// inspectionFile
inspectionFileList: [],
//
title: "",
//
open: false,
//
daterangeWarnTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
type: null,
fatherId:null,
},
fatherId:'',
oldFatherId:'',
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
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()
});
}
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},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// inspectionFile
inspectionFileList: [],
//
title: "",
//
open: false,
//
isShow: false,
//
daterangeWarnTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
type: null,
fatherId: null,
},
/** 查询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.records;
fatherId: '',
oldFatherId: '',
//
form: {},
//
rules: {},
//
staffList: [],
selectStaffList: [],
fileId: ''
};
},
created() {
this.getList();
},
methods: {
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()
});
}
},
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];
// }
listInspectionFile(this.queryParams).then(response => {
this.inspectionFileList = response.data.records;
this.queryParams.fatherId = response.data.records[0].fatherId;
this.total = response.total;
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()
},
downloadFile(item) {
// <a>
// const link = document.createElement('a');
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);
// //
// link.click();
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
type: null,
fatherId: null,
fileName: null,
filePath: null,
warnTime: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeWarnTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
handleE(item) {
this.reset(item);
this.form = item;
this.open = true;
this.title = "修改";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInspectionFile(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改inspectionFile";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInspectionFile(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.fatherId = this.fatherId
addInspectionFile(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
//
Deleteanniu(id){
this.$modal.confirm('是否确认删除inspectionFile编号为"' + id + '"的数据项?').then(function() {
return delInspectionFile(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除inspectionFile编号为"' + ids + '"的数据项?').then(function() {
return delInspectionFile(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('inspectionFile/inspectionFile/export', {
...this.queryParams
}, `inspectionFile_${new Date().getTime()}.xlsx`)
}
});
},
fatherji(id) {
this.fatherId = id
this.queryParams.fatherId = id
this.inspectionFileList = []
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>
// const link = document.createElement('a');
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);
// //
// link.click();
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
type: null,
fatherId: null,
fileName: null,
filePath: null,
warnTime: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeWarnTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
handleE(item) {
this.reset(item);
this.form = item;
this.open = true;
this.title = "修改";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInspectionFile(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改inspectionFile";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInspectionFile(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.fatherId = this.fatherId
addInspectionFile(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 分配文件权限给对应用户 */
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 () {
return delInspectionFile(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除inspectionFile编号为"' + ids + '"的数据项?').then(function () {
return delInspectionFile(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('inspectionFile/inspectionFile/export', {
...this.queryParams
}, `inspectionFile_${new Date().getTime()}.xlsx`)
}
};
}
};
</script>
<style scoped>
.content-box{
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
width: 100%;
}
.box-card{
width: 160px;
.content-box {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
width: 100%;
}
text-align: center;
margin-bottom: 15px;
margin-right: 15px;
}
.bjandshanchu{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.one{
.box-card {
width: 160px;
text-align: center;
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;
}
.two {
color: #409EFF;
cursor: pointer;
}
.three {
color: #F56C6C;
cursor: pointer;
}
</style>