selectWork.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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="top-wrapper">
  8. <uni-section>
  9. <uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal"
  10. placeholder="名称">
  11. </uni-easyinput>
  12. </uni-section>
  13. <button class="search_btn" @click="doSearch">搜索</button>
  14. <image class="menu_icon" src="~@/static/pda/menu.svg" @click="showSearch"></image>
  15. </view>
  16. <view class="wrapper">
  17. <u-list @scrolltolower="scrolltolower" class="listContent">
  18. <checkbox-group v-for="(item, index) in tableList" :key="index" @change="selectVal(item, index)">
  19. <label>
  20. <view class="listBox">
  21. <view class="listBox-sel">
  22. <checkbox :value="item.id" color="#fff" :checked="item.checked" />
  23. </view>
  24. <view class="listBox-con">
  25. <view class="listBox-bottom">
  26. <view>
  27. <text>工单编号:</text>
  28. <text class="value">{{ item.code }}</text>
  29. </view>
  30. <view>
  31. <text>计划单号:</text>
  32. <text class="value">{{ item.planCode }}</text>
  33. </view>
  34. <view>
  35. <text>计划名称:</text>
  36. <text class="value">{{ item.planName }}</text>
  37. </view>
  38. <view class="label-s">
  39. <text>报工人:</text>
  40. <text class="value">{{ item.executeUserName }}</text>
  41. </view>
  42. <view class="label-s">
  43. <text>验收人:</text>
  44. <text class="value">{{ item.accepterUserName }}</text>
  45. </view>
  46. <view>
  47. <text>验收时间:</text>
  48. <text class="value">{{ item.accepterTime }}</text>
  49. </view>
  50. <view>
  51. <text>开始时间:</text>
  52. <text class="value">{{ item.acceptTime }}</text>
  53. </view>
  54. <view>
  55. <text>结束时间:</text>
  56. <text class="value">{{ item.finishTime }}</text>
  57. </view>
  58. <view>
  59. <text>计划完成时间:</text>
  60. <text class="value">{{ item.planFinishTime }}</text>
  61. </view>
  62. <view>
  63. <text>状态:</text>
  64. <text class="value">{{ workerData(item) }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </label>
  70. </checkbox-group>
  71. <u-empty class="noDate" style="margin-top: 20vh" v-if="!tableList.length"></u-empty>
  72. </u-list>
  73. </view>
  74. <view class="footer">
  75. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  76. <view class="selBtn">选择( {{ checkListLen }} )</view>
  77. </u-button>
  78. </view>
  79. <MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch"></MySearch>
  80. <u-toast ref="uToast"></u-toast>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. getSalesWorkOrder
  86. } from '@/api/salesServiceManagement/workOrder/index.js'
  87. let workOrderStatus = {
  88. 0: '待接收',
  89. 1: '已接收',
  90. 2: '执行中',
  91. 3: '待验收',
  92. 4: '待评价',
  93. 5: '已完成',
  94. 6: '验收不通过',
  95. }
  96. export default {
  97. data() {
  98. return {
  99. tableList: [],
  100. checkData: {},
  101. pageNum: 1,
  102. isEnd: false,
  103. orderStatusList: '',
  104. isPieCar: '',
  105. searchForm: {},
  106. searchVal: '',
  107. searchShow: false,
  108. formItems: [{
  109. label: '工单编号:',
  110. prop: 'code',
  111. component: 'MyInput',
  112. props: {
  113. placeholder: '请输入内容',
  114. }
  115. },
  116. {
  117. label: '客户名称:',
  118. prop: 'contactName',
  119. component: 'MyInput',
  120. props: {
  121. placeholder: '请输入内容',
  122. }
  123. },
  124. {
  125. label: '设备名称:',
  126. prop: 'deviceName',
  127. component: 'MyInput',
  128. props: {
  129. placeholder: '请输入内容',
  130. }
  131. },
  132. {
  133. label: '故障等级:',
  134. prop: 'faultLevel',
  135. component: 'MySelect',
  136. props: {
  137. localdata: [],
  138. dataKey: 'label',
  139. dataValue: 'value'
  140. }
  141. },
  142. {
  143. label: '计划单号:',
  144. prop: 'planCode',
  145. component: 'MyInput',
  146. props: {
  147. placeholder: '请输入内容',
  148. }
  149. },
  150. {
  151. label: '计划名称:',
  152. prop: 'planName',
  153. component: 'MyInput',
  154. props: {
  155. placeholder: '请输入内容',
  156. }
  157. },
  158. {
  159. label: '报工人:',
  160. prop: 'executeUserName',
  161. component: 'MyInput',
  162. props: {
  163. placeholder: '请输入内容',
  164. }
  165. },
  166. {
  167. label: '验收人:',
  168. prop: 'accepterUserName',
  169. component: 'MyInput',
  170. props: {
  171. placeholder: '请输入内容',
  172. }
  173. },
  174. ],
  175. }
  176. },
  177. computed: {
  178. checkListLen() {
  179. if (this.checkData.id) {
  180. return 1;
  181. }
  182. return 0;
  183. },
  184. workerData() {
  185. return (row) => {
  186. return workOrderStatus[row.orderStatus]
  187. }
  188. }
  189. },
  190. onLoad(data) {
  191. this.orderStatusList = data.orderStatusList
  192. this.isPieCar = data.isPieCar
  193. this.doSearch();
  194. },
  195. methods: {
  196. doSearch() {
  197. this.isEnd = false;
  198. this.page = 1;
  199. this.getList();
  200. },
  201. //获取列表信息
  202. getList() {
  203. if (this.isEnd) {
  204. return;
  205. }
  206. uni.showLoading({
  207. title: '加载中'
  208. })
  209. let data = {
  210. pageNum: this.page,
  211. size: 10,
  212. keyWord: this.searchVal,
  213. ...this.searchForm
  214. }
  215. if (this.orderStatusList) {
  216. data.orderStatusList = this.orderStatusList
  217. }
  218. if (this.isPieCar) {
  219. data.isPieCar = this.isPieCar
  220. }
  221. getSalesWorkOrder(data).then(res => {
  222. if (this.page === 1) {
  223. this.tableList = res.list;
  224. } else {
  225. this.tableList.push(...res.list);
  226. }
  227. this.page += 1
  228. this.isEnd = this.tableList.length >= res.count;
  229. uni.hideLoading();
  230. }).catch((e) => {
  231. uni.hideLoading();
  232. })
  233. },
  234. selectVal(val, index) {
  235. this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
  236. this.tableList.forEach((item, i) => {
  237. if (item.id != val.id) {
  238. this.$set(this.tableList[i], 'checked', false)
  239. }
  240. })
  241. if (val.checked) {
  242. this.checkData = val;
  243. } else {
  244. this.checkData = {};
  245. }
  246. },
  247. scrolltolower() {
  248. if (this.isEnd) {
  249. return;
  250. }
  251. this.getList();
  252. },
  253. backAdd() {
  254. this.back();
  255. },
  256. clearSearch() {
  257. this.searchVal = ''
  258. this.doSearch()
  259. },
  260. showSearch() {
  261. this.searchShow = true
  262. },
  263. doSearch() {
  264. this.isEnd = false;
  265. this.page = 1;
  266. this.getList();
  267. },
  268. confirmSearch(e) {
  269. console.log(e);
  270. let data = JSON.parse(JSON.stringify(e))
  271. this.searchForm = data
  272. this.doSearch()
  273. },
  274. jumpAdd() {
  275. if (!this.checkData.id) {
  276. this.$refs.uToast.show({
  277. type: "warning",
  278. message: "请选择一条工单数据",
  279. })
  280. return;
  281. }
  282. uni.$emit('updateWorkData', {
  283. data: this.checkData,
  284. })
  285. this.backAdd();
  286. }
  287. }
  288. }
  289. </script>
  290. <style scoped lang="scss">
  291. @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
  292. .mainBox {
  293. height: 100vh;
  294. display: flex;
  295. flex-direction: column;
  296. .wrapper {
  297. // flex: 1;
  298. height: calc(100vh - 196rpx);
  299. overflow: hidden;
  300. }
  301. }
  302. .top-wrapper {
  303. background-color: #fff;
  304. display: flex;
  305. width: 750rpx;
  306. height: 88rpx;
  307. padding: 16rpx 32rpx;
  308. align-items: center;
  309. gap: 16rpx;
  310. /deep/.uni-section {
  311. margin-top: 0px;
  312. }
  313. /deep/.uni-section-header {
  314. padding: 0px;
  315. }
  316. .search_btn {
  317. width: 120rpx;
  318. height: 70rpx;
  319. line-height: 70rpx;
  320. padding: 0 24rpx;
  321. background: $theme-color;
  322. font-size: 32rpx;
  323. color: #fff;
  324. margin: 0;
  325. margin-left: 26rpx;
  326. }
  327. .menu_icon {
  328. width: 44rpx;
  329. height: 44rpx;
  330. margin-left: 14rpx;
  331. }
  332. }
  333. //底部按钮
  334. .footer {
  335. height: 45px;
  336. position: relative;
  337. display: flex;
  338. justify-content: space-between;
  339. align-items: center;
  340. bottom: 0;
  341. width: 100%;
  342. height: 50px;
  343. border-top: 1px solid #eeecec;
  344. background-color: #ffffff;
  345. z-index: 999;
  346. .bottom {
  347. margin-left: 10rpx;
  348. }
  349. .u-reset-button {
  350. position: absolute;
  351. right: 10rpx;
  352. top: 20rpx;
  353. width: 150rpx;
  354. }
  355. }
  356. .listBox {
  357. display: flex;
  358. padding: 10px 0;
  359. border-bottom: 1px solid #e5e5e5;
  360. }
  361. .listBox-con {
  362. width: 100%;
  363. display: flex;
  364. flex-wrap: wrap;
  365. justify-content: space-between;
  366. align-items: center;
  367. padding: 0 9px 0 0;
  368. }
  369. .listBox-sel {
  370. height: 45px;
  371. width: 40px;
  372. text-align: center;
  373. }
  374. </style>