selectWork.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. console.log(data,';data')
  222. getSalesWorkOrder(data).then(res => {
  223. if (this.page === 1) {
  224. this.tableList = res.list;
  225. } else {
  226. this.tableList.push(...res.list);
  227. }
  228. this.page += 1
  229. this.isEnd = this.tableList.length >= res.count;
  230. uni.hideLoading();
  231. }).catch((e) => {
  232. uni.hideLoading();
  233. })
  234. },
  235. selectVal(val, index) {
  236. this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
  237. this.tableList.forEach((item, i) => {
  238. if (item.id != val.id) {
  239. this.$set(this.tableList[i], 'checked', false)
  240. }
  241. })
  242. if (val.checked) {
  243. this.checkData = val;
  244. } else {
  245. this.checkData = {};
  246. }
  247. },
  248. scrolltolower() {
  249. if (this.isEnd) {
  250. return;
  251. }
  252. this.getList();
  253. },
  254. backAdd() {
  255. this.back();
  256. },
  257. clearSearch() {
  258. this.searchVal = ''
  259. this.doSearch()
  260. },
  261. showSearch() {
  262. this.searchShow = true
  263. },
  264. doSearch() {
  265. this.isEnd = false;
  266. this.page = 1;
  267. this.getList();
  268. },
  269. confirmSearch(e) {
  270. console.log(e);
  271. let data = JSON.parse(JSON.stringify(e))
  272. this.searchForm = data
  273. this.doSearch()
  274. },
  275. jumpAdd() {
  276. if (!this.checkData.id) {
  277. this.$refs.uToast.show({
  278. type: "warning",
  279. message: "请选择一条工单数据",
  280. })
  281. return;
  282. }
  283. uni.$emit('updateWorkData', {
  284. data: this.checkData,
  285. })
  286. this.backAdd();
  287. }
  288. }
  289. }
  290. </script>
  291. <style scoped lang="scss">
  292. @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
  293. .mainBox {
  294. height: 100vh;
  295. display: flex;
  296. flex-direction: column;
  297. .wrapper {
  298. // flex: 1;
  299. height: calc(100vh - 196rpx);
  300. overflow: hidden;
  301. }
  302. }
  303. .top-wrapper {
  304. background-color: #fff;
  305. display: flex;
  306. width: 750rpx;
  307. height: 88rpx;
  308. padding: 16rpx 32rpx;
  309. align-items: center;
  310. gap: 16rpx;
  311. /deep/.uni-section {
  312. margin-top: 0px;
  313. }
  314. /deep/.uni-section-header {
  315. padding: 0px;
  316. }
  317. .search_btn {
  318. width: 120rpx;
  319. height: 70rpx;
  320. line-height: 70rpx;
  321. padding: 0 24rpx;
  322. background: $theme-color;
  323. font-size: 32rpx;
  324. color: #fff;
  325. margin: 0;
  326. margin-left: 26rpx;
  327. }
  328. .menu_icon {
  329. width: 44rpx;
  330. height: 44rpx;
  331. margin-left: 14rpx;
  332. }
  333. }
  334. //底部按钮
  335. .footer {
  336. height: 45px;
  337. position: relative;
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. bottom: 0;
  342. width: 100%;
  343. height: 50px;
  344. border-top: 1px solid #eeecec;
  345. background-color: #ffffff;
  346. z-index: 999;
  347. .bottom {
  348. margin-left: 10rpx;
  349. }
  350. .u-reset-button {
  351. position: absolute;
  352. right: 10rpx;
  353. top: 20rpx;
  354. width: 150rpx;
  355. }
  356. }
  357. .listBox {
  358. display: flex;
  359. padding: 10px 0;
  360. border-bottom: 1px solid #e5e5e5;
  361. }
  362. .listBox-con {
  363. width: 100%;
  364. display: flex;
  365. flex-wrap: wrap;
  366. justify-content: space-between;
  367. align-items: center;
  368. padding: 0 9px 0 0;
  369. }
  370. .listBox-sel {
  371. height: 45px;
  372. width: 40px;
  373. text-align: center;
  374. }
  375. </style>