Commit d704a540 authored by 田翔's avatar 田翔

fix: 修复区域任务控件图片预览与关联表单隐藏值不清空问题

parent 0742a6bd
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.8.7", "version": "6.8.8",
"description": "6.8.7 关联表单增加流程名称映射", "description": "6.8.8 修复区域任务控件图片预览与关联表单隐藏值不清空问题",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
import FileViewer from 'react-file-viewer' import FileViewer from 'react-file-viewer'
import Viewer from 'viewerjs-react' import Viewer from 'viewerjs-react'
import Drag from '../../../../../components/Drag' import Drag from '../../../../../components/Drag'
import { convertUrlToBase64 } from '../../../../../../utils/index' // import { convertUrlToBase64 } from '../../../../../../utils/index'
const FileView = (props) => { const FileView = (props) => {
...@@ -23,7 +23,7 @@ const FileView = (props) => { ...@@ -23,7 +23,7 @@ const FileView = (props) => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [viewVisible, setViewVisible] = useState(false) const [viewVisible, setViewVisible] = useState(false)
const [showFile, setShowFile] = useState({ fileType: '', filePath: '' }) const [showFile, setShowFile] = useState({ fileType: '', filePath: '' })
const [fileListSrc, setFileListSrc] = useState(fileList) // const [fileListSrc, setFileListSrc] = useState(fileList)
const icon = useMemo(() => { const icon = useMemo(() => {
if (fileType === '音频') { if (fileType === '音频') {
...@@ -35,19 +35,20 @@ const FileView = (props) => { ...@@ -35,19 +35,20 @@ const FileView = (props) => {
return <FileZipOutlined /> return <FileZipOutlined />
}, [fileType]) }, [fileType])
useEffect(() => { // useEffect(() => {
getfileListSrc() // getfileListSrc()
}, []) // }, [])
const getfileListSrc = async () => { // const getfileListSrc = async () => {
let array = [] // let array = []
for (let i = 0; i < fileList.length; i++) { // for (let i = 0; i < fileList.length; i++) {
let src = `${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${fileList[i]}${site ? `&_site=${site}` : ''}` // let src = `${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${fileList[i]}${site ? `&_site=${site}` : ''}`
let value = fileList[i].includes('svg') ? await convertUrlToBase64(src) : src // let value = fileList[i].includes('svg') ? await convertUrlToBase64(src) : src
array.push(value) // array.push(value)
} // }
setFileListSrc(array) // console.log('array', array)
} // setFileListSrc(array)
// }
const showList = useMemo(() => { const showList = useMemo(() => {
let list = [] let list = []
...@@ -79,11 +80,11 @@ const FileView = (props) => { ...@@ -79,11 +80,11 @@ const FileView = (props) => {
<div className={styles.fileView} id='panda-xform-fileView'> <div className={styles.fileView} id='panda-xform-fileView'>
<Viewer container='#app'> <Viewer container='#app'>
{ {
fileListSrc.map((v, i) => { fileList.map((v, i) => {
return ( return (
<span className={styles.imgSpan} key={i} style={{ display: i == 0 ? 'inline-block' : 'none' }}> <span className={styles.imgSpan} key={i} style={{ display: i == 0 ? 'inline-block' : 'none' }}>
{fileList.length !== 1 ? <span className={styles.imgSub}>{fileList.length}</span> : null} {fileList.length !== 1 ? <span className={styles.imgSub}>{fileList.length}</span> : null}
<img className={styles.img} src={v}></img> <img className={styles.img} src={`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${v}${site ? `&_site=${site}` : ''}`}></img>
</span> </span>
) )
}) })
......
...@@ -187,6 +187,12 @@ const formFieldHide = async (params) => { ...@@ -187,6 +187,12 @@ const formFieldHide = async (params) => {
let path = getPath(params.schema, v.fieldName) let path = getPath(params.schema, v.fieldName)
if (path) { if (path) {
const schema = params?.form?.getSchemaByPath(path) const schema = params?.form?.getSchemaByPath(path)
//关联表单隐藏之后将数据清空
if (schema.widget === 'RelationForm' && v.isHide) {
const { configs, data } = params?.form?.formData?.relationForm || { configs: [], data: [] }
let newData = data.filter(v => v.path === !path)
params?.form?.setValueByPath('relationForm', { configs: configs, data: newData })
}
params?.form?.setSchemaByPath(path, { ...schema, hidden: v.isHide, presetValue: v.fieldValue || schema.presetValue || '' }) params?.form?.setSchemaByPath(path, { ...schema, hidden: v.isHide, presetValue: v.fieldValue || schema.presetValue || '' })
let gorupPath = path.split('.')[0] let gorupPath = path.split('.')[0]
if (gorupPath) { if (gorupPath) {
......
...@@ -131,7 +131,7 @@ const RelationForm = (props) => { ...@@ -131,7 +131,7 @@ const RelationForm = (props) => {
} }
const deleteTableInfo = (r) => { const deleteTableInfo = (r) => {
let listItem = { type: 'delete', accountTable: accountName, ID: r?.ID, values: getItem(r) } let listItem = { type: 'delete', path: schema.$id, accountTable: accountName, ID: r?.ID, values: getItem(r) }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
if (r?.ID?.includes('前端ID')) { if (r?.ID?.includes('前端ID')) {
let list = relationForm.data.filter(v => v.ID !== r.ID) let list = relationForm.data.filter(v => v.ID !== r.ID)
...@@ -224,7 +224,7 @@ const RelationForm = (props) => { ...@@ -224,7 +224,7 @@ const RelationForm = (props) => {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
let type = row.ID.includes('前端ID') ? 'add' : 'edit' let type = row.ID.includes('前端ID') ? 'add' : 'edit'
let itemData = { type, accountTable: accountName, ID: row.ID, values: formValue } let itemData = { type, path: schema.$id, accountTable: accountName, ID: row.ID, values: formValue }
if (formStateStr !== '添加') { if (formStateStr !== '添加') {
let array = [] let array = []
if (Array.isArray(dataSource)) { if (Array.isArray(dataSource)) {
...@@ -285,7 +285,7 @@ const RelationForm = (props) => { ...@@ -285,7 +285,7 @@ const RelationForm = (props) => {
field.forEach(v => { field.forEach(v => {
formValue.push({ fieldName: v, fieldValue: row[v] || '' }) formValue.push({ fieldName: v, fieldValue: row[v] || '' })
}) })
let itemData = { type, accountTable: accountName, ID: row.ID, values: formValue } let itemData = { type, path: schema.$id, accountTable: accountName, ID: row.ID, values: formValue }
let relationForm = addons?.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons?.getValue('relationForm') || { configs: [], data: [] }
let listArray = relationForm.data.filter(v => v.ID !== itemData.ID) let listArray = relationForm.data.filter(v => v.ID !== itemData.ID)
listArray.push(itemData) listArray.push(itemData)
...@@ -321,6 +321,7 @@ const RelationForm = (props) => { ...@@ -321,6 +321,7 @@ const RelationForm = (props) => {
let ID = `${getNanoid(10, '前端ID')}` let ID = `${getNanoid(10, '前端ID')}`
let item = { let item = {
type: 'add', type: 'add',
path: schema.$id,
accountTable: accountName, accountTable: accountName,
ID: ID, ID: ID,
values: array values: array
...@@ -404,6 +405,7 @@ const RelationForm = (props) => { ...@@ -404,6 +405,7 @@ const RelationForm = (props) => {
}) })
let item = { let item = {
type: 'add', type: 'add',
path: schema.$id,
accountTable: accountName, accountTable: accountName,
ID: ID, ID: ID,
values: values values: values
......
...@@ -122,8 +122,8 @@ const AreaTask = (props) => { ...@@ -122,8 +122,8 @@ const AreaTask = (props) => {
title: v.fieldAliasName, title: v.fieldAliasName,
dataIndex: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`, dataIndex: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`,
key: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`, key: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`,
render: (value) => { render: (_, row) => {
return <FileView value={value} {...schema} /> return <FileView value={row[`${v.fieldType}-${v.fieldName}`]} {...schema} />
} }
}) })
} else { } else {
......
...@@ -216,11 +216,9 @@ const Coordinate = (props) => { ...@@ -216,11 +216,9 @@ const Coordinate = (props) => {
} }
const callback = (value) => { const callback = (value) => {
console.log('value', value)
if (value.location && view) { if (value.location && view) {
let array = value.location.split(',') let array = value.location.split(',')
let point = lngmkt({ lng: Number(array[0]), lat: Number(array[1]) }) let point = lngmkt({ lng: Number(array[0]), lat: Number(array[1]) })
console.log('point', point)
onChange(`${point.x},${point.y}`) onChange(`${point.x},${point.y}`)
} }
} }
......
...@@ -193,7 +193,6 @@ const FileUpload = (props) => { ...@@ -193,7 +193,6 @@ const FileUpload = (props) => {
onRemove: async (file) => { onRemove: async (file) => {
let files = value?.split(",") || []; let files = value?.split(",") || [];
let list = files.filter(v => v !== file.sourcePath); let list = files.filter(v => v !== file.sourcePath);
console.log(files, file, list)
onChange(list.join(",")) onChange(list.join(","))
setShowList(await valueToList(list.join(","))) setShowList(await valueToList(list.join(",")))
}, },
......
...@@ -2,19 +2,17 @@ import React, { useEffect, useMemo, useState } from 'react'; ...@@ -2,19 +2,17 @@ import React, { useEffect, useMemo, useState } from 'react';
import { Checkbox, Divider } from 'antd'; import { Checkbox, Divider } from 'antd';
import styles from './index.less'; import styles from './index.less';
const plainOptions = ['身份号码','姓名', '名族', '住址','出生','性别', '失效日期', '签发机关','签发日期']; const plainOptions = ['身份号码', '姓名', '名族', '住址', '出生', '性别', '失效日期', '签发机关', '签发日期'];
const defaultCheckedList = ['姓名', '名族', '住址','身份号码','出生','性别', '失效日期', '签发机关','签发日期']; const defaultCheckedList = ['姓名', '名族', '住址', '身份号码', '出生', '性别', '失效日期', '签发机关', '签发日期'];
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const TableNames = (props) => { const TableNames = (props) => {
const { value, schema ,onChange} = props; const { value, schema, onChange } = props;
const [checkedList, setCheckedList] = useState((value && value.length>0) const [checkedList, setCheckedList] = useState((value && value.length > 0) ? value : defaultCheckedList);
? value : defaultCheckedList);
console.log(checkedList,"checkedListcheckedListcheckedList");
const checkAll = plainOptions.length === checkedList.length; const checkAll = plainOptions.length === checkedList.length;
const indeterminate = checkedList.length > 0 && checkedList.length < plainOptions.length; const indeterminate = checkedList.length > 0 && checkedList.length < plainOptions.length;
const onChangeOne = (list) => { const onChangeOne = (list) => {
setCheckedList(list); setCheckedList(list);
onChange(list); onChange(list);
......
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