Commit 1969fda2 authored by xinzhedeai's avatar xinzhedeai

电子文档权限添加

parent 7d71ecfe
......@@ -36,7 +36,9 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="folderModal = false">取消</el-button>
<el-button type="primary" @click="confirmFolder" :loading="modalBtnLoad">确定</el-button>
<el-button type="primary" @click="confirmFolder" :loading="modalBtnLoad"
>确定</el-button
>
</div>
</el-dialog>
<!-- 上传文件窗口 -->
......@@ -83,7 +85,12 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="fileUploadModal = false">取消</el-button>
<el-button type="primary" @click="confirmUploadFile">确定</el-button>
<el-button
type="primary"
@click="confirmUploadFile"
:loading="modalBtnLoad"
>确定</el-button
>
</div>
</el-dialog>
<el-row :gutter="15">
......@@ -91,6 +98,7 @@
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button
v-show="selectedFolderInfo.deleteWhether"
size="mini"
style="float: right; margin-left: 6px"
type="danger"
......@@ -99,6 +107,7 @@
删除</el-button
>
<el-button
v-show="selectedFolderInfo.editWhether"
size="mini"
style="float: right"
type="primary"
......@@ -121,9 +130,9 @@
:props="defaultProps"
check-strictly
accordion
show-checkbox
show-checkbox1
node-key="id"
@check="menuChange"
check="menuCheck"
@node-click="menuClick"
/>
</el-card>
......@@ -134,30 +143,32 @@
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button
v-show="selectedFolderInfo.uploadWhether"
type="primary"
size="mini"
@click="fileUploadModal = true"
>上传文件</el-button
>
<el-input
v-model="query.type"
v-model="query.originallyName"
size="small"
clearable
placeholder="查询文件分类"
placeholder="查询文件名称"
style="width: 200px"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<date-range-picker v-model="query.time" class="date-item" />
<date-range-picker v-model="query.time" type="datetimerange" class="date-item" />
<el-input
v-model="query.name"
v-model="query.classification"
size="small"
clearable
placeholder="查询文件名称"
placeholder="查询文件分类"
style="width: 200px"
class="filter-item"
/>
<el-button type="primary" size="mini" @click="search">查询</el-button>
<el-button type="primary" size="mini" @click="search"
>查询</el-button
>
</div>
<el-table ref="table" style="width: 100%" :data="fileDataList">
<el-table-column type="" width="55" />
......@@ -167,16 +178,18 @@
prop="classification"
width="100"
/>
<el-table-column width="200px" prop="time" label="录入时间" />
<el-table-column width="200px" prop="createTime" label="录入时间" />
<el-table-column label="操作" width="230px" align="center">
<template slot-scope="scope">
<el-button
type="success"
v-show="scope.row.downloadWhether"
type="primary"
size="mini"
@click="downFileById(scope.row)"
>下载</el-button
>
<el-button
v-show="scope.row.deleteWhether"
type="danger"
size="mini"
@click="delFileById(scope.row)"
......@@ -205,7 +218,7 @@
import edocApi from "@/api/kd/edoc";
import DateRangePicker from "@/components/DateRangePicker";
import { getToken } from "@/utils/auth";
import axios from 'axios'
import axios from "axios";
export default {
name: "Folder",
......@@ -215,10 +228,10 @@ export default {
data() {
return {
modalBtnLoad: false,
query:{
originallyName: '',
type:'',
time: ''
query: {
originallyName: "",
classification: "",
time: "",
},
folderModal: false,
folderForm: {
......@@ -228,9 +241,9 @@ export default {
fileType: "",
fileUploadModal: false,
uploadedFiles: [],
currentFolderId: "",
currentCheckedFolderId: "",
currentCheckedFolderInfo: {},
selectedFolderId: "",
selectedFolderId: "",
selectedFolderInfo: {},
fileDataList: [],
totalElement: 0,
page: 0,
......@@ -253,10 +266,18 @@ export default {
mounted() {
this.getDataList(); // 获取所有文件夹
},
created() {
},
created() {},
methods: {
// searchParamReset() {
// this.searchParam = {
// originallyName: "",
// classification: "",
// time: "",
// }
// this.page = 0
// this.size = 10
// this.getfileByFolderId()
// },
// 当前页的条数变化
handleSizeChange(val) {
this.size = val;
......@@ -275,48 +296,50 @@ export default {
confirmFolder() {
this.$refs["folderForm"].validate((valid) => {
if (valid) {
if(this.modalBtnLoad){
return
if (this.modalBtnLoad) {
return;
}
this.modalBtnLoad = true
if(this.folderForm.id){ // 修改
this.modalBtnLoad = true;
if (this.folderForm.id) {
// 修改
edocApi
.updateFolder({
...this.folderForm,
})
.then((res) => {
this.folderModal = false
this.$message.success("操作成功");
this.getDataList();
});
}else{// 新增
.updateFolder({
...this.folderForm,
})
.then((res) => {
this.folderModal = false;
this.$message.success("操作成功");
this.getDataList();
});
} else {
// 新增
edocApi
.addFolder({
...this.folderForm,
pid: this.currentCheckedFolderId,
})
.then((res) => {
this.folderModal = false
this.$message.success("操作成功");
this.getDataList();
});
.addFolder({
...this.folderForm,
pid: this.selectedFolderId,
})
.then((res) => {
this.folderModal = false;
this.$message.success("操作成功");
this.getDataList();
});
}
this.modalBtnLoad = false
this.modalBtnLoad = false;
}
});
},
addFolder() {
// if (!this.currentCheckedFolderId) {
// this.$message.warning("请勾选文件夹");
// if (!this.selectedFolderId) {
// this.$message.warning("请选择文件夹");
// return;
// }
this.folderModal = true;
this.folderForm = { name: "", order: "" };
},
delFolder() {
if (!this.currentCheckedFolderId) {
this.$message.warning("勾选要操作的文件夹");
if (!this.selectedFolderId) {
this.$message.warning("选择要操作的文件夹");
return;
}
this.$confirm("确定要删除吗?", "提示", {
......@@ -325,7 +348,7 @@ export default {
type: "warning",
}).then(
() => {
edocApi.delFolder([this.currentCheckedFolderId]).then((res) => {
edocApi.delFolder([this.selectedFolderId]).then((res) => {
this.$message.success("操作成功");
this.getDataList();
});
......@@ -339,29 +362,34 @@ export default {
);
},
downFileById(row) {
if(this.isExportLoading){
return
if (this.isExportLoading) {
return;
}
this.isExportLoading = true;
// 导出信息
axios.defaults.headers.common["Authorization"] = getToken();
const apiUrl = (process.env.VUE_APP_LOCAL_API + "/api/document/download").replaceAll("'", "")
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
console.log("响应头",response);
return response;
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
const apiUrl = (
process.env.VUE_APP_LOCAL_API + "/api/document/download"
).replaceAll("'", "");
axios.interceptors.response.use(
function (response) {
// 对响应数据做点什么
console.log("响应头", response);
return response;
},
function (error) {
// 对响应错误做点什么
return Promise.reject(error);
}
);
axios({
url: apiUrl,
responseType: "blob",
method: "get",
params: { id: row.id},
params: { id: row.id },
}).then((res) => {
console.log("export",res.headers["content-disposition"]);
console.log("export", res.headers["content-disposition"]);
let data = res.data;
let url = URL.createObjectURL(data);
let dis = res.headers["content-disposition"];
......@@ -389,7 +417,7 @@ export default {
() => {
edocApi.delFileById([row.id]).then((res) => {
this.$message.success("操作成功");
this.getfileByFolderId(this.currentFolderId);
this.getfileByFolderId(this.selectedFolderId);
});
},
() => {
......@@ -401,26 +429,26 @@ export default {
);
},
updateFolder() {
if (!this.currentCheckedFolderId) {
this.$message.warning("勾选文件夹");
if (!this.selectedFolderId) {
this.$message.warning("选择文件夹");
return;
}
this.folderModal = true;
this.folderForm.name = this.currentCheckedFolderInfo.name
this.folderForm.order = this.currentCheckedFolderInfo.order
this.folderForm.id = this.currentCheckedFolderInfo.id
this.folderForm.name = this.selectedFolderInfo.name;
this.folderForm.order = this.selectedFolderInfo.order;
this.folderForm.id = this.selectedFolderInfo.id;
},
search(){
this.getfileByFolderId()
search() {
this.getfileByFolderId();
},
getfileByFolderId() {
edocApi
.getfileByFolderId({
catalogueId: this.currentFolderId,
catalogueId: this.selectedFolderId,
page: this.page,
size: this.size,
...this.query,
time: this.query.time ? this.query.time.join(',') : ''
time: this.query.time ? this.query.time.join(",") : "",
})
.then((res) => {
this.fileDataList = res.body.results;
......@@ -428,7 +456,7 @@ export default {
});
},
confirmUploadFile() {
if (!this.currentFolderId) {
if (!this.selectedFolderId) {
this.$message.warning("请选择文件夹");
return;
}
......@@ -436,10 +464,14 @@ export default {
this.$message.warning("请上传文件");
return;
}
if (this.modalBtnLoad) {
return;
}
this.modalBtnLoad = true;
const formData = new FormData();
// console.log(this.formInfo.hdstatus1, "haStatus");
formData.append("fileList", this.uploadedFiles[0]);
formData.append("catalogueId", this.currentFolderId);
formData.append("catalogueId", this.selectedFolderId);
formData.append("classification", this.fileType);
edocApi.addFileByFolderId(formData).then((res) => {
......@@ -447,6 +479,7 @@ export default {
this.getfileByFolderId();
this.fileUploadModal = false;
});
this.modalBtnLoad = false;
},
addhdPicChange(event) {
// event.target 是触发事件的 input 元素
......@@ -464,17 +497,28 @@ export default {
menuClick(data, node, target) {
console.log("menuClick", data, node, target);
// 传递文件夹ID,获取对应文件夹下的文件数据
this.currentFolderId = data.id;
this.selectedFolderId = data.id;
// 下方著用于添加目录操作
this.selectedFolderInfo = data;
// this.selectedFolderId = data.id;
this.getfileByFolderId();
},
menuChange(data, node, target) {
console.log("menuChange", data, node, target);
this.currentCheckedFolderInfo = data
const menu = data;
this.currentCheckedFolderId = node.checkedKeys.length
? node.checkedKeys[0]
: "";
},
// menuCheck(data, node, target) {
// console.log("menuCheck处理前", data, node, target);
// if(node.checkedKeys.length>1){
// const tempCheckey = node.checkedKeys[node.checkedKeys.length-1]
// this.$refs.menu.setCheckedKeys([tempCheckey]);
// // node.checkedKeys.splice(0, 1)
// console.log("menuCheck处理后", data, node, target);
// }
// this.selectedFolderInfo = node.checkedKeys.length ? data : {} // 勾选上则赋值当先选中节点。否则位空对象
// const menu = data;
// this.selectedFolderId = node.checkedKeys.length
// ? node.checkedKeys[0]
// : "";
// },
},
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment