index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="副产品回收"
  8. background-color="#157A2C"
  9. color="#fff"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <view class="top-wrapper">
  13. <view class="searchBox rx-bc">
  14. <zxz-uni-data-select :localdata="taskList" v-model="formData.taskId" dataValue='id' format='{name}'
  15. dataKey="name" filterable placeholder="请选择工序" @change="doSearch"></zxz-uni-data-select>
  16. <u-button @click="doSearch" type="success" size="small" class="u-reset-button" text="搜索">
  17. </u-button>
  18. </view>
  19. </view>
  20. <view class="list_box">
  21. <u-list @scrolltolower="scrolltolower">
  22. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  23. <label class="listBox rx-bs">
  24. <view class="listBox-sel">
  25. <checkbox
  26. v-if='item.rootCategoryLevelId != 11 || (item.rootCategoryLevelId == 11 && item.status != 1)'
  27. :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" />
  28. </view>
  29. <view class="listBox-con">
  30. <view class="listBox-top rx-bc">
  31. <view>工单编号:</view>
  32. <view class="code">{{ item.code}}</view>
  33. </view>
  34. <view class="listBox-bottom rx">
  35. <view class="items">
  36. <text>工艺路线</text>{{ item.produceRoutingName }}
  37. </view>
  38. <view class="items">
  39. <text>名称</text>{{ item.productName }}
  40. </view>
  41. <view class="items">
  42. <text>生产数量</text>{{ item.formingNum }}{{item.unit}}
  43. </view>
  44. <view class="items">
  45. <text>生产重量</text>{{item.formingWeight}} {{item.weightUnit}}
  46. </view>
  47. </view>
  48. </view>
  49. </label>
  50. </checkbox-group>
  51. <view v-if='list.length == 0' style='margin-top: 20vh;'>
  52. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  53. </u-empty>
  54. </view>
  55. </u-list>
  56. </view>
  57. <view class="bottom-wrapper rx-bc">
  58. <view>
  59. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  60. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  61. </checkbox>
  62. </view>
  63. <view>
  64. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen"
  65. @click="handleSelect">
  66. <view> 选择( {{ checkListLen }} ) </view>
  67. </u-button>
  68. </view>
  69. </view>
  70. <SearchPopup mode="center" v-if='searchShow'>
  71. <template v-slot:list>
  72. <u-list @scrolltolower="scrolltolower" class="wl_list">
  73. <view class="recycleTitle">副产品列表</view>
  74. <view class="pop_list" v-for="(item, index) in memoList" :key="index">
  75. <view class="work_box rx-bc">
  76. <view>工单编号:</view>
  77. <view class="code">{{item.code}}</view>
  78. </view>
  79. <view class="recycleList rx" v-for="(it,idx) in item.recycleList" :key="'RECY' + idx">
  80. <view class="items">
  81. <text>副产品{{idx+1}}</text>{{ it.categoryName }}
  82. </view>
  83. <view class="items">
  84. <text>编号</text>{{ it.categoryCode }}
  85. </view>
  86. </view>
  87. </view>
  88. <view class="recycleTitle mt40">副产品处置</view>
  89. <view class="content_table" v-for="(item, index) in recyclell" :key="'ll' +index">
  90. <view class="item rx-sc">
  91. <view class="rx ww55 ">
  92. <view class="lable rx-cc">副产品</view>
  93. <view class="content ">{{item.categoryName}}</view>
  94. </view>
  95. <view class="rx ww45">
  96. <view class="lable rx-cc ww80">编号</view>
  97. <view class="content ">
  98. {{item.categoryCode}}
  99. </view>
  100. </view>
  101. </view>
  102. <view class="item rx-sc">
  103. <view class="rx ww55 ">
  104. <view class="lable rx-cc">处置</view>
  105. <view class="content content_num">
  106. <zxz-uni-data-select :localdata="warehouseList" v-model="item.warehouseId"
  107. dataValue='id' format='{name}' dataKey="name" filterable
  108. :clear='false'></zxz-uni-data-select>
  109. </view>
  110. </view>
  111. <view class="rx ww45">
  112. <view class="lable rx-cc ww80">数量</view>
  113. <view class="content content_num">
  114. <input class="uni-input" v-model="item.quantity" type="digit"></input>
  115. <view class="unit">{{item.weightUnit}}</view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </u-list>
  121. </template>
  122. <template v-slot:operate>
  123. <view class="operate_box rx-bc">
  124. <u-button size="small" class="u-reset-button" @click="searchCancel">
  125. 取消
  126. </u-button>
  127. <u-button type="success" size="small" class="u-reset-button" @click="handSave">
  128. 确定
  129. </u-button>
  130. </view>
  131. </template>
  132. </SearchPopup>
  133. </view>
  134. </template>
  135. <script>
  136. import {
  137. tableHeader
  138. } from '../../common.js'
  139. import {
  140. treeByPid,
  141. listWorkOrderByTaskId,
  142. getWarehouseList,
  143. disposeorder
  144. } from '@/api/pda/workOrder.js'
  145. import { getPage } from '@/api/pda/byProductRecovery.js'
  146. import {
  147. producetaskList
  148. } from '@/api/common.js'
  149. import SearchPopup from '../../components/searchPopup.vue'
  150. let [isEnd] = [false]
  151. export default {
  152. components: {
  153. SearchPopup
  154. },
  155. data() {
  156. return {
  157. list: [],
  158. page: 1,
  159. seletedAll: false, //全选状态
  160. memoList: [],
  161. recyclell: [],
  162. formData: {
  163. taskId: '',
  164. },
  165. taskList: [],
  166. warehouseList: [],
  167. searchShow: false,
  168. }
  169. },
  170. //选择的列表长度
  171. computed: {
  172. checkListLen() {
  173. return this.memoList.length
  174. }
  175. },
  176. onLoad(option) {
  177. this.getProducetask()
  178. this.getWarehouseFn()
  179. this.getList()
  180. },
  181. onUnload() {
  182. },
  183. methods: {
  184. _seletedAll() {
  185. if (!this.seletedAll) {
  186. this.seletedAll = true
  187. this.list.map(item => {
  188. this.$set(item, 'checked', true)
  189. const idx = this.memoList.findIndex(itm => itm.id === item.id)
  190. if (idx === -1) {
  191. this.memoList.push(item)
  192. }
  193. })
  194. } else {
  195. this.seletedAll = false
  196. this.list.map(item => {
  197. this.$set(item, 'checked', false)
  198. const idx = this.memoList.findIndex(itm => itm.id === item.id)
  199. if (idx > -1) {
  200. this.memoList.splice(idx, 1)
  201. }
  202. })
  203. }
  204. },
  205. doSearch() {
  206. this.list = []
  207. this.getList()
  208. },
  209. scrolltolower() {
  210. if (isEnd) return
  211. this.page++
  212. this.getList()
  213. },
  214. async getList() {
  215. let param = {
  216. pageNum: this.page,
  217. size: 10,
  218. taskId: this.formData.taskId,
  219. }
  220. await getPage(param).then(res => {
  221. this.list = res.list
  222. })
  223. // listWorkOrderByTaskId(param).then(res => {
  224. // this.list = res.list
  225. // })
  226. },
  227. //勾选
  228. selectVal(e, val, index) {
  229. console.log(val)
  230. if (val.rootCategoryLevelId == 11 && val.status == 1) {
  231. return false
  232. }
  233. this.list[index].checked = !this.list[index].checked
  234. this.seletedAll = !this.list.some(item => !item.checked)
  235. const idx = this.memoList.findIndex(
  236. item => item.id === this.list[index].id
  237. )
  238. if (this.list[index].checked) {
  239. if (idx === -1) {
  240. this.memoList.push(this.list[index])
  241. }
  242. } else {
  243. if (idx > -1) {
  244. this.memoList.splice(idx, 1)
  245. }
  246. }
  247. },
  248. searchCancel() {
  249. this.list = []
  250. this.page = 1
  251. this.getList()
  252. this.searchShow = false
  253. },
  254. handleSelect() {
  255. let arr = []
  256. this.recyclell = []
  257. this.memoList.forEach(e => {
  258. e.recycleList.forEach(f => {
  259. arr.push(f)
  260. })
  261. })
  262. this.recyclell = Array.from(new Set(arr.map(item => JSON.stringify(item)))).map(item => JSON.parse(item))
  263. this.searchShow = true
  264. },
  265. handSave() {
  266. let param = {
  267. taskId: this.formData.taskId,
  268. recyclell: this.recyclell,
  269. memoList: this.memoList
  270. }
  271. disposeorder(param).then(res => {
  272. console.log(res)
  273. this.searchShow = false
  274. })
  275. },
  276. async getProducetask() {
  277. await producetaskList().then(res => {
  278. this.taskList = res
  279. })
  280. },
  281. async getWarehouseFn() {
  282. await getWarehouseList().then(res => {
  283. this.warehouseList = res
  284. })
  285. },
  286. }
  287. }
  288. </script>
  289. <style lang="scss" scoped>
  290. .content-box {
  291. height: 100vh;
  292. overflow: hidden;
  293. display: flex;
  294. flex-direction: column;
  295. background-color: $page-bg;
  296. }
  297. .searchBox {
  298. background-color: #dedede;
  299. height: 90rpx;
  300. padding: 0 20rpx;
  301. .mt20 {
  302. margin-top: 20rpx;
  303. }
  304. /deep/ .uni-select {
  305. height: 70rpx;
  306. width: 520rpx;
  307. background: #fff !important;
  308. padding-left: 10rpx;
  309. border-radius: 5rpx;
  310. margin-right: 20rpx;
  311. }
  312. }
  313. .list_box {
  314. flex: 1;
  315. overflow: hidden;
  316. padding: 6rpx 0;
  317. .u-list {
  318. height: 100% !important;
  319. }
  320. }
  321. .bottom-wrapper {
  322. height: 80rpx;
  323. background: #fff;
  324. padding: 0 32rpx;
  325. /deep/ .uni-checkbox-input-checked {
  326. background-color: $theme-color !important;
  327. border-color: $theme-color !important;
  328. }
  329. }
  330. .listBox {
  331. margin-top: 8rpx;
  332. padding: 8rpx 24rpx;
  333. background: #fff;
  334. /deep/ .uni-checkbox-input-checked {
  335. background-color: $theme-color !important;
  336. border-color: $theme-color !important;
  337. }
  338. .listBox-con {
  339. width: 650rpx;
  340. font-weight: 400;
  341. }
  342. .listBox-top {
  343. margin-top: 6rpx;
  344. color: #090A0A;
  345. font-size: 28rpx;
  346. font-style: normal;
  347. font-weight: 800;
  348. }
  349. }
  350. .listBox-bottom,
  351. .recycleList {
  352. color: #090A0A;
  353. font-size: 24rpx;
  354. font-style: normal;
  355. flex-wrap: wrap;
  356. .items {
  357. width: calc(50% - 1px);
  358. border-left: 1rpx solid #E3E5E5;
  359. border-right: 1rpx solid #E3E5E5;
  360. border-bottom: 1rpx solid #E3E5E5;
  361. box-sizing: border-box;
  362. word-break: break-all;
  363. text {
  364. display: inline-block;
  365. background: #F7F9FA;
  366. padding: 8rpx 10rpx;
  367. color: #157A2C;
  368. }
  369. &:nth-child(1),
  370. &:nth-child(2) {
  371. border-top: 1rpx solid #E3E5E5;
  372. margin-top: 8rpx;
  373. }
  374. }
  375. }
  376. .wl_list {
  377. width: 720rpx;
  378. max-height: 75vh;
  379. .operate_box {
  380. margin: 20rpx;
  381. }
  382. .recycleTitle {
  383. margin-top: 12rpx;
  384. font-size: 28rpx;
  385. line-height: 24rpx;
  386. border-left: 6rpx solid #157A2C;
  387. padding-left: 16rpx;
  388. color: #157A2C;
  389. margin-left: 16rpx;
  390. }
  391. .mt40 {
  392. margin-top: 40rpx;
  393. }
  394. .pop_list {
  395. padding: 12rpx 16rpx;
  396. border-bottom: 2rpx solid #157A2C;
  397. .work_box {
  398. color: #090A0A;
  399. font-size: 28rpx;
  400. font-style: normal;
  401. font-weight: 800;
  402. }
  403. .recycleList {
  404. .lable {
  405. width: 32rpx;
  406. height: 32rpx;
  407. line-height: 32rpx;
  408. text-align: center;
  409. border-radius: 50%;
  410. background: #157A2C;
  411. font-size: 20rpx;
  412. color: #fff;
  413. margin-right: 40rpx;
  414. }
  415. }
  416. .it_name {
  417. width: 350rpx;
  418. font-size: 24rpx;
  419. }
  420. .it_code {
  421. font-size: 24rpx;
  422. }
  423. }
  424. }
  425. .content_table {
  426. width: 700rpx;
  427. margin: auto;
  428. margin-top: 20rpx;
  429. border: 2rpx solid $border-color;
  430. .item {
  431. display: flex;
  432. border-bottom: 2rpx solid $border-color;
  433. .lable {
  434. width: 100rpx;
  435. text-align: center;
  436. background-color: #F7F9FA;
  437. font-size: 22rpx;
  438. border-right: 2rpx solid $border-color;
  439. flex-shrink: 0;
  440. }
  441. .ww80 {
  442. width: 60rpx;
  443. }
  444. .content {
  445. width: 518rpx;
  446. min-height: 64rpx;
  447. font-size: 24rpx;
  448. line-height: 28rpx;
  449. font-style: normal;
  450. font-weight: 400;
  451. padding: 18rpx 8rpx;
  452. box-sizing: border-box;
  453. word-wrap: break-word;
  454. flex-grow: 1 !important;
  455. }
  456. .content_num {
  457. display: flex;
  458. align-items: center;
  459. padding: 0 4rpx;
  460. /deep/ .uni-input-input {
  461. border: 2rpx solid #F0F8F2;
  462. background: #F0F8F2;
  463. color: $theme-color;
  464. }
  465. .unit {
  466. width: 90rpx;
  467. text-align: center;
  468. font-size: 24rpx;
  469. color: #404446;
  470. }
  471. }
  472. .pd4 {
  473. padding: 4rpx 8rpx;
  474. }
  475. &:last-child {
  476. border-bottom: none;
  477. }
  478. }
  479. .ww55 {
  480. width: 55%;
  481. }
  482. .ww45 {
  483. width: 45%;
  484. }
  485. }
  486. </style>