Commit d704a540 authored by 田翔's avatar 田翔

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

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