异动管理:列表目的地区域列与导出;新增/编辑其他目的地省-市级联
Made-with: Cursor
This commit is contained in:
@@ -13,6 +13,7 @@ const Component = function () {
|
||||
var Button = antd.Button;
|
||||
var Input = antd.Input;
|
||||
var Select = antd.Select;
|
||||
var Cascader = antd.Cascader;
|
||||
var DatePicker = antd.DatePicker;
|
||||
var Table = antd.Table;
|
||||
var Modal = antd.Modal;
|
||||
@@ -85,6 +86,15 @@ const Component = function () {
|
||||
];
|
||||
}, []);
|
||||
|
||||
// 省-市 2 级(与调拨管理筛选一致,原型数据)
|
||||
var destinationRegionOptions = useMemo(function () {
|
||||
return [
|
||||
{ value: 'zhejiang', label: '浙江省', children: [{ value: 'hangzhou', label: '杭州市' }, { value: 'ningbo', label: '宁波市' }, { value: 'jiaxing', label: '嘉兴市' }] },
|
||||
{ value: 'shanghai', label: '上海市', children: [{ value: 'shanghai', label: '上海市' }] },
|
||||
{ value: 'guangdong', label: '广东省', children: [{ value: 'guangzhou', label: '广州市' }, { value: 'shenzhen', label: '深圳市' }, { value: 'dongguan', label: '东莞市' }] }
|
||||
];
|
||||
}, []);
|
||||
|
||||
var changeTypeOptions = useMemo(function () {
|
||||
return [
|
||||
{ value: '维修', label: '维修' },
|
||||
@@ -106,7 +116,8 @@ const Component = function () {
|
||||
'1.1.异动开始日期:必填项,日期选择器,格式为:YYYY-MM-DD HH:MM;',
|
||||
'1.2.异动预计结束日期:必填项,日期选择器,格式为:YYYY-MM-DD HH:MM;',
|
||||
'1.3.异动目的地:必填项,选择器,选项为:停车场、维修站、其他;',
|
||||
'2.4.目的地名称:必填项,如异动目的地为停车场,则此处为停车场(选择器),如异动目的地为维修站,则此处为维修站(选择器),如异动目的地为其他,则此处为输入框(自定义输入);',
|
||||
'2.4.目的地名称:必填项,如异动目的地为停车场,则此处为停车场(选择器),如异动目的地为维修站,则此处为维修站(选择器),如异动目的地为其他,则先选目的地所在区域(省-市 2 级级联),再输入目的地名称;',
|
||||
'2.4.1.目的地所在区域:当异动目的地为「其他」时必填,级联选择器,省-市 2 级,展示在目的地名称前方;',
|
||||
'2.5.异动类型:必填项,选择器,选项为:维修、保养、年审、其他;',
|
||||
'2.6.备注:文本域,支持自定义输入;',
|
||||
'',
|
||||
@@ -130,6 +141,7 @@ const Component = function () {
|
||||
startTime: null,
|
||||
plannedEndTime: null,
|
||||
destinationType: undefined,
|
||||
destinationRegion: undefined,
|
||||
destinationName: undefined,
|
||||
destinationNameOther: '',
|
||||
changeType: undefined,
|
||||
@@ -235,6 +247,8 @@ const Component = function () {
|
||||
if (!form.plannedEndTime) e.plannedEndTime = '请选择异动预计结束日期';
|
||||
if (!form.destinationType) e.destinationType = '请选择异动目的地';
|
||||
if (form.destinationType === '其他') {
|
||||
var reg = form.destinationRegion;
|
||||
if (!reg || !Array.isArray(reg) || reg.length < 2) e.destinationRegion = '请选择目的地所在区域(省-市)';
|
||||
if (!String(form.destinationNameOther || '').trim()) e.destinationName = '请输入目的地名称';
|
||||
} else {
|
||||
if (!form.destinationName) e.destinationName = '请选择目的地名称';
|
||||
@@ -494,6 +508,7 @@ const Component = function () {
|
||||
setForm(function (p) {
|
||||
return Object.assign({}, p, {
|
||||
destinationType: v,
|
||||
destinationRegion: undefined,
|
||||
destinationName: undefined,
|
||||
destinationNameOther: ''
|
||||
});
|
||||
@@ -506,8 +521,22 @@ const Component = function () {
|
||||
errors.destinationType ? React.createElement('div', { style: { marginTop: 4, color: '#ff4d4f', fontSize: 12 } }, errors.destinationType) : null
|
||||
),
|
||||
|
||||
form.destinationType === '其他' ? React.createElement('div', { style: formItemStyle },
|
||||
React.createElement('div', { style: labelStyle }, reqStar, '目的地所在区域'),
|
||||
React.createElement(Cascader, {
|
||||
placeholder: '请选择省 / 市',
|
||||
style: controlStyle,
|
||||
options: destinationRegionOptions,
|
||||
value: form.destinationRegion,
|
||||
onChange: function (v) { updateForm({ destinationRegion: v }); },
|
||||
allowClear: true,
|
||||
changeOnSelect: false,
|
||||
status: errors.destinationRegion ? 'error' : undefined
|
||||
}),
|
||||
errors.destinationRegion ? React.createElement('div', { style: { marginTop: 4, color: '#ff4d4f', fontSize: 12 } }, errors.destinationRegion) : null
|
||||
) : undefined,
|
||||
React.createElement('div', { style: formItemStyle },
|
||||
React.createElement('div', { style: labelStyle }, reqStar, destinationNameLabel),
|
||||
React.createElement('div', { style: labelStyle }, reqStar, form.destinationType === '其他' ? '目的地名称' : destinationNameLabel),
|
||||
destinationNameNode,
|
||||
errors.destinationName ? React.createElement('div', { style: { marginTop: 4, color: '#ff4d4f', fontSize: 12 } }, errors.destinationName) : null
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user