safetyCheck.vue 13 KB

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