| | |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js"; |
| | | import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js"; |
| | | import {ledgerListNoPage} from "@/api/salesManagement/salesLedger.js"; |
| | | import {ledgerListNoPage, productList} from "@/api/salesManagement/salesLedger.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | |
| | |
| | | salesContractNo: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | process: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkTime: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | process: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkName: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | productId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | testStandardId: [{ required: false, message: "è¯·éæ©ææ ", trigger: "change" }], |
| | | unit: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkResult: [{ required: true, message: "请è¾å
¥", trigger: "change" }], |
| | | checkResult: [{ required: false, message: "请è¾å
¥", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | |
| | | form.value = {} |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | | |
| | | // æ°å¢æ¨¡å¼ä¸ï¼é»è®¤è®¾ç½®äº§åå称为"马éè¯éªè±ç²"(id=320) |
| | | if (operationType.value === 'add') { |
| | | const defaultProductId = 320; |
| | | form.value.productId = defaultProductId; |
| | | currentProductId.value = defaultProductId; |
| | | form.value.productName = '马éè¯éªè±ç²'; |
| | | // å è½½è§æ ¼åå·å表 |
| | | try { |
| | | const modelRes = await modelList({ id: defaultProductId }); |
| | | modelOptions.value = modelRes || []; |
| | | // é»è®¤éä¸ç¬¬ä¸ä¸ªè§æ ¼åå· |
| | | if (modelOptions.value.length > 0) { |
| | | const firstModel = modelOptions.value[0]; |
| | | form.value.productModelId = firstModel.id; |
| | | form.value.model = firstModel.model || ''; |
| | | form.value.unit = firstModel.unit || ''; |
| | | } |
| | | // å è½½ææ é项 |
| | | getList(); |
| | | } catch (e) { |
| | | console.error('å è½½é»è®¤äº§åè§æ ¼åå·å¤±è´¥', e); |
| | | } |
| | | } |
| | | |
| | | if (operationType.value === 'edit' || operationType.value === 'view') { |
| | | // å
ä¿å testStandardIdï¼é¿å
被æ¸
空 |
| | |
| | | } |
| | | |
| | | // éå®è®¢åéæ©ååå¤ç |
| | | const handleSalesLedgerChange = (value) => { |
| | | const handleSalesLedgerChange = async (value) => { |
| | | const selectedItem = salesLedgerOptions.value.find(item => item.id == value); |
| | | if (selectedItem) { |
| | | form.value.salesContractNo = selectedItem.salesContractNo || ''; |
| | | // æ ¹æ®éå®è®¢åIDæ¥è¯¢äº§åä¿¡æ¯ï¼åªèµå¼æ°é |
| | | try { |
| | | const res = await productList({ salesLedgerId: value, type: 1 }); |
| | | const productData = res.data && res.data.length > 0 ? res.data[0] : null; |
| | | if (productData) { |
| | | // åªèªå¨å¸¦å
¥æ°é |
| | | form.value.quantity = productData.quantity || 0; |
| | | } |
| | | } catch (e) { |
| | | console.error('æ¥è¯¢éå®è®¢å产åä¿¡æ¯å¤±è´¥', e); |
| | | proxy.$modal.msgError('æ¥è¯¢éå®è®¢å产åä¿¡æ¯å¤±è´¥'); |
| | | } |
| | | } else { |
| | | form.value.salesContractNo = ''; |
| | | form.value.quantity = undefined; |
| | | } |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | title="å¿«éæ£éª" |
| | | width="70%" |
| | | @close="closeDialog" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµç»æï¼" prop="checkResult"> |
| | | <el-select v-model="form.checkResult" placeholder="è¯·éæ©æ£æµç»æ" style="width: 100%" @change="handleCheckResultChange"> |
| | | <el-option label="åæ ¼" value="åæ ¼" /> |
| | | <el-option label="ä¸åæ ¼" value="ä¸åæ ¼" /> |
| | | <el-option label="é¨ååæ ¼" value="é¨ååæ ¼" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ éæ©ï¼" prop="testStandardId"> |
| | | <el-select v-model="form.testStandardId" placeholder="è¯·éæ©ææ " style="width: 100%" @change="handleTestStandardChange"> |
| | | <el-option |
| | | v-for="item in testStandardOptions" |
| | | :key="item.id" |
| | | :label="item.standardName || item.standardNo" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <template v-if="form.checkResult"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°éï¼" prop="quantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="请è¾å
¥æ°é" clearable :precision="2" @change="handleQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµåä½ï¼" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请è¾å
¥æ£æµåä½" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åæ ¼æ°éï¼" prop="qualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="请è¾å
¥åæ ¼æ°é" clearable :precision="2" @change="handleQualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸åæ ¼æ°éï¼" prop="unqualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.unqualifiedQuantity" placeholder="请è¾å
¥ä¸åæ ¼æ°é" clearable :precision="2" @change="handleUnqualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªåï¼" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©æ£éªå" clearable style="width: 100%"> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµæ¥æï¼" prop="checkTime"> |
| | | <el-date-picker |
| | | v-model="form.checkTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ£æµæ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | | </el-form> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :tableLoading="tableLoading" |
| | | height="400" |
| | | > |
| | | <template #slot="{ row }"> |
| | | <el-input v-model="row.testValue" clearable/> |
| | | </template> |
| | | </PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { batchQuickInspect } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import { qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(['close', 'success']); |
| | | |
| | | const dialogVisible = ref(false); |
| | | const userList = ref([]); |
| | | const selectedIds = ref([]); |
| | | const selectedRows = ref([]); |
| | | const testStandardOptions = ref([]); |
| | | const inspectType = ref(2); // åºåæ£éªç±»å |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }, |
| | | rules: { |
| | | checkResult: [{ required: true, message: "è¯·éæ©æ£æµç»æ", trigger: "change" }], |
| | | testStandardId: [{ required: true, message: "è¯·éæ©ææ ", trigger: "change" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥æ°é", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请è¾å
¥åæ ¼æ°é", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请è¾å
¥ä¸åæ ¼æ°é", trigger: "blur" }], |
| | | checkCompany: [{ required: true, message: "请è¾å
¥æ£æµåä½", trigger: "blur" }], |
| | | checkName: [{ required: true, message: "è¯·éæ©æ£éªå", trigger: "change" }], |
| | | checkTime: [{ required: true, message: "è¯·éæ©æ£æµæ¥æ", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ææ ", |
| | | prop: "parameterItem", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | }, |
| | | { |
| | | label: "å
æ§å¼", |
| | | prop: "controlValue", |
| | | }, |
| | | { |
| | | label: "æ£éªå¼", |
| | | prop: "testValue", |
| | | dataType: 'slot', |
| | | slot: 'slot', |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = async (ids, rows) => { |
| | | selectedIds.value = ids; |
| | | selectedRows.value = rows; |
| | | dialogVisible.value = true; |
| | | |
| | | // å è½½ç¨æ·å表 |
| | | const userListsRes = await userListNoPage(); |
| | | userList.value = userListsRes.data; |
| | | |
| | | // å è½½ææ éé¡¹ï¼æ ¹æ®ç¬¬ä¸ä¸ªéä¸è¡ç产åIDï¼ |
| | | if (rows && rows.length > 0 && rows[0].productId) { |
| | | const params = { |
| | | productId: rows[0].productId, |
| | | inspectType: 2 |
| | | }; |
| | | const res = await qualityInspectDetailByProductId(params); |
| | | testStandardOptions.value = res.data || []; |
| | | } else { |
| | | testStandardOptions.value = []; |
| | | } |
| | | |
| | | // é置表å |
| | | form.value = { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }; |
| | | tableData.value = []; |
| | | |
| | | await nextTick(); |
| | | proxy.$refs.formRef?.clearValidate(); |
| | | }; |
| | | |
| | | // ææ éæ©ååå¤ç |
| | | const handleTestStandardChange = async (testStandardId) => { |
| | | if (!testStandardId) { |
| | | tableData.value = []; |
| | | return; |
| | | } |
| | | tableLoading.value = true; |
| | | try { |
| | | const res = await getQualityTestStandardParamByTestStandardId(testStandardId); |
| | | tableData.value = (res.data || []).map(item => ({ |
| | | ...item, |
| | | id: null, |
| | | testValue: '' |
| | | })); |
| | | } catch (error) { |
| | | console.error('è·åæ ååæ°å¤±è´¥:', error); |
| | | tableData.value = []; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ£æµç»æååå¤ç |
| | | const handleCheckResultChange = (value) => { |
| | | if (value === 'åæ ¼') { |
| | | // åæ ¼æ¶ï¼åæ ¼æ°éçäºæ°éï¼ä¸åæ ¼æ°é为0 |
| | | form.value.qualifiedQuantity = form.value.quantity || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (value === 'ä¸åæ ¼') { |
| | | // ä¸åæ ¼æ¶ï¼åæ ¼æ°é为0ï¼ä¸åæ ¼æ°éçäºæ°é |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = form.value.quantity || 0; |
| | | } |
| | | }; |
| | | |
| | | // æ°éååå¤ç |
| | | const handleQuantityChange = (value) => { |
| | | if (form.value.checkResult === 'åæ ¼') { |
| | | form.value.qualifiedQuantity = value || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (form.value.checkResult === 'ä¸åæ ¼') { |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = value || 0; |
| | | } |
| | | }; |
| | | |
| | | // åæ ¼æ°éååå¤ç |
| | | const handleQualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.qualifiedQuantity = quantity; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else { |
| | | form.value.unqualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // ä¸åæ ¼æ°éååå¤ç |
| | | const handleUnqualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("ä¸åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.unqualifiedQuantity = quantity; |
| | | form.value.qualifiedQuantity = 0; |
| | | } else { |
| | | form.value.qualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // æ ¹æ®åæ ¼/ä¸åæ ¼æ°éæ´æ°æ£æµç»æ |
| | | const updateCheckResult = () => { |
| | | const qualified = form.value.qualifiedQuantity || 0; |
| | | const unqualified = form.value.unqualifiedQuantity || 0; |
| | | const quantity = form.value.quantity || 0; |
| | | |
| | | if (qualified === quantity && unqualified === 0) { |
| | | form.value.checkResult = 'åæ ¼'; |
| | | } else if (unqualified === quantity && qualified === 0) { |
| | | form.value.checkResult = 'ä¸åæ ¼'; |
| | | } else if (qualified > 0 && unqualified > 0) { |
| | | form.value.checkResult = 'é¨ååæ ¼'; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate((valid) => { |
| | | if (valid) { |
| | | const data = { |
| | | ids: selectedIds.value, |
| | | inspectType: inspectType.value, |
| | | ...form.value, |
| | | paramList: tableData.value |
| | | }; |
| | | batchQuickInspect(data).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | emit('success'); |
| | | closeDialog(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | emit('close'); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
| | |
| | | @close="handleQuery"></FormDia> |
| | | <files-dia ref="filesDia" |
| | | @close="handleQuery"></files-dia> |
| | | <QuickCheckDia ref="quickCheckDia" |
| | | @close="handleQuery" |
| | | @success="getList"></QuickCheckDia> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | title="ç¼è¾æ£éªå" |
| | | width="30%" |
| | |
| | | } from "vue"; |
| | | import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue"; |
| | | import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue"; |
| | | import QuickCheckDia from "@/views/qualityManagement/finalInspection/components/quickCheckDia.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { |
| | | downloadQualityInspect, |
| | |
| | | qualityInspectListPage, |
| | | qualityInspectUpdate, |
| | | submitQualityInspect, |
| | | batchQuickInspect, |
| | | } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue"; |
| | | import dayjs from "dayjs"; |
| | |
| | | const formDia = ref(); |
| | | const filesDia = ref(); |
| | | const inspectionFormDia = ref(); |
| | | const quickCheckDia = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | const userList = ref([]); |
| | |
| | | return; |
| | | } |
| | | |
| | | const totalCount = selectedRows.value.length; |
| | | const submittedCount = totalCount - unSubmittedRows.length; |
| | | |
| | | let confirmMessage = `已鿩 ${totalCount} æ¡æ£éªå`; |
| | | if (submittedCount > 0) { |
| | | confirmMessage += `ï¼å
¶ä¸ ${submittedCount} æ¡å·²æäº¤ï¼å°èªå¨è·³è¿ï¼`; |
| | | } |
| | | confirmMessage += `\n\n确认åå°èªå¨ï¼\n· æ£éªç»æè®¾ä¸º"åæ ¼"\n· åæ ¼æ°éè®¾ä¸ºæ»æ°\n· ä¸åæ ¼æ°é设为 0\n· æäº¤å¹¶å
¥åº`; |
| | | |
| | | ElMessageBox.confirm(confirmMessage, "å¿«éæ£éª", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | dangerouslyUseHTMLString: false, |
| | | }) |
| | | .then(() => { |
| | | // è°ç¨æ¹éå¿«éæ£éªæ¥å£ |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | batchQuickInspect(ids).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | quickCheckDia.value?.openDialog(ids, unSubmittedRows); |
| | | }; |
| | | |
| | | // æå¼æ°å¢æ£éªå¼¹æ¡ |
| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="closeBindingDialog">åæ¶</el-button> |
| | | <el-button type="primary" @click="submitBinding">ç¡®å®</el-button> |
| | | <el-button @click="closeBindingDialog">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | formatData: (val) => { |
| | | const map = { 0: 'åæææ£éª', 1: 'è¿ç¨æ£éª', 2: 'åºåæ£éª' } |
| | | return map[val] || val |
| | | } |
| | | }, |
| | | { |
| | | label: 'å·¥åº', |
| | | prop: 'processId', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const target = processOptions.value.find( |
| | | (item) => String(item.value) === String(val) |
| | | ) |
| | | return target?.label || val |
| | | } |
| | | }, |
| | | { |
| | |
| | | <el-option label="åºåæ£éª" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åº" prop="processId"> |
| | | <el-select v-model="form.processId" placeholder="è¯·éæ©å·¥åº" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in processOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="state"> |
| | | <el-select v-model="form.state" placeholder="è¯·éæ©ç¶æ" style="width: 100%"> |
| | | <el-option label="è稿" value="0" /> |
| | |
| | | |
| | | const formRef = ref(null) |
| | | |
| | | const computedTitle = computed(() => { |
| | | const computedTitle = computed(() => { |
| | | if (props.operationType === 'edit') return 'ç¼è¾æ£æµæ å' |
| | | if (props.operationType === 'copy') return 'å¤å¶æ£æµæ å' |
| | | return 'æ°å¢æ£æµæ å' |
| | |
| | | } |
| | | }, |
| | | { |
| | | label: 'å·¥åº', |
| | | prop: 'processId', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const target = processOptions.value.find( |
| | | (item) => String(item.value) === String(val) |
| | | ) |
| | | return target?.label || val |
| | | } |
| | | }, |
| | | { |
| | | label: 'ç¶æ', |
| | | prop: 'state', |
| | | headerSlot: 'stateHeader', |
| | |
| | | ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¥åºï¼" |
| | | prop="process"> |
| | | <el-select v-model="form.process" |
| | | placeholder="è¯·éæ©å·¥åº" |
| | | <el-form-item label="éè´ååå·ï¼" |
| | | prop="purchaseContractNo"> |
| | | <el-select v-model="form.purchaseContractNo" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | :disabled="isViewMode || processQuantityDisabled" |
| | | filterable |
| | | :disabled="isViewMode" |
| | | style="width: 100%"> |
| | | <el-option v-for="item in processList" |
| | | :key="item.name" |
| | | :label="item.name" |
| | | :value="item.name" /> |
| | | <el-option v-for="item in purchaseContractList" |
| | | :key="item.id" |
| | | :label="item.purchaseContractNo" |
| | | :value="item.purchaseContractNo" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | getCurrentInstance, |
| | | nextTick, |
| | | } from "vue"; |
| | | import { getOptions } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getOptions, getSalesNo } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { |
| | | qualityInspectAdd, |
| | |
| | | } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { qualityInspectParamInfo } from "@/api/qualityManagement/qualityInspectParam.js"; |
| | | import { list } from "@/api/productionManagement/productionProcess"; |
| | | |
| | | import qualified from "@/views/inventoryManagement/stockManagement/Qualified.vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(["close"]); |
| | |
| | | const data = reactive({ |
| | | form: { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | purchaseContractNo: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | process: [{ required: true, message: "è¯·éæ©å·¥åº", trigger: "change" }], |
| | | checkTime: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkName: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | productId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | testStandardId: [{ required: false, message: "è¯·éæ©ææ ", trigger: "change" }], |
| | | unit: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkResult: [{ required: true, message: "请è¾å
¥", trigger: "change" }], |
| | | purchaseContractNo: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | checkResult: [{ required: false, message: "请è¾å
¥", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const userList = ref([]); |
| | |
| | | const v = form.value || {}; |
| | | return !!(v.productMainId != null || v.purchaseLedgerId != null); |
| | | }); |
| | | const processList = ref([]); // å·¥åºä¸æå表ï¼å·¥åºåç§° nameï¼ |
| | | |
| | | const supplierList = ref([]); |
| | | const productOptions = ref([]); |
| | | const purchaseContractList = ref([]); // éè´ååå·å表 |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ææ ", |
| | |
| | | getOptions().then(res => { |
| | | supplierList.value = res.data; |
| | | }); |
| | | // å 载工åºä¸æå表 |
| | | try { |
| | | const res = await list({ size: -1, current: -1 }); |
| | | processList.value = res.data.records || []; |
| | | } catch (e) { |
| | | console.error("å 载工åºå表失败", e); |
| | | processList.value = []; |
| | | } |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | // å
éç½®è¡¨åæ°æ®ï¼ä¿æåæ®µå®æ´ï¼é¿å
å¼¹çªé¦æ¬¡æ¸²ææ¶è§¦åå¿
填红æ¡âéªä¸ä¸âï¼ |
| | | // å è½½éè´ååå·å表 |
| | | try { |
| | | const contractRes = await getSalesNo(); |
| | | purchaseContractList.value = contractRes || []; |
| | | } catch (e) { |
| | | console.error("å è½½éè´ååå·å¤±è´¥", e); |
| | | purchaseContractList.value = []; |
| | | } |
| | | // å
éç½®è¡¨åæ°æ®ï¼ä¿æåæ®µå®æ´ï¼é¿å
å¼¹çªé¦æ¬¡æ¸²ææ¶è§¦åå¿
填红æ¡"éªä¸ä¸"ï¼ |
| | | form.value = { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | purchaseContractNo: "", |
| | | }; |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | |
| | | let params = { |
| | | productId: currentProductId.value, |
| | | inspectType: 1, |
| | | process: form.value.process || "", |
| | | }; |
| | | qualityInspectDetailByProductId(params).then(res => { |
| | | testStandardOptions.value = res.data || []; |
| | |
| | | return; |
| | | } |
| | | |
| | | // æ ¹æ®éè´ååå·æ¥æ¾å¯¹åºç purchaseLedgerId |
| | | const selectedContract = purchaseContractList.value.find( |
| | | item => item.purchaseContractNo === form.value.purchaseContractNo |
| | | ); |
| | | const purchaseLedgerId = selectedContract ? selectedContract.id : null; |
| | | |
| | | const data = { |
| | | ...form.value, |
| | | process: processName, // ä¿ç process åæ®µä»¥å
¼å®¹å端 |
| | | purchaseLedgerId: purchaseLedgerId, // æäº¤ purchaseLedgerId |
| | | qualityInspectParams: tableData.value, |
| | | }; |
| | | if (operationType.value === "add") { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | title="å¿«éæ£éª" |
| | | width="70%" |
| | | @close="closeDialog" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµç»æï¼" prop="checkResult"> |
| | | <el-select v-model="form.checkResult" placeholder="è¯·éæ©æ£æµç»æ" style="width: 100%" @change="handleCheckResultChange"> |
| | | <el-option label="åæ ¼" value="åæ ¼" /> |
| | | <el-option label="ä¸åæ ¼" value="ä¸åæ ¼" /> |
| | | <el-option label="é¨ååæ ¼" value="é¨ååæ ¼" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ éæ©ï¼" prop="testStandardId"> |
| | | <el-select v-model="form.testStandardId" placeholder="è¯·éæ©ææ " style="width: 100%" @change="handleTestStandardChange"> |
| | | <el-option |
| | | v-for="item in testStandardOptions" |
| | | :key="item.id" |
| | | :label="item.standardName || item.standardNo" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <template v-if="form.checkResult"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°éï¼" prop="quantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="请è¾å
¥æ°é" clearable :precision="2" @change="handleQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµåä½ï¼" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请è¾å
¥æ£æµåä½" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åæ ¼æ°éï¼" prop="qualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="请è¾å
¥åæ ¼æ°é" clearable :precision="2" @change="handleQualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸åæ ¼æ°éï¼" prop="unqualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.unqualifiedQuantity" placeholder="请è¾å
¥ä¸åæ ¼æ°é" clearable :precision="2" @change="handleUnqualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªåï¼" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©æ£éªå" clearable style="width: 100%"> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµæ¥æï¼" prop="checkTime"> |
| | | <el-date-picker |
| | | v-model="form.checkTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ£æµæ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | | </el-form> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :tableLoading="tableLoading" |
| | | height="400" |
| | | > |
| | | <template #slot="{ row }"> |
| | | <el-input v-model="row.testValue" clearable/> |
| | | </template> |
| | | </PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { batchQuickInspect } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import { qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(['close', 'success']); |
| | | |
| | | const dialogVisible = ref(false); |
| | | const userList = ref([]); |
| | | const selectedIds = ref([]); |
| | | const selectedRows = ref([]); |
| | | const testStandardOptions = ref([]); |
| | | const inspectType = ref(1); // è¿ç¨æ£éªç±»å |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }, |
| | | rules: { |
| | | checkResult: [{ required: true, message: "è¯·éæ©æ£æµç»æ", trigger: "change" }], |
| | | testStandardId: [{ required: true, message: "è¯·éæ©ææ ", trigger: "change" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥æ°é", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请è¾å
¥åæ ¼æ°é", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请è¾å
¥ä¸åæ ¼æ°é", trigger: "blur" }], |
| | | checkCompany: [{ required: true, message: "请è¾å
¥æ£æµåä½", trigger: "blur" }], |
| | | checkName: [{ required: true, message: "è¯·éæ©æ£éªå", trigger: "change" }], |
| | | checkTime: [{ required: true, message: "è¯·éæ©æ£æµæ¥æ", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ææ ", |
| | | prop: "parameterItem", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | }, |
| | | { |
| | | label: "å
æ§å¼", |
| | | prop: "controlValue", |
| | | }, |
| | | { |
| | | label: "æ£éªå¼", |
| | | prop: "testValue", |
| | | dataType: 'slot', |
| | | slot: 'slot', |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = async (ids, rows) => { |
| | | selectedIds.value = ids; |
| | | selectedRows.value = rows; |
| | | dialogVisible.value = true; |
| | | |
| | | // å è½½ç¨æ·å表 |
| | | const userListsRes = await userListNoPage(); |
| | | userList.value = userListsRes.data; |
| | | |
| | | // å è½½ææ éé¡¹ï¼æ ¹æ®ç¬¬ä¸ä¸ªéä¸è¡ç产åIDï¼ |
| | | if (rows && rows.length > 0 && rows[0].productId) { |
| | | const params = { |
| | | productId: rows[0].productId, |
| | | inspectType: 1 |
| | | }; |
| | | const res = await qualityInspectDetailByProductId(params); |
| | | testStandardOptions.value = res.data || []; |
| | | } else { |
| | | testStandardOptions.value = []; |
| | | } |
| | | |
| | | // é置表å |
| | | form.value = { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }; |
| | | tableData.value = []; |
| | | |
| | | await nextTick(); |
| | | proxy.$refs.formRef?.clearValidate(); |
| | | }; |
| | | |
| | | // ææ éæ©ååå¤ç |
| | | const handleTestStandardChange = async (testStandardId) => { |
| | | if (!testStandardId) { |
| | | tableData.value = []; |
| | | return; |
| | | } |
| | | tableLoading.value = true; |
| | | try { |
| | | const res = await getQualityTestStandardParamByTestStandardId(testStandardId); |
| | | tableData.value = (res.data || []).map(item => ({ |
| | | ...item, |
| | | id: null, |
| | | testValue: '' |
| | | })); |
| | | } catch (error) { |
| | | console.error('è·åæ ååæ°å¤±è´¥:', error); |
| | | tableData.value = []; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ£æµç»æååå¤ç |
| | | const handleCheckResultChange = (value) => { |
| | | if (value === 'åæ ¼') { |
| | | // åæ ¼æ¶ï¼åæ ¼æ°éçäºæ°éï¼ä¸åæ ¼æ°é为0 |
| | | form.value.qualifiedQuantity = form.value.quantity || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (value === 'ä¸åæ ¼') { |
| | | // ä¸åæ ¼æ¶ï¼åæ ¼æ°é为0ï¼ä¸åæ ¼æ°éçäºæ°é |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = form.value.quantity || 0; |
| | | } |
| | | }; |
| | | |
| | | // æ°éååå¤ç |
| | | const handleQuantityChange = (value) => { |
| | | if (form.value.checkResult === 'åæ ¼') { |
| | | form.value.qualifiedQuantity = value || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (form.value.checkResult === 'ä¸åæ ¼') { |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = value || 0; |
| | | } |
| | | }; |
| | | |
| | | // åæ ¼æ°éååå¤ç |
| | | const handleQualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.qualifiedQuantity = quantity; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else { |
| | | form.value.unqualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // ä¸åæ ¼æ°éååå¤ç |
| | | const handleUnqualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("ä¸åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.unqualifiedQuantity = quantity; |
| | | form.value.qualifiedQuantity = 0; |
| | | } else { |
| | | form.value.qualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // æ ¹æ®åæ ¼/ä¸åæ ¼æ°éæ´æ°æ£æµç»æ |
| | | const updateCheckResult = () => { |
| | | const qualified = form.value.qualifiedQuantity || 0; |
| | | const unqualified = form.value.unqualifiedQuantity || 0; |
| | | const quantity = form.value.quantity || 0; |
| | | |
| | | if (qualified === quantity && unqualified === 0) { |
| | | form.value.checkResult = 'åæ ¼'; |
| | | } else if (unqualified === quantity && qualified === 0) { |
| | | form.value.checkResult = 'ä¸åæ ¼'; |
| | | } else if (qualified > 0 && unqualified > 0) { |
| | | form.value.checkResult = 'é¨ååæ ¼'; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate((valid) => { |
| | | if (valid) { |
| | | const data = { |
| | | ids: selectedIds.value, |
| | | inspectType: inspectType.value, |
| | | ...form.value, |
| | | paramList: tableData.value |
| | | }; |
| | | batchQuickInspect(data).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | emit('success'); |
| | | closeDialog(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | emit('close'); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
| | |
| | | <div class="app-container"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">å·¥åºï¼</span> |
| | | <el-input v-model="searchForm.process" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥å·¥åºæç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span style="margin-left: 10px" |
| | | class="search_title">æ£æµæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.entryDate" |
| | |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="changeDaterange" /> |
| | | <span style="margin-left: 10px" |
| | | class="search_title">ç产工åå·ï¼</span> |
| | | <el-input v-model="searchForm.workOrderNo" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥ç产工åå·æç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | |
| | | @close="handleQuery"></FormDia> |
| | | <files-dia ref="filesDia" |
| | | @close="handleQuery"></files-dia> |
| | | <QuickCheckDia ref="quickCheckDia" |
| | | @close="handleQuery" |
| | | @success="getList"></QuickCheckDia> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | title="ç¼è¾æ£éªå" |
| | | width="30%" |
| | |
| | | } from "vue"; |
| | | import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue"; |
| | | import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue"; |
| | | import QuickCheckDia from "@/views/qualityManagement/processInspection/components/quickCheckDia.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { |
| | | downloadQualityInspect, |
| | |
| | | qualityInspectListPage, |
| | | qualityInspectUpdate, |
| | | submitQualityInspect, |
| | | batchQuickInspect, |
| | | } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue"; |
| | | import dayjs from "dayjs"; |
| | |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | process: "", |
| | | entryDate: undefined, // å½å
¥æ¥æ |
| | | workOrderNo: "", |
| | | entryDateStart: undefined, |
| | |
| | | label: "æ£æµæ¥æ", |
| | | prop: "checkTime", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å·¥åº", |
| | | prop: "process", |
| | | width: 230, |
| | | }, |
| | | { |
| | | label: "æ£éªå", |
| | |
| | | const formDia = ref(); |
| | | const filesDia = ref(); |
| | | const inspectionFormDia = ref(); |
| | | const quickCheckDia = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | const changeDaterange = value => { |
| | |
| | | return; |
| | | } |
| | | |
| | | const totalCount = selectedRows.value.length; |
| | | const submittedCount = totalCount - unSubmittedRows.length; |
| | | |
| | | let confirmMessage = `已鿩 ${totalCount} æ¡æ£éªå`; |
| | | if (submittedCount > 0) { |
| | | confirmMessage += `ï¼å
¶ä¸ ${submittedCount} æ¡å·²æäº¤ï¼å°èªå¨è·³è¿ï¼`; |
| | | } |
| | | confirmMessage += `\n\n确认åå°èªå¨ï¼\n· æ£éªç»æè®¾ä¸º"åæ ¼"\n· åæ ¼æ°éè®¾ä¸ºæ»æ°\n· ä¸åæ ¼æ°é设为 0\n· æäº¤å¹¶å
¥åº`; |
| | | |
| | | ElMessageBox.confirm(confirmMessage, "å¿«éæ£éª", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | dangerouslyUseHTMLString: false, |
| | | }) |
| | | .then(() => { |
| | | // è°ç¨æ¹éå¿«éæ£éªæ¥å£ |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | batchQuickInspect(ids).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | quickCheckDia.value?.openDialog(ids, unSubmittedRows); |
| | | }; |
| | | |
| | | // æå¼æ°å¢æ£éªå¼¹æ¡ |
| | |
| | | checkResult: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{required: true, message: "请è¾å
¥", trigger: "blur"},], |
| | | checkTime: [{required: false, message: "请è¾å
¥", trigger: "blur"},], |
| | | supplier: [{required: true, message: "请è¾å
¥", trigger: "blur"}], |
| | | checkName: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | productId: [{required: true, message: "请è¾å
¥", trigger: "blur"}], |
| | | productModelId: [{required: true, message: "è¯·éæ©äº§ååå·", trigger: "change"}], |
| | | testStandardId: [{required: false, message: "è¯·éæ©ææ ", trigger: "change"}], |
| | | unit: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | quantity: [{required: true, message: "请è¾å
¥", trigger: "blur"}], |
| | | qualifiedQuantity: [{required: true, message: "请è¾å
¥", trigger: "blur"}], |
| | | unqualifiedQuantity: [{required: true, message: "请è¾å
¥", trigger: "blur"}], |
| | | quantity: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | qualifiedQuantity: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | unqualifiedQuantity: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | checkCompany: [{required: false, message: "请è¾å
¥", trigger: "blur"}], |
| | | checkResult: [{required: true, message: "è¯·éæ©æ£æµç»æ", trigger: "change"}], |
| | | checkResult: [{required: false, message: "è¯·éæ©æ£æµç»æ", trigger: "change"}], |
| | | }, |
| | | }); |
| | | const tableColumn = ref([ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | title="å¿«éæ£éª" |
| | | width="70%" |
| | | @close="closeDialog" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµç»æï¼" prop="checkResult"> |
| | | <el-select v-model="form.checkResult" placeholder="è¯·éæ©æ£æµç»æ" style="width: 100%" @change="handleCheckResultChange"> |
| | | <el-option label="åæ ¼" value="åæ ¼" /> |
| | | <el-option label="ä¸åæ ¼" value="ä¸åæ ¼" /> |
| | | <el-option label="é¨ååæ ¼" value="é¨ååæ ¼" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ éæ©ï¼" prop="testStandardId"> |
| | | <el-select v-model="form.testStandardId" placeholder="è¯·éæ©ææ " style="width: 100%" @change="handleTestStandardChange"> |
| | | <el-option |
| | | v-for="item in testStandardOptions" |
| | | :key="item.id" |
| | | :label="item.standardName || item.standardNo" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <template v-if="form.checkResult"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°éï¼" prop="quantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="请è¾å
¥æ°é" clearable :precision="2" @change="handleQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµåä½ï¼" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请è¾å
¥æ£æµåä½" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åæ ¼æ°éï¼" prop="qualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="请è¾å
¥åæ ¼æ°é" clearable :precision="2" @change="handleQualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸åæ ¼æ°éï¼" prop="unqualifiedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.unqualifiedQuantity" placeholder="请è¾å
¥ä¸åæ ¼æ°é" clearable :precision="2" @change="handleUnqualifiedQuantityChange"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªåï¼" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©æ£éªå" clearable style="width: 100%"> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æµæ¥æï¼" prop="checkTime"> |
| | | <el-date-picker |
| | | v-model="form.checkTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ£æµæ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | | </el-form> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :tableLoading="tableLoading" |
| | | height="400" |
| | | > |
| | | <template #slot="{ row }"> |
| | | <el-input v-model="row.testValue" clearable/> |
| | | </template> |
| | | </PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { batchQuickInspect } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import { qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(['close', 'success']); |
| | | |
| | | const dialogVisible = ref(false); |
| | | const userList = ref([]); |
| | | const selectedIds = ref([]); |
| | | const selectedRows = ref([]); |
| | | const testStandardOptions = ref([]); |
| | | const inspectType = ref(0); // åæææ£éªç±»å |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }, |
| | | rules: { |
| | | checkResult: [{ required: true, message: "è¯·éæ©æ£æµç»æ", trigger: "change" }], |
| | | testStandardId: [{ required: true, message: "è¯·éæ©ææ ", trigger: "change" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥æ°é", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请è¾å
¥åæ ¼æ°é", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请è¾å
¥ä¸åæ ¼æ°é", trigger: "blur" }], |
| | | checkCompany: [{ required: true, message: "请è¾å
¥æ£æµåä½", trigger: "blur" }], |
| | | checkName: [{ required: true, message: "è¯·éæ©æ£éªå", trigger: "change" }], |
| | | checkTime: [{ required: true, message: "è¯·éæ©æ£æµæ¥æ", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ææ ", |
| | | prop: "parameterItem", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | }, |
| | | { |
| | | label: "å
æ§å¼", |
| | | prop: "controlValue", |
| | | }, |
| | | { |
| | | label: "æ£éªå¼", |
| | | prop: "testValue", |
| | | dataType: 'slot', |
| | | slot: 'slot', |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = async (ids, rows) => { |
| | | selectedIds.value = ids; |
| | | selectedRows.value = rows; |
| | | dialogVisible.value = true; |
| | | |
| | | // å è½½ç¨æ·å表 |
| | | const userListsRes = await userListNoPage(); |
| | | userList.value = userListsRes.data; |
| | | |
| | | // å è½½ææ éé¡¹ï¼æ ¹æ®ç¬¬ä¸ä¸ªéä¸è¡ç产åIDï¼ |
| | | if (rows && rows.length > 0 && rows[0].productId) { |
| | | const params = { |
| | | productId: rows[0].productId, |
| | | inspectType: 0 |
| | | }; |
| | | const res = await qualityInspectDetailByProductId(params); |
| | | testStandardOptions.value = res.data || []; |
| | | } else { |
| | | testStandardOptions.value = []; |
| | | } |
| | | |
| | | // é置表å |
| | | form.value = { |
| | | checkResult: '', |
| | | testStandardId: '', |
| | | quantity: undefined, |
| | | qualifiedQuantity: undefined, |
| | | unqualifiedQuantity: undefined, |
| | | checkCompany: '', |
| | | checkName: '', |
| | | checkTime: '', |
| | | }; |
| | | tableData.value = []; |
| | | |
| | | await nextTick(); |
| | | proxy.$refs.formRef?.clearValidate(); |
| | | }; |
| | | |
| | | // ææ éæ©ååå¤ç |
| | | const handleTestStandardChange = async (testStandardId) => { |
| | | if (!testStandardId) { |
| | | tableData.value = []; |
| | | return; |
| | | } |
| | | tableLoading.value = true; |
| | | try { |
| | | const res = await getQualityTestStandardParamByTestStandardId(testStandardId); |
| | | tableData.value = (res.data || []).map(item => ({ |
| | | ...item, |
| | | id: null, |
| | | testValue: '' |
| | | })); |
| | | } catch (error) { |
| | | console.error('è·åæ ååæ°å¤±è´¥:', error); |
| | | tableData.value = []; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ£æµç»æååå¤ç |
| | | const handleCheckResultChange = (value) => { |
| | | if (value === 'åæ ¼') { |
| | | // åæ ¼æ¶ï¼åæ ¼æ°éçäºæ°éï¼ä¸åæ ¼æ°é为0 |
| | | form.value.qualifiedQuantity = form.value.quantity || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (value === 'ä¸åæ ¼') { |
| | | // ä¸åæ ¼æ¶ï¼åæ ¼æ°é为0ï¼ä¸åæ ¼æ°éçäºæ°é |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = form.value.quantity || 0; |
| | | } |
| | | }; |
| | | |
| | | // æ°éååå¤ç |
| | | const handleQuantityChange = (value) => { |
| | | if (form.value.checkResult === 'åæ ¼') { |
| | | form.value.qualifiedQuantity = value || 0; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else if (form.value.checkResult === 'ä¸åæ ¼') { |
| | | form.value.qualifiedQuantity = 0; |
| | | form.value.unqualifiedQuantity = value || 0; |
| | | } |
| | | }; |
| | | |
| | | // åæ ¼æ°éååå¤ç |
| | | const handleQualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.qualifiedQuantity = quantity; |
| | | form.value.unqualifiedQuantity = 0; |
| | | } else { |
| | | form.value.unqualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // ä¸åæ ¼æ°éååå¤ç |
| | | const handleUnqualifiedQuantityChange = (value) => { |
| | | const quantity = form.value.quantity || 0; |
| | | if (value > quantity) { |
| | | proxy.$modal.msgWarning("ä¸åæ ¼æ°éä¸è½å¤§äºæ»æ°é"); |
| | | form.value.unqualifiedQuantity = quantity; |
| | | form.value.qualifiedQuantity = 0; |
| | | } else { |
| | | form.value.qualifiedQuantity = Number((quantity - value).toFixed(2)); |
| | | } |
| | | updateCheckResult(); |
| | | }; |
| | | |
| | | // æ ¹æ®åæ ¼/ä¸åæ ¼æ°éæ´æ°æ£æµç»æ |
| | | const updateCheckResult = () => { |
| | | const qualified = form.value.qualifiedQuantity || 0; |
| | | const unqualified = form.value.unqualifiedQuantity || 0; |
| | | const quantity = form.value.quantity || 0; |
| | | |
| | | if (qualified === quantity && unqualified === 0) { |
| | | form.value.checkResult = 'åæ ¼'; |
| | | } else if (unqualified === quantity && qualified === 0) { |
| | | form.value.checkResult = 'ä¸åæ ¼'; |
| | | } else if (qualified > 0 && unqualified > 0) { |
| | | form.value.checkResult = 'é¨ååæ ¼'; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate((valid) => { |
| | | if (valid) { |
| | | const data = { |
| | | ids: selectedIds.value, |
| | | inspectType: inspectType.value, |
| | | ...form.value, |
| | | paramList: tableData.value |
| | | }; |
| | | batchQuickInspect(data).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | emit('success'); |
| | | closeDialog(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | emit('close'); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
| | |
| | | @close="handleQuery"></FormDia> |
| | | <files-dia ref="filesDia" |
| | | @close="handleQuery"></files-dia> |
| | | <QuickCheckDia ref="quickCheckDia" |
| | | @close="handleQuery" |
| | | @success="getList"></QuickCheckDia> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | title="ç¼è¾æ£éªå" |
| | | width="30%" |
| | |
| | | } from "vue"; |
| | | import InspectionFormDia from "@/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue"; |
| | | import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue"; |
| | | import QuickCheckDia from "@/views/qualityManagement/rawMaterialInspection/components/quickCheckDia.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { |
| | | downloadQualityInspect, |
| | |
| | | qualityInspectListPage, |
| | | qualityInspectUpdate, |
| | | submitQualityInspect, |
| | | batchQuickInspect, |
| | | } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import FilesDia from "@/views/qualityManagement/rawMaterialInspection/components/filesDia.vue"; |
| | | import dayjs from "dayjs"; |
| | |
| | | const formDia = ref(); |
| | | const filesDia = ref(); |
| | | const inspectionFormDia = ref(); |
| | | const quickCheckDia = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | const changeDaterange = value => { |
| | |
| | | return; |
| | | } |
| | | |
| | | const totalCount = selectedRows.value.length; |
| | | const unSubmittedCount = unSubmittedRows.length; |
| | | const submittedCount = totalCount - unSubmittedCount; |
| | | |
| | | let confirmMessage = `已鿩 ${totalCount} æ¡æ£éªå`; |
| | | if (submittedCount > 0) { |
| | | confirmMessage += `ï¼å
¶ä¸ ${submittedCount} æ¡å·²æäº¤ï¼å°èªå¨è·³è¿ï¼`; |
| | | } |
| | | confirmMessage += `\n\n确认åå°èªå¨ï¼\n· æ£éªç»æè®¾ä¸º"åæ ¼"\n· åæ ¼æ°éè®¾ä¸ºæ»æ°\n· ä¸åæ ¼æ°é设为 0\n· æäº¤å¹¶å
¥åº`; |
| | | |
| | | ElMessageBox.confirm(confirmMessage, "å¿«éæ£éª", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | dangerouslyUseHTMLString: false, |
| | | }) |
| | | .then(() => { |
| | | // è°ç¨æ¹éå¿«éæ£éªæ¥å£ |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | batchQuickInspect(ids).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg || "å¿«éæ£éªå®æ"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | const ids = unSubmittedRows.map(item => item.id); |
| | | quickCheckDia.value?.openDialog(ids, unSubmittedRows); |
| | | }; |
| | | // æå¼éä»¶å¼¹æ¡ |
| | | const openFilesFormDia = (type, row) => { |