更新
This commit is contained in:
parent
4e159b12fd
commit
2f8288dceb
@ -16,6 +16,14 @@ export function listByPermission(query) {
|
|||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 查询inspectionFile文件夹树结构
|
||||||
|
export function queryTreeFolder(query) {
|
||||||
|
return request({
|
||||||
|
url: '/inspectionFile/inspectionFile/queryTreeFolder',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
// 根据文件id获取有权限的用户id
|
// 根据文件id获取有权限的用户id
|
||||||
export function getUserIdsByFileId(query) {
|
export function getUserIdsByFileId(query) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
分配权限
|
分配权限
|
||||||
</div>
|
</div>
|
||||||
<div class="two" @click="drawerShow(item.id)">历史版本</div>
|
<div class="two" @click="drawerShow(item.id)">历史版本</div>
|
||||||
<div class="three" @click="Deleteanniu(item.id)">删除</div>
|
<div class="three" @click="Deleteanniu(item.id)" v-if="!item.defaultKey">删除</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
@ -206,6 +206,23 @@
|
|||||||
:fileType="['doc', 'xls', 'ppt', 'txt', 'pdf','png','jpg','jpeg','gif','docx','xlsx','pptx','wps']"
|
:fileType="['doc', 'xls', 'ppt', 'txt', 'pdf','png','jpg','jpeg','gif','docx','xlsx','pptx','wps']"
|
||||||
v-model="form.filePath"/>
|
v-model="form.filePath"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-cascader
|
||||||
|
:options="folderList"
|
||||||
|
|
||||||
|
:props="{
|
||||||
|
checkStrictly: true,
|
||||||
|
emitPath:false
|
||||||
|
}"
|
||||||
|
@change="handleFolderChange"
|
||||||
|
v-model="form.fatherId"
|
||||||
|
placeholder="请选择文件夹"
|
||||||
|
clearable
|
||||||
|
show-all-levels="false"
|
||||||
|
filterable
|
||||||
|
></el-cascader>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="提醒时间" prop="warnTime">
|
<el-form-item label="提醒时间" prop="warnTime">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.warnTime"
|
v-model="form.warnTime"
|
||||||
@ -270,7 +287,7 @@ import {
|
|||||||
getUserIdsByFileId,
|
getUserIdsByFileId,
|
||||||
listByPermission,
|
listByPermission,
|
||||||
getFileRecord,
|
getFileRecord,
|
||||||
addBatchInspectionFile
|
addBatchInspectionFile, queryTreeFolder
|
||||||
} from "../api/file";
|
} from "../api/file";
|
||||||
import inspFileUpload from '@/components/FileUpload/index.vue'
|
import inspFileUpload from '@/components/FileUpload/index.vue'
|
||||||
import {getAccessToken} from "@/utils/auth";
|
import {getAccessToken} from "@/utils/auth";
|
||||||
@ -358,7 +375,8 @@ export default {
|
|||||||
fileId: '',
|
fileId: '',
|
||||||
drawerData: {},
|
drawerData: {},
|
||||||
fileUrl: '',
|
fileUrl: '',
|
||||||
isImage: false
|
isImage: false,
|
||||||
|
folderList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -373,9 +391,23 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.listByPermission()
|
// this.listByPermission()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
queryTreeFolder() {
|
||||||
|
queryTreeFolder().then(response => {
|
||||||
|
this.folderList = response.data
|
||||||
|
console.log('folderList', this.folderList)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleFolderChange(e) {
|
||||||
|
// if (e.length === 0) {
|
||||||
|
// this.form.fatherId = null
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// console.log(e)
|
||||||
|
// this.form.fatherId = e[e.length - 1]
|
||||||
|
},
|
||||||
formatDate(timestamp) {
|
formatDate(timestamp) {
|
||||||
if (!timestamp) return "";
|
if (!timestamp) return "";
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
@ -472,6 +504,7 @@ export default {
|
|||||||
this.queryParams.fatherId = this.$route.query.folderId
|
this.queryParams.fatherId = this.$route.query.folderId
|
||||||
this.fatherId = this.$route.query.folderId
|
this.fatherId = this.$route.query.folderId
|
||||||
}
|
}
|
||||||
|
this.queryTreeFolder()
|
||||||
listByPermission(this.queryParams).then(response => {
|
listByPermission(this.queryParams).then(response => {
|
||||||
this.inspectionFileList = response.data;
|
this.inspectionFileList = response.data;
|
||||||
this.queryParams.fatherId = response.data[0].fatherId;
|
this.queryParams.fatherId = response.data[0].fatherId;
|
||||||
@ -615,6 +648,32 @@ export default {
|
|||||||
this.form = item;
|
this.form = item;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改";
|
this.title = "修改";
|
||||||
|
console.log(item)
|
||||||
|
//判断文件夹树中是否有item的id或者item子类的id如果有禁用
|
||||||
|
this.folderList = this.disableIfExistsInTree(this.folderList, item.id)
|
||||||
|
},
|
||||||
|
disableIfExistsInTree(treeData, targetId) {
|
||||||
|
console.log(treeData, targetId, '执行');
|
||||||
|
|
||||||
|
function traverse(nodes, parentDisabled = false) {
|
||||||
|
return nodes.map(node => {
|
||||||
|
let newNode = { ...node };
|
||||||
|
|
||||||
|
// 递归处理子节点,同时传递父级的禁用状态
|
||||||
|
if (newNode.children && newNode.children.length > 0) {
|
||||||
|
newNode.children = traverse(newNode.children, newNode.value === targetId || parentDisabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只禁用目标节点及其子节点,不影响兄弟节点
|
||||||
|
if (newNode.value === targetId || parentDisabled) {
|
||||||
|
newNode.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newNode;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return traverse(treeData);
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
@ -638,6 +697,7 @@ export default {
|
|||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateInspectionFile(this.form).then(response => {
|
updateInspectionFile(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.form = {}
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
@ -645,6 +705,7 @@ export default {
|
|||||||
this.form.fatherId = this.fatherId
|
this.form.fatherId = this.fatherId
|
||||||
addInspectionFile(this.form).then(response => {
|
addInspectionFile(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.form = {}
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user