task.vue 8.4 KB

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