feat: update select
This commit is contained in:
@ -43,7 +43,7 @@ const TableList: React.FC = () => {
|
||||
const results = await getAllStaffList();
|
||||
setStaffOptions(
|
||||
results.map(it => ({
|
||||
label: it.staffName,
|
||||
label: `${it.staffName}${it.isDefault ? ' (默认)' : ''}`,
|
||||
isDefault: Boolean(it.isDefault),
|
||||
value: it.id,
|
||||
})),
|
||||
@ -108,10 +108,6 @@ const TableList: React.FC = () => {
|
||||
setCurrentRow(record);
|
||||
formRef.current?.setFieldsValue({
|
||||
...record,
|
||||
staff: {
|
||||
label: record.staffName,
|
||||
value: record.staffId,
|
||||
},
|
||||
city: {
|
||||
label: record.cityName,
|
||||
value: record.cityCode,
|
||||
@ -156,14 +152,13 @@ const TableList: React.FC = () => {
|
||||
title={`${currentRow ? '修改' : '新增'}城市`}
|
||||
width="400px"
|
||||
formRef={formRef}
|
||||
initialValues={{ staff: defaultStaff }}
|
||||
initialValues={{ staffId: defaultStaff?.value }}
|
||||
open={updateModalOpen}
|
||||
onOpenChange={handleUpdateModalOpen}
|
||||
onFinish={async formData => {
|
||||
const params: API.UpdateCityOperator = {
|
||||
id: currentRow?.id,
|
||||
staffId: formData.staff.value,
|
||||
staffName: formData.staff.label,
|
||||
staffId: formData.staffId,
|
||||
cityCode: formData.city.value,
|
||||
cityName: formData.city.label,
|
||||
groupLink: formData.groupLink,
|
||||
@ -184,9 +179,10 @@ const TableList: React.FC = () => {
|
||||
options={CITY_OPTIONS}
|
||||
rules={[{ required: true, message: '必填项' }]}
|
||||
/>
|
||||
<ProFormSelect.SearchSelect
|
||||
<ProFormSelect
|
||||
mode="single"
|
||||
name="staff"
|
||||
name="staffId"
|
||||
showSearch
|
||||
label="运营"
|
||||
options={staffOptions}
|
||||
rules={[{ required: true, message: '必填项' }]}
|
||||
|
||||
@ -7,15 +7,12 @@ import { clearToken, getToken, gotoLogin } from '@/utils/login';
|
||||
|
||||
import { IRequestResponse } from './types/http';
|
||||
|
||||
|
||||
/**
|
||||
* @name 全局请求配置
|
||||
* @doc https://umijs.org/docs/max/request#配置
|
||||
*/
|
||||
export const requestConfig: RequestConfig = {
|
||||
|
||||
|
||||
baseURL: (window.ENV?.BASE_URL || 'https://neighbourhood.cn') as string,
|
||||
baseURL: (window.ENV?.BASE_URL || 'https://dev.neighbourhood.cn') as string,
|
||||
// 错误处理: umi@3 的错误处理方案。
|
||||
errorConfig: {
|
||||
// 错误抛出
|
||||
|
||||
Reference in New Issue
Block a user