From 872b0e0d61b89dbdab7bf6ae2cf00223c626cb0e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 27 三月 2025 09:47:00 +0800
Subject: [PATCH] 可靠性计划-开发联调

---
 src/api/business/reliabilityPlan.js                    |   51 +++++
 src/views/CNAS/process/method/standardMethod/index.vue |    2 
 src/views/business/reliabilityPlan/index.vue           |  489 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 541 insertions(+), 1 deletions(-)

diff --git a/src/api/business/reliabilityPlan.js b/src/api/business/reliabilityPlan.js
new file mode 100644
index 0000000..cac5a39
--- /dev/null
+++ b/src/api/business/reliabilityPlan.js
@@ -0,0 +1,51 @@
+// 鍙潬鎬ц鍒掔浉鍏虫帴鍙�
+import request from '@/utils/request'
+
+// 鎴愬搧鏌ヨ
+export function selectProduct(query) {
+  return request({
+    url: '/reliabilityPlanProduct/selectProduct',
+    method: 'get',
+    params: query
+  })
+}
+// 鎴愬搧娣诲姞
+export function addOrUpdateProduct(query) {
+  return request({
+    url: '/reliabilityPlanProduct/addOrUpdateProduct',
+    method: 'post',
+    data: query
+  })
+}
+// 鎴愬搧鍒犻櫎
+export function delProduct(query) {
+  return request({
+    url: '/reliabilityPlanProduct/delProduct',
+    method: 'delete',
+    params: query
+  })
+}
+// 鍘熻緟鏂欐煡璇�
+export function selectMaterial(query) {
+  return request({
+    url: '/reliabilityPlanMaterial/selectMaterial',
+    method: 'get',
+    params: query
+  })
+}
+// 鍘熻緟鏂欐坊鍔�
+export function addOrUpdateMaterial(query) {
+  return request({
+    url: '/reliabilityPlanMaterial/addOrUpdateMaterial',
+    method: 'post',
+    data: query
+  })
+}
+// 鍘熻緟鏂欏垹闄�
+export function delMaterial(query) {
+  return request({
+    url: '/reliabilityPlanMaterial/delMaterial',
+    method: 'delete',
+    params: query
+  })
+}
diff --git a/src/views/CNAS/process/method/standardMethod/index.vue b/src/views/CNAS/process/method/standardMethod/index.vue
index 0485bd2..306b43f 100644
--- a/src/views/CNAS/process/method/standardMethod/index.vue
+++ b/src/views/CNAS/process/method/standardMethod/index.vue
@@ -41,7 +41,7 @@
       </div>
     </div>
     <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
-      :height="'calc(100vh - 250px)'" style="padding: 20px; padding-top: 0" @pagination="pagination"></lims-table>
+      :height="'calc(100vh - 250px)'" @pagination="pagination"></lims-table>
     <!-- 鏂板/缂栬緫 -->
     <el-dialog :title="title" :visible.sync="addDlog" width="500px">
       <el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
new file mode 100644
index 0000000..4e3246f
--- /dev/null
+++ b/src/views/business/reliabilityPlan/index.vue
@@ -0,0 +1,489 @@
+<template>
+  <div class="app-container">
+    <div class="search">
+      <el-form :model="entity" ref="entity" size="small" :inline="true">
+        <el-form-item label="浜у搧鍨嬪彿" prop="productType" v-if="tabIndex === 0">
+          <el-input v-model="entity.productType" clearable placeholder="璇疯緭鍏�" size="small"
+                    @keyup.enter.native="goSearch($event)">
+          </el-input>
+        </el-form-item>
+        <el-form-item label="鍘熻緟鏂欏悕绉�" prop="entrustCode" v-if="tabIndex === 1">
+          <el-input v-model="entity.entrustCode" clearable placeholder="璇疯緭鍏�" size="small"
+                    @keyup.enter.native="goSearch($event)">
+          </el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" type="primary" @click="goSearch()">鏌ヨ</el-button>
+          <el-button size="mini" @click="refresh()">閲嶇疆</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="table">
+      <div class="table-tab">
+        <div>
+          <ul class="tab">
+            <li :class="{ active: tabIndex === 0 }" @click="handleTab(0)">鎴愬搧</li>
+            <li :class="{ active: tabIndex === 1 }" @click="handleTab(1)">鍘熻緟鏂�</li>
+          </ul>
+        </div>
+        <div>
+          <el-button size="small" type="primary" @click="openAddDia('add')">鏂板</el-button>
+        </div>
+      </div>
+      <!--鎴愬搧-->
+      <div class="table">
+        <lims-table :tableData="tableData" :column="column"
+                    v-if="tabIndex === 0"
+                    @pagination="pagination"
+                    ref="tableData"
+                    :height="'calc(100vh - 290px)'"
+                    key="tableData" :page="page"
+                    :tableLoading="tableLoading"></lims-table>
+      </div>
+      <!--鍘熻緟鏂�-->
+      <div class="table">
+        <lims-table :tableData="tableData1" :column="column1"
+                    v-if="tabIndex === 1" :isSelection="true"
+                    @pagination="pagination1"
+                    :height="'calc(100vh - 290px)'"
+                    key="tableData1" :page="page1" :tableLoading="tableLoading1"></lims-table>
+      </div>
+    </div>
+    <el-dialog :visible.sync="proPlanDia" title="鎴愬搧璁″垝">
+      <el-form :model="proPlanForm" ref="proPlanForm" :rules="proPlanRules" label-width="80px" size="small">
+        <el-form-item label="浜у搧鍨嬪彿" prop="productType">
+          <el-input v-model="proPlanForm.productType" placeholder="璇峰~鍐欎骇鍝佸瀷鍙�" :disabled="operationType === 'review'"></el-input>
+        </el-form-item>
+        <el-form-item label="浜у搧鍚嶇О" prop="productName">
+          <el-input v-model="proPlanForm.productName" placeholder="璇峰~鍐欎骇鍝佸悕绉�" :disabled="operationType === 'review'"></el-input>
+        </el-form-item>
+        <el-form-item label="闆朵欢鍙�" prop="partNo">
+          <el-input v-model="proPlanForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿" :disabled="operationType === 'review'"></el-input>
+        </el-form-item>
+        <el-form-item label="瀹℃牳浜�" prop="reviewerId">
+          <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;" :disabled="operationType === 'review'">
+            <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="foot">
+        <el-button v-if="operationType !== 'review'" @click="closeProDia">鍙� 娑�</el-button>
+        <el-button v-if="operationType !== 'review'" type="primary" :loading="submitProLoading" @click="submitProForm">淇� 瀛�</el-button>
+        <el-button v-if="operationType === 'review'" :loading="submitProLoading" @click="submitProForm(0)">涓嶉�氳繃</el-button>
+        <el-button v-if="operationType === 'review'" type="primary" :loading="submitProLoading" @click="submitProForm(1)">閫氳繃</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :visible.sync="materialDia" title="鍘熻緟鏂欒鍒�">
+      <el-form :model="materialForm" ref="materialForm" :rules="materialRules" label-width="90px" size="small">
+        <el-form-item label="鍘熻緟鏂欏悕绉�" prop="materialName">
+          <el-input v-model="materialForm.materialName" placeholder="璇峰~鍐欎骇鍝佸悕绉�" :disabled="operationType === 'review'"></el-input>
+        </el-form-item>
+        <el-form-item label="闆朵欢鍙�" prop="partNo">
+          <el-input v-model="materialForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿" :disabled="operationType === 'review'"></el-input>
+        </el-form-item>
+        <el-form-item label="瀹℃牳浜�" prop="reviewerId">
+          <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;" :disabled="operationType === 'review'">
+            <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="foot">
+        <el-button v-if="operationType !== 'review'" @click="closeMaterialRulesDia">鍙� 娑�</el-button>
+        <el-button v-if="operationType !== 'review'" type="primary" :loading="submitMatLoading" @click="submitMaterialRulesForm">淇� 瀛�</el-button>
+        <el-button v-if="operationType === 'review'" :loading="submitMatLoading" @click="submitMaterialRulesForm(0)">涓嶉�氳繃</el-button>
+        <el-button v-if="operationType === 'review'" type="primary" :loading="submitMatLoading" @click="submitMaterialRulesForm(1)">閫氳繃</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+  addOrUpdateMaterial,
+  addOrUpdateProduct, delMaterial,
+  delProduct,
+  selectMaterial,
+  selectProduct
+} from "@/api/business/reliabilityPlan";
+import {selectUserCondition} from "@/api/system/user";
+import {deleteAuxiliaryWorkingHours} from "@/api/performance/manHour";
+
+export default {
+  name: '',
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: {limsTable},
+  data() {
+    // 杩欓噷瀛樻斁鏁版嵁
+    return {
+      entity: {
+        productType: null,
+        entrustCode: null,
+      },
+      tabIndex: 0,
+      // 鎴愬搧table鏁版嵁
+      tableData: [],
+      tableLoading: false,
+      column: [
+        { label: '浜у搧鍨嬪彿', prop: 'productType' },
+        { label: '浜у搧鍚嶇О', prop: 'productName' },
+        { label: '闆朵欢鍙�', prop: 'partNo' },
+        {
+          dataType: 'tag',
+          label: '瀹℃牳鐘舵��',
+          prop: 'state',
+          formatData: (params) => {
+            if (params == 1) {
+              return '閫氳繃'
+            } else if (params == 0) {
+              return '涓嶉�氳繃'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 1) {
+              return 'success'
+            } else if (params == 0) {
+              return 'danger'
+            } else {
+              return null
+            }
+          }
+        },
+        {
+          dataType: 'action',
+          label: '鎿嶄綔',
+          fixed: 'right',
+          operation: [
+            {
+              name: '缂栬緫',
+              type: 'text',
+              clickFun: (row) => {
+                this.openAddDia('edit',row);
+              }
+            },
+            {
+              name: '瀹℃牳',
+              type: 'text',
+              clickFun: (row) => {
+                this.openAddDia('review',row);
+              },
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabled: (row) => {
+                return row.state == 1
+              },
+            },
+          ]
+        }
+      ],
+      page: {
+        total: 0,
+        size: 20,
+        current: 1
+      },
+      //
+      // 鍘熻緟鏂檛able鏁版嵁
+      tableData1: [],
+      tableLoading1: false,
+      column1: [
+        { label: '鍘熻緟鏂欏悕绉�', prop: 'materialName' },
+        { label: '闆朵欢鍙�', prop: 'partNo' },
+        {
+          dataType: 'tag',
+          label: '瀹℃牳鐘舵��',
+          prop: 'state',
+          formatData: (params) => {
+            if (params == 1) {
+              return '閫氳繃'
+            } else if (params == 0) {
+              return '涓嶉�氳繃'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 1) {
+              return 'success'
+            } else if (params == 0) {
+              return 'danger'
+            } else {
+              return null
+            }
+          }
+        },
+        {
+          dataType: 'action',
+          fixed: 'right',
+          label: '鎿嶄綔',
+          operation: [
+            {
+              name: '缂栬緫',
+              type: 'text',
+              clickFun: (row) => {
+                this.openAddDia('edit',row);
+              }
+            },
+            {
+              name: '瀹℃牳',
+              type: 'text',
+              clickFun: (row) => {
+                this.openAddDia('review',row);
+              },
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDeleteM(row);
+              },
+              disabled: (row) => {
+                return row.state == 1
+              },
+            },
+          ]
+        }
+      ],
+      page1: {
+        total: 0,
+        size: 20,
+        current: 1
+      },
+      proPlanDia: false,
+      responsibleOptions: [],
+      proPlanForm: {
+        id: '',
+        productName: '',
+        productType: '',
+        partNo: '',
+      },
+      proPlanRules: {
+
+      },
+      submitProLoading: false,
+      operationType: '',
+      materialDia: false,
+      materialForm: {
+        id: '',
+        materialName: '',
+        partNo: '',
+        state: '',
+      },
+      materialRules: {},
+      submitMatLoading: false,
+    };
+  },
+  mounted() {
+    this.goSearch()
+  },
+  // 鏂规硶闆嗗悎
+  methods: {
+    // 鐐瑰嚮鏌ヨ鍥炶皟
+    goSearch(event) {
+      if (event && typeof event.preventDefault === 'function') {
+        event.preventDefault(); // 闃绘榛樿琛屼负
+      }
+      this.page.current = 1
+      this.page1.current = 1
+      this.refreshTable()
+    },
+    // 鍒囨崲涓嬪崟tab琛ㄦ牸
+    handleTab(m) {
+      this.tabIndex = m;
+      this.refreshTable()
+    },
+    pagination(page) {
+      this.page.size = page.limit
+      this.refreshTable()
+    },
+    pagination1(page) {
+      this.page1.size = page.limit
+      this.refreshTable()
+    },
+    // 鏌ヨ鍥炶皟
+    refreshTable() {
+      if (this.tabIndex === 0) {
+        // 鎴愬搧鏌ヨ
+        this.getProductOrderList()
+      } else if (this.tabIndex === 1) {
+        // 鍘熻緟鏂欐煡璇�
+        this.getMaterialOrderList()
+      }
+    },
+    getProductOrderList () {
+      this.tableLoading = true
+      selectProduct({...this.entity, ...this.page}).then(response => {
+        this.tableLoading = false
+        this.tableData = response.data.records
+      }).catch(error => {
+        this.tableLoading = false
+      })
+    },
+    getMaterialOrderList () {
+      this.tableLoading1 = true
+      selectMaterial({...this.entity, ...this.page}).then(response => {
+        this.tableLoading1 = false
+        this.tableData1 = response.data.records
+      }).catch(err => {
+        this.tableLoading1 = false
+      })
+    },
+    // 閲� 缃�
+    refresh() {
+      this.resetForm('entity')
+      this.refreshTable()
+    },
+    // 鎵撳紑鏂板寮规
+    openAddDia(type, row) {
+      this.operationType = type
+      // this.getUserList()
+      if (this.tabIndex === 0) {
+        this.proPlanDia = true
+        if (this.operationType !== 'add') {
+          this.proPlanForm = {...row}
+        }
+      } else {
+        this.materialDia = true
+        if (this.operationType !== 'add') {
+          this.materialForm = {...row}
+        }
+      }
+    },
+    // 鎴愬搧淇℃伅鎻愪氦
+    submitProForm (state) {
+      this.submitProLoading = true
+      if (this.operationType === 'add') {
+        this.proPlanForm.state = ''
+      } else {
+        this.proPlanForm.state = state
+      }
+      addOrUpdateProduct(this.proPlanForm).then(res => {
+        if (res.code === 200) {
+          this.closeProDia()
+          this.$message.success('鎿嶄綔鎴愬姛')
+          this.goSearch()
+        }
+        this.submitProLoading = false
+      }).catch(err => {
+        console.log(err)
+        this.submitProLoading = false
+      })
+    },
+    // 鍏抽棴鎴愬搧淇℃伅寮规
+    closeProDia () {
+      this.resetForm('proPlanDia')
+      this.proPlanDia = false
+    },
+    // 鍘熻緟鏂欎俊鎭彁浜�
+    submitMaterialRulesForm (state) {
+      this.submitMatLoading = true
+      if (this.operationType === 'add') {
+        this.materialForm.state = ''
+      } else {
+        this.materialForm.state = state
+      }
+      addOrUpdateMaterial(this.materialForm).then(res => {
+        if (res.code === 200) {
+          this.closeMaterialRulesDia()
+          this.$message.success('鎿嶄綔鎴愬姛')
+          this.goSearch()
+        }
+        this.submitMatLoading = false
+      }).catch(err => {
+        console.log(err)
+        this.submitMatLoading = false
+      })
+    },
+    // 鍏抽棴鍘熻緟鏂欎俊鎭脊妗�
+    closeMaterialRulesDia() {
+      this.resetForm('materialForm')
+      this.materialDia = false
+    },
+    handleDelete (row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      }).then(() => {
+        delProduct({ id: row.id }).then((res) => {
+          if (res.code == 200){
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.goSearch();
+          }
+        });
+      }).catch(() => {
+
+      });
+    },
+    handleDeleteM (row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      }).then(() => {
+        delMaterial({ id: row.id }).then((res) => {
+          if (res.code == 200){
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.goSearch();
+          }
+        });
+      }).catch(() => {
+
+      });
+    },
+    // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+    getUserList() {
+      selectUserCondition().then(res => {
+        if (res.code == 200) {
+          this.responsibleOptions = res.data
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style scoped>
+.table-tab {
+  display: flex;
+  justify-content: space-between;
+}
+
+.tab {
+  list-style-type: none;
+  display: flex;
+  margin-bottom: 12px;
+  margin-top: 0;
+  padding-left: 0;
+}
+
+.tab li {
+  line-height: 24px;
+  padding: 6px 14px;
+  font-size: 14px;
+  color: #333333;
+  border: 1px solid #EEEEEE;
+  cursor: pointer;
+}
+
+.tab li:nth-child(1) {
+  border-radius: 8px 0 0 8px;
+}
+
+.tab li:nth-child(2) {
+  border-radius: 0 8px 8px 0;
+}
+
+.tab li.active {
+  border-color: #3A7BFA;
+  color: #3A7BFA;
+}
+</style>

--
Gitblit v1.9.3