| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701 |
- <template>
- <view>
- <view class="title_box rx-bc">
- <view class="name"> 在制品: ({{ listArr.length || 0 }})个</view>
- </view>
- <view
- :class="[
- 'material',
- it.extInfo.reportWeight && it.extInfo.reportWeight && 'materialBor',
- ]"
- v-for="(it, idx) in listArr"
- :key="idx"
- >
- <view class="content_table">
- <view class="item rx-sc">
- <view class="rx">
- <view class="lable lable150 rx-cc">名称</view>
- <view class="content rx-bc">
- <view>{{ it.name }}</view>
- </view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">批次号</view>
- <view class="content content_num">
- <input
- class="uni-input"
- v-model="it.batchNo"
- :disabled="isDetails"
- />
- </view>
- </view>
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">牌号</view>
- <view class="content content_num">
- <view :disabled="isDetails">{{ it.brandNu }}</view>
- </view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx">
- <view class="lable lable150 rx-cc">型号</view>
- <view class="content rx-sc">
- <view>{{ it.modelType }}</view>
- </view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">设备</view>
- <view class="content content_num">
- <zxz-uni-data-select
- :localdata="deviceList"
- v-model="it.deviceId"
- dataValue="instanceId"
- format="{name}"
- dataKey="instanceId"
- filterable
- :disabled="isDetails"
- :clear="false"
- ></zxz-uni-data-select>
- </view>
- <!-- <view class="content ">
- <view>{{ it.deviceName || it.extInfo.deviceName }}</view>
- </view> -->
- </view>
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">炉次号</view>
- <view class="content content_num">
- <view v-if="isDetails">{{ it.extInfo.heatNumber }}</view>
- <input class="uni-input" v-else v-model="it.extInfo.heatNumber" />
- </view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">数量</view>
- <view class="content content_num">
- {{ it.extInfo.sourceQuantity || 0 }}{{ it.unit }}
- </view>
- </view>
- <view class="rx ww50">
- <view class="lable lable150 rx-cc">重量</view>
- <view class="content content_num">
- <view
- >{{ it.extInfo.newWeight || 0
- }}{{ it.extInfo.weightUnit }}</view
- >
- </view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx">
- <view class="lable lable150 rx-cc">操作</view>
- <view class="content rx-bc">
- <view style="display: flex">
- <u-button
- size="small"
- class="u-reset-button"
- type="primary"
- @click="batchClick(it, idx)"
- v-if="it.extInfo.sourceQuantity > 1"
- >拆批</u-button
- >
- <u-button
- size="small"
- class="u-reset-button"
- type="error"
- @click="deleteBatch(idx)"
- style="margin-left: 20px"
- >删除</u-button
- >
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <uni-popup ref="inputDialog" type="dialog">
- <uni-popup-dialog
- ref="inputClose"
- mode="input"
- title="拆批数"
- placeholder="请输入拆批数"
- :before-close="true"
- @close="handleClose"
- @confirm="timeoutCauseConfirm"
- ></uni-popup-dialog>
- </uni-popup>
- </view>
- </template>
- <script>
- import { splitBatch } from "@/api/pda/feeding";
- export default {
- props: {
- tableData: {
- type: Array,
- default: () => [],
- },
- itemData: {
- type: Object,
- default: () => {},
- },
- isDetails: {
- type: Boolean,
- default: false,
- },
- equipmentList: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- pickerIndex: 0,
- isAllChecked: true,
- listArr: [],
- selectedIndexs: [],
- bacthData: {},
- bacthIndex: "",
- deviceList: [],
- };
- },
- watch: {
- tableData: {
- handler(v) {
- this.listArr = v;
- },
- immediate: true,
- deep: true,
- },
- equipmentList: {
- handler(v) {
- this.deviceList = v;
- this.changeHeatNumber();
- },
- immediate: true,
- deep: true,
- },
- },
- mounted() {
- // this.listArr.push(...this.itemData.product)
- if (this.itemData.product) {
- this.listArr.push(...this.itemData.product);
- this.listArr.forEach((item) => {
- if (!item.batchNo) {
- item.batchNo = this.itemData.batchNo;
- }
- item.childBatch = 0;
- });
- } else {
- this.list.push(...this.itemData.inProductList);
- }
- },
- methods: {
- handlerCheckedTow(e, index, item) {
- console.log(item);
- if (e.detail.value.length) {
- // this.$set(this.tableData[index], 'selected', true);
- item.selected = true;
- } else {
- // this.$set(this.tableData[index], 'selected', false);
- item.selected = false;
- }
- this.listArr[index] = item;
- // this.$emit('tableDataFn', this.tableData);
- console.log(this.tableData);
- this.$nextTick(() => {
- let a = this.listArr.filter((v) => v.selected);
- if (a.length && a.length == this.listArr.length) {
- this.isAllChecked = true;
- } else {
- this.isAllChecked = false;
- }
- });
- },
- //全选
- handlerChecked(e) {
- console.log(this.listArr);
- if (e.detail.value.length) {
- // 全选
- this.listArr.map((item) => {
- item.selected = true;
- });
- } else {
- // 未选中
- this.listArr.map((item) => {
- item.selected = false;
- });
- }
- this.listArr = [];
- this.$set(this, "listArr", this.listArr);
- this.listArr = this.tableData;
- this.$emit("tableDataFn", this.tableData);
- },
- blurNum(workReportInfo) {
- this.$emit("tableDataFn", this.tableData);
- },
- handlerChange(item, index) {
- // this.$emit('tableDataFn', this.tableData);
- console.log(item, index);
- },
- selectionChange(e) {
- this.selectedIndexs = e.detail.index;
- },
- batchClick(item, index) {
- console.log("拆批", item, index);
- this.bacthData = item;
- this.bacthIndex = index;
- this.$refs.inputDialog.open();
- },
- handleClose() {
- this.$refs.inputDialog.close();
- },
- async timeoutCauseConfirm(value) {
- if (!value) {
- uni.showToast({
- title: "请输入拆批的数量",
- icon: "none",
- });
- return;
- }
- console.log(this.itemData, "2222");
- if (this.bacthData.extInfo.sourceQuantity < value) {
- this.$message.warning("拆批数不能大于数量");
- return;
- }
- let dataList = [];
- await splitBatch({
- product: this.bacthData,
- splitQt: Number(value),
- }).then((res) => {
- res.forEach((item) => {
- dataList.push(this.deepCopy(item));
- });
- this.refreshData(dataList, value);
- });
- // this.$refs.inputDialog.close()
- },
- refreshData(list, value) {
- const number =
- Number(this.listArr[this.bacthIndex].extInfo.sourceQuantity) -
- Number(value);
- this.listArr[this.bacthIndex].extInfo.sourceQuantity = number;
- this.listArr[this.bacthIndex].feedQuantity = number;
- list.forEach((item) => {
- item.childBatch = 1;
- });
- let _arr = [...this.listArr, ...list];
- this.$set(this.listArr, this.listArr.length, ...list);
- this.$set(this.itemData, "product", _arr);
- this.$forceUpdate();
- this.$refs.inputDialog.close();
- },
- deleteBatch(index) {
- this.listArr.splice(index, 1);
- this.$set(this.itemData, "product", this.listArr);
- },
- deepCopy(obj, hash = new WeakMap()) {
- if (obj === null) return null;
- if (obj instanceof Date) return new Date(obj);
- if (obj instanceof RegExp) return new RegExp(obj);
- if (typeof obj !== "object" && typeof obj !== "function") return obj;
- if (hash.has(obj)) return hash.get(obj);
- const result = Array.isArray(obj) ? [] : {};
- hash.set(obj, result);
- return Object.keys(obj).reduce((acc, key) => {
- acc[key] = this.deepCopy(obj[key], hash);
- return acc;
- }, result);
- },
- changeHeatNumber() {
- console.log(this.deviceList);
- this.deviceList.forEach((f) => {
- this.listArr.forEach((o) => {
- if (
- o.deviceId &&
- f.instanceId == o.deviceId &&
- this.deviceList.length > 1
- ) {
- console.log(444);
- o.extInfo.heatNumber = f.extInfo.heatNumber;
- this.$forceUpdate();
- } else if (this.deviceList.length == 1) {
- console.log(1323);
- o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
- o.deviceId = f.instanceId;
- this.$forceUpdate();
- } else if(this.deviceList.length > 1) {
-
- }
- });
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .uni-select--mask {
- position: relative !important;
- }
- .container {
- padding: 10rpx;
- overflow: auto;
- checkbox {
- transform: scale(0.8);
- }
- }
- .uni-input {
- width: 150rpx;
- border: 1px solid #f0f8f2;
- background: #f0f8f2;
- color: #157a2c;
- }
- /deep/.uni-table {
- min-width: 100vw !important;
- .uni-table-td,
- .uni-table-th {
- padding: 20rpx 10rpx !important;
- text-align: center !important;
- font-weight: normal !important;
- font-size: 26rpx !important;
- }
- .uni-table-text {
- font-size: 26rpx !important;
- }
- }
- .title_box {
- margin-top: 20rpx;
- .name {
- font-size: 28rpx;
- font-style: normal;
- font-weight: 400;
- color: $theme-color;
- padding-left: 20rpx;
- position: relative;
- &:before {
- position: absolute;
- content: "";
- left: 0rpx;
- top: 0rpx;
- bottom: 0rpx;
- width: 4rpx;
- height: 28rpx;
- background: $theme-color;
- margin: auto;
- }
- }
- .btn_box {
- .btn {
- padding: 0 18rpx;
- height: 50rpx;
- line-height: 50rpx;
- background: $theme-color;
- font-size: 26rpx;
- font-style: normal;
- font-weight: 400;
- font-size: 24rpx;
- color: #fff;
- border-radius: 4rpx;
- margin-left: 24rpx;
- }
- }
- }
- .material {
- margin-top: 16rpx;
- border: 1rpx solid transparent;
- .content_table {
- width: 100%;
- border: 2rpx solid $border-color;
- box-sizing: border-box;
- .item {
- display: flex;
- border-bottom: 2rpx solid $border-color;
- .lable {
- width: 132rpx;
- text-align: center;
- background-color: #f7f9fa;
- font-size: 26rpx;
- border-right: 2rpx solid $border-color;
- flex-shrink: 0;
- }
- .lable150 {
- width: 156rpx !important;
- font-size: 24rpx;
- }
- .lable190 {
- width: 200rpx !important;
- font-size: 24rpx;
- }
- .ww80 {
- width: 80rpx;
- }
- .content {
- width: 518rpx;
- min-height: 64rpx;
- font-size: 28rpx;
- line-height: 28rpx;
- font-style: normal;
- font-weight: 400;
- padding: 18rpx 8rpx;
- box-sizing: border-box;
- word-wrap: break-word;
- flex-grow: 1 !important;
- .unit {
- padding: 0 4rpx;
- font-size: 24rpx;
- color: #404446;
- }
- .penalize {
- width: 160rpx;
- line-height: 60rpx;
- background: $theme-color;
- font-size: 24rpx;
- text-align: center;
- color: #fff;
- }
- }
- .content_H {
- min-height: 92rpx;
- }
- .pd4 {
- padding: 4rpx 8rpx;
- }
- &:last-child {
- border-bottom: none;
- }
- }
- .ww55 {
- width: 55%;
- }
- .ww50 {
- width: 50%;
- }
- .ww45 {
- width: 45%;
- }
- .tag_box {
- padding: 2rpx 10rpx;
- margin-right: 12rpx;
- background: #e6a23c;
- font-size: 22rpx;
- color: #fff;
- border-radius: 4rpx;
- }
- }
- }
- .materialBor {
- border: 1rpx solid #157a2c;
- }
- .content_table2 {
- width: 100%;
- .row {
- width: 100%;
- .item {
- color: #404446;
- font-size: 28rpx;
- padding-left: 12rpx;
- }
- .color157 {
- color: $theme-color;
- }
- .ww30 {
- width: 30%;
- }
- .ww20 {
- width: 20%;
- }
- .ww15 {
- width: 15%;
- }
- .ww25 {
- width: 25%;
- }
- .ww50 {
- width: 50%;
- }
- .ww10 {
- width: 10%;
- }
- }
- .head {
- height: 64rpx;
- background: #f7f9fa;
- // border-top: 2rpx solid #E3E5E5;
- border-left: 2rpx solid #e3e5e5;
- box-sizing: border-box;
- .item {
- height: 64rpx;
- line-height: 64rpx;
- border-right: 2rpx solid #e3e5e5;
- box-sizing: border-box;
- font-size: 22rpx;
- }
- }
- .tr {
- border-top: 2rpx solid #e3e5e5;
- border-left: 2rpx solid #e3e5e5;
- .item {
- font-size: 24rpx;
- min-height: 74rpx;
- display: flex;
- align-items: center;
- border-right: 2rpx solid #e3e5e5;
- box-sizing: border-box;
- white-space: normal;
- word-break: break-all;
- }
- &:last-child {
- border-bottom: 2rpx solid #e3e5e5;
- }
- .numerate {
- font-size: 22rpx;
- color: $theme-color;
- }
- }
- }
- .content_num {
- display: flex;
- align-items: center;
- padding: 0 4rpx;
- /deep/ .uni-input-input {
- border: 2rpx solid #f0f8f2;
- background: #f0f8f2;
- color: $theme-color;
- }
- }
- .round {
- width: 32rpx;
- height: 32rpx;
- line-height: 30rpx;
- text-align: center;
- border-radius: 50%;
- background: $theme-color;
- font-size: 24rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- margin-right: 10rpx;
- }
- .popup_box {
- width: 94vw;
- padding: 16rpx 12rpx;
- box-sizing: border-box;
- }
- .operate_box {
- margin-top: 32rpx;
- padding: 10rpx 100rpx;
- /deep/ .u-button {
- width: 160rpx;
- }
- }
- .formula_box {
- font-size: 24rpx;
- font-style: normal;
- font-weight: 400;
- margin-top: 12rpx;
- }
- .reportWeight {
- font-size: 24rpx;
- font-style: normal;
- font-weight: 400;
- margin-top: 30rpx;
- text {
- color: $theme-color;
- }
- }
- </style>
|