index.vue 19 KB

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