Pre Merge pull request !819 from Lesan/feature/bpm-打印

pull/819/MERGE
Lesan 2025-09-06 04:03:35 +00:00 committed by Gitee
commit 1a539b973f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 40 additions and 23 deletions

View File

@ -13,7 +13,7 @@ const list = ref([
{ id: 'startTime', name: '发起时间' }, { id: 'startTime', name: '发起时间' },
{ id: 'endTime', name: '结束时间' }, { id: 'endTime', name: '结束时间' },
{ id: 'processStatus', name: '流程状态' }, { id: 'processStatus', name: '流程状态' },
{ id: 'printUsername', name: '打印人' }, { id: 'printUser', name: '打印人' },
{ id: 'printTime', name: '打印时间' } { id: 'printTime', name: '打印时间' }
]) ])
const searchedList = computed(() => { const searchedList = computed(() => {

View File

@ -31,8 +31,9 @@ defineExpose({ open })
const parseFormFields = () => { const parseFormFields = () => {
// TODO @lesanform field form-create api = = // TODO @lesanform field form-create api = =
const formFieldsObj = decodeFields(printData.value.formFields) // TODO @form-create
const processVariables = printData.value.processVariables const formFieldsObj = decodeFields(printData.value.processInstance.processDefinition.formFields)
const processVariables = printData.value.processInstance.formVariables
let res: any = [] let res: any = []
for (const item of formFieldsObj) { for (const item of formFieldsObj) {
const id = item['field'] const id = item['field']
@ -40,6 +41,7 @@ const parseFormFields = () => {
let html = '暂不支持此类型的表单展示' let html = '暂不支持此类型的表单展示'
// TODO // TODO
// TODO @lesan UploadImgUploadFile else processVariables[item['field']] // TODO @lesan UploadImgUploadFile else processVariables[item['field']]
// TODO @selectlabel...
if (item['type'] === 'input') { if (item['type'] === 'input') {
html = processVariables[item['field']] html = processVariables[item['field']]
} else if (item['type'] === 'UploadImg') { } else if (item['type'] === 'UploadImg') {
@ -52,17 +54,17 @@ const parseFormFields = () => {
} }
const initPrintDataMap = () => { const initPrintDataMap = () => {
printDataMap.value['startUser'] = printData.value.startUser.nickname printDataMap.value['startUser'] = printData.value.processInstance.startUser.nickname
printDataMap.value['startUserDept'] = printData.value.startUser.deptName printDataMap.value['startUserDept'] = printData.value.processInstance.startUser.deptName
printDataMap.value['processName'] = printData.value.processName printDataMap.value['processName'] = printData.value.processInstance.name
printDataMap.value['processNum'] = printData.value.processInstanceId printDataMap.value['processNum'] = printData.value.processInstance.id
printDataMap.value['startTime'] = printData.value.startTime printDataMap.value['startTime'] = formatDate(printData.value.processInstance.startTime)
printDataMap.value['endTime'] = printData.value.endTime printDataMap.value['endTime'] = formatDate(printData.value.processInstance.endTime)
printDataMap.value['processStatus'] = getDictLabel( printDataMap.value['processStatus'] = getDictLabel(
DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS, DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS,
printData.value.processStatus printData.value.processInstance.status
) )
printDataMap.value['printUsername'] = userName.value printDataMap.value['printUser'] = userName.value
printDataMap.value['printTime'] = printTime.value printDataMap.value['printTime'] = printTime.value
} }
@ -96,12 +98,12 @@ const getPrintTemplateHTML = () => {
headTd.innerHTML = '流程节点' headTd.innerHTML = '流程节点'
headTr.appendChild(headTd) headTr.appendChild(headTd)
processRecordTable.appendChild(headTr) processRecordTable.appendChild(headTr)
printData.value.approveNodes.forEach((item) => { printData.value.tasks.forEach((item) => {
const tr = document.createElement('tr') const tr = document.createElement('tr')
const td1 = document.createElement('td') const td1 = document.createElement('td')
td1.innerHTML = item.nodeName td1.innerHTML = item.name
const td2 = document.createElement('td') const td2 = document.createElement('td')
td2.innerHTML = item.nodeDesc td2.innerHTML = item.description
tr.appendChild(td1) tr.appendChild(td1)
tr.appendChild(td2) tr.appendChild(td2)
processRecordTable.appendChild(tr) processRecordTable.appendChild(tr)
@ -128,26 +130,31 @@ const printObj = ref({
<div id="printDivTag"> <div id="printDivTag">
<div v-if="printData.printTemplateEnable" v-html="getPrintTemplateHTML()"></div> <div v-if="printData.printTemplateEnable" v-html="getPrintTemplateHTML()"></div>
<div v-else> <div v-else>
<h2 class="text-center">{{ printData.processName }}</h2> <h2 class="text-center">{{ printData.processInstance.name }}</h2>
<div class="text-right text-15px">{{ '打印人员: ' + userName }}</div> <div class="text-right text-15px">{{ '打印人员: ' + userName }}</div>
<div class="flex justify-between"> <div class="flex justify-between">
<div class="text-15px">{{ '流程编号: ' + printData.processInstanceId }}</div> <div class="text-15px">{{ '流程编号: ' + printData.processInstance.id }}</div>
<div class="text-15px">{{ '打印时间: ' + printTime }}</div> <div class="text-15px">{{ '打印时间: ' + printTime }}</div>
</div> </div>
<table class="mt-20px w-100%" border="1" style="border-collapse: collapse"> <table class="mt-20px w-100%" border="1" style="border-collapse: collapse">
<tbody> <tbody>
<tr> <tr>
<td class="p-5px w-25%">发起人</td> <td class="p-5px w-25%">发起人</td>
<td class="p-5px w-25%">{{ printData.startUser.nickname }}</td> <td class="p-5px w-25%">{{ printData.processInstance.startUser.nickname }}</td>
<td class="p-5px w-25%">发起时间</td> <td class="p-5px w-25%">发起时间</td>
<td class="p-5px w-25%">{{ printData.startTime }}</td> <td class="p-5px w-25%">{{ formatDate(printData.processInstance.startTime) }}</td>
</tr> </tr>
<tr> <tr>
<td class="p-5px w-25%">所属部门</td> <td class="p-5px w-25%">所属部门</td>
<td class="p-5px w-25%">{{ printData.startUser.deptName }}</td> <td class="p-5px w-25%">{{ printData.processInstance.startUser.deptName }}</td>
<td class="p-5px w-25%">流程状态</td> <td class="p-5px w-25%">流程状态</td>
<td class="p-5px w-25%"> <td class="p-5px w-25%">
{{ getDictLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS, printData.processStatus) }} {{
getDictLabel(
DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS,
printData.processInstance.status
)
}}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -155,6 +162,16 @@ const printObj = ref({
<h4>表单内容</h4> <h4>表单内容</h4>
</td> </td>
</tr> </tr>
<!-- <tr>-->
<!-- <td class="p-5px w-100% text-center" colspan="4">-->
<!-- <form-create-->
<!-- v-model="detailForm.value"-->
<!-- v-model:api="fApi"-->
<!-- :option="detailForm.option"-->
<!-- :rule="detailForm.rule"-->
<!-- />-->
<!-- </td>-->
<!-- </tr>-->
<tr v-for="item in formFields" :key="item.id"> <tr v-for="item in formFields" :key="item.id">
<td class="p-5px w-20%"> <td class="p-5px w-20%">
{{ item.name }} {{ item.name }}
@ -168,12 +185,12 @@ const printObj = ref({
<h4>流程节点</h4> <h4>流程节点</h4>
</td> </td>
</tr> </tr>
<tr v-for="item in printData.approveNodes" :key="item.nodeId"> <tr v-for="item in printData.tasks" :key="item.id">
<td class="p-5px w-20%"> <td class="p-5px w-20%">
{{ item.nodeName }} {{ item.name }}
</td> </td>
<td class="p-5px w-80%" colspan="3"> <td class="p-5px w-80%" colspan="3">
{{ item.nodeDesc }} {{ item.description }}
<div v-if="item.signUrl !== ''"> <div v-if="item.signUrl !== ''">
<img class="w-90px h-40px" :src="item.signUrl" alt="" /> <img class="w-90px h-40px" :src="item.signUrl" alt="" />
</div> </div>