Showing
8 changed files
with
240 additions
and
5 deletions
| @@ -258,7 +258,7 @@ export default { | @@ -258,7 +258,7 @@ export default { | ||
| 258 | // 2.在映射的地方,如果审核和审批详情不一样 就映射成两一个组件 | 258 | // 2.在映射的地方,如果审核和审批详情不一样 就映射成两一个组件 |
| 259 | const _data = res && res.data ? res.data : {}; | 259 | const _data = res && res.data ? res.data : {}; |
| 260 | const _ext = JSON.parse(_data.ext || '{}'); | 260 | const _ext = JSON.parse(_data.ext || '{}'); |
| 261 | - // 审核节点编码(如 assay_report_yfcckzg 时需填写是否继续审批) | 261 | + // 审核节点编码(如 assay_report_gyglkzg2 时需填写是否继续审批) |
| 262 | this.nodeCode = _data.nodeCode || '' | 262 | this.nodeCode = _data.nodeCode || '' |
| 263 | this.auditCtx = { | 263 | this.auditCtx = { |
| 264 | taskId: _data.taskId || '', | 264 | taskId: _data.taskId || '', |
| @@ -114,6 +114,8 @@ export default { | @@ -114,6 +114,8 @@ export default { | ||
| 114 | data() { | 114 | data() { |
| 115 | return { | 115 | return { |
| 116 | id: '', | 116 | id: '', |
| 117 | + // 是否作废单(作废单仅可查看,对齐 PC 端 createActions) | ||
| 118 | + isDeleted: false, | ||
| 117 | form: {}, | 119 | form: {}, |
| 118 | applyList: [], | 120 | applyList: [], |
| 119 | detailList: [], | 121 | detailList: [], |
| @@ -144,6 +146,7 @@ export default { | @@ -144,6 +146,7 @@ export default { | ||
| 144 | return codes.join(',') | 146 | return codes.join(',') |
| 145 | }, | 147 | }, |
| 146 | displayButtons() { | 148 | displayButtons() { |
| 149 | + if (this.isDeleted) return [] | ||
| 147 | const status = this.form.approvalStatus || '' | 150 | const status = this.form.approvalStatus || '' |
| 148 | const isMine = this.form.createById === this.currentUserId | 151 | const isMine = this.form.createById === this.currentUserId |
| 149 | const isDraft = status === 'DRAFT' | 152 | const isDraft = status === 'DRAFT' |
| @@ -182,6 +185,7 @@ export default { | @@ -182,6 +185,7 @@ export default { | ||
| 182 | }, | 185 | }, |
| 183 | onLoad(query) { | 186 | onLoad(query) { |
| 184 | this.id = (query && query.id) || '' | 187 | this.id = (query && query.id) || '' |
| 188 | + this.isDeleted = (query && query.deleted) === '1' | ||
| 185 | this.loadDicData() | 189 | this.loadDicData() |
| 186 | this.loadDetail() | 190 | this.loadDetail() |
| 187 | this.getUserInfo() | 191 | this.getUserInfo() |
| @@ -386,7 +386,8 @@ export default { | @@ -386,7 +386,8 @@ export default { | ||
| 386 | uni.showToast({ title: '缺少ID', icon: 'none' }) | 386 | uni.showToast({ title: '缺少ID', icon: 'none' }) |
| 387 | return | 387 | return |
| 388 | } | 388 | } |
| 389 | - uni.navigateTo({ url: '/pages/material-settlement/detail?id=' + id }) | 389 | + // 作废单仅可查看(对齐 PC 端 createActions) |
| 390 | + uni.navigateTo({ url: '/pages/material-settlement/detail?id=' + id + '&deleted=' + (item.deleted === true ? '1' : '0') }) | ||
| 390 | } | 391 | } |
| 391 | } | 392 | } |
| 392 | } | 393 | } |
| @@ -41,6 +41,18 @@ | @@ -41,6 +41,18 @@ | ||
| 41 | </view> | 41 | </view> |
| 42 | </view> | 42 | </view> |
| 43 | </view> | 43 | </view> |
| 44 | + | ||
| 45 | + <!-- 修改意向(有值时展示,对齐 PC 端 detail-form) --> | ||
| 46 | + <template v-if="hasQualityProblemName"> | ||
| 47 | + <view class="title-header"> | ||
| 48 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 49 | + <span>修改意向</span> | ||
| 50 | + </view> | ||
| 51 | + <view class="section"> | ||
| 52 | + <view class="row"><text class="label">是否有质量问题</text><text class="value">{{ hasQualityProblemName }}</text></view> | ||
| 53 | + <view v-if="hasQualityProblemBool" class="row"><text class="label">处理意见</text><text class="value">{{ safeText(form.processOpinion) }}</text></view> | ||
| 54 | + </view> | ||
| 55 | + </template> | ||
| 44 | </view> | 56 | </view> |
| 45 | </scroll-view> | 57 | </scroll-view> |
| 46 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> | 58 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> |
| @@ -91,6 +103,18 @@ export default { | @@ -91,6 +103,18 @@ export default { | ||
| 91 | componentKeys() { | 103 | componentKeys() { |
| 92 | return getComponentKeys(this.form.workshopName) | 104 | return getComponentKeys(this.form.workshopName) |
| 93 | }, | 105 | }, |
| 106 | + // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示) | ||
| 107 | + hasQualityProblemName() { | ||
| 108 | + const v = this.form.hasQualityProblem | ||
| 109 | + if (v === true || v === 1 || v === '1') return '是' | ||
| 110 | + if (v === false || v === 0 || v === '0') return '否' | ||
| 111 | + return '' | ||
| 112 | + }, | ||
| 113 | + // 是否有质量问题-是 | ||
| 114 | + hasQualityProblemBool() { | ||
| 115 | + const v = this.form.hasQualityProblem | ||
| 116 | + return v === true || v === 1 || v === '1' | ||
| 117 | + }, | ||
| 94 | approvalStatusName() { | 118 | approvalStatusName() { |
| 95 | const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) | 119 | const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) |
| 96 | if (!v) return '-' | 120 | if (!v) return '-' |
| @@ -140,7 +164,7 @@ export default { | @@ -140,7 +164,7 @@ export default { | ||
| 140 | }, | 164 | }, |
| 141 | { | 165 | { |
| 142 | ...this.buttons[3], | 166 | ...this.buttons[3], |
| 143 | - visible: canQuality && this.$auth.hasPermi('warehouse-manage:material-test:submit') | 167 | + visible: canQuality && this.$auth.hasPermi('warehouse-manage:material-test:submitApprove') |
| 144 | }, | 168 | }, |
| 145 | { | 169 | { |
| 146 | ...this.buttons[4], | 170 | ...this.buttons[4], |
| @@ -354,6 +378,14 @@ export default { | @@ -354,6 +378,14 @@ export default { | ||
| 354 | background: #fff; | 378 | background: #fff; |
| 355 | margin-bottom: 20rpx; | 379 | margin-bottom: 20rpx; |
| 356 | } | 380 | } |
| 381 | +.title-header { | ||
| 382 | + display: flex; | ||
| 383 | + align-items: center; | ||
| 384 | + padding: 24rpx 32rpx 12rpx; | ||
| 385 | + background-color: #ffffff; | ||
| 386 | + .title-header_icon { width: 36rpx; height: 36rpx; margin-right: 12rpx; } | ||
| 387 | + span { font-size: 34rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); } | ||
| 388 | +} | ||
| 357 | .row { | 389 | .row { |
| 358 | display: flex; | 390 | display: flex; |
| 359 | margin-bottom: 28rpx; | 391 | margin-bottom: 28rpx; |
| @@ -37,6 +37,18 @@ | @@ -37,6 +37,18 @@ | ||
| 37 | </view> | 37 | </view> |
| 38 | </view> | 38 | </view> |
| 39 | 39 | ||
| 40 | + <!-- 修改意向(有值时展示,对齐 PC 端 detail-form) --> | ||
| 41 | + <template v-if="hasQualityProblemName"> | ||
| 42 | + <view class="title-header"> | ||
| 43 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 44 | + <span>修改意向</span> | ||
| 45 | + </view> | ||
| 46 | + <view class="section"> | ||
| 47 | + <view class="row"><text class="label">是否有质量问题</text><text class="value">{{ hasQualityProblemName }}</text></view> | ||
| 48 | + <view v-if="hasQualityProblemBool" class="row"><text class="label">处理意见</text><text class="value">{{ safeText(form.processOpinion) }}</text></view> | ||
| 49 | + </view> | ||
| 50 | + </template> | ||
| 51 | + | ||
| 40 | <!-- 是否继续审批(assay_report_yfcckzg 节点必填) --> | 52 | <!-- 是否继续审批(assay_report_yfcckzg 节点必填) --> |
| 41 | <view v-if="showContinueApproval" class="section"> | 53 | <view v-if="showContinueApproval" class="section"> |
| 42 | <view class="field-row"> | 54 | <view class="field-row"> |
| @@ -85,13 +97,25 @@ export default { | @@ -85,13 +97,25 @@ export default { | ||
| 85 | } | 97 | } |
| 86 | }, | 98 | }, |
| 87 | computed: { | 99 | computed: { |
| 88 | - // assay_report_yfcckzg 节点需填写 是否继续审批 | 100 | + // assay_report_gyglkzg2 节点需填写 是否继续审批 |
| 89 | showContinueApproval() { | 101 | showContinueApproval() { |
| 90 | return this.nodeCode === 'assay_report_gyglkzg2' | 102 | return this.nodeCode === 'assay_report_gyglkzg2' |
| 91 | }, | 103 | }, |
| 92 | componentKeys() { | 104 | componentKeys() { |
| 93 | return getComponentKeys(this.form.workshopName) | 105 | return getComponentKeys(this.form.workshopName) |
| 94 | }, | 106 | }, |
| 107 | + // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示) | ||
| 108 | + hasQualityProblemName() { | ||
| 109 | + const v = this.form.hasQualityProblem | ||
| 110 | + if (v === true || v === 1 || v === '1') return '是' | ||
| 111 | + if (v === false || v === 0 || v === '0') return '否' | ||
| 112 | + return '' | ||
| 113 | + }, | ||
| 114 | + // 是否有质量问题-是 | ||
| 115 | + hasQualityProblemBool() { | ||
| 116 | + const v = this.form.hasQualityProblem | ||
| 117 | + return v === true || v === 1 || v === '1' | ||
| 118 | + }, | ||
| 95 | approvalStatusName() { | 119 | approvalStatusName() { |
| 96 | const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) | 120 | const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) |
| 97 | if (!v) return '-' | 121 | if (!v) return '-' |
| @@ -188,6 +212,14 @@ export default { | @@ -188,6 +212,14 @@ export default { | ||
| 188 | background: #fff; | 212 | background: #fff; |
| 189 | margin-bottom: 20rpx; | 213 | margin-bottom: 20rpx; |
| 190 | } | 214 | } |
| 215 | +.title-header { | ||
| 216 | + display: flex; | ||
| 217 | + align-items: center; | ||
| 218 | + padding: 24rpx 32rpx 12rpx; | ||
| 219 | + background-color: #ffffff; | ||
| 220 | + .title-header_icon { width: 36rpx; height: 36rpx; margin-right: 12rpx; } | ||
| 221 | + span { font-size: 34rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); } | ||
| 222 | +} | ||
| 191 | .row { | 223 | .row { |
| 192 | display: flex; | 224 | display: flex; |
| 193 | margin-bottom: 28rpx; | 225 | margin-bottom: 28rpx; |
| @@ -314,7 +314,7 @@ export default { | @@ -314,7 +314,7 @@ export default { | ||
| 314 | ) | 314 | ) |
| 315 | results.forEach((res, idx) => { | 315 | results.forEach((res, idx) => { |
| 316 | const data = res && res.data ? res.data : {} | 316 | const data = res && res.data ? res.data : {} |
| 317 | - const lineList = data.buyoutApplyLineList || data.procurementBuyoutApplyLineList || [] | 317 | + const lineList = data.lineList || [] |
| 318 | map[ids[idx]] = lineList.reduce((m, line) => { | 318 | map[ids[idx]] = lineList.reduce((m, line) => { |
| 319 | if (line && line.productId) { | 319 | if (line && line.productId) { |
| 320 | m[line.productId] = line.estimatedLoss == null ? '' : line.estimatedLoss | 320 | m[line.productId] = line.estimatedLoss == null ? '' : line.estimatedLoss |
| @@ -119,6 +119,31 @@ | @@ -119,6 +119,31 @@ | ||
| 119 | <view class="section"> | 119 | <view class="section"> |
| 120 | <text class="remark-text">{{ safeText(form.documentRemark) }}</text> | 120 | <text class="remark-text">{{ safeText(form.documentRemark) }}</text> |
| 121 | </view> | 121 | </view> |
| 122 | + | ||
| 123 | + <!-- 附件信息(与PC一致:签字凭证/延期说明/驾驶员姓名) --> | ||
| 124 | + <view v-if="hasAttachments" class="sub-table"> | ||
| 125 | + <view class="sub-header"> | ||
| 126 | + <image class="sub-bar" src="/static/images/title.png" /> | ||
| 127 | + <text class="sub-title">附件信息</text> | ||
| 128 | + </view> | ||
| 129 | + <view class="sub-body"> | ||
| 130 | + <view v-if="signFileList.length" class="card"> | ||
| 131 | + <view v-for="(item, i) in signFileList" :key="item.fileId || i" class="row"> | ||
| 132 | + <text class="label">{{ i === 0 ? '签字凭证' : '' }}</text> | ||
| 133 | + <text class="value file-link" @click="downloadAttachment(item)">{{ item.fileName }}</text> | ||
| 134 | + </view> | ||
| 135 | + </view> | ||
| 136 | + <view v-if="delayFileList.length" class="card"> | ||
| 137 | + <view v-for="(item, i) in delayFileList" :key="item.fileId || i" class="row"> | ||
| 138 | + <text class="label">{{ i === 0 ? '延期说明' : '' }}</text> | ||
| 139 | + <text class="value file-link" @click="downloadAttachment(item)">{{ item.fileName }}</text> | ||
| 140 | + </view> | ||
| 141 | + </view> | ||
| 142 | + <view class="card"> | ||
| 143 | + <view class="row"><text class="label">驾驶员姓名</text><text class="value">{{ safeText(form.driver) }}</text></view> | ||
| 144 | + </view> | ||
| 145 | + </view> | ||
| 146 | + </view> | ||
| 122 | </view> | 147 | </view> |
| 123 | </scroll-view> | 148 | </scroll-view> |
| 124 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> | 149 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> |
| @@ -129,6 +154,7 @@ | @@ -129,6 +154,7 @@ | ||
| 129 | import DetailButtons from '@/components/detail-buttons/index.vue' | 154 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 130 | import { getDicByCodes, getDicName } from '@/utils/dic.js' | 155 | import { getDicByCodes, getDicName } from '@/utils/dic.js' |
| 131 | import { weighTicketDetailApi, weighTicketSubmitAuditApi, weighTicketCancelApi } from '@/api/procure-manage/weighTicket.js' | 156 | import { weighTicketDetailApi, weighTicketSubmitAuditApi, weighTicketCancelApi } from '@/api/procure-manage/weighTicket.js' |
| 157 | +import { downloadFileApi } from '@/api/base.js' | ||
| 132 | import { getInfo } from '@/api/login.js' | 158 | import { getInfo } from '@/api/login.js' |
| 133 | 159 | ||
| 134 | export default { | 160 | export default { |
| @@ -179,6 +205,15 @@ export default { | @@ -179,6 +205,15 @@ export default { | ||
| 179 | isBuyout() { | 205 | isBuyout() { |
| 180 | return this.buyout || (this.applyList || []).length > 0 | 206 | return this.buyout || (this.applyList || []).length > 0 |
| 181 | }, | 207 | }, |
| 208 | + signFileList() { | ||
| 209 | + return this.parseAttachmentList(this.form.signAttachmentFileIds, this.form.signAttachmentFileNames) | ||
| 210 | + }, | ||
| 211 | + delayFileList() { | ||
| 212 | + return this.parseAttachmentList(this.form.delayAttachmentFileIds, this.form.delayAttachmentFileNames) | ||
| 213 | + }, | ||
| 214 | + hasAttachments() { | ||
| 215 | + return this.signFileList.length > 0 || this.delayFileList.length > 0 | ||
| 216 | + }, | ||
| 182 | displayButtons() { | 217 | displayButtons() { |
| 183 | const status = this.form.approvalStatus || '' | 218 | const status = this.form.approvalStatus || '' |
| 184 | const isMine = this.form.createById === this.currentUserId | 219 | const isMine = this.form.createById === this.currentUserId |
| @@ -241,6 +276,48 @@ export default { | @@ -241,6 +276,48 @@ export default { | ||
| 241 | toggle(key) { | 276 | toggle(key) { |
| 242 | this.collapse = { ...this.collapse, [key]: !this.collapse[key] } | 277 | this.collapse = { ...this.collapse, [key]: !this.collapse[key] } |
| 243 | }, | 278 | }, |
| 279 | + // 附件字段(多文件逗号分隔)解析为文件列表 | ||
| 280 | + parseAttachmentList(idsStr, namesStr) { | ||
| 281 | + const ids = String(idsStr || '').split(',').map(x => x.trim()).filter(Boolean) | ||
| 282 | + const names = String(namesStr || '').split(',').map(x => x.trim()) | ||
| 283 | + return ids.map((id, idx) => ({ | ||
| 284 | + fileId: id, | ||
| 285 | + fileName: names[idx] || `附件${idx + 1}` | ||
| 286 | + })) | ||
| 287 | + }, | ||
| 288 | + // 下载/预览附件 | ||
| 289 | + downloadAttachment(item) { | ||
| 290 | + const id = item && item.fileId | ||
| 291 | + const fileName = (item && item.fileName) || '' | ||
| 292 | + if (!id) return | ||
| 293 | + downloadFileApi({ id }) | ||
| 294 | + .then(res => { | ||
| 295 | + const url = (res && res.data) || '' | ||
| 296 | + if (!url) { | ||
| 297 | + uni.showToast({ title: '获取附件地址失败', icon: 'none' }) | ||
| 298 | + return | ||
| 299 | + } | ||
| 300 | + // #ifdef H5 | ||
| 301 | + window.open(url) | ||
| 302 | + // #endif | ||
| 303 | + // #ifndef H5 | ||
| 304 | + uni.downloadFile({ | ||
| 305 | + url, | ||
| 306 | + success: r => { | ||
| 307 | + uni.openDocument({ | ||
| 308 | + filePath: r.tempFilePath, | ||
| 309 | + showMenu: true, | ||
| 310 | + fail: () => uni.showToast({ title: '无法打开该附件', icon: 'none' }) | ||
| 311 | + }) | ||
| 312 | + }, | ||
| 313 | + fail: () => uni.showToast({ title: '附件下载失败', icon: 'none' }) | ||
| 314 | + }) | ||
| 315 | + // #endif | ||
| 316 | + }) | ||
| 317 | + .catch(() => { | ||
| 318 | + uni.showToast({ title: '附件获取失败', icon: 'none' }) | ||
| 319 | + }) | ||
| 320 | + }, | ||
| 244 | async loadDicData() { | 321 | async loadDicData() { |
| 245 | try { | 322 | try { |
| 246 | const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE', 'AUDIT_STATUS']) | 323 | const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE', 'AUDIT_STATUS']) |
| @@ -447,6 +524,10 @@ export default { | @@ -447,6 +524,10 @@ export default { | ||
| 447 | word-break: break-all; | 524 | word-break: break-all; |
| 448 | } | 525 | } |
| 449 | } | 526 | } |
| 527 | + | ||
| 528 | +.file-link { | ||
| 529 | + color: $theme-primary; | ||
| 530 | +} | ||
| 450 | .remark-text { | 531 | .remark-text { |
| 451 | font-size: 28rpx; | 532 | font-size: 28rpx; |
| 452 | color: rgba(0, 0, 0, 0.9); | 533 | color: rgba(0, 0, 0, 0.9); |
| @@ -106,12 +106,38 @@ | @@ -106,12 +106,38 @@ | ||
| 106 | <view class="section"> | 106 | <view class="section"> |
| 107 | <text class="remark-text">{{ safeText(form.documentRemark) }}</text> | 107 | <text class="remark-text">{{ safeText(form.documentRemark) }}</text> |
| 108 | </view> | 108 | </view> |
| 109 | + | ||
| 110 | + <!-- 附件信息(与PC一致:签字凭证/延期说明/驾驶员姓名) --> | ||
| 111 | + <view v-if="hasAttachments" class="sub-table"> | ||
| 112 | + <view class="sub-header"> | ||
| 113 | + <image class="sub-bar" src="/static/images/title.png" /> | ||
| 114 | + <text class="sub-title">附件信息</text> | ||
| 115 | + </view> | ||
| 116 | + <view class="sub-body"> | ||
| 117 | + <view v-if="signFileList.length" class="card"> | ||
| 118 | + <view v-for="(item, i) in signFileList" :key="item.fileId || i" class="row"> | ||
| 119 | + <text class="label">{{ i === 0 ? '签字凭证' : '' }}</text> | ||
| 120 | + <text class="value file-link" @click="downloadAttachment(item)">{{ item.fileName }}</text> | ||
| 121 | + </view> | ||
| 122 | + </view> | ||
| 123 | + <view v-if="delayFileList.length" class="card"> | ||
| 124 | + <view v-for="(item, i) in delayFileList" :key="item.fileId || i" class="row"> | ||
| 125 | + <text class="label">{{ i === 0 ? '延期说明' : '' }}</text> | ||
| 126 | + <text class="value file-link" @click="downloadAttachment(item)">{{ item.fileName }}</text> | ||
| 127 | + </view> | ||
| 128 | + </view> | ||
| 129 | + <view class="card"> | ||
| 130 | + <view class="row"><text class="label">驾驶员姓名</text><text class="value">{{ safeText(form.driver) }}</text></view> | ||
| 131 | + </view> | ||
| 132 | + </view> | ||
| 133 | + </view> | ||
| 109 | </scroll-view> | 134 | </scroll-view> |
| 110 | </view> | 135 | </view> |
| 111 | </template> | 136 | </template> |
| 112 | 137 | ||
| 113 | <script> | 138 | <script> |
| 114 | import { weighTicketDetailApi } from '@/api/procure-manage/weighTicket.js' | 139 | import { weighTicketDetailApi } from '@/api/procure-manage/weighTicket.js' |
| 140 | +import { downloadFileApi } from '@/api/base.js' | ||
| 115 | import { getDicByCodes, getDicName } from '@/utils/dic.js' | 141 | import { getDicByCodes, getDicName } from '@/utils/dic.js' |
| 116 | 142 | ||
| 117 | export default { | 143 | export default { |
| @@ -147,6 +173,15 @@ export default { | @@ -147,6 +173,15 @@ export default { | ||
| 147 | }, | 173 | }, |
| 148 | isBuyout() { | 174 | isBuyout() { |
| 149 | return this.buyout || (this.applyList || []).length > 0 | 175 | return this.buyout || (this.applyList || []).length > 0 |
| 176 | + }, | ||
| 177 | + signFileList() { | ||
| 178 | + return this.parseAttachmentList(this.form.signAttachmentFileIds, this.form.signAttachmentFileNames) | ||
| 179 | + }, | ||
| 180 | + delayFileList() { | ||
| 181 | + return this.parseAttachmentList(this.form.delayAttachmentFileIds, this.form.delayAttachmentFileNames) | ||
| 182 | + }, | ||
| 183 | + hasAttachments() { | ||
| 184 | + return this.signFileList.length > 0 || this.delayFileList.length > 0 | ||
| 150 | } | 185 | } |
| 151 | }, | 186 | }, |
| 152 | created() { | 187 | created() { |
| @@ -185,6 +220,51 @@ export default { | @@ -185,6 +220,51 @@ export default { | ||
| 185 | uni.showToast({ title: '详情加载失败', icon: 'none' }) | 220 | uni.showToast({ title: '详情加载失败', icon: 'none' }) |
| 186 | }) | 221 | }) |
| 187 | }, | 222 | }, |
| 223 | + // 附件字段(多文件逗号分隔)解析为文件列表 | ||
| 224 | + parseAttachmentList(idsStr, namesStr) { | ||
| 225 | + const ids = String(idsStr || '').split(',').map(x => x.trim()).filter(Boolean) | ||
| 226 | + const names = String(namesStr || '').split(',').map(x => x.trim()) | ||
| 227 | + return ids.map((id, idx) => ({ | ||
| 228 | + fileId: id, | ||
| 229 | + fileName: names[idx] || `附件${idx + 1}` | ||
| 230 | + })) | ||
| 231 | + }, | ||
| 232 | + // 下载/预览附件 | ||
| 233 | + downloadAttachment(item) { | ||
| 234 | + const id = item && item.fileId | ||
| 235 | + if (!id) return | ||
| 236 | + downloadFileApi({ id }) | ||
| 237 | + .then(res => { | ||
| 238 | + const url = (res && res.data) || '' | ||
| 239 | + if (!url) { | ||
| 240 | + uni.showToast({ title: '获取附件地址失败', icon: 'none' }) | ||
| 241 | + return | ||
| 242 | + } | ||
| 243 | + // #ifdef H5 | ||
| 244 | + window.open(url) | ||
| 245 | + // #endif | ||
| 246 | + // #ifndef H5 | ||
| 247 | + uni.downloadFile({ | ||
| 248 | + url, | ||
| 249 | + success: r => { | ||
| 250 | + uni.openDocument({ | ||
| 251 | + filePath: r.tempFilePath, | ||
| 252 | + showMenu: true, | ||
| 253 | + fail: () => uni.showToast({ title: '无法打开该附件', icon: 'none' }) | ||
| 254 | + }) | ||
| 255 | + }, | ||
| 256 | + fail: () => uni.showToast({ title: '附件下载失败', icon: 'none' }) | ||
| 257 | + }) | ||
| 258 | + // #endif | ||
| 259 | + }) | ||
| 260 | + .catch(() => { | ||
| 261 | + uni.showToast({ title: '附件获取失败', icon: 'none' }) | ||
| 262 | + }) | ||
| 263 | + }, | ||
| 264 | + // 供流程审核页获取业务表单数据(variables) | ||
| 265 | + getFormValues() { | ||
| 266 | + return this.form | ||
| 267 | + }, | ||
| 188 | safeText(v) { | 268 | safeText(v) { |
| 189 | const s = v == null ? '' : String(v) | 269 | const s = v == null ? '' : String(v) |
| 190 | return s.trim() ? s : '-' | 270 | return s.trim() ? s : '-' |
| @@ -358,6 +438,11 @@ export default { | @@ -358,6 +438,11 @@ export default { | ||
| 358 | text-overflow: ellipsis; | 438 | text-overflow: ellipsis; |
| 359 | white-space: nowrap; | 439 | white-space: nowrap; |
| 360 | } | 440 | } |
| 441 | + | ||
| 442 | + .file-link { | ||
| 443 | + color: $theme-primary; | ||
| 444 | + overflow: visible; | ||
| 445 | + } | ||
| 361 | } | 446 | } |
| 362 | } | 447 | } |
| 363 | } | 448 | } |