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
   areaId: number | string;
98
   areaId: number | string;
99
   areaName: string;
99
   areaName: string;
100
   children?: PtAreaOption[];
100
   children?: PtAreaOption[];
101
+  type: string;
101
 };
102
 };

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

@@ -22,7 +22,10 @@
22
                 :data="ptAreaOptions"
22
                 :data="ptAreaOptions"
23
                 :props="{ value: 'areaId', label: 'areaName', children: 'children' }"
23
                 :props="{ value: 'areaId', label: 'areaName', children: 'children' }"
24
                 value-key="areaId"
24
                 value-key="areaId"
25
+                node-key="areaId"
26
+                :highlight-current="true"
25
                 placeholder="请选择餐厅"
27
                 placeholder="请选择餐厅"
28
+                @current-change="handleClickNode"
26
               />
29
               />
27
             </el-form-item>
30
             </el-form-item>
28
           </el-col>
31
           </el-col>
@@ -104,6 +107,7 @@ import { queryRoom2AreaList } from '@/api/basics/room/ptRoom';
104
 import * as XfTermApi from '@/api/consumption/xfTerm';
107
 import * as XfTermApi from '@/api/consumption/xfTerm';
105
 import { XfTermForm } from '@/api/consumption/xfTerm/types';
108
 import { XfTermForm } from '@/api/consumption/xfTerm/types';
106
 import { useI18n } from 'vue-i18n';
109
 import { useI18n } from 'vue-i18n';
110
+import { number } from 'vue-types';
107
 
111
 
108
 defineOptions({ name: 'XfTermForm' });
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
 const resetForm = () => {
259
 const resetForm = () => {
251
   formData.value = {
260
   formData.value = {
@@ -324,9 +333,16 @@ const emit = defineEmits(['success']);
324
 /** 提交按钮 */
333
 /** 提交按钮 */
325
 const submitForm = async () => {
334
 const submitForm = async () => {
326
   // 校验表单
335
   // 校验表单
336
+  // console.log(typeof formData.value.roomId);
327
   if (!formRef.value) return;
337
   if (!formRef.value) return;
328
   const valid = await formRef.value?.validate();
338
   const valid = await formRef.value?.validate();
329
   if (!valid) return;
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
   formLoading.value = true;
347
   formLoading.value = true;
332
   try {
348
   try {

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

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