instanceBom.vue 15 KB

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