scanCodeCheck.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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="@/pages_safetyCheck/images/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="@/pages_safetyCheck/images/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. this.$parent.goPage('securityCheck',false);
  78. },
  79. //十六进制颜色值和RGB格式转换
  80. hexToRgb(hex, opacity = 1) {
  81. // 去除#号
  82. var color = hex.replace("#", "");
  83. // 分割成红、绿、蓝三部分的16进制字符串
  84. var red = parseInt(color.substring(0, 2), 16);
  85. var green = parseInt(color.substring(2, 4), 16);
  86. var blue = parseInt(color.substring(4, 6), 16);
  87. return `RGB(${red}, ${green}, ${blue},${opacity})`;
  88. },
  89. batchClick(row) {
  90. let self = this;
  91. if (this.dialogStatus == 0) { //计划点击
  92. this.$set(this, 'planId', row.planId);
  93. this.$set(this, 'planTitle', row.planTitle);
  94. this.$set(this, 'checkTypeName', row.checkTypeName);
  95. this.$set(this, 'crossCheck', row.crossCheck);
  96. if (row.checkPlanSetVoList.length == 1) {
  97. //如果只有1个检查批次不弹窗
  98. let planSetId = row.checkPlanSetVoList[0].planSetId
  99. self.checkPlanSetVoList = row.checkPlanSetVoList[0];
  100. self.securityAppCheckManageList(planSetId)
  101. } else if (row.checkPlanSetVoList.length == 0) {
  102. this.dialogStatus = 0;
  103. this.$parent.goPage('securityCheck',false);
  104. uni.showToast({
  105. title: '该实验室暂无检查计划!',
  106. icon: "none",
  107. mask: true,
  108. duration: 2000
  109. });
  110. return
  111. } else {
  112. this.$set(this, 'batchList', row.checkPlanSetVoList);
  113. this.dialogStatus = 1;
  114. this.dialogTtile = '批次';
  115. this.$parent.goPage('securityCheck',true);
  116. }
  117. } else if (this.dialogStatus == 1) { //批次点击
  118. /* this.dialogStatus = 2;
  119. this.dialogTtile = '实验室'; */
  120. let planSetId = row.planSetId
  121. self.checkPlanSetVoList = row;
  122. this.securityAppCheckManageList(planSetId)
  123. }
  124. },
  125. //查询计划
  126. async securityAppCheckPlanAppTitleList() {
  127. this.queryParams.subId = this.newData.subId;
  128. this.queryParams.checkStatus = 0;
  129. let self = this;
  130. const {
  131. data
  132. } = await securityAppCheckPlanAppTitleList(this.queryParams);
  133. if (data.code == 200) {
  134. //循环过滤掉当前计划中批次中已经检查完成的
  135. data.data.records.forEach(function(item, index) {
  136. let list = [];
  137. item.checkPlanSetVoList.forEach(function(item2) {
  138. if (item2.checkSetProgress != 100) {
  139. list.push(item2)
  140. }
  141. })
  142. item.checkPlanSetVoList = list
  143. })
  144. let list2 = []
  145. list2 = data.data.records.filter(function(item) {
  146. return item.checkPlanSetVoList.length != 0
  147. });
  148. data.data.records = list2
  149. if (data.data.records.length == 1) { //一个计划
  150. this.$set(this, 'planId', data.data.records[0].planId);
  151. this.$set(this, 'planTitle', data.data.records[0].planTitle);
  152. this.$set(this, 'checkTypeName', data.data.records[0].checkTypeName);
  153. this.$set(this, 'crossCheck', data.data.records[0].crossCheck);
  154. if (data.data.records[0].checkPlanSetVoList.length == 1) { //1个批次
  155. let planSetId = data.data.records[0]
  156. if (data.data.records[0].checkPlanSetVoList[0]) { //一个批次
  157. let planSetId = data.data.records[0].checkPlanSetVoList[0].planSetId
  158. self.checkPlanSetVoList = data.data.records[0].checkPlanSetVoList[0];
  159. self.securityAppCheckManageList(planSetId)
  160. }
  161. } else if (data.data.records[0].checkPlanSetVoList.length == 0) {
  162. this.dialogStatus = 0;
  163. this.$parent.goPage('securityCheck',false);
  164. uni.showToast({
  165. title: '该实验室暂无检查计划!',
  166. icon: "none",
  167. mask: true,
  168. duration: 2000
  169. });
  170. return
  171. } else { //多个批次
  172. this.dialogStatus = 1;
  173. this.batchList = data.data.records[0].checkPlanSetVoList;
  174. this.$parent.goPage('securityCheck',true);
  175. this.dialogTtile = '批次';
  176. }
  177. } else if (data.data.records.length==0) {
  178. this.dialogStatus = 0;
  179. this.$parent.goPage('securityCheck',false);
  180. uni.showToast({
  181. title: '该实验室暂无检查计划!',
  182. icon: "none",
  183. mask: true,
  184. duration: 2000
  185. });
  186. return
  187. } else { //多个计划
  188. this.batchList = data.data.records;
  189. this.$parent.goPage('securityCheck',true);
  190. this.dialogTtile = '计划标题';
  191. }
  192. }
  193. },
  194. //检查任务-在此结果里对比实验室Id判断是否有实验室
  195. async securityAppCheckManageList(planSetId) {
  196. let self = this;
  197. let obj = {
  198. page: 1,
  199. pageSize: 20,
  200. planSetId: planSetId,
  201. subId: self.newData.subId,
  202. }
  203. const {
  204. data
  205. } = await securityAppCheckManageList(obj);
  206. if (data.code == 200) {
  207. //this.shadeList = data.data.records;
  208. if (data.data.records[0]) {
  209. let manageId = data.data.records[0].manageId;
  210. self.securityAppCheckSetOptionList(data.data.records[0],0);
  211. } else {
  212. self.dialogStatus = 0;
  213. this.$parent.goPage('securityCheck',false);
  214. uni.showToast({
  215. title: '该实验室暂无检查计划!',
  216. icon: "none",
  217. mask: true,
  218. duration: 2000
  219. });
  220. return
  221. }
  222. }
  223. },
  224. //查询检查项
  225. async securityAppCheckSetOptionList(item,checkStatus) {
  226. let self = this;
  227. let upData = item;
  228. let obj = {
  229. page: 1,
  230. pageSize: 20,
  231. checkStatus: checkStatus,
  232. manageId: upData.manageId,
  233. }
  234. const {
  235. data
  236. } = await securityAppCheckSetOptionList(obj);
  237. if (data.code == 200 && checkStatus==0) {//先查询待检查数据
  238. if (data.data.records[0]) {
  239. let infoData = {};
  240. infoData.pageType = 0;
  241. infoData.itemsStatus = 0;
  242. infoData.subName = upData.subName;
  243. infoData.checkPlanSetVoList = self.checkPlanSetVoList;
  244. infoData.planId = self.planId;
  245. infoData.planTitle = self.planTitle;
  246. infoData.checkTypeName = self.checkTypeName;
  247. infoData.crossCheck = self.crossCheck;
  248. infoData.roomNum = upData.roomNum;
  249. infoData.subId = data.data.records[0].subId;
  250. infoData.manageId = data.data.records[0].manageId;
  251. infoData.setOptionId = data.data.records[0].setOptionId;
  252. infoData.hazardCheckPro = data.data.records[0].hazardCheckPro;
  253. infoData.checkCategory = data.data.records[0].checkCategory;
  254. uni.navigateTo({
  255. url: '/pages_safetyCheck/views/inspectManage/conductInspections?infoData=' +
  256. encodeURIComponent(
  257. JSON
  258. .stringify(infoData))
  259. });
  260. } else {
  261. self.securityAppCheckSetOptionList(item,2);
  262. }
  263. }else if (data.code == 200 && checkStatus==2) {//查询检查中数据
  264. if (data.data.records[0]) {
  265. let infoData = {};
  266. infoData.pageType = 0;
  267. infoData.itemsStatus = 0;
  268. infoData.subName = upData.subName;
  269. infoData.checkPlanSetVoList = self.checkPlanSetVoList;
  270. infoData.planId = self.planId;
  271. infoData.planTitle = self.planTitle;
  272. infoData.checkTypeName = self.checkTypeName;
  273. infoData.crossCheck = self.crossCheck;
  274. infoData.roomNum = upData.roomNum;
  275. infoData.subId = data.data.records[0].subId;
  276. infoData.manageId = data.data.records[0].manageId;
  277. infoData.setOptionId = data.data.records[0].setOptionId;
  278. infoData.hazardCheckPro = data.data.records[0].hazardCheckPro;
  279. infoData.checkCategory = data.data.records[0].checkCategory;
  280. uni.navigateTo({
  281. url: '/pages_safetyCheck/views/inspectManage/conductInspections?infoData=' +
  282. encodeURIComponent(
  283. JSON
  284. .stringify(infoData))
  285. });
  286. } else {
  287. self.dialogStatus = 0;
  288. this.$parent.goPage('securityCheck',false);
  289. uni.showToast({
  290. title: '该实验室暂无检查工作!',
  291. icon: "none",
  292. mask: true,
  293. duration: 2000
  294. });
  295. return;
  296. }
  297. }
  298. },
  299. },
  300. onHide() {
  301. },
  302. beforeDestroy() {
  303. },
  304. }
  305. </script>
  306. <style lang="stylus" scoped>
  307. .shade {
  308. height: 100%;
  309. width: 100%;
  310. position: fixed;
  311. display: flex;
  312. flex-direction: column;
  313. z-index: 200;
  314. background: rgba(0, 0, 0, 0.2);
  315. top: 0;
  316. .null-box {
  317. flex: 1;
  318. }
  319. .shade_n {
  320. position: absolute;
  321. bottom: 0;
  322. left: 0;
  323. width: 750rpx;
  324. height: 466rpx;
  325. background: #FFFFFF;
  326. border-radius: 20rpx 20rpx 0rpx 0rpx;
  327. overflow-y: auto;
  328. .title {
  329. display: flex;
  330. justify-content: space-between;
  331. align-items: center;
  332. padding: 0 50rpx 0 284rpx;
  333. box-sizing: border-box;
  334. border-bottom: 1rpx solid #E0E0E0;
  335. >view {
  336. font-size: 30rpx;
  337. color: #3D3D3D;
  338. line-height: 90rpx;
  339. text-align: left;
  340. }
  341. >img {
  342. width: 24rpx;
  343. height: 12rpx;
  344. }
  345. }
  346. .batch {
  347. padding: 0 30rpx;
  348. box-sizing: border-box;
  349. .batch-li {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. border-bottom: 1rpx solid #E0E0E0;
  354. padding: 20rpx 0 16rpx 0rpx;
  355. box-sizing: border-box;
  356. .batch-li-l {
  357. >text:nth-of-type(1) {
  358. display: block;
  359. font-size: 30rpx;
  360. color: #333333;
  361. line-height: 42rpx;
  362. text-align: left;
  363. }
  364. >text:nth-of-type(2) {
  365. display: block;
  366. font-size: 28rpx;
  367. color: #666666;
  368. line-height: 39rpx;
  369. text-align: left;
  370. margin-top: 6rpx;
  371. }
  372. }
  373. .batch-li-r {
  374. font-size: 28rpx;
  375. color: #666666;
  376. line-height: 39rpx;
  377. text-align: left;
  378. display: flex;
  379. justify-content: flex-start;
  380. align-items: center;
  381. >img {
  382. width: 24rpx;
  383. height: 24rpx;
  384. margin-left: 9rpx;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. }
  391. </style>