instanceBom.vue 15 KB

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