fix(dealer): 移除楼层字段优化房号相关逻辑及表单
- 删除楼层相关代码及状态管理 - 更新房号唯一键及展示逻辑,去除楼层字段 - 表单中楼层输入改为普通输入框,禁用编辑状态 - 修正提交及校验逻辑,统一房号字段处理 - 简化编辑模式房号数据回填过程 - 移除小区、楼栋、单元、楼层、房号弹出选择组件及相关逻辑 - 更改提示文案,从“请选择”改为“请填写”房号相关项
This commit is contained in:
@@ -16,8 +16,6 @@ import {
|
||||
} from "@/utils/dateUtils";
|
||||
import {ShopDealerUser} from "@/api/shop/shopDealerUser/model";
|
||||
import {getShopDealerUser, pageShopDealerUser} from "@/api/shop/shopDealerUser";
|
||||
import {listDictData} from "@/api/system/dict-data";
|
||||
import type {DictData} from "@/api/system/dict-data/model";
|
||||
|
||||
const AddShopDealerApply = () => {
|
||||
const {params} = useRouter();
|
||||
@@ -32,22 +30,20 @@ const AddShopDealerApply = () => {
|
||||
const DUP_CHECK_MAX_PAGES = 50;
|
||||
|
||||
// 房号信息:用 dealerCode 存储唯一键,dealerName 存储展示文案
|
||||
const buildHouseKey = (community: string, buildingNo: string, unitNo: string | undefined, floorNo: string | undefined, roomNo: string) => {
|
||||
const buildHouseKey = (community: string, buildingNo: string, unitNo: string | undefined, roomNo: string) => {
|
||||
const c = (community || '').trim();
|
||||
const b = (buildingNo || '').trim();
|
||||
const u = (unitNo || '').trim();
|
||||
const f = (floorNo || '').trim();
|
||||
const r = (roomNo || '').trim();
|
||||
return [c, b, u, f, r].join('|');
|
||||
return [c, b, u, r].join('|');
|
||||
};
|
||||
|
||||
const buildHouseDisplay = (community: string, buildingNo: string, unitNo: string | undefined, floorNo: string | undefined, roomNo: string) => {
|
||||
const buildHouseDisplay = (community: string, buildingNo: string, unitNo: string | undefined, roomNo: string) => {
|
||||
const c = (community || '').trim();
|
||||
const b = (buildingNo || '').trim();
|
||||
const u = (unitNo || '').trim();
|
||||
const f = (floorNo || '').trim();
|
||||
const r = (roomNo || '').trim();
|
||||
return `${c}${b ? `${b}栋` : ''}${u ? `${u}单元` : ''}${f ? `${f}楼` : ''}${r ? `${r}号` : ''}`;
|
||||
return `${c}${b ? `${b}栋` : ''}${u ? `${u}单元` : ''}${r ? `${r}号` : ''}`;
|
||||
};
|
||||
|
||||
const parseHouseKey = (key?: string) => {
|
||||
@@ -56,8 +52,7 @@ const AddShopDealerApply = () => {
|
||||
community: parts[0] || '',
|
||||
buildingNo: parts[1] || '',
|
||||
unitNo: parts[2] || '',
|
||||
floorNo: parts[3] || '',
|
||||
roomNo: parts[4] || '',
|
||||
roomNo: parts[3] || '',
|
||||
};
|
||||
};
|
||||
|
||||
@@ -74,41 +69,6 @@ const AddShopDealerApply = () => {
|
||||
const [receptionistLoading, setReceptionistLoading] = useState<boolean>(false)
|
||||
const [selectedReceptionist, setSelectedReceptionist] = useState<ShopDealerUser | null>(null)
|
||||
|
||||
// 小区选择状态
|
||||
const [showCommunityPicker, setShowCommunityPicker] = useState<boolean>(false)
|
||||
const [communitySearch, setCommunitySearch] = useState<string>('')
|
||||
const [communityList, setCommunityList] = useState<DictData[]>([])
|
||||
const [communityLoading, setCommunityLoading] = useState<boolean>(false)
|
||||
const [selectedCommunity, setSelectedCommunity] = useState<DictData | null>(null)
|
||||
|
||||
// 楼栋选择状态
|
||||
const [showBuildingPicker, setShowBuildingPicker] = useState<boolean>(false)
|
||||
const [buildingSearch, setBuildingSearch] = useState<string>('')
|
||||
const [buildingList, setBuildingList] = useState<DictData[]>([])
|
||||
const [buildingLoading, setBuildingLoading] = useState<boolean>(false)
|
||||
const [selectedBuilding, setSelectedBuilding] = useState<DictData | null>(null)
|
||||
|
||||
// 单元选择状态
|
||||
const [showUnitPicker, setShowUnitPicker] = useState<boolean>(false)
|
||||
const [unitSearch, setUnitSearch] = useState<string>('')
|
||||
const [unitList, setUnitList] = useState<DictData[]>([])
|
||||
const [unitLoading, setUnitLoading] = useState<boolean>(false)
|
||||
const [selectedUnit, setSelectedUnit] = useState<DictData | null>(null)
|
||||
|
||||
// 楼层选择状态
|
||||
const [showFloorPicker, setShowFloorPicker] = useState<boolean>(false)
|
||||
const [floorSearch, setFloorSearch] = useState<string>('')
|
||||
const [floorList, setFloorList] = useState<DictData[]>([])
|
||||
const [floorLoading, setFloorLoading] = useState<boolean>(false)
|
||||
const [selectedFloor, setSelectedFloor] = useState<DictData | null>(null)
|
||||
|
||||
// 房号选择状态
|
||||
const [showRoomPicker, setShowRoomPicker] = useState<boolean>(false)
|
||||
const [roomSearch, setRoomSearch] = useState<string>('')
|
||||
const [roomList, setRoomList] = useState<DictData[]>([])
|
||||
const [roomLoading, setRoomLoading] = useState<boolean>(false)
|
||||
const [selectedRoom, setSelectedRoom] = useState<DictData | null>(null)
|
||||
|
||||
// 获取审核状态文字
|
||||
const getApplyStatusText = (status?: number) => {
|
||||
switch (status) {
|
||||
@@ -123,6 +83,8 @@ const AddShopDealerApply = () => {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(getApplyStatusText)
|
||||
|
||||
// 处理签约时间选择
|
||||
const handleApplyTimeConfirm = (param: string) => {
|
||||
const selectedDate = param[3] // 选中的日期字符串 (YYYY-M-D)
|
||||
@@ -234,278 +196,6 @@ const AddShopDealerApply = () => {
|
||||
setSelectedReceptionist(null)
|
||||
}
|
||||
|
||||
// 加载小区列表
|
||||
const loadCommunityList = async (keyword?: string) => {
|
||||
setCommunityLoading(true)
|
||||
try {
|
||||
const list = await listDictData({ dictCode: 'xiaoqu' })
|
||||
// 过滤搜索关键词
|
||||
if (keyword) {
|
||||
setCommunityList(list.filter((item: DictData) =>
|
||||
(item.dictDataName || '').includes(keyword) ||
|
||||
(item.label || '').includes(keyword)
|
||||
))
|
||||
} else {
|
||||
setCommunityList(list)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载小区列表失败:', e)
|
||||
} finally {
|
||||
setCommunityLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开小区选择
|
||||
const openCommunityPicker = () => {
|
||||
setCommunitySearch('')
|
||||
loadCommunityList()
|
||||
setShowCommunityPicker(true)
|
||||
}
|
||||
|
||||
// 搜索小区
|
||||
const handleCommunitySearch = (val: string) => {
|
||||
setCommunitySearch(val)
|
||||
loadCommunityList(val)
|
||||
}
|
||||
|
||||
// 选择小区
|
||||
const handleSelectCommunity = (item: DictData) => {
|
||||
setSelectedCommunity(item)
|
||||
setShowCommunityPicker(false)
|
||||
// 更新表单数据
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
address: item.dictDataName || item.label || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 清除小区
|
||||
const handleClearCommunity = () => {
|
||||
setSelectedCommunity(null)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
address: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 加载楼栋列表
|
||||
const loadBuildingList = async (keyword?: string) => {
|
||||
setBuildingLoading(true)
|
||||
try {
|
||||
const list = await listDictData({ dictCode: 'building' })
|
||||
if (keyword) {
|
||||
setBuildingList(list.filter((item: DictData) =>
|
||||
(item.dictDataName || '').includes(keyword) ||
|
||||
(item.label || '').includes(keyword)
|
||||
))
|
||||
} else {
|
||||
setBuildingList(list)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载楼栋列表失败:', e)
|
||||
} finally {
|
||||
setBuildingLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开楼栋选择
|
||||
const openBuildingPicker = () => {
|
||||
setBuildingSearch('')
|
||||
loadBuildingList()
|
||||
setShowBuildingPicker(true)
|
||||
}
|
||||
|
||||
// 搜索楼栋
|
||||
const handleBuildingSearch = (val: string) => {
|
||||
setBuildingSearch(val)
|
||||
loadBuildingList(val)
|
||||
}
|
||||
|
||||
// 选择楼栋
|
||||
const handleSelectBuilding = (item: DictData) => {
|
||||
setSelectedBuilding(item)
|
||||
setShowBuildingPicker(false)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
buildingNo: item.dictDataName || item.label || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 清除楼栋
|
||||
const handleClearBuilding = () => {
|
||||
setSelectedBuilding(null)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
buildingNo: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 加载单元列表
|
||||
const loadUnitList = async (keyword?: string) => {
|
||||
setUnitLoading(true)
|
||||
try {
|
||||
const list = await listDictData({ dictCode: 'unit' })
|
||||
if (keyword) {
|
||||
setUnitList(list.filter((item: DictData) =>
|
||||
(item.dictDataName || '').includes(keyword) ||
|
||||
(item.label || '').includes(keyword)
|
||||
))
|
||||
} else {
|
||||
setUnitList(list)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载单元列表失败:', e)
|
||||
} finally {
|
||||
setUnitLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开单元选择
|
||||
const openUnitPicker = () => {
|
||||
setUnitSearch('')
|
||||
loadUnitList()
|
||||
setShowUnitPicker(true)
|
||||
}
|
||||
|
||||
// 搜索单元
|
||||
const handleUnitSearch = (val: string) => {
|
||||
setUnitSearch(val)
|
||||
loadUnitList(val)
|
||||
}
|
||||
|
||||
// 选择单元
|
||||
const handleSelectUnit = (item: DictData) => {
|
||||
setSelectedUnit(item)
|
||||
setShowUnitPicker(false)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
unitNo: item.dictDataName || item.label || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 清除单元
|
||||
const handleClearUnit = () => {
|
||||
setSelectedUnit(null)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
unitNo: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 加载楼层列表
|
||||
const loadFloorList = async (keyword?: string) => {
|
||||
setFloorLoading(true)
|
||||
try {
|
||||
const list = await listDictData({ dictCode: 'floor' })
|
||||
if (keyword) {
|
||||
setFloorList(list.filter((item: DictData) =>
|
||||
(item.dictDataName || '').includes(keyword) ||
|
||||
(item.label || '').includes(keyword)
|
||||
))
|
||||
} else {
|
||||
setFloorList(list)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载楼层列表失败:', e)
|
||||
} finally {
|
||||
setFloorLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开楼层选择
|
||||
const openFloorPicker = () => {
|
||||
setFloorSearch('')
|
||||
loadFloorList()
|
||||
setShowFloorPicker(true)
|
||||
}
|
||||
|
||||
// 搜索楼层
|
||||
const handleFloorSearch = (val: string) => {
|
||||
setFloorSearch(val)
|
||||
loadFloorList(val)
|
||||
}
|
||||
|
||||
// 选择楼层
|
||||
const handleSelectFloor = (item: DictData) => {
|
||||
setSelectedFloor(item)
|
||||
setShowFloorPicker(false)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
floorNo: item.dictDataName || item.label || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 清除楼层
|
||||
const handleClearFloor = () => {
|
||||
setSelectedFloor(null)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
floorNo: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 加载房号列表
|
||||
const loadRoomList = async (keyword?: string) => {
|
||||
setRoomLoading(true)
|
||||
try {
|
||||
const list = await listDictData({ dictCode: 'room' })
|
||||
if (keyword) {
|
||||
setRoomList(list.filter((item: DictData) =>
|
||||
(item.dictDataName || '').includes(keyword) ||
|
||||
(item.label || '').includes(keyword)
|
||||
))
|
||||
} else {
|
||||
setRoomList(list)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载房号列表失败:', e)
|
||||
} finally {
|
||||
setRoomLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开房号选择
|
||||
const openRoomPicker = () => {
|
||||
setRoomSearch('')
|
||||
loadRoomList()
|
||||
setShowRoomPicker(true)
|
||||
}
|
||||
|
||||
// 搜索房号
|
||||
const handleRoomSearch = (val: string) => {
|
||||
setRoomSearch(val)
|
||||
loadRoomList(val)
|
||||
}
|
||||
|
||||
// 选择房号
|
||||
const handleSelectRoom = (item: DictData) => {
|
||||
setSelectedRoom(item)
|
||||
setShowRoomPicker(false)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
roomNo: item.dictDataName || item.label || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 清除房号
|
||||
const handleClearRoom = () => {
|
||||
setSelectedRoom(null)
|
||||
if (formRef.current) {
|
||||
formRef.current.setFieldsValue({
|
||||
roomNo: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
// 计算保护期过期时间(15天后)
|
||||
const calculateExpirationTime = (): string => {
|
||||
@@ -579,14 +269,13 @@ const AddShopDealerApply = () => {
|
||||
return s.replace(/\s+/g, '').toUpperCase();
|
||||
};
|
||||
|
||||
const normalizeHouseNoPart = (raw: string, kind: 'building' | 'unit' | 'floor' | 'room') => {
|
||||
const normalizeHouseNoPart = (raw: string, kind: 'building' | 'unit' | 'room') => {
|
||||
let s = toHalfWidth(normalizeText(raw)).toUpperCase();
|
||||
s = s.replace(/\s+/g, '');
|
||||
|
||||
// 去掉常见后缀/装饰词
|
||||
if (kind === 'building') s = s.replace(/(号楼|栋|幢|楼)$/g, '');
|
||||
if (kind === 'unit') s = s.replace(/(单元)$/g, '');
|
||||
if (kind === 'floor') s = s.replace(/(楼|层)$/g, '');
|
||||
if (kind === 'room') s = s.replace(/(室|房|号)$/g, '');
|
||||
|
||||
// 只保留数字与字母,统一分隔符差异(如 12-01 / 12#01)
|
||||
@@ -601,13 +290,12 @@ const AddShopDealerApply = () => {
|
||||
return s;
|
||||
};
|
||||
|
||||
const buildHouseKeyNormalized = (community: string, buildingNo: string, unitNo: string | undefined, floorNo: string | undefined, roomNo: string) => {
|
||||
const buildHouseKeyNormalized = (community: string, buildingNo: string, unitNo: string | undefined, roomNo: string) => {
|
||||
const c = normalizeCommunity(community);
|
||||
const b = normalizeHouseNoPart(buildingNo, 'building');
|
||||
const u = normalizeHouseNoPart(unitNo || '', 'unit');
|
||||
const f = normalizeHouseNoPart(floorNo || '', 'floor');
|
||||
const r = normalizeHouseNoPart(roomNo, 'room');
|
||||
return [c, b, u, f, r].join('|');
|
||||
return [c, b, u, r].join('|');
|
||||
};
|
||||
|
||||
const getNormalizedHouseKeyFromApply = (apply: ShopDealerApply) => {
|
||||
@@ -616,7 +304,6 @@ const AddShopDealerApply = () => {
|
||||
parsed.community || apply.address || '',
|
||||
parsed.buildingNo || '',
|
||||
parsed.unitNo || '',
|
||||
parsed.floorNo || '',
|
||||
parsed.roomNo || ''
|
||||
);
|
||||
};
|
||||
@@ -660,15 +347,11 @@ const AddShopDealerApply = () => {
|
||||
return;
|
||||
}
|
||||
if (!values.buildingNo || values.buildingNo.trim() === '') {
|
||||
Taro.showToast({title: '请选择楼栋', icon: 'error'});
|
||||
return;
|
||||
}
|
||||
if (!values.floorNo || values.floorNo.trim() === '') {
|
||||
Taro.showToast({title: '请选择楼层', icon: 'error'});
|
||||
Taro.showToast({title: '请填写楼栋号', icon: 'error'});
|
||||
return;
|
||||
}
|
||||
if (!values.roomNo || values.roomNo.trim() === '') {
|
||||
Taro.showToast({title: '请选择房号', icon: 'error'});
|
||||
Taro.showToast({title: '请填写房号', icon: 'error'});
|
||||
return;
|
||||
}
|
||||
if (!values.realName || values.realName.trim() === '') {
|
||||
@@ -723,10 +406,10 @@ const AddShopDealerApply = () => {
|
||||
? reporterDealerUser.refereeId
|
||||
: undefined;
|
||||
|
||||
const houseKeyRaw = buildHouseKey(values.address, values.buildingNo, values.unitNo, values.floorNo, values.roomNo);
|
||||
const houseKeyNormalized = buildHouseKeyNormalized(values.address, values.buildingNo, values.unitNo, values.floorNo, values.roomNo);
|
||||
const houseKeyRaw = buildHouseKey(values.address, values.buildingNo, values.unitNo, values.roomNo);
|
||||
const houseKeyNormalized = buildHouseKeyNormalized(values.address, values.buildingNo, values.unitNo, values.roomNo);
|
||||
const houseKey = houseKeyNormalized || houseKeyRaw;
|
||||
const houseDisplay = buildHouseDisplay(values.address, values.buildingNo, values.unitNo, values.floorNo, values.roomNo);
|
||||
const houseDisplay = buildHouseDisplay(values.address, values.buildingNo, values.unitNo, values.roomNo);
|
||||
|
||||
// 新增报备:提交前检查房号是否已报备(按 小区+楼栋+单元+房号 判断,且做规范化)
|
||||
if (!isEditMode) {
|
||||
@@ -803,8 +486,8 @@ const AddShopDealerApply = () => {
|
||||
const expirationTime = isEditMode ? existingApply?.expirationTime : calculateExpirationTime();
|
||||
|
||||
// 准备提交的数据
|
||||
// 避免把表单里的楼栋/单元/楼层/房号等临时字段原样提交给后端
|
||||
const {buildingNo, unitNo, floorNo, roomNo, ...restValues} = values;
|
||||
// 避免把表单里的楼栋/单元/房号等临时字段原样提交给后端
|
||||
const {buildingNo, unitNo, roomNo, ...restValues} = values;
|
||||
const submitData = {
|
||||
...restValues,
|
||||
type: 4,
|
||||
@@ -891,55 +574,18 @@ const AddShopDealerApply = () => {
|
||||
})
|
||||
}, []); // 依赖用户ID,当用户变化时重新加载
|
||||
|
||||
// 编辑模式下,从 dealerCode 反解出楼栋/单元/楼层/房号,回填表单(只读展示)
|
||||
// 编辑模式下,从 dealerCode 反解出楼栋/单元/房号,回填表单(只读展示)
|
||||
useEffect(() => {
|
||||
if (!formRef.current || !FormData) return;
|
||||
const parsed = parseHouseKey(FormData.dealerCode);
|
||||
const communityValue = parsed.community || FormData.address || '';
|
||||
formRef.current.setFieldsValue({
|
||||
address: communityValue,
|
||||
address: parsed.community || FormData.address,
|
||||
buildingNo: parsed.buildingNo,
|
||||
unitNo: parsed.unitNo,
|
||||
floorNo: parsed.floorNo,
|
||||
roomNo: parsed.roomNo,
|
||||
realName: FormData.realName,
|
||||
mobile: FormData.mobile
|
||||
});
|
||||
// 回填小区选中状态
|
||||
if (communityValue) {
|
||||
setSelectedCommunity({
|
||||
dictDataName: communityValue,
|
||||
label: communityValue
|
||||
} as DictData)
|
||||
}
|
||||
// 回填楼栋选中状态
|
||||
if (parsed.buildingNo) {
|
||||
setSelectedBuilding({
|
||||
dictDataName: parsed.buildingNo,
|
||||
label: parsed.buildingNo
|
||||
} as DictData)
|
||||
}
|
||||
// 回填单元选中状态
|
||||
if (parsed.unitNo) {
|
||||
setSelectedUnit({
|
||||
dictDataName: parsed.unitNo,
|
||||
label: parsed.unitNo
|
||||
} as DictData)
|
||||
}
|
||||
// 回填楼层选中状态
|
||||
if (parsed.floorNo) {
|
||||
setSelectedFloor({
|
||||
dictDataName: parsed.floorNo,
|
||||
label: parsed.floorNo
|
||||
} as DictData)
|
||||
}
|
||||
// 回填房号选中状态
|
||||
if (parsed.roomNo) {
|
||||
setSelectedRoom({
|
||||
dictDataName: parsed.roomNo,
|
||||
label: parsed.roomNo
|
||||
} as DictData)
|
||||
}
|
||||
}, [FormData]);
|
||||
|
||||
if (loading) {
|
||||
@@ -956,156 +602,7 @@ const AddShopDealerApply = () => {
|
||||
onFinish={(values) => submitSucceed(values)}
|
||||
onFinishFailed={(errors) => submitFailed(errors)}
|
||||
>
|
||||
<View className={'bg-gray-100 h-3'}></View>
|
||||
<CellGroup style={{padding: '4px 0'}}>
|
||||
<Cell
|
||||
title="小区"
|
||||
required={true}
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedCommunity ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">
|
||||
{selectedCommunity.dictDataName || selectedCommunity.label}
|
||||
</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearCommunity(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择小区</Text>
|
||||
)}
|
||||
<ArrowRight size={14} color="#ccc"/>
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openCommunityPicker}
|
||||
/>
|
||||
{/* 隐藏字段,通过 ref.setFieldsValue 设置 */}
|
||||
<Form.Item name="address" style={{display: 'none'}}>
|
||||
<View />
|
||||
</Form.Item>
|
||||
{/* 楼栋选择 */}
|
||||
<Cell
|
||||
title="楼栋"
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedBuilding ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">{selectedBuilding.dictDataName || selectedBuilding.label}</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearBuilding(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择</Text>
|
||||
)}
|
||||
{!isEditMode && <ArrowRight size={14} color="#ccc"/>}
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openBuildingPicker}
|
||||
/>
|
||||
{/* 隐藏字段,通过 ref.setFieldsValue 设置 */}
|
||||
<Form.Item name="buildingNo" style={{display: 'none'}}>
|
||||
<View />
|
||||
</Form.Item>
|
||||
{/* 单元选择 */}
|
||||
<Cell
|
||||
title="单元"
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedUnit ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">{selectedUnit.dictDataName || selectedUnit.label}</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearUnit(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择</Text>
|
||||
)}
|
||||
{!isEditMode && <ArrowRight size={14} color="#ccc"/>}
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openUnitPicker}
|
||||
/>
|
||||
{/* 隐藏字段,通过 ref.setFieldsValue 设置 */}
|
||||
<Form.Item name="unitNo" style={{display: 'none'}}>
|
||||
<View />
|
||||
</Form.Item>
|
||||
{/* 楼层选择 */}
|
||||
<Cell
|
||||
title="楼层"
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedFloor ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">{selectedFloor.dictDataName || selectedFloor.label}</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearFloor(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择</Text>
|
||||
)}
|
||||
{!isEditMode && <ArrowRight size={14} color="#ccc"/>}
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openFloorPicker}
|
||||
/>
|
||||
{/* 隐藏字段,通过 ref.setFieldsValue 设置 */}
|
||||
<Form.Item name="floorNo" style={{display: 'none'}}>
|
||||
<View />
|
||||
</Form.Item>
|
||||
{/* 房号选择 */}
|
||||
<Cell
|
||||
title="房号"
|
||||
required={true}
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedRoom ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">{selectedRoom.dictDataName || selectedRoom.label}</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearRoom(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择</Text>
|
||||
)}
|
||||
{!isEditMode && <ArrowRight size={14} color="#ccc"/>}
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openRoomPicker}
|
||||
/>
|
||||
{/* 隐藏字段,通过 ref.setFieldsValue 设置 */}
|
||||
<Form.Item name="roomNo" style={{display: 'none'}}>
|
||||
<View />
|
||||
</Form.Item>
|
||||
<CellGroup style={{padding: '0'}}>
|
||||
{/* 接待人员选择 */}
|
||||
<Cell
|
||||
title="接待人员"
|
||||
@@ -1131,7 +628,19 @@ const AddShopDealerApply = () => {
|
||||
}
|
||||
onClick={openReceptionistPicker}
|
||||
/>
|
||||
<div className={'h-3 bg-gray-50'}></div>
|
||||
<View className={'bg-gray-100 h-2'}></View>
|
||||
<Form.Item name="address" label="小区" initialValue={FormData?.address} required>
|
||||
<Input placeholder="幸福里" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="buildingNo" label="楼栋号" required>
|
||||
<Input placeholder="3" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="unitNo" label="单元号">
|
||||
<Input placeholder="1" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="roomNo" label="房号" required>
|
||||
<Input placeholder="1201" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="realName" label="姓名" initialValue={FormData?.realName} required>
|
||||
<Input placeholder="张三" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
@@ -1144,24 +653,32 @@ const AddShopDealerApply = () => {
|
||||
{isEditMode && (
|
||||
<>
|
||||
<Form.Item name="money" label="签约价格" initialValue={FormData?.money} required>
|
||||
<Input placeholder="(元/兆瓦时)" />
|
||||
<Input placeholder="(元/兆瓦时)" disabled={false}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="applyTime" label="签约时间" initialValue={FormData?.applyTime}>
|
||||
<View onClick={() => setShowApplyTimePicker(true)}>
|
||||
<Input
|
||||
placeholder="点击选择签约时间"
|
||||
readOnly
|
||||
value={applyTime ? formatDateForDisplay(applyTime) : ''}
|
||||
/>
|
||||
<View
|
||||
className="flex items-center justify-between py-2"
|
||||
onClick={() => setShowApplyTimePicker(true)}
|
||||
>
|
||||
<View className="flex items-center">
|
||||
<CalendarIcon size={16} color="#999" className="mr-2"/>
|
||||
<Text style={{color: applyTime ? '#333' : '#999'}}>
|
||||
{applyTime ? formatDateForDisplay(applyTime) : '请选择签约时间'}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Form.Item>
|
||||
<Form.Item name="contractTime" label="合同日期" initialValue={FormData?.contractTime}>
|
||||
<View onClick={() => setShowContractTimePicker(true)}>
|
||||
<Input
|
||||
placeholder="点击选择合同生效起止时间"
|
||||
readOnly
|
||||
value={contractTime ? formatDateForDisplay(contractTime) : ''}
|
||||
/>
|
||||
<View
|
||||
className="flex items-center justify-between py-2"
|
||||
onClick={() => setShowContractTimePicker(true)}
|
||||
>
|
||||
<View className="flex items-center">
|
||||
<CalendarIcon size={16} color="#999" className="mr-2"/>
|
||||
<Text style={{color: contractTime ? '#333' : '#999'}}>
|
||||
{contractTime ? formatDateForDisplay(contractTime) : '请选择合同生效起止时间'}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Form.Item>
|
||||
{/*<Form.Item name="refereeId" label="邀请人ID" initialValue={FormData?.refereeId} required>*/}
|
||||
@@ -1248,267 +765,6 @@ const AddShopDealerApply = () => {
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 小区选择弹出层 */}
|
||||
<Popup
|
||||
visible={showCommunityPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowCommunityPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择小区</Text>
|
||||
<View onClick={() => setShowCommunityPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={communitySearch}
|
||||
placeholder="搜索小区名称"
|
||||
onChange={handleCommunitySearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{communityLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : communityList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无小区数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
communityList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
description={item.comments || ''}
|
||||
extra={
|
||||
selectedCommunity?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectCommunity(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 楼栋选择弹出层 */}
|
||||
<Popup
|
||||
visible={showBuildingPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowBuildingPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择楼栋</Text>
|
||||
<View onClick={() => setShowBuildingPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={buildingSearch}
|
||||
placeholder="搜索楼栋号"
|
||||
onChange={handleBuildingSearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{buildingLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : buildingList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无楼栋数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
buildingList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
extra={
|
||||
selectedBuilding?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectBuilding(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 单元选择弹出层 */}
|
||||
<Popup
|
||||
visible={showUnitPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowUnitPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择单元</Text>
|
||||
<View onClick={() => setShowUnitPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={unitSearch}
|
||||
placeholder="搜索单元号"
|
||||
onChange={handleUnitSearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{unitLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : unitList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无单元数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
unitList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
extra={
|
||||
selectedUnit?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectUnit(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 楼层选择弹出层 */}
|
||||
<Popup
|
||||
visible={showFloorPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowFloorPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择楼层</Text>
|
||||
<View onClick={() => setShowFloorPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={floorSearch}
|
||||
placeholder="搜索楼层"
|
||||
onChange={handleFloorSearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{floorLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : floorList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无楼层数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
floorList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
extra={
|
||||
selectedFloor?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectFloor(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 房号选择弹出层 */}
|
||||
<Popup
|
||||
visible={showRoomPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowRoomPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择房号</Text>
|
||||
<View onClick={() => setShowRoomPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={roomSearch}
|
||||
placeholder="搜索房号"
|
||||
onChange={handleRoomSearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{roomLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : roomList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无房号数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
roomList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
extra={
|
||||
selectedRoom?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectRoom(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 审核状态显示(仅在编辑模式下显示) */}
|
||||
{isEditMode && (
|
||||
<CellGroup>
|
||||
|
||||
Reference in New Issue
Block a user