table.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="table-wrap entRiskPointCheck-table">
  3. <view v-for="(item, index) in dataList.hazardList" :key="item.hazardId" class="hazardList-wrap">
  4. <view class="hazardList">
  5. <view class="hazardTitle-wrap">
  6. <view class="hazardTitle">标题:{{item.hazardTitle}}</view>
  7. <view class="hazardCode">编号:{{item.hazardCode}}</view>
  8. </view>
  9. <view class="hazard-cont">
  10. <view v-for="(item1, riskIndex) in item.riskList"
  11. :key="item1.riskId" class="hazardItem"
  12. :class="(item.riskList.length-1)===riskIndex?'delBorder':''">
  13. <view class="riskList">
  14. <view class="hazardHead">
  15. <view>风险源:{{item1.riskSource}}</view>
  16. <view>危险因素:{{item1.riskReason}}</view>
  17. <view>等级:{{item1.riskLevel}}</view>
  18. </view>
  19. <view class="riskItem"
  20. v-for="(measure, index) in item1.measureList"
  21. :key="measure.measureId"
  22. @click="check(measure,item)">
  23. <view>措施分类:{{measure.measureTypeTitle}}</view>
  24. <view>管控措施:{{measure.measureContent}}</view>
  25. <text>法律依据:{{measure.measureReference}}</text>
  26. <text class="risk-desc">描述:{{measure.measureDesc}}</text>
  27. <template v-if="measure.checkResult===0">
  28. <text class="status primary">处理</text>
  29. </template>
  30. <template v-if="measure.checkResult===1">
  31. <text class="status success">通过</text>
  32. </template>
  33. <template v-if="measure.checkResult===2">
  34. <text class="status error">不通过</text>
  35. </template>
  36. <template v-if="measure.checkResult===3">
  37. <text class="status warn">有隐患</text>
  38. </template>
  39. <text class="zhcx-iconfont zhcx-icon-youbianjiantoujiaoduxiao"></text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="handle-wrap">
  47. <button class="bottom-button-left" type="primary" @click="AllCheck()">全部通过</button>
  48. <button class="bottom-button-right" type="primary" @click="FinishCheck()">完成检查</button>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import { getCheckList, getCheckTaskView } from '@/api/entRiskPoint.js'
  54. import {
  55. verifyCheckTaskDoingIsComplete,
  56. batchUpdateCheckTaskDoingRecord,
  57. completeCheckTaskDoingRecord
  58. } from '@/api/checkRecord.js'
  59. import { deepClone } from '@/libs/index.js'
  60. export default {
  61. data() {
  62. return {
  63. dataList: [{ hazardList: [] }],
  64. queryConditions: {
  65. checklistId: '',
  66. riskPointId: ''
  67. },
  68. }
  69. },
  70. onLoad(options) {
  71. console.log({
  72. "检查表":options
  73. })
  74. this.queryConditions.taskId = options.taskId
  75. this.queryConditions.riskPointId = options.riskPointId
  76. //请求页面数据
  77. this.getData(options.taskId);
  78. },
  79. methods: {
  80. getData(taskId) {
  81. getCheckTaskView(taskId).then((resp) => {
  82. const { code, data, count } = resp
  83. if (code === 0) {
  84. console.log("成功")
  85. this.queryConditions.total = count
  86. this.dataList = data
  87. }
  88. }).catch((error) => {
  89. console.log(error)
  90. })
  91. },
  92. check(measure,item) {
  93. //跳转到分级管控检查表页面
  94. let riskPointId=this.queryConditions.riskPointId;
  95. let taskId=this.queryConditions.taskId;
  96. if(!riskPointId){
  97. uni.showToast({
  98. title:"riskPointId未找到"
  99. })
  100. return;
  101. }
  102. if(!taskId){
  103. uni.showToast({
  104. title:"taskId未找到"
  105. })
  106. return;
  107. }
  108. measure.hazardId=item.hazardId;
  109. uni.setStorageSync('entRiskPointMeasure',measure)
  110. uni.reLaunch({
  111. url: `/views/entRiskPointCheck/checkInfo?taskId=${taskId}&riskPointId=${riskPointId}`
  112. });
  113. },
  114. //全部通过
  115. AllCheck() {
  116. batchUpdateCheckTaskDoingRecord(this.queryConditions.taskId).then((res) => {
  117. const { code, data, conut } = res
  118. if (code === 0) {
  119. uni.showToast({
  120. icon:'none',
  121. title:'操作成功!'
  122. })
  123. this.getData(this.queryConditions.taskId);
  124. }
  125. })
  126. },
  127. //完成
  128. FinishCheck() {
  129. completeCheckTaskDoingRecord(this.queryConditions.taskId).then((res) => {
  130. const { code, data, conut } = res
  131. if (code === 0) {
  132. let riskPointId=this.queryConditions.riskPointId;
  133. uni.showToast({
  134. icon:'none',
  135. title:'完成任务成功!',
  136. complete() {
  137. //回跳到检查清单
  138. // uni.reLaunch({
  139. // url: '/views/entRiskPointCheck/index?id=' + riskPointId
  140. // });
  141. //跳转到首页
  142. uni.reLaunch({
  143. url:"/pages/index/index",
  144. })
  145. // uni.switchTab({
  146. // url:"/pages/index/index",
  147. // })
  148. }
  149. })
  150. }
  151. })
  152. },
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .entRiskPointCheck-table{
  158. // padding:0 20upx;
  159. // margin-top: 30upx;
  160. margin-bottom: 150upx;
  161. .hazardList-wrap{
  162. .hazardList {
  163. padding:30upx;
  164. margin-bottom:30upx;
  165. background-color: #f5f5f5;
  166. // border-radius: 10upx;
  167. box-shadow: 0 0 6upx rgba(0,0,0,0.5);
  168. .hazardHead{
  169. background-color:#fff;
  170. font-weight: 600;
  171. padding-bottom: 10px;
  172. }
  173. .hazardTitle-wrap{
  174. .hazardTitle{
  175. font-weight: 600;
  176. font-size: 34upx;
  177. }
  178. .hazardCode{
  179. font-weight: 600;
  180. font-size: 34upx;
  181. padding-bottom: 15upx;
  182. }
  183. }
  184. .hazardItem{
  185. background-color: #fff;
  186. margin-top: 28upx;
  187. border-top: 1px solid #eaeaea;
  188. padding:10upx 0;
  189. &.delBorder{
  190. border-top:none;
  191. }
  192. }
  193. .risk-desc{
  194. margin-left: 16upx;
  195. }
  196. .riskList{
  197. .riskItem{
  198. border-top: 1px solid #eaeaea;
  199. position: relative;
  200. padding: 20upx 0;
  201. .zhcx-iconfont{
  202. font-size: 16px;
  203. position: absolute;
  204. right: 10upx;
  205. top: 50%;
  206. transform: translateY(-50%);
  207. }
  208. .status{
  209. &.primary{
  210. color: #1aad19;
  211. }
  212. &.warn{
  213. color: #e6a23c;
  214. }
  215. &.success{
  216. color:#0081FF;
  217. }
  218. &.error{
  219. color: red;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. .handle-wrap{
  227. width: 750upx;
  228. position: fixed;
  229. left: 0;
  230. bottom: 5upx;
  231. text-align: center;
  232. .bottom-button-left {
  233. width: 350upx;
  234. background-color: #31bc07;
  235. border-top-right-radius: 0;
  236. border-bottom-right-radius: 0;
  237. display: inline-block;
  238. }
  239. .bottom-button-right {
  240. width: 350upx;
  241. background-color: DodgerBlue;
  242. border-top-left-radius: 0;
  243. border-bottom-left-radius:0 ;
  244. display: inline-block;
  245. }
  246. }
  247. }
  248. </style>