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

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

parent 7359c8d4
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.0.19", "version": "6.0.20",
"description": "6.0.19 台账支持getDeleted查出被删除的数据", "description": "6.0.20 手写签名支持电子签章",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -483,6 +483,23 @@ export function QueryFields(accountName) { ...@@ -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) { export function QueryAddFields(accountName) {
return request({ return request({
......
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import ReactSignatureCanvas from 'react-signature-canvas' import ReactSignatureCanvas from 'react-signature-canvas'
import Drag from '../../../components/Drag' import Drag from '../../../components/Drag'
import { UploadFileReturnUrl } from '../../../../apis/process' import { UploadFileReturnUrl, getUserSignature, SaveUserSignature } from '../../../../apis/process'
import styles from './index.less' import styles from './index.less'
import { Button, Checkbox } from 'antd'
const Signature = (props) => { const Signature = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1;
const { addons, value, onChange, schema } = props const { addons, value, onChange, schema } = props
const { disabled, presetValue } = schema const { disabled, presetValue } = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [checked, setChecked] = useState(false)
const [signature, setSignature] = useState('')
const canvasRef = useRef(null) const canvasRef = useRef(null)
const open = () => { const open = () => {
if (addons) { if (addons) {
getSignature()
setVisible(true) setVisible(true)
} }
} }
...@@ -37,6 +42,9 @@ const Signature = (props) => { ...@@ -37,6 +42,9 @@ const Signature = (props) => {
if (code === 0) { if (code === 0) {
onChange(data) onChange(data)
setVisible(false) setVisible(false)
if (checked) {
saveSignature(data)
}
} else { } else {
message.error('生成图片失败!') message.error('生成图片失败!')
} }
...@@ -44,6 +52,29 @@ const Signature = (props) => { ...@@ -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(() => { useEffect(() => {
addons?.setValue(addons?.dataPath, presetValue || '') addons?.setValue(addons?.dataPath, presetValue || '')
}, [presetValue]) }, [presetValue])
...@@ -62,8 +93,17 @@ const Signature = (props) => { ...@@ -62,8 +93,17 @@ const Signature = (props) => {
<Drag <Drag
title={'手写签名'} title={'手写签名'}
visible={visible} visible={visible}
onOk={onOk}
onCancel={() => setVisible(false)} 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 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