Browse Source

bugfix:消费设备只能挂在房间上

bing 5 days ago
parent
commit
b0064d72bd

+ 1 - 0
src/api/basics/room/ptArea/types.ts

@@ -98,4 +98,5 @@ export type PtAreaOption = {
98 98
   areaId: number | string;
99 99
   areaName: string;
100 100
   children?: PtAreaOption[];
101
+  type: string;
101 102
 };

+ 16 - 0
src/views/consumption/xfTerm/DetailForm.vue

@@ -22,7 +22,10 @@
22 22
                 :data="ptAreaOptions"
23 23
                 :props="{ value: 'areaId', label: 'areaName', children: 'children' }"
24 24
                 value-key="areaId"
25
+                node-key="areaId"
26
+                :highlight-current="true"
25 27
                 placeholder="请选择餐厅"
28
+                @current-change="handleClickNode"
26 29
               />
27 30
             </el-form-item>
28 31
           </el-col>
@@ -104,6 +107,7 @@ import { queryRoom2AreaList } from '@/api/basics/room/ptRoom';
104 107
 import * as XfTermApi from '@/api/consumption/xfTerm';
105 108
 import { XfTermForm } from '@/api/consumption/xfTerm/types';
106 109
 import { useI18n } from 'vue-i18n';
110
+import { number } from 'vue-types';
107 111
 
108 112
 defineOptions({ name: 'XfTermForm' });
109 113
 
@@ -246,6 +250,11 @@ const open = async (type: string, id?: number) => {
246 250
     }
247 251
   }
248 252
 };
253
+
254
+const handleClickNode = (data: PtAreaOption, node: any) => {
255
+  // console.log(data, node, 'handleClickNode');
256
+};
257
+
249 258
 /** 表单重置 */
250 259
 const resetForm = () => {
251 260
   formData.value = {
@@ -324,9 +333,16 @@ const emit = defineEmits(['success']);
324 333
 /** 提交按钮 */
325 334
 const submitForm = async () => {
326 335
   // 校验表单
336
+  // console.log(typeof formData.value.roomId);
327 337
   if (!formRef.value) return;
328 338
   const valid = await formRef.value?.validate();
329 339
   if (!valid) return;
340
+  // 校验选择的餐厅 是不是 房间
341
+  // console.log(typeof formData.value.roomId);
342
+  if (formData.value.roomId && typeof formData.value.roomId !== 'number') {
343
+    proxy?.$modal.msgError('所属餐厅只能选择房间,校区、楼栋、楼层不能选择!');
344
+    return;
345
+  }
330 346
   // 提交请求
331 347
   formLoading.value = true;
332 348
   try {

+ 2 - 1
src/views/consumption/xfTerm/index.vue

@@ -405,7 +405,8 @@ const getMapRS = async () => {
405 405
           list.push({
406 406
             areaId: child.areaId,
407 407
             areaName: child.areaName,
408
-            children: []
408
+            children: [],
409
+            type: 'room'
409 410
           });
410 411
         });
411 412
         node.children = list;