Commit 556facb9 authored by 田翔's avatar 田翔

fix: 关联表单编辑状态下点击不进行处理

parent 6016b0c6
{
"name": "panda-xform",
"version": "5.2.1",
"description": "5.2.1 图片显示缩略图异常问题",
"version": "5.2.2",
"description": "5.2.2 关联表单编辑状态下点击不进行处理",
"keywords": [
"panda-xform"
],
......
......@@ -288,11 +288,15 @@ const getAutoWatch = ({ schema, form, startTime, initField }) => {
const getSelectItemList = async (params) => {
if ((new Date().getTime() - params.startTime) < 2000) return
const { sourcePath, form, targetPath, dictionary, value } = params
const { code, data, msg } = await GetSelectItemList({ nodeName: dictionary })
if (code === 0) {
let array = data.filter(v => v.nodeName === value)
if (Array.isArray(array) && array.length) {
form.setValueByPath(targetPath, array[0].nodeValue)
//只读情况下不做处理
const { disabled } = form.getSchemaByPath(targetPath)
if (!disabled) {
const { code, data, msg } = await GetSelectItemList({ nodeName: dictionary })
if (code === 0) {
let array = data.filter(v => v.nodeName === value)
if (Array.isArray(array) && array.length) {
form.setValueByPath(targetPath, array[0].nodeValue)
}
}
}
}
......
......@@ -249,10 +249,10 @@ const RelationForm = (props) => {
}
const addClick = () => {
if (!localForm.length) {
return message.info('台账添加字段未配置!')
}
if (addons) {
if (!localForm.length) {
return message.info('台账添加字段未配置!')
}
setRow({ ID: `前端ID${new Date().getTime()}` })
setFormState('添加')
setSchemaValues(localForm)
......@@ -295,35 +295,37 @@ const RelationForm = (props) => {
}
const addRow = () => {
let array = []
let field = config?.accountFieids?.filter(v => v.webDisplay).map(v => v.fieldName)
let obj = {}
field.forEach(v => {
obj[v] = ''
if (Array.isArray(mappedField)) {
mappedField.forEach(s => {
if (s.toField === v) {
let value = getFieldValue(s, formDataObj, codes) || ''
array.push({ fieldName: s.toField, fieldValue: value })
obj[s.toField] = value
}
})
if (addons) {
let array = []
let field = config?.accountFieids?.filter(v => v.webDisplay).map(v => v.fieldName)
let obj = {}
field.forEach(v => {
obj[v] = ''
if (Array.isArray(mappedField)) {
mappedField.forEach(s => {
if (s.toField === v) {
let value = getFieldValue(s, formDataObj, codes) || ''
array.push({ fieldName: s.toField, fieldValue: value })
obj[s.toField] = value
}
})
}
})
let ID = `${getNanoid(10, '前端ID')}`
let item = {
type: 'add',
accountTable: accountName,
ID: ID,
values: array
}
})
let ID = `${getNanoid(10, '前端ID')}`
let item = {
type: 'add',
accountTable: accountName,
ID: ID,
values: array
setDataSource([...dataSource, { ID: ID, ...obj }])
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
relationForm.data.push(item)
addons.setValue('relationForm', { ...relationForm })
setTimeout(() => {
onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `)
}, 0)
}
setDataSource([...dataSource, { ID: ID, ...obj }])
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
relationForm.data.push(item)
addons.setValue('relationForm', { ...relationForm })
setTimeout(() => {
onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `)
}, 0)
}
const addRows = () => {
......
......@@ -10,8 +10,8 @@ import * as XLSX from 'xlsx'
import { convertUrlToBase64 } from '../../../../utils/index'
const accepts = {
'全部': ['.bmp', '.gif', '.jpeg', 'tiff', '.png', '.svg', '.jpg', '.docx', '.xlsx', '.pdf', '.mp4', '.mp3'],
'图片': ['.bmp', '.gif', '.jpeg', 'tiff', '.png', '.svg', '.jpg'],
'全部': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg', '.docx', '.xlsx', '.pdf', '.mp4', '.mp3'],
'图片': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg'],
'文档': ['.docx', '.xlsx', '.pdf'],
'视频': ['.mp4'],
'音频': ['.mp3'],
......
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