Просмотр исходного кода

feat(process/detail): 一键签名

wangpx 10 месяцев назад
Родитель
Сommit
d71b9cec4e
3 измененных файлов с 53 добавлено и 14 удалено
  1. 13 0
      api/process.js
  2. 0 1
      pages/login.vue
  3. 40 13
      pages/process/detail/index.vue

+ 13 - 0
api/process.js

@@ -223,4 +223,17 @@ export function uploadFile(data) {
     name: data.name,
     filePath: data.filePath
   })
+}
+
+export function getSeal(staffId) {
+	return request({
+    url: preUrl,
+    method: 'post',
+    data: {
+    	serviceId: '20250617BpmClientSeal',
+    	params: {
+    		staffId,
+    	}
+    }
+  })
 }

+ 0 - 1
pages/login.vue

@@ -47,7 +47,6 @@ function handleLogin() {
 		$modal.msgError("请输入您的密码")
 	} else {
 		$modal.loading("登录中,请耐心等待...")
-		// TEST: 测试登录接口
 		userStore.Login(loginForm.value).then((res) => {
 			if (loginForm.value.password == '123456') {
 				changeOrgPWD(res.returnParams.useId)

+ 40 - 13
pages/process/detail/index.vue

@@ -84,8 +84,16 @@
 										type="date" />
 									<!-- 审批签字板 -->
 									<view v-else-if="'13' == elem.type">
-										<button v-if="elem.defaultValue == ''" type="primary"
-											@click="handleSignature(index)">签名</button>
+										<view v-if="elem.defaultValue == ''">
+											<uni-row>
+												<uni-col :span="24">
+													<button type="primary" @click="handleSignature(index)">手动签名</button>
+												</uni-col>
+												<uni-col :span="24">
+													<button style="margin-top: 5px;" type="primary" @click="onclickAutosealButton(index)">一键签名</button>
+												</uni-col>
+											</uni-row>
+										</view>
 										<view v-else class="signature_img">
 											<img style="width: 100%;" mode="widthFix" @click="handleSignature(index)"
 												:src="config.baseUrlPre + elem.sealImgPath"
@@ -220,7 +228,7 @@
 				<view class="flow_step_container">
 					<uni-section titleFontSize="1.3rem" title="流转过程" type="line"></uni-section>
 					<up-steps :current="stepActive" activeColor="#18bc37" inactiveColor="#2979ff" direction="column">
-						<view v-for="(step, index) in options">
+						<view v-for="(step, index) in options" :key="index">
 							<up-steps-item :contentClass="'redcontent'" v-if="step.state == 3"
 								:title="step.title + ' 退回'" :desc="step.desc" :key="index" error></up-steps-item>
 							<up-steps-item :contentClass="'redcontent'" v-else-if="step.state == 0"
@@ -285,7 +293,7 @@
 				</view>
 			</uni-card>
 		</view>
-		<view class="cancel_button_container">
+		<view class="cancel_button_container" >
 			<uni-card spacing="0" padding="0">
 				<button :disabled="!button_state" :loading="!button_state" type="warn"
 					@click="handleCancelProcess">撤销</button>
@@ -315,6 +323,9 @@
 					<uni-col :span="6">
 						<button @click="onclickSignatureButton('landscape')">全屏</button>
 					</uni-col>
+					<!-- <uni-col :span="24">
+						<button type="primary" @click="onclickAutosealButton()">一键签名</button>
+					</uni-col> -->
 				</uni-row>
 			</view>
 		</view>
@@ -329,7 +340,7 @@
 	import config from '@/config.js'
 	import $tab from '@/plugins/tab.js'
 	import $modal from '@/plugins/modal.js'
-	import { getProcessFlowInfo, getProcessFormInfo, getProcessFormInfoInFlow, getProcessFlow, submitProcessFlow, cancelProcessFlow, uploadSignatureImg, uploadSignatureBoardImg, uploadFile } from '@/api/process.js'
+	import { getProcessFlowInfo, getProcessFormInfo, getProcessFormInfoInFlow, getProcessFlow, submitProcessFlow, cancelProcessFlow, uploadSignatureImg, uploadSignatureBoardImg, uploadFile, getSeal } from '@/api/process.js'
 	import { getAttendanceSegment } from '@/api/work.js'
 	import { useUserStore } from '@/store/user.js'
 	import { getLoginInfo, getSession, setSession } from '@/utils/auth.js'
@@ -468,6 +479,7 @@
 		if (processInfo.tinsId) {
 			// 待办审批流程表单数据todo
 			getProcessFormInfoInFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
+				console.log('returnParams', returnParams);
 
 				const modifyReturnParams = (returnParams) => {
 					return returnParams.formElements.map(element => {
@@ -539,6 +551,7 @@
 					processInfo.reqRemark = returnParams.tmodel.reqRemark
 				})
 			}
+			console.log('options', options.value);
 		})
 	}
 
@@ -775,17 +788,21 @@
 	// 生成人民币大写
 	function computedNumberToChineseCurrency(item, form) {
 		const elem = form.find(elem => elem.elementName == item.BddzText.slice(3))
-		return item.defaultValue = convertToChineseCurrency(elem.defaultValue)
+		if (elem.defaultValue) {
+			return item.defaultValue = convertToChineseCurrency(elem.defaultValue)
+		}
 	}
 	// 按照公式统计数据
 	function computedBddzTextValue(item) {
 		const mainIndex = formElements.value.findIndex(({ elementName }) => elementName == item.BddzText.slice(3))
 		const reIndex = repeatingForm.value.elementItem.findIndex(({ elementName }) => elementName == item.BddzText)
-		if (mainIndex != -1) {
-			return item.defaultValue = formElements.value[mainIndex].defaultValue
-		}
-		if (reIndex != -1) {
-			return computedValueToRepeatingForm(item)
+		if (item.defaultValue) {
+			if (mainIndex != -1) {
+				return item.defaultValue = formElements.value[mainIndex].defaultValue
+			}
+			if (reIndex != -1) {
+				return computedValueToRepeatingForm(item)
+			}
 		}
 	}
 	// 统计重复表数据
@@ -795,7 +812,9 @@
 		for (const formItem of repeatingForm.value.elements) {
 			result += Number(formItem[index].defaultValue) || 0
 		}
-		return item.defaultValue = Number(result.toFixed(2))
+		if (item.defaultValue) {
+			return item.defaultValue = Number(result.toFixed(2))
+		}
 	}
 	function digitInput(event, item) {
 		// 获取输入框当前的值
@@ -932,9 +951,17 @@
 				isLandscape.value = !isLandscape.value
 				initSignature()
 				break;
-
 		}
 	}
+	function onclickAutosealButton(index) {
+		if (signatureItemIndex.value != -1) index = signatureItemIndex.value
+		getSeal(userStore.user.useId).then(({ returnParams }) => {
+			formElements.value[index].defaultValue = returnParams.sealFileId.universalid
+			formElements.value[index].sealImgPath = returnParams.sealFileId.path
+			signaturePopupShow.value = false
+			signaturePopup.value.close()
+		})
+	}
 	function closeSignaturePopup() {
 		signatureItemIndex.value = -1
 		signaturePopupShow.value = false