hejianhao
2025-05-09 a0c49d7a675d55c73a76eb466202619929f44ec2
laboratory/src/views/projectList/index.vue
@@ -22,26 +22,26 @@
                </el-form>
            </template>
            <template #setting>
                <el-button @click="handleAddProject" class="el-icon-plus" type="primary">
                <el-button @click="handleProject('add')" class="el-icon-plus" type="primary">
                    新增项目组</el-button>
            </template>
            <template #table>
                <el-table-column prop="teamName" label="项目组名称" />
                <el-table-column prop="personCharge" label="项目负责人" />
                <el-table-column prop="staffName" label="项目组成员" />
                <el-table-column prop="age" label="项目创建时间" />
                <el-table-column prop="age" label="状态">
                <el-table-column prop="createTime" label="项目创建时间" />
                <el-table-column prop="status" label="状态">
                    <template #default="{ row }">
                        <el-tag v-if="row.status == 1" type="success">正常运作</el-tag>
                        <el-tag v-else type="danger">已封存</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="age" label="操作">
                <el-table-column label="操作">
                    <template #default="{ row }">
                        <el-button type="text" @click="handleChangeStatus(row, 1)">封存</el-button>
                        <el-button type="text" @click="handleChangeStatus(row, 0)">解封</el-button>
                        <el-button type="text">编辑</el-button>
                        <el-button type="text">详情</el-button>
                        <el-button v-if="row.status == 1" type="text" @click="handleChangeStatus(row, 2)">封存</el-button>
                        <el-button v-if="row.status == 2" type="text" @click="handleChangeStatus(row, 1)">解封</el-button>
                        <el-button type="text" @click="handleProject('edit', row.id)">编辑</el-button>
                        <el-button type="text" @click="handleProject('detail', row.id)">详情</el-button>
                        <el-button type="text" @click="handleDel(row)">删除</el-button>
                    </template>
                </el-table-column>
@@ -54,7 +54,7 @@
</template>
<script>
import { getProjectList } from './service'
import { getProjectList, changeStatus, deleteProject } from './service'
import moment from 'moment'
export default {
    name: 'ProjectList',
@@ -62,6 +62,7 @@
        return {
            showDelConfirm: false,
            rowId: '',
            status: null,
            changeStatus: false,
            changeStatusTitle: '',
            changeStatusTip: '',
@@ -77,34 +78,60 @@
        this.getList()
    },
    methods: {
        handleAddProject() {
            this.$router.push({
                path: '/projectList/addProject'
            })
        handleProject(type, id) {
            if (type == 'add') {
                this.$router.push({
                    path: '/projectList/addProject'
                })
                return
            }
            if (type == 'edit') {
                this.$router.push({
                    path: '/projectList/editProject',
                    query: {
                        id
                    }
                })
                return
            }
            if (type == 'detail') {
                this.$router.push({
                    path: '/projectList/detailProject',
                    query: {
                        id
                    }
                })
                return
            }
        },
        handleDel(row) {
            this.rowId = row.id
            this.showDelConfirm = true
        },
        handleDelConfirm() {
            this.showDelConfirm = false
            this.msgsuccess('删除成功')
            this.rowId = ''
            this.getList()
            deleteProject({ id: this.rowId }).then(res => {
                this.showDelConfirm = false
                this.msgsuccess('删除成功')
                this.rowId = ''
                this.getList()
            })
        },
        handleChangeStatus(row, status) {
            this.rowId = row.id
            this.changeStatusTitle = status == 1 ? '确认要封存这个项目组吗?' : '确认要解封该项目组吗?'
            this.changeStatusTip = status == 1 ? '封存后项目组内人员看不到数据,审批人仍然可见数据。' : '解封后项目组内人员数据恢复。'
            this.status = status
            this.changeStatusTitle = status == 2 ? '确认要封存这个项目组吗?' : '确认要解封该项目组吗?'
            this.changeStatusTip = status == 2 ? '封存后项目组内人员看不到数据,审批人仍然可见数据。' : '解封后项目组内人员数据恢复。'
            this.changeStatus = true
        },
        handleChangeStatusConfirm() {
            this.changeStatus = false
            this.msgsuccess('操作成功')
            this.rowId = ''
            this.changeStatusTitle = ''
            this.changeStatusTip = ''
            this.getList()
            changeStatus({ id: this.rowId, status: this.status }).then(res => {
                this.changeStatus = false
                this.msgsuccess('操作成功')
                this.rowId = ''
                this.changeStatusTitle = ''
                this.changeStatusTip = ''
                this.getList()
            })
        },
        handleCurrentChange(page) {
            this.queryForm.pageNum = page