From 28d60ee46f2a6ee67810108809fe86b9d32e822e Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 03 四月 2025 22:15:29 +0800
Subject: [PATCH] 可靠性计划完善
---
src/views/business/reliabilityPlan/plan.vue | 27 ++++++++-----
src/api/business/reliabilityPlan.js | 18 +++++++++
src/views/business/reliabilityPlan/index.vue | 68 +++++++++++++++++++++++++++------
3 files changed, 90 insertions(+), 23 deletions(-)
diff --git a/src/api/business/reliabilityPlan.js b/src/api/business/reliabilityPlan.js
index edb2bf4..e97a1d8 100644
--- a/src/api/business/reliabilityPlan.js
+++ b/src/api/business/reliabilityPlan.js
@@ -68,6 +68,15 @@
});
}
+//鑾峰彇鍘熻緟鏉愪骇鍝佹楠岄」
+export function materialItem(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/materialItem",
+ method: "get",
+ params: query,
+ });
+}
+
//鑾峰彇浜у搧妫�楠岄」
export function codeList(query) {
return request({
@@ -77,6 +86,15 @@
});
}
+//鑾峰彇鍘熻緟鏉愪骇鍝佹楠岄」
+export function materialCodeList(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/materialCodeList",
+ method: "get",
+ params: query,
+ });
+}
+
//鏇存柊鎻掑叆浜у搧璁″垝
export function addOrUpdateItem(query) {
return request({
diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
index c989737..a0d9c30 100644
--- a/src/views/business/reliabilityPlan/index.vue
+++ b/src/views/business/reliabilityPlan/index.vue
@@ -97,12 +97,16 @@
<el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
:props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }"
:show-all-levels="false" clearable filterable placeholder="璇烽�夋嫨鍘熻緟鏉愬悕绉�" size="small" style="width: 100%;"
- :disabled="operationType === 'review' || operationType === 'submit'">
+ :disabled="operationType === 'review' || operationType === 'submit'" @change="handleMaterialNameChange">
</el-cascader>
</el-form-item>
<el-form-item label="闆朵欢鍙�" prop="partNo">
- <el-input v-model="materialForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿"
- :disabled="operationType === 'review' || operationType === 'submit'"></el-input>
+ <el-select v-model="materialForm.partNo" placeholder="璇烽�夋嫨" clearable filterable
+ :disabled="operationType === 'review' || !materialForm.materialName || operationType === 'submit'"
+ style="width: 100%;">
+ <el-option v-for="item in materialPartNoOption" :key="item.id" :label="item.partNo" :value="item.partNo">
+ </el-option>
+ </el-select>
</el-form-item>
<!-- <el-form-item label="瀹℃牳浜�" prop="reviewerId">
<el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;"
@@ -159,6 +163,7 @@
tableData: [],
typeOption: [],
partNoOption: [], // 娣诲姞浜у搧鍨嬪彿閫夐」鏁版嵁
+ materialPartNoOption:[],
tableLoading: false,
itemParameterData: {
cascaderField: {
@@ -470,19 +475,56 @@
}
} else {
this.materialDia = true
- if (this.operationType === 'add') {
- this.materialForm = {
- id: '',
- materialName: '',
- partNo: '',
- state: '',
- reviewerId: ''
+ if (this.operationType === 'add') {
+ this.materialForm = {
+ id: '',
+ materialName: '',
+ partNo: '',
+ state: '',
+ reviewerId: ''
+ }
+ } else {
+ this.materialForm = { ...row }
+ // 缂栬緫鏃惰幏鍙栭�変腑鑺傜偣鐨処D骞跺姞杞界浉鍏虫暟鎹�
+ const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.materialName)
+ if (selectedNode) {
+ this.getMaterialPartNoOptions(selectedNode.id)
+ }
}
- } else {
- this.materialForm = { ...row }
- }
}
},
+
+ //鍘熻緟鏉愰浂浠跺彿閫夋嫨
+ handleMaterialNameChange(value) {
+ if (value) {
+ const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, value)
+ if (selectedNode) {
+ this.getMaterialPartNoOptions(selectedNode.id)
+ }
+ } else {
+ this.materialPartNoOption = []
+ this.materialForm.partNo = ''
+ }
+ },
+
+ // 鑾峰彇鍘熻緟鏉愰浂浠跺彿鍒楄〃
+ getMaterialPartNoOptions(materialId) {
+ if (!materialId) {
+ this.materialPartNoOption = []
+ return
+ }
+ getPartNoList({ productId: materialId }).then(res => {
+ if (res.code === 200) {
+ this.materialPartNoOption = res.data || []
+ if (this.materialPartNoOption.length === 0) {
+ this.materialForm.partNo = ''
+ }
+ }
+ }).catch(() => {
+ this.materialPartNoOption = []
+ this.materialForm.partNo = ''
+ })
+ },
// 鎴愬搧淇℃伅鎻愪氦
submitProForm(state) {
this.submitProLoading = true
diff --git a/src/views/business/reliabilityPlan/plan.vue b/src/views/business/reliabilityPlan/plan.vue
index 54b38f9..3574af0 100644
--- a/src/views/business/reliabilityPlan/plan.vue
+++ b/src/views/business/reliabilityPlan/plan.vue
@@ -83,7 +83,7 @@
</template>
<script>
-import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem } from "@/api/business/reliabilityPlan";
+import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem, materialItem, materialCodeList } from "@/api/business/reliabilityPlan";
export default {
dicts: ["planned_frequency"],
@@ -115,7 +115,10 @@
},
methods: {
getTableData() {
- selectProductItem({ rePlanId: this.planId }).then(res => {
+ selectProductItem({
+ rePlanId: this.planId,
+ type: this.planType
+ }).then(res => {
if (res.code === 200) {
this.tableData = res.data || [];
}
@@ -126,12 +129,13 @@
// 鑾峰彇妫�楠岄」鍒楄〃
getItemList() {
- itemList({ rePlanId: this.planId }).then(res => {
+ const api = this.planType === '鎴愬搧' ? itemList : materialItem;
+ api({ rePlanId: this.planId }).then(res => {
if (res.code === 200) {
this.itemList = res.data.map(item => ({
- label: item.inspectionItem, // 淇敼涓� inspectionItem
+ label: item.inspectionItem,
value: item.id,
- inspectionItem: item.inspectionItem // 娣诲姞 inspectionItem 瀛楁
+ inspectionItem: item.inspectionItem
})) || [];
}
}).catch(err => {
@@ -141,13 +145,14 @@
// 鑾峰彇娴嬭瘯鏍囧噯鍒楄〃
getCodeList() {
- codeList({ rePlanId: this.planId }).then(res => {
+ const api = this.planType === '鎴愬搧' ? codeList : materialCodeList;
+ api({ rePlanId: this.planId }).then(res => {
if (res.code === 200) {
- this.codeList = res.data.map(item => ({
+ this.codeList = res.data ? res.data.map(item => ({
label: item.standard,
value: item.id,
standard: item.standard
- })) || [];
+ })) : [];
}
}).catch(err => {
console.error('鑾峰彇娴嬭瘯鏍囧噯鍒楄〃澶辫触:', err);
@@ -176,7 +181,8 @@
inspectionItem: item.inspectionItem,
standard: item.standard,
frequency: item.frequency,
- remark: item.remark
+ remark: item.remark,
+ type: this.planType
};
return addOrUpdateItem(params);
});
@@ -212,7 +218,8 @@
inspectionItem: this.addForm.name,
standard: this.addForm.standard,
frequency: this.addForm.frequency,
- remark: this.addForm.remark
+ remark: this.addForm.remark,
+ type: this.planType
}
addOrUpdateItem(params).then(res => {
if (res.code === 200) {
--
Gitblit v1.9.3