scanCodeCheck.vue 11 KB

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