提交 4faf0cdf 作者: 龚洪江

Merge branch 'master' into develop

#请求接口地址 #请求接口地址
#VITE_REQUEST_BASE_URL='https://www.iuav.shop' VITE_REQUEST_BASE_URL='https://www.iuav.shop'
VITE_REQUEST_BASE_URL='https://test.iuav.shop' #VITE_REQUEST_BASE_URL='https://test.iuav.shop'
#VITE_REQUEST_BASE_URL='/api' #VITE_REQUEST_BASE_URL='/api'
#旧版接口地址 #旧版接口地址
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn' #VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
......
...@@ -14,4 +14,4 @@ patches: ...@@ -14,4 +14,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/admin newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/admin
newTag: 657c23a46ef6de5cb873894e258f4783b330cd59 newTag: db08d3f7fa32fb28ac7ffbea891921f8fc26c780
...@@ -55,7 +55,7 @@ const SelectMapModal: FC<propType> = (props) => { ...@@ -55,7 +55,7 @@ const SelectMapModal: FC<propType> = (props) => {
} }
}; };
// 防抖 // 防抖
const handleSearchDebounced = debounce(handleSearch, 500); const handleSearchDebounced = debounce(handleSearch, 1000);
// 选择了地址 // 选择了地址
const handleSearchAddress = (e: number) => { const handleSearchAddress = (e: number) => {
if (!isNaN(e)) { if (!isNaN(e)) {
...@@ -118,8 +118,12 @@ const SelectMapModal: FC<propType> = (props) => { ...@@ -118,8 +118,12 @@ const SelectMapModal: FC<propType> = (props) => {
}); });
}} }}
onSearchAddress={(e) => { onSearchAddress={(e) => {
console.log('筛选e--->', e); // console.log('筛选e--->', e);
setAddressList(e.map((i, j) => ({ label: i.name, value: j, data: i, searchKey }))); setAddressList(
e
.filter((i) => (i.location as any) !== '')
.map((i, j) => ({ label: i.name, value: j, data: i, searchKey })),
);
}} }}
></MapComponent> ></MapComponent>
<div <div
......
import { Form, Input, InputNumber } from 'antd'; import { Form, Input } from 'antd';
interface Item { interface Item {
key: string; key: string;
......
...@@ -5,7 +5,7 @@ import { ...@@ -5,7 +5,7 @@ import {
listUserApplyTag, listUserApplyTag,
} from '~/api/interface/customManageType'; } from '~/api/interface/customManageType';
import { InterDataType, InterListType, InterReqType } from '~/api/interface'; import { InterDataType, InterListType, InterReqType } from '~/api/interface';
import { Button, Form, Input, message, Modal, Rate, Select, Space } from 'antd'; import { Button, Form, Input, message, Modal, Rate, Select } from 'antd';
import { CustomManageAPI } from '~/api'; import { CustomManageAPI } from '~/api';
import SelectMapModal from '~/components/select-map'; import SelectMapModal from '~/components/select-map';
...@@ -50,6 +50,7 @@ const AddEditModal: FC<propType> = (props) => { ...@@ -50,6 +50,7 @@ const AddEditModal: FC<propType> = (props) => {
form.setFieldsValue({ form.setFieldsValue({
...res.result, ...res.result,
name: res.result.name || data?.companyName, name: res.result.name || data?.companyName,
address: res.result.address || detail?.address,
}); });
setDetail(res.result); setDetail(res.result);
// console.log('获取审批详情 -->', res.result); // console.log('获取审批详情 -->', res.result);
...@@ -83,8 +84,8 @@ const AddEditModal: FC<propType> = (props) => { ...@@ -83,8 +84,8 @@ const AddEditModal: FC<propType> = (props) => {
const res = await CustomManageAPI.editUserApplyTag({ const res = await CustomManageAPI.editUserApplyTag({
id: Number(data?.id), id: Number(data?.id),
...detail, ...detail,
...values,
...address, ...address,
...values,
}); });
if (res && res.code === '200') { if (res && res.code === '200') {
message.success('操作成功'); message.success('操作成功');
...@@ -117,29 +118,25 @@ const AddEditModal: FC<propType> = (props) => { ...@@ -117,29 +118,25 @@ const AddEditModal: FC<propType> = (props) => {
> >
<Select placeholder='请选择加盟类型' allowClear options={cooperationList} disabled /> <Select placeholder='请选择加盟类型' allowClear options={cooperationList} disabled />
</Form.Item> </Form.Item>
<Form.Item <div style={{ display: 'flex' }}>
label='网点地址' <Form.Item
name='address' label='网点地址'
rules={[{ required: true, message: '请选择网点地址' }]} name='address'
> rules={[{ required: true, message: '请选择网点地址' }]}
<Space.Compact style={{ width: '100%' }}> style={{ width: '80%', marginLeft: '5%' }}
<Input >
placeholder='请选择网点地址' <Input placeholder='请选择网点地址' maxLength={50} allowClear />
maxLength={50} </Form.Item>
allowClear <Button
disabled type='primary'
value={form.getFieldValue('address') || detail?.address} onClick={() => {
/> setOpenAddress(true);
<Button }}
type='primary' style={{ transform: 'translateX(-50px)' }}
onClick={() => { >
setOpenAddress(true); 选择位置
}} </Button>
> </div>
选择位置
</Button>
</Space.Compact>
</Form.Item>
<Form.Item <Form.Item
label='服务资质' label='服务资质'
name='content' name='content'
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
line-height: 20px; line-height: 20px;
&:before{ //&:before{
content: '*'; // content: '*';
color: red; // color: red;
} //}
} }
&-table{ &-table{
......
...@@ -15,11 +15,9 @@ type ColumnTypes = Exclude<EditableTableProps['columns'], undefined>; ...@@ -15,11 +15,9 @@ type ColumnTypes = Exclude<EditableTableProps['columns'], undefined>;
type tableDataType = { type tableDataType = {
gradeId: number; gradeId: number;
id: number; id: number;
mainImage: string;
modelsId: number; modelsId: number;
price: number; price: number;
typeId: number; typeId: number;
fileList: any[];
}; };
//机型下拉返回类型 //机型下拉返回类型
type modelsListType = InterDataType<licenceModelsListType>; type modelsListType = InterDataType<licenceModelsListType>;
...@@ -49,6 +47,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -49,6 +47,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
return Promise.reject(new Error('价格大于0且小于10万')); return Promise.reject(new Error('价格大于0且小于10万'));
} }
} else { } else {
if (value === undefined || value === '' || value === null) {
return Promise.resolve();
}
return Promise.reject(new Error('价格为数字且保留小数点后两位')); return Promise.reject(new Error('价格为数字且保留小数点后两位'));
} }
return Promise.resolve(); return Promise.resolve();
...@@ -67,15 +68,15 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -67,15 +68,15 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
render: (_text: string, _record, index: number) => index + 1, render: (_text: string, _record, index: number) => index + 1,
width: '10%', width: '10%',
}, },
{ // {
title: '培训主图', // title: '培训主图',
align: 'center', // align: 'center',
dataIndex: 'mainImage', // dataIndex: 'mainImage',
width: '10%', // width: '10%',
inputType: 'uploader', // inputType: 'uploader',
editable: true, // editable: true,
rules: [{ required: true, message: '请上传培训主图' }], // rules: [{ required: true, message: '请上传培训主图' }],
}, // },
{ {
title: '培训机型', title: '培训机型',
align: 'center', align: 'center',
...@@ -84,7 +85,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -84,7 +85,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
inputType: 'select', inputType: 'select',
width: '15%', width: '15%',
selectOption: modelsList, selectOption: modelsList,
rules: [{ required: true, message: '请选择培训机型' }], // rules: [{ required: true, message: '请选择培训机型' }],
}, },
{ {
title: '培训等级', title: '培训等级',
...@@ -94,7 +95,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -94,7 +95,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
inputType: 'select', inputType: 'select',
width: '15%', width: '15%',
selectOption: gradeList, selectOption: gradeList,
rules: [{ required: true, message: '请选择培训等级' }], // rules: [{ required: true, message: '请选择培训等级' }],
}, },
{ {
title: '培训类型', title: '培训类型',
...@@ -104,7 +105,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -104,7 +105,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
inputType: 'select', inputType: 'select',
width: '15%', width: '15%',
selectOption: typeList, selectOption: typeList,
rules: [{ required: true, message: '请选择培训类型' }], // rules: [{ required: true, message: '请选择培训类型' }],
}, },
{ {
title: '培训价格', title: '培训价格',
...@@ -112,7 +113,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -112,7 +113,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
editable: true, editable: true,
dataIndex: 'price', dataIndex: 'price',
width: '12%', width: '12%',
rules: [{ required: true, validator: priceValidator }], rules: [{ required: false, validator: priceValidator }],
}, },
{ {
title: '操作', title: '操作',
...@@ -160,7 +161,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -160,7 +161,7 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
editing: true, editing: true,
selectOption: col.selectOption, selectOption: col.selectOption,
inputType: col.inputType, inputType: col.inputType,
uploadSuccess: col.inputType === 'uploader' ? uploadSuccess : undefined, // uploadSuccess: col.inputType === 'uploader' ? uploadSuccess : undefined,
rules: col.rules, rules: col.rules,
}), }),
}; };
...@@ -169,11 +170,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -169,11 +170,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
{ {
id: Math.random(), id: Math.random(),
gradeId: -1, gradeId: -1,
mainImage: '',
modelsId: -1, modelsId: -1,
price: -1, price: -1,
typeId: -1, typeId: -1,
fileList: [],
}, },
]); ]);
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
...@@ -191,11 +190,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -191,11 +190,9 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
{ {
id: Math.random(), id: Math.random(),
gradeId: -1, gradeId: -1,
mainImage: '',
modelsId: -1, modelsId: -1,
price: -1, price: -1,
typeId: -1, typeId: -1,
fileList: [],
}, },
]); ]);
}; };
...@@ -206,13 +203,13 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => { ...@@ -206,13 +203,13 @@ const SkuInfo: FC<selfProps> = forwardRef((_props, ref) => {
setTableData([...tableData]); setTableData([...tableData]);
}; };
//主图上传 //主图上传
const uploadSuccess = (record: tableDataType, result: any) => { // const uploadSuccess = (record: tableDataType, result: any) => {
const index: number = tableData.findIndex((v) => v.id === record.id); // const index: number = tableData.findIndex((v) => v.id === record.id);
skuForm.setFieldValue('mainImage' + record.id, result[0].url); // skuForm.setFieldValue('mainImage' + record.id, result[0].url);
tableData[index].mainImage = result[0].url; // tableData[index].mainImage = result[0].url;
tableData[index].fileList = result; // tableData[index].fileList = result;
setTableData([...tableData]); // setTableData([...tableData]);
}; // };
//培训机型下拉 //培训机型下拉
const getLicenceModelsList = () => { const getLicenceModelsList = () => {
PilotTrainAPI.getLicenceModelsList().then(({ result }) => { PilotTrainAPI.getLicenceModelsList().then(({ result }) => {
......
...@@ -46,14 +46,23 @@ const AddOrEditInstitution = () => { ...@@ -46,14 +46,23 @@ const AddOrEditInstitution = () => {
if (!introduceInfo) { if (!introduceInfo) {
return message.warning('机构介绍不能为空'); return message.warning('机构介绍不能为空');
} }
const skuReqData = skuRef.current.getTableData().map((v: tableDataType) => { const skuReqData = skuRef.current.getTableData().reduce((list: any, v: tableDataType) => {
return Object.getOwnPropertyNames(v).reduce((pre: any, cur: string) => { const Obj = Object.getOwnPropertyNames(v).reduce((pre: any, cur: string) => {
if (Object.getOwnPropertyNames(value[1]).includes(cur + v.id)) { if (Object.getOwnPropertyNames(value[1]).includes(cur + v.id)) {
pre[cur] = value[1][cur + v.id]; pre[cur] = value[1][cur + v.id];
} }
return pre; return pre;
}, {}); }, {});
}); if (
Object.getOwnPropertyNames(Obj).length &&
!Object.getOwnPropertyNames(Obj).every(
(key: string) => Obj[key] === '' || Obj[key] === undefined || Obj[key] === null,
)
) {
list.push(Obj);
}
return list;
}, []);
PilotTrainAPI[institutionId ? 'updateOrg' : 'insertOrg']({ PilotTrainAPI[institutionId ? 'updateOrg' : 'insertOrg']({
...value[0], ...value[0],
trainingProgramsVOS: skuReqData, trainingProgramsVOS: skuReqData,
...@@ -139,27 +148,22 @@ const AddOrEditInstitution = () => { ...@@ -139,27 +148,22 @@ const AddOrEditInstitution = () => {
] ]
: [], : [],
); );
const programsList = institutionDetail.programsDOList.map((v) => ({ if (institutionDetail.programsDOList) {
...v, const programsList = institutionDetail.programsDOList.map((v) => ({
fileList: [ ...v,
{ }));
id: Math.random(), skuRef.current.setDefaultDataEvent().setDefaultTableData(programsList);
uid: Math.random(), const skuObj = institutionDetail.programsDOList.reduce((pre: any, cur: any) => {
name: 'img', Object.getOwnPropertyNames(cur)
url: v.mainImage, .filter((key: string) => key !== 'id')
}, .forEach((v: string) => {
], pre[v + cur.id] = cur[v];
})); });
skuRef.current.setDefaultDataEvent().setDefaultTableData(programsList); return pre;
const skuObj = institutionDetail.programsDOList.reduce((pre: any, cur: any) => { }, {});
Object.getOwnPropertyNames(cur) skuRef.current.getForm().setFieldsValue(skuObj);
.filter((key: string) => key !== 'id') }
.forEach((v: string) => {
pre[v + cur.id] = cur[v];
});
return pre;
}, {});
skuRef.current.getForm().setFieldsValue(skuObj);
setIntroduceInfo(institutionDetail.detail); setIntroduceInfo(institutionDetail.detail);
} }
}, [institutionDetail]); }, [institutionDetail]);
......
...@@ -79,12 +79,19 @@ const InstitutionsList = () => { ...@@ -79,12 +79,19 @@ const InstitutionsList = () => {
{ {
title: '培训类型', title: '培训类型',
align: 'center', align: 'center',
render: (_text: string, record) => render: (_text: string, record: any) =>
record.programsDOList[0].gradeName + record.programsDOList
'/' + ? Object.getOwnPropertyNames(record.programsDOList[0])
record.programsDOList[0].modelsName + .filter(
'/' + (key: string) =>
record.programsDOList[0].typeName, ['gradeName', 'modelsName', 'typeName'].includes(key) &&
record.programsDOList[0][key] !== undefined &&
record.programsDOList[0][key] !== '' &&
record.programsDOList[0][key] !== null,
)
.map((key: string) => record.programsDOList[0][key])
.join('/')
: '',
width: '20%', width: '20%',
}, },
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论