Commit 9de6310e authored by 田翔's avatar 田翔

fix: 可编辑表格自动计算修复

parent 8d69570e
{
"name": "panda-xform",
"version": "5.1.4",
"description": "5.1.4 预览pdf样式修改",
"version": "5.1.5",
"description": "5.1.5 可编辑表格自动计算修复",
"keywords": [
"panda-xform"
],
......@@ -131,4 +131,4 @@
"publishConfig": {
"registry": "https://g.civnet.cn:4873"
}
}
}
\ No newline at end of file
import React from 'react'
import React, { useMemo } from 'react'
import { Tooltip } from 'antd'
const style = {
......@@ -11,12 +11,12 @@ const style = {
const Text = (props) => {
const { text } = props
const { text, align } = props
if (text && text.length > 10) {
return (
<Tooltip title={text}>
<div style={style}>{text}</div>
<div style={{ ...style }}>{text}</div>
</Tooltip>
)
}
......
......@@ -137,6 +137,7 @@ const ValueEdit = (props) => {
return (
<Input
disabled={disabled}
style={{ color: loaclPaths.includes(presetValue) ? 'green' : '' }}
onChange={(e) => onChange({ fieldName, fieldValue: e.target.value })}
value={value}
/>
......
......@@ -44,7 +44,8 @@ const TablePack = (props, ref) => {
//台账列表、台账选择器表头
const getColumnProps = (json, v) => {
const { fieldName, columnWidth, isSort, accurateSearch } = v
console.log('v', v)
const { fieldName, columnWidth, isSort, accurateSearch, alignment } = v
const { widget, sourceType, options } = json?.[fieldName] || {}
let searchProps = {}
if (accurateSearch) {
......@@ -122,6 +123,7 @@ const TablePack = (props, ref) => {
sortOrder: sortedInfo.field === fieldName ? sortedInfo.order : null,
filteredValue: filteredInfo[fieldName] || null,
...searchProps,
align: alignment === '中' ? 'center' : (alignment === '右' ? 'right' : 'left'),
onHeaderCell: (column) => ({
width: column.width,
onResize: (e, props) => {
......@@ -139,7 +141,7 @@ const TablePack = (props, ref) => {
if (['RadioButton', 'CheckBox'].includes(widget)) {
return <SelectView {...props} />
}
return <Text text={value} />
return <Text align={alignment} text={value} />
},
}
}
......
......@@ -2,7 +2,7 @@ import { message } from 'antd'
import { isObject } from '../../utils'
import { formAutomaticComputation, GetSelectItemList, formFieldHideComputation } from '../../apis/process'
export const debounce = (fn) => {
export const debounce = (fn, wait = 300) => {
let t = null
return function (e) {
const context = this
......@@ -14,7 +14,7 @@ export const debounce = (fn) => {
if (typeof fn === 'function') {
fn.call(context, ...args)
}
}, 300)
}, wait)
}
}
......
......@@ -288,9 +288,8 @@ const RelationForm = (props) => {
let listArray = relationForm.data.filter(v => v.ID !== itemData.ID)
listArray.push(itemData)
addons?.setValue('relationForm', { ...relationForm, data: listArray })
setTimeout(() => {
onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `)
}, 0)
onChange(`${new Date().getTime()}`)
addons?.setValue(addons?.dataPath, `${array.length}`)
} else {
rowClick(type, row)
}
......
......@@ -81,96 +81,98 @@ const OtherSource = (props) => {
}
</Select>
</Form.Item>
<Form.List name="field" label='字段映射'>
{(value, { add, remove }) => (
<>
{value.map(({ key, name, ...restField }, index) => (
<Space
key={key}
style={{
display: 'flex',
marginBottom: '5px',
justifyContent: 'center',
position: 'relative',
left: index === 0 ? '-11px' : '',
}}
align='baseline'
>
<Form.Item
{...restField}
name={[name, 'fromField']}
rules={[
{
required: true,
message: '来源字段必填',
}
]}
<Space align="baseline">
<div style={{ width: '60px' }}>字段映射:</div>
<Form.List name="field" label='字段映射'>
{(value, { add, remove }) => (
<>
{value.map(({ key, name, ...restField }, index) => (
<Space
key={key}
style={{
display: 'flex',
marginBottom: '5px',
justifyContent: 'center',
position: 'relative',
}}
align='baseline'
>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onFocus={fromFieldFocus}
<Form.Item
{...restField}
name={[name, 'fromField']}
rules={[
{
required: true,
message: '来源字段必填',
}
]}
>
{fromField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeSelect>
</Form.Item>
<div className={styles.centerImg}></div>
<Form.Item
{...restField}
name={[name, 'toField']}
rules={[
{
required: true,
message: '目标字段必填',
},
{
validator: (rules, value, callback) => {
const { field } = form.getFieldsValue()
let toFields = Array.from(new Set([...field.map(v => v.toField)]))
if (toFields.length !== field.length) {
return Promise.reject('目标字段不能重复!')
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onFocus={fromFieldFocus}
>
{fromField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeSelect>
</Form.Item>
<div className={styles.centerImg}></div>
<Form.Item
{...restField}
name={[name, 'toField']}
rules={[
{
required: true,
message: '目标字段必填',
},
{
validator: (rules, value, callback) => {
const { field } = form.getFieldsValue()
let toFields = Array.from(new Set([...field.map(v => v.toField)]))
if (toFields.length !== field.length) {
return Promise.reject('目标字段不能重复!')
}
return Promise.resolve()
}
return Promise.resolve()
}
}
]}
>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onFocus={toFieldFocus}
]}
>
{toField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeSelect>
</Form.Item>
<Form.Item
hidden={true}
{...restField}
name={[name, 'layerName']}
>
<Input />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Space>
))}
<Form.Item style={{ padding: '0 10px' }}>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加映射
</Button>
</Form.Item>
</>
)}
</Form.List>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onFocus={toFieldFocus}
>
{toField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeSelect>
</Form.Item>
<Form.Item
hidden={true}
{...restField}
name={[name, 'layerName']}
>
<Input />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Space>
))}
<Form.Item style={{ padding: '0 10px' }}>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加映射
</Button>
</Form.Item>
</>
)}
</Form.List>
</Space>
</Form>
</Drag>
</div>
......
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