semiProductBom.vue 17 KB

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