| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import {computed, onMounted, reactive, ref} from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addProductMain} from "@/api/productionManagement/workOrder.js"; |
| | | |
| | | defineOptions({ |
| | | name: "CopperPrintingForm" |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | isShow: { |
| | | type: Boolean, |
| | | required: true |
| | | }, |
| | | isEdit: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | detailData: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | } |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:isShow", "refreshData"]); |
| | | |
| | | const visible = computed({ |
| | | get: () => props.isShow, |
| | | set: (value: boolean) => emits("update:isShow", value), |
| | | }); |
| | | |
| | | const formData = reactive({ |
| | | productProcessRouteItemId: undefined, |
| | | workOrderId: undefined, |
| | | planQuantity: undefined, |
| | | reportWork: undefined, |
| | | productMainId: undefined, |
| | | quantity: undefined, // ç§éäº§åºæ¿ |
| | | userId: undefined, // ä½ä¸å |
| | | userName: undefined, // ä½ä¸å |
| | | otherData: { |
| | | dryingTemperature: '', // ç干温度 |
| | | startTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), // å¼å§æ¶é´ |
| | | endTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), // ç»ææ¶é´ |
| | | userId: undefined, // ä½ä¸å |
| | | userName: undefined, // ä½ä¸å |
| | | underlyingCopperPaste: undefined, // åºå±éæµ |
| | | underlyingCopperPastePrintingQuantity: undefined, // åºå±éæµå°å·æ¬¡æ° |
| | | underlyingCopperPasteMachineNumber: undefined, // åºå±éæµæºå°å· |
| | | underlyingCopperPasteSilkScreenFamilyNumber: undefined, // åºå±éæµä¸ç½æå· |
| | | underlyingCopperPasteNumberOfEyes: undefined, // åºå±éæµç®æ° |
| | | underlyingCopperPasteUserId: undefined, // åºå±éæµä½ä¸å |
| | | underlyingCopperPasteUserName: undefined, // åºå±éæµä½ä¸å |
| | | underlyingCopperPasteDryingTemperature: undefined, // åºå±éæµç干温度 |
| | | surfaceCopperPaste: undefined, // 表å±éæµ |
| | | surfaceCopperPastePrintingQuantity: undefined, // 表å±éæµå°å·æ¬¡æ° |
| | | surfaceCopperPasteMachineNumber: undefined, // 表å±éæµæºå°å· |
| | | surfaceCopperPasteSilkScreenFamilyNumber: undefined, // 表å±éæµä¸ç½æå· |
| | | surfaceCopperPasteNumberOfEyes: undefined, // 表å±éæµç®æ° |
| | | surfaceCopperPasteUserId: undefined, // 表å±éæµä½ä¸å |
| | | surfaceCopperPasteUserName: undefined, // 表å±éæµä½ä¸å |
| | | surfaceCopperPasteDryingTemperature: undefined, // 表å±éæµç干温度, |
| | | steelBurningDate: undefined, // ç§é¢æ¥æ |
| | | copperFiringTime: undefined, // ç§éè¿çæ¶é´ |
| | | steelFiringTime: undefined, // ç§é¢åºçæ¶é´ |
| | | weight: undefined, // ééï¼kg/posï¼ |
| | | copperSmeltingTemperatureProfile: undefined, // ç§é温度æ²çº¿ |
| | | remark: undefined, // 夿³¨ |
| | | } |
| | | }) |
| | | |
| | | const userOptions = ref([]); |
| | | const getUserList = () => { |
| | | userListNoPageByTenantId() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | userOptions.value = res.data || []; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·åç¨æ·å表失败", err); |
| | | }); |
| | | }; |
| | | // ç¨æ·éæ©ååæ¶æ´æ° userName |
| | | const handleUserChange = (userId: any, reportType: string) => { |
| | | if (userId) { |
| | | const selectedUser = userOptions.value.find(user => user.userId === userId); |
| | | |
| | | switch (reportType) { |
| | | case 'userId': |
| | | formData.otherData.userName = selectedUser.userName; |
| | | break; |
| | | case 'underlyingCopperPasteUserId': |
| | | formData.otherData.underlyingCopperPasteUserName = selectedUser.userName; |
| | | break; |
| | | case 'surfaceCopperPasteUserId': |
| | | formData.otherData.surfaceCopperPasteUserName = selectedUser.userName; |
| | | break; |
| | | } |
| | | } else { |
| | | switch (reportType) { |
| | | case 'userId': |
| | | formData.otherData.userName = ""; |
| | | break; |
| | | case 'underlyingCopperPasteUserId': |
| | | formData.otherData.underlyingCopperPasteUserName = ""; |
| | | break; |
| | | case 'surfaceCopperPasteUserId': |
| | | formData.otherData.surfaceCopperPasteUserName = ""; |
| | | break; |
| | | } |
| | | } |
| | | }; |
| | | const handleReport = () => { |
| | | if (!formData.otherData.userId && !formData.otherData.surfaceCopperPasteUserId && !formData.otherData.underlyingCopperPasteUserId) { |
| | | ElMessage.error('è¯·éæ©ä½ä¸å') |
| | | return; |
| | | } |
| | | if (!formData.quantity || formData.quantity <= 0) { |
| | | ElMessage.error('请è¾å
¥ç产æ°é') |
| | | return; |
| | | } |
| | | formData.userId = formData.otherData.surfaceCopperPasteUserId || formData.otherData.underlyingCopperPasteUserId; |
| | | |
| | | const otherData = JSON.stringify(formData.otherData); |
| | | const submitData = { |
| | | ...formData, |
| | | otherData: otherData |
| | | }; |
| | | |
| | | addProductMain(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage({ |
| | | message: 'æ¥å·¥æå', |
| | | type: 'success', |
| | | }) |
| | | emits("refreshData") |
| | | visible.value = false; |
| | | } else { |
| | | ElMessage.error('æ¥å·¥å¤±è´¥') |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const initData = () => { |
| | | if (!props.isEdit) { |
| | | formData.otherData = JSON.parse(props.detailData.otherData || '{}'); |
| | | formData.quantity = props.detailData.quantity; |
| | | } else { |
| | | const row = props.row; |
| | | formData.planQuantity = row.planQuantity |
| | | formData.productProcessRouteItemId = row.productProcessRouteItemId |
| | | formData.workOrderId = row.id |
| | | formData.reportWork = row.reportWork |
| | | formData.productMainId = row.productMainId |
| | | } |
| | | } |
| | | |
| | | const displayValue = (value: any) => { |
| | | return value === undefined || value === null || value === "" ? "-" : value; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getUserList(); |
| | | initData() |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <el-dialog v-model="visible" |
| | | title="å°éæ¥å·¥" |
| | | width="90%"> |
| | | <el-form :model="formData"> |
| | | <table class="report-table"> |
| | | <tbody> |
| | | <tr> |
| | | <td class="tip" colspan="4">ç·çæ¸
æ´åæ¾ç½®æ¶é´è¶
è¿72Hï¼éæ°ççåæè½å°å·å¹¶å¡«åæ¬æ </td> |
| | | <td class="label" colspan="3">ç干温度</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.dryingTemperature" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.dryingTemperature) }}</span> |
| | | </td> |
| | | <td class="label">å¼å§æ¶é´</td> |
| | | <td colspan="2"> |
| | | <el-date-picker |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.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.startTime) }}</span> |
| | | </td> |
| | | <td class="label" colspan="3">ç»ææ¶é´</td> |
| | | <td colspan="2"> |
| | | <el-date-picker |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.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.endTime) }}</span> |
| | | </td> |
| | | <td class="label" colspan="2">ä½ä¸å</td> |
| | | <td colspan="2"> |
| | | <el-select v-model="formData.otherData.userId" |
| | | v-if="props.isEdit" |
| | | style="width: 100%" |
| | | placeholder="è¯·éæ©ä½ä¸å" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange($event, 'userId')"> |
| | | <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.userName || formData.otherData.userId) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">åºå±éæµ</td> |
| | | <td> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPaste" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPaste) }}</span> |
| | | </td> |
| | | <td class="label">å°å·æ¬¡æ°</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPastePrintingQuantity" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPastePrintingQuantity) }}</span> |
| | | </td> |
| | | <td class="label">æºå°å·</td> |
| | | <td> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteMachineNumber" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteMachineNumber) }}</span> |
| | | </td> |
| | | <td class="label">ä¸ç½æå·</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteSilkScreenFamilyNumber" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteSilkScreenFamilyNumber) }}</span> |
| | | </td> |
| | | <td class="label">ç®æ°</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteNumberOfEyes" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteNumberOfEyes) }}</span> |
| | | </td> |
| | | <td class="label">ä½ä¸å</td> |
| | | <td colspan="2"> |
| | | <el-select v-model="formData.otherData.underlyingCopperPasteUserId" |
| | | v-if="props.isEdit" |
| | | style="width: 100%" |
| | | placeholder="è¯·éæ©ä½ä¸å" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange($event, 'underlyingCopperPasteUserId')"> |
| | | <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.underlyingCopperPasteUserName || formData.otherData.underlyingCopperPasteUserId) }}</span> |
| | | </td> |
| | | <td class="label" colspan="2">ç干温度</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.underlyingCopperPasteDryingTemperature" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.underlyingCopperPasteDryingTemperature) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">表å±éæµ</td> |
| | | <td> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPaste" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPaste) }}</span> |
| | | </td> |
| | | <td class="label">å°å·æ¬¡æ°</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPastePrintingQuantity" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPastePrintingQuantity) }}</span> |
| | | </td> |
| | | <td class="label">æºå°å·</td> |
| | | <td> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteMachineNumber" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteMachineNumber) }}</span> |
| | | </td> |
| | | <td class="label">ä¸ç½æå·</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteSilkScreenFamilyNumber" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteSilkScreenFamilyNumber) }}</span> |
| | | </td> |
| | | <td class="label">ç®æ°</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteNumberOfEyes" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteNumberOfEyes) }}</span> |
| | | </td> |
| | | <td class="label">ä½ä¸å</td> |
| | | <td colspan="2"> |
| | | <el-select v-model="formData.otherData.surfaceCopperPasteUserId" |
| | | v-if="props.isEdit" |
| | | style="width: 100%" |
| | | placeholder="è¯·éæ©ä½ä¸å" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange($event, 'surfaceCopperPasteUserId')"> |
| | | <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.surfaceCopperPasteUserName || formData.otherData.surfaceCopperPasteUserId) }}</span> |
| | | </td> |
| | | <td class="label" colspan="2">ç干温度</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.surfaceCopperPasteDryingTemperature" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.surfaceCopperPasteDryingTemperature) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">ç§é¢æ¥æ</td> |
| | | <td colspan="2"> |
| | | <el-date-picker |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.steelBurningDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©" |
| | | style="width: 100%" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.steelBurningDate) }}</span> |
| | | </td> |
| | | <td class="label" colspan="3">ç§éè¿çæ¶é´</td> |
| | | <td colspan="2"> |
| | | <el-date-picker |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.copperFiringTime" |
| | | 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.copperFiringTime) }}</span> |
| | | </td> |
| | | <td class="label">ç§é¢åºçæ¶é´</td> |
| | | <td colspan="2"> |
| | | <el-date-picker |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.steelFiringTime" |
| | | 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.steelFiringTime) }}</span> |
| | | </td> |
| | | <td class="label" colspan="3">ç§éäº§åºæ¿</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.quantity" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.quantity) }}</span> |
| | | </td> |
| | | <td class="label" colspan="2">éé(kg/pos)</td> |
| | | <td colspan="2"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.weight" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.weight) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">ç§é温度æ²çº¿</td> |
| | | <td colspan="7"> |
| | | <el-input |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.copperSmeltingTemperatureProfile" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.copperSmeltingTemperatureProfile) }}</span> |
| | | </td> |
| | | <td class="label">夿³¨</td> |
| | | <td colspan="11"> |
| | | <el-input v-if="props.isEdit" v-model="formData.otherData.remark" type="textarea" :rows="3" placeholder="请è¾å
¥"/> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.remark) }}</span> |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button v-if="props.isEdit" type="primary" |
| | | @click="handleReport">ç¡®å®</el-button> |
| | | <el-button @click="visible = false">{{ props.isEdit ? "åæ¶" : "å
³é" }}</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .report-table { |
| | | width: 100%; |
| | | border-collapse: collapse; |
| | | table-layout: fixed; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .report-table td { |
| | | border: 1px solid #dcdfe6; |
| | | padding: 6px; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | .report-table .label { |
| | | width: 90px; |
| | | background: #f5f7fa; |
| | | text-align: center; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .report-table .tip { |
| | | text-align: center; |
| | | font-weight: 500; |
| | | line-height: 1.4; |
| | | background: #fafafa; |
| | | } |
| | | |
| | | .view-value { |
| | | display: inline-block; |
| | | min-height: 32px; |
| | | line-height: 32px; |
| | | } |
| | | </style> |