Commit ba78b0f0 authored by 田翔's avatar 田翔

fix: 代码修复

parent a1051bd6
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.0.4", "version": "6.0.5",
"description": "6.0.4 台账loding效果", "description": "6.0.5 文本支持自动计算",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -133,6 +133,11 @@ const textWidgets = [ ...@@ -133,6 +133,11 @@ const textWidgets = [
disabled: disabled, disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'], dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
calculateRule: {
title: '计算规则',
type: 'string',
widget: 'CalculateRule',
},
maxLength: { maxLength: {
title: '最大长度', title: '最大长度',
type: 'number', type: 'number',
......
...@@ -137,10 +137,14 @@ const formAutomatic = async (params) => { ...@@ -137,10 +137,14 @@ const formAutomatic = async (params) => {
data.forEach(v => { data.forEach(v => {
let path = getPath(params.schema, v.fieldName) let path = getPath(params.schema, v.fieldName)
if (path) { if (path) {
console.log('params', params, path)
if (['DateTime', 'Time'].includes(params.widget)) { if (['DateTime', 'Time'].includes(params.widget)) {
if (v.fieldValue !== 0) { if (v.fieldValue !== 0) {
params.form.setValueByPath(path, v.fieldValue + '') params.form.setValueByPath(path, v.fieldValue + '')
} }
} else if (['TextInput'].includes(params.widget)) {
const schema = params?.form?.getSchemaByPath(path)
params?.form?.setSchemaByPath(path, { ...schema, otherValue: v.fieldValue + '' })
} else { } else {
params.form.setValueByPath(path, v.fieldValue + '') params.form.setValueByPath(path, v.fieldValue + '')
} }
...@@ -216,7 +220,7 @@ export const getWatch = ({ schema, form, startTime, initField }) => { ...@@ -216,7 +220,7 @@ export const getWatch = ({ schema, form, startTime, initField }) => {
let formValue = form?.getValues() let formValue = form?.getValues()
let { relationForm } = formValue let { relationForm } = formValue
const configs = relationForm?.configs || [] const configs = relationForm?.configs || []
const AutoCalculate = getWidgetInfo(schema, ['NumberInput', 'DateTime', 'Time']) const AutoCalculate = getWidgetInfo(schema, ['NumberInput', 'DateTime', 'Time', 'TextInput'])
const HiddenWidget = getHiddenWidget(schema) const HiddenWidget = getHiddenWidget(schema)
const RelevanceSelect = getWidgetInfo(schema, ['RelevanceSelect']) const RelevanceSelect = getWidgetInfo(schema, ['RelevanceSelect'])
if (Array.isArray(AutoCalculate)) { if (Array.isArray(AutoCalculate)) {
......
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