task.vue 5.6 KB

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