From 679ede97899d73d5a7619091b6ee3b7c881d1627 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期六, 28 六月 2025 10:04:27 +0800
Subject: [PATCH] 修改bug

---
 laboratory/src/views/chemistQa/projectTesting/add.vue |  140 +++++++++++++++++++++++++++++-----------------
 1 files changed, 87 insertions(+), 53 deletions(-)

diff --git a/laboratory/src/views/chemistQa/projectTesting/add.vue b/laboratory/src/views/chemistQa/projectTesting/add.vue
index b3209f9..a684086 100644
--- a/laboratory/src/views/chemistQa/projectTesting/add.vue
+++ b/laboratory/src/views/chemistQa/projectTesting/add.vue
@@ -16,10 +16,10 @@
                     <el-table-column prop="teamName" label="项目组名称" />
                     <el-table-column prop="personCharge" label="项目负责人" />
                     <el-table-column prop="staffName" label="项目组成员">
-                                    <template #default="{ row }">
-                                        <span>{{row.staffName?row.staffName:row.staffs.map(item => item.nickName).join(',')}}</span>
-                                    </template>
-                                </el-table-column>
+                        <template #default="{ row }">
+                            <span>{{row.staffName ? row.staffName : row.staffs.map(item => item.nickName).join(',')}}</span>
+                        </template>
+                    </el-table-column>
                     <el-table-column prop="createTime" label="创建时间" />
                 </template>
             </Table>
@@ -27,36 +27,40 @@
                 <el-row :gutter="20">
                     <el-col :span="24">
                         <el-form-item prop="itemName" label="检测项名称">
-                            <el-input v-model="form.itemName" style="width: 100%;" placeholder="请输入检测项名称" :disabled="isDetail" />
+                            <el-input v-model="form.itemName" style="width: 100%;" placeholder="请输入检测项名称"
+                                :disabled="isDetail" />
                         </el-form-item>
                         <el-form-item prop="itemCode" label="检测项编号" style="margin-left: 100px;">
-                            <el-input v-model="form.itemCode" style="width: 100%;" placeholder="请输入检测项编号" :disabled="isDetail" />
+                            <el-input v-model="form.itemCode" style="width: 100%;" placeholder="请输入检测项编号"
+                                :disabled="isDetail" />
                         </el-form-item>
                     </el-col>
-                    
+
                 </el-row>
 
                 <div class="notice">备注内容</div>
 
                 <div prop="remark" style="margin-top: 18px">
-                    <el-input v-model="form.remark" type="textarea" :rows="4" style="width: 100%;" placeholder="请输入备注内容" :disabled="isDetail" />
+                    <el-input v-model="form.remark" type="textarea" :rows="4" style="width: 100%;" placeholder="请输入备注内容"
+                        :disabled="isDetail" />
                 </div>
-               
+
                 <div class="notice" style="margin: 18px 0;" v-if="isDetail">报告列表</div>
 
                 <div class="table-setting" v-if="isDetail">
                     <div class="flex a-center">
-                        <div class="table-title" :class="{ active: currentType === 'list' }" @click="handleTypeChange('list')">
+                        <div class="table-title" :class="{ active: currentType === 'list' }"
+                            @click="handleTypeChange('list')">
                             项目检测项、检验包列表
                         </div>
-                        <div class="table-tit" :class="{ active: currentType === 'draft' }" @click="handleTypeChange('draft')">
+                        <div class="table-tit" :class="{ active: currentType === 'draft' }"
+                            @click="handleTypeChange('draft')">
                             草稿箱
                         </div>
                     </div>
                 </div>
 
-                <Table :data="reportTableData" :total="reportTotal" row-key="id" :height="null" @handlePageChange="handlePageChange" @handleSizeChange="handleSizeChange"
-                   v-if="isDetail">
+                <Table :data="reportTableData" :total="reportTotal" row-key="id" :height="null" v-if="isDetail">
                     <el-table-column prop="reportContent" label="报告内容">
                         <template #default="{ row }">
                             <span>{{ getReportContentText(row.reportContent) }}</span>
@@ -68,6 +72,7 @@
                     <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 == 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>
@@ -87,6 +92,11 @@
                                 <el-button type="text" @click="handleWithdraw(row)">编辑</el-button>
                                 <el-button type="text" @click="handleDelete(row)">删除</el-button>
                             </template>
+                            <template v-else-if="row.status === -1">
+                                <el-button type="text" @click="handleReportDetail(row)">详情</el-button>
+                                <el-button type="text" @click="handleWithdraw(row)">编辑</el-button>
+                                <el-button type="text" @click="handleDelete(row)">删除</el-button>
+                            </template>
                         </template>
                     </el-table-column>
                 </Table>
@@ -98,14 +108,9 @@
             </el-form>
         </Card>
         <chooseProject @submit="getProjectData" :show="showChoose" @close="showChoose = false"></chooseProject>
-            <!-- 删除确认弹窗 -->
-    <ShowDelConfirm 
-      :title="changeStatusTitle" 
-      :tip="changeStatusTip" 
-      :show="changeStatus"
-      @close="changeStatus = false" 
-      @confirm="handleChangeStatusConfirm" 
-    />
+        <!-- 删除确认弹窗 -->
+        <ShowDelConfirm :title="changeStatusTitle" :tip="changeStatusTip" :show="changeStatus"
+            @close="changeStatus = false" @confirm="handleChangeStatusConfirm" />
     </div>
 
 </template>
@@ -114,12 +119,12 @@
 import AiEditor from '@/components/AiEditor'
 import chooseProject from '@/components/chooseProject'
 import ShowDelConfirm from "@/components/showDelConfirm/index.vue";
-import {addData, editData, getDetail} from './service'
+import { addData, editData, getDetail,revokedReport,deleteDetail } from './service'
 
 export default {
-    components: { 
+    components: {
         AiEditor,
-        chooseProject,ShowDelConfirm
+        chooseProject, ShowDelConfirm
     },
     data() {
         return {
@@ -153,6 +158,7 @@
             changeStatusTitle: '',
             changeStatusTip: '',
             currentRow: null,
+            itemId: null,
             currentAction: '' // 'revoke' 或 'delete'
         }
     },
@@ -165,18 +171,21 @@
             }
             this.getDetail()
         }
+        if (this.$route.query.itemId) {
+            this.itemId = this.$route.query.itemId
+        }
     },
     methods: {
         getDetail() {
             getDetail(this.$route.query.id).then(res => {
                 if (res) {
-                    this.form = res
+                    this.form = { ...res }
                     if (res.projectTeamVO) {
                         this.tableData = [{
                             ...res.projectTeamVO,
                         }]
                     }
-                    if(res.qaTestItemReportList.length > 0){
+                    if (res.qaTestItemReportList.length > 0) {
                         this.allReportTableData = res.qaTestItemReportList
                         this.reportTableData = res.qaTestItemReportList.filter(item => item.status != '-1')
                     }
@@ -263,9 +272,10 @@
         handleReportDetail(row) {
             // 处理报告详情
             this.$router.push({
-                path: '/chemistQa/projectTesting/add',
+                path: '/chemistQa/addDetectionReport',
                 query: {
                     id: row.id,
+                    itemId: this.$route.query.id,
                     type: 'detail'
                 }
             })
@@ -273,12 +283,12 @@
         getReportList(type) {
             // 获取报告列表数据
             // TODO: 调用接口获取数据
-            if(type=='list'){
+            if (type == 'list') {
                 this.reportTableData = this.allReportTableData.filter(item => item.status != '-1');
-            }else{
+            } else {
                 this.reportTableData = this.allReportTableData.filter(item => item.status == '-1');
             }
-            
+
         },
         handleRevokeApproval(row) {
             this.currentRow = row;
@@ -288,15 +298,13 @@
             this.changeStatus = true;
         },
         handleWithdraw(row) {
-            this.$confirm('确认撤回该记录吗?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(() => {
-                // TODO: 调用撤回接口
-                this.$message.success('撤回成功')
-            }).catch(() => {
-                this.$message.info('已取消撤回')
+            this.$router.push({
+                path: '/chemistQa/addDetectionReport',
+                query: {
+                    id: row.id,
+                    itemId: this.$route.query.id,
+                    type: 'edit'
+                }
             })
         },
         handleDelete(row) {
@@ -306,19 +314,44 @@
             this.changeStatusTip = '删除后记录将无法找回';
             this.changeStatus = true;
         },
-        handleChangeStatusConfirm() {
+        async handleChangeStatusConfirm() {
             if (this.currentAction === 'revoke') {
                 // TODO: 调用撤销审批接口
+                const res = await revokedReport({ id: this.currentRow.id });
+                if (res.code === 200) {
+                    this.loading = false;
+                    this.$message.success('撤销审批成功');
+                    this.changeStatus = false;
+                    this.currentRow = null;
+                    this.currentAction = '';
+                    // 刷新列表
+                    this.getReportList();
+
+                } else {
+                    this.$message.error(res.msg || '撤销审批失败');
+                }
                 this.$message.success('撤销审批成功');
             } else if (this.currentAction === 'delete') {
                 // TODO: 调用删除接口
+                const res = await deleteDetail({ id: this.currentRow.id });
+                if (res) {
+                    this.loading = false;
+                    this.$message.success('删除成功');
+                    this.changeStatus = false;
+                    this.currentRow = null;
+                    this.currentAction = '';
+                    // 刷新列表
+                    this.getReportList();
+
+                } else {
+                    this.$message.error(res.msg || '删除失败');
+                }
                 this.$message.success('删除成功');
             }
-            this.changeStatus = false;
-            this.currentRow = null;
-            this.currentAction = '';
-            // 刷新列表
-            this.getReportList();
+
+
+
+
         },
         getReportContentText(value) {
             const contentMap = {
@@ -337,14 +370,15 @@
 </script>
 
 <style lang="less" scoped>
-.notice{
+.notice {
     flex-shrink: 0;
-            font-weight: bold;
-            font-size: 18px;
-            color: #222222;
-            line-height: 27px;
-            font-family: "Source Han Sans CN Bold Bold";
+    font-weight: bold;
+    font-size: 18px;
+    color: #222222;
+    line-height: 27px;
+    font-family: "Source Han Sans CN Bold Bold";
 }
+
 .header-title {
     display: flex;
     align-items: center;
@@ -399,12 +433,12 @@
     }
 }
 
-.end-btn{
+.end-btn {
     display: flex;
     align-items: center;
     gap: 10px;
 
-    button{
+    button {
         width: 180px;
         height: 36px;
         // background: #409EFF; 

--
Gitblit v1.7.1