Commit 1969fda2 authored by xinzhedeai's avatar xinzhedeai

电子文档权限添加

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