From a3695db3102da2fb5b2f309578afe27f58b926d8 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 15 四月 2026 17:22:28 +0800
Subject: [PATCH] 成品检测编辑增加送检车间
---
src/views/qualityManagement/finalInspection/components/formDia.vue | 381 +++++++++++++++++++++++++++++------------------------
1 files changed, 207 insertions(+), 174 deletions(-)
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 407cd6f..d6f7c09 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -25,26 +25,27 @@
</el-col>
<el-col :span="12">
<el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
- <el-select v-model="form.productModelId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'edit'"
+ <el-select v-model="form.productModelId" placeholder="璇烽�夋嫨" clearable
+ :disabled="operationType === 'edit'"
filterable readonly @change="handleChangeModel">
- <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
+ <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
<el-select
- v-model="form.testStandardId"
- placeholder="璇烽�夋嫨鎸囨爣"
- clearable
- @change="handleTestStandardChange"
- style="width: 100%"
+ v-model="form.testStandardId"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ clearable
+ @change="handleTestStandardChange"
+ style="width: 100%"
>
<el-option
- v-for="item in testStandardOptions"
- :key="item.id"
- :label="item.standardName || item.standardNo"
- :value="item.id"
+ v-for="item in testStandardOptions"
+ :key="item.id"
+ :label="item.standardName || item.standardNo"
+ :value="item.id"
/>
</el-select>
</el-form-item>
@@ -59,10 +60,10 @@
<el-col :span="12">
<el-form-item label="鎵瑰彿锛�" prop="batchNo">
<el-input
- v-model="form.batchNo"
- placeholder="璇疯緭鍏�"
- clearable
- :disabled="operationType === 'edit'"
+ v-model="form.batchNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :disabled="operationType === 'edit'"
/>
</el-form-item>
</el-col>
@@ -75,17 +76,18 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�鍝佹暟閲忥細" prop="inspectedQuantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inspectedQuantity" placeholder="璇疯緭鍏�" clearable :precision="2"/>
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inspectedQuantity"
+ placeholder="璇疯緭鍏�" clearable :precision="2"/>
</el-form-item>
</el-col>
<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" :disabled="quantityDisabled"/>
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�"
+ clearable :precision="2" :disabled="quantityDisabled"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
-
<el-col :span="12">
<el-form-item label="鐢熶骇鏃ユ湡锛�" prop="productionDate">
<el-date-picker
@@ -123,8 +125,8 @@
<el-col :span="12">
<el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
<el-select v-model="form.checkResult">
- <el-option label="鍚堟牸" value="鍚堟牸" />
- <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
+ <el-option label="鍚堟牸" value="鍚堟牸"/>
+ <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"/>
</el-select>
</el-form-item>
</el-col>
@@ -132,10 +134,10 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
- </el-select>
+ <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
+ <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">
@@ -176,13 +178,13 @@
filterable
@change="getInspectProductModel"
>
- <el-option v-for="item in inspectModelOptions" :key="item.id" :label="item.model" :value="item.id" />
+ <el-option v-for="item in inspectModelOptions" :key="item.id" :label="item.model" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="UID鐮侊紙妫�楠岋級锛�" prop="inspectUidNo">
- <el-input v-model="form.inspectUidNo" placeholder="鑷姩甯﹀嚭" disabled />
+ <el-input v-model="form.inspectUidNo" placeholder="鑷姩甯﹀嚭" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -234,16 +236,21 @@
<el-input v-model="form.inspectValidityDate" placeholder="鑷姩璁$畻" disabled/>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="璇锋閮ㄩ棬锛�" prop="manufacturingTeam">
+ <el-input v-model="form.manufacturingTeam" placeholder="璇疯緭鍏�" clearable/>
+ </el-form-item>
+ </el-col>
</el-row>
</el-form>
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :tableLoading="tableLoading"
- height="400"
- >
- <template #instrument="{ row }">
+ <PIMTable
+ rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ height="400"
+ >
+ <template #instrument="{ row }">
<el-select
v-model="row.instrument"
placeholder="璇烽�夋嫨鎴栬緭鍏�"
@@ -254,7 +261,7 @@
style="width: 100%"
@change="handleInstrumentChange(row)"
>
- <el-option label="鐩祴" value="鐩祴" />
+ <el-option label="鐩祴" value="鐩祴"/>
<el-option
v-for="item in deviceList"
:key="item.id"
@@ -271,24 +278,24 @@
clearable
style="width: 100%"
>
- <el-option label="姝e父" value="姝e父" />
- <el-option label="鍋滄満" value="鍋滄満" />
- <el-option label="杩愯" value="杩愯" />
- <el-option label="缁翠慨" value="缁翠慨" />
- <el-option label="/" value="/" />
+ <el-option label="姝e父" value="姝e父"/>
+ <el-option label="鍋滄満" value="鍋滄満"/>
+ <el-option label="杩愯" value="杩愯"/>
+ <el-option label="缁翠慨" value="缁翠慨"/>
+ <el-option label="/" value="/"/>
</el-select>
</template>
<template #result="{ row }">
- <el-input v-model="row.result" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="row.result" placeholder="璇疯緭鍏�" clearable/>
</template>
<template #resultJudgment="{ row }">
<el-select v-model="row.resultJudgment" placeholder="璇烽�夋嫨" clearable style="width: 100%">
- <el-option label="鍚堟牸" value="鍚堟牸" />
- <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
- <el-option label="/" value="/" />
+ <el-option label="鍚堟牸" value="鍚堟牸"/>
+ <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"/>
+ <el-option label="/" value="/"/>
</el-select>
</template>
- </PIMTable>
+ </PIMTable>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">纭</el-button>
@@ -305,11 +312,15 @@
import {modelList, productTreeList} from "@/api/basicData/product.js";
import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
import {userListNoPage} from "@/api/system/user.js";
-import { getStockInventoryAll } from "@/api/inventoryManagement/stockInventory.js";
-import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
+import {getStockInventoryAll} from "@/api/inventoryManagement/stockInventory.js";
+import {
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId
+} from "@/api/qualityManagement/metricMaintenance.js";
import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
-const { proxy } = getCurrentInstance()
+
+const {proxy} = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
@@ -345,7 +356,7 @@
// 妫�楠岀敤绮夊墏/娑叉儏鍐电浉鍏虫柊瀛楁
inspectMaterialConditionId: "",
inspectMaterialCondition: "",
- inspectProductModelId : "",
+ inspectProductModelId: "",
inspectBatchNo: "",
inspectSupplier: "",
inspectProductModel: "",
@@ -353,17 +364,18 @@
inspectProductionDate: "",
inspectValidityDate: "",
inspectValidityPeriod: "",
+ manufacturingTeam: "",
},
rules: {
- checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
- process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ checkTime: [{required: true, message: "璇疯緭鍏�", trigger: "blur"},],
+ process: [{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" }],
+ unit: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
inspectedQuantity: [
- { required: true, message: "璇疯緭鍏ユ鍝佹暟閲�", trigger: "blur" },
+ {required: true, message: "璇疯緭鍏ユ鍝佹暟閲�", trigger: "blur"},
{
validator: (rule, value, callback) => {
if (value !== '' && value !== null && value !== undefined) {
@@ -381,13 +393,13 @@
trigger: "blur"
}
],
- quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- batchNo: [{ required: true, validator: validateBatchNo, trigger: "blur" }],
- checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+ quantity: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ checkCompany: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
+ batchNo: [{required: true, validator: validateBatchNo, trigger: "blur"}],
+ checkResult: [{required: true, message: "璇疯緭鍏�", trigger: "change"}],
},
});
-const { form, rules } = toRefs(data);
+const {form, rules} = toRefs(data);
// 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯鏁伴噺缃伆
const quantityDisabled = computed(() => {
const v = form.value || {};
@@ -412,16 +424,16 @@
};
const normalized = (list) =>
- (list || []).map((n) => {
- const value = normalizeNodeValue(n);
- const label = n.label ?? n.productName ?? n.model ?? n.batchNo ?? n.customer ?? "";
- return {
- ...n,
- value,
- label,
- children: normalized(n.children),
- };
- });
+ (list || []).map((n) => {
+ const value = normalizeNodeValue(n);
+ const label = n.label ?? n.productName ?? n.model ?? n.batchNo ?? n.customer ?? "";
+ return {
+ ...n,
+ value,
+ label,
+ children: normalized(n.children),
+ };
+ });
return normalized(nodes);
};
@@ -429,17 +441,17 @@
// 妫�楠岀敤绮夊墏/娑叉爲褰笅鎷夛細涓嶅睍绀哄瀷鍙枫�佹壒鍙凤紙鐢卞彸渚с�岃鏍煎瀷鍙枫�嶃�屾壒鍙枫�嶅崟鐙�夋嫨锛�
function filterInspectTreeForPowderSelect(nodes = []) {
return (nodes || [])
- .filter(
- (n) =>
- n &&
- n.nodeType !== "customer" &&
- n.nodeType !== "model" &&
- n.nodeType !== "batch"
- )
- .map((n) => ({
- ...n,
- children: filterInspectTreeForPowderSelect(n.children || []),
- }));
+ .filter(
+ (n) =>
+ n &&
+ n.nodeType !== "customer" &&
+ n.nodeType !== "model" &&
+ n.nodeType !== "batch"
+ )
+ .map((n) => ({
+ ...n,
+ children: filterInspectTreeForPowderSelect(n.children || []),
+ }));
}
/** 鍦ㄤ骇鍝佸瓙鏍戝唴閫掑綊鏀堕泦鍨嬪彿鑺傜偣锛堝瀷鍙峰彲鑳藉湪绗� 3 灞傚強鏇存繁锛岃�岄潪浜у搧鐨勭洿鎺ュ瓙鑺傜偣锛� */
@@ -484,16 +496,16 @@
}
const tableColumn = ref([
- {
- label: "妫�娴嬮」鐩�",
- prop: "parameterItem",
- width: 150
- },
- {
- label: "鏍囧噯瑕佹眰",
- prop: "standardValue",
- width: 180
- },
+ {
+ label: "妫�娴嬮」鐩�",
+ prop: "parameterItem",
+ width: 150
+ },
+ {
+ label: "鏍囧噯瑕佹眰",
+ prop: "standardValue",
+ width: 180
+ },
{
label: "鍗曚綅",
prop: "unit",
@@ -520,13 +532,13 @@
slot: 'result',
width: 150
},
- {
- label: "缁撴灉鍒ゆ柇",
- prop: "resultJudgment",
- dataType: 'slot',
- slot: 'resultJudgment',
- width: 120
- },
+ {
+ label: "缁撴灉鍒ゆ柇",
+ prop: "resultJudgment",
+ dataType: 'slot',
+ slot: 'resultJudgment',
+ width: 120
+ },
]);
const tableData = ref([]);
const tableLoading = ref(false);
@@ -575,6 +587,7 @@
if (currentProductId.value) {
// 璁剧疆浜у搧鍚嶇О
form.value.productName = findNodeById(productOptions.value, currentProductId.value);
+ syncInspectDeptByProductName(form.value.productName);
// 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
const params = {
@@ -583,7 +596,7 @@
};
Promise.all([
- modelList({ id: currentProductId.value }),
+ modelList({id: currentProductId.value}),
qualityInspectDetailByProductId(params)
]).then(([modelRes, testStandardRes]) => {
// 璁剧疆瑙勬牸鍨嬪彿閫夐」
@@ -606,7 +619,7 @@
if (savedTestStandardId) {
// 纭繚绫诲瀷鍖归厤锛坕tem.id 鍙兘鏄暟瀛楁垨瀛楃涓诧級
const matchedOption = testStandardOptions.value.find(item =>
- item.id == savedTestStandardId || String(item.id) === String(savedTestStandardId)
+ item.id == savedTestStandardId || String(item.id) === String(savedTestStandardId)
);
if (matchedOption) {
// 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
@@ -643,6 +656,23 @@
inspectProductOptions.value = filterInspectTreeForPowderSelect(inspectStockInventoryAllTree);
return inspectProductOptions.value;
};
+
+const getInspectDeptByProductName = (productName) => {
+ const name = String(productName ?? "").trim();
+ if (!name) return "";
+ const match = name.match(/^鎴愬搧-([涓�涓塢)绫讳骇鍝�-/);
+ if (!match) return "";
+ return `${match[1]}绫昏溅闂碻;
+};
+
+const syncInspectDeptByProductName = (productName, force = false) => {
+ const dept = getInspectDeptByProductName(productName);
+ if (!dept) return;
+ if (force || !String(form.value.inspectDept ?? "").trim()) {
+ form.value.inspectDept = dept;
+ }
+};
+
const getModels = (value) => {
form.value.productModelId = undefined;
form.value.unit = undefined;
@@ -651,7 +681,8 @@
modelOptions.value = [];
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
- modelList({ id: value }).then((res) => {
+ syncInspectDeptByProductName(form.value.productName, true);
+ modelList({id: value}).then((res) => {
modelOptions.value = res;
})
if (currentProductId.value) {
@@ -683,9 +714,10 @@
}
return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
};
+
function convertIdToValue(data) {
return data.map((item) => {
- const { id, children, ...rest } = item;
+ const {id, children, ...rest} = item;
const newItem = {
...rest,
value: id, // 灏� id 鏀逛负 value
@@ -697,17 +729,18 @@
return newItem;
});
}
+
// 鎻愪氦浜у搧琛ㄥ崟
const submitForm = () => {
proxy.$refs.formRef.validate(valid => {
if (valid) {
form.value.inspectType = 2
- if (operationType.value === "add") {
- tableData.value.forEach((item) => {
- delete item.id
- })
- }
- const data = {...form.value, qualityInspectParams: tableData.value}
+ if (operationType.value === "add") {
+ tableData.value.forEach((item) => {
+ delete item.id
+ })
+ }
+ const data = {...form.value, qualityInspectParams: tableData.value}
if (operationType.value === "add") {
qualityInspectAdd(data).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
@@ -732,14 +765,14 @@
productId: currentProductId.value,
inspectType: 2
}
- qualityInspectDetailByProductId(params).then(res => {
- // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
- testStandardOptions.value = res.data || [];
- // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
- tableData.value = [];
- // 娓呯┖鎸囨爣閫夋嫨
- form.value.testStandardId = '';
- })
+ qualityInspectDetailByProductId(params).then(res => {
+ // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+ testStandardOptions.value = res.data || [];
+ // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+ tableData.value = [];
+ // 娓呯┖鎸囨爣閫夋嫨
+ form.value.testStandardId = '';
+ })
}
// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
@@ -759,9 +792,9 @@
})
}
const getQualityInspectParamList = (id) => {
- qualityInspectParamInfo(id).then(res => {
- tableData.value = (res.data || []).map(item => ({...item}));
- })
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = (res.data || []).map(item => ({...item}));
+ })
}
// 璁$畻鏈夋晥鏈燂紙鐢熶骇鏃ユ湡 + 瑙勬牸鍨嬪彿涓殑鏈夋晥鏈燂級
@@ -829,17 +862,17 @@
inspectBatchNodeByBatchNo = new Map();
try {
- const list = (await modelList({ id: value })) || [];
+ const list = (await modelList({id: value})) || [];
inspectModelOptions.value = inspectModelOptions.value.map((m) => {
const hit = list.find((x) => String(x.id) === String(m.id));
return hit
- ? {
+ ? {
...m,
validityPeriod: hit.validityPeriod,
uidNo: hit.uidNo ?? m.uidNo,
unit: hit.unit ?? m.unit,
}
- : m;
+ : m;
});
} catch (e) {
console.error("鍔犺浇妫�楠岀敤瑙勬牸鍨嬪彿澶辫触", e);
@@ -875,10 +908,10 @@
const batchNodes = (modelNode.children || []).filter((b) => b.nodeType === "batch");
inspectBatchNodeByBatchNo = new Map(
- batchNodes.map((b) => {
- const key = String(b.batchNo ?? b.value ?? b.label ?? "").trim();
- return [key, b];
- })
+ batchNodes.map((b) => {
+ const key = String(b.batchNo ?? b.value ?? b.label ?? "").trim();
+ return [key, b];
+ })
);
inspectBatchNoOptions.value = batchNodes.map((b) => ({
label: String(b.batchNo ?? b.label ?? "").trim(),
@@ -926,11 +959,11 @@
// 鎵瑰彿鍙樺寲锛氬厛鐢熸垚鍙�変緵搴斿晢锛涚敓浜ф棩鏈�/鏈夋晥鏈熷湪鈥滀緵搴斿晢鈥濋�夋嫨鍚庡甫鍑�
const customers = (batchNode.children || [])
- .filter((c) => c.nodeType === "customer")
- .map((c) => c.customer ?? c.label ?? "")
- .filter(Boolean);
+ .filter((c) => c.nodeType === "customer")
+ .map((c) => c.customer ?? c.label ?? "")
+ .filter(Boolean);
const uniq = Array.from(new Set(customers));
- inspectSupplierOptions.value = uniq.map((s) => ({ label: s, value: s }));
+ inspectSupplierOptions.value = uniq.map((s) => ({label: s, value: s}));
form.value.inspectSupplier = "";
form.value.inspectProductionDate = "";
@@ -974,7 +1007,7 @@
}
const customerNode = (batchNode.children || []).find(
- (c) => c.nodeType === "customer" && String(c.customer ?? c.label ?? "").trim() === safeSupplier
+ (c) => c.nodeType === "customer" && String(c.customer ?? c.label ?? "").trim() === safeSupplier
);
if (!customerNode) {
form.value.inspectProductionDate = "";
@@ -984,33 +1017,33 @@
}
const rawProd =
- customerNode.productionDate ??
- customerNode.production_date ??
- batchNode.productionDate ??
- batchNode.production_date;
+ customerNode.productionDate ??
+ customerNode.production_date ??
+ batchNode.productionDate ??
+ batchNode.production_date;
form.value.inspectProductionDate = rawProd ? String(rawProd).slice(0, 10) : "";
// 鏈夋晥鏈熷勾鏁帮細浼樺厛鍙栦緵搴斿晢鑺傜偣锛屽叾娆″洖閫�鍒拌鏍煎瀷鍙锋湁鏁堟湡
const validityYears =
- customerNode.validityPeriod ??
- customerNode.validity_period ??
- customerNode.validityYears ??
- null;
+ customerNode.validityPeriod ??
+ customerNode.validity_period ??
+ customerNode.validityYears ??
+ null;
if (validityYears == null || validityYears === "") {
const selectedModel = inspectModelOptions.value.find(
- (item) => String(item.id) === String(form.value.inspectProductModelId)
+ (item) => String(item.id) === String(form.value.inspectProductModelId)
);
form.value.inspectValidityPeriod = selectedModel?.validityPeriod ?? "";
form.value.inspectValidityDate = calculateInspectValidityDateByYears(
- form.value.inspectProductionDate,
- selectedModel?.validityPeriod ?? ""
+ form.value.inspectProductionDate,
+ selectedModel?.validityPeriod ?? ""
);
} else {
form.value.inspectValidityPeriod = validityYears;
form.value.inspectValidityDate = calculateInspectValidityDateByYears(
- form.value.inspectProductionDate,
- validityYears
+ form.value.inspectProductionDate,
+ validityYears
);
}
};
@@ -1037,8 +1070,8 @@
const merged = inspectModelOptions.value;
const targetSpec = String(row.inspectProductModel ?? "").trim();
const currentModel =
- merged.find((m) => String(m.model ?? "").trim() === targetSpec) ||
- merged.find((m) => String(m.id) === String(row.inspectProductModelId));
+ merged.find((m) => String(m.model ?? "").trim() === targetSpec) ||
+ merged.find((m) => String(m.id) === String(row.inspectProductModelId));
if (currentModel) {
form.value.inspectProductModelId = currentModel.id;
@@ -1074,40 +1107,40 @@
// 鑾峰彇璁惧鍙拌处鍒楄〃
const loadDeviceList = () => {
- qualityInspectParamDeviceList().then(res => {
- deviceList.value = res.data || [];
- });
+ qualityInspectParamDeviceList().then(res => {
+ deviceList.value = res.data || [];
+ });
};
// 璁惧鐘舵�侀鑹叉槧灏�
const getDeviceStatusType = (status) => {
- const map = {
- '姝e父': 'success',
- '杩愯': 'primary',
- '鍋滄満': 'warning',
- '缁翠慨': 'danger'
- };
- return map[status] || 'info';
+ const map = {
+ '姝e父': 'success',
+ '杩愯': 'primary',
+ '鍋滄満': 'warning',
+ '缁翠慨': 'danger'
+ };
+ return map[status] || 'info';
};
// 妫�娴嬪櫒鍏峰彉鍖栨椂锛岃嚜鍔ㄥ~鍏呰澶囩姸鎬�
const handleInstrumentChange = (row) => {
- if (row.instrument === '鐩祴') {
- row.deviceId = null;
- row.deviceName = '鐩祴';
- row.deviceStatus = '';
- return;
- }
- const device = deviceList.value.find(d => d.deviceName === row.instrument);
- if (device) {
- row.deviceId = device.id;
- row.deviceName = device.deviceName;
- row.deviceStatus = device.status || '';
- } else {
- row.deviceId = null;
- row.deviceName = row.instrument || '';
- row.deviceStatus = '';
- }
+ if (row.instrument === '鐩祴') {
+ row.deviceId = null;
+ row.deviceName = '鐩祴';
+ row.deviceStatus = '';
+ return;
+ }
+ const device = deviceList.value.find(d => d.deviceName === row.instrument);
+ if (device) {
+ row.deviceId = device.id;
+ row.deviceName = device.deviceName;
+ row.deviceStatus = device.status || '';
+ } else {
+ row.deviceId = null;
+ row.deviceName = row.instrument || '';
+ row.deviceStatus = '';
+ }
};
// 鍏抽棴寮规
@@ -1135,4 +1168,4 @@
<style scoped>
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3