Przeglądaj źródła

影像资料修改

duy 1 rok temu
rodzic
commit
2a35d8b80d

+ 1 - 1
src/views/other-file/image-data.vue

@@ -142,7 +142,7 @@ const uploadClick = (item) => {
             dataType: item['storageDirectoryFormat'], //存储目录格式 1按部位存储,2按日期存储
             fileType: item['fileType'], //文件类型,1视频文件,2图片文件
             classifyId: item.id, //classifyId, 分类ID,
-            id: item.id,
+      
         },
     })
 }

+ 18 - 6
src/views/other-file/image-form.vue

@@ -13,7 +13,7 @@
             <div class="hc-tree-box">
                 <el-scrollbar>
                     <WbsTree
-                        :auto-expand-keys="TreeAutoExpandKeys" :contract-id="contractId" :project-id="projectId" :class-id="dataId"
+                        :auto-expand-keys="TreeAutoExpandKeys" :contract-id="contractId" :project-id="projectId" :class-id="classifyId"
                         @nodeTap="nodeWbsElTreeClick"
                     />
                 </el-scrollbar>
@@ -149,7 +149,7 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from 'vue'
+import { onActivated, onMounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
 import WbsTree from './components/WbsTree.vue'
@@ -172,7 +172,7 @@ const userInfo = ref(useAppState.getUserInfo)
 //路由参数
 const routerQuery = useRoutes?.query
 //存储目录格式 1按部位存储,2按日期存储
-const dataId = routerQuery?.classifyId || ''
+const dataId = ref(routerQuery?.id || '')
 const wbsNodeIds = routerQuery?.wbsId || ''
 const classifyId = routerQuery?.classifyId || ''
 const dataType = parseInt(routerQuery?.dataType + '') || 1
@@ -204,11 +204,14 @@ watch(contractId, (val) => {
 const TreeAutoExpandKeys = ref([])
 
 //渲染完成
-onMounted(() => {
+onActivated(() => {
+    dataId.value = useRoutes?.query?.id || ''
+    console.log( dataId.value, 'dataId.value')
     if (dataType === 1) {
         TreeAutoExpandKeys.value = getStoreValue('TreeExpandKeys')
     }
     formDataFormat({})
+   
     queryById()
     formValue.value.shootingUser = userInfo.value['real_name']
     if (wbsNodeIds) {
@@ -220,9 +223,9 @@ onMounted(() => {
 //详情
 const queryByLoading = ref(false)
 const queryById = async () => {
-    if (dataId) {
+    if (dataId.value) {
         queryByLoading.value = true
-        const { error, code, data } = await imageApi.queryById({ id: dataId })
+        const { error, code, data } = await imageApi.queryById({ id: dataId.value })
         //判断状态
         queryByLoading.value = false
         if (!error && code === 200) {
@@ -250,9 +253,18 @@ const getFileTitleNamedata = async (wbsNodeIds) => {
 const wbsId = ref('')
 const treeItemInfo = ref({})
 const nodeWbsElTreeClick = ({ data, keys }) => {
+    if (dataId.value.length > 1 && data['primaryKeyId'] !== wbsNodeIds) {
+        window.$message.warning('编辑文件时,不可切换节点')
+        return
+    }
     if (data.notExsitChild === true) {
         treeItemInfo.value = data
         wbsId.value = data['primaryKeyId']
+        if (dataId.value.length < 1) {
+            formValue.value = {}
+            uploadFileList.value = []
+            previewFileList.value = []
+        }
         formValue.value.wbsId = data['primaryKeyId']
         getFileTitleNamedata(data['primaryKeyId'])
         //缓存自动展开