task.vue 6.5 KB

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