|
|
@@ -186,7 +186,6 @@ const loading = ref(false)
|
|
|
const showSearch = ref(true)
|
|
|
const total = ref(0)
|
|
|
const ids = ref([])
|
|
|
-const single = ref(true)
|
|
|
const multiple = ref(true)
|
|
|
const currentPid = ref(undefined)
|
|
|
const folderTreeRef = ref(null)
|
|
|
@@ -227,9 +226,19 @@ function goBack() {
|
|
|
router.push(backMap[fdCate.value] || '/index')
|
|
|
}
|
|
|
|
|
|
+// 树数据缓存:同一模块(fdCate)的文件夹树只拉取一次,切换项目时复用,减少重复请求
|
|
|
+const treeCache = new Map()
|
|
|
+
|
|
|
function getFolderTree() {
|
|
|
- return folderList({ fdCate: fdCate.value, pageSize: 999 }).then(response => {
|
|
|
- const list = response.rows || response.data || []
|
|
|
+ const cached = treeCache.get(fdCate.value)
|
|
|
+ const load = cached
|
|
|
+ ? Promise.resolve(cached)
|
|
|
+ : folderList({ fdCate: fdCate.value, pageSize: 999 }).then(response => {
|
|
|
+ const list = response.rows || response.data || []
|
|
|
+ treeCache.set(fdCate.value, list)
|
|
|
+ return list
|
|
|
+ })
|
|
|
+ return load.then(list => {
|
|
|
// 根据当前选中文件夹更新标题,体现二级模块跳转
|
|
|
const current = list.find(f => f.id === currentPid.value)
|
|
|
if (current) {
|
|
|
@@ -316,11 +325,14 @@ function resetQuery() {
|
|
|
|
|
|
function handleSelectionChange(selection) {
|
|
|
ids.value = selection.map(item => item.id)
|
|
|
- single.value = selection.length !== 1
|
|
|
multiple.value = !selection.length
|
|
|
}
|
|
|
|
|
|
function handleUpload() {
|
|
|
+ if (!currentPid.value) {
|
|
|
+ proxy.$modal.msgWarning('请先选择文件夹')
|
|
|
+ return
|
|
|
+ }
|
|
|
uploadData.value = { pid: currentPid.value }
|
|
|
uploadOpen.value = true
|
|
|
nextTick(() => {
|
|
|
@@ -356,6 +368,10 @@ function uploadError() {
|
|
|
}
|
|
|
|
|
|
function handleMkdir() {
|
|
|
+ if (!currentPid.value) {
|
|
|
+ proxy.$modal.msgWarning('请先选择文件夹')
|
|
|
+ return
|
|
|
+ }
|
|
|
dialogForm.value = { name: '' }
|
|
|
dialogTitle.value = '新建文件夹'
|
|
|
dialogOpen.value = true
|
|
|
@@ -367,6 +383,8 @@ function submitDialog() {
|
|
|
mkdir({ name: dialogForm.value.name, pid: currentPid.value, fdCate: fdCate.value }).then(() => {
|
|
|
proxy.$modal.msgSuccess('新建成功')
|
|
|
dialogOpen.value = false
|
|
|
+ // 新建文件夹后清除树缓存,强制刷新
|
|
|
+ treeCache.delete(fdCate.value)
|
|
|
getFolderTree()
|
|
|
})
|
|
|
}
|
|
|
@@ -433,16 +451,33 @@ function handleBatchDelete() {
|
|
|
}
|
|
|
|
|
|
function handleEditPlanValue() {
|
|
|
+ if (!currentPid.value) {
|
|
|
+ proxy.$modal.msgWarning('请先选择工程')
|
|
|
+ return
|
|
|
+ }
|
|
|
planValueForm.id = currentPid.value
|
|
|
- planValueForm.planValue = currentPlanValue.value || 0
|
|
|
- planValueDialogVisible.value = true
|
|
|
+ // 点击时实时加载当前工程自身的进度,避免使用缓存导致显示旧值/其他工程的值
|
|
|
+ getPlanValue(currentPid.value).then(response => {
|
|
|
+ planValueForm.planValue = response.data || 0
|
|
|
+ currentPlanValue.value = planValueForm.planValue
|
|
|
+ planValueDialogVisible.value = true
|
|
|
+ }).catch(() => {
|
|
|
+ planValueForm.planValue = 0
|
|
|
+ planValueDialogVisible.value = true
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function submitPlanValue() {
|
|
|
- updatePlanValue({ id: planValueForm.id, planValue: planValueForm.planValue }).then(() => {
|
|
|
- proxy.$modal.msgSuccess('修改成功')
|
|
|
- currentPlanValue.value = planValueForm.planValue
|
|
|
- planValueDialogVisible.value = false
|
|
|
+ updatePlanValue({ id: planValueForm.id, planValue: planValueForm.planValue }).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ proxy.$modal.msgSuccess('修改成功')
|
|
|
+ currentPlanValue.value = planValueForm.planValue
|
|
|
+ planValueDialogVisible.value = false
|
|
|
+ } else {
|
|
|
+ proxy.$modal.msgError(res.msg || '修改失败')
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ proxy.$modal.msgError('修改失败')
|
|
|
})
|
|
|
}
|
|
|
|