Commit a007dc7c authored by 田翔's avatar 田翔

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

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