|
|
@@ -1,585 +0,0 @@
|
|
|
-<route lang="json5" type="page">
|
|
|
-{
|
|
|
- layout: 'default',
|
|
|
- style: {
|
|
|
- navigationBarTitleText: '签字详情',
|
|
|
- navigationStyle: 'custom',
|
|
|
- },
|
|
|
-}
|
|
|
-</route>
|
|
|
-
|
|
|
-<template>
|
|
|
- <view class="detail-container">
|
|
|
- <!-- 导航栏 -->
|
|
|
- <NavBar>
|
|
|
- <template #title>
|
|
|
- <text class="nav-title">{{ title }}</text>
|
|
|
- </template>
|
|
|
- </NavBar>
|
|
|
-
|
|
|
- <!-- 内容区域 -->
|
|
|
- <scroll-view class="scroll-content" scroll-y>
|
|
|
- <!-- PDF 图片预览 -->
|
|
|
- <view v-if="pdfImg" class="pdf-preview" :style="{ width: pdfWidth + 'px', height: pdfHeight + 'px' }">
|
|
|
- <image :src="pdfImg" mode="aspectFit" class="pdf-image" />
|
|
|
- </view>
|
|
|
- <view v-else-if="loading" class="pdf-placeholder">
|
|
|
- <text class="placeholder-text">加载中...</text>
|
|
|
- </view>
|
|
|
- <view v-else class="pdf-placeholder">
|
|
|
- <text class="placeholder-text">暂无图片</text>
|
|
|
- </view>
|
|
|
- </scroll-view>
|
|
|
-
|
|
|
- <!-- 底部按钮 -->
|
|
|
- <view class="footer-bar">
|
|
|
- <button class="footer-btn more-btn" @click="handlePushOrder">更多操作</button>
|
|
|
- <button class="footer-btn re-sign-btn" @click="handleReSign">重新签名</button>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 推送订单弹窗 -->
|
|
|
- <view v-if="showPushPopup" class="popup-overlay" @click="closePushPopup">
|
|
|
- <view class="popup-content" @click.stop>
|
|
|
- <text class="popup-title">推送任务单</text>
|
|
|
- <view class="form-item">
|
|
|
- <text class="form-label">接收人名称:</text>
|
|
|
- <input
|
|
|
- class="form-input"
|
|
|
- v-model="inputName"
|
|
|
- placeholder="请输入接收人名称"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <text class="form-label">接收人手机号:</text>
|
|
|
- <input
|
|
|
- class="form-input"
|
|
|
- v-model="inputPhone"
|
|
|
- type="number"
|
|
|
- maxlength="11"
|
|
|
- placeholder="请输入接收人手机号"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <text class="form-label">电子邮箱:</text>
|
|
|
- <input
|
|
|
- class="form-input"
|
|
|
- v-model="inputEmail"
|
|
|
- type="text"
|
|
|
- placeholder="请输入电子邮箱(选填)"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <view class="popup-actions">
|
|
|
- <button class="action-btn cancel-btn" @click="closePushPopup">取消</button>
|
|
|
- <button class="action-btn confirm-btn" @click="handlePushOrderSubmit">确定</button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script lang="ts" setup>
|
|
|
-import { ref, onMounted, watch } from 'vue'
|
|
|
-import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
-import { getGcConfig, getTaskOrderSignImg, pushTaskOrder } from '@/api/sign'
|
|
|
-import { useUserStore } from '@/store/user'
|
|
|
-// import { createBusinessConfig } from '@/pages/webview/common/config/businessEditorConfig'
|
|
|
-import { setSpreadsheetEditParams } from '@/common/global'
|
|
|
-import NavBar from '@/components/NavBar/NavBar.vue'
|
|
|
-
|
|
|
-const title = ref('')
|
|
|
-const routeType = ref('')
|
|
|
-const orderId = ref('')
|
|
|
-const orderItemId = ref('')
|
|
|
-const securityCheckId = ref('')
|
|
|
-const reportId = ref('')
|
|
|
-const unitContact = ref('')
|
|
|
-const unitPhone = ref('')
|
|
|
-const receiverEmail = ref('')
|
|
|
-const templateId = ref('')
|
|
|
-
|
|
|
-const loading = ref(true)
|
|
|
-const pdfImg = ref('')
|
|
|
-const pdfWidth = ref(0)
|
|
|
-const pdfHeight = ref(0)
|
|
|
-const showPushPopup = ref(false)
|
|
|
-const inputName = ref('')
|
|
|
-const inputPhone = ref('')
|
|
|
-const inputEmail = ref('')
|
|
|
-
|
|
|
-const userStore = useUserStore()
|
|
|
-const userInfo = ref(userStore.userInfo)
|
|
|
-
|
|
|
-const gcConfig = ref<any>({})
|
|
|
-const initData = ref<any>({})
|
|
|
-
|
|
|
-const titleTextMap: Record<string, string> = {
|
|
|
- FWD: '服务单/受理单',
|
|
|
- JYRS: '检验结果告知',
|
|
|
- AQJC: '安全检查记录',
|
|
|
- ZXXX: '重大问题线索告知'
|
|
|
-}
|
|
|
-
|
|
|
-const businessTypeMap: Record<string, number> = {
|
|
|
- FWD: 100,
|
|
|
- JYRS: 200,
|
|
|
- AQJC: 300,
|
|
|
- ZXXX: 400
|
|
|
-}
|
|
|
-
|
|
|
-onLoad((options) => {
|
|
|
- const type = options?.type || ''
|
|
|
- routeType.value = type
|
|
|
- title.value = titleTextMap[type] || '签字详情'
|
|
|
- orderId.value = options?.orderId || ''
|
|
|
- orderItemId.value = options?.orderItemId || ''
|
|
|
- securityCheckId.value = options?.securityCheckId || ''
|
|
|
- reportId.value = options?.reportId || ''
|
|
|
- unitContact.value = options?.unitContact || ''
|
|
|
- unitPhone.value = options?.unitPhone || ''
|
|
|
- receiverEmail.value = options?.receiverEmail || ''
|
|
|
- templateId.value = options?.templateId || ''
|
|
|
-
|
|
|
- inputName.value = unitContact.value
|
|
|
- inputPhone.value = unitPhone.value
|
|
|
- inputEmail.value = receiverEmail.value
|
|
|
-})
|
|
|
-
|
|
|
-watch(orderId, (val) => {
|
|
|
- if (val) {
|
|
|
- getTaskOrderGcConfig()
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-// 获取任务单配置
|
|
|
-const getTaskOrderGcConfig = async () => {
|
|
|
- loading.value = true
|
|
|
- try {
|
|
|
- const result: any = await getGcConfig({
|
|
|
- orderId: orderId.value,
|
|
|
- businessType: routeType.value ? businessTypeMap[routeType.value] : '',
|
|
|
- orderItemId: orderItemId.value || undefined,
|
|
|
- }, userInfo.value)
|
|
|
-
|
|
|
- console.log('获取任务单葡萄城配置信息:', result)
|
|
|
- const res = result?.data
|
|
|
- gcConfig.value = res || {}
|
|
|
- initData.value = result?.initData || {}
|
|
|
-
|
|
|
- if (res) {
|
|
|
- await getTaskOrderSignImg(res)
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('获取配置失败:', error)
|
|
|
- uni.showToast({ title: '获取配置信息失败', icon: 'none' })
|
|
|
- } finally {
|
|
|
- loading.value = false
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 获取已签名的图片
|
|
|
-const getTaskOrderSignImg = async (res: any) => {
|
|
|
- const { dataStr, templateUrl, templateId } = res
|
|
|
-
|
|
|
- if (!orderId.value) return
|
|
|
-
|
|
|
- if (orderId.value) {
|
|
|
- const params: any = {
|
|
|
- dataStr: dataStr || 'xxx',
|
|
|
- templateUrl: templateUrl || 'xxxx',
|
|
|
- orderId: orderId.value,
|
|
|
- businessType: routeType.value ? businessTypeMap[routeType.value] : '',
|
|
|
- fileType: 100,
|
|
|
- orderItemId: orderItemId.value || undefined,
|
|
|
- templateId: templateId || '',
|
|
|
- }
|
|
|
-
|
|
|
- if (routeType.value === 'ZXXX' && res.fileVersionId) {
|
|
|
- params.fileVersionId = res.fileVersionId
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- const result: any = await getTaskOrderSignImg(params)
|
|
|
- if (typeof result === 'string') {
|
|
|
- if (!/^data:image\/\w+;base64,/.test(result)) return
|
|
|
- const base64Data = result.replace(/^data:image\/\w+;base64,/, '')
|
|
|
- const fileName = `upload_${Date.now()}.png`
|
|
|
- const fs = uni.getFileSystemManager()
|
|
|
- const filePath = `${uni.env.USER_DATA_PATH}/${fileName}`
|
|
|
- fs.writeFileSync(filePath, base64Data, 'base64')
|
|
|
- pdfImg.value = filePath
|
|
|
-
|
|
|
- uni.getImageInfo({
|
|
|
- src: filePath,
|
|
|
- success: (imageInfo) => {
|
|
|
- const screenWidth = uni.getSystemInfoSync().windowWidth - 32
|
|
|
- pdfWidth.value = screenWidth
|
|
|
- pdfHeight.value = screenWidth * imageInfo.height / imageInfo.width
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showToast({ title: '获取任务单图片失败', icon: 'none' })
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('获取签名图片失败:', error)
|
|
|
- uni.showToast({ title: '获取任务单图片失败', icon: 'none' })
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('缺少必要的配置信息:', { dataStr: !!dataStr, templateUrl: !!templateUrl })
|
|
|
- loading.value = false
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 返回
|
|
|
-const goBack = () => {
|
|
|
- uni.navigateBack()
|
|
|
-}
|
|
|
-
|
|
|
-// 重新签名
|
|
|
-const handleReSign = () => {
|
|
|
- const url = `/pages/sign/index?orderId=${orderId.value}&type=${routeType.value}&orderItemId=${orderItemId.value}&securityCheckId=${securityCheckId.value}&unitContact=${unitContact.value}&unitPhone=${unitPhone.value}&receiverEmail=${receiverEmail.value}&reportId=${reportId.value}&templateId=${templateId.value}`
|
|
|
- uni.redirectTo({ url })
|
|
|
-}
|
|
|
-
|
|
|
-// 更多操作
|
|
|
-const handlePushOrder = () => {
|
|
|
- const itemList = routeType.value === 'ZXXX' ? ['出具重大问题线索告知单', '更新'] : ['推送', '更新']
|
|
|
-
|
|
|
- uni.showActionSheet({
|
|
|
- itemList: itemList,
|
|
|
- success: (res) => {
|
|
|
- if (res.tapIndex === 0) {
|
|
|
- // 推送
|
|
|
- showPushPopup.value = true
|
|
|
- } else if (res.tapIndex === 1) {
|
|
|
- // 更新 - 检查签名状态
|
|
|
- handleUpdateCheck()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 更新前检查签名状态
|
|
|
-const handleUpdateCheck = () => {
|
|
|
- if (pdfImg.value) {
|
|
|
- const confirmMessageMap: Record<string, string> = {
|
|
|
- FWD: '更新会清除当前签约代表签名,是否确认?',
|
|
|
- JYRS: '更新会清除当前客户代表签名,是否确认?',
|
|
|
- AQJC: '更新会清除当前受检单位签名,是否确认?',
|
|
|
- ZXXX: '更新会清除当前受检单位签名,是否确认?'
|
|
|
- }
|
|
|
- const confirmMessage = confirmMessageMap[routeType.value]
|
|
|
- if (confirmMessage) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: confirmMessage,
|
|
|
- success: (modalRes) => {
|
|
|
- if (modalRes.confirm) {
|
|
|
- handleSpreadsheetEdit()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- handleSpreadsheetEdit()
|
|
|
- }
|
|
|
- } else {
|
|
|
- handleSpreadsheetEdit()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 跳转到电子表格编辑器
|
|
|
-const handleSpreadsheetEdit = () => {
|
|
|
- if (!routeType.value || !orderId.value || !initData.value) {
|
|
|
- uni.showToast({ title: '配置信息不完整', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- const businessConfig = createBusinessConfig(routeType.value as any)
|
|
|
-
|
|
|
- const editInitData = { ...initData.value }
|
|
|
- if (orderItemId.value) {
|
|
|
- editInitData.orderItemId = orderItemId.value
|
|
|
- }
|
|
|
- editInitData.securityCheckId = securityCheckId.value || ''
|
|
|
- editInitData.reportId = reportId.value || ''
|
|
|
-
|
|
|
- const editParams = {
|
|
|
- routeType: routeType.value,
|
|
|
- orderId: orderId.value,
|
|
|
- gcConfig: editInitData,
|
|
|
- businessConfig,
|
|
|
- orderItemId: orderItemId.value || undefined,
|
|
|
- }
|
|
|
-
|
|
|
- setSpreadsheetEditParams(editParams)
|
|
|
- console.log('设置全局编辑参数:', JSON.stringify(editParams))
|
|
|
-
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/webview/generic-webview?businessType=${routeType.value}&orderId=${orderId.value}&templateId=${editInitData.templateId || ''}&useOnline=1`,
|
|
|
- })
|
|
|
- } catch (error) {
|
|
|
- console.error('创建业务配置失败:', error)
|
|
|
- uni.showToast({ title: '启动编辑器失败,请重试', icon: 'none' })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const createBusinessConfig = (name) => {
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-// 关闭推送弹窗
|
|
|
-const closePushPopup = () => {
|
|
|
- showPushPopup.value = false
|
|
|
- inputEmail.value = ''
|
|
|
-}
|
|
|
-
|
|
|
-// 推送任务单提交
|
|
|
-const handlePushOrderSubmit = () => {
|
|
|
- console.log('输入的内容:', inputName.value, inputPhone.value, inputEmail.value)
|
|
|
- if (!inputName.value || !inputPhone.value) {
|
|
|
- return uni.showToast({ title: '请输入接收人姓名和手机号', icon: 'none' })
|
|
|
- }
|
|
|
-
|
|
|
- // 校验手机号
|
|
|
- if (!/^1[3456789]\d{9}$/.test(inputPhone.value)) {
|
|
|
- return uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
|
|
|
- }
|
|
|
-
|
|
|
- // 校验邮箱(如果填写了)
|
|
|
- if (inputEmail.value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(inputEmail.value)) {
|
|
|
- return uni.showToast({ title: '请输入正确的电子邮箱', icon: 'none' })
|
|
|
- }
|
|
|
-
|
|
|
- const params = {
|
|
|
- id: orderId.value,
|
|
|
- receiver: inputName.value,
|
|
|
- receiverPhone: inputPhone.value,
|
|
|
- receiverEmail: inputEmail.value || '',
|
|
|
- businessType: routeType.value ? businessTypeMap[routeType.value] : '',
|
|
|
- orderItemId: orderItemId.value || undefined,
|
|
|
- }
|
|
|
-
|
|
|
- pushTaskOrder(params).then((res: any) => {
|
|
|
- console.log(res, 'pushTaskOrder res')
|
|
|
- if (res?.code === 0) {
|
|
|
- uni.showToast({ title: '推送成功', icon: 'success' })
|
|
|
- showPushPopup.value = false
|
|
|
- // 重新获取任务单最新配置和图片
|
|
|
- getTaskOrderGcConfig()
|
|
|
- } else {
|
|
|
- uni.showToast({ title: res?.msg || '推送失败', icon: 'none' })
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- console.error('推送失败:', error)
|
|
|
- uni.showToast({ title: '推送失败', icon: 'none' })
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 页面显示时重新获取数据(从编辑器返回时)
|
|
|
-onShow(() => {
|
|
|
- if (orderId.value) {
|
|
|
- console.log('详情页面显示,重新获取签名图片数据')
|
|
|
- gcConfig.value && getTaskOrderSignImg(gcConfig.value)
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- if (orderId.value) {
|
|
|
- getTaskOrderGcConfig()
|
|
|
- }
|
|
|
-})
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
-.detail-container {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- height: 100vh;
|
|
|
- background-color: #f5f5f5;
|
|
|
-}
|
|
|
-
|
|
|
-.navigate-view {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- height: 44px;
|
|
|
- background-color: #fff;
|
|
|
- border-bottom: 1px solid #eee;
|
|
|
- padding: 0 15px;
|
|
|
-}
|
|
|
-
|
|
|
-.navigate-left {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- width: 44px;
|
|
|
-}
|
|
|
-
|
|
|
-.back-icon {
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
-}
|
|
|
-
|
|
|
-.navigate-title {
|
|
|
- font-size: 17px;
|
|
|
- font-weight: 500;
|
|
|
- color: #333;
|
|
|
-}
|
|
|
-
|
|
|
-.navigate-right {
|
|
|
- width: 44px;
|
|
|
-}
|
|
|
-
|
|
|
-.nav-title {
|
|
|
- font-size: 17px;
|
|
|
- font-weight: 500;
|
|
|
- color: #333;
|
|
|
-}
|
|
|
-
|
|
|
-.scroll-content {
|
|
|
- flex: 1;
|
|
|
- padding: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.pdf-preview {
|
|
|
- margin: 0 auto 10px;
|
|
|
- background-color: #fff;
|
|
|
- border-radius: 5px;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-
|
|
|
-.pdf-image {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
-}
|
|
|
-
|
|
|
-.pdf-placeholder {
|
|
|
- width: 100%;
|
|
|
- height: 200px;
|
|
|
- background-color: #f5f5f5;
|
|
|
- border-radius: 8px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-
|
|
|
-.placeholder-text {
|
|
|
- color: #999;
|
|
|
- font-size: 14px;
|
|
|
-}
|
|
|
-
|
|
|
-.footer-bar {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- padding: 10px 15px;
|
|
|
- background-color: #fff;
|
|
|
- border-top: 1px solid #eee;
|
|
|
- gap: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.footer-btn {
|
|
|
- flex: 1;
|
|
|
- height: 44px;
|
|
|
- border-radius: 5px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- font-size: 15px;
|
|
|
- border: none;
|
|
|
-}
|
|
|
-
|
|
|
-.more-btn {
|
|
|
- background-color: #fff;
|
|
|
- color: #333;
|
|
|
- border: 1px solid #ddd;
|
|
|
-}
|
|
|
-
|
|
|
-.re-sign-btn {
|
|
|
- background-color: rgb(47, 142, 255);
|
|
|
- color: #fff;
|
|
|
-}
|
|
|
-
|
|
|
-// 推送弹窗
|
|
|
-.popup-overlay {
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- z-index: 999;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-content {
|
|
|
- width: 85%;
|
|
|
- max-width: 400px;
|
|
|
- background-color: #fff;
|
|
|
- border-radius: 10px;
|
|
|
- padding: 20px;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-title {
|
|
|
- font-size: 18px;
|
|
|
- font-weight: 500;
|
|
|
- color: #333;
|
|
|
- text-align: center;
|
|
|
- margin-bottom: 20px;
|
|
|
-}
|
|
|
-
|
|
|
-.form-item {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: 15px;
|
|
|
- gap: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.form-label {
|
|
|
- width: 120px;
|
|
|
- font-size: 14px;
|
|
|
- color: #666;
|
|
|
- flex-shrink: 0;
|
|
|
- text-align: right;
|
|
|
-}
|
|
|
-
|
|
|
-.form-input {
|
|
|
- flex: 1;
|
|
|
- height: 36px;
|
|
|
- border: 1px solid #e0e0e0;
|
|
|
- border-radius: 5px;
|
|
|
- padding: 0 10px;
|
|
|
- font-size: 14px;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-actions {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- justify-content: space-around;
|
|
|
- margin-top: 20px;
|
|
|
- gap: 20px;
|
|
|
-}
|
|
|
-
|
|
|
-.action-btn {
|
|
|
- flex: 1;
|
|
|
- height: 40px;
|
|
|
- border-radius: 5px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- font-size: 15px;
|
|
|
- border: none;
|
|
|
-}
|
|
|
-
|
|
|
-.cancel-btn {
|
|
|
- background-color: #94bddfff;
|
|
|
- color: #fff;
|
|
|
-}
|
|
|
-
|
|
|
-.confirm-btn {
|
|
|
- background-color: #071F50;
|
|
|
- color: #fff;
|
|
|
-}
|
|
|
-</style>
|