...
|
...
|
@@ -5,7 +5,25 @@ export default { |
|
|
name: 'DocumentIndex',
|
|
|
template: '',
|
|
|
components: {},
|
|
|
props: {},
|
|
|
props: {
|
|
|
// 展示文档类型,默认展示类型
|
|
|
types: {
|
|
|
type: Array,
|
|
|
default: ['fxbg', 'gf', 'gzgl', 'jkjc', 'lxwh', 'pzgl', '', 'rcxj']
|
|
|
},
|
|
|
// 是否是预览模式
|
|
|
// 预览模式不展示授权按钮
|
|
|
isView: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
// 文件类型id(展示该类型下的文件信息)
|
|
|
// 是否是预览模式 == true,viewDocId,必须传入
|
|
|
viewTypeId: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
props: {
|
...
|
...
|
@@ -23,10 +41,9 @@ export default { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
setup() {
|
|
|
setup(props, {attrs, slots, emit}) {
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
let height = Vue.ref(window.innerHeight - 20);
|
|
|
let defaultKeys = Vue.ref('');
|
|
|
let iconclass = {
|
|
|
'folder': 'icon-wenjianjia',
|
|
|
'docx': 'icon-word-full',
|
...
|
...
|
@@ -133,13 +150,14 @@ export default { |
|
|
// 加载列表
|
|
|
proxy.$http.get("/inspection-report/doc/type/tree", {}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
|
|
|
treeData.value = res.data;
|
|
|
currentNodeData.value = res.data[0];
|
|
|
let firstId = res.data[0].id;
|
|
|
defaultKeys.value = firstId;
|
|
|
|
|
|
let first = res.data[0];
|
|
|
currentNodeData.value = first;
|
|
|
|
|
|
// 加载所有
|
|
|
getPage('');
|
|
|
getPage('0');
|
|
|
}
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -149,10 +167,10 @@ export default { |
|
|
let params = {
|
|
|
id: id,
|
|
|
name: keyWord.value,
|
|
|
types:null
|
|
|
types: props.types.join(',')
|
|
|
}
|
|
|
// 加载列表
|
|
|
proxy.$http.get(`/inspection-report/file/file/documentPage`, params, function (res) {
|
|
|
proxy.$http.get(`/inspection-report/file/document/list`, params, function (res) {
|
|
|
if (res && res.data) {
|
|
|
dataList.value = res.data;
|
|
|
}
|
...
|
...
|
@@ -179,34 +197,52 @@ export default { |
|
|
}
|
|
|
|
|
|
// 刷新
|
|
|
let reload = () => {
|
|
|
let reload = (loadTree) => {
|
|
|
// 属性tree
|
|
|
setTimeout(function () {
|
|
|
let id = currentNodeData.value.id;
|
|
|
getPage(id);
|
|
|
|
|
|
if(loadTree && loadTree == true){
|
|
|
getTree();
|
|
|
}
|
|
|
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除文档
|
|
|
* 将文档放入回收站
|
|
|
* @param id 文档id
|
|
|
* @param type 文件夹或者文档
|
|
|
*/
|
|
|
let deleteDocument = (id, type) => {
|
|
|
let params = null;
|
|
|
|
|
|
let msg = "您确认删除该文件?";
|
|
|
if (type == 'folder') {
|
|
|
msg = "您确认删除该文件以及文件下的文件?";
|
|
|
params = {id: id, type: type}
|
|
|
} else {
|
|
|
// 删除文件
|
|
|
let arr = getCheckedFile();
|
|
|
let info = [];
|
|
|
arr.map(function (v) {
|
|
|
info.push({
|
|
|
id:v.id,
|
|
|
type:v.type
|
|
|
})
|
|
|
})
|
|
|
params = info;
|
|
|
}
|
|
|
proxy.$global.confirm(msg, function () {
|
|
|
debugger
|
|
|
// ok
|
|
|
proxy.$http.get(`/inspection-report/file/file/delete`, {id: id, type: type}, function (res) {
|
|
|
proxy.$http.post(`/inspection-report/file/change`,params , function (res) {
|
|
|
if (res && res.code == 0) {
|
|
|
proxy.$global.showMsg('删除成功!');
|
|
|
|
|
|
reload();
|
|
|
reload(false);
|
|
|
}
|
|
|
})
|
|
|
|
...
|
...
|
@@ -253,7 +289,7 @@ export default { |
|
|
})
|
|
|
|
|
|
// 属性tree
|
|
|
reload();
|
|
|
reload(true);
|
|
|
showFolder(false);
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
...
|
...
|
@@ -267,44 +303,31 @@ export default { |
|
|
*/
|
|
|
let searchFile = () => {
|
|
|
getPage('');
|
|
|
// let id = currentNodeData.value.id;
|
|
|
// if (id) {
|
|
|
// getPage(id);
|
|
|
// } else {
|
|
|
// // 浏览器地址传文档id参数
|
|
|
// let docId = proxy.$global.getQueryVariable('docId');
|
|
|
// if (docId) {
|
|
|
// getPage(docId);
|
|
|
// } else {
|
|
|
// proxy.$global.showMsg('请选择文档类型!', 'warning');
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 用户授权
|
|
|
let showUserDialogVisible = Vue.ref(false);
|
|
|
let userFileRight = Vue.ref({}); // {roleIds: ["1"], usernames: ["admin"]}
|
|
|
let getCheckedFile = () => {
|
|
|
let arr = dataList.value.filter(function (v){
|
|
|
if(v.checked != undefined && v.checked == true){
|
|
|
let arr = dataList.value.filter(function (v) {
|
|
|
if (v.checked != undefined && v.checked == true) {
|
|
|
return v;
|
|
|
}
|
|
|
})
|
|
|
|
|
|
if(arr.length == 0){
|
|
|
proxy.$global.showMsg('请选择需要授权的文档!', 'warning');
|
|
|
if (arr.length == 0) {
|
|
|
proxy.$global.showMsg('请选择需要操作的文档!', 'warning');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(arr.length == 1){
|
|
|
if (arr.length == 1) {
|
|
|
// 查询文件的权限
|
|
|
proxy.$http.get(`/inspection-report/doc/doc/auth/getGrant`, {docId:arr[0].id}, function (res) {
|
|
|
proxy.$http.get(`/inspection-report/doc/doc/auth/getGrant`, {docId: arr[0].id}, function (res) {
|
|
|
if (res && res.code == 0) {
|
|
|
let map = res.map;
|
|
|
if(map){
|
|
|
if (map) {
|
|
|
userFileRight.value = res.map;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -317,9 +340,9 @@ export default { |
|
|
}
|
|
|
// 用户授权弹框
|
|
|
let showUserDialog = (flg) => {
|
|
|
if(flg){
|
|
|
if (flg) {
|
|
|
let arr = getCheckedFile();
|
|
|
if(arr && arr.length > 0){
|
|
|
if (arr && arr.length > 0) {
|
|
|
showUserDialogVisible.value = flg;
|
|
|
}
|
|
|
} else {
|
...
|
...
|
@@ -338,16 +361,16 @@ export default { |
|
|
return v.code;
|
|
|
});
|
|
|
|
|
|
let docIds = getCheckedFile().map(function (v){
|
|
|
let docIds = getCheckedFile().map(function (v) {
|
|
|
return v.id;
|
|
|
});
|
|
|
|
|
|
|
|
|
// 保存用户权限
|
|
|
let params = {
|
|
|
docIds:docIds.join(','),
|
|
|
roleIds:roleCodes.join(','),
|
|
|
usernames:userIds.join(',')
|
|
|
docIds: docIds.join(','),
|
|
|
roleIds: roleCodes.join(','),
|
|
|
usernames: userIds.join(',')
|
|
|
}
|
|
|
proxy.$http.get(`/inspection-report/doc/doc/auth/grant`, params, function (res) {
|
|
|
if (res && res.code == 0) {
|
...
|
...
|
@@ -368,7 +391,34 @@ export default { |
|
|
let showUploadFile = (flg) => {
|
|
|
showUploadDialogVisible.value = flg;
|
|
|
}
|
|
|
let uploadCallBack = () =>{
|
|
|
let uploadCallBack = ({document,fileInfo}) => {
|
|
|
reload(false);
|
|
|
console.log(111111111111,document,fileInfo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 文件下载
|
|
|
*/
|
|
|
let downloadFile = () =>{
|
|
|
let arr = getCheckedFile();
|
|
|
|
|
|
let info = [];
|
|
|
arr.map(function (v) {
|
|
|
// info.push({
|
|
|
// id:v.id,
|
|
|
// type:v.type
|
|
|
// })
|
|
|
|
|
|
info.push(`${v.id}__${v.type}`);
|
|
|
})
|
|
|
|
|
|
let params = {
|
|
|
info : info.join(","),
|
|
|
fileName:''
|
|
|
}
|
|
|
|
|
|
proxy.$http.downloadFile('/inspection-report/file/download',params);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
@@ -377,16 +427,15 @@ export default { |
|
|
* 挂载完
|
|
|
*/
|
|
|
Vue.onMounted(() => {
|
|
|
// 参数是否传文档id
|
|
|
let docId = proxy.$global.getQueryVariable('docId');
|
|
|
if (!docId) {
|
|
|
// 预览模式 不展示左侧树
|
|
|
if (!props.isView) {
|
|
|
getTree();
|
|
|
} else {
|
|
|
layout.value = {
|
|
|
left: 0,
|
|
|
right: 24
|
|
|
}
|
|
|
getPage(docId);
|
|
|
getPage(props.viewTypeId);
|
|
|
}
|
|
|
})
|
|
|
|
...
|
...
|
@@ -400,7 +449,6 @@ export default { |
|
|
columns,
|
|
|
dataList,
|
|
|
total,
|
|
|
defaultKeys,
|
|
|
nodeClick,
|
|
|
keyWord,
|
|
|
searchFile,
|
...
|
...
|
@@ -408,6 +456,9 @@ export default { |
|
|
activeBtn,
|
|
|
activeModel,
|
|
|
deleteDocument,
|
|
|
uploadCallBack,
|
|
|
|
|
|
downloadFile,
|
|
|
|
|
|
currentNodeData,
|
|
|
docForm,
|
...
|
...
|
|