semiProductBom.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">物料明细 ({{ list.length || 0 }})个</view>
  5. <view
  6. class="btn_box rx-cc"
  7. v-if="deviceList.length > 1"
  8. @click="bindDevice"
  9. >绑定设备</view
  10. >
  11. </view>
  12. <u-list
  13. @scrolltolower="scrolltolower"
  14. class="z_list"
  15. style="height: 100% !important"
  16. >
  17. <view class="material rx-ss" v-for="(mate, idx) in list" :key="idx">
  18. <view class="left rx-ss" @click="getDelete(idx)" v-if="workOrderId">
  19. <uni-icons
  20. custom-prefix="iconfont"
  21. type="icon-shanchu"
  22. size="20"
  23. color="#fa3534"
  24. ></uni-icons>
  25. </view>
  26. <view class="content_table">
  27. <view
  28. class="item rx-sc"
  29. v-if="
  30. [23, 2, 9, 28].includes(Number(mate.rootCategoryLevelId)) &&
  31. mate.isConsumable == 1
  32. "
  33. >
  34. <view class="rx">
  35. <view class="lable rx-cc">编码</view>
  36. <view class="content rx-bc">
  37. <view>{{ mate.categoryCode }} </view>
  38. <view
  39. class="tag_box"
  40. v-if="
  41. Object.prototype.hasOwnProperty.call(mate, 'extInfo') &&
  42. Object.prototype.hasOwnProperty.call(
  43. mate.extInfo,
  44. 'productionTimes'
  45. ) &&
  46. Object.prototype.hasOwnProperty.call(
  47. mate.extInfo.productionTimes,
  48. item.currentTaskDiagram.taskId
  49. )
  50. "
  51. >
  52. {{
  53. mate.extInfo.productionTimes[item.currentTaskDiagram.taskId]
  54. }}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view
  60. class="item rx-bc"
  61. v-if="
  62. [23, 2, 9, 28].includes(Number(mate.rootCategoryLevelId)) &&
  63. mate.isConsumable == 0
  64. "
  65. @click="handleCheck(idx, mate)"
  66. >
  67. <view class="rx">
  68. <view class="lable rx-cc">编码</view>
  69. <view class="content rx-bc">
  70. <view>{{ mate.categoryCode }}</view>
  71. <view
  72. class="tag_box"
  73. v-if="mate.isCache"
  74. style="margin-right: -36rpx"
  75. >缓</view
  76. >
  77. </view>
  78. </view>
  79. <view class="rx-cc ww20" v-if="deviceList.length > 1">
  80. <image
  81. class="check"
  82. v-if="mate.check"
  83. src="../../../../static/check.png"
  84. ></image>
  85. <image
  86. class="check"
  87. v-if="!mate.check"
  88. src="../../../../static/check_no.png"
  89. ></image>
  90. </view>
  91. </view>
  92. <view class="item">
  93. <view class="lable rx-cc">名称</view>
  94. <view class="content"
  95. >{{ mate.name }}
  96. <text
  97. v-if="[2, 23, 9, 28].includes(Number(mate.rootCategoryLevelId))"
  98. >
  99. ({{
  100. mate.rootCategoryLevelId == 2
  101. ? "在制品"
  102. : mate.rootCategoryLevelId == 23
  103. ? "半成品"
  104. : mate.rootCategoryLevelId == 9
  105. ? "产品"
  106. : mate.rootCategoryLevelId == 28
  107. ? "废品"
  108. : ""
  109. }})
  110. </text></view
  111. >
  112. </view>
  113. <view class="item rx-sc">
  114. <view class="rx">
  115. <view class="lable lable150 rx-cc">型号</view>
  116. <view class="content rx-sc">
  117. <view>{{ mate.modelType }}</view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="item rx-sc">
  122. <view class="rx">
  123. <view class="lable lable150 rx-cc">规格</view>
  124. <view class="content rx-sc">
  125. <view>{{ mate.specification }}</view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="item rx-sc">
  130. <view class="rx ww50">
  131. <view class="lable lable150 rx-cc">批次号</view>
  132. <view class="content content_num">
  133. <view v-if="isDetails">{{ mate.batchNo }}</view>
  134. <input class="uni-input" v-else v-model="mate.batchNo" />
  135. </view>
  136. </view>
  137. <view class="rx ww50">
  138. <view class="lable lable150 rx-cc">牌号</view>
  139. <view class="content content_num">
  140. <view>{{ mate.brandNum }}</view>
  141. </view>
  142. </view>
  143. </view>
  144. <!-- <view
  145. class="item"
  146. v-for="(itm, index) in tableH(mate.rootCategoryLevelId)"
  147. :key="index"
  148. >
  149. <view class="lable rx-cc">{{ itm.label }}</view>
  150. <view class="content">{{ mate[itm.prop] }}</view>
  151. </view> -->
  152. <!-- <view class="item" v-if='mate.isConsumable == 1'>
  153. <view class="lable rx-cc">包装库存</view>
  154. <view class="content">{{ mate.packingCountBase }}/ {{ mate.minUnit }}</view>
  155. </view> -->
  156. <view class="item rx-sc" v-if="mate.isConsumable == 0">
  157. <view class="rx ww50">
  158. <view class="lable rx-cc"
  159. >{{
  160. currentTaskDiagram.isFirstTask == 1 ? "物料重量" : "上道重量"
  161. }}
  162. </view>
  163. <view
  164. class="content content_num"
  165. v-if="currentTaskDiagram.isFirstTask == 1"
  166. >
  167. <!--{{ mate.extInfo.weight || 0 }} {{ mate.extInfo.weightUnit }}-->
  168. <input
  169. class="uni-input"
  170. style="width: 120rpx"
  171. v-model="mate.extInfo.weight"
  172. type="digit"
  173. />
  174. <view class="unit">/{{ mate.extInfo.weightUnit }}</view>
  175. </view>
  176. <view class="content" v-if="currentTaskDiagram.isFirstTask == 0">
  177. {{ mate.extInfo.newWeight || 0 }} {{ mate.extInfo.weightUnit }}
  178. </view>
  179. </view>
  180. <view class="rx ww50">
  181. <view class="lable ww80 rx-cc">刻码</view>
  182. <!-- <view class="content">{{ mate.extInfo.engrave }}</view> -->
  183. <view class="content content_num">
  184. <view v-if="isDetails">{{ mate.extInfo.engrave }}</view>
  185. <input
  186. class="uni-input"
  187. v-else
  188. v-model="mate.extInfo.engrave"
  189. />
  190. </view>
  191. </view>
  192. </view>
  193. <view class="item rx-sc" v-if="mate.isConsumable == 0">
  194. <view class="rx ww50">
  195. <view class="lable rx-cc">序列号</view>
  196. <view class="content content_num">
  197. <view v-if="isDetails">{{ mate.extInfo.productSequence }}</view>
  198. <input
  199. class="uni-input"
  200. v-else
  201. v-model="mate.extInfo.productSequence"
  202. />
  203. </view>
  204. </view>
  205. <view class="rx ww50">
  206. <view class="lable rx-cc">物料代号</view>
  207. <!-- <view class="content">{{ mate.extInfo.materielCode }}</view> -->
  208. <view class="content content_num">
  209. <view v-if="isDetails">{{ mate.extInfo.materielCode }}</view>
  210. <input
  211. class="uni-input"
  212. v-else
  213. v-model="mate.extInfo.materielCode"
  214. />
  215. </view>
  216. </view>
  217. </view>
  218. <view class="item" v-if="mate.isConsumable == 0">
  219. <view class="rx ww50">
  220. <view class="lable rx-cc">报工重量</view>
  221. <view class="content content_num">
  222. <view v-if="isDetails">{{ mate.extInfo.reportWeight }}</view>
  223. <input
  224. class="uni-input"
  225. v-else
  226. v-model="mate.extInfo.reportWeight"
  227. />
  228. </view>
  229. </view>
  230. <view class="rx ww50">
  231. <view class="lable rx-cc">客户代号</view>
  232. <view class="content content_num">
  233. <view v-if="isDetails">{{ mate.extInfo.clientCode }}</view>
  234. <input
  235. class="uni-input"
  236. v-else
  237. v-model="mate.extInfo.clientCode"
  238. />
  239. </view>
  240. </view>
  241. </view>
  242. <view
  243. class="item"
  244. v-if="mate.isConsumable == 0 && deviceList.length > 0"
  245. >
  246. <view class="rx ww70">
  247. <view class="lable rx-cc">设备</view>
  248. <view class="content content_num">
  249. <zxz-uni-data-select
  250. v-if="!isDetails"
  251. :localdata="deviceList"
  252. v-model="mate.deviceId"
  253. dataValue="id"
  254. format="{name}-{codeNumber}"
  255. @change="(e) => selectVal(e, mate, idx)"
  256. dataKey="id"
  257. filterable
  258. :clear="false"
  259. ></zxz-uni-data-select>
  260. <span v-if="isDetails">{{ mate.deviceName }}</span>
  261. </view>
  262. </view>
  263. <view class="rx ww30">
  264. <view class="lable rx-cc ww80">炉次号</view>
  265. <view class="content content_num">
  266. <view v-if="isDetails">{{ mate.extInfo.heatNumber }}</view>
  267. <input
  268. v-else
  269. class="uni-input"
  270. style="width: 120rpx"
  271. v-model="mate.extInfo.heatNumber"
  272. />
  273. </view>
  274. </view>
  275. </view>
  276. <view
  277. class="item"
  278. v-if="mate.isConsumable == 0 && workInfo.singleReport == 0"
  279. >
  280. <view class="lable rx-cc">投料类型</view>
  281. <view class="content" style="color: #157a2c"
  282. >{{ workInfo.singleReport == 0 ? "批量投料" : "" }}
  283. </view>
  284. </view>
  285. <view class="item rx-sc" v-if="mate.isConsumable == 0">
  286. <view class="rx ww50">
  287. <view class="lable rx-cc">位置</view>
  288. <view class="content content_num">
  289. <view v-if="isDetails">{{ mate.extInfo.position }}</view>
  290. <input
  291. v-else
  292. class="uni-input"
  293. v-model="mate.extInfo.position"
  294. />
  295. </view>
  296. </view>
  297. <view class="rx ww50">
  298. <view class="lable rx-cc ww80">数量</view>
  299. <view class="content content_num">
  300. <view v-if="isDetails">{{ mate.feedQuantity }}</view>
  301. <input
  302. v-else
  303. class="uni-input"
  304. style="width: 160rpx"
  305. v-model="mate.feedQuantity"
  306. type="digit"
  307. />
  308. <view class="unit">/{{ mate.unit }}</view>
  309. </view>
  310. </view>
  311. </view>
  312. <view class="item" v-if="mate.isConsumable == 1">
  313. <view class="lable rx-cc">数量</view>
  314. <view class="content content_num">
  315. <input
  316. class="uni-input"
  317. v-model="mate.feedQuantity"
  318. type="digit"
  319. />
  320. <view class="unit">/{{ mate.unit }}</view>
  321. </view>
  322. </view>
  323. </view>
  324. </view>
  325. </u-list>
  326. <SearchPopup mode="center" v-if="deviveShow">
  327. <template v-slot:list>
  328. <view class="search_list">
  329. <u-form
  330. labelPosition="left"
  331. :model="formData"
  332. labelWidth="180"
  333. labelAlign="left"
  334. class="baseForm"
  335. >
  336. <u-form-item
  337. label="绑定设备:"
  338. class="required-form"
  339. borderBottom
  340. prop="assetType"
  341. >
  342. <zxz-uni-data-select
  343. :localdata="deviceList"
  344. v-model="formData.deviceId"
  345. dataValue="id"
  346. format="{name}-{codeNumber}"
  347. @change="(e) => (formData.deviceName = e.name + e.codeNumber)"
  348. dataKey="id"
  349. filterable
  350. :clear="false"
  351. ></zxz-uni-data-select>
  352. </u-form-item>
  353. </u-form>
  354. </view>
  355. </template>
  356. <template v-slot:operate>
  357. <view class="operate_box rx-bc">
  358. <u-button size="small" class="u-reset-button" @click="deviceClose">
  359. 取消
  360. </u-button>
  361. <u-button
  362. type="success"
  363. size="small"
  364. class="u-reset-button"
  365. @click="deviceOk"
  366. >
  367. 确定
  368. </u-button>
  369. </view>
  370. </template>
  371. </SearchPopup>
  372. </view>
  373. </template>
  374. <script>
  375. import { tableHeader } from "./feedBom.js";
  376. import SearchPopup from "../../components/searchPopup.vue";
  377. export default {
  378. components: {
  379. SearchPopup,
  380. },
  381. props: {
  382. workOrderId: {
  383. type: String,
  384. default: "",
  385. },
  386. list: {
  387. type: Array,
  388. default: () => [],
  389. },
  390. equipmentList: {
  391. type: Array,
  392. default: () => [],
  393. },
  394. currentTaskDiagram: {
  395. type: Object,
  396. default: () => {},
  397. },
  398. isDetails: {
  399. type: Boolean,
  400. default: false,
  401. },
  402. workInfo: {
  403. type: Object,
  404. default: () => {},
  405. },
  406. },
  407. watch: {
  408. equipmentList: {
  409. immediate: true,
  410. deep: true,
  411. handler(newVal) {
  412. console.log("112233", newVal);
  413. this.deviceList = newVal;
  414. this.changeHeatNumber();
  415. },
  416. },
  417. },
  418. data() {
  419. return {
  420. deviceList: [],
  421. deviveShow: false,
  422. formData: {
  423. deviceId: null,
  424. deviceName: null,
  425. },
  426. };
  427. },
  428. created() {},
  429. methods: {
  430. tableH(type) {
  431. return tableHeader(type);
  432. },
  433. getDelete(idx) {
  434. this.list.splice(idx, 1);
  435. },
  436. scrolltolower() {},
  437. handleCheck(idx, it) {
  438. this.$set(this.list[idx], "check", !it.check);
  439. },
  440. selectVal(e, item, idx) {
  441. this.$set(this.list[idx], "deviceName", e.name + "-" + e.codeNumber);
  442. this.$set(this.list[idx]["extInfo"], "heatNumber", e.extInfo.heatNumber);
  443. },
  444. changeHeatNumber() {
  445. this.deviceList.forEach((f) => {
  446. this.list.forEach((o) => {
  447. if (o.deviceId && f.id == o.deviceId && this.deviceList.length > 1) {
  448. o.extInfo.heatNumber = f.extInfo.heatNumber;
  449. o["workstationName"] = f.workstationName;
  450. } else if (this.deviceList.length == 1) {
  451. o["deviceName"] = this.deviceList[0].name;
  452. o["deviceId"] = this.deviceList[0].id;
  453. o["workstationName"] = this.deviceList[0].workstationName;
  454. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
  455. this.$forceUpdate();
  456. }
  457. });
  458. });
  459. },
  460. bindDevice() {
  461. this.deviveShow = true;
  462. },
  463. deviceOk() {
  464. let arr = this.list.filter((e) => {
  465. return e.check;
  466. });
  467. if (arr.length <= 0) {
  468. uni.showToast({
  469. icon: "none",
  470. title: "请先勾选半成品",
  471. });
  472. return false;
  473. }
  474. if (!this.formData.deviceId) {
  475. uni.showToast({
  476. icon: "none",
  477. title: "请先选择设备",
  478. });
  479. return false;
  480. }
  481. this.list.forEach((e) => {
  482. if (e.check) {
  483. e["deviceId"] = this.formData.deviceId;
  484. e["deviceName"] = this.formData.deviceName;
  485. }
  486. });
  487. this.$forceUpdate();
  488. this.deviceClose();
  489. },
  490. deviceClose() {
  491. this.formData.deviceName = null;
  492. this.formData.deviceId = null;
  493. this.deviveShow = false;
  494. },
  495. },
  496. };
  497. </script>
  498. <style lang="scss" scoped>
  499. .title_box {
  500. margin-top: 20rpx;
  501. .name {
  502. font-size: 28rpx;
  503. font-style: normal;
  504. font-weight: 400;
  505. color: $theme-color;
  506. padding-left: 20rpx;
  507. position: relative;
  508. &:before {
  509. position: absolute;
  510. content: "";
  511. left: 0rpx;
  512. top: 0rpx;
  513. bottom: 0rpx;
  514. width: 4rpx;
  515. height: 28rpx;
  516. background: $theme-color;
  517. margin: auto;
  518. }
  519. }
  520. .btn_box {
  521. padding: 0 18rpx;
  522. height: 48rpx;
  523. background: $theme-color;
  524. font-size: 26rpx;
  525. font-style: normal;
  526. font-weight: 400;
  527. font-size: 24rpx;
  528. color: #fff;
  529. border-radius: 4rpx;
  530. .scan {
  531. width: 34rpx;
  532. height: 34rpx;
  533. margin-right: 12rpx;
  534. }
  535. }
  536. }
  537. .material {
  538. margin-top: 10rpx;
  539. .left {
  540. width: 40rpx;
  541. }
  542. .zdy_check {
  543. width: 30rpx;
  544. height: 30rpx;
  545. border: 2rpx solid #c8c9cc;
  546. border-radius: 4rpx;
  547. }
  548. .check_active {
  549. background: $theme-color;
  550. border: 2rpx solid $theme-color;
  551. /deep/ .u-icon__icon {
  552. color: #fff !important;
  553. }
  554. }
  555. .content_table {
  556. width: 670rpx;
  557. border: 2rpx solid $border-color;
  558. .item {
  559. display: flex;
  560. border-bottom: 2rpx solid $border-color;
  561. .lable {
  562. width: 132rpx;
  563. text-align: center;
  564. background-color: #f7f9fa;
  565. font-size: 26rpx;
  566. border-right: 2rpx solid $border-color;
  567. flex-shrink: 0;
  568. }
  569. .ww80 {
  570. width: 80rpx;
  571. }
  572. .content {
  573. width: 500rpx;
  574. min-height: 64rpx;
  575. font-size: 28rpx;
  576. line-height: 28rpx;
  577. font-style: normal;
  578. font-weight: 400;
  579. padding: 18rpx 8rpx;
  580. box-sizing: border-box;
  581. word-wrap: break-word;
  582. flex-grow: 1 !important;
  583. }
  584. .content_num {
  585. display: flex;
  586. align-items: center;
  587. padding: 0 4rpx;
  588. /deep/ .uni-input-input {
  589. width: 200rpx;
  590. border: 2rpx solid #f0f8f2;
  591. background: #f0f8f2;
  592. color: $theme-color;
  593. }
  594. .unit {
  595. padding: 0 4rpx;
  596. font-size: 24rpx;
  597. color: #404446;
  598. }
  599. }
  600. .ww400 {
  601. /deep/ .uni-input-input {
  602. width: 400rpx;
  603. }
  604. }
  605. .pd4 {
  606. padding: 4rpx 8rpx;
  607. }
  608. &:last-child {
  609. border-bottom: none;
  610. }
  611. }
  612. .ww55 {
  613. width: 55%;
  614. }
  615. .ww45 {
  616. width: 45%;
  617. }
  618. .ww50 {
  619. width: 50%;
  620. }
  621. .ww30 {
  622. width: 30%;
  623. }
  624. .ww70 {
  625. width: 70%;
  626. }
  627. .ww80 {
  628. width: 80%;
  629. }
  630. .ww20 {
  631. width: 20%;
  632. }
  633. .check {
  634. width: 30rpx;
  635. height: 30rpx;
  636. }
  637. .tag_box {
  638. padding: 2rpx 10rpx;
  639. margin-right: 12rpx;
  640. background: #e6a23c;
  641. font-size: 22rpx;
  642. color: #fff;
  643. border-radius: 4rpx;
  644. }
  645. }
  646. }
  647. .z_list {
  648. max-height: 2000rpx;
  649. }
  650. .search_list {
  651. min-height: 100rpx;
  652. width: 90vw;
  653. /deep/ .baseForm {
  654. padding: 0 20rpx;
  655. }
  656. }
  657. .operate_box {
  658. padding: 10rpx 32rpx;
  659. /deep/ .u-button {
  660. width: 40%;
  661. }
  662. }
  663. </style>