From f8d17ac2666198f513a4d5f83dce1135a911f2ee Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 02 四月 2025 17:15:07 +0800
Subject: [PATCH] Merge branch 'radio-frequency-cable' of http://114.132.189.42:9002/r/lims-ruoyi-before into radio-frequency-cable
---
src/views/business/reliabilityPlan/plan.vue | 164 ++++++++++++++++++++++++++------
src/api/business/reliabilityPlan.js | 45 +++++++++
src/views/business/reliabilityPlan/index.vue | 45 +++++---
3 files changed, 206 insertions(+), 48 deletions(-)
diff --git a/src/api/business/reliabilityPlan.js b/src/api/business/reliabilityPlan.js
index 9482a2f..edb2bf4 100644
--- a/src/api/business/reliabilityPlan.js
+++ b/src/api/business/reliabilityPlan.js
@@ -49,3 +49,48 @@
params: query,
});
}
+
+//鏌ヨ浜у搧璁″垝
+export function selectProductItem(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/selectProductItem",
+ method: "get",
+ params: query,
+ });
+}
+
+//鑾峰彇浜у搧妫�楠岄」
+export function itemList(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/itemList",
+ method: "get",
+ params: query,
+ });
+}
+
+//鑾峰彇浜у搧妫�楠岄」
+export function codeList(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/codeList",
+ method: "get",
+ params: query,
+ });
+}
+
+//鏇存柊鎻掑叆浜у搧璁″垝
+export function addOrUpdateItem(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/addOrUpdateItem",
+ method: "post",
+ data: query,
+ });
+}
+
+//鍒犻櫎
+export function deleteItem(query) {
+ return request({
+ url: "/reliabilityPlanProductItem/deleteItem",
+ method: "delete",
+ params: query,
+ });
+}
diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
index 0ff4d4e..c989737 100644
--- a/src/views/business/reliabilityPlan/index.vue
+++ b/src/views/business/reliabilityPlan/index.vue
@@ -79,7 +79,7 @@
<div slot="footer" class="foot">
<el-button v-if="operationType !== 'review'" @click="closeProDia">鍙� 娑�</el-button>
<el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
- :loading="submitProLoading" @click="submitProForm">淇�
+ :loading="submitProLoading" @click="submitProForm(0)">淇�
瀛�</el-button>
<el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
@click="submitProForm(1)">鎻� 浜�</el-button>
@@ -95,9 +95,10 @@
<el-form :model="materialForm" ref="materialForm" :rules="materialRules" label-width="90px" size="small">
<el-form-item label="鍘熻緟鏉愬悕绉�" prop="materialName">
<el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
- :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false }" :show-all-levels="false"
- clearable filterable placeholder="璇烽�夋嫨鍘熻緟鏉愬悕绉�" size="small" style="width: 100%;"
- :disabled="operationType === 'review' || operationType === 'submit'"></el-cascader>
+ :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'">
+ </el-cascader>
</el-form-item>
<el-form-item label="闆朵欢鍙�" prop="partNo">
<el-input v-model="materialForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿"
@@ -115,7 +116,7 @@
<el-button v-if="operationType !== 'review'" @click="closeMaterialRulesDia">鍙�
娑�</el-button>
<el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
- :loading="submitMatLoading" @click="submitMaterialRulesForm">淇� 瀛�</el-button>
+ :loading="submitMatLoading" @click="submitMaterialRulesForm(0)">淇� 瀛�</el-button>
<el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
@click="submitMaterialRulesForm(1)">鎻� 浜�</el-button>
<el-button v-if="operationType === 'review'" :loading="submitMatLoading"
@@ -448,9 +449,6 @@
// 鎵撳紑鏂板寮规
openAddDia(type, row) {
this.operationType = type
- this.getTypeOptions()
- this.getPartNoOptions()
- // this.getUserList()
if (this.tabIndex === 0) {
this.proPlanDia = true
if (this.operationType === 'add') {
@@ -463,6 +461,12 @@
}
} else {
this.proPlanForm = { ...row }
+ // 缂栬緫鏃惰幏鍙栭�変腑鑺傜偣鐨処D骞跺姞杞界浉鍏虫暟鎹�
+ const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.productName)
+ if (selectedNode) {
+ this.getTypeOptions(selectedNode.id)
+ this.getPartNoOptions(selectedNode.id)
+ }
}
} else {
this.materialDia = true
@@ -482,12 +486,15 @@
// 鎴愬搧淇℃伅鎻愪氦
submitProForm(state) {
this.submitProLoading = true
- if (this.operationType === 'add') {
- this.proPlanForm.state = ''
- } else {
- this.proPlanForm.state = state
+ // 鑾峰彇閫変腑鑺傜偣鐨処D
+ const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.proPlanForm.productName)
+ const params = {
+ ...this.proPlanForm,
+ state: state === undefined ? null : parseInt(state),
+ productId: selectedNode?.id
}
- addOrUpdateProduct(this.proPlanForm).then(res => {
+
+ addOrUpdateProduct(params).then(res => {
if (res.code === 200) {
this.closeProDia()
this.$message.success('鎿嶄綔鎴愬姛')
@@ -507,12 +514,14 @@
// 鍘熻緟鏉愪俊鎭彁浜�
submitMaterialRulesForm(state) {
this.submitMatLoading = true
- if (this.operationType === 'add') {
- this.materialForm.state = ''
- } else {
- this.materialForm.state = state
+ // 鑾峰彇閫変腑鑺傜偣鐨処D
+ const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.materialForm.materialName)
+ const params = {
+ ...this.materialForm,
+ state: state === undefined ? null : parseInt(state),
+ materialId: selectedNode?.id
}
- addOrUpdateMaterial(this.materialForm).then(res => {
+ addOrUpdateMaterial(params).then(res => {
if (res.code === 200) {
this.closeMaterialRulesDia()
this.$message.success('鎿嶄綔鎴愬姛')
diff --git a/src/views/business/reliabilityPlan/plan.vue b/src/views/business/reliabilityPlan/plan.vue
index 7434c2c..54b38f9 100644
--- a/src/views/business/reliabilityPlan/plan.vue
+++ b/src/views/business/reliabilityPlan/plan.vue
@@ -10,32 +10,35 @@
</div>
</div>
<el-table :data="tableData" style="width: 100%">
- <el-table-column prop="date" label="妫�娴嬮」" width="180">
- </el-table-column>
- <el-table-column prop="name" label="娴嬭瘯鏍囧噯" width="180">
+ <el-table-column prop="inspectionItem" label="妫�娴嬮」" width="180">
<template slot-scope="scope">
- <el-select v-model="scope.row.name" placeholder="璇烽�夋嫨" v-if="isEdit" size="small">
- <el-option v-for="item in standardList" :key="item.value" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- <span v-else>{{ scope.row.name }}</span>
+ <span>{{ scope.row.inspectionItem }}</span>
</template>
</el-table-column>
- <el-table-column prop="address" label="棰戞">
+ <el-table-column prop="standard" label="娴嬭瘯鏍囧噯" width="180">
<template slot-scope="scope">
- <el-select v-model="scope.row.name" placeholder="璇烽�夋嫨" v-if="isEdit" size="small">
+ <el-select v-model="scope.row.standard" placeholder="璇烽�夋嫨" v-if="isEdit" size="small">
+ <el-option v-for="item in codeList" :key="item.id" :label="item.label" :value="item.standard">
+ </el-option>
+ </el-select>
+ <span v-else>{{ scope.row.standard }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="frequency" label="棰戞">
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.frequency" placeholder="璇烽�夋嫨" v-if="isEdit" size="small">
<el-option v-for="item in dict.type.planned_frequency" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
- <span v-else>{{ scope.row.name }}</span>
+ <dict-tag v-else :options="dict.type.planned_frequency" :value="scope.row.frequency" />
</template>
</el-table-column>
- <el-table-column prop="address" label="澶囨敞">
+ <el-table-column prop="remark" label="澶囨敞">
<template slot-scope="scope">
- <el-input size="small" placeholder="璇疯緭鍏�" v-model="scope.row.address" v-if="isEdit">
+ <el-input size="small" placeholder="璇疯緭鍏�" v-model="scope.row.remark" v-if="isEdit">
</el-input>
- <span v-else>{{ scope.row.address }}</span>
+ <span v-else>{{ scope.row.remark }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="鎿嶄綔" width="100" v-if="planState == 0">
@@ -48,25 +51,26 @@
<el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
<el-form-item label="妫�楠岄」" prop="name">
<el-select v-model="addForm.name" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
- <el-option v-for="item in itemList" :key="item.value" :label="item.label" :value="item.value">
+ <el-option v-for="item in itemList" :key="item.id" :label="item.inspectionItem"
+ :value="item.inspectionItem">
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="娴嬭瘯鏍囧噯" prop="number">
- <el-select v-model="addForm.name" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
- <el-option v-for="item in standardList" :key="item.value" :label="item.label" :value="item.value">
+ <el-form-item label="娴嬭瘯鏍囧噯" prop="standard">
+ <el-select v-model="addForm.standard" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
+ <el-option v-for="item in codeList" :key="item.id" :label="item.label" :value="item.standard">
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="棰戞" prop="number">
- <el-select v-model="addForm.name" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
+ <el-form-item label="棰戞" prop="frequency">
+ <el-select v-model="addForm.frequency" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
<el-option v-for="item in dict.type.planned_frequency" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="澶囨敞" prop="number">
- <el-input size="small" placeholder="璇疯緭鍏�" v-model="addForm.address">
+ <el-form-item label="澶囨敞" prop="remark">
+ <el-input size="small" placeholder="璇疯緭鍏�" v-model="addForm.remark">
</el-input>
</el-form-item>
</el-form>
@@ -79,15 +83,15 @@
</template>
<script>
+import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem } from "@/api/business/reliabilityPlan";
+
export default {
dicts: ["planned_frequency"],
data() {
return {
- tableData: [
- {}
- ],
+ tableData: [],
+ codeList: [],//鏍囧噯鍒楄〃
isEdit: false,
- standardList: [],//鏍囧噯鍒楄〃
saveLoading: false,
addForm: {},
addRules: {
@@ -104,15 +108,94 @@
const { id, type, state } = this.$route.query
this.planId = id;
this.planType = type;
- this.planState = state
+ this.planState = state;
+ this.getTableData();
+ this.getItemList();
+ this.getCodeList();
},
methods: {
+ getTableData() {
+ selectProductItem({ rePlanId: this.planId }).then(res => {
+ if (res.code === 200) {
+ this.tableData = res.data || [];
+ }
+ }).catch(err => {
+ console.error('鑾峰彇鏁版嵁澶辫触:', err);
+ });
+ },
+
+ // 鑾峰彇妫�楠岄」鍒楄〃
+ getItemList() {
+ itemList({ rePlanId: this.planId }).then(res => {
+ if (res.code === 200) {
+ this.itemList = res.data.map(item => ({
+ label: item.inspectionItem, // 淇敼涓� inspectionItem
+ value: item.id,
+ inspectionItem: item.inspectionItem // 娣诲姞 inspectionItem 瀛楁
+ })) || [];
+ }
+ }).catch(err => {
+ console.error('鑾峰彇妫�楠岄」鍒楄〃澶辫触:', err);
+ });
+ },
+
+ // 鑾峰彇娴嬭瘯鏍囧噯鍒楄〃
+ getCodeList() {
+ codeList({ rePlanId: this.planId }).then(res => {
+ if (res.code === 200) {
+ this.codeList = res.data.map(item => ({
+ label: item.standard,
+ value: item.id,
+ standard: item.standard
+ })) || [];
+ }
+ }).catch(err => {
+ console.error('鑾峰彇娴嬭瘯鏍囧噯鍒楄〃澶辫触:', err);
+ });
+ },
// 鍒犻櫎
- handleDelete(row) { },
+ handleDelete(row) {
+ this.$modal.confirm('鏄惁纭鍒犻櫎璇ユ楠岄」锛�').then(() => {
+ deleteItem({ id: row.id }).then(res => {
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛');
+ this.getTableData();
+ }
+ }).catch(err => {
+ console.error('鍒犻櫎澶辫触:', err);
+ });
+ }).catch(() => { });
+ },
// 淇濆瓨
save() {
this.saveLoading = true;
- this.isEdit = false
+ const promises = this.tableData.map(item => {
+ const params = {
+ id: item.id,
+ rePlanId: this.planId,
+ inspectionItem: item.inspectionItem,
+ standard: item.standard,
+ frequency: item.frequency,
+ remark: item.remark
+ };
+ return addOrUpdateItem(params);
+ });
+
+ Promise.all(promises)
+ .then(responses => {
+ if (responses.every(res => res.code === 200)) {
+ this.$message.success('淇濆瓨鎴愬姛');
+ this.isEdit = false;
+ this.getTableData();
+ }
+ })
+ .catch(err => {
+ console.error('淇濆瓨澶辫触:', err);
+ this.$message.error('淇濆瓨澶辫触');
+ })
+ .finally(() => {
+ this.saveLoading = false;
+ });
},
goback() {
this.$tab.closePage();
@@ -121,7 +204,28 @@
this.addForm = {}
this.addDia = true;
},
- submitProduct() { }
+ submitProduct(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ const params = {
+ rePlanId: this.planId,
+ inspectionItem: this.addForm.name,
+ standard: this.addForm.standard,
+ frequency: this.addForm.frequency,
+ remark: this.addForm.remark
+ }
+ addOrUpdateItem(params).then(res => {
+ if (res.code === 200) {
+ this.$message.success('淇濆瓨鎴愬姛');
+ this.addDia = false;
+ this.getTableData();
+ }
+ }).catch(err => {
+ console.error('淇濆瓨澶辫触:', err);
+ });
+ }
+ });
+ }
}
}
</script>
--
Gitblit v1.9.3