scanCodeCheck.vue 11 KB

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