scanCodeCheck.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="shade">
  3. <view class="null-box" @click="dialogClose()"></view>
  4. <view class="shade_n">
  5. <view class="title">
  6. <view>{{dialogTtile}}</view>
  7. <!-- <img :src="imagesUrl('commonality/icon_06.png')"> -->
  8. </view>
  9. <view class="batch">
  10. <view class="batch-li" @click="batchClick(item)" v-for="(item,index) in batchList">
  11. <view class="batch-li-l">
  12. <text v-if="dialogStatus==0">{{item.planTitle}}</text>
  13. <text v-if="dialogStatus==1">{{item.checkName}}</text>
  14. </view>
  15. <view class="batch-li-r">
  16. <img :src="imagesUrl('commonality/icon_wd_gd@1x.png')">
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. securityAppCheckPlanAppTitleList,
  26. securityAppCheckManageList,
  27. securityAppCheckSetOptionList,
  28. } from '@/pages_safetyCheck/api/index.js'
  29. import {
  30. config
  31. } from '@/api/request/config.js'
  32. export default {
  33. name: "iotControl",
  34. props: {
  35. subjectData: {},
  36. },
  37. data() {
  38. return {
  39. baseUrl: config.base_url,
  40. newData:{},
  41. dialogTtile: '',
  42. dialogStatus: 0, //0计划 1批次 2实验室
  43. batchList: [],
  44. queryParams: {
  45. page: 1,
  46. pageSize: 100,
  47. checkCategory: '', //1校院巡查 2学院自查
  48. subId: '',
  49. },
  50. checkPlanSetVoList: null,
  51. form: {},
  52. OptionListArr:[],//临时存储检查项
  53. planId:'',
  54. planTitle:'',
  55. checkTypeName:'',
  56. crossCheck:'',
  57. }
  58. },
  59. created() {
  60. },
  61. mounted() {
  62. if(uni.getStorageSync('identityData')){
  63. if(uni.getStorageSync('identityData').type=='collegeAdmin'){
  64. this.queryParams.checkCategory=2
  65. }else if(uni.getStorageSync('identityData').type=='schoolAdmin'){
  66. this.queryParams.checkCategory=1
  67. }
  68. }
  69. this.$set(this, 'newData', this.subjectData);
  70. console.log(this.subjectData)
  71. this.$set(this.queryParams, 'subId', this.subjectData.subId);
  72. this.securityAppCheckPlanAppTitleList();
  73. },
  74. methods: {
  75. dialogClose() {
  76. this.dialogStatus = 0;
  77. // #ifdef WEB
  78. this.$parent.$parent.goPage('securityCheck',false);
  79. // #endif
  80. // #ifdef MP-WEIXIN
  81. this.$parent.goPage('securityCheck',false);
  82. // #endif
  83. },
  84. //十六进制颜色值和RGB格式转换
  85. hexToRgb(hex, opacity = 1) {
  86. // 去除#号
  87. var color = hex.replace("#", "");
  88. // 分割成红、绿、蓝三部分的16进制字符串
  89. var red = parseInt(color.substring(0, 2), 16);
  90. var green = parseInt(color.substring(2, 4), 16);
  91. var blue = parseInt(color.substring(4, 6), 16);
  92. return `RGB(${red}, ${green}, ${blue},${opacity})`;
  93. },
  94. batchClick(row) {
  95. let self = this;
  96. if (this.dialogStatus == 0) { //计划点击
  97. this.$set(this, 'planId', row.planId);
  98. this.$set(this, 'planTitle', row.planTitle);
  99. this.$set(this, 'checkTypeName', row.checkTypeName);
  100. this.$set(this, 'crossCheck', row.crossCheck);
  101. if (row.checkPlanSetVoList.length == 1) {
  102. //如果只有1个检查批次不弹窗
  103. let planSetId = row.checkPlanSetVoList[0].planSetId
  104. self.checkPlanSetVoList = row.checkPlanSetVoList[0];
  105. self.securityAppCheckManageList(planSetId)
  106. } else if (row.checkPlanSetVoList.length == 0) {
  107. this.dialogStatus = 0;
  108. // #ifdef WEB
  109. this.$parent.$parent.goPage('securityCheck',false);
  110. // #endif
  111. // #ifdef MP-WEIXIN
  112. this.$parent.goPage('securityCheck',false);
  113. // #endif
  114. uni.showToast({
  115. title: '该实验室暂无检查计划!',
  116. icon: "none",
  117. mask: true,
  118. duration: 2000
  119. });
  120. return
  121. } else {
  122. this.$set(this, 'batchList', row.checkPlanSetVoList);
  123. this.dialogStatus = 1;
  124. this.dialogTtile = '批次';
  125. // #ifdef WEB
  126. this.$parent.$parent.goPage('securityCheck',true);
  127. // #endif
  128. // #ifdef MP-WEIXIN
  129. this.$parent.goPage('securityCheck',true);
  130. // #endif
  131. }
  132. } else if (this.dialogStatus == 1) { //批次点击
  133. /* this.dialogStatus = 2;
  134. this.dialogTtile = '实验室'; */
  135. let planSetId = row.planSetId
  136. self.checkPlanSetVoList = row;
  137. this.securityAppCheckManageList(planSetId)
  138. }
  139. },
  140. //查询计划
  141. async securityAppCheckPlanAppTitleList() {
  142. this.queryParams.subId = this.newData.subId;
  143. this.queryParams.checkStatus = 0;
  144. let self = this;
  145. const {
  146. data
  147. } = await securityAppCheckPlanAppTitleList(this.queryParams);
  148. if (data.code == 200) {
  149. //循环过滤掉当前计划中批次中已经检查完成的
  150. data.data.records.forEach(function(item, index) {
  151. let list = [];
  152. item.checkPlanSetVoList.forEach(function(item2) {
  153. if (item2.checkSetProgress != 100) {
  154. list.push(item2)
  155. }
  156. })
  157. item.checkPlanSetVoList = list
  158. })
  159. let list2 = []
  160. list2 = data.data.records.filter(function(item) {
  161. return item.checkPlanSetVoList.length != 0
  162. });
  163. data.data.records = list2
  164. if (data.data.records.length == 1) { //一个计划
  165. this.$set(this, 'planId', data.data.records[0].planId);
  166. this.$set(this, 'planTitle', data.data.records[0].planTitle);
  167. this.$set(this, 'checkTypeName', data.data.records[0].checkTypeName);
  168. this.$set(this, 'crossCheck', data.data.records[0].crossCheck);
  169. if (data.data.records[0].checkPlanSetVoList.length == 1) { //1个批次
  170. let planSetId = data.data.records[0]
  171. if (data.data.records[0].checkPlanSetVoList[0]) { //一个批次
  172. let planSetId = data.data.records[0].checkPlanSetVoList[0].planSetId
  173. self.checkPlanSetVoList = data.data.records[0].checkPlanSetVoList[0];
  174. self.securityAppCheckManageList(planSetId)
  175. }
  176. } else if (data.data.records[0].checkPlanSetVoList.length == 0) {
  177. this.dialogStatus = 0;
  178. // #ifdef WEB
  179. this.$parent.$parent.goPage('securityCheck',false);
  180. // #endif
  181. // #ifdef MP-WEIXIN
  182. this.$parent.goPage('securityCheck',false);
  183. // #endif
  184. uni.showToast({
  185. title: '该实验室暂无检查计划!',
  186. icon: "none",
  187. mask: true,
  188. duration: 2000
  189. });
  190. return
  191. } else { //多个批次
  192. this.dialogStatus = 1;
  193. this.batchList = data.data.records[0].checkPlanSetVoList;
  194. // #ifdef WEB
  195. this.$parent.$parent.goPage('securityCheck',true);
  196. // #endif
  197. // #ifdef MP-WEIXIN
  198. this.$parent.goPage('securityCheck',true);
  199. // #endif
  200. this.dialogTtile = '批次';
  201. }
  202. } else if (data.data.records.length==0) {
  203. this.dialogStatus = 0;
  204. // #ifdef WEB
  205. this.$parent.$parent.goPage('securityCheck',false);
  206. // #endif
  207. // #ifdef MP-WEIXIN
  208. this.$parent.goPage('securityCheck',false);
  209. // #endif
  210. uni.showToast({
  211. title: '该实验室暂无检查计划!',
  212. icon: "none",
  213. mask: true,
  214. duration: 2000
  215. });
  216. return
  217. } else { //多个计划
  218. this.batchList = data.data.records;
  219. // #ifdef WEB
  220. this.$parent.$parent.goPage('securityCheck',true);
  221. // #endif
  222. // #ifdef MP-WEIXIN
  223. this.$parent.goPage('securityCheck',true);
  224. // #endif
  225. this.dialogTtile = '计划标题';
  226. }
  227. }
  228. },
  229. //检查任务-在此结果里对比实验室Id判断是否有实验室
  230. async securityAppCheckManageList(planSetId) {
  231. let self = this;
  232. let obj = {
  233. page: 1,
  234. pageSize: 20,
  235. planSetId: planSetId,
  236. subId: self.newData.subId,
  237. }
  238. const {
  239. data
  240. } = await securityAppCheckManageList(obj);
  241. if (data.code == 200) {
  242. //this.shadeList = data.data.records;
  243. if (data.data.records[0]) {
  244. let manageId = data.data.records[0].manageId;
  245. self.securityAppCheckSetOptionList(data.data.records[0],0);
  246. } else {
  247. self.dialogStatus = 0;
  248. // #ifdef WEB
  249. this.$parent.$parent.goPage('securityCheck',false);
  250. // #endif
  251. // #ifdef MP-WEIXIN
  252. this.$parent.goPage('securityCheck',false);
  253. // #endif
  254. uni.showToast({
  255. title: '该实验室暂无检查计划!',
  256. icon: "none",
  257. mask: true,
  258. duration: 2000
  259. });
  260. return
  261. }
  262. }
  263. },
  264. //查询检查项
  265. async securityAppCheckSetOptionList(item,checkStatus) {
  266. let self = this;
  267. let upData = item;
  268. let obj = {
  269. page: 1,
  270. pageSize: 20,
  271. checkStatus: checkStatus,
  272. manageId: upData.manageId,
  273. }
  274. const {
  275. data
  276. } = await securityAppCheckSetOptionList(obj);
  277. if (data.code == 200 && checkStatus==0) {//先查询待检查数据
  278. if (data.data.records[0]) {
  279. let infoData = {};
  280. infoData.pageType = 0;
  281. infoData.itemsStatus = 0;
  282. infoData.subName = upData.subName;
  283. infoData.checkPlanSetVoList = self.checkPlanSetVoList;
  284. infoData.planId = self.planId;
  285. infoData.planTitle = self.planTitle;
  286. infoData.checkTypeName = self.checkTypeName;
  287. infoData.crossCheck = self.crossCheck;
  288. infoData.roomNum = upData.roomNum;
  289. infoData.subId = data.data.records[0].subId;
  290. infoData.manageId = data.data.records[0].manageId;
  291. infoData.setOptionId = data.data.records[0].setOptionId;
  292. infoData.hazardCheckPro = data.data.records[0].hazardCheckPro;
  293. infoData.checkCategory = data.data.records[0].checkCategory;
  294. uni.navigateTo({
  295. url: '/pages_safetyCheck/views/inspectManage/conductInspections?infoData=' +
  296. encodeURIComponent(
  297. JSON
  298. .stringify(infoData))
  299. });
  300. } else {
  301. self.securityAppCheckSetOptionList(item,2);
  302. }
  303. }else if (data.code == 200 && checkStatus==2) {//查询检查中数据
  304. if (data.data.records[0]) {
  305. let infoData = {};
  306. infoData.pageType = 0;
  307. infoData.itemsStatus = 0;
  308. infoData.subName = upData.subName;
  309. infoData.checkPlanSetVoList = self.checkPlanSetVoList;
  310. infoData.planId = self.planId;
  311. infoData.planTitle = self.planTitle;
  312. infoData.checkTypeName = self.checkTypeName;
  313. infoData.crossCheck = self.crossCheck;
  314. infoData.roomNum = upData.roomNum;
  315. infoData.subId = data.data.records[0].subId;
  316. infoData.manageId = data.data.records[0].manageId;
  317. infoData.setOptionId = data.data.records[0].setOptionId;
  318. infoData.hazardCheckPro = data.data.records[0].hazardCheckPro;
  319. infoData.checkCategory = data.data.records[0].checkCategory;
  320. uni.navigateTo({
  321. url: '/pages_safetyCheck/views/inspectManage/conductInspections?infoData=' +
  322. encodeURIComponent(
  323. JSON
  324. .stringify(infoData))
  325. });
  326. } else {
  327. self.dialogStatus = 0;
  328. // #ifdef WEB
  329. this.$parent.$parent.goPage('securityCheck',false);
  330. // #endif
  331. // #ifdef MP-WEIXIN
  332. this.$parent.goPage('securityCheck',false);
  333. // #endif
  334. uni.showToast({
  335. title: '该实验室暂无检查工作!',
  336. icon: "none",
  337. mask: true,
  338. duration: 2000
  339. });
  340. return;
  341. }
  342. }
  343. },
  344. },
  345. onHide() {
  346. },
  347. beforeDestroy() {
  348. },
  349. }
  350. </script>
  351. <style lang="stylus" scoped>
  352. .shade {
  353. height: 100%;
  354. width: 100%;
  355. position: fixed;
  356. display: flex;
  357. flex-direction: column;
  358. z-index: 200;
  359. background: rgba(0, 0, 0, 0.2);
  360. top: 0;
  361. .null-box {
  362. flex: 1;
  363. }
  364. .shade_n {
  365. position: absolute;
  366. bottom: 0;
  367. left: 0;
  368. width: 750rpx;
  369. height: 466rpx;
  370. background: #FFFFFF;
  371. border-radius: 20rpx 20rpx 0rpx 0rpx;
  372. overflow-y: auto;
  373. .title {
  374. display: flex;
  375. justify-content: space-between;
  376. align-items: center;
  377. padding: 0 50rpx 0 284rpx;
  378. box-sizing: border-box;
  379. border-bottom: 1rpx solid #E0E0E0;
  380. >view {
  381. font-size: 30rpx;
  382. color: #3D3D3D;
  383. line-height: 90rpx;
  384. text-align: left;
  385. }
  386. >img {
  387. width: 24rpx;
  388. height: 12rpx;
  389. }
  390. }
  391. .batch {
  392. padding: 0 30rpx;
  393. box-sizing: border-box;
  394. .batch-li {
  395. display: flex;
  396. justify-content: space-between;
  397. align-items: center;
  398. border-bottom: 1rpx solid #E0E0E0;
  399. padding: 20rpx 0 16rpx 0rpx;
  400. box-sizing: border-box;
  401. .batch-li-l {
  402. >text:nth-of-type(1) {
  403. display: block;
  404. font-size: 30rpx;
  405. color: #333333;
  406. line-height: 42rpx;
  407. text-align: left;
  408. }
  409. >text:nth-of-type(2) {
  410. display: block;
  411. font-size: 28rpx;
  412. color: #666666;
  413. line-height: 39rpx;
  414. text-align: left;
  415. margin-top: 6rpx;
  416. }
  417. }
  418. .batch-li-r {
  419. font-size: 28rpx;
  420. color: #666666;
  421. line-height: 39rpx;
  422. text-align: left;
  423. display: flex;
  424. justify-content: flex-start;
  425. align-items: center;
  426. >img {
  427. width: 24rpx;
  428. height: 24rpx;
  429. margin-left: 9rpx;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. </style>