Explorar el Código

影像资料修改

duy hace 1 año
padre
commit
dca48c355f
Se han modificado 1 ficheros con 24 adiciones y 16 borrados
  1. 24 16
      src/views/other-file/image-form.vue

+ 24 - 16
src/views/other-file/image-form.vue

@@ -149,7 +149,7 @@
 </template>
 
 <script setup>
-import { onActivated, onMounted, ref, watch } from 'vue'
+import { nextTick, onActivated, onMounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
 import WbsTree from './components/WbsTree.vue'
@@ -174,9 +174,9 @@ const routerQuery = useRoutes?.query
 //存储目录格式 1按部位存储,2按日期存储
 const dataId = ref(routerQuery?.id || '')
 const wbsNodeIds = ref(routerQuery?.wbsId || '')
-const classifyId = routerQuery?.classifyId || ''
-const dataType = parseInt(routerQuery?.dataType + '') || 1
-const fileType = parseInt(routerQuery?.fileType + '') || 2
+const classifyId = ref(routerQuery?.classifyId || '')
+const dataType = ref(parseInt(routerQuery?.dataType + '') || 1)
+const fileType = ref(parseInt(routerQuery?.fileType + '') || 2)
 const toDayDate = dateFormat(new Date(), 'yyyy-MM-dd')
 
 const userRealName = ref('')
@@ -208,11 +208,14 @@ onActivated(() => {
     isshowTree.value = false
     dataId.value = useRoutes?.query?.id || ''
     wbsNodeIds.value = useRoutes?.query?.wbsId || ''
+    classifyId.value = useRoutes?.query?.classifyId || ''
+    dataType.value = parseInt(useRoutes?.query?.dataType + '') || 1
+    fileType.value = parseInt(routerQuery?.fileType + '') || 2
     setTimeout(() => {
         isshowTree.value = true
     }, 100)
 
-    if (dataType === 1) {
+    if (dataType.value === 1) {
         TreeAutoExpandKeys.value = getStoreValue('TreeExpandKeys')
     }
     formDataFormat({})
@@ -338,11 +341,12 @@ const formDataFormat = (info) => {
         uploadTime: toDayDate,
         shootingTimeStr: toDayDate,
         ...info,
-        type: fileType || '2',
+        type: fileType.value || '2',
         wbsId: info?.wbsId || wbsNodeIds.value,
-        classifyId: info?.classifyId || classifyId,
+        classifyId: info?.classifyId || classifyId.value,
         projectId: info?.projectId || projectId.value,
         contractId: info?.contractId || contractId.value,
+        shootingUser: userInfo.value['real_name'],
     }
     //原始文件地址
     let imageUrl = info['imageUrl'] || ''
@@ -394,11 +398,11 @@ const previewVideoModal = ref(false)
 const initialIndex = ref(-1)
 const previewVideoUrl = ref('')
 const uploadsPreview = ({ index, fileArr }) => {
-    if (fileType === 2) {
+    if (fileType.value === 2) {
         previewFileList.value = fileArr
         initialIndex.value = index
         previewModal.value = true
-    } else if (fileType === 1) {
+    } else if (fileType.value === 1) {
         previewVideoUrl.value = fileArr[index]
         previewVideoModal.value = true
     }
@@ -436,14 +440,17 @@ const saveClick = () => {
 
 //保存并添加记录
 const saveLogClick = () => {
+    formValue.value.shootingUser = userInfo.value['real_name']
     verifyFormData(true)
+
+  
 }
 
 //表单效验
 const shootingTimeStr = ref('')
 const verifyFormData = async (log) => {
     const formData = formValue.value
-    formData.classifyId = classifyId
+    formData.classifyId = classifyId.value
     formData.projectId = projectId
     formData.contractId = contractId
     const fileList = uploadFileList.value
@@ -459,7 +466,7 @@ const verifyFormData = async (log) => {
   
     shootingTimeStr.value = formData['shootingTimeStr'] || ''
     //验证数据
-    if (!formData?.wbsId && dataType === 1) {
+    if (!formData?.wbsId && dataType.value === 1) {
         window.$message?.warning('请先选择节点')
     } else {
         const res = await formValidate(formRef.value)
@@ -503,6 +510,7 @@ const updateImageclassifyFile = async (formData, log) => {
         if (log) {
             tableData.value.push(deepClone(formValue.value))
             formDataFormat({})
+
         } else {
             toBackClick()
         }
@@ -521,18 +529,18 @@ const dataNodeExpandKeys = () => {
 
 //返回上页
 const toBackClick = () => {
-    if (dataType === 1) {
+    if (dataType.value === 1) {
         //NodeExpandKeys()
-    } else if (dataType === 2) {
+    } else if (dataType.value === 2) {
         dataNodeExpandKeys()
     }
     //返回上级
     router.push({
         path: '/other-file/image-view',
         query: {
-            fileType: fileType,
-            type: dataType,
-            id: classifyId,
+            fileType: fileType.value,
+            type: dataType.value,
+            id: classifyId.value,
         },
     })