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