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

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

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