Commit 6163ddd5 authored by 田翔's avatar 田翔

fix: 时间格式自动补全年月日,关联表单只读形态修复,提示语样式调整

parent 82816325
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "2.3.6", "version": "2.3.7",
"description": "2.3.6: 问题调整", "description": "2.3.7: 时间格式自动补全年月日,关联表单只读形态修复,提示语样式调整",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -126,6 +126,7 @@ export const getWatch = (schema, form, startTime) => { ...@@ -126,6 +126,7 @@ export const getWatch = (schema, form, startTime) => {
let { relationForm } = form?.getValues() let { relationForm } = form?.getValues()
const configs = relationForm?.configs || [] const configs = relationForm?.configs || []
const AutoCalculate = getRules(schema) const AutoCalculate = getRules(schema)
// console.log('AutoCalculate', AutoCalculate)
if (Array.isArray(AutoCalculate)) { if (Array.isArray(AutoCalculate)) {
AutoCalculate.forEach(item => { AutoCalculate.forEach(item => {
const { filedName, rules, calculateRule } = item const { filedName, rules, calculateRule } = item
...@@ -151,7 +152,9 @@ export const getWatch = (schema, form, startTime) => { ...@@ -151,7 +152,9 @@ export const getWatch = (schema, form, startTime) => {
watch[v] = () => { watch[v] = () => {
let params = { let params = {
tableName: schema.tableName, tableName: schema.tableName,
filedFormulas: [{ fieldName: filedName, formula: calculateRule }], filedFormulas: [
{ fieldName: filedName, formula: calculateRule }
],
form: form, form: form,
paths: paths, paths: paths,
relationForm, relationForm,
...@@ -164,7 +167,7 @@ export const getWatch = (schema, form, startTime) => { ...@@ -164,7 +167,7 @@ export const getWatch = (schema, form, startTime) => {
} }
}) })
} }
console.log('watch', watch) // console.log('watch', watch)
return watch return watch
} }
......
...@@ -13,7 +13,7 @@ const BaseForm = (props, ref) => { ...@@ -13,7 +13,7 @@ const BaseForm = (props, ref) => {
} }
)) ))
const { schemaForm, config, formState } = props const { schemaForm, config, formState, disabled } = props
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext) const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const prefixCls = getPrefixCls('pandaXform') const prefixCls = getPrefixCls('pandaXform')
const pandaXform = getPrefixCls() const pandaXform = getPrefixCls()
...@@ -51,7 +51,11 @@ const BaseForm = (props, ref) => { ...@@ -51,7 +51,11 @@ const BaseForm = (props, ref) => {
value = v.fieldValue value = v.fieldValue
} }
}) })
childObj[s] = { ...child[s], presetValue: value || child[s].presetValue } let disabledField = child[s].disabled
if (disabled) {
disabledField = true
}
childObj[s] = { ...child[s], presetValue: value || child[s].presetValue, disabled: disabledField }
} }
} }
} }
...@@ -61,7 +65,7 @@ const BaseForm = (props, ref) => { ...@@ -61,7 +65,7 @@ const BaseForm = (props, ref) => {
} }
} }
return { ...group, properties: parentObj } return { ...group, properties: parentObj }
}, [schemaForm, field, formState]) }, [schemaForm, field, disabled])
const watch = useMemo(() => { const watch = useMemo(() => {
return getWatch(schema, form, startTime) return getWatch(schema, form, startTime)
......
...@@ -389,6 +389,7 @@ const RelationForm = (props) => { ...@@ -389,6 +389,7 @@ const RelationForm = (props) => {
formState={formState} formState={formState}
config={config} config={config}
ref={baseFormRef} ref={baseFormRef}
disabled={!['编辑', '添加'].includes(formState)}
/> />
</Drag> </Drag>
</div> </div>
......
...@@ -39,7 +39,7 @@ const DateTime = (props) => { ...@@ -39,7 +39,7 @@ const DateTime = (props) => {
disabledDate={disabledDate} disabledDate={disabledDate}
picker={format} picker={format}
disabled={disabled} disabled={disabled}
placeholder={placeholder} placeholder={!disabled ? placeholder : ''}
value={value ? moment(value) : null} value={value ? moment(value) : null}
onChange={dateChange} onChange={dateChange}
showNow showNow
......
...@@ -6,7 +6,7 @@ import moment from 'moment' ...@@ -6,7 +6,7 @@ import moment from 'moment'
const Time = (props) => { const Time = (props) => {
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { presetValue, currentDate, defaultCurrent, options } = schema const { presetValue, currentDate, defaultCurrent, options, disabled, placeholder } = schema
const disabledDate = (current) => { const disabledDate = (current) => {
if (options === '不超过当前时间') { if (options === '不超过当前时间') {
...@@ -17,7 +17,7 @@ const Time = (props) => { ...@@ -17,7 +17,7 @@ const Time = (props) => {
} }
const timeChange = (time, timeStr) => { const timeChange = (time, timeStr) => {
onChange(timeStr) onChange(moment(time).format('YYYY-MM-DD HH:ss:mm'))
} }
useEffect(() => { useEffect(() => {
...@@ -36,6 +36,7 @@ const Time = (props) => { ...@@ -36,6 +36,7 @@ const Time = (props) => {
onChange={timeChange} onChange={timeChange}
disabledDate={disabledDate} disabledDate={disabledDate}
locale={locale} locale={locale}
placeholder={!disabled ? placeholder : ''}
getPopupContainer={(targterNode) => targterNode.parentElement || document.body} getPopupContainer={(targterNode) => targterNode.parentElement || document.body}
/> />
) )
......
...@@ -37,7 +37,7 @@ body #app { ...@@ -37,7 +37,7 @@ body #app {
input::-webkit-input-placeholder, input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder, textarea::-webkit-input-placeholder,
.@{ant-prefix}-select-selection-placeholder { .@{ant-prefix}-select-selection-placeholder {
color: #dad9d9; color: #8a8282;
} // 单行文本框 } // 单行文本框
input[disabled] { input[disabled] {
color: @disabledColor; color: @disabledColor;
......
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