From e950c38ba82e5e6bc8b0c50c35e5dbb6a180165a Mon Sep 17 00:00:00 2001
From: 13404089107 <puwei@sinata.cn>
Date: 星期二, 20 五月 2025 16:43:06 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 laboratory/src/views/reportLibrary/feasibilityStudy/index.vue |  166 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 118 insertions(+), 48 deletions(-)

diff --git a/laboratory/src/views/reportLibrary/feasibilityStudy/index.vue b/laboratory/src/views/reportLibrary/feasibilityStudy/index.vue
index b7eaf55..3e49b8a 100644
--- a/laboratory/src/views/reportLibrary/feasibilityStudy/index.vue
+++ b/laboratory/src/views/reportLibrary/feasibilityStudy/index.vue
@@ -1,6 +1,6 @@
 <template>
     <div class="list">
-        <el-card class="header-box">
+        <el-card class="header-box" v-if="roleType == 3">
             <div class="box-title">
                 <img src="@/assets/public/notice.png" class="header-icon"> <span>设立课题规则</span>
             </div>
@@ -10,7 +10,7 @@
                 <p>2、在可行研究阶段,工艺开发升级,重新规划工艺研究路线,则以新规划的工艺路线方案来设定课题。</p>
             </div>
         </el-card>
-        <TableCustom :tableData="tableData" :total="total" @handleCurrentChange="handleCurrentChanges"
+        <TableCustom :tableData="tableData" :height="null" :total="total" @handleCurrentChange="handleCurrentChanges"
             @handleSizeChange="handleSizeChanges">
             <template #search>
                 <el-form :model="form" label-width="auto" inline>
@@ -41,13 +41,13 @@
                 </el-form>
             </template>
             <template #setting>
-                <el-button @click="handleAddProject" class="el-icon-plus" type="primary">
+                <el-button v-if="roleType == 3" @click="handleAddProject" class="el-icon-plus" type="primary">
                     新增可研报告</el-button>
                 <div class="table-setting">
-                    <div class="table-title">
+                    <div :class="!isDraft ? 'table-title' : 'table-tit'" @click="changeTab('')">
                         可研报告库
                     </div>
-                    <div class="table-tit">
+                    <div v-if="roleType == 3" :class="!isDraft ? 'table-tit' : 'table-title'" @click="changeTab('-1')">
                         草稿箱
                     </div>
                 </div>
@@ -59,23 +59,33 @@
                 <el-table-column prop="reportName" label="报告名称" />
                 <el-table-column prop="createBy" label="创建人" />
                 <el-table-column prop="createTime" label="创建时间" />
-                <el-table-column prop="status" label="状态">
+                <el-table-column prop="status" label="状态" v-if="!isDraft">
                     <template #default="{ row }">
-                        <el-tag v-if="row.status == 1" type="success">待审核</el-tag>
-                        <el-tag v-else-if="row.status == 0" type="success">已通过</el-tag>
-                        <el-tag v-else type="danger">已驳回</el-tag>
+                        <el-tag v-if="row.status == 1">待审核</el-tag>
+                        <el-tag v-else-if="row.status == 2">待评定</el-tag>
+                        <el-tag v-else-if="row.status == 4" type="danger">已驳回</el-tag>
+                        <el-tag v-else-if="row.status == 3" type="success">已评定</el-tag>
+                        <el-tag v-else-if="row.status == 5" type="info">已撤回</el-tag>
+
                     </template>
                 </el-table-column>
                 <el-table-column prop="options" label="操作">
                     <template #default="{ row }">
-                        <el-button type="text">审核</el-button>
-                        <el-button type="text">详情</el-button>
+                        <el-button type="text" @click="handleApproval(row)"
+                            v-if="row.status == 1 && [1, 2].includes(roleType)">审核</el-button>
+                        <el-button type="text" @click="handleDetail(row)">详情</el-button>
+                        <el-button type="text" @click="handleDelete(row)"
+                            v-if="[4, 5].includes(row.status) && roleType == 3">删除</el-button>
+                        <el-button type="text" @click="handleEdit(row)"
+                            v-if="[4, 5].includes(row.status) && roleType == 3">编辑</el-button>
+                        <el-button type="text" @click="handleRevoke(row)"
+                            v-if="row.status == 1 && roleType == 3">撤销审批</el-button>
                     </template>
                 </el-table-column>
             </template>
         </TableCustom>
 
-        <Approval :visible="showApproval" @close="showApproval = false" />
+        <Approval :visible="showApproval" @close="showApproval = false" :obj="rowData" @approve="handleApprove" />
         <ShowDelConfirm :show="showDelConfirm" @close="showDelConfirm = false" @confirm="handleDelConfirm" />
         <ShowDelConfirm :title="changeStatusTitle" :tip="changeStatusTip" :show="changeStatus"
             @close="changeStatus = false" @confirm="handleChangeStatusConfirm" />
@@ -84,7 +94,7 @@
 
 <script>
 import Approval from './components/approval'
-import { getDataList } from './service'
+import { getDataList, audit, revokeAudit, deleteData } from './service'
 
 export default {
     name: 'ProjectList',
@@ -93,63 +103,98 @@
     },
     data() {
         return {
-            form: {
-                name: ''
-            },
             showDelConfirm: false,
             rowId: '',
             changeStatus: false,
             showApproval: false,
             changeStatusTitle: '',
             changeStatusTip: '',
-            tableData:[],
+            tableData: [],
+            isDraft: false,
+            rowData: {},
+            roleType: '', // 1 超级管理员 2 审批人 3 工艺工程师 4化验师 5实验员
             form: {
                 pageSize: 10,
                 pageNum: 1,
-                teamName:'',
-                status:'',
-                startTime:'',
-                reportType:1,
-                reportName:'',
-                reportCode:'',
-                endTime:'',
-                date:''
+                teamName: '',
+                status: '',
+                startTime: '',
+                reportType: 1,
+                reportName: '',
+                reportCode: '',
+                endTime: '',
+                date: ''
             },
             total: 0
         }
     },
 
     mounted() {
+        this.roleType = JSON.parse(sessionStorage.getItem('userInfo'))?.roleType
+        console.log('adwqedwqeqwe', this.roleType);
+
         this.getList()
     },
-    
+
     methods: {
+        handleApproval(row) {
+            this.rowData = row
+            this.showApproval = true
+        },
+        handleDetail(row) {
+            row.isDetail = true
+            this.rowData = row
+            this.showApproval = true
+        },
+        handleEdit(row) {
+            this.$router.push({
+                path: '/reportLibrary/edit',
+                query: {
+                    id: row.id
+                }
+            })
+        },
         handleAddProject() {
             this.$router.push('/reportLibrary/add')
         },
-        handleDel(row) {
+        changeTab(status) {
+            if (status == -1) {
+                this.isDraft = true
+                this.form.pageNum = 1
+            } else {
+                this.form.pageNum = 1
+                this.isDraft = false
+                this.form.status = status
+            }
+            this.getList()
+        },
+        handleDelete(row) {
             this.rowId = row.id
             this.showDelConfirm = true
         },
-        handleDelConfirm() {
-            this.showDelConfirm = false
-            this.msgsuccess('删除成功')
-            this.rowId = ''
-            this.getList()
-        },
-        handleChangeStatus(row, status) {
+        handleRevoke(row) {
             this.rowId = row.id
-            this.changeStatusTitle = status == 1 ? '确认要封存这个项目组吗?' : '确认要解封该项目组吗?'
-            this.changeStatusTip = status == 1 ? '封存后项目组内人员看不到数据,审批人仍然可见数据。' : '解封后项目组内人员数据恢复。'
+            this.changeStatusTitle = '确认要撤销审批吗?'
+            this.changeStatusTip = '撤销审批后,可研报告将被撤销。'
             this.changeStatus = true
         },
+        handleDelConfirm() {
+            deleteData({ id: this.rowId }).then(res => {
+                this.showDelConfirm = false
+                this.$message.success('删除成功')
+                this.rowId = ''
+                this.getList()
+            })
+        },
         handleChangeStatusConfirm() {
-            this.changeStatus = false
-            this.msgsuccess('操作成功')
-            this.rowId = ''
-            this.changeStatusTitle = ''
-            this.changeStatusTip = ''
-            this.getList()
+            revokeAudit({ id: this.rowId }).then(res => {
+                this.changeStatus = false
+                this.$message.success('操作成功')
+                this.rowId = ''
+                this.changeStatusTitle = ''
+                this.changeStatusTip = ''
+                this.getList()
+            })
         },
         handleCurrentChanges(page) {
             this.form.pageNum = page
@@ -160,21 +205,46 @@
             this.getList()
         },
         getList() {
-            getDataList(this.form).then(res => {
-                console.log('sdasdasdqweqw',res);
-                this.tableData = res.records || []
-                this.total = res.total || 0
+            let data = {}
+            if (this.isDraft) {
+                data = {
+                    ...this.form,
+                    status: -1
+                }
+            } else {
+                data = this.form
+            }
+            getDataList(data).then(res => {
+                if (res.code === 200) {
+                    this.tableData = res.data.records || []
+                    this.total = res.data.total || 0
+                }
             })
+        },
+        handleApprove(data) {
+            let params = {
+                id: data.id,
+                auditStatus: data.statuss,
+                auditRemark: data.remark
+            }
 
+            audit({ ...params }).then(res => {
+                if (res.code === 200) {
+                    this.$message.success('审核成功')
+                    this.showApproval = false
+                    this.getList()
+                }
+            })
         }
     }
 }
 </script>
 
 <style scoped lang="less">
-.el-icon-plus{
+.el-icon-plus {
     margin-bottom: 20px;
 }
+
 .header-content {
     font-family: PingFangSC, PingFang SC;
     font-weight: 400;
@@ -225,7 +295,7 @@
     font-family: SourceHanSansCN, SourceHanSansCN;
     font-weight: bold;
     font-size: 18px;
-    color: #049C9A;
+    color: #606266;
     line-height: 27px;
 }
 

--
Gitblit v1.7.1