safetyCheck.vue 13 KB

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