index.vue 16 KB

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