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

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

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