|
@@ -719,6 +719,13 @@
|
|
|
@click="handleOpenOAAudit"
|
|
@click="handleOpenOAAudit"
|
|
|
size="small"
|
|
size="small"
|
|
|
>OA审核</el-button>
|
|
>OA审核</el-button>
|
|
|
|
|
+ <!-- 小程序推送:记录录入状态下,根据项目配置判断是否需要签名 -->
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="isCanMiniProgramPush"
|
|
|
|
|
+ type="warning"
|
|
|
|
|
+ @click="handleMiniProgramPush"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >小程序推送</el-button>
|
|
|
<!-- <el-button v-if="isCanSyncReportData" type="primary" @click="handleSyncReportData" :disabled="checkerIsLoginUser" size="small"-->
|
|
<!-- <el-button v-if="isCanSyncReportData" type="primary" @click="handleSyncReportData" :disabled="checkerIsLoginUser" size="small"-->
|
|
|
<!-- >同步报表</el-button>-->
|
|
<!-- >同步报表</el-button>-->
|
|
|
</template>
|
|
</template>
|
|
@@ -865,6 +872,40 @@
|
|
|
</template>
|
|
</template>
|
|
|
</CustomDialog>
|
|
</CustomDialog>
|
|
|
|
|
|
|
|
|
|
+ <!-- 小程序推送签名信息弹窗 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="miniProgramPushDialogVisible"
|
|
|
|
|
+ title="签名信息"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="miniProgramPushFormRef"
|
|
|
|
|
+ :model="miniProgramPushForm"
|
|
|
|
|
+ :rules="miniProgramPushFormRules"
|
|
|
|
|
+ label-width="100px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form-item label="联系人姓名" prop="recipient">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="miniProgramPushForm.recipient"
|
|
|
|
|
+ placeholder="请输入联系人姓名"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="联系人电话" prop="recipientPhone">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="miniProgramPushForm.recipientPhone"
|
|
|
|
|
+ placeholder="请输入联系人电话"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="miniProgramPushDialogVisible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" :loading="miniProgramPushLoading" @click="handleMiniProgramPushConfirm">确定推送</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="tsx">
|
|
<script setup lang="tsx">
|
|
@@ -904,6 +945,7 @@ import {SpreadViewer} from "@/components/DynamicReport";
|
|
|
import {InitParams} from "@/components/DynamicReport/SpreadInterface";
|
|
import {InitParams} from "@/components/DynamicReport/SpreadInterface";
|
|
|
import { cloneDeep, debounce } from 'lodash-es'
|
|
import { cloneDeep, debounce } from 'lodash-es'
|
|
|
import {BoilerTaskOrderApi} from "@/api/pressure2/boilertaskorder";
|
|
import {BoilerTaskOrderApi} from "@/api/pressure2/boilertaskorder";
|
|
|
|
|
+import {BoilerConnectRecordReportApi} from "@/api/pressure2/boilerconnectrecordreport";
|
|
|
import * as UserGroupApi from '@/api/bpm/userGroup'
|
|
import * as UserGroupApi from '@/api/bpm/userGroup'
|
|
|
|
|
|
|
|
const CustomDialog = defineAsyncComponent(() => import('@/components/CustomDialog/index.vue'))
|
|
const CustomDialog = defineAsyncComponent(() => import('@/components/CustomDialog/index.vue'))
|
|
@@ -1607,6 +1649,102 @@ const handleOpenOAAudit = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 小程序推送相关逻辑
|
|
|
|
|
+const projectConfig = ref<any>({})
|
|
|
|
|
+const miniProgramPushDialogVisible = ref(false)
|
|
|
|
|
+const miniProgramPushForm = ref({
|
|
|
|
|
+ recipient: '',
|
|
|
|
|
+ recipientPhone: ''
|
|
|
|
|
+})
|
|
|
|
|
+const miniProgramPushFormRules = {
|
|
|
|
|
+ recipient: [{ required: true, message: '请输入联系人姓名', trigger: 'blur' }],
|
|
|
|
|
+ recipientPhone: [{ required: true, message: '请输入联系人电话', trigger: 'blur' }]
|
|
|
|
|
+}
|
|
|
|
|
+const miniProgramPushFormRef = ref()
|
|
|
|
|
+const miniProgramPushLoading = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+// 判断是否可以小程序推送:记录录入状态下且配置了项目
|
|
|
|
|
+const isCanMiniProgramPush = computed(() => {
|
|
|
|
|
+ if (!props.selectedItem) return false
|
|
|
|
|
+ // 只有记录录入状态下才能推送
|
|
|
|
|
+ if (props.selectedItem.taskStatus !== PressureCheckerMyTaskStatus['RECORD_INPUT']) return false
|
|
|
|
|
+ // 需要有模板ID才能获取项目配置
|
|
|
|
|
+ return !!props.selectedItem.templateId
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 获取项目配置
|
|
|
|
|
+const fetchProjectConfig = async () => {
|
|
|
|
|
+ if (!props.selectedItem?.templateId) return
|
|
|
|
|
+ try {
|
|
|
|
|
+ const type = showReportPdfType.value === 'report' ? 'report' : 'record'
|
|
|
|
|
+ const res = await BoilerConnectRecordReportApi.getByTemplateId({
|
|
|
|
|
+ templateId: props.selectedItem.templateId,
|
|
|
|
|
+ type: type
|
|
|
|
|
+ })
|
|
|
|
|
+ if (res && res.length > 0) {
|
|
|
|
|
+ projectConfig.value = res[0]
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取项目配置失败:', error)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 处理小程序推送
|
|
|
|
|
+const handleMiniProgramPush = async () => {
|
|
|
|
|
+ await fetchProjectConfig()
|
|
|
|
|
+ // 判断是否需要签名
|
|
|
|
|
+ if (projectConfig.value.isSign === '1') {
|
|
|
|
|
+ // 需要签名,打开签名信息弹窗
|
|
|
|
|
+ miniProgramPushForm.value = {
|
|
|
|
|
+ recipient: props.taskOrderItem?.unitContact || '',
|
|
|
|
|
+ recipientPhone: props.taskOrderItem?.unitPhone || ''
|
|
|
|
|
+ }
|
|
|
|
|
+ miniProgramPushDialogVisible.value = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 不需要签名,直接推送
|
|
|
|
|
+ ElMessageBox.confirm('确定要进行小程序推送吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ executeMiniProgramPush()
|
|
|
|
|
+ }).catch(() => {})
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 执行小程序推送 - 更新报告的接收人信息
|
|
|
|
|
+const executeMiniProgramPush = async (signInfo?: any) => {
|
|
|
|
|
+ miniProgramPushLoading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const params: Record<string, any> = {
|
|
|
|
|
+ id: props.selectedItem?.id
|
|
|
|
|
+ }
|
|
|
|
|
+ if (signInfo) {
|
|
|
|
|
+ params.recipient = signInfo.recipient
|
|
|
|
|
+ params.recipientPhone = signInfo.recipientPhone
|
|
|
|
|
+ }
|
|
|
|
|
+ await PipeTaskOrderApi.miniProgramPush(params)
|
|
|
|
|
+ ElMessage.success('推送信息保存成功')
|
|
|
|
|
+ miniProgramPushDialogVisible.value = false
|
|
|
|
|
+ emit('refresh')
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('推送信息保存失败:', error)
|
|
|
|
|
+ ElMessage.error('推送信息保存失败,请稍后重试')
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ miniProgramPushLoading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 签名信息弹窗确认
|
|
|
|
|
+const handleMiniProgramPushConfirm = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await miniProgramPushFormRef.value?.validate()
|
|
|
|
|
+ executeMiniProgramPush(miniProgramPushForm.value)
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 表单验证失败
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 判断"填写结果"按钮是否显示
|
|
// 判断"填写结果"按钮是否显示
|
|
|
const isCanEditRecordResult = computed(() => {
|
|
const isCanEditRecordResult = computed(() => {
|
|
|
// 非我的任务详情页面,不显示
|
|
// 非我的任务详情页面,不显示
|