safetyCheck.vue 16 KB

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