CommunicationSupport.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div>
  3. <Dialog custom-show type="lg" title="通讯保障" hide-footer @close="handleClose">
  4. <div class="content">
  5. <div class="left-content">
  6. <el-input v-model="queryParams1.keyword" class="custom-input" placeholder="组织架构搜索">
  7. <template #prefix>
  8. <el-icon class="el-input__icon"><search /></el-icon>
  9. </template>
  10. </el-input>
  11. <div class="tree-container">
  12. <div class="tree-box">
  13. <el-tree :data="treeData" :props="{ value: 'deptId', label: 'deptName', children: 'children' }" accordion @node-click="handleNodeClick" />
  14. </div>
  15. </div>
  16. </div>
  17. <div class="middle-content">
  18. <div class="search-box">
  19. <el-select
  20. v-model="queryParams1.value1"
  21. class="custom-select select-box"
  22. placeholder="全部"
  23. popper-class="custom-select-popper"
  24. :teleported="false"
  25. >
  26. <el-option v-for="level in options" :key="level.value" :label="level.name" :value="level.value"></el-option>
  27. </el-select>
  28. <el-input v-model="queryParams1.keyword" class="custom-input" placeholder="组织架构搜索">
  29. <template #prefix>
  30. <el-icon class="el-input__icon"><search /></el-icon>
  31. </template>
  32. </el-input>
  33. </div>
  34. <div class="user-box">
  35. <div class="user-table">
  36. <div class="tr">
  37. <div class="td2">
  38. <div :class="getCheckedClass()" @click="handleChecked"></div>
  39. </div>
  40. <div class="td">姓名</div>
  41. <div class="td3">职务</div>
  42. </div>
  43. <div class="table-content">
  44. <div v-for="(item, index) in userList" :key="index" class="tr2">
  45. <div class="td2">
  46. <div :class="item.checked ? 'common-checked-active' : 'common-checked'" @click="handleChecked2(item)"></div>
  47. </div>
  48. <div class="td">{{ item.nickName }}</div>
  49. <div class="td3">
  50. {{ item.deptName }}
  51. <div class="phone-icon"></div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="select-box2">
  59. <div class="select-header">
  60. <div class="left-item">
  61. <div>已选择:</div>
  62. <div class="text">{{ selectList.length }}</div>
  63. <div>人</div>
  64. </div>
  65. <div class="clear-btn" @click="clearSelect">清空</div>
  66. </div>
  67. <div class="select-content">
  68. <div v-for="(item, index) in selectList" :key="index" class="box-item">
  69. <div class="line">
  70. <div class="text1">{{ item.nickName }}</div>
  71. <div class="text2">{{ item.duty }}</div>
  72. </div>
  73. <div class="line" style="margin-top: 20px">
  74. <div class="text2">{{ item.deptName }}</div>
  75. </div>
  76. <div class="close-btn" @click="deleteItem(item)"></div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </Dialog>
  82. </div>
  83. </template>
  84. <script lang="ts" setup>
  85. import { Search } from '@element-plus/icons-vue';
  86. import { listDept } from '@/api/system/dept';
  87. import { DeptVO } from '@/api/system/dept/types';
  88. import { listUser } from '@/api/system/user';
  89. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  90. const emits = defineEmits(['close']);
  91. const options = ref([{ name: '全部', value: '全部' }]);
  92. let queryParams1 = ref({
  93. pageNum: 1,
  94. pageSize: 10,
  95. deptName: undefined,
  96. deptCategory: undefined,
  97. status: undefined
  98. });
  99. let queryParams2 = ref({
  100. pageNum: 1,
  101. pageSize: 100,
  102. deptId: ''
  103. });
  104. const treeData = ref([]);
  105. const userList = ref([]);
  106. const selectList = computed(() => {
  107. const data = [];
  108. userList.value.forEach((item) => {
  109. if (item.checked) {
  110. data.push(item);
  111. }
  112. });
  113. return data;
  114. });
  115. const getCheckedClass = () => {
  116. let res = 'common-checked';
  117. const len = userList.value.length;
  118. const len2 = selectList.value.length;
  119. if (len2 > 0 && len2 === len) {
  120. res = 'common-checked-active';
  121. } else if (len2 > 0) {
  122. res = 'common-checked-half';
  123. }
  124. return res;
  125. };
  126. const handleNodeClick = (data) => {
  127. queryParams2.value.deptId = data.deptId;
  128. getPerson();
  129. };
  130. const getPerson = () => {
  131. listUser(queryParams2.value).then((res) => {
  132. const data = res.rows;
  133. data.forEach((item) => {
  134. for (let i = 0; i < selectList.value.length; i++) {
  135. if (selectList.value[i].nickName === item.nickName) {
  136. item.checked = true;
  137. break;
  138. }
  139. }
  140. });
  141. userList.value = data;
  142. });
  143. };
  144. // 全选、全取消
  145. const handleChecked = () => {
  146. const checkedClass = getCheckedClass();
  147. let flag = true;
  148. if (checkedClass === 'common-checked-active') {
  149. flag = false;
  150. }
  151. userList.value.forEach((item) => {
  152. item.checked = flag;
  153. });
  154. };
  155. // 单个选中、取消选中
  156. const handleChecked2 = (item) => {
  157. item.checked = !item.checked;
  158. };
  159. // 清空
  160. const clearSelect = () => {
  161. userList.value.forEach((item) => {
  162. if (item.checked) {
  163. item.checked = false;
  164. }
  165. });
  166. };
  167. // 清空指定项
  168. const deleteItem = (item) => {
  169. for (let i = 0; i < userList.value.length; i++) {
  170. if (item.deptId === userList.value[i].deptId) {
  171. userList.value[i].checked = false;
  172. break;
  173. }
  174. }
  175. };
  176. // 弹窗关闭后
  177. const handleClose = () => {
  178. emits('close');
  179. };
  180. const initData = () => {
  181. listDept(queryParams1.value).then((res: any) => {
  182. const data = proxy?.handleTree<DeptVO>(res.data, 'deptId');
  183. treeData.value = data;
  184. });
  185. };
  186. onMounted(() => {
  187. initData();
  188. });
  189. </script>
  190. <style lang="scss" scoped>
  191. .content {
  192. display: flex;
  193. margin-top: 12px;
  194. .left-content {
  195. width: 910px;
  196. padding-right: 30px;
  197. border-right: 1px solid #2187ff;
  198. }
  199. .middle-content {
  200. width: 910px;
  201. padding: 0 30px;
  202. border-right: 1px solid #2187ff;
  203. .search-box {
  204. display: flex;
  205. .select-box {
  206. flex-shrink: 0;
  207. width: 176px !important;
  208. height: 56px;
  209. line-height: 56px;
  210. margin: 0 10px;
  211. color: #83a3be;
  212. font-size: 32px;
  213. }
  214. }
  215. .user-box {
  216. margin-left: 10px;
  217. width: 100%;
  218. height: 100%;
  219. .user-table {
  220. padding: 15px 0;
  221. display: flex;
  222. flex-direction: column;
  223. font-size: 38px;
  224. color: #fbffff;
  225. .tr {
  226. background-color: #102e76;
  227. }
  228. .tr,
  229. .tr2 {
  230. display: flex;
  231. padding: 6px 0;
  232. .td {
  233. flex: 1;
  234. display: flex;
  235. align-items: center;
  236. }
  237. .td2 {
  238. width: 65px;
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. }
  243. .td3 {
  244. flex: 2;
  245. display: flex;
  246. align-items: center;
  247. }
  248. }
  249. .table-content {
  250. height: 858px;
  251. overflow-y: auto;
  252. }
  253. .tr2 {
  254. margin-top: 10px;
  255. background-color: #122868;
  256. }
  257. .phone-icon {
  258. width: 62px;
  259. height: 63px;
  260. background: url('@/assets/images/emergencyCommandMap/communication/phone.png');
  261. cursor: pointer;
  262. }
  263. }
  264. }
  265. }
  266. .custom-select-popper {
  267. .el-scrollbar {
  268. .el-select-dropdown__item {
  269. color: #b1cae0;
  270. font-size: 32px;
  271. height: 56px;
  272. line-height: 56px;
  273. }
  274. }
  275. }
  276. .input {
  277. background: transparent;
  278. color: #83a3be;
  279. font-size: 32px;
  280. outline: none;
  281. appearance: none;
  282. height: 100%;
  283. border: none;
  284. &::placeholder {
  285. color: #83a3be;
  286. }
  287. }
  288. .tree-container {
  289. margin-top: 15px;
  290. display: flex;
  291. .tree-box {
  292. width: 100%;
  293. height: 920px;
  294. overflow-y: auto;
  295. padding: 15px 8px;
  296. :deep(.el-tree) {
  297. height: 100%;
  298. background-color: transparent;
  299. color: #fbffff;
  300. font-size: 38px;
  301. .el-tree-node__content {
  302. height: auto;
  303. padding-top: 10px;
  304. padding-bottom: 10px;
  305. white-space: normal;
  306. word-break: break-all;
  307. }
  308. .el-tree-node__expand-icon {
  309. color: #297cfc;
  310. font-size: 23px;
  311. }
  312. .el-tree-node:focus > .el-tree-node__content,
  313. .el-tree-node__content:hover {
  314. background-color: transparent !important;
  315. }
  316. }
  317. }
  318. }
  319. .select-box2 {
  320. margin-left: 30px;
  321. width: 910px;
  322. height: 100%;
  323. .select-header {
  324. display: flex;
  325. justify-content: space-between;
  326. align-items: center;
  327. color: #fbffff;
  328. font-size: 32px;
  329. border-bottom: 1px solid #247dff;
  330. padding: 20px;
  331. .left-item {
  332. display: flex;
  333. align-items: center;
  334. .text {
  335. margin: 0 10px;
  336. color: #00e8ff;
  337. font-family: 'BEBAS-1';
  338. }
  339. }
  340. .clear-btn {
  341. color: #00e8ff;
  342. cursor: pointer;
  343. }
  344. }
  345. .select-content {
  346. height: 858px;
  347. overflow-y: auto;
  348. .box-item {
  349. border-bottom: 1px solid #247dff;
  350. padding: 20px;
  351. position: relative;
  352. .line {
  353. color: #fff;
  354. font-size: 38px;
  355. display: flex;
  356. .text1 {
  357. margin-right: 35px;
  358. }
  359. .text2 {
  360. color: #a7ccdf;
  361. }
  362. }
  363. .close-btn {
  364. position: absolute;
  365. right: 10px;
  366. top: 50px;
  367. cursor: pointer;
  368. width: 29px;
  369. height: 29px;
  370. background: url('@/assets/images/emergencyCommandMap/communication/close.png') no-repeat;
  371. }
  372. }
  373. }
  374. }
  375. }
  376. </style>