emergencyOfficials.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <div class="container">
  3. <div v-show="!isShowStructure" class="page-head">
  4. <van-search
  5. v-model="keywords"
  6. placeholder="请输入搜索关键词"
  7. :left-icon="searchImg"
  8. :right-icon="closeImg"
  9. @search="onSearch"
  10. />
  11. <div class="select-box">
  12. <div class="adress-box" @click="showStructure">
  13. <div class="blue-rectangle" />
  14. <div v-if="!!requestParameters.checkedId" class="block1">
  15. <div>{{ upOneLevel }}</div>
  16. <div style="margin: 0 5px">{{ ">" }}</div>
  17. <div style="color: #1d92ff">{{ adressContent }}</div>
  18. </div>
  19. <div v-else class="block1" style="height: 27px">
  20. <div>广东省</div>
  21. <div style="margin: 0 5px">{{ ">" }}</div>
  22. <div style="color: #1d92ff">茂名市</div>
  23. </div>
  24. </div>
  25. <div />
  26. </div>
  27. <hr style="color: #f9f9f9" />
  28. </div>
  29. <div v-show="!isShowStructure" class="scroll-list">
  30. <van-list
  31. v-model:loading="loading"
  32. :finished="finished"
  33. finished-text="没有更多了"
  34. @load="onLoad"
  35. >
  36. <div v-for="(item, index) in persons" :key="item.id">
  37. <div class="person-box2" @click="personInform(item)">
  38. <div class="circle">
  39. <img :src="onlineUser" alt="" />
  40. </div>
  41. <div style="display: flex">
  42. <div class="information-card2">
  43. <div style="display: flex">
  44. <div style="font-weight: bold">{{ item.name }}</div>
  45. </div>
  46. <div style="display: flex">
  47. <div style="font-size: 13px; margin-top: 5px; color: #979797">
  48. {{ item.unit }}&nbsp;&nbsp;{{ item.position }}
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="link-top" />
  55. </div>
  56. </van-list>
  57. </div>
  58. <organizationalStructure
  59. v-if="isShowStructure"
  60. v-model:isShowStructure="isShowStructure"
  61. @confirm="handleSelect"
  62. />
  63. </div>
  64. </template>
  65. <script setup lang="ts">
  66. import offlineUser from "@/assets/images/threePreventionResponsiblePerson/offlineUsers.png";
  67. import onlineUser from "@/assets/images/threePreventionResponsiblePerson/onlineUsers.png";
  68. import { getDicts } from "@/api/system/dict/data";
  69. import { getEventList } from "@/api/event";
  70. import searchImg from "@/assets/images/search.png";
  71. import closeImg from "@/assets/images/close.png";
  72. import OrganizationalStructure from "@/views/threePreventionResponsiblePerson/organizationalStructure.vue";
  73. import { getPersonalData, getPersonalType } from "@/api/persons";
  74. import { listContact } from "@/api/duty/eventing";
  75. /*
  76. const list = ref([
  77. {
  78. id: "1",
  79. name: "谢和平",
  80. unit: "茂名市应急管理局",
  81. position: "一级科员",
  82. title: "教授",
  83. expertType: "其它突发事件"
  84. },
  85. {
  86. id: "2",
  87. name: "谢和平",
  88. unit: "茂名市应急管理局",
  89. position: "一级科员",
  90. title: "教授",
  91. expertType: "其它突发事件"
  92. },
  93. {
  94. id: "3",
  95. name: "谢和平",
  96. unit: "茂名市应急管理局",
  97. position: "一级科员",
  98. title: "教授",
  99. expertType: "其它突发事件"
  100. },
  101. {
  102. id: "4",
  103. name: "谢和平",
  104. unit: "茂名市应急管理局",
  105. position: "一级科员",
  106. title: "教授",
  107. expertType: "其它突发事件"
  108. },
  109. {
  110. id: "5",
  111. name: "谢和平",
  112. unit: "茂名市应急管理局",
  113. position: "一级科员",
  114. title: "教授",
  115. expertType: "其它突发事件"
  116. },
  117. {
  118. id: "6",
  119. name: "谢和平",
  120. unit: "茂名市应急管理局",
  121. position: "一级科员",
  122. title: "教授",
  123. expertType: "其它突发事件"
  124. },
  125. {
  126. id: "7",
  127. name: "谢和平",
  128. unit: "茂名市应急管理局",
  129. position: "一级科员",
  130. title: "教授",
  131. expertType: "其它突发事件"
  132. },
  133. {
  134. id: "8",
  135. name: "谢和平",
  136. unit: "茂名市应急管理局",
  137. position: "一级科员",
  138. title: "教授",
  139. expertType: "其它突发事件"
  140. },
  141. {
  142. id: "9",
  143. name: "谢和平",
  144. unit: "茂名市应急管理局",
  145. position: "一级科员",
  146. title: "教授",
  147. expertType: "其它突发事件"
  148. },
  149. {
  150. id: "10",
  151. name: "谢和平",
  152. unit: "茂名市应急管理局",
  153. position: "一级科员",
  154. title: "教授",
  155. expertType: "其它突发事件"
  156. }
  157. ]);
  158. */
  159. const router = useRouter();
  160. const keywords = ref("");
  161. let responsibility_type = ref([]);
  162. const fieldValue = ref("三防指挥部");
  163. const showPicker = ref(false);
  164. const onConfirm = ({ selectedValues, selectedOptions }) => {
  165. showPicker.value = false; //用于控制 van-picker 组件的显示状态,将其设置为 false 表示隐藏选择器。
  166. requestParameters.value.type_parent_id = selectedValues.toString(); //将用户选择的值(selectedValues)保存到 requestParameters 对象的 type_content 属性中
  167. fieldValue.value = selectedOptions[0].dictLabel; //将用户选择的第一个选项的 dictLabel 属性值保存到 fieldValue 中
  168. requestParameters.value.page = 1;
  169. onLoad();
  170. };
  171. const loading = ref(false);
  172. const finished = ref(false);
  173. const customFieldName = {
  174. text: "dictLabel",
  175. value: "dictValue"
  176. };
  177. const requestParameters = ref({
  178. name: "",
  179. type: [],
  180. type_parent_id: "",
  181. page: 1,
  182. pageSize: 10,
  183. contactName: keywords,
  184. checkedId: ""
  185. });
  186. const personInform = item => {
  187. router.push({ name: "CadreInformation", query: { id: item.id } });
  188. };
  189. const persons = ref([]);
  190. const onLoad = () => {
  191. /*
  192. getPersonalData(requestParameters.value).then(res => {
  193. var item = res.data || [];
  194. // 重置 persons 数组(如果是第一页)
  195. if (requestParameters.value.page == 1) {
  196. persons.value = [];
  197. }
  198. // 将新数据添加到 persons 数组中
  199. item.forEach(temp => {
  200. persons.value.push(temp);
  201. });
  202. // 检查是否加载了所有数据
  203. if (persons.value.length >= res.total) {
  204. finished.value = true;
  205. } else {
  206. finished.value = false;
  207. }
  208. requestParameters.value.page++;
  209. loading.value = false;
  210. });
  211. */
  212. listContact(requestParameters.value).then(res => {
  213. var item = res.data || [];
  214. // 重置 persons 数组(如果是第一页)
  215. if (requestParameters.value.page == 1) {
  216. persons.value = [];
  217. }
  218. // 将新数据添加到 persons 数组中
  219. item.forEach(i => {
  220. persons.value.push({
  221. id: i.id,
  222. name: i.contactName,
  223. unit: i.unitName,
  224. position: i.position,
  225. phone: i.phone
  226. });
  227. });
  228. // 检查是否加载了所有数据
  229. if (persons.value.length >= res.total) {
  230. finished.value = true;
  231. } else {
  232. finished.value = false;
  233. }
  234. requestParameters.value.page++;
  235. loading.value = false;
  236. });
  237. };
  238. onMounted(() => {
  239. // getDicts("responsibility_type").then(res => {
  240. // res.data.unshift({ dictLabel: "所有类型", dictValue: "" });
  241. // responsibility_type.value = res.data;
  242. // });
  243. //getPersonalType(requestParameters.value).then(res => {
  244. // responsibility_type = res.data || [];
  245. //});
  246. onLoad();
  247. });
  248. const onSearch = keywords => {
  249. requestParameters.value.page = 1;
  250. onLoad();
  251. };
  252. const showPersonalInformation = item => {
  253. router.push({ name: "PersonInformation", query: { id: item.id } });
  254. };
  255. let keyword = ref("");
  256. let treeRef = ref();
  257. let checkData = ref([]);
  258. const isShowStructure = ref(false);
  259. const showStructure = () => {
  260. isShowStructure.value = true;
  261. };
  262. const adressContent = ref();
  263. const upOneLevel = ref();
  264. const filterNode = (value, data) => {
  265. if (!value) return true;
  266. return data.label.indexOf(value) !== -1;
  267. };
  268. let selectedTreeId = ref([]);
  269. const handleSelect = data => {
  270. adressContent.value = data.label;
  271. upOneLevel.value = data.value;
  272. requestParameters.value.checkedId = data.id;
  273. };
  274. </script>
  275. <style scoped lang="scss">
  276. .container {
  277. height: calc(100vh - 55px);
  278. display: flex;
  279. flex-direction: column;
  280. }
  281. .select-box {
  282. display: flex;
  283. flex-direction: row;
  284. justify-content: space-between;
  285. margin-top: -2px;
  286. background: #fff;
  287. }
  288. .circle {
  289. width: 55px;
  290. height: 55px;
  291. border-radius: 50%;
  292. background-color: #eaeaea;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. color: black;
  297. font-size: 15px;
  298. margin: 15px 5px 15px;
  299. }
  300. .person-box {
  301. display: flex;
  302. flex-direction: row;
  303. margin-left: 10px;
  304. }
  305. .person-box2 {
  306. display: flex;
  307. flex-direction: row;
  308. padding-left: 8px;
  309. background-color: #ffffff;
  310. }
  311. .information-card {
  312. display: flex;
  313. flex-direction: column;
  314. margin-left: 10px;
  315. width: 250px;
  316. }
  317. .block {
  318. width: 100%;
  319. height: 100%;
  320. background-color: #f2f2f2;
  321. }
  322. .page-head {
  323. width: 100%;
  324. }
  325. .blue-rectangle {
  326. width: 6px;
  327. height: 20px;
  328. background-image: linear-gradient(180deg, #00fce7 0%, #2c81ff 100%);
  329. border-radius: 0 3px 0 0;
  330. margin-left: -10px;
  331. }
  332. .adress-box {
  333. display: flex;
  334. flex-direction: row;
  335. padding-top: 10px;
  336. width: 50%;
  337. margin-left: 20px;
  338. }
  339. .link-top {
  340. height: 0.5px;
  341. border-top: solid #f2f2f2 1px;
  342. }
  343. .block1 {
  344. display: flex;
  345. flex-direction: row;
  346. margin-left: 5px;
  347. }
  348. .scroll-list {
  349. flex: 1;
  350. overflow: scroll;
  351. }
  352. .information-card2 {
  353. display: flex;
  354. flex-direction: column;
  355. justify-content: center;
  356. margin-left: 10px;
  357. width: 230px;
  358. margin-top: 2px;
  359. }
  360. .common-search {
  361. :deep(.van-field__right-icon) {
  362. width: 30px;
  363. height: 30px;
  364. padding: 0;
  365. .van-icon__image {
  366. width: 30px;
  367. height: 30px;
  368. }
  369. }
  370. }
  371. </style>