hazardRecord.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="page">
  3. <view class="wrap">
  4. <template v-if="itemList.length>0">
  5. <view class="checklist" v-for="(hazardlist,idx) in itemList" :key="idx">
  6. <view class="title more">{{hazardlist.hazardTitle}}</view>
  7. <view class="item-cont" v-if="hazardlist.riskList&&hazardlist.riskList.length>0">
  8. <view class="checklistItem" v-for="(riskItem,itemIdx) in hazardlist.riskList" :key="itemIdx">
  9. <view class="itemTitle more"> {{riskItem.riskTitle}}</view>
  10. <view class="point-cont" v-if="riskItem.recordList&&riskItem.recordList.length>0">
  11. <view class="point" v-for="(measure,measureIdx) in riskItem.recordList" :key="measureIdx" @click="check(measure)">
  12. <view class="pointContent">
  13. <text style="padding-right: 5px;">{{measureIdx+1}})</text>
  14. <text>{{measure.measureContent}}</text>
  15. </view>
  16. <view class="status">{{measure.checkResult|checkResultFilter}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="handle-container">
  23. <view class="handle" @click="handleSubmit(1)">全部通过</view>
  24. <view class="handle" @click="handleSubmit(2)">全不通过</view>
  25. <view class="handle" @click="handleSubmit(3)">提交</view>
  26. <view class="handle" @click="handleSubmit(4)">撤销</view>
  27. <view class="handle" @click="handleSubmit(5)">转交</view>
  28. </view>
  29. </template>
  30. <template v-else>没有可处理的清单^-_-^</template>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import { getChecklistHazardRecordView } from '@/api/aqpt/checklistRecordHazardApi'
  36. import { batchUpdateChecklistHazardRecordDoing } from '@/api/aqpt/checklistHazardRecordApi'
  37. import {cancelCheckTask,completeCheckTask} from '@/api/aqpt/task.js'
  38. export default {
  39. data() {
  40. return {
  41. defaultProps: {
  42. id: 'itemId',
  43. children: 'children',
  44. label: 'itemTitle'
  45. },
  46. accountInfo:{},
  47. divider: false,
  48. edit: true,
  49. itemList:[],
  50. recordId:undefined,
  51. checklistId:undefined,
  52. handleVisiable:false,
  53. type:undefined,
  54. status:undefined,
  55. taskTitle:""
  56. }
  57. },
  58. filters: {
  59. checkResultFilter(i) {
  60. if (i >= 0) {
  61. const strs = [
  62. '未检查',
  63. '通过'
  64. ]
  65. return strs[i]
  66. } else {
  67. if (i === -1) {
  68. return '未通过'
  69. } else if (i === -2) {
  70. return '发现隐患'
  71. }
  72. }
  73. }
  74. },
  75. onLoad({rid,cid,title}) {
  76. this.checklistId=cid
  77. this.recordId=rid
  78. let accountInfo=uni.getStorageSync('accountInfo')
  79. this.accountInfo=accountInfo
  80. this.taskTitle=title
  81. this.getchecklistRecord(rid)
  82. },
  83. methods: {
  84. getchecklistRecord(recordId){
  85. getChecklistHazardRecordView(recordId).then((res)=>{
  86. this.itemList=res.data.hazardList
  87. this.status=res.data.status
  88. })
  89. },
  90. check(measure){
  91. uni.setStorageSync("measure",measure)
  92. uni.navigateTo({
  93. url:"/pages/index/handle/task/hazardRecord/form"
  94. })
  95. },
  96. handleSubmit(type){
  97. let recordId=this.recordId;
  98. let checklistId=this.checklistId;
  99. if(type===1){
  100. batchUpdateChecklistHazardRecordDoing(recordId,1).then(()=>{
  101. this.getchecklistRecord(checklistId,recordId)
  102. })
  103. }
  104. if(type===2){
  105. batchUpdateChecklistHazardRecordDoing(recordId,-1).then(()=>{
  106. this.getchecklistRecord(checklistId,recordId)
  107. })
  108. }
  109. if(type===3){//完成
  110. completeCheckTask(recordId).then(()=>{
  111. uni.switchTab({
  112. url:'/pages/index/index'
  113. })
  114. }).catch(()=>{
  115. uni.showToast({
  116. icon:"none",
  117. title:"操作失败"
  118. })
  119. })
  120. }
  121. if(type===4){//放弃
  122. cancelCheckTask(recordId).then(()=>{
  123. uni.switchTab({
  124. url:'/pages/index/index'
  125. })
  126. }).catch(()=>{
  127. uni.showToast({
  128. icon:"none",
  129. title:"操作失败"
  130. })
  131. })
  132. }
  133. if(type===5){//转交
  134. let taskTitle=this.taskTitle;
  135. uni.navigateTo({
  136. url:`/pages/index/handle/task/checkList/form/transferCheckTask?tid=${recordId}&title=${taskTitle}`
  137. })
  138. }
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .page{
  145. background-color: #F5F6F8;
  146. padding: 20rpx;
  147. min-height: 100vh;
  148. box-sizing: border-box;
  149. margin-bottom: 100rpx;
  150. .page-head{
  151. text-align: right;
  152. padding-bottom: 10rpx;
  153. .handle{
  154. display: inline-block;
  155. background-color: #3384FF;
  156. color: #fff;
  157. padding: 10rpx 15rpx;
  158. box-sizing: border-box;
  159. border-right: 1rpx solid #eaeaea;
  160. font-size: 30rpx;
  161. text-align: center;
  162. &:nth-child(4){
  163. border: 0;
  164. }
  165. }
  166. }
  167. }
  168. .wrap{
  169. padding: 20rpx;
  170. background-color: #fff;
  171. .checklist{
  172. .title{
  173. color: #222222;
  174. font-size: 32rpx;
  175. height: 98rpx;
  176. line-height: 98rpx;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. border-bottom: 1px dashed #E8E8E8;
  180. }
  181. .more{
  182. background-image: url('/static/tree_more.png');
  183. background-size: 30rpx 30rpx;
  184. padding-left: 40rpx;
  185. background-position: center left;
  186. background-repeat: no-repeat;
  187. }
  188. .item-cont{
  189. padding-left: 20rpx;
  190. border-bottom: 1px dashed #E8E8E8;
  191. .checklistItem{
  192. .itemTitle{
  193. color: #222222;
  194. font-size: 32rpx;
  195. height: 98rpx;
  196. line-height: 98rpx;
  197. }
  198. }
  199. .point-cont{
  200. padding-left: 30rpx;
  201. .point{
  202. display: flex;
  203. color: #666;
  204. font-size: 28rpx;
  205. // height: 98rpx;
  206. // line-height: 98rpx;
  207. .pointContent{
  208. flex: 1;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. .handle-container{
  215. position: fixed;
  216. width: 100%;
  217. left: 0;
  218. bottom: 0;
  219. background-color: #fff;
  220. display: flex;
  221. justify-content: center;
  222. align-items: center;
  223. border-top: 1rpx solid #eaeaea;
  224. .handle{
  225. display:block;
  226. background-color: #3384FF;
  227. color: #fff;
  228. padding: 15rpx 0;
  229. width: 20%;
  230. box-sizing: border-box;
  231. border-right: 1rpx solid #eaeaea;
  232. font-size: 26rpx;
  233. text-align: center;
  234. &:last-child{
  235. border: 0;
  236. }
  237. }
  238. }
  239. }
  240. </style>