xx
This commit is contained in:
@@ -349,6 +349,7 @@ export default function DeviceManagementPage() {
|
||||
setBindModalVisible(false);
|
||||
setSiteOptions([]);
|
||||
setUserOptions([]);
|
||||
bindForm.resetFields(); // 加一句重置,避免缓存
|
||||
}}
|
||||
onOk={() => bindForm.submit()}
|
||||
width={500}
|
||||
@@ -358,6 +359,7 @@ export default function DeviceManagementPage() {
|
||||
<Input.TextArea placeholder="例如: SN001, SN002" rows={3} disabled />
|
||||
</Form.Item>
|
||||
|
||||
{/* ========== 修复:组织 ========== */}
|
||||
<Form.Item label="所属组织" name="orgId" rules={[{ required: true, message: '请选择组织' }]}>
|
||||
<Select
|
||||
allowClear
|
||||
@@ -370,14 +372,20 @@ export default function DeviceManagementPage() {
|
||||
}}
|
||||
>
|
||||
{orgOptions.map(org => (
|
||||
<Select.Option key={org.id} value={org.id}>{org.orgName}</Select.Option>
|
||||
<Select.Option
|
||||
key={`org-${org.id}`}
|
||||
value={org.id}
|
||||
>
|
||||
{org.name || org.orgName || '未命名组织'}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
{/* ========== 修复:场站 ========== */}
|
||||
<Form.Item label="所属场站" name="siteId" rules={[{ required: true, message: '请选择场站' }]}>
|
||||
<Select
|
||||
placeholder="请先选择场站"
|
||||
placeholder="请先选择组织"
|
||||
disabled={!siteOptions.length}
|
||||
onChange={(val) => {
|
||||
bindForm.setFieldsValue({ userId: undefined });
|
||||
@@ -386,23 +394,34 @@ export default function DeviceManagementPage() {
|
||||
}}
|
||||
>
|
||||
{siteOptions.map(site => (
|
||||
<Select.Option key={site.id} value={site.id}>{site.siteName}</Select.Option>
|
||||
<Select.Option
|
||||
key={`site-${site.id}`}
|
||||
value={site.id}
|
||||
>
|
||||
{site.name || site.siteName || '未命名场站'}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
{/* ========== 修复:用户 ========== */}
|
||||
<Form.Item label="负责人" name="userId" rules={[{ required: true, message: '请选择负责人' }]}>
|
||||
<Select
|
||||
placeholder="请先选择场站"
|
||||
disabled={!userOptions.length}
|
||||
>
|
||||
{userOptions.map(user => (
|
||||
<Select.Option key={user.userId} value={user.userId}>{user.nickName || user.userName}</Select.Option>
|
||||
<Select.Option
|
||||
key={`user-${user.userId}`}
|
||||
value={user.userId}
|
||||
>
|
||||
{user.nickName || user.userName || user.realName || '未知用户'}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</Modal >
|
||||
</>
|
||||
) : (
|
||||
// 显示原来的设备列表
|
||||
@@ -440,7 +459,8 @@ export default function DeviceManagementPage() {
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user