zhangwencui
10 天以前 91dec349aa88c58c587199d9601529d60824e1d0
src/pages/oa/ApproveManage/approve-template/index.vue
@@ -48,8 +48,8 @@
          <up-divider />
          <view class="item-details">
            <view class="detail-row">
              <text class="detail-label">模板类型</text>
              <text class="detail-value">{{ templateTypeText(item.templateType) }}</text>
              <text class="detail-label">审批类型</text>
              <text class="detail-value">{{ businessTypeText(item.businessType) }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">审批节点</text>
@@ -80,7 +80,8 @@
                       @click.stop="goEdit(item)">
              编辑
            </up-button>
            <up-button class="action-btn"
            <up-button v-if="!isSystemTemplate(item)"
                       class="action-btn"
                       size="small"
                       type="error"
                       plain
@@ -115,8 +116,15 @@
    deleteApprovalTemplate,
    listApprovalTemplatePage,
  } from "@/api/oa/approvalTemplate.js";
  import {
    buildTypeLabelMap,
    fetchApprovalTemplateTypes,
    getTemplateTypeLabel,
    isSystemApprovalTemplate,
  } from "../../_utils/approvalTemplateType.js";
  const EDIT_STORAGE_KEY = "oa_approve_template_edit_row";
  const typeLabelMap = ref({});
  const queryParams = reactive({
    templateName: "",
@@ -155,12 +163,17 @@
    return "info";
  };
  const templateTypeText = type => {
    const val = Number(type);
    if (val === 0) return "系统内置";
    if (val === 1) return "自定义";
    return "-";
  };
  const businessTypeText = type =>
    getTemplateTypeLabel(type, typeLabelMap.value);
  const isSystemTemplate = isSystemApprovalTemplate;
  const loadTemplateTypes = () =>
    fetchApprovalTemplateTypes()
      .then(opts => {
        typeLabelMap.value = buildTypeLabelMap(opts);
      })
      .catch(() => {});
  const nodeCount = item => {
    const count = item?.nodes?.length;
@@ -241,6 +254,10 @@
  const handleDelete = item => {
    if (!item?.id) return;
    if (isSystemTemplate(item)) {
      uni.showToast({ title: "系统内置模板不可删除", icon: "none" });
      return;
    }
    const name = item.templateName || "该模板";
    uni.showModal({
      title: "删除确认",
@@ -266,6 +283,7 @@
  };
  onShow(() => {
    loadTemplateTypes();
    handleSearch();
  });
</script>