소스 검색

文件上传替换更改

duy 2 년 전
부모
커밋
d4fa5f8313
3개의 변경된 파일79개의 추가작업 그리고 53개의 파일을 삭제
  1. 1 1
      src/views/archives/tuning.vue
  2. 41 9
      src/views/file/collection.vue
  3. 37 43
      src/views/transfer/inspects.vue

+ 1 - 1
src/views/archives/tuning.vue

@@ -270,7 +270,7 @@
 import {ref, watch, onMounted} from "vue";
 import {useAppStore} from "~src/store";
 import HcTree from "~src/components/tree/hc-tree.vue"
-import {downloadBlob, getArrValue, deepClone} from "js-fast-way"
+import { getArrValue, deepClone} from "js-fast-way"
 import {delMessage, rowsToId, rowsToIdNumArr} from "~uti/tools";
 import tuningApi from "~api/archiveConfig/tuning.js";
 import archiveFileApi from "~api/archiveFile/archiveFileAuto.js";

+ 41 - 9
src/views/file/collection.vue

@@ -302,12 +302,13 @@
                 </template>
                 <template #action="{row,index}">
                     <el-button type="danger" plain size="small" :loading="row['delBtnLoading']" @click="delUploadData(row,index)">删除</el-button>
+                    <el-button type="danger" plain size="small" :loading="row['delBtnLoading']" @click="replaceUploadData(row,index)">替换</el-button>
                 </template>
             </HcTable>
             <template #footer>
                 <div class="lr-dialog-footer">
                     <div class="left flex items-center">
-                        <el-button type="primary" hc-btn @click="uploadFileClick">
+                        <el-button type="primary" hc-btn @click="uploadFileClick" v-if="tableUploadType==='add'">
                             <HcIcon name="add-circle"/>
                             <span>新增上传</span>
                         </el-button>
@@ -433,9 +434,21 @@ const uploadFileClick = () => {
 const HcUploadFileProgress = (res) => {
     uploadsLoading.value = res
 }
+
 // 文件上传成功的回调
 const HcUploadFileSuccess = (res) => {
     console.log('文件上传成功', res)
+    console.log(isReplace.value,'isReplace.valu');
+    if(isReplace.value){
+        console.log(1111);
+        res.fileNumber=replacerow.value?.fileNumber
+        res.fileTime=replacerow.value?.fileTime
+        res.isApproval=replacerow.value?.isApproval
+        res.isNeedCertification=replacerow.value?.isNeedCertification
+    }
+    
+    console.log(res,'res');
+  
     uploadsChange(res)
 }
 
@@ -1184,7 +1197,7 @@ const tableUploadColumn = ref([
     {key:'isNeedCertification', name: '是否需要认证'},
     {key:'dutyUser', name: '责任者'},
     {key:'isElement', name: '是否四要素'},
-    {key:'action', name: '操作', width: 100}
+    {key:'action', name: '操作'}
 ])
 const setTableUploadColumn = () => {
     if (isBuiltDrawing.value === 2) {
@@ -1200,7 +1213,7 @@ const setTableUploadColumn = () => {
             {key:'isNeedCertification', name: '是否需要认证'},
             {key:'dutyUser', name: '责任者'},
             {key:'isElement', name: '是否四要素'},
-            {key:'action', name: '操作', width: 100}
+            {key:'action', name: '操作'}
         ]
         sheetTypeStatus()
         sheetSourceStatus()
@@ -1213,7 +1226,7 @@ const setTableUploadColumn = () => {
             {key:'isNeedCertification', name: '是否需要认证'},
             {key:'dutyUser', name: '责任者'},
             {key:'isElement', name: '是否四要素'},
-            {key:'action', name: '操作', width: 100}
+            {key:'action', name: '操作',}
         ]
     }
 }
@@ -1221,6 +1234,7 @@ const tableUploadData = ref([])
 
 //上传的文件结果
 const uploadsChange = (item) => {
+    console.log(item,'item');
     if (getObjVal(item)) {
         let newArr = tableUploadData.value
         const sheet = sheetType.value, source = sheetSourceType.value
@@ -1230,22 +1244,26 @@ const uploadsChange = (item) => {
             projectId: projectId.value,
             contractId: contractId.value,
             nodeId: nodeIds.value,
-            fileNumber: '',
+            fileNumber:item?.fileNumber || '',
             fileName: fileName,
             ossFileName: item?.name || '',
-            fileTime: null,
+            // fileTime: null,
+            fileTime:  item?.fileTime || null,
             fileUrl: item?.link || '',
             sheetType: sheet.length > 0 ? sheet[0]['dictKey'] || '': '',
             sheetSource: source.length > 0 ? source[0]['dictKey'] || '': '',
             drawingNo: '',
             citeChangeNumber: '',
-            isApproval: 1,
-            isNeedCertification: 1,
+            isApproval:item?.isApproval?.length>0?item?.isApproval:1 || 1,
+            isNeedCertification: item?.isNeedCertification?.length>0?item.isNeedCertification:1 || 1,
             dutyUser: dutyUser.value,
             pdfFileUrl: item?.pdfUrl || '',
             filePage: item?.page || '',
             isElement: 0
         })
+        console.log(newArr,'newArr');
+        newArr[0].isApproval=item?.isApproval
+        newArr[0].isNeedCertification=item?.isNeedCertification
         tableUploadData.value = newArr
     } else {
         console.log(item)
@@ -1274,7 +1292,21 @@ const delUploadData = async (row,index) => {
         tableUploadData.value.splice(index,1);
     }
 }
-
+const isReplace=ref(false)
+const replacerow=ref({})
+const replaceIndex=ref()
+//替换replaceUploadData
+const replaceUploadData = async (row,index) => {
+    console.log(row,index);
+    replacerow.value=row
+    replaceIndex.value=index
+  
+    setdutyUser()
+    HcUploadFileRef?.value.btnUpload()
+    
+    isReplace.value=true
+    tableUploadData.value.splice(replaceIndex.value,1);
+}
 //批量上传保存
 const uploadSaveLoading = ref(false)
 const batchUploadSave = async () => {

+ 37 - 43
src/views/transfer/inspects.vue

@@ -151,10 +151,11 @@
 <script setup>
 import {ref, watch, onMounted, nextTick} from "vue";
 import {useAppStore} from "~src/store";
-//import HcTree from "./components/hc-tree.vue"
+import { getArrValue} from "js-fast-way"
 import HcTree from "~src/components/tree/hc-tree.vue"
 import MetaTable from "./components/meta-table.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
+import tuningApi from "~api/archiveConfig/tuning.js";
 
 //变量
 const useAppState = useAppStore()
@@ -175,7 +176,7 @@ watch(() => [
 
 //渲染完成
 onMounted(() => {
-
+    setTableColumns()
 })
 
 //树加载
@@ -199,6 +200,12 @@ const projectTreeClick = ({node, data, keys, key}) => {
     //缓存展开的节点
     setStoreValue('inspectExpandKeys', keys)
     treeAutoExpandKeys.value = keys || []
+
+    searchForm.value.total = 0
+    searchForm.value.current = 1
+    searchForm.value.size = 20
+    searchForm.value.nodeIds = data.id || '';
+    getTableData()
 }
 //树菜单被点击
 const ElTreeMenuClick = async ({key,node,data}) => {
@@ -214,51 +221,38 @@ const pageChange = ({current, size}) => {
 
 //表格数据
 const tableRef = ref(null)
-const tableColumn = ref([
-    {key:'key1', name: '档号', width: 100},
-    {key:'key2', name: '案卷题名'},
-    {key:'key3', name: '保管期限', width: 120},
-    {key:'key4', name: '总页数', width: 120},
-    {key:'key5', name: '立卷单位', width: 150},
-    {key:'key6', name: '备注', width: 150}
-])
-const tableData = ref([
-    {
-        id: 1,
-        key1:'BS28',
-        key2: '安康至来凤国家高速公路奉节至巫山(渝鄂界)段干岩洞隧道LK3+425~LK3+393初期支护钢筋网分项开工报告、检验申请批复单、质量检验报告单、记录表、试验检测记录及评定报告、中间交工证书',
-        key3: 30,
-        key4: 300,
-        key5: '贵州路桥集团',
-        key6: '这是备注信息',
-        status: 1
-    },
-    {
-        id: 2,
-        key1:'BS29',
-        key2: '安康至来凤国家高速公路奉节至巫山(渝鄂界)段干岩洞隧道LK3+425~LK3+393初期支护钢筋网分项开工报告、检验申请批复单、质量检验报告单、记录表、试验检测记录及评定报告、中间交工证书',
-        key3: '永久',
-        key4: 300,
-        key5: '贵州路桥集团',
-        key6: '这是备注信息',
-        status: 0
-    },
-    {
-        id: 3,
-        key1:'BS30',
-        key2: '安康至来凤国家高速公路奉节至巫山(渝鄂界)段干岩洞隧道LK3+425~LK3+393初期支护钢筋网分项开工报告、检验申请批复单、质量检验报告单、记录表、试验检测记录及评定报告、中间交工证书',
-        key3: 30,
-        key4: 300,
-        key5: '贵州路桥集团',
-        key6: '这是备注信息',
-        status: 0
-    },
-])
+const tableColumn = ref([])
+//设置表头
+const setTableColumns = () => {
+    tableColumn.value = [
+        {key: 'fileNumber', name: '档号'},
+        {key: 'name', name: '案卷题名', width: 500},
+        {key: 'storageTimeValue', name: '保管期限'},
+        {key: 'fileSize', name: '总页数'},
+        {key:'unit', name: '立卷单位', width: 150},
+        {key:'remark', name: '备注', width: 150}
+    ]
+}
+const tableData = ref([])
 
 //获取数据
 const tableLoading = ref(false)
 const getTableData = async () => {
-
+    tableLoading.value = true
+    const {error, code, data} = await tuningApi.pageByArchive({
+        ...searchForm.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+        isArchive: 1
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data?.records)
+        searchForm.value.total = data?.total || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
 }
 
 //行被点击