Communication.vue 18 KB

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