hiddenDangerItems.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <!-- 隐患项 -->
  2. <template>
  3. <view class="hiddenDangerItems">
  4. <view class="header">
  5. <view class="tabTitle_tow">
  6. <view class="tabTitle_tow_li" @tap="tabClickTow(index)" :key="index" v-for="(item,index) in tabTextTow">
  7. <view :class="{on:curTabTow==index}" class="tabTitle_tow_text">{{item}}</view>
  8. <view :class="{on:curTabTow==index}" class="tabTitle_tow_across"></view>
  9. </view>
  10. </view>
  11. <view class="line"></view>
  12. <view class="search">
  13. <uni-data-picker :ellipsis="false" :localdata="checkOptionList[0]" :map="{text:'name',value:'id'}"
  14. popup-title="请选择所属目录" @change="(e)=>onchange(e)" @nodeclick="onnodeclick()"
  15. ref="uniDataPicker" :addType="false" :addIndex="index">
  16. <view class="search-l">
  17. {{newData.hazardCheckName?newData.hazardCheckName:'检查指标'}}
  18. <img src="@/pages_safetyCheck/images/icon_06.png">
  19. </view>
  20. </uni-data-picker>
  21. <view class="search-r" @click="inspectionItemsClick()">
  22. <img src="@/pages_safetyCheck/images/icon_aqjc_ss.png">
  23. {{newData.hazardCheckCode?newData.hazardCheckCode:''}}{{newData.hazardCheckName?newData.hazardCheckName:'模糊搜索检查项'}}
  24. </view>
  25. </view>
  26. </view>
  27. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  28. <view class="list">
  29. <view class="total">待整改共{{total}}项</view>
  30. <view class="list-li" v-for="(item,index) in dataList" :key="index">
  31. <view class="list-li-t" @click="itemsClick(item)">
  32. <img v-if="item.rectifyStatus==0" src="@/pages_safetyCheck/images/icon_zg_zh@1x.png">
  33. <img v-if="item.rectifyStatus==1" src="@/pages_safetyCheck/images/icon_xz_fc@1x.png">
  34. <img v-if="item.rectifyStatus==2" src="@/pages_safetyCheck/images/icon_xz_zg@1x.png">
  35. <view v-if="item.hazardCheckId">{{item.hazardCheckCode}}{{item.hazardCheckName}}</view>
  36. <view v-if="!item.hazardCheckId">{{item.hazardDescribe}}</view>
  37. </view>
  38. <view v-if="item.hazardCheckId" class="list-li-b" @click="hiddenDangerClick(item)">
  39. 此检查项在当前实验室累计出现<text>{{item.hazardCheckNum}}</text>次隐患
  40. </view>
  41. </view>
  42. </view>
  43. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. config
  50. } from '@/api/request/config.js'
  51. import {
  52. securityAppCheckPhotoList,
  53. securityCheckOptionList,
  54. } from '@/pages_safetyCheck/api/index.js'
  55. export default {
  56. name: "hiddenDangerItems",
  57. components: {
  58. },
  59. data() {
  60. return {
  61. baseUrl: config.base_url,
  62. pageType: 1,
  63. tabTextTow: ['待整改', '已整改', '暂无法整改'],
  64. curTabTow: 0,
  65. form: {
  66. imgDtoList: [],
  67. },
  68. newData: {
  69. },
  70. dialogVisible: false,
  71. // 查询参数
  72. queryParams: {
  73. page: 1,
  74. pageSize: 10,
  75. subId: '',
  76. rectifyStatus: 0,
  77. hazardCheckId: '',
  78. searchValue: '',
  79. },
  80. total: 0,
  81. dataList: [{}],
  82. getDataType: false,
  83. //检查项
  84. checkOptionList: [],
  85. }
  86. },
  87. onLoad(option) {
  88. this.$set(this, 'newData', JSON.parse(decodeURIComponent(option.infoData)));
  89. this.pageType = this.newData.pageType;
  90. this.queryParams.subId = this.newData.subId ? this.newData.subId : ''
  91. this.queryParams.hazardCheckId = this.newData.hazardCheckId ? this.newData.hazardCheckId : ''
  92. uni.setNavigationBarTitle({
  93. title: '实验室名称(房间号)'
  94. })
  95. if (this.pageType == 0) {
  96. //检查
  97. this.tabTextTow = ['待检查', '检查中', '已检查']
  98. } else if (this.pageType == 1) {
  99. //复查
  100. this.tabTextTow = ['待复查', '复查完毕', '退回整改']
  101. } else if (this.pageType == 2) {
  102. //整改
  103. this.tabTextTow = ['待整改', '已整改', '暂无法整改']
  104. }
  105. },
  106. onShow() {
  107. },
  108. mounted() {
  109. this.getCheckOptionList()
  110. this.getList()
  111. },
  112. methods: {
  113. //滚动事件
  114. scrollGet() {
  115. let self = this;
  116. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  117. this.$set(this, 'getDataType', true);
  118. } else {
  119. this.queryParams.page += 1;
  120. this.$nextTick(() => {
  121. this.getList();
  122. })
  123. }
  124. },
  125. //顶部tab点击
  126. tabClickTow(index) {
  127. this.curTabTow = index;
  128. this.queryParams.rectifyStatus = index;
  129. this.getList()
  130. },
  131. dialogOpen() {
  132. this.dialogVisible = true;
  133. },
  134. dialogClose() {
  135. this.dialogVisible = false;
  136. },
  137. //搜索项跳转
  138. inspectionItemsClick() {
  139. this.newData.pageType = 2; //1随手拍检查项
  140. uni.redirectTo({
  141. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItemsSearch?form=' + encodeURIComponent(
  142. JSON.stringify(this.newData))
  143. });
  144. },
  145. itemsClick(row) {
  146. let infoData = row;
  147. infoData.pageType = this.pageType;
  148. uni.redirectTo({
  149. url: '/pages_safetyCheck/views/inspectManage/inspectAdd?infoData=' + encodeURIComponent(JSON
  150. .stringify(infoData))
  151. });
  152. },
  153. hiddenDangerClick(row) {
  154. let infoData = row;
  155. infoData.pageType = this.pageType;
  156. uni.redirectTo({
  157. url: '/pages_safetyCheck/views/inspectManage/hiddenDangerRecord?infoData=' +
  158. encodeURIComponent(JSON.stringify(infoData))
  159. });
  160. },
  161. //
  162. async getList() {
  163. let self = this;
  164. const {
  165. data
  166. } = await securityAppCheckPhotoList(this.queryParams);
  167. if (data.code == 200) {
  168. if (self.queryParams.page == 1) {
  169. this.dataList = data.data.records;
  170. this.total = data.data.total;
  171. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  172. this.$set(this, 'getDataType', true);
  173. }
  174. } else {
  175. this.dataList = [...this.dataList, ...data.data.records]
  176. this.total = data.data.total;
  177. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  178. this.$set(this, 'getDataType', true);
  179. }
  180. }
  181. }
  182. },
  183. /**************************检查项***************************/
  184. //获取检查项
  185. async getCheckOptionList() {
  186. const {
  187. data
  188. } = await securityCheckOptionList();
  189. if (data.code == 200) {
  190. let list = this.getTreeData(data.data);
  191. console.log(list)
  192. this.checkOptionList.push(JSON.parse(JSON.stringify(list)));
  193. }
  194. },
  195. getTreeData(data) {
  196. for (var i = 0; i < data.length > 0; i++) {
  197. if (data[i].children == null || data[i].children.length <= 0) {
  198. // children若为空数组,则将children设为undefined
  199. data[i].children = undefined;
  200. } else {
  201. if (this.form.checkCategory == 1 && data[i].level == 3) {
  202. if (data[i].children[0]) {
  203. let mainPoint = []
  204. for (let b = 0; b < data[i].children.length; b++) {
  205. mainPoint.push(data[i].children[b].name)
  206. data[i].mainPoint = mainPoint.join(',')
  207. }
  208. } else {
  209. data[i].mainPoint = '';
  210. }
  211. data[i].children = [];
  212. }
  213. // children若不为空数组,则继续 递归调用 本方法
  214. this.getTreeData(data[i].children);
  215. }
  216. }
  217. return data;
  218. },
  219. //选中固有检查项(新)
  220. onchange(e) {
  221. let self = this;
  222. //hazardCheckCode:'', //检查项目code序号
  223. //hazardCheckName:'', //检查项目名称
  224. //hazardCheckPro:'', //最后一级的id
  225. console.log(e.detail.value)
  226. this.$set(this.queryParams,'hazardCheckId',e.detail.value[e.detail.value.length - 1].value)
  227. this.$set(this.newData,'hazardCheckName',e.detail.value[e.detail.value.length - 1].text)
  228. this.getList()
  229. },
  230. onnodeclick(node) {
  231. },
  232. }
  233. }
  234. </script>
  235. <style lang="stylus" scoped>
  236. .hiddenDangerItems {
  237. height: 100%;
  238. display flex;
  239. box-sizing: border-box;
  240. #totalColor-A {
  241. color: #0183FA;
  242. background: rgba(1, 131, 250, 0.2);
  243. }
  244. #totalColor-B {
  245. color: #16B531;
  246. background: rgba(22, 181, 49, 0.2);
  247. }
  248. #totalColor-C {
  249. color: #FF8C00;
  250. background: rgba(255, 140, 0, 0.2);
  251. }
  252. .header {
  253. width: 100%;
  254. position: fixed;
  255. top: 0rpx;
  256. z-index: 100;
  257. background: #fff;
  258. .tabTitle_tow {
  259. width: 520rpx;
  260. height: 80rpx;
  261. display flex;
  262. justify-content: flex-start;
  263. align-items: center;
  264. .tabTitle_tow_li {
  265. flex: 1;
  266. position: relative;
  267. text-align center;
  268. .tabTitle_tow_text {
  269. display: inline-block;
  270. font-size: 30rpx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #333333;
  274. line-height: 46rpx;
  275. position: relative;
  276. &.on {
  277. color: #0183FA;
  278. }
  279. }
  280. .tabTitle_tow_across {
  281. width: 50rpx;
  282. height: 4rpx;
  283. background: #0183FA;
  284. border-radius: 2rpx;
  285. margin-left: 38%;
  286. display none;
  287. &.on {
  288. display block;
  289. }
  290. }
  291. }
  292. }
  293. .line {
  294. width: 100%;
  295. height: 20rpx;
  296. background: #F5F5F5;
  297. }
  298. .search {
  299. width: 750rpx;
  300. height: 80rpx;
  301. background: #FFFFFF;
  302. border-radius: 0rpx 0rpx 0rpx 0rpx;
  303. display: flex;
  304. justify-content: flex-start;
  305. align-items: center;
  306. .search-l {
  307. width: 200rpx;
  308. height: 60rpx;
  309. border-radius: 50rpx 50rpx 50rpx 50rpx;
  310. border: 1rpx solid #E0E0E0;
  311. display: flex;
  312. justify-content: space-between;
  313. align-items: center;
  314. padding: 0 20rpx;
  315. box-sizing: border-box;
  316. margin: 0 32rpx 0 30rpx;
  317. >img {
  318. width: 24rpx;
  319. height: 12rpx;
  320. }
  321. }
  322. .search-r {
  323. width: 470rpx;
  324. height: 60rpx;
  325. background: #FFFFFF;
  326. border-radius: 50rpx 50rpx 50rpx 50rpx;
  327. border: 1rpx solid #E0E0E0;
  328. font-size: 24rpx;
  329. color: #999999;
  330. line-height: 60rpx;
  331. text-align: left;
  332. display: flex;
  333. justify-content: flex-start;
  334. align-items: center;
  335. padding: 0 20rpx;
  336. box-sizing: border-box;
  337. >img {
  338. width: 30rpx;
  339. height: 30rpx;
  340. margin-right: 20rpx;
  341. }
  342. }
  343. }
  344. }
  345. .list {
  346. width: 750rpx;
  347. background: #FFFFFF;
  348. margin-top: 200rpx;
  349. padding-bottom: 20rpx;
  350. box-sizing: border-box;
  351. .total {
  352. width: 180rpx;
  353. height: 50rpx;
  354. background: rgba(1, 131, 250, 0.2);
  355. border-radius: 0rpx 0rpx 20rpx 0rpx;
  356. font-size: 24rpx;
  357. color: #0183FA;
  358. line-height: 50rpx;
  359. text-align: left;
  360. padding: 0rpx 22rpx;
  361. box-sizing: border-box;
  362. margin-bottom: 20rpx;
  363. }
  364. .list-li {
  365. margin: 0 30rpx;
  366. .list-li-t {
  367. width: 690rpx;
  368. background: #F5F5F5;
  369. border-radius: 10rpx 10rpx 10rpx 10rpx;
  370. display: flex;
  371. justify-content: flex-start;
  372. padding: 12rpx 20rpx 14rpx 14rpx;
  373. box-sizing: border-box;
  374. margin: 20rpx 0;
  375. >img {
  376. width: 24rpx;
  377. height: 24rpx;
  378. margin-right: 30rpx;
  379. }
  380. >view {
  381. flex: 1;
  382. font-size: 24rpx;
  383. color: #3D3D3D;
  384. line-height: 34rpx;
  385. text-align: left;
  386. }
  387. }
  388. .list-li-b {
  389. font-size: 24rpx;
  390. color: #3D3D3D;
  391. line-height: 24rpx;
  392. text-align: right;
  393. >text {
  394. color: #FF0000;
  395. }
  396. }
  397. }
  398. }
  399. .get-data-null-p {
  400. text-align: center;
  401. height: 100rpx;
  402. line-height: 100rpx;
  403. color: #999;
  404. padding-bottom: 200rpx;
  405. }
  406. }
  407. </style>