taskList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="task-page">
  3. <div class="title">{{item.title}}</div>
  4. <div class="info" v-if="items.length>0">
  5. <div class="item-checklist" v-for="item in items">
  6. <view class="name">检查防水是否完好检查防水是否完好检查防水是否完好检查防水是否完好检查防水是否完好</view>
  7. <view class="cont">
  8. <uni-data-checkbox v-model="item.state" :localdata="checkState" @change="changeCheck(item)"/>
  9. </view>
  10. </div>
  11. </div>
  12. <view class="empty" v-else>
  13. 没有可检查项
  14. </view>
  15. <view class="footer" @click="onSubmit" v-if="items.length>0">提交</view>
  16. </view>
  17. </template>
  18. <script>
  19. import {parseTime} from '@/libs/index.js'
  20. import { getChecklistItemById } from '@/api/check'
  21. import { handleCheckTask } from '@/api/task'
  22. export default {
  23. data() {
  24. return {
  25. userData:{},
  26. item:{
  27. title:"水位预{2号-770-32002}:采空区封堵完好,无渗水情况。"
  28. },
  29. flow:{
  30. status:"",
  31. time:"",
  32. desc:"",
  33. attachList:[]
  34. },
  35. items:[],
  36. checkState:[{"value": 1,"text": "通过" },{"value": 0,"text": "不通过"}]
  37. }
  38. },
  39. onLoad() {
  40. this.init()
  41. },
  42. methods: {
  43. parseTime,
  44. init(){
  45. let data=uni.getStorageSync('task-item')
  46. this.userData=uni.getStorageSync('accountInfo')
  47. getChecklistItemById(data.checklistId).then((res) => {
  48. this.items = res.data
  49. })
  50. },
  51. changeCheck(item){
  52. if(!item.state){
  53. uni.showModal({
  54. title: '提示',
  55. content: `请确认${item.title}状态为否`,
  56. success: function (res) {
  57. if (res.confirm) {
  58. console.log('用户点击确定');
  59. } else if (res.cancel) {
  60. console.log('用户点击取消');
  61. }
  62. }
  63. });
  64. }
  65. },
  66. onSubmit(){
  67. let viewData=uni.getStorageSync('task-item')
  68. let checkItemNopass = ''
  69. let checkItemPass = ''
  70. let checkResult=0
  71. this.dataList.forEach(item => {
  72. if (item.state===1) {
  73. checkItemPass += item.checkItemPass + ','
  74. }else{
  75. checkResult=1
  76. checkItemNopass += item.checklistItemContent + '不通过,'
  77. }
  78. })
  79. checkItemPass = checkItemPass.substring(0, checkItemPass.length - 1)
  80. checkItemNopass = checkItemNopass.substring(0, checkItemNopass.length - 1)
  81. handleCheckTask({
  82. ...viewData,
  83. 'handleAccountId': this.userData.userId,
  84. 'handleAccountName': this.userData.userName,
  85. 'handlePositionId': this.userData.positionId,
  86. 'handlePositionName': this.userData.positionName,
  87. 'handleGroupId': this.userData.groupId,
  88. 'handleGroupName': this.userData.groupName,
  89. 'status': 1,
  90. checkResult,
  91. checkItemPass,
  92. checkItemNopass
  93. }).then(() => {
  94. this.dialogVisible = false
  95. this.$emit('success')
  96. if (checkResult===1) {
  97. uni.setStorageSync('submit-data',{
  98. ...viewData,
  99. 'handleAccountId': this.userData.userId,
  100. 'handleAccountName': this.userData.userName,
  101. 'handlePositionId': this.userData.positionId,
  102. 'handlePositionName': this.userData.positionName,
  103. 'handleGroupId': this.userData.groupId,
  104. 'handleGroupName': this.userData.groupName,
  105. 'status': 1,
  106. checkResult,
  107. checkItemPass,
  108. checkItemNopass
  109. })
  110. uni.navigateTo({
  111. url:'/pages/task/submit/submit'
  112. })
  113. }
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .task-page{
  121. background-color: #F3F5FB;
  122. height: 100vh;
  123. .title{
  124. font-family: 'Source Han Sans CN';
  125. font-style: normal;
  126. font-weight: 700;
  127. font-size: 36rpx;
  128. line-height: 54rpx;
  129. color: #212121;
  130. padding:0 32rpx;
  131. }
  132. .info{
  133. padding: 0 10rpx;
  134. margin: 40rpx 0 0;
  135. padding-bottom: 150rpx;
  136. background: #FFFFFF;
  137. border-radius: 32rpx 32rpx 0px 0px;
  138. .item-checklist{
  139. display: flex;
  140. justify-content: space-between;
  141. padding: 18rpx 20rpx;
  142. border-bottom: 1rpx solid #EFF1F3;
  143. .name{
  144. flex: 1;
  145. }
  146. .cont{
  147. padding-left: 20rpx;
  148. width: 200rpx;
  149. display: flex;
  150. justify-content: flex-end;
  151. align-items: center;
  152. box-sizing: border-box;
  153. }
  154. }
  155. }
  156. .empty{
  157. text-align: center;
  158. font-size: 28rpx;
  159. margin-top: 10%;
  160. color: #666;
  161. }
  162. .footer{
  163. width: 100%;
  164. height: 136rpx;
  165. background: #FFFFFF;
  166. border-radius: 16upx 16upx 0px 0px;
  167. position: fixed;
  168. left: 0;
  169. bottom: 0;
  170. text-align: center;
  171. color: #168DEC;
  172. font-size: 32upx;
  173. padding-top: 20upx;
  174. letter-spacing: 2px;
  175. border-top: 1rpx solid #eaeaea;
  176. }
  177. }
  178. </style>