|
@@ -24,6 +24,7 @@
|
|
|
<el-input
|
|
|
v-model="deviceFilterText"
|
|
|
:placeholder="t('devicePerson.filterDevicePlaceholder')"
|
|
|
+ :disabled="!devicesLoaded"
|
|
|
clearable
|
|
|
prefix-icon="Search"
|
|
|
/>
|
|
@@ -62,7 +63,7 @@
|
|
|
<div class="control-row">
|
|
|
<!-- 左侧人员选择 -->
|
|
|
<div class="control-group">
|
|
|
- <label class="control-title">{{ t('devicePerson.rp') }}<span class="required-star">*</span></label>
|
|
|
+ <label class="control-title">{{ t('devicePerson.rp') }}</label>
|
|
|
<div class="person-selector">
|
|
|
<el-select
|
|
|
v-model="selectedPersons"
|
|
@@ -103,7 +104,7 @@
|
|
|
size="large"
|
|
|
style="min-width: 180px;"
|
|
|
@click="submitRelations"
|
|
|
- :disabled="tempRelations.length === 0 || !formData.reason.trim() || selectedPersons.length === 0"
|
|
|
+ :disabled="tempRelations.length === 0 || !formData.reason.trim()"
|
|
|
>
|
|
|
{{ t('iotMaintain.save') }}
|
|
|
</el-button>
|
|
@@ -152,6 +153,8 @@ const simpleDevices = ref<IotDeviceVO[]>([])
|
|
|
const deptList = ref<Tree[]>([]) // 树形结构
|
|
|
const selectedDevices = ref<number[]>([]) // 改为数组存储多选
|
|
|
const { delView } = useTagsViewStore() // 视图操作
|
|
|
+// 设备加载状态标记 只有加载完设备才能通过文本框筛选
|
|
|
+const devicesLoaded = ref(false)
|
|
|
|
|
|
const formData = ref({
|
|
|
id: undefined,
|
|
@@ -271,11 +274,18 @@ const handleDeptDeviceTreeNodeClick = async (row: { [key: string]: any }) => {
|
|
|
/** 获得 部门下的设备 列表 */
|
|
|
const getDeviceList = async () => {
|
|
|
try {
|
|
|
+ // 查询到数据后才能进行搜索 筛选
|
|
|
+ devicesLoaded.value = false
|
|
|
+
|
|
|
const params = { deptId: formData.value.deptId }
|
|
|
const data = await IotDeviceApi.simpleDevices(params)
|
|
|
simpleDevices.value = data || []
|
|
|
+
|
|
|
+ devicesLoaded.value = true
|
|
|
} catch (error) {
|
|
|
simpleDevices.value = []
|
|
|
+ // 即使失败也启用搜索框(避免卡在禁用状态)
|
|
|
+ devicesLoaded.value = true
|
|
|
console.error('获取设备列表失败:', error)
|
|
|
}
|
|
|
}
|
|
@@ -354,7 +364,7 @@ const submitRelations = async () => {
|
|
|
deviceId: r.deviceId,
|
|
|
deptId: r.deptId,
|
|
|
reason: r.reason,
|
|
|
- personIds: selectedPersons.value // 添加人员ID列表
|
|
|
+ personIds: selectedPersons.value || [] // 添加人员ID列表
|
|
|
}))
|
|
|
await IotDeviceApi.saveDeviceAllot(submitData)
|
|
|
// 模拟API调用
|