workInProgressList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name"> 在制品: ({{ listArr.length || 0 }})个</view>
  5. </view>
  6. <view
  7. :class="[
  8. 'material',
  9. it.extInfo.reportWeight && it.extInfo.reportWeight && 'materialBor',
  10. ]"
  11. v-for="(it, idx) in listArr"
  12. :key="idx"
  13. >
  14. <view class="content_table">
  15. <view class="item rx-sc">
  16. <view class="rx">
  17. <view class="lable lable150 rx-cc">名称</view>
  18. <view class="content rx-bc">
  19. <view>{{ it.name }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="item rx-sc">
  24. <view class="rx ww50">
  25. <view class="lable lable150 rx-cc">批次号</view>
  26. <view class="content content_num">
  27. <input
  28. class="uni-input"
  29. v-model="it.batchNo"
  30. :disabled="isDetails"
  31. />
  32. </view>
  33. </view>
  34. <view class="rx ww50">
  35. <view class="lable lable150 rx-cc">牌号</view>
  36. <view class="content content_num">
  37. <view :disabled="isDetails">{{ it.brandNu }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="item rx-sc">
  42. <view class="rx">
  43. <view class="lable lable150 rx-cc">型号</view>
  44. <view class="content rx-sc">
  45. <view>{{ it.modelType }}</view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="item rx-sc">
  50. <view class="rx ww50">
  51. <view class="lable lable150 rx-cc">设备</view>
  52. <view class="content content_num">
  53. <zxz-uni-data-select
  54. :localdata="deviceList"
  55. v-model="it.deviceId"
  56. dataValue="instanceId"
  57. format="{name}"
  58. dataKey="instanceId"
  59. filterable
  60. :disabled="isDetails"
  61. :clear="false"
  62. ></zxz-uni-data-select>
  63. </view>
  64. <!-- <view class="content ">
  65. <view>{{ it.deviceName || it.extInfo.deviceName }}</view>
  66. </view> -->
  67. </view>
  68. <view class="rx ww50">
  69. <view class="lable lable150 rx-cc">炉次号</view>
  70. <view class="content content_num">
  71. <view v-if="isDetails">{{ it.extInfo.heatNumber }}</view>
  72. <input class="uni-input" v-else v-model="it.extInfo.heatNumber" />
  73. </view>
  74. </view>
  75. </view>
  76. <view class="item rx-sc">
  77. <view class="rx ww50">
  78. <view class="lable lable150 rx-cc">数量</view>
  79. <view class="content content_num">
  80. {{ it.extInfo.sourceQuantity || 0 }}{{ it.unit }}
  81. </view>
  82. </view>
  83. <view class="rx ww50">
  84. <view class="lable lable150 rx-cc">重量</view>
  85. <view class="content content_num">
  86. <view
  87. >{{ it.extInfo.newWeight || 0
  88. }}{{ it.extInfo.weightUnit }}</view
  89. >
  90. </view>
  91. </view>
  92. </view>
  93. <view class="item rx-sc">
  94. <view class="rx">
  95. <view class="lable lable150 rx-cc">操作</view>
  96. <view class="content rx-bc">
  97. <view style="display: flex">
  98. <u-button
  99. size="small"
  100. class="u-reset-button"
  101. type="primary"
  102. @click="batchClick(it, idx)"
  103. v-if="it.extInfo.sourceQuantity > 1"
  104. >拆批</u-button
  105. >
  106. <u-button
  107. size="small"
  108. class="u-reset-button"
  109. type="error"
  110. @click="deleteBatch(idx)"
  111. style="margin-left: 20px"
  112. >删除</u-button
  113. >
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <uni-popup ref="inputDialog" type="dialog">
  121. <uni-popup-dialog
  122. ref="inputClose"
  123. mode="input"
  124. title="拆批数"
  125. placeholder="请输入拆批数"
  126. :before-close="true"
  127. @close="handleClose"
  128. @confirm="timeoutCauseConfirm"
  129. ></uni-popup-dialog>
  130. </uni-popup>
  131. </view>
  132. </template>
  133. <script>
  134. import { splitBatch } from "@/api/pda/feeding";
  135. export default {
  136. props: {
  137. tableData: {
  138. type: Array,
  139. default: () => [],
  140. },
  141. itemData: {
  142. type: Object,
  143. default: () => {},
  144. },
  145. isDetails: {
  146. type: Boolean,
  147. default: false,
  148. },
  149. equipmentList: {
  150. type: Array,
  151. default: () => [],
  152. },
  153. },
  154. data() {
  155. return {
  156. pickerIndex: 0,
  157. isAllChecked: true,
  158. listArr: [],
  159. selectedIndexs: [],
  160. bacthData: {},
  161. bacthIndex: "",
  162. deviceList: [],
  163. };
  164. },
  165. watch: {
  166. tableData: {
  167. handler(v) {
  168. this.listArr = v;
  169. },
  170. immediate: true,
  171. deep: true,
  172. },
  173. equipmentList: {
  174. handler(v) {
  175. this.deviceList = v;
  176. this.changeHeatNumber();
  177. },
  178. immediate: true,
  179. deep: true,
  180. },
  181. },
  182. mounted() {
  183. // this.listArr.push(...this.itemData.product)
  184. if (this.itemData.product) {
  185. this.listArr.push(...this.itemData.product);
  186. this.listArr.forEach((item) => {
  187. if (!item.batchNo) {
  188. item.batchNo = this.itemData.batchNo;
  189. }
  190. item.childBatch = 0;
  191. });
  192. } else {
  193. this.list.push(...this.itemData.inProductList);
  194. }
  195. },
  196. methods: {
  197. handlerCheckedTow(e, index, item) {
  198. console.log(item);
  199. if (e.detail.value.length) {
  200. // this.$set(this.tableData[index], 'selected', true);
  201. item.selected = true;
  202. } else {
  203. // this.$set(this.tableData[index], 'selected', false);
  204. item.selected = false;
  205. }
  206. this.listArr[index] = item;
  207. // this.$emit('tableDataFn', this.tableData);
  208. console.log(this.tableData);
  209. this.$nextTick(() => {
  210. let a = this.listArr.filter((v) => v.selected);
  211. if (a.length && a.length == this.listArr.length) {
  212. this.isAllChecked = true;
  213. } else {
  214. this.isAllChecked = false;
  215. }
  216. });
  217. },
  218. //全选
  219. handlerChecked(e) {
  220. console.log(this.listArr);
  221. if (e.detail.value.length) {
  222. // 全选
  223. this.listArr.map((item) => {
  224. item.selected = true;
  225. });
  226. } else {
  227. // 未选中
  228. this.listArr.map((item) => {
  229. item.selected = false;
  230. });
  231. }
  232. this.listArr = [];
  233. this.$set(this, "listArr", this.listArr);
  234. this.listArr = this.tableData;
  235. this.$emit("tableDataFn", this.tableData);
  236. },
  237. blurNum(workReportInfo) {
  238. this.$emit("tableDataFn", this.tableData);
  239. },
  240. handlerChange(item, index) {
  241. // this.$emit('tableDataFn', this.tableData);
  242. console.log(item, index);
  243. },
  244. selectionChange(e) {
  245. this.selectedIndexs = e.detail.index;
  246. },
  247. batchClick(item, index) {
  248. console.log("拆批", item, index);
  249. this.bacthData = item;
  250. this.bacthIndex = index;
  251. this.$refs.inputDialog.open();
  252. },
  253. handleClose() {
  254. this.$refs.inputDialog.close();
  255. },
  256. async timeoutCauseConfirm(value) {
  257. if (!value) {
  258. uni.showToast({
  259. title: "请输入拆批的数量",
  260. icon: "none",
  261. });
  262. return;
  263. }
  264. console.log(this.itemData, "2222");
  265. if (this.bacthData.extInfo.sourceQuantity < value) {
  266. this.$message.warning("拆批数不能大于数量");
  267. return;
  268. }
  269. let dataList = [];
  270. await splitBatch({
  271. product: this.bacthData,
  272. splitQt: Number(value),
  273. }).then((res) => {
  274. res.forEach((item) => {
  275. dataList.push(this.deepCopy(item));
  276. });
  277. this.refreshData(dataList, value);
  278. });
  279. // this.$refs.inputDialog.close()
  280. },
  281. refreshData(list, value) {
  282. const number =
  283. Number(this.listArr[this.bacthIndex].extInfo.sourceQuantity) -
  284. Number(value);
  285. this.listArr[this.bacthIndex].extInfo.sourceQuantity = number;
  286. this.listArr[this.bacthIndex].feedQuantity = number;
  287. list.forEach((item) => {
  288. item.childBatch = 1;
  289. });
  290. let _arr = [...this.listArr, ...list];
  291. this.$set(this.listArr, this.listArr.length, ...list);
  292. this.$set(this.itemData, "product", _arr);
  293. this.$forceUpdate();
  294. this.$refs.inputDialog.close();
  295. },
  296. deleteBatch(index) {
  297. this.listArr.splice(index, 1);
  298. this.$set(this.itemData, "product", this.listArr);
  299. },
  300. deepCopy(obj, hash = new WeakMap()) {
  301. if (obj === null) return null;
  302. if (obj instanceof Date) return new Date(obj);
  303. if (obj instanceof RegExp) return new RegExp(obj);
  304. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  305. if (hash.has(obj)) return hash.get(obj);
  306. const result = Array.isArray(obj) ? [] : {};
  307. hash.set(obj, result);
  308. return Object.keys(obj).reduce((acc, key) => {
  309. acc[key] = this.deepCopy(obj[key], hash);
  310. return acc;
  311. }, result);
  312. },
  313. changeHeatNumber() {
  314. console.log(this.deviceList);
  315. this.deviceList.forEach((f) => {
  316. this.listArr.forEach((o) => {
  317. if (
  318. o.deviceId &&
  319. f.instanceId == o.deviceId &&
  320. this.deviceList.length > 1
  321. ) {
  322. console.log(444);
  323. o.extInfo.heatNumber = f.extInfo.heatNumber;
  324. this.$forceUpdate();
  325. } else if (this.deviceList.length == 1) {
  326. console.log(1323);
  327. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
  328. o.deviceId = f.instanceId;
  329. this.$forceUpdate();
  330. } else if(this.deviceList.length > 1) {
  331. }
  332. });
  333. });
  334. },
  335. },
  336. };
  337. </script>
  338. <style lang="scss" scoped>
  339. ::v-deep .uni-select--mask {
  340. position: relative !important;
  341. }
  342. .container {
  343. padding: 10rpx;
  344. overflow: auto;
  345. checkbox {
  346. transform: scale(0.8);
  347. }
  348. }
  349. .uni-input {
  350. width: 150rpx;
  351. border: 1px solid #f0f8f2;
  352. background: #f0f8f2;
  353. color: #157a2c;
  354. }
  355. /deep/.uni-table {
  356. min-width: 100vw !important;
  357. .uni-table-td,
  358. .uni-table-th {
  359. padding: 20rpx 10rpx !important;
  360. text-align: center !important;
  361. font-weight: normal !important;
  362. font-size: 26rpx !important;
  363. }
  364. .uni-table-text {
  365. font-size: 26rpx !important;
  366. }
  367. }
  368. .title_box {
  369. margin-top: 20rpx;
  370. .name {
  371. font-size: 28rpx;
  372. font-style: normal;
  373. font-weight: 400;
  374. color: $theme-color;
  375. padding-left: 20rpx;
  376. position: relative;
  377. &:before {
  378. position: absolute;
  379. content: "";
  380. left: 0rpx;
  381. top: 0rpx;
  382. bottom: 0rpx;
  383. width: 4rpx;
  384. height: 28rpx;
  385. background: $theme-color;
  386. margin: auto;
  387. }
  388. }
  389. .btn_box {
  390. .btn {
  391. padding: 0 18rpx;
  392. height: 50rpx;
  393. line-height: 50rpx;
  394. background: $theme-color;
  395. font-size: 26rpx;
  396. font-style: normal;
  397. font-weight: 400;
  398. font-size: 24rpx;
  399. color: #fff;
  400. border-radius: 4rpx;
  401. margin-left: 24rpx;
  402. }
  403. }
  404. }
  405. .material {
  406. margin-top: 16rpx;
  407. border: 1rpx solid transparent;
  408. .content_table {
  409. width: 100%;
  410. border: 2rpx solid $border-color;
  411. box-sizing: border-box;
  412. .item {
  413. display: flex;
  414. border-bottom: 2rpx solid $border-color;
  415. .lable {
  416. width: 132rpx;
  417. text-align: center;
  418. background-color: #f7f9fa;
  419. font-size: 26rpx;
  420. border-right: 2rpx solid $border-color;
  421. flex-shrink: 0;
  422. }
  423. .lable150 {
  424. width: 156rpx !important;
  425. font-size: 24rpx;
  426. }
  427. .lable190 {
  428. width: 200rpx !important;
  429. font-size: 24rpx;
  430. }
  431. .ww80 {
  432. width: 80rpx;
  433. }
  434. .content {
  435. width: 518rpx;
  436. min-height: 64rpx;
  437. font-size: 28rpx;
  438. line-height: 28rpx;
  439. font-style: normal;
  440. font-weight: 400;
  441. padding: 18rpx 8rpx;
  442. box-sizing: border-box;
  443. word-wrap: break-word;
  444. flex-grow: 1 !important;
  445. .unit {
  446. padding: 0 4rpx;
  447. font-size: 24rpx;
  448. color: #404446;
  449. }
  450. .penalize {
  451. width: 160rpx;
  452. line-height: 60rpx;
  453. background: $theme-color;
  454. font-size: 24rpx;
  455. text-align: center;
  456. color: #fff;
  457. }
  458. }
  459. .content_H {
  460. min-height: 92rpx;
  461. }
  462. .pd4 {
  463. padding: 4rpx 8rpx;
  464. }
  465. &:last-child {
  466. border-bottom: none;
  467. }
  468. }
  469. .ww55 {
  470. width: 55%;
  471. }
  472. .ww50 {
  473. width: 50%;
  474. }
  475. .ww45 {
  476. width: 45%;
  477. }
  478. .tag_box {
  479. padding: 2rpx 10rpx;
  480. margin-right: 12rpx;
  481. background: #e6a23c;
  482. font-size: 22rpx;
  483. color: #fff;
  484. border-radius: 4rpx;
  485. }
  486. }
  487. }
  488. .materialBor {
  489. border: 1rpx solid #157a2c;
  490. }
  491. .content_table2 {
  492. width: 100%;
  493. .row {
  494. width: 100%;
  495. .item {
  496. color: #404446;
  497. font-size: 28rpx;
  498. padding-left: 12rpx;
  499. }
  500. .color157 {
  501. color: $theme-color;
  502. }
  503. .ww30 {
  504. width: 30%;
  505. }
  506. .ww20 {
  507. width: 20%;
  508. }
  509. .ww15 {
  510. width: 15%;
  511. }
  512. .ww25 {
  513. width: 25%;
  514. }
  515. .ww50 {
  516. width: 50%;
  517. }
  518. .ww10 {
  519. width: 10%;
  520. }
  521. }
  522. .head {
  523. height: 64rpx;
  524. background: #f7f9fa;
  525. // border-top: 2rpx solid #E3E5E5;
  526. border-left: 2rpx solid #e3e5e5;
  527. box-sizing: border-box;
  528. .item {
  529. height: 64rpx;
  530. line-height: 64rpx;
  531. border-right: 2rpx solid #e3e5e5;
  532. box-sizing: border-box;
  533. font-size: 22rpx;
  534. }
  535. }
  536. .tr {
  537. border-top: 2rpx solid #e3e5e5;
  538. border-left: 2rpx solid #e3e5e5;
  539. .item {
  540. font-size: 24rpx;
  541. min-height: 74rpx;
  542. display: flex;
  543. align-items: center;
  544. border-right: 2rpx solid #e3e5e5;
  545. box-sizing: border-box;
  546. white-space: normal;
  547. word-break: break-all;
  548. }
  549. &:last-child {
  550. border-bottom: 2rpx solid #e3e5e5;
  551. }
  552. .numerate {
  553. font-size: 22rpx;
  554. color: $theme-color;
  555. }
  556. }
  557. }
  558. .content_num {
  559. display: flex;
  560. align-items: center;
  561. padding: 0 4rpx;
  562. /deep/ .uni-input-input {
  563. border: 2rpx solid #f0f8f2;
  564. background: #f0f8f2;
  565. color: $theme-color;
  566. }
  567. }
  568. .round {
  569. width: 32rpx;
  570. height: 32rpx;
  571. line-height: 30rpx;
  572. text-align: center;
  573. border-radius: 50%;
  574. background: $theme-color;
  575. font-size: 24rpx;
  576. font-style: normal;
  577. font-weight: 400;
  578. color: #fff;
  579. margin-right: 10rpx;
  580. }
  581. .popup_box {
  582. width: 94vw;
  583. padding: 16rpx 12rpx;
  584. box-sizing: border-box;
  585. }
  586. .operate_box {
  587. margin-top: 32rpx;
  588. padding: 10rpx 100rpx;
  589. /deep/ .u-button {
  590. width: 160rpx;
  591. }
  592. }
  593. .formula_box {
  594. font-size: 24rpx;
  595. font-style: normal;
  596. font-weight: 400;
  597. margin-top: 12rpx;
  598. }
  599. .reportWeight {
  600. font-size: 24rpx;
  601. font-style: normal;
  602. font-weight: 400;
  603. margin-top: 30rpx;
  604. text {
  605. color: $theme-color;
  606. }
  607. }
  608. </style>