| | |
| | | <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> |
| | |
| | | @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 |
| | |
| | | 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: "", |
| | |
| | | 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; |
| | |
| | | |
| | | const handleDelete = item => { |
| | | if (!item?.id) return; |
| | | if (isSystemTemplate(item)) { |
| | | uni.showToast({ title: "系统内置模板不可删除", icon: "none" }); |
| | | return; |
| | | } |
| | | const name = item.templateName || "该模板"; |
| | | uni.showModal({ |
| | | title: "删除确认", |
| | |
| | | }; |
| | | |
| | | onShow(() => { |
| | | loadTemplateTypes(); |
| | | handleSearch(); |
| | | }); |
| | | </script> |