From d8d68a0aee93073b5ec3195368ca0ed1076f66a2 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期三, 25 六月 2025 17:58:08 +0800
Subject: [PATCH] 对接评定接口和中台待办事项

---
 laboratory/src/views/deliveryAssessment/testingAndEvaluation/index.vue |  663 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 478 insertions(+), 185 deletions(-)

diff --git a/laboratory/src/views/deliveryAssessment/testingAndEvaluation/index.vue b/laboratory/src/views/deliveryAssessment/testingAndEvaluation/index.vue
index 781e37c..c1af2ab 100644
--- a/laboratory/src/views/deliveryAssessment/testingAndEvaluation/index.vue
+++ b/laboratory/src/views/deliveryAssessment/testingAndEvaluation/index.vue
@@ -1,214 +1,507 @@
 <template>
-    <div class="list">
-        <TableCustom :queryForm="queryForm" :tableData="tableData" :total="total" @currentChange="handleCurrentChange"
-            @sizeChange="handleSizeChange">
-            <template #search>
-                <el-form :model="form" label-width="140px" inline>
-                    <el-form-item label="所属项目组:">
-                        <el-input v-model="form.name" placeholder="请输入" />
-                    </el-form-item>
-                    <el-form-item label="检测项名称:">
-                        <el-input v-model="form.name" placeholder="请输入" />
-                    </el-form-item>
-                    <el-form-item label="检测项编号:">
-                        <el-input v-model="form.name" placeholder="请输入" />
-                    </el-form-item>
-                    <el-form-item label="状态:">
-                        <el-select v-model="form.name" placeholder="请选择" />
-                    </el-form-item>
-                    <el-form-item class="search-btn-box">
-                        <el-button>重置</el-button>
-                        <el-button type="primary">查询</el-button>
-                    </el-form-item>
-                </el-form>
-            </template>
-            <template #setting>
-                <div class="table-title">
-                    项目检查项、检验包
+  <div class="list">
+    <TableCustom
+      :queryForm="queryForm"
+      :height="0"
+      :total="total"
+      @currentChange="handleCurrentChange"
+      @sizeChange="handleSizeChange"
+    >
+      <template #search>
+        <el-form
+          ref="searchForm"
+          :model="form"
+          :rules="rules"
+          label-width="auto"
+          inline
+        >
+          <el-form-item label="所属项目组:">
+            <el-input v-model="form.teamName" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="检测项名称:">
+            <el-input v-model="form.itemName" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="检测项编号:">
+            <el-input v-model="form.itemCode" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="报告内容:">
+            <el-select v-model="form.reportContent" placeholder="请选择">
+              <el-option label="国家标准" value="1"></el-option>
+              <el-option label="分析方法开发" value="2"></el-option>
+              <el-option label="方法验证报告" value="3"></el-option>
+              <el-option label="方法确认" value="4"></el-option>
+              <el-option label="操作规程" value="5"></el-option>
+              <el-option label="方法转移记录清单" value="6"></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="状态:">
+            <el-select v-model="form.status" placeholder="请选择">
+              <el-option label="全部" value=""></el-option>
+              <el-option label="草稿箱" value="-1"></el-option>
+              <el-option label="已提交" value="1"></el-option>
+              <el-option label="待评定" value="2"></el-option>
+              <el-option label="已评定" value="3"></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="" style="margin-left: 63px">
+            <el-button
+              type="default"
+              style="margin-right: 10px"
+              @click="handleReset"
+              >重置</el-button
+            >
+            <el-button type="primary" @click="handleSearch">查询</el-button>
+          </el-form-item>
+        </el-form>
+      </template>
+      <template #setting>
+        <div class="table-setting">
+          <div class="flex a-center">
+            <div class="table-title active">项目检测项、检验包列表</div>
+          </div>
+        </div>
+      </template>
+      <template #tableCustom>
+        <Table
+          :data="tableData"
+          :total="total"
+          @row-click="handleRowClick"
+          row-key="id"
+          :height="null"
+          @currentChange="handleCurrentChange"
+          @sizeChange="handleSizeChange"
+          :expand-row-keys="expandRowKeys"
+        >
+          <el-table-column type="expand" width="1">
+            <template #default="{ row }">
+              <div class="expand-box">
+                <div style="display: flex; align-items: center">
+                  <div class="expand-box-title">报告列表</div>
                 </div>
-            </template>
-            <template #tableCustom>
-                <Table :data="tableData" :total="0" @row-click="handleRowClick" row-key="id"
-                    :expand-row-keys="expandRowKeys">
-                    <el-table-column type="expand" width="1">
-                        <template #default="{ row }">
-                            <div class="expand-box">
-                                <div class="expand-box-title">报告列表</div>
-                                <Table :total="0" :height="null">
-                                    <el-table-column prop="name" label="报告内容" />
-                                    <el-table-column prop="name" label="制订人" />
-                                    <el-table-column prop="name" label="制订日期" />
-                                    <el-table-column prop="name" label="检测项编号" />
-                                    <el-table-column prop="name" label="审批人" />
-                                    <el-table-column prop="name" label="审批时间" />
-                                    <el-table-column prop="age" label="状态">
-                                        <template #default="{ row }">
-                                            <el-tag v-if="row.status == 1" type="info" color="#fff">已通过</el-tag>
-                                            <el-tag v-else type="success">未通过</el-tag>
-                                        </template>
-                                    </el-table-column>
-                                    <el-table-column prop="age" label="操作">
-                                        <template #default="{ row }">
-                                            <el-button type="text">详情</el-button>
-                                        </template>
-                                    </el-table-column>
-                                </Table>
-                            </div>
-                        </template>
-                    </el-table-column>
-                    <el-table-column prop="name" label="所属项目组" />
-                    <el-table-column prop="age" label="检测项名称" />
-                    <el-table-column prop="age" label="检测项编号" />
-                    <el-table-column prop="age" label="备注" />
-                    <el-table-column prop="age" label="创建人" />
-                    <el-table-column prop="age" label="创建时间" />
-                    <el-table-column prop="age" label="状态">
-                        <template #default="{ row }">
-                            <el-tag v-if="row.status == 1" type="info" color="#fff">已评定</el-tag>
-                            <el-tag v-else type="success">待评定</el-tag>
-                        </template>
-                    </el-table-column>
-                    <el-table-column prop="age" label="操作">
-                        <template #default="{ row }">
-                            <!-- 工艺工程师 -->
-                            <!-- <el-button type="text" @click="assessmentVisible = true">评定</el-button> -->
-                            <el-button type="text" @click="assessmentVisible = true">详情</el-button>
-                        </template>
-                    </el-table-column>
+                <Table
+                  :data="reportList[row.id] || []"
+                  :total="0"
+                  :height="null"
+                >
+                  <el-table-column prop="reportContent" label="报告内容">
+                    <template #default="{ row }">
+                      <span>{{ getReportContentText(row.reportContent) }}</span>
+                    </template>
+                  </el-table-column>
+                  <el-table-column prop="developPerson" label="制订人" />
+                  <el-table-column prop="createTime" label="制订日期" />
+                  <el-table-column prop="auditPersonName" label="审批人" />
+                  <el-table-column prop="auditTime" label="审批时间" />
+                  <el-table-column prop="status" label="状态">
+                    <template #default="{ row }">
+                      <el-tag v-if="row.status == 1" type="info" color="#fff"
+                        >待审核</el-tag
+                      >
+                      <el-tag v-if="row.status == 2" type="success" color="#fff"
+                        >已通过</el-tag
+                      >
+                      <el-tag v-if="row.status == 3" type="danger"
+                        >已驳回</el-tag
+                      >
+                      <el-tag v-if="row.status == 4" type="danger"
+                        >已撤销</el-tag
+                      >
+                    </template>
+                  </el-table-column>
+                  <el-table-column prop="age" label="操作">
+                    <template #default="{ row }">
+                      <el-button type="text" v-if="row.status == 2" @click="handleApprove(row)"
+                        >详情</el-button
+                      >
+                    </template>
+                  </el-table-column>
                 </Table>
+              </div>
             </template>
-        </TableCustom>
+          </el-table-column>
+          <el-table-column prop="teamName" label="所属项目组" />
+          <el-table-column prop="itemName" label="检测项名称" />
+          <el-table-column prop="itemCode" label="检测项编号" />
+          <el-table-column prop="remark" label="备注" />
+          <el-table-column prop="createBy" label="创建人" />
+          <el-table-column prop="createTime" label="创建时间" />
+          <el-table-column prop="age" label="状态">
+            <template #default="{ row }">
+              <el-tag v-if="row.status == -1" type="info" color="#fff"
+                >草稿箱</el-tag
+              >
+              <el-tag v-else-if="row.status == 1" type="warning">已提交</el-tag>
+              <el-tag v-else-if="row.status == 2" type="primary">待评定</el-tag>
+              <el-tag v-else-if="row.status == 3" type="success">已评定</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column prop="age" label="操作">
+            <template #default="{ row }">
+              <template>
+                <el-button
+                  v-if="row.status == 2 && isProcessEngineer"
+                  type="text"
+                  @click="handleReportDetail(row, 'approve')"
+                  >评定</el-button
+                >
+                <el-button
+                  v-else
+                  type="text"
+                  @click="handleReportDetail(row, 'detail')"
+                  >详情</el-button
+                >
+              </template>
+            </template>
+          </el-table-column>
+        </Table>
+      </template>
+    </TableCustom>
 
-        <AssessmentDialog :modelValue="assessmentVisible" :reportData="currentReport"
-            @submit="handleAssessmentSubmit" />
-    </div>
+    <Approval
+      :visible="showApproval"
+      @close="closeApproval"
+      :data="rowData"
+      :type="approvalType"
+    />
+    <AssessmentDialog
+      :modelValue="showAssessmentDialog"
+      :reportData="assessmentDialogData"
+      :id="assessmentDialogId"
+      :type="assessmentDialogType"
+      @close="handleCloseAssessmentDialog"
+    />
+  </div>
 </template>
 
 <script>
-import AssessmentDialog from './components/AssessmentDialog.vue'
+import Approval from "./components/approval";
+import AssessmentDialog from "./components/AssessmentDialog.vue";
+import { getDataList, getListByItemId } from "./service";
 
 export default {
-    name: 'TestingAndEvaluation',
-    components: {
-        AssessmentDialog
+  name: "ProjectList",
+  components: {
+    Approval,
+    AssessmentDialog,
+  },
+  data() {
+    return {
+      form: {
+        itemCode: "", // 检测项编号
+        itemName: "", // 检测项名称
+        reportContent: "", // 报告内容
+        status: "", // 状态,默认为空字符串表示全部
+        teamName: "", // 项目组名称
+        pageNum: 1,
+        pageSize: 10,
+      },
+      rules: {
+        itemCode: [
+          { max: 50, message: "检测项编号不能超过50个字符", trigger: "blur" },
+        ],
+        itemName: [
+          { max: 100, message: "检测项名称不能超过100个字符", trigger: "blur" },
+        ],
+        teamName: [
+          { max: 100, message: "项目组名称不能超过100个字符", trigger: "blur" },
+        ],
+      },
+      showSubmitConfirm: false,
+      showDelConfirm: false,
+      confirmTitle: "", // 确认框标题
+      confirmTip: "", // 确认框提示
+      confirmType: "", // 确认框类型:'deleteReport'-删除报告, 'deleteItem'-删除检测项, 'revoke'-撤销审批
+      rowId: "",
+      showApproval: false,
+      approvalType: "", // 新增:审批类型
+      submitTitle: "", // 新增:提交评定确认框标题
+      submitTip: "", // 新增:提交评定确认框提示
+      queryForm: {
+        pageSize: 10,
+        pageNum: 1,
+      },
+      tableData: [],
+      expandRowKeys: [],
+      total: 0,
+      rowData: {},
+      reportList: {}, // 修改为对象,用行ID作为key
+      currentRow: null,
+      currentAction: "",
+      showItemApproval: false,
+      loading: false,
+      showAssessmentDialog: false,
+      assessmentDialogData: {},
+      assessmentDialogId: "",
+      assessmentDialogType: "detail",
+    };
+  },
+  computed: {
+    isChemist() {
+      const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
+      return userInfo.roleType == 4; // 2是化验师
     },
-    data() {
-        return {
-            form: {
-            },
-            tableData: [{ id: 1 }, { id: 2 }],
-            queryForm: {
-                pageSize: 10,
-                pageNum: 1
-            },
-            total: 0,
-            assessmentVisible: false,
-            currentReport: {},
-            expandRowKeys: []
-        }
+    isProcessEngineer() {
+      const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
+      return userInfo.roleType == 3; // 3是工艺工程师
     },
-    methods: {
-        handleRowClick(row, column, event) {
-            if (column.label === '操作') return
-            if (this.expandRowKeys.includes(row.id)) {
-                this.expandRowKeys = this.expandRowKeys.filter(key => key !== row.id);
-            } else {
-                this.expandRowKeys = [row.id];
-            }
-        },
-        handleCurrentChange(page) {
-            this.queryForm.pageNum = page
-            this.getList()
-        },
-        handleSizeChange(size) {
-            this.queryForm.pageSize = size
-            this.getList()
-        },
-        getList() {
-
-        },
-        handleDetail(row) {
-            // 处理详情
-        },
-        handleAssessment(row) {
-            this.currentReport = row;
-            this.assessmentVisible = true;
-        },
-        handleAssessmentSubmit(data) {
-            console.log('评定提交数据:', data);
-            // 处理评定提交
+    isApprovaler() {
+      const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
+      return userInfo.roleType == 2; // 2是审批人
+    },
+  },
+  methods: {
+    closeApproval() {
+      this.showApproval = false;
+      this.rowData = {};
+      this.approvalType = "";
+      this.getList();
+    },
+    handleCloseAssessmentDialog(){
+      this.showAssessmentDialog = false;
+      this.assessmentDialogData = {};
+      this.assessmentDialogId = '';
+      this.assessmentDialogType = ''; // 或 'evaluate',根据业务调整
+      this.getList();
+    },
+    async handleRowClick(row, column, event) {
+      if (column.label == "操作") return;
+      const currentOpenId = this.expandRowKeys[0];
+      if (currentOpenId === row.id) {
+        // 如果点的是当前已展开的,关闭它
+        this.expandRowKeys = [];
+        delete this.reportList[row.id];
+      } else {
+        // 如果有其他已展开的,先关闭
+        if (currentOpenId) {
+          this.expandRowKeys = [];
+          delete this.reportList[currentOpenId];
         }
-    }
-}
+        // 展开新行
+        this.expandRowKeys = [row.id];
+        try {
+          const res = await getListByItemId({ id: row.id });
+          if (res) {
+            this.$set(this.reportList, row.id, res || []);
+          } else {
+            this.msgError(res.msg || "获取报告列表失败");
+          }
+        } catch (error) {
+          console.error("获取报告列表失败:", error);
+          this.msgError("获取报告列表失败");
+        }
+      }
+    },
+    handleApprove(row) {
+      this.showApproval = true;
+      this.rowId = row.id;
+      this.rowData = row;
+      this.approvalType = "detail";
+    },
+    handleCurrentChange(page) {
+      this.queryForm.pageNum = page;
+      this.getList();
+    },
+    handleSizeChange(size) {
+      this.queryForm.pageSize = size;
+      this.getList();
+    },
+    async getList() {
+      if (this.loading) return;
+      try {
+        this.loading = true;
+        const params = {
+          ...this.form,
+          pageNum: this.queryForm.pageNum,
+          pageSize: this.queryForm.pageSize,
+        };
+        let res;
+        res = await getDataList(params);
+        if (res.code === 200) {
+          this.tableData = res.data.records || [];
+          this.total = res.data.total || 0;
+        } else {
+          this.$message.error(res.msg || "获取列表失败");
+        }
+      } catch (error) {
+        console.error("获取列表失败:", error);
+        this.$message.error("获取列表失败,请重试");
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 打开评定弹窗
+    handleReportDetail(row, type) {
+      this.assessmentDialogData = row;
+      this.assessmentDialogId = row.id;
+      this.assessmentDialogType = type; // 或 'evaluate',根据业务调整
+      this.showAssessmentDialog = true;
+    },
+    getReportContentText(value) {
+      const contentMap = {
+        1: "国家标准",
+        2: "分析方法开发",
+        3: "方法验证报告",
+        4: "方法确认",
+        5: "操作规程",
+        6: "方法转移记录清单",
+      };
+      return contentMap[value] || value;
+    },
+    async handleSearch() {
+      try {
+        console.log("111111111");
+        // this.loading = true;
+        await this.$refs.searchForm.validate();
+        this.queryForm.pageNum = 1;
+        await this.getList();
+      } catch (error) {
+        // 如果是校验失败,error会是false,此时不做任何处理,因为el-form会展示错误信息
+        if (error !== false) {
+          this.$message.error("查询失败,请重试");
+        }
+      } finally {
+        this.loading = false;
+      }
+    },
+    async handleReset() {
+      try {
+        // this.loading = true;
+        this.$refs.searchForm.resetFields();
+        // resetFields会把status也置为初始值'',需要根据当前tab重新设置
+        this.form = {
+          itemCode: "",
+          itemName: "",
+          reportContent: "",
+          status: "",
+          teamName: "",
+          pageNum: 1,
+          pageSize: 10,
+        };
+        this.queryForm.pageNum = 1;
+        await this.getList();
+      } catch (error) {
+        this.$message.error("重置失败,请重试");
+      } finally {
+        this.loading = false;
+      }
+    },
+  },
+  mounted() {
+    this.getList();
+  },
+};
 </script>
 
 <style scoped lang="less">
-.list {
-    height: 100%;
+.el-icon-plus {
+  margin-bottom: 20px;
 }
 
-.top-box-integral {
-    display: flex;
-    justify-content: space-between;
-    flex-wrap: wrap;
-    gap: 28px;
-
-    &-card {
-        flex: 1;
-        background: #E8FAF6;
-        box-shadow: 0px 10px 10px 0px rgba(0, 0, 0, 0.06);
-        border-radius: 10px;
-        padding: 21px 20px;
-
-        &-title {
-            font-family: 'SourceHanSansCN-Medium';
-            font-size: 14px;
-            color: rgba(0, 0, 0, 0.8);
-        }
-
-        &-num {
-            font-family: 'SF Compact Display Black';
-            text-align: center;
-            font-weight: 900;
-            font-size: 50px;
-            color: #049C9A;
-            line-height: 60px;
-        }
-    }
+.header-content {
+  font-family: PingFangSC, PingFang SC;
+  font-weight: 400;
+  font-size: 14px;
+  color: rgba(0, 0, 0, 0.88);
+  margin-left: 30px;
 }
 
-.tip-warring {
-    margin-top: 20px;
-    color: rgba(255, 73, 85, 1);
+.box-title {
+  font-family: SourceHanSansCN, SourceHanSansCN;
+  font-weight: bold;
+  font-size: 18px;
+  color: #222222;
+  line-height: 27px;
+  display: flex;
+  align-items: center;
+}
+
+.header-icon {
+  width: 20px;
+  height: 20px;
+  margin-right: 10px;
+}
+
+.header-box {
+  border-radius: 16px;
+  margin-bottom: 30px;
+}
+
+.table-setting {
+  display: flex;
+  padding-bottom: 20px;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.flex {
+  display: flex;
+  align-items: center;
 }
 
 .table-title {
-    width: 220px;
-    height: 50px;
-    background: #FFFFFF;
-    border-radius: 8px 8px 0px 0px;
-    border: 1px solid #049C9A;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    font-family: SourceHanSansCN, SourceHanSansCN;
-    font-weight: bold;
-    font-size: 18px;
-    color: #049C9A;
-    line-height: 27px;
+  width: 220px;
+  height: 50px;
+  background: #fafafc;
+  border-radius: 8px 8px 0px 0px;
+  border: 1px solid #dcdfe6;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-family: SourceHanSansCN, SourceHanSansCN;
+  font-weight: bold;
+  font-size: 18px;
+  color: #606266;
+  line-height: 27px;
+  cursor: pointer;
+  transition: all 0.3s ease;
+
+  &.active {
+    color: #049c9a;
+    background: #ffffff;
+    border: 1px solid #049c9a;
+  }
+}
+
+.table-tit {
+  width: 166px;
+  height: 50px;
+  background: #fafafc;
+  border-radius: 8px 8px 0px 0px;
+  border: 1px solid #dcdfe6;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-family: SourceHanSansCN, SourceHanSansCN;
+  font-weight: bold;
+  font-size: 18px;
+  color: #606266;
+  line-height: 27px;
+  margin-left: 16px;
+  cursor: pointer;
+  transition: all 0.3s ease;
+
+  &.active {
+    color: #049c9a;
+    background: #ffffff;
+    border: 1px solid #049c9a;
+  }
+}
+
+.list {
+  height: 100%;
 }
 
 .expand-box {
-    padding: 20px;
-    background: linear-gradient(180deg, #049C9A 0%, #0ACBCA 100%);
-    border-radius: 20px;
+  padding: 20px;
+  background: linear-gradient(180deg, #049c9a 0%, #0acbca 100%);
+  border-radius: 20px;
 
-    &-title {
-        font-weight: 500;
-        font-size: 16px;
-        color: #FFFFFF;
-        line-height: 24px;
-        margin-bottom: 20px;
-    }
+  &-title {
+    font-weight: 500;
+    font-size: 16px;
+    color: #ffffff;
+    line-height: 24px;
+    margin-bottom: 20px;
+  }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.7.1