hazardRecord.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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 submit" @click="handleSubmit(3)">提交</view>
  26. <view class="handle danger" @click="handleSubmit('danger')">登记隐患</view>
  27. <view class="more" @mouseenter="hover(1)" @mouseleave="hover">
  28. <text class="text">更多</text>
  29. <view class="list" v-if="showMore">
  30. <view class="hand-item-box">
  31. <view class="handle-item" @click="handleSubmit(4)">撤销</view>
  32. <view class="handle-item" @click="handleSubmit(5)">转交</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <template v-else>没有可处理的清单^-_-^</template>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import { getChecklistHazardRecordView } from '@/api/aqpt/checklistRecordHazardApi'
  44. import { batchUpdateChecklistHazardRecordDoing } from '@/api/aqpt/checklistHazardRecordApi'
  45. import {cancelCheckTask,completeCheckTask} from '@/api/aqpt/task.js'
  46. export default {
  47. data() {
  48. return {
  49. defaultProps: {
  50. id: 'itemId',
  51. children: 'children',
  52. label: 'itemTitle'
  53. },
  54. accountInfo:{},
  55. divider: false,
  56. edit: true,
  57. itemList:[],
  58. recordId:undefined,
  59. checklistId:undefined,
  60. handleVisiable:false,
  61. type:undefined,
  62. status:undefined,
  63. taskTitle:"",
  64. showMore:false
  65. }
  66. },
  67. filters: {
  68. checkResultFilter(i) {
  69. if (i >= 0) {
  70. const strs = [
  71. '未检查',
  72. '通过'
  73. ]
  74. return strs[i]
  75. } else {
  76. if (i === -1) {
  77. return '未通过'
  78. } else if (i === -2) {
  79. return '发现隐患'
  80. }
  81. }
  82. }
  83. },
  84. onLoad({rid,cid,title}) {
  85. this.checklistId=cid
  86. this.recordId=rid
  87. let accountInfo=uni.getStorageSync('accountInfo')
  88. this.accountInfo=accountInfo
  89. this.taskTitle=title
  90. this.getchecklistRecord(rid)
  91. },
  92. methods: {
  93. getchecklistRecord(recordId){
  94. getChecklistHazardRecordView(recordId).then((res)=>{
  95. if(!res.data.hazardList)return
  96. this.itemList=res.data.hazardList
  97. this.status=res.data.status
  98. })
  99. },
  100. check(measure){
  101. uni.setStorageSync("measure",measure)
  102. uni.redirectTo({
  103. url:"/pages/index/handle/task/hazardRecord/form"
  104. })
  105. },
  106. handleSubmit(type){
  107. let recordId=this.recordId;
  108. let checklistId=this.checklistId;
  109. if(type===1){
  110. batchUpdateChecklistHazardRecordDoing(recordId,1).then(()=>{
  111. this.getchecklistRecord(recordId)
  112. })
  113. }
  114. if(type===2){
  115. batchUpdateChecklistHazardRecordDoing(recordId,-1).then(()=>{
  116. this.getchecklistRecord(recordId)
  117. })
  118. }
  119. if(type===3){//完成
  120. completeCheckTask(recordId).then(()=>{
  121. uni.switchTab({
  122. url:'/pages/index/index'
  123. })
  124. }).catch(()=>{
  125. uni.showToast({
  126. icon:"none",
  127. title:"操作失败"
  128. })
  129. })
  130. }
  131. if(type===4){//放弃
  132. cancelCheckTask(recordId).then(()=>{
  133. uni.switchTab({
  134. url:'/pages/index/index'
  135. })
  136. }).catch(()=>{
  137. uni.showToast({
  138. icon:"none",
  139. title:"操作失败"
  140. })
  141. })
  142. }
  143. if(type===5){//转交
  144. let taskTitle=this.taskTitle;
  145. uni.redirectTo({
  146. url:`/pages/index/handle/task/checkList/form/transferCheckTask?tid=${recordId}&title=${taskTitle}`
  147. })
  148. }
  149. if(type==="danger"){
  150. let href="http://h5.xazhyc.com/danger/views/create.html";
  151. let name= '登记隐患'
  152. completeCheckTask(recordId).then(()=>{
  153. uni.redirectTo({
  154. url:`/pages/webview/webview?href=${href}&name=${name}`
  155. })
  156. }).catch(()=>{
  157. uni.showToast({
  158. icon:"none",
  159. title:"操作失败"
  160. })
  161. })
  162. }
  163. },
  164. hover(state){
  165. this.showMore=state===1
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .page{
  172. background-color: #F5F6F8;
  173. padding: 20rpx;
  174. min-height: 100vh;
  175. box-sizing: border-box;
  176. margin-bottom: 100rpx;
  177. .page-head{
  178. text-align: right;
  179. padding-bottom: 10rpx;
  180. .handle{
  181. display: inline-block;
  182. background-color: #3384FF;
  183. color: #fff;
  184. padding: 10rpx 15rpx;
  185. box-sizing: border-box;
  186. border-right: 1rpx solid #eaeaea;
  187. font-size: 30rpx;
  188. text-align: center;
  189. &:nth-child(4){
  190. border: 0;
  191. }
  192. }
  193. }
  194. }
  195. .wrap{
  196. padding: 20rpx;
  197. background-color: #fff;
  198. .checklist{
  199. .title{
  200. color: #222222;
  201. font-size: 32rpx;
  202. height: 98rpx;
  203. line-height: 98rpx;
  204. overflow: hidden;
  205. text-overflow: ellipsis;
  206. border-bottom: 1px dashed #E8E8E8;
  207. }
  208. .more{
  209. background-image: url('/static/tree_more.png');
  210. background-size: 30rpx 30rpx;
  211. padding-left: 40rpx;
  212. background-position: center left;
  213. background-repeat: no-repeat;
  214. }
  215. .item-cont{
  216. padding-left: 20rpx;
  217. border-bottom: 1px dashed #E8E8E8;
  218. .checklistItem{
  219. .itemTitle{
  220. color: #222222;
  221. font-size: 32rpx;
  222. height: 98rpx;
  223. line-height: 98rpx;
  224. }
  225. }
  226. .point-cont{
  227. padding-left: 30rpx;
  228. .point{
  229. display: flex;
  230. color: #666;
  231. font-size: 28rpx;
  232. // height: 98rpx;
  233. // line-height: 98rpx;
  234. .pointContent{
  235. flex: 1;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. .handle-container{
  242. position: fixed;
  243. width: 100%;
  244. left: 0;
  245. bottom: 0;
  246. background-color: #fff;
  247. display: flex;
  248. justify-content: center;
  249. align-items: center;
  250. border-top: 1rpx solid #eaeaea;
  251. padding: 15rpx 0;
  252. .handle{
  253. display:inline-block;
  254. color: #222;
  255. padding: 15rpx 20rpx;
  256. box-sizing: border-box;
  257. border: 1rpx solid #eaeaea;
  258. font-size: 26rpx;
  259. text-align: center;
  260. border-radius: 50rpx;
  261. margin: 0 10rpx;
  262. &.danger{
  263. background-color: #FA5B41;
  264. color: #fff;
  265. }
  266. &.submit{
  267. background-color: #3384FF;
  268. color: #fff;
  269. }
  270. }
  271. .more{
  272. position: relative;
  273. padding: 15rpx 20rpx;
  274. .text:hover{
  275. &+.list>.hand-item-box{
  276. display: block;
  277. }
  278. }
  279. .list{
  280. position: absolute;
  281. bottom: 100rpx;
  282. right: 0;
  283. box-shadow: 0px 2px 12px 0px #0000001F;
  284. padding:0 20rpx;
  285. background-color: #fff;
  286. .hand-item-box{
  287. position: relative;
  288. display: none;
  289. &.show{
  290. display: block;
  291. }
  292. &::after{
  293. width: 0;
  294. height: 0;
  295. content: "";
  296. display: block;
  297. border-width: 26rpx 26rpx 0 0;
  298. border-color: #fff transparent;
  299. border-style: solid;
  300. position: absolute;
  301. bottom: -20rpx;
  302. right: -20rpx;
  303. }
  304. .handle-item{
  305. width: 180rpx;
  306. height: 50rpx;
  307. font-size: 26rpx;
  308. line-height: 50rpx;
  309. background-color: #fff;
  310. text-align: center;
  311. border-bottom: 1px solid #ccc;
  312. padding:10rpx 0;
  313. &:last-child{
  314. border: 0;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. }
  322. </style>