index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <template>
  2. <u-sticky bgColor="#fff" style="box-shadow: 1px 1px 4px rgb(26 26 26 / 10%)">
  3. <u-tabs
  4. :list="list"
  5. :current="current"
  6. @click="tabsClick"
  7. lineColor="#333"
  8. :activeStyle="{ color: '#333' }"
  9. :inactiveStyle="{ color: '#909399' }"
  10. style="border-bottom: 1px solid #eaeef1"
  11. ></u-tabs>
  12. </u-sticky>
  13. <view class="informationSelect" @touchstart="fingerstart" @touchend="fingerend" style="background-color: #ffffff">
  14. <uni-swipe-action>
  15. <uni-swipe-action-item>
  16. <!-- 各类查询 start -->
  17. <view class="content">
  18. <u-input style="border-radius: 50px; margin-bottom: 10px" @blur="blur" v-model="dataInput" prefixIcon="search" prefixIconStyle="color: #0c7bf9" :placeholder="placeholderText"> </u-input>
  19. <u-empty v-if="!dataRes" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
  20. <view v-if="current == 8">
  21. <view class="con">
  22. <view class="time">{{ newTime }}</view>
  23. <video src="https://mbsvod.oss-cn-beijing.aliyuncs.com/cy-video.mp4" autoplay :controls="false" :show-center-play-btn="false" :loop="true" style="width: 100%"></video>
  24. </view>
  25. </view>
  26. <view v-else>
  27. <u-row v-for="po in classifyData" :key="po">
  28. <u-col span="4">
  29. <view style="text-align: right; padding: 0px 5px 0px 5px">{{ po.title }}</view>
  30. </u-col>
  31. <u-col span="8">
  32. <view style="text-align: left; padding: 0px 5px 0px 5px">{{ po.value }}</view>
  33. </u-col>
  34. </u-row>
  35. </view>
  36. </view>
  37. <!-- 各类查询 end -->
  38. </uni-swipe-action-item>
  39. </uni-swipe-action>
  40. </view>
  41. </template>
  42. <script setup>
  43. import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
  44. import { ref, onMounted, inject, shallowRef, reactive, watchEffect, getCurrentInstance } from "vue";
  45. import { publicStores, useStores } from "@/store/modules/index";
  46. import { dataList } from "@/api/business/mhxf/informationSelect";
  47. const publicStore = publicStores(); //全局公共Stores
  48. const { proxy } = getCurrentInstance();
  49. const dataInput = ref("");
  50. const current = ref(0);
  51. const classifyUrl = ref("");
  52. const classifyCode = ref("");
  53. const placeholderText = ref("");
  54. const dataRes = ref(1);
  55. const list = ref([
  56. {
  57. id: 1,
  58. name: "警情查询",
  59. },
  60. {
  61. id: 2,
  62. name: "火灾查询",
  63. },
  64. {
  65. id: 3,
  66. name: "人员查询",
  67. badge: {
  68. // isDot: true,
  69. // value: 5,
  70. },
  71. },
  72. {
  73. id: 4,
  74. name: "车辆查询",
  75. badge: {
  76. // value: 5,
  77. },
  78. },
  79. {
  80. id: 5,
  81. name: "站点查询",
  82. badge: {
  83. // value: 5,
  84. },
  85. },
  86. {
  87. id: 6,
  88. name: "消火栓",
  89. badge: {
  90. // value: 5,
  91. },
  92. },
  93. {
  94. id: 7,
  95. name: "重点单位",
  96. badge: {
  97. // value: 5,
  98. },
  99. },
  100. {
  101. id: 8,
  102. name: "消防检查信息",
  103. badge: {
  104. // value: 5,
  105. },
  106. },
  107. {
  108. id: 9,
  109. name: "视频监控",
  110. badge: {
  111. // value: 5,
  112. },
  113. },
  114. ]);
  115. const startData = ref({
  116. clientX: "",
  117. clientY: "",
  118. });
  119. const updDistance = ref(100);
  120. const lrDistance = ref(50);
  121. const topMed = ref("");
  122. const bottomMed = ref("");
  123. const leftMed = ref("");
  124. const rightMed = ref("");
  125. const classifyData = ref([]); //警情查询数据存储
  126. /**
  127. * @当按下去的时候
  128. */
  129. function fingerstart(e) {
  130. // 记录 距离可视区域左上角 左边距 和 上边距
  131. startData.value.clientX = e.changedTouches[0].clientX;
  132. startData.value.clientY = e.changedTouches[0].clientY;
  133. }
  134. /**
  135. * @当抬起来的时候
  136. */
  137. function fingerend(e) {
  138. // 当前位置 减去 按下位置 计算 距离
  139. const subX = e.changedTouches[0].clientX - startData.value.clientX;
  140. const subY = e.changedTouches[0].clientY - startData.value.clientY;
  141. if (subY > updDistance.value || subY < -updDistance.value) {
  142. if (subY > updDistance.value) {
  143. bottomscroll(subY);
  144. } else if (subY < -updDistance.value) {
  145. topscroll(subY);
  146. }
  147. } else {
  148. if (subX > lrDistance.value) {
  149. rightscroll(subX);
  150. } else if (subX < -lrDistance.value) {
  151. leftscroll(subX);
  152. } else {
  153. console.log("无效操作");
  154. }
  155. }
  156. }
  157. /**
  158. * @上滑触发
  159. */
  160. function topscroll(dista) {
  161. topMed.value ? (topMed.value = dista) : (topMed.value = null);
  162. console.log("触发了上滑方法!");
  163. }
  164. /**
  165. * @下滑触发
  166. */
  167. function bottomscroll(dista) {
  168. bottomMed.value ? (bottomMed.value = dista) : (bottomMed.value = null);
  169. console.log("触发了下滑方法!");
  170. }
  171. /**
  172. * @右滑触发
  173. */
  174. function rightscroll(dista) {
  175. rightMed.value ? (rightMed.value = dista) : (rightMed.value = null);
  176. console.log("触发了右滑方法!");
  177. if (current.value >= 1) {
  178. current.value--;
  179. } else {
  180. current.value = list.value.length - 1;
  181. }
  182. }
  183. /**
  184. * @左滑触发
  185. */
  186. function leftscroll(dista) {
  187. leftMed.value ? (leftMed.value = dista) : (leftMed.value = null);
  188. console.log("触发了左滑方法!");
  189. if (current.value < list.value.length - 1) {
  190. current.value++;
  191. } else {
  192. current.value = 0;
  193. }
  194. }
  195. function blur(e) {
  196. if (dataInput.value) {
  197. goSearch();
  198. }
  199. }
  200. /**
  201. * @tabs点击事件
  202. */
  203. function tabsClick(e) {
  204. current.value = e.index;
  205. console.log(current.value);
  206. dataInput.value = "";
  207. dataRes.value = 1;
  208. }
  209. function goSearch() {
  210. if (current.value == 0) {
  211. //警情查询
  212. classifyUrl.value = "/service-fire/demPoliceInfo/page";
  213. placeholderText.value = "请输入案件编号";
  214. classifySearch(classifyUrl.value, {
  215. caseCode: dataInput.value,
  216. });
  217. } else if (current.value == 1) {
  218. //火灾查询
  219. placeholderText.value = "请输入火灾地址";
  220. classifyUrl.value = "/service-fire/demFireStatisticsAttach/page";
  221. classifySearch(classifyUrl.value, {
  222. address: dataInput.value,
  223. });
  224. } else if (current.value == 2) {
  225. //人员查询
  226. placeholderText.value = "请输入值班人员名称";
  227. classifyUrl.value = "/service-fire/unitBeOnDuty/list";
  228. classifySearch(classifyUrl.value, {
  229. name: dataInput.value,
  230. });
  231. } else if (current.value == 3) {
  232. //车辆信息
  233. placeholderText.value = "请输入车牌号";
  234. classifyUrl.value = "/service-fire/unitBeOnDuty/vehiclelist";
  235. classifySearch(classifyUrl.value, {
  236. licensePlate: dataInput.value,
  237. });
  238. } else if (current.value == 4) {
  239. //站点查询
  240. placeholderText.value = "请输入站点名称";
  241. classifyUrl.value = "/service-fire/unitBeOnDuty/page";
  242. classifySearch(classifyUrl.value, {
  243. stationName: dataInput.value,
  244. });
  245. } else if (current.value == 5) {
  246. //消火栓
  247. placeholderText.value = "请输入水源名称";
  248. classifyUrl.value = "/service-fire/demWaterSource/waterSourceList";
  249. classifySearch(classifyUrl.value, {
  250. waterName: dataInput.value,
  251. });
  252. } else if (current.value == 6) {
  253. //重点单位
  254. placeholderText.value = "请输入单位名称";
  255. classifyUrl.value = "/service-fire/baseCompany/companyList";
  256. classifySearch(classifyUrl.value, {
  257. companyName: dataInput.value,
  258. });
  259. } else if (current.value == 7) {
  260. //消防检查信息
  261. placeholderText.value = "请输入单位ID";
  262. classifyUrl.value = "/service-fire/demFireInspect/fireInspectList";
  263. classifySearch(classifyUrl.value, {
  264. companyId: dataInput.value,
  265. });
  266. } else if (current.value == 8) {
  267. //消防检查信息
  268. placeholderText.value = "";
  269. // classifyUrl.value = "/service-fire/demFireInspect/fireInspectList";
  270. // classifySearch(classifyUrl.value, {
  271. // companyId: dataInput.value,
  272. // });
  273. }
  274. }
  275. //分类信息查询 start
  276. async function classifySearch(URL, params) {
  277. proxy.$modal.loading("加载中");
  278. classifyData.value = [];
  279. dataList(URL, params).then((res) => {
  280. proxy.$modal.closeLoading();
  281. if (res.status == "SUCCESS") {
  282. if (current.value == 2) {
  283. if (res.data.length) {
  284. dataRes.value = 1;
  285. } else {
  286. dataRes.value = 0;
  287. }
  288. var records = res.data[0][0];
  289. } else if (current.value == 3) {
  290. if (res.data.length) {
  291. dataRes.value = 1;
  292. } else {
  293. dataRes.value = 0;
  294. }
  295. var records = res.data[0];
  296. } else {
  297. // console.log('111111111')
  298. // console.log(res.data.records.length)
  299. // console.log('111222')
  300. if (res.data.total) {
  301. dataRes.value = 1;
  302. } else {
  303. dataRes.value = 0;
  304. }
  305. var records = res.data.records[0];
  306. }
  307. console.log(dataRes.value + "------1");
  308. switch (current.value) {
  309. case 0: //警情查询
  310. var classifyTitle = [
  311. "案件编号",
  312. "主管支队",
  313. "案件时间段",
  314. "通知到场时间",
  315. "通知出水时间",
  316. "通知控制时间",
  317. "通知熄火时间",
  318. "通知返队时间",
  319. "区域",
  320. "案件类型",
  321. "案发地址",
  322. "立案时间",
  323. "立案日期",
  324. "处置对象",
  325. "案件等级",
  326. "主管中队",
  327. "区县",
  328. "案件状态",
  329. "案件性质",
  330. "填表时间",
  331. "街镇",
  332. "创建时间",
  333. ];
  334. var classifyValue = [
  335. records.caseCode,
  336. records.branch,
  337. records.timeSlot,
  338. records.noticeArrivalTime,
  339. records.noticeEffluentTime,
  340. records.controlTime,
  341. records.quenchTime,
  342. records.returnTime,
  343. records.caseArea,
  344. records.caseTypeCode,
  345. records.address,
  346. records.filingTime,
  347. records.filingDate,
  348. records.handleObject,
  349. records.caseLevel,
  350. records.squadron,
  351. records.district,
  352. records.caseStatus,
  353. records.caseNature,
  354. records.bdpAudit,
  355. records.streetTown,
  356. records.createTime,
  357. ];
  358. break;
  359. case 1: //火灾查询
  360. var classifyTitle = [
  361. "地区",
  362. "街镇",
  363. "经度",
  364. "维度",
  365. "平台ID",
  366. "火灾地址",
  367. "过火面积",
  368. "直接财产损失",
  369. "死亡人数",
  370. "受伤人数",
  371. "受灾户数",
  372. "火灾原因",
  373. "火灾等级",
  374. "场所一级",
  375. "场所二级",
  376. "起火物一级",
  377. "起火物二级",
  378. "性质",
  379. ];
  380. var classifyValue = [
  381. records.district,
  382. records.street,
  383. records.longitude,
  384. records.latitude,
  385. records.id,
  386. records.address,
  387. records.burnedArea,
  388. records.propertyLoss,
  389. records.deathToll,
  390. records.nonFatal,
  391. records.disasterHome,
  392. records.fireCause,
  393. records.fireLevel,
  394. records.placeOne,
  395. records.placeTwo,
  396. records.fireGoodsOne,
  397. records.fireGoodsTwo,
  398. records.nature,
  399. ];
  400. break;
  401. case 2: //人员查询
  402. var classifyTitle = ["值班人员信息", "岗位名称", "机构名称", "机构简称", "机构地址", "值班日期"];
  403. var classifyValue = [records.name, records.postName, records.organizationName, records.organizationShort, records.organizationAddress, records.time];
  404. break;
  405. case 3: //车辆查询
  406. var classifyTitle = [
  407. "车辆信息",
  408. "单件装备编码",
  409. "装备名称",
  410. "装备编码",
  411. "上级装备编码",
  412. "所属消防机构",
  413. "车牌号码",
  414. "资产编号",
  415. "商标",
  416. "颜色",
  417. "生产厂家名称",
  418. "有效期至",
  419. "车架号",
  420. "发动机编号",
  421. "批次号",
  422. "电台呼号",
  423. "车辆简称",
  424. "电台频道",
  425. "指挥员姓名",
  426. "驾驶员",
  427. ];
  428. var classifyValue = [
  429. records.vehicleId,
  430. records.singleEquipCode,
  431. records.equipName,
  432. records.equipCode,
  433. records.superiorEquipCode,
  434. records.fireOrga,
  435. records.licensePlate,
  436. records.assetCode,
  437. records.assetCode,
  438. records.colour,
  439. records.productName,
  440. records.validityTime,
  441. records.frameCode,
  442. records.engineCode,
  443. records.batchCode,
  444. records.radioCallSign,
  445. records.vehicleAbbreviat,
  446. records.radioChannel,
  447. records.commanderName,
  448. records.driver,
  449. ];
  450. break;
  451. case 4: //站点查询
  452. var classifyTitle = [
  453. "平台ID",
  454. "支队名称",
  455. "所属辖区中队",
  456. "消防站名称",
  457. "单位性质",
  458. "地址",
  459. "所在位置",
  460. "联动固定电话",
  461. "负责人姓名",
  462. "负责人手机号码",
  463. "备注",
  464. "消防站类型",
  465. "经度",
  466. "维度",
  467. "创建时间",
  468. "更新时间",
  469. "支队id",
  470. "中队id",
  471. "编号",
  472. "原单位性质",
  473. ];
  474. var classifyValue = [
  475. records.id,
  476. records.branchName,
  477. records.squadron,
  478. records.stationName,
  479. records.companyNature,
  480. records.address,
  481. records.location,
  482. records.fixedPhone,
  483. records.chargeName,
  484. records.chargePhone,
  485. records.remark,
  486. records.stationType,
  487. records.longitude,
  488. records.dimension,
  489. records.createTime,
  490. records.updateTime,
  491. records.branchId,
  492. records.squadronId,
  493. records.number,
  494. records.primaryCompanyNature,
  495. ];
  496. break;
  497. case 5: //消火栓
  498. var classifyTitle = [
  499. "可用状态名称",
  500. "消防站简介",
  501. "水源地址",
  502. "建造时间",
  503. "消火栓接口形式",
  504. "水源类型",
  505. "管辖机构名称",
  506. "取水形式",
  507. "联系方式",
  508. "可用状态",
  509. "水源性质",
  510. "水源名称",
  511. "管网单位",
  512. "管网压力",
  513. ];
  514. var classifyValue = [
  515. records.availableStatusName,
  516. records.fireAbbreviat,
  517. records.waterAddress,
  518. records.buildTime,
  519. records.hydrantInterface,
  520. records.waterType,
  521. records.organizateName,
  522. records.waterForm,
  523. records.contactMode,
  524. records.availableStatus,
  525. records.waterNature,
  526. records.waterName,
  527. records.pipeCompany,
  528. records.pipePressure,
  529. ];
  530. break;
  531. case 6: //重点单位
  532. var classifyTitle = [
  533. "单位联系电话",
  534. "单位详细地址",
  535. "职工人数",
  536. "单位类型",
  537. "消防安全责任人姓名",
  538. "法人代表姓名",
  539. "单位名称",
  540. "消防安全管理人姓名",
  541. "单位主属性",
  542. "建筑面积",
  543. "行政区域",
  544. "单位成立时间",
  545. "占地面积",
  546. "火灾危险性",
  547. "创建时间",
  548. "单位性质",
  549. "固定资产(单位:万元)",
  550. ];
  551. var classifyValue = [
  552. records.linkPhone,
  553. records.address,
  554. records.employeeNum,
  555. records.companyType,
  556. records.fireDutyName,
  557. records.delegateName,
  558. records.companyName,
  559. records.fireManageName,
  560. records.mainAttribute,
  561. records.buildArea,
  562. records.administrativeDivision,
  563. records.foundTimecoverArea,
  564. records.coverArea,
  565. records.fireHazard,
  566. records.createTime,
  567. records.companyNature,
  568. records.fixedAssets,
  569. ];
  570. break;
  571. case 7: //消防检查信息
  572. var classifyTitle = ["单位ID", "检查人员ID", "计划生成时间", "检查结果", "创建人", "创建时间", "检查员名称", "检查员职位", "单位电话"];
  573. var classifyValue = [
  574. records.companyId,
  575. records.personId,
  576. records.planTime,
  577. records.inspectResult,
  578. records.creator,
  579. records.createTime,
  580. records.personName,
  581. records.personPosition,
  582. records.linkPhone,
  583. ];
  584. break;
  585. // default:
  586. // 默认代码块
  587. }
  588. for (var i = 0; i < classifyTitle.length; i++) {
  589. var obj = {};
  590. obj.title = classifyTitle[i];
  591. obj.value = classifyValue[i];
  592. classifyData.value.push(obj);
  593. // console.log(classifyData.value);
  594. }
  595. } else {
  596. }
  597. });
  598. }
  599. // end
  600. watchEffect(() => {
  601. goSearch();
  602. });
  603. // start
  604. const newTime = ref("");
  605. function getNowTime() {
  606. var date = new Date();
  607. var time =
  608. addZero(date.getFullYear()) +
  609. "-" +
  610. addZero(date.getMonth() + 1) +
  611. "-" +
  612. addZero(date.getDate()) +
  613. " " +
  614. addZero(date.getHours()) +
  615. ":" +
  616. addZero(date.getMinutes()) +
  617. ":" +
  618. addZero(date.getSeconds());
  619. newTime.value = time;
  620. }
  621. //根据自己的需求,看要不要在时间不大于10的时候在前面补0,如果需要直接addZero(date.getMinutes()),其它与之相同,如果不需要删掉addZero()方法即可。
  622. //小于10的拼接上0字符串
  623. function addZero(s) {
  624. return s < 10 ? "0" + s : s;
  625. }
  626. // end
  627. // 自定义导航事件
  628. onNavigationBarButtonTap((e) => {
  629. if (e.float == "right") {
  630. uni.navigateTo({
  631. url: "/pages/business/mhxf/xunJian/collect/components/collectRecord",
  632. });
  633. } else {
  634. }
  635. });
  636. onLoad((options) => {
  637. getNowTime(); //进入页面调用该方法获取当前时间
  638. clearInterval(myTimeDisplay); //销毁之前定时器
  639. var myTimeDisplay = setInterval(() => {
  640. getNowTime(); //每秒更新一次时间
  641. }, 1000);
  642. });
  643. onReady(() => {});
  644. onMounted(() => {});
  645. </script>
  646. <style lang="scss">
  647. .uni-swipe {
  648. overflow: visible;
  649. }
  650. body {
  651. background: #fff;
  652. }
  653. .is-selected {
  654. color: #1989fa;
  655. }
  656. .informationSelect {
  657. height: calc(100vh - 88px);
  658. background-color: #ffffff;
  659. .content {
  660. padding: 10px;
  661. .u-row {
  662. height: 36px;
  663. line-height: 36px;
  664. .u-col {
  665. border: 1px #e4e3e3 solid;
  666. border-right: 0px;
  667. border-bottom: 0px;
  668. text-align: center;
  669. view {
  670. padding: 0 10px;
  671. min-height: 36px;
  672. overflow: hidden; //超出的文本隐藏
  673. // text-overflow: ellipsis; //溢出用省略号显示
  674. overflow: auto;
  675. white-space: nowrap; // 默认不换行;
  676. font-size: 14px;
  677. }
  678. }
  679. .u-col:last-child {
  680. border-right: 1px #e4e3e3 solid;
  681. }
  682. }
  683. .u-row:last-child {
  684. .u-col {
  685. border-bottom: 1px #e4e3e3 solid;
  686. }
  687. }
  688. }
  689. }
  690. </style>
  691. <style scoped>
  692. body,
  693. uni-page-body,
  694. uni-page-refresh,
  695. .grayBackgroundColor {
  696. background: rgb(241, 241, 241);
  697. }
  698. .time {
  699. position: absolute;
  700. z-index: 99999;
  701. top: 3px;
  702. left: 3px;
  703. display: inline-block;
  704. color: #fff;
  705. }
  706. .con {
  707. text-align: center;
  708. position: relative;
  709. }
  710. .bg-white {
  711. background-color: #ffffff;
  712. }
  713. body {
  714. background: #fff;
  715. }
  716. </style>