Commit a007dc7c authored by 田翔's avatar 田翔

选择器支持搜索,可编辑功能,日期,时间选择器支持配置

parent 00d395c0
......@@ -27,7 +27,8 @@ admin.get('/', function (req, res) {
app.use(['/admin', '/manager'], admin);
app.use(webpackHotMiddleware(compiler));
app.use(express.static(__dirname));
app.use('/', createProxyMiddleware('/', { target: 'http://127.0.0.1:8880', changeOrigin: true }));
// app.use('/', createProxyMiddleware('/', { target: 'http://127.0.0.1:8880', changeOrigin: true }));
app.use('/', createProxyMiddleware('/', { target: 'http://192.168.10.167:8088/', changeOrigin: true }));
// app.use('/', createProxyMiddleware('/', { target: 'http://192.168.10.178:8082', changeOrigin: true }));
// app.use('/', createProxyMiddleware('/', { target: 'http://192.168.10.167:8088/', changeOrigin: true }));
const port = process.env.PORT || 8888;
......
{
"name": "panda-xform",
"version": "1.4.9",
"description": "1.4.9: 下拉框形态修复",
"version": "1.5.0",
"description": "1.5.0: 选择器支持搜索,可编辑功能,日期,时间选择器支持配置",
"keywords": [
"panda-xform"
],
......@@ -47,9 +47,9 @@
"@babel/plugin-syntax-jsx": "^7.12.13",
"@babel/plugin-transform-modules-amd": "^7.14.5",
"@umijs/fabric": "^2.0.7",
"@wisdom-map/amap": "^1.0.49--27.11",
"@wisdom-map/arcgismap": "1.4.0-75",
"@wisdom-map/basemap": "1.1.0-14",
"@wisdom-map/amap": "1.1.0-beta.42",
"@wisdom-map/arcgismap": "1.4.0-92",
"@wisdom-map/basemap": "1.1.0-18",
"babel-loader": "^8.2.2",
"babel-plugin-import": "^1.13.3",
"check-prettier": "^1.0.3",
......
......@@ -652,6 +652,9 @@ const selectWidgets = [
required: true,
displayType: 'row',
labelWidth: 80,
// props: {
// disabled: true
// }
},
title: {
title: '标题',
......@@ -1632,7 +1635,28 @@ const selectWidgets = [
props: {
placeholder: '示例:部门="XX部门"'
}
}
},
groupStyle: {
title: '控件样式',
type: 'object',
properties: {}
},
width: {
title: '元素宽度',
type: 'string',
widget: 'percentSlider',
},
labelWidth: {
title: '标签宽度',
description: '默认值110',
default: 110,
type: 'number',
widget: 'slider',
max: 400,
props: {
hideNumber: true,
},
},
}
}
]
......@@ -1674,32 +1698,24 @@ const dateWidgets = [
type: 'string',
displayType: 'row',
labelWidth: 80,
default: '请选择日期',
},
presetValue: {
title: '默认值',
type: 'string',
widget: 'DateDefault',
format: '{{formData.format}}',
dateFormat: '{{formData.format}}',
displayType: 'row',
labelWidth: 80,
description: '勾选默认当前日期此处配置无效'
},
groupSetting: {
title: '控件设置',
groupVerify: {
title: '数据校验',
type: 'object',
properties: {}
},
format: {
title: '日期格式',
type: 'string',
// enum: ['date', 'dateTime', 'year', 'month', 'quarter', 'week'],
enum: ['date', 'dateTime', 'year', 'month'],
default: 'date',
enumNames: ['日期', '日期时间', '日期年份', '日期月份'],
displayType: 'row',
labelWidth: 80,
},
disabled: {
title: '只读',
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
......@@ -1710,34 +1726,73 @@ const dateWidgets = [
}
}
},
required: {
title: '必填',
currentDate: {
title: '不超过当前日期',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
width: '66%',
props: {
style: {
marginLeft: '10px',
}
}
},
hidden: {
title: '隐藏',
groupSetting: {
title: '控件设置',
type: 'object',
properties: {}
},
format: {
title: '日期格式',
type: 'string',
enum: ['date', 'dateTime', 'year', 'month', 'week', 'quarter'],
default: 'date',
enumNames: ['日期', '日期时间', '日期年份', '日期月份', '日期周', '日期季度'],
displayType: 'row',
labelWidth: 80,
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
width: '30%',
props: {
style: {
marginLeft: '10px',
}
}
},
hidden: {
title: '隐藏',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '25%',
// props: {
// style: {
// marginLeft: '10px',
// }
// }
},
defaultCurrent: {
title: '默认当前日期',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '45%',
// props: {
// style: {
// marginLeft: '10px',
// }
// }
},
groupStyle: {
title: '控件样式',
type: 'object',
properties: {
properties: {}
},
width: {
title: '元素宽度',
type: 'string',
......@@ -1754,8 +1809,6 @@ const dateWidgets = [
hideNumber: true,
},
},
}
},
},
},
{
......@@ -1795,6 +1848,7 @@ const dateWidgets = [
type: 'string',
displayType: 'row',
labelWidth: 80,
default: '请选择时间',
},
presetValue: {
title: '默认值',
......@@ -1803,11 +1857,82 @@ const dateWidgets = [
format: '{{formData.format}}',
displayType: 'row',
labelWidth: 80,
description: '勾选默认当前时间此处配置无效'
},
groupVerify: {
title: '数据校验',
type: 'object',
properties: {},
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
currentDate: {
title: '不超过当前时间',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '66%',
props: {
style: {
marginLeft: '10px',
}
}
},
groupSetting: {
title: '控件设置',
type: 'object',
properties: {},
},
format: {
title: '日期格式',
type: 'string',
enum: ['date', 'dateTime', 'year', 'month', 'week', 'quarter'],
default: 'date',
enumNames: ['日期', '日期时间', '日期年份', '日期月份', '日期周', '日期季度'],
displayType: 'row',
labelWidth: 80,
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '30%',
props: {
style: {
marginLeft: '10px',
}
}
},
hidden: {
title: '隐藏',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '25%',
},
defaultCurrent: {
title: '默认当前时间',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '45%',
},
groupStyle: {
title: '控件样式',
type: 'object',
properties: {
properties: {}
},
width: {
title: '元素宽度',
type: 'string',
......@@ -1826,8 +1951,6 @@ const dateWidgets = [
},
}
},
}
},
]
const fileWidgets = [
......@@ -1883,7 +2006,8 @@ const fileWidgets = [
enumNames: ['全部', '图片', '文档', '音频', '视频'],
default: '全部',
displayType: 'row',
labelWidth: 80,
labelWidth: 100,
// description: "{{formData.fileType === '图片' ? '支持bmp、gif、jpeg、tiff、png、svg、jpg格式': (formData.fileType === '文档' ? '支持docx,xlsx,pdf格式':(formData.fileType === '音频' ? '支持mp3格式' : (formData.fileType === '视频' ? '支持mp4格式':null )))}}",
},
disabled: {
title: '只读',
......
This diff is collapsed.
......@@ -7,36 +7,34 @@ import locale from 'antd/lib/date-picker/locale/zh_CN'
const DateTime = (props) => {
const { value, onChange, schema } = props
const { disabled, format, presetValue, placeholder, groupStyle } = schema
console.log('日期时间', props)
const { disabled, format, presetValue, placeholder, currentDate, defaultCurrent } = schema
const valueShow = useMemo(() => {
// console.log('value+presetValue', value, presetValue)
if (defaultCurrent) {
return (value || new Date()) ? moment(value || new Date()) : null
}
return (value || presetValue) ? moment(value || presetValue) : null
}, [presetValue, value])
}, [presetValue, defaultCurrent, value])
const disabledDate = (current) => {
if (schema.config === '不超过当前时间') {
return current && current > moment();
if (currentDate) {
return current && current > moment()
} else {
return false
}
}
const dateChange = (date, dateStr) => {
onChange(dateStr)
if (date && date._d) {
onChange(moment(date._d).format('YYYY-MM-DD HH:ss:mm'))
} else {
onChange(null)
}
const onOk = (value) => {
console.log('value', value)
}
// console.log('valueShow', valueShow)
return (
<DatePicker
disabledDate={disabledDate}
picker={format}
disabled={disabled}
placeholder={placeholder}
......@@ -46,7 +44,6 @@ const DateTime = (props) => {
showTime={format === 'dateTime'}
style={{ width: '100%' }}
locale={locale}
onOk={onOk}
/>
);
......
......@@ -7,20 +7,37 @@ const Time = (props) => {
console.log('props', props)
const { value, onChange, schema, addons } = props
const { presetValue } = schema
const { presetValue, currentDate, defaultCurrent } = schema
const valueShow = useMemo(() => {
if (defaultCurrent) {
return (value || new Date()) ? moment(value || new Date(), 'HH:mm:ss') : null
}
return (value || presetValue) ? moment(value || presetValue, 'HH:mm:ss') : null
}, [presetValue, value])
}, [presetValue, value, defaultCurrent])
const disabledDate = (current) => {
if (currentDate) {
return current && current.format('HH:mm:ss') > moment().format('HH:mm:ss')
} else {
return false
}
}
const timeChange = (time, timeStr) => {
onChange(timeStr)
}
return (
<TimePicker style={{ width: '100%' }} value={valueShow} onChange={timeChange} />
<TimePicker
style={{ width: '100%' }}
value={valueShow}
onChange={timeChange}
disabledDate={disabledDate}
/>
)
}
export default Time
\ No newline at end of file
......@@ -13,12 +13,12 @@ const ComboBox = ({ value, onChange, schema }) => {
const [site, setSite] = useState([])
const valueShow = useMemo(() => {
if (isMultiple) {
if (isMultiple || isEdit) {
return (value || presetValue) ? (value || presetValue).split(',') : []
} else {
return value || presetValue || null
}
}, [presetValue, value])
}, [isEdit, isMultiple, presetValue, value])
const enums = useMemo(() => {
switch (soruceType) {
......@@ -35,17 +35,23 @@ const ComboBox = ({ value, onChange, schema }) => {
}
}, [soruceType, options, dictionaryList, tableData, site])
const handleChange = value => {
if (isEdit) {
const children = useMemo(() => {
let children = []
if (Array.isArray(enums)) {
enums.forEach(v => {
children.push(<Option key={v}>{v}</Option>)
})
}
return children
}, [enums])
} else {
if (isMultiple) {
const handleChange = value => {
if (isMultiple || isEdit) {
onChange(value.join(','))
} else {
onChange(value)
}
}
}
const onFocus = async () => {
if (soruceType === '数据字典') {
......@@ -93,15 +99,16 @@ const ComboBox = ({ value, onChange, schema }) => {
<Select
onFocus={onFocus}
style={{ width: '100%' }}
mode={isMultiple ? 'multiple' : ''}
mode={isEdit ? 'tags' : (isMultiple ? 'multiple' : '')}
disabled={disabled}
showArrow={!disabled}
showSearch
value={valueShow}
placeholder={placeholder}
onChange={handleChange}
allowClear
>
{enums.map(v => <Option value={v} key={v}>{v}</Option>)}
{children}
</Select>
)
......
This diff is collapsed.
@import '~antd/es/style/themes/default.less';
.tableAccountClass {
.@{ant-prefix}-modal-body {
display: flex;
flex-direction: column;
padding: 15px 24px 0 24px;
.tableAccountEmpty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
}
}
......@@ -5,28 +5,23 @@ import locale from 'antd/lib/date-picker/locale/zh_CN'
const DateDefault = (props) => {
console.log('props', props)
const { onChange, addons, schema } = props
const { format } = schema
const { dateFormat } = schema
const dateChange = (date, dateStr) => {
onChange(dateStr)
if (date && date._d) {
onChange(moment(date._d).format('YYYY-MM-DD HH:ss:mm'))
} else {
onChange(null)
}
const onOk = (value) => {
console.log('value', value)
}
console.log('format', format)
if (format === 'dateTime') {
if (dateFormat === 'dateTime') {
return (
<DatePicker
picker={format}
picker={dateFormat}
// value={valueShow}
onChange={dateChange}
onOk={onOk}
// onOk={onOk}
showNow
showTime
style={{ width: '100%' }}
......@@ -37,12 +32,12 @@ const DateDefault = (props) => {
return (
<DatePicker
picker={format}
picker={dateFormat}
// value={valueShow}
onChange={dateChange}
onOk={onOk}
// onOk={onOk}
style={{ width: '100%' }}
locale={locale}
// locale={locale}
/>
)
......
......@@ -4,8 +4,6 @@ import { LoadLedgers } from '../../../../../apis/process'
const AccountName = (props) => {
console.log('props', props)
const { value, onChange } = props
const [options, setOptions] = useState([])
......
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