index.vue 20 KB

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