Ver código fonte

fix: 修改bug

shiyanyu 2 semanas atrás
pai
commit
e9135a0373

+ 11 - 5
src/views/EntDeclaration/auditTaskManagement/taskFillIn.vue

@@ -172,7 +172,7 @@
           :rules="materialRulesComputed"
           label-width="100px"
         >
-          <el-form-item v-if="isClcs" label="资料类别" prop="informationType">
+          <el-form-item label="资料类别" prop="informationType">
             <el-select
               v-model="materialForm.informationType"
               placeholder="请选择资料类别"
@@ -197,7 +197,7 @@
               :disabled="isViewMode"
             ></el-input>
           </el-form-item>
-          <el-form-item
+          <!-- <el-form-item
             v-if="isClcs"
             label="资料要求:"
             prop="informationRequire"
@@ -224,7 +224,7 @@
                 :value="item.key"
               ></el-option>
             </el-select>
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item label="上传附件:" prop="fileList">
             <el-upload
               class="upload-demo"
@@ -714,7 +714,7 @@
         },
         materialRules: {
           informationType: [
-            { required: true, message: '请选择资料类别', trigger: 'change' },
+            { required: true, message: '请选择资料类别', trigger: 'blur' },
           ],
           informationName: [
             { required: true, message: '请输入资料名称', trigger: 'blur' },
@@ -725,6 +725,9 @@
           informationRequire: [
             { required: true, message: '请输入资料要求', trigger: 'blur' },
           ],
+          fileList: [
+            { required: true, message: '请上传附件', trigger: 'blur' },
+          ],
         },
         materialCategoryOptions: [
           { label: '综合性资料', value: 'comprehensive' },
@@ -803,8 +806,11 @@
             fileList: [fileRequiredRule],
           }
         }
-        // 其它节点:仅资料名称必填 + 上传附件必填
+        // 其它节点:资料类别、资料名称、上传附件必填
         return {
+          informationType: [
+            { required: true, message: '请选择资料类别', trigger: 'blur' },
+          ],
           informationName: [
             { required: true, message: '请输入资料名称', trigger: 'blur' },
           ],

+ 79 - 118
src/views/costAudit/auditInfo/archivesManage/ArchiveInduction.vue

@@ -566,98 +566,69 @@
       </div>
 
       <!-- 文件列表 -->
-      <draggable
-        v-model="fileListData"
-        :options="{ animation: 200, handle: '.drag-handle' }"
-        tag="div"
-        class="file-list-draggable"
-        @change="handleSortFiles"
+      <el-table
+        v-loading="fileListLoading"
+        :data="fileListData"
+        border
+        style="width: 100%"
       >
-        <div
-          v-for="(row, index) in fileListData"
-          :key="row.id"
-          class="file-list-item"
-          style="
-            padding: 15px;
-            border: 1px solid #dcdfe6;
-            margin-bottom: 10px;
-            border-radius: 4px;
-            background-color: #fff;
-            cursor: move;
-          "
+        <el-table-column type="index" label="序号" width="80" align="center" />
+        <el-table-column
+          prop="documentName"
+          label="文书名称"
+          min-width="200"
+          align="left"
+        />
+        <el-table-column
+          prop="documentNumber"
+          label="文号"
+          width="180"
+          align="center"
         >
-          <el-row :gutter="20">
-            <el-col :span="2">
-              <div style="text-align: center">
-                <span
-                  class="drag-handle"
-                  style="cursor: move; color: #909399; font-size: 18px"
-                >
-                  ☰
-                </span>
-                <div style="font-size: 12px; margin-top: 5px">
-                  {{ index + 1 }}
-                </div>
-              </div>
-            </el-col>
-            <el-col :span="6">
-              <div style="font-size: 14px; font-weight: 500">
-                {{ row.documentName }}
-              </div>
-              <div style="font-size: 12px; color: #909399; margin-top: 5px">
-                文书名称
-              </div>
-            </el-col>
-            <el-col :span="4">
-              <div style="font-size: 14px">{{ row.documentNumber }}</div>
-              <div style="font-size: 12px; color: #909399; margin-top: 5px">
-                文号
-              </div>
-            </el-col>
-            <el-col :span="5">
-              <div style="font-size: 14px">{{ row.auditedUnitName }}</div>
-              <div style="font-size: 12px; color: #909399; margin-top: 5px">
-                被监审单位
-              </div>
-            </el-col>
-            <el-col :span="3">
-              <div style="font-size: 14px">{{ row.fileSource }}</div>
-              <div style="font-size: 12px; color: #909399; margin-top: 5px">
-                文件来源
-              </div>
-            </el-col>
-            <el-col :span="2">
-              <div style="font-size: 14px">{{ row.pageCount || 0 }}</div>
-              <div style="font-size: 12px; color: #909399; margin-top: 5px">
-                页数
-              </div>
-            </el-col>
-            <el-col :span="2" style="text-align: right">
-              <el-button
-                type="text"
-                size="small"
-                style="margin-right: 5px"
-                @click="handleEditFile(row)"
-              >
-                修改
-              </el-button>
-              <el-button
-                type="text"
-                size="small"
-                @click="handleDeleteDetailFile(row)"
-              >
-                删除
-              </el-button>
-            </el-col>
-          </el-row>
-        </div>
-        <div
-          v-if="fileListData.length === 0"
-          style="text-align: center; padding: 40px 0; color: #909399"
+          <template slot-scope="{ row }">
+            {{ row.documentNumber || row.documentNo || '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="auditedUnitName"
+          label="监审单位"
+          min-width="180"
+          align="left"
+        />
+        <el-table-column
+          prop="fileSource"
+          label="文件来源"
+          width="160"
+          align="center"
+        />
+        <el-table-column
+          prop="pageCount"
+          label="页数"
+          width="100"
+          align="center"
         >
-          暂无数据
-        </div>
-      </draggable>
+          <template slot-scope="{ row }">
+            {{ row.pageCount || 0 }}
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="220" align="center" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button type="text" size="small" @click="handlePreviewFile(row)">
+              预览
+            </el-button>
+            <el-button type="text" size="small" @click="handleEditFile(row)">
+              修改
+            </el-button>
+            <el-button
+              type="text"
+              size="small"
+              @click="handleDeleteDetailFile(row)"
+            >
+              删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
 
       <div slot="footer" style="text-align: right; margin-top: 20px">
         <el-button @click="fileListDialogVisible = false">关闭</el-button>
@@ -762,7 +733,7 @@
 <script>
   import CostAuditDialog from '@/components/costAudit/CostAuditDialog.vue'
   import UploadComponent from '@/components/costAudit/UploadComponent.vue'
-  import draggable from 'vuedraggable'
+  import { Base64 } from 'js-base64'
   import {
     addDataInductionList,
     saveDataInductionWithDetails,
@@ -780,7 +751,6 @@
     components: {
       CostAuditDialog,
       UploadComponent,
-      draggable,
     },
     filters: {
       formatDate(value) {
@@ -1137,6 +1107,22 @@
           : []
         this.newFileDialogVisible = true
       },
+      handlePreviewFile(row) {
+        const rawUrl = row.attachmentUrl || row.url || row.fileUrl
+        if (!rawUrl) {
+          this.$message.warning('暂无文件!')
+          return
+        }
+        // 拼接完整地址
+        const absoluteUrl = rawUrl.startsWith('http')
+          ? rawUrl
+          : (window.context?.form || '') + rawUrl
+        // kkFileView 预览地址
+        const baseHost =
+          typeof host !== 'undefined' && host ? host : window.location.origin
+        const encodedUrl = encodeURIComponent(Base64.encode(absoluteUrl))
+        window.open(`${baseHost}:8012/onlinePreview?url=${encodedUrl}`)
+      },
       async handleDeleteDetailFile(row) {
         this.$confirm('确定要删除此文件吗?', '提示', {
           confirmButtonText: '确定',
@@ -1154,8 +1140,8 @@
                 )
                 if (index > -1) {
                   this.fileListData.splice(index, 1)
-                  // 删除后重新排序
-                  await this.handleSortFiles()
+                  // 删除后刷新列表
+                  this.loadFileList(this.currentEditingMaterial.id)
                 }
               } else {
                 this.$message.error(response.message || '删除失败')
@@ -1170,31 +1156,6 @@
       handleUploadNewFileSuccess(response, file) {
         // 此方法已经被 handleNewFileSaveFiles 指代
       },
-      async handleSortFiles() {
-        try {
-          if (!this.fileListData || this.fileListData.length === 0) {
-            return
-          }
-          // 一次性保存所有文件的orderNum
-          const savePromises = this.fileListData.map((row, index) => {
-            const params = {
-              id: row.id,
-              orderNum: index + 1,
-              masterId: this.currentEditingMaterial.id,
-              taskId: this.taskId,
-            }
-            return saveDetailInfo(params)
-          })
-          await Promise.all(savePromises)
-          // 排序成功,不显示提示信息
-          // 不需要重新加载,应为fileListData已经是排序后的结果
-        } catch (error) {
-          console.error('排序失败:', error)
-          this.$message.error('排序失败,请重试')
-          // 失败时重新加载文件列表
-          this.loadFileList(this.currentEditingMaterial.id)
-        }
-      },
       openAddFileDialog() {
         this.addFileForm = {
           documentName: '',

+ 11 - 6
src/views/costAudit/auditInfo/archivesManage/ArchiveProofread.vue

@@ -328,6 +328,7 @@
   } from '@/api/audit/dataProofread'
   import { getDetailListByMasterList } from '@/api/audit/dataInduction'
   import CostAuditDialog from '@/components/costAudit/CostAuditDialog.vue'
+  import { Base64 } from 'js-base64'
 
   export default {
     name: 'ArchiveProofread',
@@ -466,14 +467,18 @@
         this.loadFileList(masterId)
       },
       handlePreviewFile(row) {
-        // 预览文件(documentType = 1 或 3)
-        if (!row.attachmentUrl) {
-          this.$message.warning('文件地址为空')
+        const rawUrl = row.attachmentUrl || row.url || row.fileUrl
+        if (!rawUrl) {
+          this.$message.warning('暂无文件!')
           return
         }
-
-        // 在新窗口打开文件预览
-        window.open(row.attachmentUrl, '_blank')
+        const absoluteUrl = rawUrl.startsWith('http')
+          ? rawUrl
+          : (window.context?.form || '') + rawUrl
+        const baseHost =
+          typeof host !== 'undefined' && host ? host : window.location.origin
+        const encodedUrl = encodeURIComponent(Base64.encode(absoluteUrl))
+        window.open(`${baseHost}:8012/onlinePreview?url=${encodedUrl}`)
       },
       handleViewCatalog(row) {
         // 查看卷内目录(documentType = 2)或卷宗封底说明(documentType = 3)