safetyCheck.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. <!-- 计划列表 -->
  2. <template>
  3. <view class="planDetail">
  4. <view class="header">
  5. <img class="header-bg" :src="imagesUrl('commonality/bg_1.png')">
  6. <view class="tabTitle">
  7. <view class="tabTitle_li" @tap="tabClick(index)" :key="index" v-for="(item,index) in tabText">
  8. <view class="tabTitle_text">
  9. <img :src="item.img">
  10. <view
  11. :id="curTab==index && curTab==0?'fontColor-A':(curTab==index && curTab==1?'fontColor-B':'')">
  12. {{item.name}}
  13. </view>
  14. <view>{{item.title}}</view>
  15. </view>
  16. <view class="line"></view>
  17. <view :class="{on:curTab==index}" class="tabTitle_across">
  18. <img :src="imagesUrl('commonality/img_xyzc_bg@1x.png')">
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 列表部分 -->
  24. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  25. <view class="list">
  26. <view class="list-li" @click="planClick(item)" v-for="(item,index) in dataList">
  27. <img :src="imagesUrl('safetyCheck/icon_aqjc_jh@1x.png')">
  28. <view>{{item.planTitle}}</view>
  29. <img :src="imagesUrl('commonality/icon_wd_gd@1x.png')">
  30. </view>
  31. </view>
  32. <view class="get-data-p" v-if="!getDataType">
  33. <img class="get-data-img" :src="imagesUrl('safetyCheck/icon_aqjc_sl.png')">
  34. <view class="get-data-text">上拉加载</view>
  35. </view>
  36. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  37. </scroll-view>
  38. <view class="subBtn">
  39. <img class="subBtn-img" @click="saoCode()"
  40. :src="imagesUrl('safetyCheck/icon_aqjc_saoma.png')">
  41. </view>
  42. <view class="patrolLoginButton" v-if="patrolLoginType" @click="clickOut()">退出登录</view>
  43. <!-- 弹窗部分 -->
  44. <view class="shade" v-if="dialogVisible">
  45. <view class="null-box" @click="dialogClose()"></view>
  46. <view class="shade_n">
  47. <view class="title">
  48. <view>检查批次</view>
  49. </view>
  50. <view class="batch">
  51. <view class="batch-li" @click="batchClick(item)"
  52. v-for="(item,index) in batchList.checkPlanSetVoList">
  53. <view class="batch-li-l">
  54. <text>{{item.checkName}}</text>
  55. <text>开始检查日期:{{item.checkStartTime}}</text>
  56. </view>
  57. <view class="batch-li-r">检查进度{{item.checkSetProgress}}%
  58. <img :src="imagesUrl('commonality/icon_wd_gd@1x.png')">
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="shade-box" v-if="securityCheck">
  65. <view class="null-box" @click="goPage('securityCheck',false)"></view>
  66. <view class="shade_n">
  67. <view class="title">
  68. <view>请选择实验室</view>
  69. </view>
  70. <view class="batch">
  71. <view class="batch-li" @click="batchClickTow(item)" v-for="(item,index) in subjectData">
  72. <view class="batch-li-l">
  73. <text>{{item.planTitle}}-{{item.checkName}}</text>
  74. <text>{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</text>
  75. </view>
  76. <view class="batch-li-r">
  77. <img :src="imagesUrl('commonality/icon_wd_gd@1x.png')">
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. logout
  88. } from '@/pages/api/index.js'
  89. import {
  90. config
  91. } from '@/api/request/config.js'
  92. import {
  93. securityAppCheckPlanTitleList,
  94. } from '@/pages_safetyCheck/api/index.js'
  95. import {
  96. securityAppCheckPlanScanCode,
  97. } from '@/pages_safetyCheck/api/index.js'
  98. import { pageScanCode } from '@/utils/scanTheCode'
  99. export default {
  100. name: "planDetail",
  101. data() {
  102. return {
  103. patrolLoginType:uni.getStorageSync('patrolLoginType'),
  104. pageType: 0,
  105. tabText: [{
  106. name: '校级检查',
  107. title: '学校检查计划',
  108. img: this.imagesUrl('safetyCheck/icon_aqjc_xjjc@1x.png'),
  109. },
  110. {
  111. name: '学院自查',
  112. title: '学院自查计划',
  113. img: this.imagesUrl('safetyCheck/icon_aqjc_xxzc@1x.png'),
  114. },
  115. // {
  116. // name: '现场检查',
  117. // title: '检查隐患草稿',
  118. // img: this.imagesUrl('safetyCheck/icon_aqjc_xcjc@1x.png'),
  119. // },
  120. {
  121. name: '随手拍',
  122. title: '隐患上报整改',
  123. img: this.imagesUrl('safetyCheck/icon_aqjc_ssp@1x.png'),
  124. },
  125. ],
  126. //校级/院级
  127. curTab: 0,
  128. queryParams: {
  129. page: 1,
  130. pageSize: 20,
  131. checkCategory: 1, //1校院巡查 2学院自查
  132. },
  133. total: 0,
  134. dataList: [],
  135. getDataType: false,
  136. dialogVisible: false,
  137. batchList: [],
  138. batchData: {},
  139. securityCheck:false,
  140. subjectData: [],
  141. }
  142. },
  143. onLoad(option) {
  144. this.$set(this,'securityCheck',false)
  145. this.getList()
  146. },
  147. onShow() {
  148. this.acceptSaoCode();
  149. },
  150. onHide() {
  151. uni.$off('acceptSaoCode');
  152. },
  153. mounted() {
  154. },
  155. methods: {
  156. //退出按钮
  157. clickOut() {
  158. let self = this;
  159. uni.showModal({
  160. // title: '确认要退出吗?',
  161. content: '确认要退出吗',
  162. cancelColor: "#999",
  163. confirmColor: "#0183FA",
  164. success: function(res) {
  165. if (res.confirm) {
  166. self.logout();
  167. } else if (res.cancel) {}
  168. }
  169. });
  170. },
  171. //退出登录
  172. async logout() {
  173. let self = this;
  174. const {
  175. data
  176. } = await logout();
  177. if (data.code == 200) {
  178. uni.removeStorageSync('token');
  179. uni.removeStorageSync('userId');
  180. uni.removeStorageSync('userType');
  181. uni.redirectTo({
  182. url: '/pages/views/login/patrolLogin',
  183. });
  184. }
  185. },
  186. //滚动加载事件
  187. scrollGet() {
  188. let self = this;
  189. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  190. this.$set(this, 'getDataType', true);
  191. } else {
  192. this.queryParams.page += 1;
  193. this.$nextTick(() => {
  194. this.getList();
  195. })
  196. }
  197. },
  198. /******调用摄像头******/
  199. saoCode() {
  200. pageScanCode();
  201. },
  202. acceptSaoCode(){
  203. let self = this;
  204. uni.$on('acceptSaoCode', (codeData) => {
  205. if (codeData.subId) {
  206. self.securityAppCheckPlanScanCode(codeData.subId,self.planSetId);
  207. } else {
  208. uni.showToast({
  209. title: '请扫描正确的二维码',
  210. icon: "none",
  211. mask: true,
  212. duration: 2000
  213. });
  214. }
  215. });
  216. },
  217. //查询计划
  218. async securityAppCheckPlanScanCode(subId,planSetId) {
  219. let self = this;
  220. let checkCategory = null;
  221. if(uni.getStorageSync('identityData')){
  222. if(uni.getStorageSync('identityData').type=='collegeAdmin'){
  223. checkCategory=2
  224. }else if(uni.getStorageSync('identityData').type=='schoolAdmin'){
  225. checkCategory=1
  226. }
  227. }
  228. let obj = {
  229. subId:subId,
  230. checkCategory:checkCategory,
  231. };
  232. if(planSetId){
  233. obj.planSetId = planSetId;
  234. }
  235. const {
  236. data
  237. } = await securityAppCheckPlanScanCode(obj);
  238. if (data.code == 200) {
  239. if(data.data[0]){
  240. if(data.data[1]){
  241. //多个
  242. self.$set(self,'subjectData',data.data);
  243. self.$set(self,'securityCheck',true);
  244. }else{
  245. //单个
  246. let infoData = data.data[0];
  247. infoData.pageType = 0;
  248. uni.navigateTo({
  249. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' + encodeURIComponent(
  250. JSON.stringify(infoData))
  251. });
  252. }
  253. }else{
  254. //没有
  255. uni.showToast({
  256. title: '该实验室暂无检查计划!',
  257. icon: "none",
  258. mask: true,
  259. duration: 2000
  260. });
  261. }
  262. }
  263. },
  264. batchClickTow(row) {
  265. let infoData = row;
  266. infoData.pageType = 0;
  267. uni.navigateTo({
  268. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' + encodeURIComponent(
  269. JSON.stringify(infoData))
  270. });
  271. },
  272. //安全检查扫码控制显示隐藏
  273. goPage(type,status) {
  274. if (type == 'securityCheck') {
  275. if(status){
  276. this.$set(this, "securityCheck", true)
  277. }else{
  278. this.$set(this, "securityCheck", false)
  279. }
  280. }
  281. },
  282. //顶部tab点击
  283. tabClick(index) {
  284. this.$set(this.queryParams, 'page', 1);
  285. this.$set(this, 'total', 0);
  286. if (this.curTab != index) {
  287. this.$set(this, 'dataList', []);
  288. if (index == 0) {
  289. //校级检查
  290. this.$set(this, 'curTab', index);
  291. this.$set(this.queryParams, 'checkCategory', 1);
  292. this.getList()
  293. } else if (index == 1) {
  294. //学院自查
  295. this.$set(this, 'curTab', index);
  296. this.$set(this.queryParams, 'checkCategory', 2);
  297. this.getList()
  298. } else if (index == 2) {
  299. //随手拍
  300. uni.navigateTo({
  301. url: "/pages_safetyCheck/views/snapshotManage/snapshotList",
  302. });
  303. }
  304. }
  305. },
  306. //检查批次点击
  307. batchClick(row) {
  308. this.$set(this.batchData, 'checkPlanSetVoList', row);
  309. this.$nextTick(() => {
  310. uni.navigateTo({
  311. url: '/pages_safetyCheck/views/inspectManage/inspectList?infoData=' +
  312. encodeURIComponent(JSON.stringify(this.batchData))
  313. });
  314. })
  315. },
  316. planClick(row) {
  317. if (row.checkPlanSetVoList.length > 1) {
  318. this.$set(this, 'batchData', {
  319. planId: row.planId,
  320. planTitle: row.planTitle,
  321. checkCategory: row.checkCategory,
  322. checkTypeName: row.checkTypeName,
  323. crossCheck: row.crossCheck,
  324. });
  325. this.$set(this, 'batchList', row);
  326. this.dialogVisible = true;
  327. } else {
  328. //如果只有1个检查批次不弹窗
  329. this.$set(this, 'batchData', {
  330. planId: row.planId,
  331. planTitle: row.planTitle,
  332. checkCategory: row.checkCategory,
  333. checkTypeName: row.checkTypeName,
  334. crossCheck: row.crossCheck,
  335. checkPlanSetVoList: row.checkPlanSetVoList[0]
  336. });
  337. this.$nextTick(() => {
  338. uni.navigateTo({
  339. url: '/pages_safetyCheck/views/inspectManage/inspectList?infoData=' +
  340. encodeURIComponent(JSON.stringify(this.batchData))
  341. });
  342. })
  343. }
  344. },
  345. dialogClose() {
  346. this.dialogVisible = false;
  347. },
  348. async getList() {
  349. let self = this;
  350. const {
  351. data
  352. } = await securityAppCheckPlanTitleList(this.queryParams);
  353. if (data.code == 200) {
  354. if (self.queryParams.page == 1) {
  355. this.dataList = data.data.records;
  356. this.total = data.data.total;
  357. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  358. this.$set(this, 'getDataType', true);
  359. }
  360. } else {
  361. this.dataList = [...this.dataList, ...data.data.records]
  362. this.total = data.data.total;
  363. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  364. this.$set(this, 'getDataType', true);
  365. }
  366. }
  367. }
  368. },
  369. },
  370. }
  371. </script>
  372. <style lang="stylus" scoped>
  373. .planDetail {
  374. height: 100%;
  375. display: flex;
  376. flex-direction: column;
  377. .header {
  378. width: 100%;
  379. height: 482rpx;
  380. // position: fixed;
  381. // top: 0rpx;
  382. // z-index: 100;
  383. .header-bg {
  384. width: 750rpx;
  385. height: 310rpx;
  386. position: absolute;
  387. }
  388. .tabTitle {
  389. width: 690rpx;
  390. height: 242rpx;
  391. background: #FFFFFF;
  392. border-radius: 20rpx 20rpx 20rpx 20rpx;
  393. display flex;
  394. justify-content: flex-start;
  395. align-items: center;
  396. position: absolute;
  397. left: 30rpx;
  398. top: 208rpx;
  399. .tabTitle_li {
  400. height: 242rpx;
  401. flex: 1;
  402. position: relative;
  403. text-align center;
  404. .line {
  405. width: 2rpx;
  406. height: 20rpx;
  407. background: #D8D8D8;
  408. border-radius: 0rpx 0rpx 0rpx 0rpx;
  409. position: absolute;
  410. top: 40%;
  411. }
  412. .tabTitle_text {
  413. display: flex;
  414. justify-content: center;
  415. flex-direction: column;
  416. align-items: center;
  417. >img {
  418. width: 82rpx;
  419. height: 82rpx;
  420. margin-top: 44rpx;
  421. }
  422. >view:nth-of-type(1) {
  423. font-size: 30rpx;
  424. color: #333333;
  425. line-height: 40rpx;
  426. text-align: left;
  427. margin-top: 8rpx;
  428. }
  429. >view:nth-of-type(2) {
  430. font-size: 24rpx;
  431. color: #666666;
  432. line-height: 30rpx;
  433. text-align: left;
  434. margin-top: 6rpx;
  435. }
  436. position: relative;
  437. &.on {}
  438. }
  439. .tabTitle_across {
  440. /* width: 50rpx;
  441. height: 4rpx;
  442. background: #0183FA;
  443. border-radius: 2rpx; */
  444. margin-left: 38%;
  445. margin-top: 37rpx;
  446. display none;
  447. >img {
  448. width: 40rpx;
  449. height: 26rpx;
  450. }
  451. &.on {
  452. display block;
  453. }
  454. }
  455. }
  456. }
  457. }
  458. .for-max-box {
  459. flex: 1;
  460. overflow-y scroll;
  461. .list {
  462. width: 690rpx;
  463. margin-left: 30rpx;
  464. background: #FFFFFF;
  465. border-radius: 20rpx 20rpx 20rpx 20rpx;
  466. .list-li:nth-child(1) {
  467. border-top: none;
  468. }
  469. .list-li {
  470. border-top: 1rpx dashed #E0E0E0;
  471. height: 100rpx;
  472. display: flex;
  473. justify-content: flex-start;
  474. align-items: center;
  475. padding: 0 30rpx;
  476. box-sizing: border-box;
  477. >view:nth-of-type(1) {
  478. flex: 1;
  479. font-size: 28rpx;
  480. color: #333333;
  481. line-height: 39rpx;
  482. text-align: left;
  483. margin: 0 52rpx 0 20rpx;
  484. overflow: hidden;
  485. text-overflow: ellipsis;
  486. white-space: nowrap;
  487. }
  488. >img:nth-of-type(1) {
  489. width: 42rpx;
  490. height: 42rpx;
  491. }
  492. >img:nth-of-type(2) {
  493. width: 24rpx;
  494. height: 24rpx;
  495. }
  496. }
  497. }
  498. .get-data-p {
  499. height: 100rpx;
  500. text-align: center;
  501. .get-data-img {
  502. width: 30rpx;
  503. height: 30rpx;
  504. margin: 0 auto;
  505. margin-top: 15rpx;
  506. }
  507. .get-data-text {
  508. text-align: center;
  509. }
  510. }
  511. .get-data-null-p {
  512. height: 100rpx;
  513. line-height: 100rpx;
  514. text-align: center;
  515. }
  516. }
  517. .shade {
  518. height: 100%;
  519. width: 100%;
  520. position: fixed;
  521. display: flex;
  522. flex-direction: column;
  523. z-index: 200;
  524. background: rgba(0, 0, 0, 0.2);
  525. .null-box {
  526. flex: 1;
  527. }
  528. .shade_n {
  529. position: absolute;
  530. bottom: 0;
  531. left: 0;
  532. width: 750rpx;
  533. height: 466rpx;
  534. background: #FFFFFF;
  535. border-radius: 20rpx 20rpx 0rpx 0rpx;
  536. overflow-y: auto;
  537. .title {
  538. display: flex;
  539. justify-content: space-between;
  540. align-items: center;
  541. padding: 0 50rpx 0 284rpx;
  542. box-sizing: border-box;
  543. border-bottom: 1rpx solid #E0E0E0;
  544. >view {
  545. font-size: 30rpx;
  546. color: #3D3D3D;
  547. line-height: 90rpx;
  548. text-align: left;
  549. }
  550. >img {
  551. width: 24rpx;
  552. height: 12rpx;
  553. }
  554. }
  555. .batch {
  556. padding: 0 30rpx;
  557. box-sizing: border-box;
  558. .batch-li {
  559. display: flex;
  560. justify-content: space-between;
  561. align-items: center;
  562. border-bottom: 1rpx solid #E0E0E0;
  563. padding: 20rpx 0 16rpx 0rpx;
  564. box-sizing: border-box;
  565. .batch-li-l {
  566. >text:nth-of-type(1) {
  567. display: block;
  568. font-size: 30rpx;
  569. color: #333333;
  570. line-height: 42rpx;
  571. text-align: left;
  572. }
  573. >text:nth-of-type(2) {
  574. display: block;
  575. font-size: 28rpx;
  576. color: #666666;
  577. line-height: 39rpx;
  578. text-align: left;
  579. margin-top: 6rpx;
  580. }
  581. }
  582. .batch-li-r {
  583. font-size: 28rpx;
  584. color: #666666;
  585. line-height: 39rpx;
  586. text-align: left;
  587. display: flex;
  588. justify-content: flex-start;
  589. align-items: center;
  590. >img {
  591. width: 24rpx;
  592. height: 24rpx;
  593. margin-left: 9rpx;
  594. }
  595. }
  596. }
  597. }
  598. }
  599. }
  600. #fontColor-A {
  601. color: #0040C1;
  602. }
  603. #fontColor-B {
  604. color: #009519;
  605. }
  606. #bgColor-A {
  607. color: #0183FA;
  608. background: rgba(1, 131, 250, 0.2);
  609. }
  610. #bgColor-B {
  611. color: #16B531;
  612. background: rgba(22, 181, 49, 0.2);
  613. }
  614. .subBtn{
  615. position: fixed;
  616. bottom: 90rpx;
  617. left: 295rpx;
  618. z-index: 100;
  619. .subBtn-img{
  620. width: 160rpx;
  621. height: 160rpx;
  622. }
  623. }
  624. .patrolLoginButton{
  625. position: absolute;
  626. top:80rpx;
  627. right:20rpx;
  628. color:#fff;
  629. background-color: red;
  630. padding:10rpx 20rpx;
  631. border-radius:10rpx;
  632. font-size:24rpx;
  633. line-height:30rpx;
  634. height:32rpx;
  635. }
  636. .shade-box {
  637. height: 100%;
  638. width: 100%;
  639. position: fixed;
  640. display: flex;
  641. flex-direction: column;
  642. z-index: 200;
  643. background: rgba(0, 0, 0, 0.2);
  644. top: 0;
  645. .null-box {
  646. flex: 1;
  647. }
  648. .shade_n {
  649. position: absolute;
  650. bottom: 0;
  651. left: 0;
  652. width: 750rpx;
  653. height: 466rpx;
  654. background: #FFFFFF;
  655. border-radius: 20rpx 20rpx 0rpx 0rpx;
  656. overflow-y: auto;
  657. .title {
  658. display: flex;
  659. justify-content: space-between;
  660. align-items: center;
  661. padding: 0 50rpx 0 284rpx;
  662. box-sizing: border-box;
  663. border-bottom: 1rpx solid #E0E0E0;
  664. >view {
  665. font-size: 30rpx;
  666. color: #3D3D3D;
  667. line-height: 90rpx;
  668. text-align: left;
  669. }
  670. >img {
  671. width: 24rpx;
  672. height: 12rpx;
  673. }
  674. }
  675. .batch {
  676. padding: 0 30rpx;
  677. box-sizing: border-box;
  678. .batch-li {
  679. display: flex;
  680. justify-content: space-between;
  681. align-items: center;
  682. border-bottom: 1rpx solid #E0E0E0;
  683. padding: 20rpx 0 16rpx 0rpx;
  684. box-sizing: border-box;
  685. .batch-li-l {
  686. >text:nth-of-type(1) {
  687. display: block;
  688. font-size: 30rpx;
  689. color: #333333;
  690. line-height: 42rpx;
  691. text-align: left;
  692. }
  693. >text:nth-of-type(2) {
  694. display: block;
  695. font-size: 28rpx;
  696. color: #666666;
  697. line-height: 39rpx;
  698. text-align: left;
  699. margin-top: 6rpx;
  700. }
  701. }
  702. .batch-li-r {
  703. font-size: 28rpx;
  704. color: #666666;
  705. line-height: 39rpx;
  706. text-align: left;
  707. display: flex;
  708. justify-content: flex-start;
  709. align-items: center;
  710. >img {
  711. width: 24rpx;
  712. height: 24rpx;
  713. margin-left: 9rpx;
  714. }
  715. }
  716. }
  717. }
  718. }
  719. }
  720. }
  721. </style>