ソースを参照

后端返回组态绑定的设备

Zimo 1 週間 前
コミット
aee27e15b4
1 ファイル変更14 行追加4 行削除
  1. 14 4
      src/views/maotu/index.vue

+ 14 - 4
src/views/maotu/index.vue

@@ -150,6 +150,7 @@ async function openConfig(row: WebtopoProjectVO) {
     linkedDeviceIds: getLinkedDeviceIds(row),
     remark: row.remark
   }
+  deviceOptions.value = []
   createVisible.value = true
   await loadDeviceOptions(deptId)
   await nextTick()
@@ -161,7 +162,7 @@ function handleCreateClose() {
 }
 
 async function submitCreate() {
-  if (!formRef.value) return
+  if (!formRef.value || deviceLoading.value) return
 
   try {
     createLoading.value = true
@@ -188,7 +189,7 @@ async function submitCreate() {
 }
 
 async function submitConfig() {
-  if (!formRef.value || !createForm.value.id) return
+  if (!formRef.value || !createForm.value.id || deviceLoading.value) return
 
   try {
     createLoading.value = true
@@ -402,6 +403,8 @@ watch(
     destroy-on-close>
     <el-form
       ref="formRef"
+      v-loading="deviceLoading"
+      element-loading-text="设备选项加载中..."
       :model="createForm"
       :rules="rules"
       label-position="top"
@@ -421,8 +424,9 @@ watch(
           collapse-tags-tooltip
           :max-collapse-tags="3"
           :loading="deviceLoading"
+          :disabled="deviceLoading"
           class="w-full"
-          placeholder="请选择绑定设备">
+          :placeholder="deviceLoading ? '设备选项加载中...' : '请选择绑定设备'">
           <el-option
             v-for="item in deviceOptions"
             :key="item.value"
@@ -445,7 +449,13 @@ watch(
 
     <template #footer>
       <el-button @click="handleCreateClose">取消</el-button>
-      <el-button type="primary" :loading="createLoading" @click="submitForm">保存</el-button>
+      <el-button
+        type="primary"
+        :loading="createLoading"
+        :disabled="deviceLoading"
+        @click="submitForm">
+        保存
+      </el-button>
     </template>
   </el-dialog>
 </template>