Communication.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <div class="communication-container">
  3. <div class="tabs">
  4. <div v-for="(item, index) in menu" :key="index" :class="activeIndex === index ? 'tab tab_active' : 'tab'" @click="activeIndex = index">
  5. {{ item.name }}
  6. </div>
  7. <!-- 新增的图标按钮 -->
  8. <div class="more-icon" @click="showCommunicationDialogList">
  9. <img src="@/assets/images/video/enlarge.png" />
  10. </div>
  11. </div>
  12. <!--视频会商-->
  13. <div v-show="activeIndex === 0" class="content">
  14. <div class="left-content">
  15. <div class="search-box">
  16. <el-input v-model="queryParams.label" class="custom-input" placeholder="组织架构搜索" style="width: 487px" @keyup.enter="getTree">
  17. <template #prefix>
  18. <el-icon class="el-input__icon"><search /></el-icon>
  19. </template>
  20. </el-input>
  21. <el-select
  22. v-model="queryParams2.value2"
  23. class="custom-select select-box"
  24. placeholder="全部"
  25. popper-class="custom-select-popper"
  26. :teleported="false"
  27. >
  28. <el-option v-for="level in options" :key="level.value" :label="level.name" :value="level.value"></el-option>
  29. </el-select>
  30. <el-input v-model="queryParams2.name" class="custom-input" placeholder="设备搜索" @keyup.enter="handleNodeClick(false)">
  31. <template #prefix>
  32. <el-icon class="el-input__icon"><search /></el-icon>
  33. </template>
  34. </el-input>
  35. </div>
  36. <div class="tree-container">
  37. <div class="tree-box">
  38. <div style="overflow-y: auto; height: 100%">
  39. <el-tree :data="treeData" accordion @node-click="handleNodeClick" />
  40. </div>
  41. </div>
  42. <div class="user-box">
  43. <div class="user-table">
  44. <div class="tr">
  45. <div class="td2">
  46. <div :class="getCheckedClass()" @click="handleChecked"></div>
  47. </div>
  48. <div class="td">设备</div>
  49. <!-- div class="td3">姓名职务</div -->
  50. </div>
  51. <div class="table-content">
  52. <div v-for="(item, index) in userList" :key="index" class="tr2">
  53. <div class="td2">
  54. <div :class="item.checked ? 'common-checked-active' : 'common-checked'" @click="handleChecked2(item)"></div>
  55. </div>
  56. <div class="td">{{ item.name }}</div>
  57. <!-- div class="td3">
  58. {{ item.duty }}
  59. <div class="phone-icon"></div>
  60. </div-->
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="select-box2">
  68. <div class="select-header">
  69. <div class="left-item">
  70. <div>已选择:</div>
  71. <div class="text">{{ selectList.length }}</div>
  72. <div>个</div>
  73. </div>
  74. <div class="clear-btn" @click="clearSelect">清空</div>
  75. </div>
  76. <div class="select-content">
  77. <div v-for="(item, index) in selectList" :key="index" class="box-item">
  78. <div class="line">
  79. <div class="text1">{{ item.name }}</div>
  80. <div class="text2">{{ item.duty }}</div>
  81. </div>
  82. <div class="line" style="margin-top: 20px">
  83. <div class="text2">{{ item.dept }}</div>
  84. </div>
  85. <div class="close-btn" @click="deleteItem(item)"></div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="btn-box">
  90. <div class="btn" @click="showJoinMeetingDialog">
  91. <div class="icon1"></div>
  92. <div class="text">会议号入会</div>
  93. </div>
  94. <div class="btn" @click="handleOpenCall">
  95. <div class="icon2"></div>
  96. <div class="text">电话呼叫</div>
  97. </div>
  98. <div class="btn" @click="handleOpenMeeting">
  99. <div class="icon3"></div>
  100. <div class="text">发起会议</div>
  101. </div>
  102. </div>
  103. </div>
  104. <Drone v-show="activeIndex === 1" />
  105. <IndividualEquipment v-show="activeIndex === 2" :height="345" />
  106. <Dialog v-if="showJoinMeeting" custom-show type="xs" height="760px" title="加入会议" @confirm="handleJoinMeeting" @close="closeDialog">
  107. <el-form ref="formRef" :model="meetingForm" :rules="rules">
  108. <el-form-item label="会议号" label-width="200px" prop="roomcode">
  109. <el-input v-model="meetingForm.roomcode" class="custom-input2" clearable placeholder="请输入会议号" />
  110. </el-form-item>
  111. <el-form-item label="账号" label-width="200px" prop="username">
  112. <el-input v-model="meetingForm.username" class="custom-input2" clearable placeholder="请输入设备账号" />
  113. </el-form-item>
  114. <el-form-item label="密码" label-width="200px" prop="userpass">
  115. <el-input v-model="meetingForm.userpass" type="password" class="custom-input2" clearable placeholder="请输入设备密码" />
  116. </el-form-item>
  117. </el-form>
  118. </Dialog>
  119. <Dialog
  120. v-if="showOpenMeeting"
  121. custom-show
  122. type="xs"
  123. height="660px"
  124. :title="type === '0' ? '发起会议' : '电话呼叫'"
  125. @confirm="handleStartCall"
  126. @close="closeOpenDialog"
  127. >
  128. <el-form ref="form2Ref" :model="openMeetingForm" :rules="rules2">
  129. <el-form-item label="账号" label-width="200px" prop="username">
  130. <el-input v-model="openMeetingForm.username" class="custom-input2" clearable placeholder="请输入设备账号" />
  131. </el-form-item>
  132. <el-form-item label="密码" label-width="200px" prop="userpass">
  133. <el-input v-model="openMeetingForm.userpass" type="password" class="custom-input2" clearable placeholder="请输入设备密码" />
  134. </el-form-item>
  135. </el-form>
  136. </Dialog>
  137. </div>
  138. <CommunicationDialog v-if="communicationDialogState.showListDialog" v-model="communicationDialogState.showListDialog" :flag="flag" />
  139. </template>
  140. <script lang="ts" setup>
  141. import { Search } from '@element-plus/icons-vue';
  142. import { getStartMiniParam, getStartMiniWithNoParam, getAvconDeviceTree, getAvconDeviceList } from '@/api/emergencyCommandMap/communication';
  143. import { deepClone } from '@/utils';
  144. import Drone from './Drone.vue';
  145. import IndividualEquipment from './IndividualEquipment.vue';
  146. import CommunicationDialog from './Communication-dialog.vue';
  147. const proxy = getCurrentInstance()?.proxy;
  148. const props = defineProps({
  149. flag: Boolean
  150. });
  151. let activeIndex = ref(0);
  152. const options = ref([{ name: '全部', value: '全部' }]);
  153. const menu = ref([{ name: '视频会商' }, { name: '无人机' }, { name: '单兵设备' }]);
  154. const treeData = ref([]);
  155. const userList = ref([]);
  156. const communicationDialogState = reactive({
  157. showListDialog: false
  158. });
  159. const showCommunicationDialogList = () => {
  160. communicationDialogState.showListDialog = true;
  161. };
  162. const queryParams = reactive({
  163. label: ''
  164. });
  165. const queryParams2 = reactive({
  166. name: '',
  167. value2: ''
  168. });
  169. const getTree = () => {
  170. getAvconDeviceTree(queryParams).then((res) => {
  171. treeData.value = res.data;
  172. });
  173. };
  174. const selectList = ref([]);
  175. const getCheckedClass = () => {
  176. let res = 'common-checked';
  177. const len = userList.value.length;
  178. let len2 = 0;
  179. userList.value.forEach((item) => {
  180. const index = selectList.value.findIndex((item2) => item2.id === item.id);
  181. if (index > -1) {
  182. len2++;
  183. }
  184. });
  185. if (len2 > 0 && len2 === len) {
  186. res = 'common-checked-active';
  187. } else if (len2 > 0) {
  188. res = 'common-checked-half';
  189. }
  190. return res;
  191. };
  192. let clickNodeId = ref('');
  193. const handleNodeClick = (item) => {
  194. if (!!item) {
  195. clickNodeId.value = item.id;
  196. }
  197. const id = item ? item.id : !!clickNodeId.value ? clickNodeId.value : treeData.value[0].id;
  198. console.log('handleNodeClick', id);
  199. getAvconDeviceList(id, queryParams2).then((res) => {
  200. res.data.forEach((item) => {
  201. const index = selectList.value.findIndex((item2) => item2.id === item.id);
  202. item.checked = index > -1;
  203. });
  204. userList.value = res.data;
  205. });
  206. };
  207. // 全选、全取消
  208. const handleChecked = () => {
  209. const checkedClass = getCheckedClass();
  210. let flag = true;
  211. if (checkedClass === 'common-checked-active') {
  212. flag = false;
  213. }
  214. userList.value.forEach((item) => {
  215. item.checked = flag;
  216. changeSelectList(item);
  217. });
  218. };
  219. // 单个选中、取消选中
  220. const handleChecked2 = (item) => {
  221. item.checked = !item.checked;
  222. changeSelectList(item);
  223. };
  224. // 清空
  225. const clearSelect = () => {
  226. userList.value.forEach((item) => {
  227. if (item.checked) {
  228. item.checked = false;
  229. }
  230. });
  231. selectList.value = [];
  232. };
  233. const changeSelectList = (item) => {
  234. const index = selectList.value.findIndex((item2) => item2.id === item.id);
  235. if (item.checked) {
  236. if (index === -1) {
  237. selectList.value.push(deepClone(item));
  238. }
  239. } else {
  240. if (index > -1) {
  241. selectList.value.splice(index, 1);
  242. }
  243. }
  244. };
  245. // 清空指定项
  246. const deleteItem = (item) => {
  247. for (let i = 0; i < userList.value.length; i++) {
  248. if (item.id === userList.value[i].id) {
  249. userList.value[i].checked = false;
  250. break;
  251. }
  252. }
  253. item.checked = false;
  254. changeSelectList(item);
  255. };
  256. let formRef = ref();
  257. let showJoinMeeting = ref(false);
  258. let meetingForm = reactive({
  259. roomcode: '',
  260. username: '',
  261. userpass: ''
  262. });
  263. const rules = reactive({
  264. roomcode: [{ required: true, message: '会议号不能为空', trigger: 'blur' }],
  265. username: [{ required: true, message: '会议账号不能为空', trigger: 'blur' }],
  266. userpass: [{ required: true, message: '会议密码不能为空', trigger: 'blur' }]
  267. });
  268. // 0 会议 1 电话
  269. let type = ref('0');
  270. // 点击会议号入会
  271. const showJoinMeetingDialog = () => {
  272. type.value = '0';
  273. showJoinMeeting.value = true;
  274. };
  275. const closeDialog = () => {
  276. showJoinMeeting.value = false;
  277. meetingForm.roomcode = '';
  278. };
  279. ///////////////////
  280. let form2Ref = ref();
  281. let showOpenMeeting = ref(false);
  282. let openMeetingForm = reactive({
  283. username: '',
  284. userpass: ''
  285. });
  286. const rules2 = reactive({
  287. username: [{ required: true, message: '会议账号不能为空', trigger: 'blur' }],
  288. userpass: [{ required: true, message: '会议密码不能为空', trigger: 'blur' }]
  289. });
  290. const handleOpenMeeting = () => {
  291. type.value = '0';
  292. showOpenMeeting.value = true;
  293. };
  294. const closeOpenDialog = () => {
  295. showOpenMeeting.value = false;
  296. };
  297. const handleOpenCall = () => {
  298. type.value = '1';
  299. showOpenMeeting.value = true;
  300. };
  301. // 会议号入会
  302. const handleJoinMeeting = () => {
  303. formRef.value?.validate((valid) => {
  304. if (valid) {
  305. const screenWidth = window.screen.width * window.devicePixelRatio;
  306. const screenHeight = window.screen.height * window.devicePixelRatio;
  307. const data = {
  308. userid: meetingForm.username, // 空表示后台获取当前用户对应融合通信dev_id
  309. password: meetingForm.userpass || '123',
  310. roomcode: meetingForm.roomcode, // 会议号
  311. windowpos: { 'x': 0, 'y': 0, 'width': screenWidth, 'height': screenHeight, 'top': true }
  312. };
  313. getStartMiniWithNoParam(data).then((res) => {
  314. // 创建一个a标签元素
  315. const a = document.createElement('a');
  316. // 设置a标签的href属性
  317. a.href = res.data;
  318. // 触发点击事件
  319. a.click();
  320. // 保存账号和密码
  321. localStorage.setItem('meeting_username', meetingForm.username);
  322. localStorage.setItem('meeting_userpass', meetingForm.userpass);
  323. });
  324. closeDialog();
  325. }
  326. });
  327. };
  328. // 电话呼叫
  329. const handleStartCall = () => {
  330. form2Ref.value?.validate((valid) => {
  331. if (valid) {
  332. let dev_list = [];
  333. userList.value.forEach((item) => {
  334. if (item.checked && item.mobile != '') {
  335. dev_list.push({ id: item.mobile, avtype: type.value === '0' ? 'av' : 'a' }); // a 音频 v 视频 默认 av
  336. }
  337. });
  338. if (dev_list.length == 0) {
  339. proxy?.$modal.msgError('请勾选人员');
  340. return false;
  341. }
  342. const screenWidth = window.screen.width * window.devicePixelRatio;
  343. const screenHeight = window.screen.height * window.devicePixelRatio;
  344. const data = {
  345. userid: openMeetingForm.username, // 空表示后台获取当前用户对应融合通信dev_id
  346. password: openMeetingForm.userpass,
  347. windowpos: { 'x': 0, 'y': 0, 'width': screenWidth, 'height': screenHeight, 'top': true },
  348. members: {
  349. num: dev_list.length + 2, // 配置多少个座位,一般就是邀请人多少个就多少个
  350. 'dev-list': dev_list
  351. }
  352. };
  353. getStartMiniParam(data).then((res) => {
  354. // 创建一个a标签元素
  355. const a = document.createElement('a');
  356. // 设置a标签的href属性
  357. a.href = res.data;
  358. // 触发点击事件
  359. a.click();
  360. // 保存账号和密码
  361. localStorage.setItem('meeting_username', openMeetingForm.username);
  362. localStorage.setItem('meeting_userpass', openMeetingForm.userpass);
  363. });
  364. closeOpenDialog();
  365. }
  366. });
  367. };
  368. onMounted(() => {
  369. const meeting_username = localStorage.getItem('meeting_username') || '';
  370. const meeting_userpass = localStorage.getItem('meeting_userpass') || '';
  371. meetingForm.username = meeting_username;
  372. meetingForm.userpass = meeting_userpass;
  373. openMeetingForm.username = meeting_username;
  374. openMeetingForm.userpass = meeting_userpass;
  375. getTree();
  376. });
  377. </script>
  378. <style lang="scss" scoped>
  379. .communication-container {
  380. width: 1963px;
  381. height: 659px;
  382. background: url('@/assets/images/emergencyCommandMap/communication/communicationBg.png') no-repeat;
  383. position: relative;
  384. padding-top: 100px;
  385. padding-left: 60px;
  386. animation-name: slideLeft;
  387. animation-duration: 2s;
  388. .tabs {
  389. display: flex;
  390. align-items: center; // 确保标签居中对齐
  391. position: relative; // 使相对定位生效,以便绝对定位图标
  392. .tab {
  393. font-size: 44px;
  394. font-family: YouSheBiaoTiHei;
  395. text-align: center;
  396. color: #b6bbcc;
  397. width: 317px;
  398. height: 78px;
  399. line-height: 85px;
  400. background: url('@/assets/images/emergencyCommandMap/communication/tab.png') no-repeat;
  401. cursor: pointer;
  402. &:hover {
  403. color: #ffffff;
  404. background: url('@/assets/images/emergencyCommandMap/communication/tabActive.png') no-repeat;
  405. }
  406. }
  407. .tab_active {
  408. color: #ffffff;
  409. background: url('@/assets/images/emergencyCommandMap/communication/tabActive.png') no-repeat;
  410. }
  411. .more-icon {
  412. position: absolute;
  413. top: -40px; // 调整图标与顶部的距离
  414. right: 10px; // 调整图标与右侧的距离
  415. cursor: pointer;
  416. img {
  417. width: 40px; // 根据实际需要调整大小
  418. height: 40px;
  419. }
  420. }
  421. }
  422. .content {
  423. display: flex;
  424. margin-top: 12px;
  425. .left-content {
  426. .search-box {
  427. display: flex;
  428. .custom-input {
  429. width: 305px;
  430. }
  431. .select-box {
  432. width: 176px !important;
  433. height: 56px;
  434. line-height: 56px;
  435. margin: 0 10px;
  436. color: #83a3be;
  437. font-size: 32px;
  438. }
  439. .custom-select-popper {
  440. .el-scrollbar {
  441. .el-select-dropdown__item {
  442. color: #b1cae0;
  443. font-size: 32px;
  444. height: 56px;
  445. line-height: 56px;
  446. }
  447. }
  448. }
  449. .input {
  450. background: transparent;
  451. color: #83a3be;
  452. font-size: 32px;
  453. outline: none;
  454. appearance: none;
  455. height: 100%;
  456. border: none;
  457. &::placeholder {
  458. color: #83a3be;
  459. }
  460. }
  461. }
  462. }
  463. .tree-container {
  464. margin-top: 15px;
  465. display: flex;
  466. .tree-box {
  467. width: 488px;
  468. height: 354px;
  469. background: url('@/assets/images/emergencyCommandMap/communication/treeBg.png') no-repeat;
  470. padding: 15px 8px;
  471. overflow: hidden;
  472. :deep(.el-tree) {
  473. background-color: transparent;
  474. color: #fbffff;
  475. font-size: 38px;
  476. .el-tree-node__content {
  477. height: auto;
  478. padding-top: 10px;
  479. padding-bottom: 10px;
  480. white-space: normal;
  481. word-break: break-all;
  482. }
  483. .el-tree-node__expand-icon {
  484. color: #297cfc;
  485. font-size: 23px;
  486. }
  487. .el-tree-node:focus > .el-tree-node__content,
  488. .el-tree-node__content:hover {
  489. background-color: transparent !important;
  490. }
  491. }
  492. }
  493. .user-box {
  494. margin-left: 10px;
  495. width: 488px;
  496. height: 354px;
  497. background: url('@/assets/images/emergencyCommandMap/communication/treeBg.png') no-repeat;
  498. background-size: 100% 100%;
  499. .user-table {
  500. padding: 15px 8px;
  501. display: flex;
  502. flex-direction: column;
  503. font-size: 38px;
  504. color: #fbffff;
  505. .tr {
  506. background-color: #102e76;
  507. }
  508. .tr,
  509. .tr2 {
  510. display: flex;
  511. padding: 6px 0;
  512. .td {
  513. flex: 2;
  514. display: flex;
  515. align-items: center;
  516. }
  517. .td2 {
  518. width: 65px;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. }
  523. .td3 {
  524. flex: 3;
  525. display: flex;
  526. align-items: center;
  527. justify-content: center;
  528. }
  529. }
  530. .table-content {
  531. height: 275px;
  532. overflow-y: auto;
  533. }
  534. .tr2 {
  535. margin-top: 10px;
  536. background-color: #122868;
  537. }
  538. .phone-icon {
  539. flex-shrink: 0;
  540. width: 62px;
  541. height: 63px;
  542. background: url('@/assets/images/emergencyCommandMap/communication/phone.png') no-repeat;
  543. cursor: pointer;
  544. }
  545. }
  546. }
  547. }
  548. .select-box2 {
  549. margin-left: 10px;
  550. width: 579px;
  551. height: 450px;
  552. background: url('@/assets/images/emergencyCommandMap/communication/peopleBg.png') no-repeat;
  553. background-size: 100% 100%;
  554. .select-header {
  555. display: flex;
  556. justify-content: space-between;
  557. align-items: center;
  558. color: #fbffff;
  559. font-size: 32px;
  560. border-bottom: 1px solid #247dff;
  561. padding: 20px;
  562. .left-item {
  563. display: flex;
  564. align-items: center;
  565. .text {
  566. margin: 0 10px;
  567. color: #00e8ff;
  568. font-family: 'BEBAS-1';
  569. }
  570. }
  571. .clear-btn {
  572. color: #00e8ff;
  573. cursor: pointer;
  574. }
  575. }
  576. .select-content {
  577. height: 360px;
  578. overflow-y: auto;
  579. .box-item {
  580. border-bottom: 1px solid #247dff;
  581. padding: 20px;
  582. position: relative;
  583. .line {
  584. color: #fff;
  585. font-size: 38px;
  586. display: flex;
  587. .text1 {
  588. margin-right: 35px;
  589. }
  590. .text2 {
  591. color: #a7ccdf;
  592. }
  593. }
  594. .close-btn {
  595. position: absolute;
  596. right: 10px;
  597. top: 50px;
  598. cursor: pointer;
  599. width: 29px;
  600. height: 29px;
  601. background: url('@/assets/images/emergencyCommandMap/communication/close.png') no-repeat;
  602. }
  603. }
  604. }
  605. }
  606. .btn-box {
  607. flex: 1;
  608. height: 421px;
  609. display: flex;
  610. flex-direction: column;
  611. justify-content: center;
  612. align-items: center;
  613. .btn {
  614. width: 361px;
  615. height: 136px;
  616. background: url('@/assets/images/emergencyCommandMap/communication/btn.png') no-repeat;
  617. display: flex;
  618. align-items: center;
  619. justify-content: center;
  620. cursor: pointer;
  621. .icon1,
  622. .icon2,
  623. .icon3 {
  624. margin-right: 20px;
  625. margin-top: 10px;
  626. }
  627. .icon1 {
  628. width: 64px;
  629. height: 67px;
  630. background: url('@/assets/images/emergencyCommandMap/communication/icon1.png') no-repeat;
  631. }
  632. .icon2 {
  633. width: 64px;
  634. height: 65px;
  635. background: url('@/assets/images/emergencyCommandMap/communication/icon2.png') no-repeat;
  636. }
  637. .icon3 {
  638. width: 64px;
  639. height: 63px;
  640. background: url('@/assets/images/emergencyCommandMap/communication/icon3.png') no-repeat;
  641. }
  642. .text {
  643. color: #fff;
  644. font-size: 38px;
  645. }
  646. }
  647. }
  648. }
  649. }
  650. .title {
  651. position: absolute;
  652. top: 6px;
  653. left: 141px;
  654. font-size: 60px;
  655. }
  656. </style>