buhuazhen
7 小时以前 19775998b5ea8e4e3da74bb2a3f8981d360427ed
fix: 审批管理附件问题修复
已修改2个文件
88 ■■■■ 文件已修改
src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue
@@ -380,23 +380,18 @@
      <template v-if="detailAttachments.length">
        <el-tag
          v-for="(f, i) in detailAttachments"
          :key="i"
          class="detail-attachment-tag"
          type="info"
          effect="plain"
        >
          {{ attachmentDisplayName(f) }}
        </el-tag>
        <div class="detail-attachment-list">
          <div
            v-for="(f, i) in detailAttachments"
            :key="i"
            class="detail-attachment-item"
            @click="openAttachmentFile(f)"
          >
            <el-icon class="attachment-icon"><Document /></el-icon>
            <span class="attachment-name">{{ attachmentDisplayName(f) }}</span>
            <el-icon class="attachment-download"><Download /></el-icon>
          </div>
        </div>
      </template>
@@ -422,7 +417,7 @@
<script setup>
import { ArrowRight, Plus, RefreshRight } from "@element-plus/icons-vue";
import { ArrowRight, Document, Download, Plus, RefreshRight } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
@@ -525,6 +520,14 @@
}
function openAttachmentFile(file) {
  const url = file?.url || file?.previewURL || file?.downloadURL || file?.previewUrl || "";
  if (url) {
    window.open(url, "_blank");
  } else {
    ElMessage.warning("无法打开该附件");
  }
}
function unwrapArray(payload) {
@@ -795,10 +798,40 @@
}
.detail-attachment-tag {
.detail-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
  margin: 0 8px 8px 0;
.detail-attachment-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--el-fill-color-light);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.detail-attachment-item:hover {
  background: var(--el-fill-color);
}
.attachment-icon {
  font-size: 16px;
  color: var(--el-text-color-regular);
}
.attachment-name {
  font-size: 14px;
  color: var(--el-text-color-primary);
}
.attachment-download {
  font-size: 14px;
  color: var(--el-text-color-secondary);
}
.text-muted {
src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js
@@ -214,10 +214,21 @@
    });
  }
  function openFormDialog(mode, row) {
  async function openFormDialog(mode, row) {
    formDialog.mode = mode;
    formDialog.title = mode === "add" ? "新建审批模板" : "编辑审批模板";
    resetForm(mode === "edit" ? row : null);
    if (mode === "edit" && row?.id) {
      // 编辑时先查询详情获取完整数据(包含附件)
      try {
        const res = await getApprovalTemplateDetail(row.id);
        const detailData = mapTemplateFromApi(unwrapTemplateDetail(res));
        resetForm(detailData);
      } catch {
        resetForm(row);
      }
    } else {
      resetForm(mode === "edit" ? row : null);
    }
    formDialog.visible = true;
  }