Parcourir la source

实时标绘调整

Hwf il y a 6 mois
Parent
commit
e2959cd050

+ 13 - 5
src/api/globalMap/onlinePlotting.ts

@@ -49,8 +49,16 @@ export const createCollaboration = (data) => {
     data: data
   });
 };
-
+// 开启协同
 export const startCollaboration = (data) => {
+  return request({
+    url: '/api/pattern/ws/reset_user',
+    method: 'put',
+    data: data
+  });
+};
+// 增加协同用户
+export const addWsUser = (data) => {
   return request({
     url: '/api/pattern/ws/add_user',
     method: 'post',
@@ -62,7 +70,7 @@ export const startCollaboration = (data) => {
 export const endCollaboration = (data) => {
   return request({
     url: '/api/pattern/ws/delete_user',
-    method: 'post',
+    method: 'put',
     data: data
   });
 };
@@ -86,11 +94,11 @@ export const getBzList = (params) => {
 };
 
 // 添加分组
-export const addGroup = (params) => {
+export const addGroup = (data) => {
   return request({
     url: '/api/pattern/ws/add_group',
-    method: 'get',
-    params: params
+    method: 'post',
+    data: data
   });
 };
 

+ 19 - 3
src/views/globalMap/RightMenu/OnlinePlotting/CollaborativeUser.vue

@@ -16,7 +16,8 @@
         <div class="td">{{ item.nick_name }}</div>
         <div class="td">{{ item.dept_name }}</div>
         <div class="td">
-          <div class="btn1">关闭协同</div>
+          <div v-if="!!item.ws_flag" class="btn1" @click="handleCloseUser(item.id)">关闭协同</div>
+          <div v-else class="btn1" @click="handleStartUser(item.id)">开启协同</div>
         </div>
       </div>
     </div>
@@ -24,7 +25,7 @@
 </template>
 
 <script lang="ts" setup name="ImportLayer">
-import { getPatternUserList } from '@/api/globalMap/onlinePlotting';
+import { endCollaboration, getPatternUserList, startCollaboration } from '@/api/globalMap/onlinePlotting';
 
 const props = defineProps({
   modelValue: Boolean,
@@ -44,7 +45,22 @@ const getList = () => {
     dataList.value = res.data;
   });
 };
-
+const handleCloseUser = (id) => {
+  endCollaboration({
+    pattern_id: props.patternId,
+    user_id: id
+  }).then(() => {
+    getList();
+  });
+};
+const handleStartUser = (id) => {
+  startCollaboration({
+    pattern_id: props.patternId,
+    user_id: id
+  }).then(() => {
+    getList();
+  });
+};
 const handleClose = () => {
   emits('update:modelValue', false);
 };

+ 22 - 7
src/views/globalMap/RightMenu/OnlinePlotting/LayerDetail.vue

@@ -34,7 +34,7 @@
     </div>
     <div class="common-table">
       <div class="table-header">
-        <div class="td" style="width: 40px"></div>
+<!--        <div class="td" style="width: 40px"></div>-->
         <div class="td">标注名称</div>
         <div class="td">用户</div>
         <div class="td">单位</div>
@@ -42,7 +42,11 @@
         <div class="td">操作</div>
       </div>
       <div v-for="(item, index) in dataList" :key="index" class="tr">
-        <div class="td" :title="item.event_title">{{ item.event_title }}</div>
+        <div class="td" :title="item.name">{{ item.name }}</div>
+        <div class="td" :title="item.nickName">{{ item.nick_name }}</div>
+        <div class="td" :title="item.dept_name">{{ item.dept_name }}</div>
+        <div class="td" :title="item.create_time">{{ item.create_time }}</div>
+        <div class="td"></div>
       </div>
     </div>
   </Dialog>
@@ -63,7 +67,7 @@
 </template>
 
 <script lang="ts" setup name="LayerDetail">
-import { addGroup, getBzList } from '@/api/globalMap/onlinePlotting';
+import { addGroup, addWsUser, getBzList, getPatternUserList } from '@/api/globalMap/onlinePlotting';
 import ImportLayer from './ImportLayer.vue';
 import CollaborativeUser from './CollaborativeUser.vue';
 const props = defineProps({
@@ -98,7 +102,8 @@ const handleAddGroup = () => {
     pattern_id: props.patternId
   };
   addGroup(obj).then((res) => {
-    emits('update:modelValue', false);
+    showGroup.value = false;
+    getList();
   });
 };
 const handleClose1 = () => {
@@ -118,8 +123,15 @@ const handleClose3 = () => {
   showCooperate.value = false;
 };
 const handleConfirm = (data) => {
-
-}
+  let arr = [];
+  data.forEach((item) => {
+    arr.push(item.userId);
+  });
+  addWsUser({
+    user_id_list: arr,
+    pattern_id: props.patternId
+  });
+};
 
 let showUser = ref(false);
 const handleShowUser = () => {
@@ -130,10 +142,13 @@ let showImportLayer = ref(false);
 const handleShowImportLayer = () => {
   showImportLayer.value = true;
 };
-onMounted(() => {
+const getList = () => {
   getBzList(queryParams).then((res) => {
     dataList.value = res.data;
   });
+};
+onMounted(() => {
+  getList();
 });
 </script>
 

+ 8 - 5
src/views/globalMap/RightMenu/OnlinePlotting/index.vue

@@ -151,7 +151,7 @@
   <!--保存修改弹窗-->
   <EditDialog v-if="showEdit" v-model="showEdit" :edit-data="editData" @submit="handleSubmit" />
   <Contact v-if="shareState.showShare" v-model="shareState.showShare" @close="handleCloseShare" @confirm="handleShareConfirm" />
-  <Dialog v-model="showForm" title="协同标绘" type="xs" @confirm="handleSendForm">
+  <Dialog v-if="showForm" v-model="showForm" custom-show title="协同标绘" type="xs" @close="showForm = false" @confirm="handleSendForm">
     <div style="display: flex; align-items: center">
       <div style="font-size: 36px">预案名称</div>
       <el-input v-model="form.pattern_name" class="custom-input" placeholder="请输入" style="flex: 1" />
@@ -175,7 +175,6 @@ import { createWebSocket } from '@/utils/websocket';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const getDrawTool = inject('getDrawTool');
 const getMap = inject('getMap');
-const getMapUtils = inject('getMapUtils');
 const containerScale = inject('containerScale');
 const { currentState, commit, undo, history, future } = useHistory();
 const emits = defineEmits(['getCollaborationData']);
@@ -774,13 +773,17 @@ const getWebSocketData = (data) => {
   console.log('接收数据', data);
 };
 const handleSendForm = () => {
-  createWebSocket('v7fUAuygwZUs24Nx3RDnL', getWebSocketData);
-  patternId.value = 'v7fUAuygwZUs24Nx3RDnL';
+  if (!form.value.pattern_name) {
+    return proxy?.$modal.msgWarning('请填写预案名称');
+  }
+  createWebSocket('2-85yd6_ZmiYDoZTezv5S', getWebSocketData);
+  patternId.value = '2-85yd6_ZmiYDoZTezv5S';
   // createCollaboration(form.value).then(() => {
   //   patternId.value = form.value.pattern_id;
   //   createWebSocket(form.value.pattern_id, getWebSocketData);
+    showForm.value = false;
+    collaboration.value = true;
   // });
-  collaboration.value = true;
 };
 const handleShowDialog = () => {
   editData.value = {