index.vue 19 KB

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