selectWork.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择工单" @clickLeft="backAdd">
  4. </uni-nav-bar>
  5. <view class="wapper-top">
  6. </view>
  7. <view class="wrapper">
  8. <u-list @scrolltolower="scrolltolower" class="listContent">
  9. <checkbox-group v-for="(item, index) in tableList" :key="index" @change="selectVal(item, index)">
  10. <label>
  11. <view class="listBox">
  12. <view class="listBox-sel">
  13. <checkbox :value="item.id" color="#fff" :checked="item.checked" />
  14. </view>
  15. <view class="listBox-con">
  16. <view class="listBox-bottom">
  17. <view>
  18. <text>工单编号:</text>
  19. <text class="value">{{ item.code }}</text>
  20. </view>
  21. <view>
  22. <text>计划单号:</text>
  23. <text class="value">{{ item.planCode }}</text>
  24. </view>
  25. <view>
  26. <text>计划名称:</text>
  27. <text class="value">{{ item.planName }}</text>
  28. </view>
  29. <view class="label-s">
  30. <text>报工人:</text>
  31. <text class="value">{{ item.executeUserName }}</text>
  32. </view>
  33. <view class="label-s">
  34. <text>验收人:</text>
  35. <text class="value">{{ item.accepterUserName }}</text>
  36. </view>
  37. <view>
  38. <text>验收时间:</text>
  39. <text class="value">{{ item.accepterTime }}</text>
  40. </view>
  41. <view>
  42. <text>开始时间:</text>
  43. <text class="value">{{ item.acceptTime }}</text>
  44. </view>
  45. <view>
  46. <text>结束时间:</text>
  47. <text class="value">{{ item.finishTime }}</text>
  48. </view>
  49. <view>
  50. <text>计划完成时间:</text>
  51. <text class="value">{{ item.planFinishTime }}</text>
  52. </view>
  53. <view>
  54. <text>状态:</text>
  55. <text class="value">{{ workerData(item) }}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </label>
  61. </checkbox-group>
  62. <u-empty class="noDate" style="margin-top: 20vh" v-if="!tableList.length"></u-empty>
  63. </u-list>
  64. </view>
  65. <view class="footer">
  66. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  67. <view class="selBtn">选择( {{ checkListLen }} )</view>
  68. </u-button>
  69. </view>
  70. <u-toast ref="uToast"></u-toast>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. getSalesWorkOrder
  76. } from '@/api/salesServiceManagement/workOrder/index.js'
  77. let workOrderStatus = {
  78. 0: '待接收',
  79. 1: '已接收',
  80. 2: '执行中',
  81. 3: '待验收',
  82. 4: '待评价',
  83. 5: '已完成',
  84. 6: '验收不通过',
  85. }
  86. export default {
  87. data() {
  88. return {
  89. tableList: [],
  90. checkData: {},
  91. pageNum: 1,
  92. isEnd: false,
  93. orderStatusList:'',
  94. isPieCar:''
  95. }
  96. },
  97. computed: {
  98. checkListLen() {
  99. if (this.checkData.id) {
  100. return 1;
  101. }
  102. return 0;
  103. },
  104. workerData() {
  105. return (row) => {
  106. return workOrderStatus[row.orderStatus]
  107. }
  108. }
  109. },
  110. onLoad(data) {
  111. this.orderStatusList=data.orderStatusList
  112. this.isPieCar=data.isPieCar
  113. this.doSearch();
  114. },
  115. methods: {
  116. doSearch() {
  117. this.isEnd = false;
  118. this.page = 1;
  119. this.getList();
  120. },
  121. //获取列表信息
  122. getList() {
  123. if (this.isEnd) {
  124. return;
  125. }
  126. uni.showLoading({
  127. title: '加载中'
  128. })
  129. let data = {
  130. pageNum: this.page,
  131. size: 10,
  132. }
  133. if(this.orderStatusList){
  134. data.orderStatusList=this.orderStatusList
  135. }
  136. if(this.isPieCar){
  137. data.isPieCar=this.isPieCar
  138. }
  139. getSalesWorkOrder(data).then(res => {
  140. if (this.page === 1) {
  141. this.tableList = res.list;
  142. } else {
  143. this.tableList.push(...res.list);
  144. }
  145. this.page += 1
  146. this.isEnd = this.tableList.length >= res.count;
  147. uni.hideLoading();
  148. }).catch((e) => {
  149. uni.hideLoading();
  150. })
  151. },
  152. selectVal(val, index) {
  153. this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
  154. this.tableList.forEach((item, i) => {
  155. if (item.id != val.id) {
  156. this.$set(this.tableList[i], 'checked', false)
  157. }
  158. })
  159. if (val.checked) {
  160. this.checkData = val;
  161. } else {
  162. this.checkData = {};
  163. }
  164. },
  165. scrolltolower() {
  166. if (this.isEnd) {
  167. return;
  168. }
  169. this.getList();
  170. },
  171. backAdd() {
  172. this.back();
  173. },
  174. jumpAdd() {
  175. if (!this.checkData.id) {
  176. this.$refs.uToast.show({
  177. type: "warning",
  178. message: "请选择一条工单数据",
  179. })
  180. return;
  181. }
  182. uni.$emit('updateWorkData', {
  183. data: this.checkData,
  184. })
  185. this.backAdd();
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped lang="scss">
  191. @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
  192. .mainBox {
  193. height: 100vh;
  194. display: flex;
  195. flex-direction: column;
  196. .wrapper {
  197. // flex: 1;
  198. height: calc(100vh - 196rpx);
  199. overflow: hidden;
  200. }
  201. }
  202. //底部按钮
  203. .footer {
  204. height: 45px;
  205. position: relative;
  206. display: flex;
  207. justify-content: space-between;
  208. align-items: center;
  209. bottom: 0;
  210. width: 100%;
  211. height: 50px;
  212. border-top: 1px solid #eeecec;
  213. background-color: #ffffff;
  214. z-index: 999;
  215. .bottom {
  216. margin-left: 10rpx;
  217. }
  218. .u-reset-button {
  219. position: absolute;
  220. right: 10rpx;
  221. top: 20rpx;
  222. width: 150rpx;
  223. }
  224. }
  225. </style>