| | |
| | | <script setup lang="ts"> |
| | | import {computed, onMounted, reactive, ref} from "vue"; |
| | | import {computed, onMounted, reactive, ref, watch} from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js"; |
| | |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | } |
| | | }, |
| | | /** 工单 BOM 投入重量,回显到「投入重量」 */ |
| | | bomInputQty: { |
| | | type: Number, |
| | | default: null, |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:isShow", "refreshData"]); |
| | |
| | | copperFiringTime: undefined, // 烧铜进炉时间 |
| | | steelFiringTime: undefined, // 烧钢出炉时间 |
| | | weight: undefined, // 重量(kg/pos) |
| | | inputWeight: undefined, // 投入重量(KG) |
| | | copperSmeltingTemperatureProfile: undefined, // 烧铜温度曲线 |
| | | remark: undefined, // 备注 |
| | | } |
| | |
| | | }); |
| | | }; |
| | | |
| | | const resolveBomInputQty = () => { |
| | | const bom = props.bomInputQty ?? props.row?.bomInputQty; |
| | | if (bom === null || bom === undefined || bom === "") { |
| | | return null; |
| | | } |
| | | const n = Number(bom); |
| | | return Number.isFinite(n) ? n : null; |
| | | }; |
| | | |
| | | const applyBomInputWeight = () => { |
| | | const n = resolveBomInputQty(); |
| | | if (n !== null) { |
| | | formData.otherData.inputWeight = n; |
| | | } |
| | | }; |
| | | |
| | | const initData = () => { |
| | | if (!props.isEdit) { |
| | | formData.otherData = JSON.parse(props.row.otherData || '{}'); |
| | | formData.quantity = props.row.quantity; |
| | | formData.scrapQty = props.row.scrapQty; |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } else { |
| | | const row = props.row; |
| | | formData.planQuantity = row.planQuantity |
| | |
| | | formData.workOrderId = row.id |
| | | formData.reportWork = row.reportWork |
| | | formData.productMainId = row.productMainId |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => props.isShow, |
| | | (show) => { |
| | | if (show) { |
| | | initData(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.bomInputQty, props.row?.bomInputQty], |
| | | () => { |
| | | if (!props.isShow) return; |
| | | if (props.isEdit) { |
| | | applyBomInputWeight(); |
| | | return; |
| | | } |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | const displayValue = (value: any) => { |
| | | return value === undefined || value === null || value === "" ? "-" : value; |
| | |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.steelFiringTime) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr class="report-row report-row--double"> |
| | | <td class="label" colspan="2">投入重量(KG)</td> |
| | | <td colspan="19" class="cell-field"> |
| | | <el-input-number |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.inputWeight" |
| | | :controls="false" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr class="report-row report-row--triple"> |
| | | <td class="label" colspan="2">烧铜产出</td> |
| | | <td colspan="5" class="cell-field"> |