safetyCheck.vue 12 KB

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