Commit 954473c5 authored by 田翔's avatar 田翔

fix: 手写签名支持电子签章

parent 7359c8d4
{
"name": "panda-xform",
"version": "6.0.19",
"description": "6.0.19 台账支持getDeleted查出被删除的数据",
"version": "6.0.20",
"description": "6.0.20 手写签名支持电子签章",
"keywords": [
"panda-xform"
],
......
......@@ -483,6 +483,23 @@ export function QueryFields(accountName) {
})
}
//获取用户电子签章
export function getUserSignature(userId) {
return request({
url: `/PandaWorkFlow/WorkFlow/AccountManage/GetCaseUserExtend_Signature${userId ? `?userId=${userId}` : ''}`,
method: 'get'
})
}
//保存用户电子签章
export function SaveUserSignature(data) {
return request({
url: `/PandaWorkFlow/WorkFlow/AccountManage/SaveCaseUserExtend_Signature`,
method: 'post',
data
})
}
//获取台账添加字段
export function QueryAddFields(accountName) {
return request({
......
import React, { useEffect, useRef, useState } from 'react'
import ReactSignatureCanvas from 'react-signature-canvas'
import Drag from '../../../components/Drag'
import { UploadFileReturnUrl } from '../../../../apis/process'
import { UploadFileReturnUrl, getUserSignature, SaveUserSignature } from '../../../../apis/process'
import styles from './index.less'
import { Button, Checkbox } from 'antd'
const Signature = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1;
const { addons, value, onChange, schema } = props
const { disabled, presetValue } = schema
const [visible, setVisible] = useState(false)
const [checked, setChecked] = useState(false)
const [signature, setSignature] = useState('')
const canvasRef = useRef(null)
const open = () => {
if (addons) {
getSignature()
setVisible(true)
}
}
......@@ -37,6 +42,9 @@ const Signature = (props) => {
if (code === 0) {
onChange(data)
setVisible(false)
if (checked) {
saveSignature(data)
}
} else {
message.error('生成图片失败!')
}
......@@ -44,6 +52,29 @@ const Signature = (props) => {
}
}
const saveSignature = async (data) => {
const { code } = await SaveUserSignature({ userId: userID, value: data })
if (code === 0) {
console.log('保存电子签章')
}
}
const getSignature = async () => {
const { code, data } = await getUserSignature(userID)
if (code === 0) {
setSignature(data)
}
}
const getValues = () => {
onChange(signature)
setVisible(false)
}
const checkChange = (e) => {
setChecked(e.target.checked)
}
useEffect(() => {
addons?.setValue(addons?.dataPath, presetValue || '')
}, [presetValue])
......@@ -62,8 +93,17 @@ const Signature = (props) => {
<Drag
title={'手写签名'}
visible={visible}
onOk={onOk}
onCancel={() => setVisible(false)}
footer={
<div className={styles.footer} style={{ display: 'flex', justifyContent: 'space-between' }}>
<Checkbox onChange={checkChange} checked={checked}>保存到电子签章中</Checkbox>
<div className={styles.right}>
<Button onClick={() => setVisible(false)}>取消</Button>
{signature ? <Button type='primary' ghost onClick={() => getValues()}>电子签章</Button> : null}
<Button type='primary' onClick={() => onOk()}>确定</Button>
</div>
</div>
}
destroyOnClose
>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment