outsourceList.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. <template>
  2. <view>
  3. <!-- 委外下一步 -->
  4. <u-popup :show="show" :mode="mode" :closeOnClickOverlay="false">
  5. <view class="card_box">
  6. <view class="item_box rx-bc">
  7. <view class="item_one rx-sc">
  8. <view class="lable">委外名称:</view>
  9. <view style="color: #157a2c">{{ outObj.name }}</view>
  10. </view>
  11. </view>
  12. <view class="item_box rx-bc">
  13. <view class="item_one perce50 rx-sc">
  14. <view class="lable">委外类型:</view>
  15. <view style="color: #157a2c">{{
  16. outObj.type == 4 ? "带料委外" : "无料委外"
  17. }}</view>
  18. </view>
  19. <view class="item_one perce50 rx-sc">
  20. <view class="lable">直接入库:</view>
  21. <view style="color: #157a2c">{{
  22. outObj.isInWarehouse == 1 ? "是" : "否"
  23. }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <u-tabs
  28. :list="tabList"
  29. @click="handTab"
  30. lineWidth="30"
  31. lineColor="#157A2C"
  32. :activeStyle="{
  33. color: '#157A2C',
  34. }"
  35. :inactiveStyle="{
  36. color: '#303133',
  37. }"
  38. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
  39. >
  40. </u-tabs>
  41. <view class="box_list">
  42. <u-list @scrolltolower="scrolltolower" class="z_list">
  43. <view v-if="actTab == '物品清单'">
  44. <view
  45. class="rx-bc"
  46. v-if="outObj.isStraight != 1 && clientEnvironmentId != 2"
  47. >
  48. <view style="margin-left: 24rpx">
  49. <checkbox
  50. v-if="!seletedAll"
  51. color="#fff"
  52. :checked="seletedAll"
  53. @tap="_seletedAll"
  54. >全选
  55. </checkbox>
  56. <checkbox
  57. class="select-all"
  58. color="#fff"
  59. v-else
  60. :checked="seletedAll"
  61. @tap="_seletedAll"
  62. >
  63. 取消全选
  64. </checkbox>
  65. </view>
  66. <view
  67. >勾选:<text style="color: #157a2c"
  68. >{{ checkListLen || 0 }}个</text
  69. >
  70. </view>
  71. </view>
  72. <u-form
  73. labelPosition="left"
  74. :model="outObj"
  75. labelWidth="180"
  76. labelAlign="left"
  77. class=""
  78. v-if="checkListLen > 0 && clientEnvironmentId != 2"
  79. >
  80. <u-form-item label="收货仓库:" borderBottom prop="warehouseId">
  81. <zxz-uni-data-select
  82. :localdata="warehouseList"
  83. v-model="outObj.warehouseId"
  84. dataValue="id"
  85. dataKey="name"
  86. filterable
  87. format="{name}"
  88. ></zxz-uni-data-select>
  89. </u-form-item>
  90. </u-form>
  91. <checkbox-group
  92. v-for="(item, index) in pickOutInList"
  93. :key="index"
  94. @change="(e) => selectVal(e, item, index)"
  95. >
  96. <label class="listBox rx-bs">
  97. <view class="listBox-sel">
  98. <checkbox
  99. v-if="
  100. (item.rootCategoryLevelId != 11 ||
  101. (item.rootCategoryLevelId == 11 && item.status != 1)) &&
  102. clientEnvironmentId != 2
  103. "
  104. :value="item.code"
  105. color="#fff"
  106. :disabled="outObj.isStraight == 1"
  107. :checked="item.checked"
  108. />
  109. </view>
  110. <view class="listBox-con">
  111. <view class="listBox-top rx-bc">
  112. <view> {{ item.name }}</view>
  113. <view class="code">
  114. {{
  115. item.rootCategoryLevelId == 4
  116. ? item.codeNumber
  117. : item.code
  118. }}
  119. </view>
  120. </view>
  121. <view class="listBox-bottom rx">
  122. <view
  123. v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
  124. :key="index"
  125. class="items"
  126. v-if="!itm.formatter"
  127. >
  128. <text>{{ itm.label }}</text
  129. >{{ item[itm.prop] }}
  130. </view>
  131. <view
  132. class="items"
  133. v-if="
  134. item.rootCategoryLevelId == 1 &&
  135. item.isConsumable == 1 &&
  136. item.rootCategoryLevelId != 11 &&
  137. item.rootCategoryLevelId != 4
  138. "
  139. >
  140. <text>可用库存</text>{{ item.availableCountBase }}
  141. {{ item.unit }}
  142. </view>
  143. <view
  144. class="items"
  145. v-if="
  146. [1, 2, 9, 23].includes(
  147. Number(item.rootCategoryLevelId)
  148. ) && item.isConsumable == 0
  149. "
  150. >
  151. <text>刻码</text>{{ item.extInfo.engrave }}
  152. </view>
  153. <view
  154. class="items"
  155. v-if="
  156. [1, 2, 9, 23].includes(
  157. Number(item.rootCategoryLevelId)
  158. ) && item.isConsumable == 0
  159. "
  160. >
  161. <text>物料代号</text>{{ item.extInfo.materielCode }}
  162. </view>
  163. <view
  164. class="items"
  165. v-if="
  166. [1, 2, 9, 23].includes(
  167. Number(item.rootCategoryLevelId)
  168. ) && item.isConsumable == 0
  169. "
  170. >
  171. <text>客户代号</text>{{ item.extInfo.clientCode }}
  172. </view>
  173. <view
  174. class="items"
  175. v-if="
  176. [1, 2, 9, 23].includes(
  177. Number(item.rootCategoryLevelId)
  178. ) && item.isConsumable == 0
  179. "
  180. >
  181. <text>重量</text>{{ item.extInfo.newWeight }}
  182. {{ item.extInfo.weightUnit }}
  183. </view>
  184. <view
  185. class="items"
  186. v-if="
  187. [1, 2, 9, 23].includes(
  188. Number(item.rootCategoryLevelId)
  189. ) && item.isConsumable == 1
  190. "
  191. >
  192. <text>数量</text>{{ item.feedQuantity }}
  193. </view>
  194. <view
  195. class="items"
  196. v-if="
  197. [1, 2, 9, 23].includes(
  198. Number(item.rootCategoryLevelId)
  199. ) && item.isConsumable == 1
  200. "
  201. >
  202. <text>重量</text>{{ item.weight || 0 }}
  203. {{ item.weightUnit }}
  204. </view>
  205. <view
  206. class="items"
  207. v-if="
  208. [1, 2, 9, 23].includes(
  209. Number(item.rootCategoryLevelId)
  210. ) && item.isConsumable == 1
  211. "
  212. >
  213. <text>规格</text> {{ item.specification }}
  214. </view>
  215. <view
  216. class="items"
  217. v-if="
  218. [1, 2, 9, 23].includes(
  219. Number(item.rootCategoryLevelId)
  220. ) && item.isConsumable == 1
  221. "
  222. >
  223. <text>型号</text> {{ item.modelType }}
  224. </view>
  225. </view>
  226. </view>
  227. </label>
  228. </checkbox-group>
  229. </view>
  230. <view v-if="actTab == '带料清单'">
  231. <view class="title_box rx-bc">
  232. <view></view>
  233. <view class="right_box rx-ec">
  234. <u-button
  235. type="success"
  236. size="small"
  237. class="u-reset-button"
  238. @click="addPicking(2)"
  239. text="添加"
  240. ></u-button>
  241. </view>
  242. </view>
  243. <view v-for="(item, index) in bomMaterialList" :key="index">
  244. <label class="listBox rx-bs">
  245. <view class="listBox-sel">
  246. <view class="round">{{ index + 1 }}</view>
  247. </view>
  248. <view class="listBox-con">
  249. <view class="listBox-bottom rx">
  250. <view class="items">
  251. <text>名称</text>{{ item.name }}
  252. </view>
  253. <view class="items">
  254. <text>编码</text>{{ item.code }}
  255. </view>
  256. <view
  257. v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
  258. :key="index"
  259. class="items"
  260. v-if="!itm.formatter"
  261. >
  262. <text>{{ itm.label }}</text
  263. >{{ item[itm.prop] }}
  264. </view>
  265. <view
  266. class="items"
  267. v-if="item.isDemandQuantity && clientEnvironmentId != 2"
  268. >
  269. <text>数量</text
  270. >{{
  271. checkListLen == 0
  272. ? item.demandQuantity
  273. : item.count * (checkListLen || 1)
  274. }}
  275. </view>
  276. <view
  277. class="items content_num"
  278. v-if="!item.isDemandQuantity && clientEnvironmentId != 2"
  279. >
  280. <text>数量</text>
  281. <input
  282. style="8px !important"
  283. v-model="item.demandQuantity"
  284. />
  285. </view>
  286. <view
  287. class="items"
  288. v-if="item.isDemandQuantity && clientEnvironmentId == 2"
  289. >
  290. <text>数量</text
  291. >{{ item.count * (outObj.formedNumLast || 1) }}
  292. </view>
  293. <view
  294. class="items content_num"
  295. v-if="!item.isDemandQuantity && clientEnvironmentId == 2"
  296. >
  297. <text>数量</text>
  298. <input
  299. style="8rpx !important"
  300. v-model="item.demandQuantity"
  301. />
  302. </view>
  303. </view>
  304. </view>
  305. </label>
  306. </view>
  307. </view>
  308. <view v-if="actTab == '产出清单'">
  309. <view class="title_box rx-bc">
  310. <view></view>
  311. <view class="right_box rx-ec">
  312. <u-button
  313. type="success"
  314. size="small"
  315. class="u-reset-button"
  316. @click="addPicking(3)"
  317. text="添加"
  318. ></u-button>
  319. </view>
  320. </view>
  321. <view v-for="(item, index) in standardOutputList" :key="index">
  322. <label class="listBox rx-bs">
  323. <view class="listBox-sel">
  324. <view class="round">{{ index + 1 }}</view>
  325. </view>
  326. <view class="listBox-con">
  327. <view class="listBox-bottom rx">
  328. <view class="items">
  329. <text>名称</text>{{ item.name }}
  330. </view>
  331. <view class="items">
  332. <text>编码</text>{{ item.code }}
  333. </view>
  334. <view
  335. v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
  336. :key="index"
  337. class="items"
  338. v-if="!itm.formatter"
  339. >
  340. <text>{{ itm.label }}</text
  341. >{{ item[itm.prop] }}
  342. </view>
  343. <view class="items content_num">
  344. <text>数量</text>
  345. <input
  346. style="8rpx !important"
  347. v-model="item.demandQuantity"
  348. />
  349. </view>
  350. </view>
  351. </view>
  352. </label>
  353. </view>
  354. </view>
  355. </u-list>
  356. <view class="operate_box rx-bc">
  357. <u-button size="small" class="u-reset-button" @click="close">
  358. 取消
  359. </u-button>
  360. <u-button
  361. type="success"
  362. size="small"
  363. class="u-reset-button"
  364. @click="handOK(0)"
  365. >
  366. 提交
  367. </u-button>
  368. <u-button
  369. type="success"
  370. size="small"
  371. class="u-reset-button"
  372. @click="handOK(1)"
  373. >
  374. 提交并发布
  375. </u-button>
  376. </view>
  377. </view>
  378. </u-popup>
  379. </view>
  380. </template>
  381. <script>
  382. import {
  383. checkOutsourceMaterial,
  384. applyoutsourceSave,
  385. getWarehouseList,
  386. } from "@/api/pda/workOrder.js";
  387. import { tableHeader } from "../common.js";
  388. import { EventBus } from "@/utils/eventBus.js";
  389. export default {
  390. data() {
  391. return {
  392. mode: "center",
  393. show: false,
  394. topHight: 20 || 20,
  395. outObj: {},
  396. tabList: [
  397. {
  398. name: "物品清单",
  399. },
  400. {
  401. name: "带料清单",
  402. },
  403. {
  404. name: "产出清单",
  405. },
  406. ],
  407. actTab: "物品清单",
  408. bomMaterialList: [],
  409. pickOutInList: [],
  410. materialList: [],
  411. standardOutputList: [],
  412. isFirstTask: null,
  413. clientEnvironmentId:
  414. uni.getStorageSync("userInfo") &&
  415. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  416. seletedAll: false, //全选状态
  417. checkListLen: 0,
  418. warehouseList: [],
  419. };
  420. },
  421. created() {
  422. EventBus.$on("outEvent", this.handleEvent);
  423. },
  424. computed: {},
  425. methods: {
  426. open(obj) {
  427. this.outObj = obj;
  428. (this.actTab = "物品清单"), this.outsourceMaterialFn();
  429. this.getWarehouseFn();
  430. this.show = true;
  431. },
  432. outsourceMaterialFn() {
  433. let param = {
  434. taskId: this.outObj.taskId,
  435. taskIds: this.outObj.taskIds,
  436. workOrderId: this.outObj.workOrderId,
  437. quantity: this.outObj.formedNumLast,
  438. };
  439. checkOutsourceMaterial(param).then((res) => {
  440. let _arr = [];
  441. _arr = [...res.pickOutInList, ...res.materialList];
  442. this.pickOutInList = _arr.reduce((acc, item) => {
  443. const existingItem = acc.find((existing) => existing.id === item.id);
  444. if (!existingItem) {
  445. acc.push(item);
  446. }
  447. return acc;
  448. }, []);
  449. this.bomMaterialList = res.bomMaterialList.map((m) => {
  450. return {
  451. ...m,
  452. isDemandQuantity: true,
  453. };
  454. });
  455. this.standardOutputList = res.standardOutputList;
  456. this.$forceUpdate();
  457. });
  458. },
  459. // 仓库
  460. getWarehouseFn() {
  461. getWarehouseList().then((res) => {
  462. this.warehouseList = res;
  463. });
  464. },
  465. handTab(item) {
  466. this.actTab = item.name;
  467. },
  468. close() {
  469. this.show = false;
  470. },
  471. handleEvent({ message }) {
  472. console.log(message, "message999999999999");
  473. if (message.pid == 3) {
  474. this.standardOutputList = [
  475. ...this.standardOutputList,
  476. ...message.memoList,
  477. ];
  478. } else {
  479. if (message.pid == 2) {
  480. this.bomMaterialList = message.memoList;
  481. // console.log(this.bomMaterialList,'1111111111');
  482. // return
  483. }
  484. }
  485. },
  486. tableH(type) {
  487. return tableHeader(type);
  488. },
  489. //勾选
  490. selectVal(e, val, index) {
  491. this.pickOutInList[index].checked = !this.pickOutInList[index].checked;
  492. this.checkListLen = this.pickOutInList.filter(
  493. (f) => f.checked == true
  494. ).length;
  495. },
  496. _seletedAll() {
  497. if (!this.seletedAll) {
  498. this.seletedAll = true;
  499. this.pickOutInList.map((item) => {
  500. this.$set(item, "checked", true);
  501. });
  502. } else {
  503. this.seletedAll = false;
  504. this.pickOutInList.map((item) => {
  505. this.$set(item, "checked", false);
  506. });
  507. }
  508. this.checkListLen = this.pickOutInList.filter(
  509. (f) => f.checked == true
  510. ).length;
  511. },
  512. scrolltolower() {},
  513. addPicking(id) {
  514. const storageKey = Date.now() + "";
  515. let arr = null;
  516. if (id == 3) {
  517. arr = [
  518. {
  519. standardOutputList: this.standardOutputList,
  520. },
  521. ];
  522. } else {
  523. arr = [
  524. {
  525. bomMaterialList: this.bomMaterialList,
  526. },
  527. ];
  528. }
  529. uni.setStorageSync(storageKey, arr);
  530. uni.navigateTo({
  531. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=weiwai&taskId=${this.outObj.taskId}&classIds=[1,23,9]`,
  532. });
  533. },
  534. handOK(isRelease) {
  535. if (this.checkListLen > 0 && !this.outObj.warehouseId) {
  536. uni.showToast({
  537. title: "请选择仓库",
  538. icon: "none",
  539. });
  540. return;
  541. }
  542. let _pickOutInList = [];
  543. if (this.clientEnvironmentId == 2) {
  544. _pickOutInList = this.pickOutInList;
  545. } else {
  546. _pickOutInList = this.pickOutInList.filter((f) => f.checked == true);
  547. }
  548. let param = {
  549. ...this.outObj,
  550. isRelease: isRelease,
  551. bomMaterialList: this.bomMaterialList,
  552. pickOutInList: _pickOutInList,
  553. materialList: this.materialList,
  554. standardOutputList: this.standardOutputList,
  555. };
  556. applyoutsourceSave(param).then((res) => {
  557. uni.showToast({
  558. title: "提交成功",
  559. icon: "none",
  560. });
  561. this.$emit("close", true);
  562. this.checkListLen = 0;
  563. this.close();
  564. });
  565. },
  566. },
  567. };
  568. </script>
  569. <style lang="scss" scoped>
  570. .z_list {
  571. max-height: 860rpx;
  572. padding: 10rpx;
  573. box-sizing: border-box;
  574. }
  575. .box_list {
  576. min-height: 100rpx;
  577. width: 96vw;
  578. /deep/ .baseForm {
  579. padding: 0 20rpx;
  580. }
  581. }
  582. .operate_box {
  583. padding: 10rpx 32rpx;
  584. /deep/ .u-button {
  585. width: 28%;
  586. }
  587. }
  588. /deep/ .u-tabs__wrapper__nav {
  589. background: #f5f5f5 !important;
  590. }
  591. .listBox {
  592. margin-top: 8rpx;
  593. padding: 8rpx 24rpx;
  594. background: #fff;
  595. /deep/ .uni-checkbox-input-checked {
  596. background-color: $theme-color !important;
  597. border-color: $theme-color !important;
  598. }
  599. .listBox-sel {
  600. margin-top: 10rpx;
  601. margin-right: 8rpx;
  602. .round {
  603. width: 32rpx;
  604. height: 32rpx;
  605. line-height: 32rpx;
  606. text-align: center;
  607. border-radius: 50%;
  608. background: $theme-color;
  609. font-size: 24rpx;
  610. font-style: normal;
  611. font-weight: 400;
  612. color: #fff;
  613. }
  614. }
  615. .round {
  616. width: 32rpx;
  617. height: 32rpx;
  618. line-height: 32rpx;
  619. text-align: center;
  620. border-radius: 50%;
  621. background: $theme-color;
  622. font-size: 24rpx;
  623. font-style: normal;
  624. font-weight: 400;
  625. color: #fff;
  626. }
  627. .listBox-con {
  628. width: 650rpx;
  629. font-weight: 400;
  630. }
  631. .listBox-top {
  632. margin-top: 6rpx;
  633. color: #090a0a;
  634. font-size: 28rpx;
  635. font-style: normal;
  636. font-weight: 800;
  637. }
  638. .listBox-bottom {
  639. color: #090a0a;
  640. font-size: 24rpx;
  641. font-style: normal;
  642. flex-wrap: wrap;
  643. .items {
  644. width: calc(50% - 1px);
  645. border-left: 1rpx solid #e3e5e5;
  646. border-right: 1rpx solid #e3e5e5;
  647. border-bottom: 1rpx solid #e3e5e5;
  648. box-sizing: border-box;
  649. word-break: break-all;
  650. text {
  651. display: inline-block;
  652. background: #f7f9fa;
  653. padding: 8rpx 10rpx;
  654. color: #157a2c;
  655. }
  656. &:nth-child(1),
  657. &:nth-child(2) {
  658. border-top: 1rpx solid #e3e5e5;
  659. margin-top: 8rpx;
  660. }
  661. }
  662. }
  663. }
  664. .card_box {
  665. width: 92vw;
  666. padding: 16rpx 32rpx;
  667. box-sizing: border-box;
  668. border-bottom: 2rpx solid #e1e1e1;
  669. .item_box {
  670. margin-top: 10rpx;
  671. .item_one {
  672. width: 100%;
  673. font-size: 26rpx;
  674. font-style: normal;
  675. font-weight: 400;
  676. line-height: 38rpx;
  677. word-wrap: break-word;
  678. }
  679. .gylx {
  680. color: $theme-color;
  681. }
  682. .perce50 {
  683. width: 50%;
  684. }
  685. }
  686. }
  687. .content_num {
  688. display: flex;
  689. align-items: center;
  690. padding: 0 4rpx;
  691. /deep/ .uni-input-input {
  692. border: 2rpx solid #f0f8f2;
  693. background: #f0f8f2;
  694. color: $theme-color;
  695. }
  696. }
  697. </style>