| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- 模æ¿ç»å®è¡¨ååºï¼å¡«æ¥é¡¹ + å®¡æ¹æµç¨ + éä»¶ï¼é¡»æå¨å¤å± el-form ä¸ï¼ --> |
| | | <template> |
| | | <template v-if="activeTemplate"> |
| | | <el-form-item |
| | | v-if="showTemplateName && !hideTemplateName && !flowAttachmentsOnly && !flowOnly" |
| | | label="å®¡æ¹æ¨¡æ¿" |
| | | > |
| | | <span class="template-name">{{ activeTemplate.label }}</span> |
| | | <el-button v-if="allowChangeTemplate" type="primary" link class="ml12" @click="emit('change-template')"> |
| | | æ´æ¢æ¨¡æ¿ |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | <FormPayloadFields |
| | | v-if="!hideFormFields && !flowAttachmentsOnly && !flowOnly" |
| | | :fields="fields" |
| | | :form-payload="formPayload" |
| | | /> |
| | | |
| | | <el-form-item label="å®¡æ¹æµç¨" required> |
| | | <TemplateFlowEditor |
| | | v-model="flowNodesModel" |
| | | :user-options="userOptions" |
| | | :readonly="!flowEditable" |
| | | /> |
| | | <p class="section-tip"> |
| | | {{ |
| | | flowEditable |
| | | ? "æµç¨ä¸å®¡æ¹äººç±æ¨¡æ¿é¢ç½®ï¼å¯æéå¾®è°èç¹å®¡æ¹äººã" |
| | | : "æµç¨ä¸å®¡æ¹äººç±æé模æ¿åºå®ï¼ä¸å¯ä¿®æ¹ã" |
| | | }} |
| | | </p> |
| | | </el-form-item> |
| | | |
| | | <el-form-item v-if="!flowOnly && templateAttachments.length" label="模æ¿åè"> |
| | | <el-tag |
| | | v-for="(f, i) in templateAttachments" |
| | | :key="`tpl-${i}`" |
| | | class="attachment-tag" |
| | | type="info" |
| | | effect="plain" |
| | | > |
| | | {{ attachmentDisplayName(f) }} |
| | | </el-tag> |
| | | <p class="section-tip">以ä¸ä¸ºæ¨¡æ¿é带æä»¶ï¼ä»
ä¾åèï¼æäº¤é件请å¨ä¸æ¹ä¸ä¼ ã</p> |
| | | </el-form-item> |
| | | |
| | | <el-form-item v-if="!flowOnly" label="éä»¶"> |
| | | <FileUpload |
| | | v-model:file-list="attachmentsModel" |
| | | :limit="uploadLimit" |
| | | button-text="ç¹å»éæ©æä»¶" |
| | | /> |
| | | <p class="section-tip">éå¡«ï¼å¯ä¸ä¼ ä¸ç³è¯·ç¸å
³çè¯´æææã</p> |
| | | </el-form-item> |
| | | </template> |
| | | <el-empty v-else description="请å
éæ©å®¡æ¹æ¨¡æ¿" :image-size="64" /> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed } from "vue"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | import TemplateFlowEditor from "../../approve-template/components/TemplateFlowEditor.vue"; |
| | | import FormPayloadFields from "../../approve-list/components/FormPayloadFields.vue"; |
| | | import { attachmentDisplayName } from "../approvalTemplateBindingUtils.js"; |
| | | |
| | | const props = defineProps({ |
| | | activeTemplate: { type: Object, default: null }, |
| | | fields: { type: Array, default: () => [] }, |
| | | formPayload: { type: Object, required: true }, |
| | | flowNodes: { type: Array, default: () => [] }, |
| | | /** ç¨æ·èªè¡ä¸ä¼ çéä»¶ */ |
| | | attachments: { type: Array, default: () => [] }, |
| | | /** 模æ¿é¢ç½®éä»¶ï¼åªè¯»å±ç¤ºï¼ */ |
| | | templateAttachments: { type: Array, default: () => [] }, |
| | | userOptions: { type: Array, default: () => [] }, |
| | | showTemplateName: { type: Boolean, default: true }, |
| | | allowChangeTemplate: { type: Boolean, default: true }, |
| | | /** 为 true æ¶ä¸å±ç¤ºæ¨¡æ¿èªå®ä¹å¡«æ¥é¡¹ï¼ä»
ä¿çå®¡æ¹æµç¨ä¸éä»¶ï¼ */ |
| | | hideFormFields: { type: Boolean, default: false }, |
| | | /** 为 true æ¶ä¸å±ç¤ºå®¡æ¹æ¨¡æ¿åç§°è¡ï¼ç±ç¶çº§ç½®é¡¶å±ç¤ºï¼ */ |
| | | hideTemplateName: { type: Boolean, default: false }, |
| | | /** 为 true æ¶ä»
å±ç¤ºå®¡æ¹æµç¨ä¸éä»¶ï¼å¡«æ¥é¡¹ç±ç¶çº§åç¬æ¸²æï¼ */ |
| | | flowAttachmentsOnly: { type: Boolean, default: false }, |
| | | /** 为 true æ¶ä»
å±ç¤ºå®¡æ¹æµç¨ï¼ä¸å±ç¤ºæ¨¡æ¿å¡«æ¥é¡¹ãéä»¶çï¼ */ |
| | | flowOnly: { type: Boolean, default: false }, |
| | | uploadLimit: { type: Number, default: 10 }, |
| | | /** 为 true æ¶å¯ç¼è¾æ¨¡æ¿é¢ç½®ç审æ¹äººï¼ä»
å®¡æ¹æ¨¡æ¿ç®¡ç页使ç¨ï¼ */ |
| | | flowEditable: { type: Boolean, default: false }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:flowNodes", "update:attachments", "change-template"]); |
| | | |
| | | const flowNodesModel = computed({ |
| | | get: () => props.flowNodes, |
| | | set: (v) => emit("update:flowNodes", v), |
| | | }); |
| | | |
| | | const attachmentsModel = computed({ |
| | | get: () => props.attachments, |
| | | set: (v) => emit("update:attachments", v), |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .template-name { |
| | | font-weight: 600; |
| | | color: var(--el-text-color-primary); |
| | | } |
| | | .ml12 { |
| | | margin-left: 12px; |
| | | } |
| | | .section-tip { |
| | | font-size: 12px; |
| | | color: var(--el-text-color-secondary); |
| | | margin: 8px 0 0; |
| | | line-height: 1.5; |
| | | } |
| | | .attachment-tag { |
| | | margin: 0 8px 8px 0; |
| | | } |
| | | </style> |