index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="生产工单"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <view class="tab-title">
  12. <view
  13. v-for="(item, index) in tabList"
  14. :key="index"
  15. class="tab-item"
  16. v-text="item.label"
  17. :class="index === pickTabIndex ? 'active' : ''"
  18. @click="changeChartsTab(index)"
  19. ></view>
  20. <view class="search-icon" @click="searchVisible = true">
  21. 筛选
  22. <image src="~@/static/filter.svg" mode=""></image>
  23. </view>
  24. </view>
  25. <view class="tab-title__placeholder"> </view>
  26. <card :list="tableList"></card>
  27. <!-- 搜索组件 -->
  28. <u-popup
  29. :show="searchVisible"
  30. mode="right"
  31. @close="searchVisible = false"
  32. @open="openSearch"
  33. >
  34. <view class="search-container">
  35. <view class="title">工单筛选</view>
  36. <uni-forms
  37. ref="customForm"
  38. :modelValue="popupInfo"
  39. label-position="top"
  40. >
  41. <!-- <uni-forms-item label="生产版本" name="createTime" label-width="200rpx">
  42. <view class="version-wrapper">
  43. <checkbox-group @change="checkboxChange" class="version-group">
  44. <label class="wrapper-label" v-for="item in items" :key="item.value"
  45. :style="item.checked?'background:#157a2c;color:#fff':''"
  46. >
  47. <view>
  48. <checkbox :value="item.value" :checked="item.checked" style="display: none;"/>
  49. </view>
  50. <view>{{item.name}}</view>
  51. </label>
  52. </checkbox-group>
  53. </view>
  54. </uni-forms-item> -->
  55. <uni-forms-item label="创建时间" name="createTime" label-width="500rpx">
  56. <uni-datetime-picker type="date" v-model="popupInfo.createTimeStart" @change="confirmStart">
  57. <div class="picker-time"> {{showStart}} </div>
  58. </uni-datetime-picker>
  59. <uni-datetime-picker type="date" v-model="popupInfo.createTimeEnd"@change="confirmEnd">
  60. <div class="picker-time"> {{showEnd}} </div>
  61. </uni-datetime-picker>
  62. </uni-forms-item>
  63. <uni-forms-item label="计划开始时间" name="planTime" label-width="500rpx">
  64. <uni-datetime-picker type="date" v-model="popupInfo.planStartTimeStart" @change="confirmPlanStart">
  65. <div class="picker-time"> {{planStart}} </div>
  66. </uni-datetime-picker>
  67. <uni-datetime-picker type="date" v-model="popupInfo.planStartTimeEnd"@change="confirmPlanEnd">
  68. <div class="picker-time"> {{planEnd}} </div>
  69. </uni-datetime-picker>
  70. </uni-forms-item>
  71. </uni-forms>
  72. <view class="footer">
  73. <view class="btn reset" @click="handleReset"> 重置 </view>
  74. <view class="btn search" @click="handleSearch"> 搜索 </view>
  75. </view>
  76. </view>
  77. </u-popup>
  78. </view>
  79. </template>
  80. <script>
  81. import { get, getJ, post, postJ } from '@/utils/api.js'
  82. import card from './components/card.vue'
  83. let [page, size, isEnd] = [1, 10, false]
  84. import { getListByStatus } from "@/api/production/order.js";
  85. export default {
  86. components: {
  87. card
  88. },
  89. data () {
  90. return {
  91. searchVisible: false,
  92. tabList: [
  93. {
  94. value: '4',
  95. label: '待生产'
  96. },
  97. {
  98. value: '5',
  99. label: '生产中'
  100. },
  101. {
  102. value: '6',
  103. label: '已完成'
  104. }
  105. ],
  106. statusList: [
  107. { code: '4', label: '待生产' },
  108. { code: '5', label: '生产中' },
  109. { code: '6', label: '已完成' }
  110. ],
  111. pickTabIndex: 0,
  112. popupInfo: {
  113. createTimeStart:'',
  114. createTimeEnd:'',
  115. planStartTimeStart:'',
  116. planStartTimeEnd:''
  117. }, //筛选数据
  118. showStart:'起始日期:',
  119. showEnd:'结束日期:',
  120. planStart:'起始日期:',
  121. planEnd:'结束日期:',
  122. tableList: [],
  123. // warehouseList: [],
  124. items: [
  125. {
  126. value: '挤压',
  127. name: '挤压'
  128. },
  129. {
  130. value: '模压',
  131. name: '模压',
  132. checked: 'true'
  133. },
  134. {
  135. value: '等静压',
  136. name: '等静压'
  137. }
  138. ]
  139. }
  140. },
  141. onShow () {
  142. // this._getWarehouseChildren()
  143. // this.getFirstList()
  144. },
  145. //触底加载
  146. onReachBottom: function () {
  147. // if (isEnd) {
  148. // uni.showToast({
  149. // title: '已经没有更多数据了!',
  150. // icon: 'none',
  151. // duration: 1000 //提示持续时间
  152. // })
  153. // return
  154. // }
  155. // // 显示加载图标
  156. // uni.showLoading({
  157. // title: '数据加载中'
  158. // })
  159. // this.getMoreLists()
  160. },
  161. methods: {
  162. confirmStart (e) {
  163. this.popupInfo.createTimeStart = e
  164. this.showStart = '起始日期:'+ e
  165. },
  166. confirmEnd (e) {
  167. this.popupInfo.createTimeEnd = e
  168. this.showEnd ='结束日期:'+ e
  169. },
  170. confirmPlanStart (e) {
  171. this.popupInfo.planStartTimeStart = e
  172. this.planStart = '起始日期:'+ e
  173. },
  174. confirmPlanEnd (e) {
  175. this.popupInfo.planStartTimeEnd = e
  176. this.planEnd = '结束日期:'+ e
  177. },
  178. checkboxChange: function (e) {
  179. var items = this.items,
  180. values = e.detail.value;
  181. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  182. const item = items[i]
  183. if(values.includes(item.value)){
  184. this.$set(item,'checked',true)
  185. }else{
  186. this.$set(item,'checked',false)
  187. }
  188. }
  189. },
  190. addAllocation () {
  191. uni.navigateTo({
  192. url: '/pages/warehouse/inventoryAllocation/edit'
  193. })
  194. },
  195. handleReset () {
  196. this.popupInfo = {
  197. createTimeStart:'',
  198. createTimeEnd:'',
  199. planStartTimeStart:'',
  200. planStartTimeEnd:''
  201. }
  202. this.tableList = []
  203. this.getFirstList()
  204. },
  205. handleSearch () {
  206. this.getFirstList()
  207. },
  208. // 搜索弹窗
  209. openSearch () {
  210. // console.log('open');
  211. },
  212. getFirstList () {
  213. page = 1
  214. this.searchVisible = false
  215. isEnd = true
  216. uni.showLoading({
  217. title: '数据加载中'
  218. })
  219. this.getList()
  220. },
  221. getMoreLists () {
  222. //获取更多数据
  223. page++
  224. this.getList()
  225. },
  226. //获取列表信息
  227. getList () {
  228. uni.showLoading({
  229. title: '加载中'
  230. })
  231. const list = []
  232. list.push(this.tabList[this.pickTabIndex].value)
  233. let data = {
  234. pageNum:page,
  235. size,
  236. ...this.popupInfo,
  237. statusList: list
  238. }
  239. if (data.range?.length) {
  240. data.createTimeStart = data.range[0]
  241. data.createTimeEnd = data.range[1]
  242. }
  243. delete data.range
  244. getListByStatus(data).then(res=>{
  245. if (page === 1) {
  246. this.tableList = res.data.list
  247. } else {
  248. this.tableList.push(...res.data.list)
  249. }
  250. isEnd = this.tableList.length >= res.data.count
  251. }).then(()=>{
  252. uni.hideLoading()
  253. })
  254. },
  255. //切换tab
  256. changeChartsTab (index) {
  257. this.pickTabIndex = index
  258. this.handleSearch()
  259. },
  260. //查看详情
  261. viewDetails (id, code) {
  262. uni.navigateTo({
  263. url: '/pages/warehouse/enterHouse/details?id=' + id + '&code=' + code
  264. })
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="scss" scoped>
  270. .mainBox {
  271. padding-bottom: 120rpx;
  272. }
  273. .search-container {
  274. width: 70vw;
  275. padding: 30rpx 36rpx;
  276. .footer {
  277. position: absolute;
  278. bottom: 0;
  279. left: 0;
  280. width: 100%;
  281. display: flex;
  282. box-shadow: 0 10rpx 30rpx 0 #000;
  283. .btn {
  284. width: 50%;
  285. height: 80rpx;
  286. border-radius: 0 !important;
  287. flex: 1;
  288. display: flex;
  289. justify-content: center;
  290. align-items: center;
  291. &.reset {
  292. color: $j-primary-border-green;
  293. }
  294. &.search {
  295. color: #fff;
  296. background-color: $j-primary-border-green;
  297. }
  298. }
  299. }
  300. .title {
  301. font-weight: bold;
  302. font-size: 30rpx;
  303. margin-bottom: 20rpx;
  304. }
  305. .status-wrapper {
  306. display: flex;
  307. align-items: center;
  308. justify-content: space-between;
  309. view {
  310. background-color: rgba(242, 242, 242, 1);
  311. height: 60rpx;
  312. border-radius: 30rpx;
  313. line-height: 60rpx;
  314. text-align: center;
  315. width: 160rpx;
  316. border: 1rpx solid rgba(242, 242, 242, 1);
  317. &.active {
  318. color: #157a2c;
  319. border-color: rgba(21, 122, 44, 1);
  320. }
  321. }
  322. }
  323. /deep/.uni-date {
  324. .uni-icons {
  325. display: none;
  326. }
  327. .uni-date-x {
  328. padding: 0;
  329. view {
  330. margin: 0 20rpx;
  331. }
  332. }
  333. }
  334. /deep/.uni-date__x-input,
  335. /deep/.uni-easyinput__content-input {
  336. height: 60rpx;
  337. border-radius: 30rpx;
  338. overflow: hidden;
  339. background-color: rgba(242, 242, 242, 1);
  340. }
  341. .version-group{
  342. display: flex;
  343. align-items: center;
  344. justify-content: flex-start;
  345. flex-wrap: wrap;
  346. }
  347. .wrapper-label{
  348. height: 50rpx;
  349. padding: 0 20rpx;
  350. border: 1rpx solid #ccc;
  351. display: flex;
  352. align-items: center;
  353. justify-content: center;
  354. font-size: 24rpx;
  355. margin: 0 20rpx 20rpx 0;
  356. }
  357. .picker-time{
  358. width: 100%;
  359. height: 60rpx;
  360. line-height: 60rpx;
  361. border: 1rpx solid #ccc;
  362. margin-bottom: 20rpx;
  363. text-indent: 10rpx;
  364. border-radius: 4rpx;
  365. }
  366. }
  367. .tab-title {
  368. position: fixed;
  369. z-index: 99;
  370. width: 100%;
  371. display: flex;
  372. justify-content: space-between;
  373. align-items: center;
  374. height: $tab-height;
  375. line-height: $tab-height;
  376. background-color: #ffffff;
  377. border-bottom: 1px solid #f2f2f2;
  378. box-sizing: border-box;
  379. .search-icon {
  380. display: flex;
  381. align-items: center;
  382. justify-content: space-around;
  383. font-size: 28rpx;
  384. white-space: nowrap;
  385. margin-left: 10rpx;
  386. image {
  387. width: 34rpx;
  388. height: 34rpx;
  389. }
  390. }
  391. .tab-item {
  392. width: 25%;
  393. text-align: center;
  394. font-size: 32rpx;
  395. color: $uni-text-color-grey;
  396. }
  397. .tab-item.active {
  398. color: $j-primary-border-green;
  399. border-bottom: 1px solid $j-primary-border-green;
  400. font-weight: bold;
  401. }
  402. .tab-item.filter {
  403. flex: 1;
  404. padding: 0px 30rpx;
  405. .uni-icons {
  406. display: flex;
  407. padding-top: 5px;
  408. }
  409. }
  410. }
  411. .listBox {
  412. margin-top: 10px;
  413. padding-top: 5px;
  414. padding-bottom: 8px;
  415. .listTit {
  416. display: flex;
  417. align-items: center;
  418. .stuts {
  419. width: 55px;
  420. font-size: 12px;
  421. // border: 1px solid red;
  422. }
  423. .name {
  424. font-size: $uni-font-size-base;
  425. padding-left: 15rpx;
  426. }
  427. .date {
  428. font-size: $uni-font-size-sm;
  429. padding-left: 45rpx;
  430. color: #999;
  431. }
  432. }
  433. .listCont {
  434. display: flex;
  435. align-items: center;
  436. flex-wrap: wrap;
  437. padding-left: 20rpx;
  438. flex-direction: row;
  439. margin-top: 10rpx;
  440. color: #666;
  441. // border: 1px solid red;
  442. .item {
  443. width: 50%;
  444. font-size: $uni-font-size-sm;
  445. overflow: hidden;
  446. white-space: nowrap;
  447. text-overflow: ellipsis;
  448. -o-text-overflow: ellipsis;
  449. }
  450. .item text {
  451. color: #666;
  452. }
  453. .item-left {
  454. font-size: 20px;
  455. font-weight: 600;
  456. color: #999;
  457. position: relative;
  458. left: 90%;
  459. top: -55rpx;
  460. }
  461. }
  462. .item-top {
  463. height: 5rpx;
  464. width: 96%;
  465. margin: 0 auto;
  466. border-bottom: 1px solid #d8d3d3;
  467. }
  468. .listbtn {
  469. margin-top: 20rpx;
  470. display: flex;
  471. justify-content: flex-end;
  472. align-items: center;
  473. .operBox {
  474. display: flex;
  475. align-items: center;
  476. }
  477. }
  478. .listbtn button {
  479. margin-right: 20rpx;
  480. }
  481. }
  482. </style>