|
|
@@ -13,22 +13,82 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<SpreadDesignerGeneric
|
|
|
+ ref="designerRef"
|
|
|
:businessConfig="businessConfig"
|
|
|
:templateData="templateData"
|
|
|
:templateBlob="templateBlob"
|
|
|
@save="handleSave"
|
|
|
@cancel="handleCancel"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template #navBar>
|
|
|
+ <ReportNavBar>
|
|
|
+ <template #right>
|
|
|
+ <view class="nav-btn-group">
|
|
|
+ <view
|
|
|
+ class="nav-btn"
|
|
|
+ @click="designerRef?.handleNavButtonClick({ action: 'cancel' })"
|
|
|
+ >
|
|
|
+ 取消
|
|
|
+ </view>
|
|
|
+ <view
|
|
|
+ class="nav-btn primary"
|
|
|
+ @click="designerRef?.handleNavButtonClick({ action: 'save' })"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </view>
|
|
|
+ <view
|
|
|
+ class="nav-btn submit-btn"
|
|
|
+ @click="openAuditorDialog"
|
|
|
+ >
|
|
|
+ 提交审核
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </ReportNavBar>
|
|
|
+ </template>
|
|
|
+ </SpreadDesignerGeneric>
|
|
|
+
|
|
|
+ <!-- 审核人选择弹窗 -->
|
|
|
+ <view v-if="auditorVisible" class="auditor-overlay" @click="auditorVisible = false">
|
|
|
+ <view class="auditor-dialog" @click.stop>
|
|
|
+ <view class="auditor-title">选择审核人</view>
|
|
|
+ <scroll-view scroll-y class="auditor-list">
|
|
|
+ <view
|
|
|
+ v-for="item in auditorList"
|
|
|
+ :key="item.id"
|
|
|
+ :class="['auditor-item', { active: selectedAuditorId === item.id }]"
|
|
|
+ @click="selectedAuditorId = item.id"
|
|
|
+ >
|
|
|
+ <text class="auditor-name">{{ item.nickname || item.userName }}</text>
|
|
|
+ <view v-if="selectedAuditorId === item.id" class="auditor-check">✓</view>
|
|
|
+ </view>
|
|
|
+ <view v-if="auditorLoading" class="auditor-loading">加载中...</view>
|
|
|
+ <view v-if="!auditorLoading && auditorList.length === 0" class="auditor-empty">
|
|
|
+ 暂无可选审核人
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ <view class="auditor-footer">
|
|
|
+ <view class="auditor-btn cancel" @click="auditorVisible = false">取消</view>
|
|
|
+ <view class="auditor-btn confirm" @click="confirmSubmit">确定</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref } from 'vue'
|
|
|
import SpreadDesignerGeneric from '@/components/SpreadDesigner/spreadDesignerGeneric.vue'
|
|
|
+import ReportNavBar from '@/components/NavBar/ReportNavBar.vue'
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
import { getEnvBaseUrl } from '@/utils/index'
|
|
|
import { getStandardTemplate } from '@/api/index'
|
|
|
import { getDynamicTbVal, saveDynamicTbVal } from '@/api/task'
|
|
|
+import { getAuditList } from '@/api/system/user'
|
|
|
+import { useConfigStore } from '@/store/config'
|
|
|
+import { EquipmentType, PressureReportType } from '@/utils/dictMap'
|
|
|
+import { requestFunc, TaskOrderFuncName } from '@/api/ApiRouter/taskOrder'
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
|
|
const businessConfig = ref({
|
|
|
businessType: 'CZZD',
|
|
|
@@ -40,13 +100,19 @@ const businessConfig = ref({
|
|
|
saveButtonText: '保存',
|
|
|
cancelButtonText: '取消',
|
|
|
showAdditionalToolbar: true,
|
|
|
- customButtons: [],
|
|
|
},
|
|
|
})
|
|
|
+const equipType = useConfigStore().getEquipType()
|
|
|
const templateBlob = ref<string>('')
|
|
|
const templateData = ref<any>({})
|
|
|
const skipEntryKeys = ref<string[]>([])
|
|
|
|
|
|
+// 审核人选择相关
|
|
|
+const auditorVisible = ref(false)
|
|
|
+const auditorList = ref<any[]>([])
|
|
|
+const auditorLoading = ref(false)
|
|
|
+const selectedAuditorId = ref<string>('')
|
|
|
+
|
|
|
let templateId: string = ''
|
|
|
let orderId: string = ''
|
|
|
let mode: 'edit' | 'create' = 'edit'
|
|
|
@@ -161,4 +227,186 @@ const handleSave = async (data: any) => {
|
|
|
const handleCancel = () => {
|
|
|
uni.navigateBack()
|
|
|
}
|
|
|
+
|
|
|
+const designerRef = ref<any>(null)
|
|
|
+
|
|
|
+// 打开审核人选择弹窗
|
|
|
+const openAuditorDialog = async () => {
|
|
|
+ auditorVisible.value = true
|
|
|
+ auditorLoading.value = true
|
|
|
+ auditorList.value = []
|
|
|
+ selectedAuditorId.value = ''
|
|
|
+ try {
|
|
|
+ const roleCode = 'WorkBookApprover'
|
|
|
+ const res = await getAuditList({ roleCode })
|
|
|
+ auditorList.value = (res as any)?.data?.list || []
|
|
|
+ } catch (e) {
|
|
|
+ console.error('获取审核人列表失败:', e)
|
|
|
+ uni.showToast({ title: '获取审核人列表失败', icon: 'none' })
|
|
|
+ } finally {
|
|
|
+ auditorLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 确认提交审核
|
|
|
+const confirmSubmit = async () => {
|
|
|
+ if (!selectedAuditorId.value) {
|
|
|
+ uni.showToast({ title: '请选择审核人', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ auditorVisible.value = false
|
|
|
+ try {
|
|
|
+ const dataSource = designerRef.value?.getSpreadDataSource()
|
|
|
+ if (dataSource) {
|
|
|
+ const saveResult = await saveDynamicTbVal({ params: dataSource, instId: instId.value })
|
|
|
+ if (saveResult?.code !== 0) {
|
|
|
+ throw new Error(saveResult?.msg || '保存报表失败,请重试')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const reqData = {
|
|
|
+ id: workInstructionId,
|
|
|
+ reportType: PressureReportType.WORKINSTRUCTION,
|
|
|
+ reportUrl: workInstructionId,
|
|
|
+ prepareJson: JSON.stringify({
|
|
|
+ prepareName: uni.getStorageSync('userInfo')?.name || '',
|
|
|
+ prepareDate: dayjs().format('YYYY年MM月DD日'),
|
|
|
+ }),
|
|
|
+ auditUserIds: [selectedAuditorId.value],
|
|
|
+ approveUserIds: [],
|
|
|
+ }
|
|
|
+ uni.showLoading({ title: '提交审核中...', mask: true })
|
|
|
+ const res = await requestFunc(TaskOrderFuncName.SubmitOpinionNoticeApproval, equipType, reqData)
|
|
|
+ if (res?.code === 0) {
|
|
|
+ uni.showToast({ title: '提交审核成功', icon: 'success' })
|
|
|
+ } else {
|
|
|
+ throw new Error(res?.msg || '提交审核失败,请重试')
|
|
|
+ }
|
|
|
+ } catch (error: any) {
|
|
|
+ console.error('提交审核异常:', error)
|
|
|
+ uni.showToast({ title: error.message || '提交审核失败', icon: 'none' })
|
|
|
+ } finally {
|
|
|
+ uni.navigateBack()
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.nav-btn-group {
|
|
|
+ display: flex;
|
|
|
+ gap: 8px;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.nav-btn {
|
|
|
+ padding: 0 12px;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 28px;
|
|
|
+ color: #495057;
|
|
|
+ white-space: nowrap;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid #dee2e6;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+.nav-btn.primary {
|
|
|
+ color: white;
|
|
|
+ background-color: #007bff;
|
|
|
+ border-color: #007bff;
|
|
|
+}
|
|
|
+
|
|
|
+.nav-btn.submit-btn {
|
|
|
+ color: white;
|
|
|
+ background-color: #67c23a;
|
|
|
+ border-color: #67c23a;
|
|
|
+}
|
|
|
+
|
|
|
+/* 审核人弹窗 */
|
|
|
+.auditor-overlay {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ z-index: 10001;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-dialog {
|
|
|
+ width: 80%;
|
|
|
+ max-height: 70vh;
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-title {
|
|
|
+ padding: 16px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #333;
|
|
|
+ text-align: center;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-list {
|
|
|
+ max-height: 50vh;
|
|
|
+ padding: 8px 0;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 12px 16px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-item.active {
|
|
|
+ background-color: #ecf5ff;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-name {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-check {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #007bff;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-loading,
|
|
|
+.auditor-empty {
|
|
|
+ padding: 20px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #999;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-footer {
|
|
|
+ display: flex;
|
|
|
+ border-top: 1px solid #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-btn {
|
|
|
+ flex: 1;
|
|
|
+ padding: 14px 0;
|
|
|
+ font-size: 15px;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-btn.cancel {
|
|
|
+ color: #666;
|
|
|
+ border-right: 1px solid #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.auditor-btn.confirm {
|
|
|
+ font-weight: 600;
|
|
|
+ color: #007bff;
|
|
|
+}
|
|
|
+</style>
|