Commit 0d4827a0 authored by 田翔's avatar 田翔

fix: 内部字段不允许编辑配置

parent a9aae132
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "2.8.5", "version": "2.8.6",
"description": "2.8.5: 初始化的时候必填校验问题", "description": "2.8.6: 内部字段不允许编辑配置",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -92,15 +92,18 @@ const globalSettings = { ...@@ -92,15 +92,18 @@ const globalSettings = {
widget: 'TableNames', widget: 'TableNames',
required: true, required: true,
}, },
tableType: {
title: '表类型',
type: 'string',
disabled: true,
},
alias: { alias: {
title: '展示名称', title: '展示名称',
type: 'string', type: 'string',
// widget: 'htmlInput',
}, },
interfaceName: { interfaceName: {
title: '接口', title: '接口',
type: 'string', type: 'string',
// widget: 'htmlInput',
}, },
column: { column: {
title: '整体布局', title: '整体布局',
......
...@@ -3,6 +3,8 @@ import { commonSettings, switchSettings, elementSettings } from './otherSettings ...@@ -3,6 +3,8 @@ import { commonSettings, switchSettings, elementSettings } from './otherSettings
import { GroupOutlined } from '@ant-design/icons' import { GroupOutlined } from '@ant-design/icons'
import IconPack from '../../widgets/IconPack' import IconPack from '../../widgets/IconPack'
const disabled = '{{formData.tableTypeParent === "物联设备表" && formData.IsSystemField}}'
const groupStyle = { const groupStyle = {
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -71,44 +73,58 @@ const textWidgets = [ ...@@ -71,44 +73,58 @@ const textWidgets = [
type: 'string', type: 'string',
widget: 'FieldNames', widget: 'FieldNames',
required: true, required: true,
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
title: { title: {
title: '展示名称', title: '展示名称',
required: true, required: true,
type: 'string', type: 'string',
widget: 'htmlInput', disabled: disabled,
dependencies: ['widget'] dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
placeholder: { placeholder: {
title: '提示语', title: '提示语',
type: 'string', type: 'string',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
description: { description: {
title: '字段说明', title: '字段说明',
type: 'string', type: 'string',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
hiddenCondition: { hiddenCondition: {
title: '隐藏条件', title: '隐藏条件',
type: 'string', type: 'string',
description: '所有形态默认显示', description: '所有形态默认显示',
widget: 'HiddenCondition' widget: 'HiddenCondition',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
presetValue: { presetValue: {
title: '默认值', title: '默认值',
type: 'string', type: 'string',
widget: 'InputDefault', widget: 'InputDefault',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
maxLength: { maxLength: {
title: '最大长度', title: '最大长度',
type: 'number', type: 'number',
widget: 'number', widget: 'number',
default: 200, default: 200,
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
rules: { rules: {
title: '正则校验', title: '正则校验',
type: 'array', type: 'array',
default: [], default: [],
widget: 'VerifyTextInput', widget: 'VerifyTextInput',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
uniqueVerify: { uniqueVerify: {
title: '唯一值校验', title: '唯一值校验',
...@@ -117,23 +133,25 @@ const textWidgets = [ ...@@ -117,23 +133,25 @@ const textWidgets = [
enum: ['表名/字段名'], enum: ['表名/字段名'],
default: null, default: null,
enumNames: ['表名/字段名'], enumNames: ['表名/字段名'],
// displayType: 'row',
// labelWidth: 100,
props: { props: {
allowClear: true allowClear: true
} },
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
tableName: { tableName: {
title: '表名', title: '表名',
type: 'string', type: 'string',
hidden: "{{formData.uniqueVerify !== '表名/字段名'}}", hidden: "{{formData.uniqueVerify !== '表名/字段名'}}",
dependencies: ['uniqueVerify'], disabled: disabled,
dependencies: ['uniqueVerify', 'tableTypeParent', 'IsSystemField'],
}, },
fieldName: { fieldName: {
title: '字段名', title: '字段名',
type: 'string', type: 'string',
hidden: "{{formData.uniqueVerify !== '表名/字段名'}}", hidden: "{{formData.uniqueVerify !== '表名/字段名'}}",
dependencies: ['uniqueVerify'], disabled: disabled,
dependencies: ['uniqueVerify', 'tableTypeParent', 'IsSystemField'],
}, },
required: { required: {
title: '必填', title: '必填',
...@@ -144,7 +162,9 @@ const textWidgets = [ ...@@ -144,7 +162,9 @@ const textWidgets = [
style: { style: {
marginLeft: '10px', marginLeft: '10px',
} }
} },
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
disabled: { disabled: {
title: '只读', title: '只读',
...@@ -152,13 +172,16 @@ const textWidgets = [ ...@@ -152,13 +172,16 @@ const textWidgets = [
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '33%',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
isStoreID: { isStoreID: {
title: '是否存储ID', title: '是否存储ID',
type: 'boolean', type: 'boolean',
default: false, default: false,
hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}", hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}",
dependencies: ['presetValue'], disabled: disabled,
dependencies: ['presetValue', 'tableTypeParent', 'IsSystemField'],
}, },
isQRCode: { isQRCode: {
title: '设备二维码', title: '设备二维码',
...@@ -168,6 +191,8 @@ const textWidgets = [ ...@@ -168,6 +191,8 @@ const textWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 120, labelWidth: 120,
description: '是否解析为二维码格式(手持端专用)', description: '是否解析为二维码格式(手持端专用)',
disabled: disabled,
dependencies: ['presetValue', 'tableTypeParent', 'IsSystemField'],
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -180,6 +205,8 @@ const textWidgets = [ ...@@ -180,6 +205,8 @@ const textWidgets = [
widget: 'InputAddon', widget: 'InputAddon',
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
disabled: disabled,
dependencies: ['presetValue', 'tableTypeParent', 'IsSystemField'],
}, },
addonAfter: { addonAfter: {
title: '后置标签', title: '后置标签',
...@@ -187,11 +214,15 @@ const textWidgets = [ ...@@ -187,11 +214,15 @@ const textWidgets = [
widget: 'InputAddon', widget: 'InputAddon',
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
width: { width: {
title: '元素宽度', title: '元素宽度',
type: 'string', type: 'string',
widget: 'percentSlider', widget: 'percentSlider',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
labelWidth: { labelWidth: {
title: '标签宽度', title: '标签宽度',
...@@ -203,6 +234,8 @@ const textWidgets = [ ...@@ -203,6 +234,8 @@ const textWidgets = [
props: { props: {
hideNumber: true, hideNumber: true,
}, },
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
}, },
}, },
...@@ -559,11 +592,6 @@ const textWidgets = [ ...@@ -559,11 +592,6 @@ const textWidgets = [
widget: 'Coding', widget: 'Coding',
}, },
setting: { setting: {
groupBase: {
title: '基础信息',
type: 'object',
properties: {}
},
widget: { widget: {
title: '控件类型', title: '控件类型',
type: 'string', type: 'string',
...@@ -576,22 +604,30 @@ const textWidgets = [ ...@@ -576,22 +604,30 @@ const textWidgets = [
type: 'string', type: 'string',
widget: 'FieldNames', widget: 'FieldNames',
required: true, required: true,
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
title: { title: {
title: '展示名称', title: '展示名称',
required: true, required: true,
type: 'string', type: 'string',
widget: 'htmlInput', widget: 'htmlInput',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
description: { description: {
title: '字段说明', title: '字段说明',
type: 'string', type: 'string',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
hiddenCondition: { hiddenCondition: {
title: '隐藏条件', title: '隐藏条件',
type: 'string', type: 'string',
description: '所有形态默认显示', description: '所有形态默认显示',
widget: 'HiddenCondition' widget: 'HiddenCondition',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
required: { required: {
title: '必填', title: '必填',
...@@ -602,7 +638,9 @@ const textWidgets = [ ...@@ -602,7 +638,9 @@ const textWidgets = [
style: { style: {
marginLeft: '10px' marginLeft: '10px'
} }
} },
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
disabled: { disabled: {
title: '只读', title: '只读',
...@@ -610,23 +648,25 @@ const textWidgets = [ ...@@ -610,23 +648,25 @@ const textWidgets = [
widget: 'checkbox', widget: 'checkbox',
default: true, default: true,
width: '30%', width: '30%',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
prefixion: { prefixion: {
title: '前缀', title: '前缀',
type: 'string', type: 'string',
displayType: 'row', disabled: disabled,
labelWidth: 90, dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
codingType: { codingType: {
title: '编码方式', title: '编码方式',
type: 'string', type: 'string',
displayType: 'row',
labelWidth: 90,
widget: 'select', widget: 'select',
enum: ['1', '2', '3'], enum: ['1', '2', '3'],
default: '3', default: '3',
enumNames: ['前缀-年份-六位编码', '前缀-年份月份-六位编码', '前缀 -八位编码'], enumNames: ['前缀-年份-六位编码', '前缀-年份月份-六位编码', '前缀-八位编码'],
description: '{{rootValue.codingType === "1" ?"示例:XJ-2019-000001" : (rootValue.codingType === "2" ? "示例: XJ-201909-000001" : "示例: XJ00000001")}}' description: '{{rootValue.codingType === "1" ?"示例:XJ-2019-000001" : (rootValue.codingType === "2" ? "示例: XJ-201909-000001" : "示例: XJ00000001")}}',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -637,6 +677,8 @@ const textWidgets = [ ...@@ -637,6 +677,8 @@ const textWidgets = [
title: '元素宽度', title: '元素宽度',
type: 'string', type: 'string',
widget: 'percentSlider', widget: 'percentSlider',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
labelWidth: { labelWidth: {
title: '标签宽度', title: '标签宽度',
...@@ -648,6 +690,8 @@ const textWidgets = [ ...@@ -648,6 +690,8 @@ const textWidgets = [
props: { props: {
hideNumber: true, hideNumber: true,
}, },
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
}, },
}, },
} }
...@@ -721,10 +765,10 @@ const selectWidgets = [ ...@@ -721,10 +765,10 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: { properties: {
value: { value: {
title: '选项值', title: '',
type: 'string', type: 'string',
displayType: 'row', displayType: 'row',
labelWidth: 75, labelWidth: 10,
required: true, required: true,
default: '', default: '',
props: { props: {
...@@ -919,10 +963,10 @@ const selectWidgets = [ ...@@ -919,10 +963,10 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: { properties: {
value: { value: {
title: '选项值', title: '',
type: 'string', type: 'string',
displayType: 'row', displayType: 'row',
labelWidth: 75, labelWidth: 10,
// required: true, // required: true,
default: '', default: '',
props: { props: {
...@@ -1057,11 +1101,10 @@ const selectWidgets = [ ...@@ -1057,11 +1101,10 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: { properties: {
value: { value: {
title: '选项值', title: '',
type: 'string', type: 'string',
displayType: 'row', displayType: 'row',
labelWidth: 75, labelWidth: 10,
// required: true,
default: '', default: '',
props: { props: {
style: { style: {
......
...@@ -4,7 +4,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons' ...@@ -4,7 +4,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons'
import Generator, { defaultSettings, defaultCommonSettings, defaultGlobalSettings } from 'fr-generator' import Generator, { defaultSettings, defaultCommonSettings, defaultGlobalSettings } from 'fr-generator'
import { settings, baseSettings, globalSettings } from './config' import { settings, baseSettings, globalSettings } from './config'
import widgets from '../widgets' import widgets from '../widgets'
import { saveTableConfig, GetTableConfigJson } from '../../apis/process' import { saveTableConfig, GetTableConfigJson, ReloadTableFields } from '../../apis/process'
import FormRender from '../FormRender' import FormRender from '../FormRender'
import { isObject } from '../../utils' import { isObject } from '../../utils'
import Drag from '../components/Drag' import Drag from '../components/Drag'
...@@ -27,6 +27,7 @@ const FormDesigner = (props, ref) => { ...@@ -27,6 +27,7 @@ const FormDesigner = (props, ref) => {
const prefixClsPandaXform = getPrefixCls() const prefixClsPandaXform = getPrefixCls()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [schema, setSchema] = useState({}) const [schema, setSchema] = useState({})
const [fieldName, setFieldName] = useState([])
const designerRef = useRef(null) const designerRef = useRef(null)
const formRenderRef = useRef(null) const formRenderRef = useRef(null)
...@@ -41,8 +42,7 @@ const FormDesigner = (props, ref) => { ...@@ -41,8 +42,7 @@ const FormDesigner = (props, ref) => {
return settingsParent return settingsParent
}, [settings, tableName]) }, [settings, tableName])
const getJSON = (json, tableName) => { const getJSON = (json, fieldName) => {
json.tableName = tableName
let properties = json?.properties let properties = json?.properties
let parent = {} let parent = {}
let paths = [] let paths = []
...@@ -60,7 +60,15 @@ const FormDesigner = (props, ref) => { ...@@ -60,7 +60,15 @@ const FormDesigner = (props, ref) => {
let child = properties[v]?.properties let child = properties[v]?.properties
if (isObject(child)) { if (isObject(child)) {
for (let s in child) { for (let s in child) {
let IsSystemField = false
fieldName.forEach(j => {
if (j.name === s) {
IsSystemField = j.IsSystemField
}
})
child[s].tableNameParent = tableName child[s].tableNameParent = tableName
child[s].tableTypeParent = json.tableType
child[s].IsSystemField = IsSystemField
if (v === '(未分组)') { if (v === '(未分组)') {
ungroupedChild[s] = child[s] ungroupedChild[s] = child[s]
} }
...@@ -95,10 +103,12 @@ const FormDesigner = (props, ref) => { ...@@ -95,10 +103,12 @@ const FormDesigner = (props, ref) => {
const getTableConfig = async (tableName) => { const getTableConfig = async (tableName) => {
const { code, data, msg } = await GetTableConfigJson({ tableName }) const { code, data, msg } = await GetTableConfigJson({ tableName })
if (code === 0) { const res = await ReloadTableFields({ tableName })
if (data && typeof data === 'string') { if (code === 0 && res.data && res.data.root) {
let json = JSON.parse(data) if (data && typeof data === 'string' && Array.isArray(res.data.root)) {
designerRef?.current?.setValue(getJSON(json, tableName)) setFieldName(res.data.root)
let json = getJSON(JSON.parse(data), res.data.root)
designerRef?.current?.setValue(json)
setSchema(json) setSchema(json)
} }
} else { } else {
...@@ -141,7 +151,7 @@ const FormDesigner = (props, ref) => { ...@@ -141,7 +151,7 @@ const FormDesigner = (props, ref) => {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
setVisible(true) setVisible(true)
let json = getJSON(designerRef.current.getValue(), tableName) let json = getJSON(designerRef.current.getValue(), fieldName)
setSchema(json) setSchema(json)
designerRef.current.setValue(json) designerRef.current.setValue(json)
} }
...@@ -151,7 +161,7 @@ const FormDesigner = (props, ref) => { ...@@ -151,7 +161,7 @@ const FormDesigner = (props, ref) => {
if (errors.length) { if (errors.length) {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
let json = getJSON(designerRef.current.getValue(), tableName) let json = getJSON(designerRef.current.getValue(), fieldName)
designerRef.current.setValue(json) designerRef.current.setValue(json)
const { code, data, msg } = await saveTableConfig(json) const { code, data, msg } = await saveTableConfig(json)
if (code === 0) { if (code === 0) {
...@@ -184,7 +194,7 @@ const FormDesigner = (props, ref) => { ...@@ -184,7 +194,7 @@ const FormDesigner = (props, ref) => {
] ]
} }
return [false, false, false, false] return [false, false, false, false]
}, [extra]) }, [extra, fieldName])
const getFields = (schema) => { const getFields = (schema) => {
let array = [] let array = []
...@@ -214,6 +224,17 @@ const FormDesigner = (props, ref) => { ...@@ -214,6 +224,17 @@ const FormDesigner = (props, ref) => {
} }
} }
const canDelete = (values) => {
const { $id, tableTypeParent, IsSystemField } = values
if (tableTypeParent === '物联设备表' && IsSystemField) {
if (fieldName.some(v => v.name === $id)) {
message.info(`表类型为:【${tableTypeParent}】,内部字段【${$id}】不允许删除!`)
return false
}
}
return true
}
if (!tableName) { if (!tableName) {
return null return null
} }
...@@ -223,6 +244,7 @@ const FormDesigner = (props, ref) => { ...@@ -223,6 +244,7 @@ const FormDesigner = (props, ref) => {
<div style={{ height: '100%' }}> <div style={{ height: '100%' }}>
<Generator <Generator
// configProvider={{ prefixCls: prefixClsPandaXform }} // configProvider={{ prefixCls: prefixClsPandaXform }}
canDelete={canDelete}
mapping={{ mapping={{
object: 'Header', object: 'Header',
}} }}
......
...@@ -20,6 +20,7 @@ const BooleanSwitch = (props) => { ...@@ -20,6 +20,7 @@ const BooleanSwitch = (props) => {
return ( return (
<Switch <Switch
disabled={disabled}
checked={value} checked={value}
checkedChildren='是' checkedChildren='是'
unCheckedChildren='否' unCheckedChildren='否'
......
...@@ -9,7 +9,7 @@ const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'obj ...@@ -9,7 +9,7 @@ const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'obj
const InputAddon = (props) => { const InputAddon = (props) => {
const { value, onChange } = props const { value, onChange, disabled } = props
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [icon, setIcon] = useState() const [icon, setIcon] = useState()
...@@ -33,8 +33,8 @@ const InputAddon = (props) => { ...@@ -33,8 +33,8 @@ const InputAddon = (props) => {
return ( return (
<div className={styles.inputAddon}> <div className={styles.inputAddon}>
<Input value={value} onChange={inputChange} /> <Input disabled={disabled} value={value} onChange={inputChange} />
<div className={styles.addon}><PlusOutlined onClick={iconClick} /></div> {!disabled ? <div className={styles.addon}><PlusOutlined onClick={iconClick} /></div> : null}
<Drag <Drag
width={'50%'} width={'50%'}
getContainer={false} getContainer={false}
......
...@@ -9,7 +9,7 @@ import { widgetData, getStyles } from '../../../../../constant/constant' ...@@ -9,7 +9,7 @@ import { widgetData, getStyles } from '../../../../../constant/constant'
const FieldNames = (props) => { const FieldNames = (props) => {
let fields = window.designer || [] let fields = window.designer || []
const { value, onChange, addons } = props const { value, onChange, addons, disabled } = props
const { tableNameParent, widget } = addons.formData const { tableNameParent, widget } = addons.formData
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
...@@ -90,6 +90,7 @@ const FieldNames = (props) => { ...@@ -90,6 +90,7 @@ const FieldNames = (props) => {
return ( return (
<div className={styles.fieldNames}> <div className={styles.fieldNames}>
<Select <Select
disabled={disabled}
onFocus={onFocus} onFocus={onFocus}
onChange={selectChange} onChange={selectChange}
style={{ width: '100%' }} style={{ width: '100%' }}
...@@ -109,7 +110,7 @@ const FieldNames = (props) => { ...@@ -109,7 +110,7 @@ const FieldNames = (props) => {
} }
</Select> </Select>
{ {
plusShow ? ( plusShow && !disabled ? (
<div className={styles.plus}> <div className={styles.plus}>
<PlusOutlined onClick={iconClick} /> <PlusOutlined onClick={iconClick} />
</div> </div>
......
import React, { useState, useRef } from 'react' import React, { useState, useRef, useMemo } from 'react'
import { Modal, Input, message, Dropdown, Menu, Tree } from 'antd' import { Modal, Input, message, Dropdown, Menu, Tree } from 'antd'
import styles from './index.less' import styles from './index.less'
import { ReloadTableFields, ruleValidation, getFormFieldHideDtos } from '../../../../../apis/process' import { ReloadTableFields, ruleValidation, getFormFieldHideDtos } from '../../../../../apis/process'
...@@ -13,7 +13,7 @@ const fnList = [ ...@@ -13,7 +13,7 @@ const fnList = [
const HiddenCondition = (props) => { const HiddenCondition = (props) => {
const { value, onChange, addons } = props const { value, onChange, addons, disabled } = props
const { tableNameParent } = addons.formData const { tableNameParent } = addons.formData
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [fieldList, setFieldList] = useState([]) const [fieldList, setFieldList] = useState([])
...@@ -101,6 +101,7 @@ const HiddenCondition = (props) => { ...@@ -101,6 +101,7 @@ const HiddenCondition = (props) => {
return ( return (
<div> <div>
<Input <Input
disabled={disabled}
value={value} value={value}
onClick={inputClick} onClick={inputClick}
/> />
......
import React, { useMemo, useState } from 'react' import React, { useMemo, useState } from 'react'
import { Input, Modal, Popover, Select, Dropdown, Menu } from 'antd' import { Input, Modal, Popover, Select, Dropdown, Menu } from 'antd'
import { PlusOutlined } from '@ant-design/icons' import { PlusOutlined } from '@ant-design/icons'
import styles from './index.less'
const options = [ const options = [
{ label: '本人姓名', key: '【本人姓名】' }, { label: '本人姓名', key: '【本人姓名】' },
...@@ -9,7 +10,7 @@ const options = [ ...@@ -9,7 +10,7 @@ const options = [
const InputDefault = (props) => { const InputDefault = (props) => {
const { value, onChange } = props const { value, onChange, addons, disabled } = props
const style = useMemo(() => { const style = useMemo(() => {
let paths = ['【本人姓名】', '【本人部门】'] let paths = ['【本人姓名】', '【本人部门】']
...@@ -28,13 +29,15 @@ const InputDefault = (props) => { ...@@ -28,13 +29,15 @@ const InputDefault = (props) => {
} }
return ( return (
<div className='InputDefault'> <div className={styles.inputDefault}>
<Input <Input
disabled={disabled}
allowClear allowClear
value={value} value={value}
onChange={inputChange} onChange={inputChange}
style={style} style={style}
addonAfter={ />
{!disabled ? (
<Dropdown <Dropdown
overlay={( overlay={(
<Menu <Menu
...@@ -43,10 +46,9 @@ const InputDefault = (props) => { ...@@ -43,10 +46,9 @@ const InputDefault = (props) => {
/> />
)} )}
> >
<PlusOutlined /> <div className={styles.addon}><PlusOutlined /></div>
</Dropdown> </Dropdown>
} ) : null}
/>
</div> </div>
) )
......
@import '~antd/es/style/themes/default.less';
.inputDefault {
position: relative;
.@{ant-prefix}-input-affix-wrapper-disabled {
background-color: #f8fafc;
border: none;
}
.@{ant-prefix}-input {
padding-right: 30px;
}
.addon {
position: absolute;
right: 10px;
top: 5px;
&:hover {
color: #4096ff;
}
}
}
\ No newline at end of file
...@@ -30,7 +30,7 @@ const options = [ ...@@ -30,7 +30,7 @@ const options = [
const VerifyTextInput = (props) => { const VerifyTextInput = (props) => {
const { value, onChange } = props const { value, onChange, disabled } = props
const valueShow = useMemo(() => { const valueShow = useMemo(() => {
return Array.isArray(value) && value.length ? value[0].pattern : null return Array.isArray(value) && value.length ? value[0].pattern : null
...@@ -47,6 +47,7 @@ const VerifyTextInput = (props) => { ...@@ -47,6 +47,7 @@ const VerifyTextInput = (props) => {
return ( return (
<Select <Select
disabled={disabled}
allowClear allowClear
value={valueShow} value={valueShow}
options={options} options={options}
......
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