From 0c4429a719f5c95a7690fae51efaaa799ef4e77d Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 25 五月 2026 10:02:48 +0800
Subject: [PATCH] fix: 投入重量改成投入重量/数量
---
src/views/productionManagement/workOrder/components/GranulationForm.vue | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 253 insertions(+), 9 deletions(-)
diff --git a/src/views/productionManagement/workOrder/components/GranulationForm.vue b/src/views/productionManagement/workOrder/components/GranulationForm.vue
index ce7a8b8..cf18aea 100644
--- a/src/views/productionManagement/workOrder/components/GranulationForm.vue
+++ b/src/views/productionManagement/workOrder/components/GranulationForm.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import {computed, onMounted, reactive, ref} from "vue";
+import {computed, onMounted, reactive, ref, watch} from "vue";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {ElMessage} from "element-plus";
import {addProductMain} from "@/api/productionManagement/workOrder.js";
@@ -20,7 +20,12 @@
row: {
type: Object,
default: () => ({}),
- }
+ },
+ /** 宸ュ崟 BOM 鎶曞叆閲嶉噺锛屽洖鏄惧埌銆屾姇鍏ラ噸閲�/鏁伴噺銆� */
+ bomInputQty: {
+ type: Number,
+ default: null,
+ },
});
const emits = defineEmits(["update:isShow", "refreshData"]);
@@ -102,7 +107,7 @@
startTime: undefined,
endTime: undefined,
weightRatio: undefined, // 閲嶉噺姣旓紙姘�/鏂欙級
- pva: undefined, // PVAn绮樺悎鍓傞噸閲�
+ pva: undefined, // PVA绮樺悎鍓傞噸閲�
dispersantWeight: undefined, // 鍒嗘暎鍓傞噸閲�
releaseAgentWeight: undefined, // 鑴辨ā鍓傞噸閲�
},
@@ -121,6 +126,7 @@
confirmName: undefined,
},
remark: undefined, // 澶囨敞
+ inputWeight: undefined, // 鎶曞叆閲嶉噺/鏁伴噺(KG)
}
})
@@ -152,13 +158,19 @@
formData.otherData.burningMaterial.userName = selectedUser.userName;
break;
case 'burningMaterialConfirmId':
- formData.otherData.stirredMillIncludesMixing.confirmName = selectedUser.userName;
+ formData.otherData.burningMaterial.confirmName = selectedUser.userName;
break;
case 'stirredMillUserId':
formData.otherData.stirredMill.userName = selectedUser.userName;
break;
case 'stirredMillConfirmId':
formData.otherData.stirredMill.confirmName = selectedUser.userName;
+ break;
+ case 'granulationBUserId':
+ formData.otherData.granulationB.userName = selectedUser.userName;
+ break;
+ case 'granulationBConfirmId':
+ formData.otherData.granulationB.confirmName = selectedUser.userName;
break;
}
} else {
@@ -181,12 +193,18 @@
case 'stirredMillConfirmId':
formData.otherData.stirredMill.confirmName = "";
break;
+ case 'granulationBUserId':
+ formData.otherData.granulationB.userName = "";
+ break;
+ case 'granulationBConfirmId':
+ formData.otherData.granulationB.confirmName = "";
+ break;
}
}
};
-// todo 淇敼浣滀笟鍛橈紝鍦ㄦ墍鏈変綔涓氬憳涓幏鍙栧~鍏ョ殑鍊硷紝濡傛灉娌℃湁鍒欐彁绀轰笉鎻愪氦
+
const handleReport = () => {
- if (!formData.otherData.userId && !formData.otherData.surfaceCopperPasteUserId && !formData.otherData.underlyingCopperPasteUserId) {
+ if (!formData.otherData.stirredMillIncludesMixing.userId && !formData.otherData.stirredMill.userId && !formData.otherData.burningMaterial.userId && !formData.otherData.granulationB.userId) {
ElMessage.error('璇烽�夋嫨浣滀笟鍛�')
return;
}
@@ -194,7 +212,7 @@
ElMessage.error('璇疯緭鍏ョ敓浜ф暟閲�')
return;
}
- formData.userId = formData.otherData.surfaceCopperPasteUserId || formData.otherData.underlyingCopperPasteUserId;
+ formData.userId = formData.otherData.stirredMillIncludesMixing.userId || formData.otherData.stirredMill.userId || formData.otherData.burningMaterial.userId || formData.otherData.granulationB.userId;
const otherData = JSON.stringify(formData.otherData);
const submitData = {
@@ -216,10 +234,29 @@
});
};
+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;
+ if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") {
+ applyBomInputWeight();
+ }
} else {
const row = props.row;
formData.planQuantity = row.planQuantity
@@ -227,8 +264,32 @@
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;
@@ -535,7 +596,7 @@
<span v-else class="view-value">{{ displayValue(formData.otherData.burningMaterial.calcinationWeight) }}</span>
<span>KG</span>
</td>
- <td class="label" colspan="2" rowspan="3">
+ <td class="label" colspan="2" rowspan="2">
<span>纭浜�:</span>
<el-select v-model="formData.otherData.burningMaterial.confirmId"
v-if="props.isEdit"
@@ -707,7 +768,190 @@
<span v-else class="view-value">{{ displayValue(formData.otherData.stirredMill.confirmName || formData.otherData.stirredMill.confirmId) }}</span>
</td>
</tr>
- <!-- todo鎼呮媽琛屽紑濮嬶紝纭浜鸿鐣欑┖锛屽凡鍦ㄤ笂闈㈣〃鏍奸鐣� -->
+ <tr>
+ <td class="label" colspan="2" rowspan="2">鎼呮媽</td>
+ <td class="label" colspan="4">
+ <span>寮�濮嬫椂闂达細</span>
+ <el-date-picker
+ v-if="props.isEdit"
+ v-model="formData.otherData.stir.startTime"
+ type="datetime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%"
+ />
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.startTime) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>缁撴潫鏃堕棿锛�</span>
+ <el-date-picker
+ v-if="props.isEdit"
+ v-model="formData.otherData.stir.endTime"
+ type="datetime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%"
+ />
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.endTime) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>閲嶉噺姣旓紙姘�/鏂欙級锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.stir.weightRatio" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.weightRatio) }}</span>
+ </td>
+ </tr>
+ <tr>
+ <td class="label" colspan="4">
+ <span>PVA绮樺悎鍓傞噸閲� 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.stir.pva" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.pva) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>鍒嗘暎鍓傞噸閲� 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.stir.dispersantWeight" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.dispersantWeight) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>鑴辨ā鍓傞噸閲� 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.stir.releaseAgentWeight" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.stir.releaseAgentWeight) }}</span>
+ </td>
+ </tr>
+ <tr>
+ <td class="label" colspan="2" rowspan="5">閫犵矑</td>
+ <td class="label" colspan="6">
+ <span>寮�濮嬫椂闂达細</span>
+ <el-date-picker
+ v-if="props.isEdit"
+ v-model="formData.otherData.granulationB.startTime"
+ type="datetime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%"
+ />
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.startTime) }}</span>
+ </td>
+ <td class="label" colspan="6">
+ <span>缁撴潫鏃堕棿锛�</span>
+ <el-date-picker
+ v-if="props.isEdit"
+ v-model="formData.otherData.granulationB.endTime"
+ type="datetime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%"
+ />
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.endTime) }}</span>
+ </td>
+ <td class="label" colspan="2" rowspan="2">
+ <span>浣滀笟鍛�:</span>
+ <el-select v-model="formData.otherData.granulationB.userId"
+ v-if="props.isEdit"
+ style="width: 100%"
+ placeholder="璇烽�夋嫨浣滀笟鍛�"
+ clearable
+ filterable
+ @change="handleUserChange($event, 'granulationBUserId')">
+ <el-option v-for="user in userOptions"
+ :key="user.userId"
+ :label="user.userName"
+ :value="user.userId"/>
+ </el-select>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.userName || formData.otherData.granulationB.userId) }}</span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="label" colspan="4">
+ <span>闆惧寲鍣ㄨ浆閫� 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.atomizerRotationalSpeed" placeholder="璇疯緭鍏�">
+ <template #append>r/min</template>
+ </el-input>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.atomizerRotationalSpeed) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>杩涘彛閫熷害 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.importSpeed" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.importSpeed) }}</span>
+ </td>
+ <td class="label" colspan="4">
+ <span>鍑哄彛閫熷害 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.outSpeed" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.outSpeed) }}</span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="12">
+ <span>鎶曞叆閲嶉噺(KG)/鏁伴噺锛�</span>
+ <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>
+ <td class="label" colspan="6">
+ <span>浜у嚭鎬绘暟 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.quantity" placeholder="璇疯緭鍏�">
+ <template #append>KG</template>
+ </el-input>
+ <span v-else class="view-value">{{ displayValue(formData.quantity) }}</span>
+ </td>
+ <td class="label" colspan="6">
+ <span>鍚堟牸閲嶉噺 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.qualifiedWeight" placeholder="璇疯緭鍏�">
+ <template #append>KG</template>
+ </el-input>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.qualifiedWeight) }}</span>
+ </td>
+ <td class="label" colspan="2" rowspan="2">
+ <span>纭浜�:</span>
+ <el-select v-model="formData.otherData.granulationB.confirmId"
+ v-if="props.isEdit"
+ style="width: 100%"
+ placeholder="璇烽�夋嫨纭浜�"
+ clearable
+ filterable
+ @change="handleUserChange($event, 'granulationBConfirmId')">
+ <el-option v-for="user in userOptions"
+ :key="user.userId"
+ :label="user.userName"
+ :value="user.userId"/>
+ </el-select>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.confirmName || formData.otherData.granulationB.confirmId) }}</span>
+ </td>
+ </tr>
+ <tr>
+ <td class="label" colspan="6">
+ <span>灏炬枡 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.wasteMaterials" placeholder="璇疯緭鍏�">
+ <template #append>KG</template>
+ </el-input>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.wasteMaterials) }}</span>
+ </td>
+ <td class="label" colspan="6">
+ <span>澹佹枡 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.granulationB.wallMaterial" placeholder="璇疯緭鍏�">
+ <template #append>KG</template>
+ </el-input>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.granulationB.wallMaterial) }}</span>
+ </td>
+ </tr>
+ <tr>
+ <td class="label" colspan="16">
+ <span>澶囨敞 锛�</span>
+ <el-input v-if="props.isEdit" v-model="formData.otherData.remark" placeholder="璇疯緭鍏�"/>
+ <span v-else class="view-value">{{ displayValue(formData.otherData.remark) }}</span>
+ </td>
+ </tr>
</tbody>
</table>
</el-form>
--
Gitblit v1.9.3