马宇豪
2025-05-09 cbb23429b8beed72b58cbb57f9b3c56a0fb2b5d2
src/views/experiment/project/index.vue
@@ -13,6 +13,12 @@
                        <el-option v-for="item in projectState.experimentTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div class="basic-line">
                    <span>风险等级:</span>
                    <el-select v-model="projectState.searchQuery.searchParams.assessLevel" clearable filterable class="input-box" placeholder="风险等级">
                        <el-option v-for="item in projectState.riskLevelList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div style="padding-bottom: 10px">
                    <el-button type="primary" @click="getProjectData">查询</el-button>
                    <el-button plain @click="reset">重置</el-button>
@@ -46,11 +52,11 @@
                            <span>{{scope.row.siteList.map(i=>i.siteName).join(',')}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column prop="experimentType" label="实验类别">
                          <template #default="scope">
                            <span>{{projectState.experimentTypeList.find(i=>i.id == scope.row.experimentType)?.name}}</span>
                          </template>
                        </el-table-column>
                      <el-table-column prop="experimentTypeName" label="实验类别" width="130">
                        <!--                          <template #default="scope">-->
                        <!--                            <span>{{developState.experimentTypeList.find(i=>i.id == scope.row.experimentType)?.name}}</span>-->
                        <!--                          </template>-->
                      </el-table-column>
                        <el-table-column prop="status" label="评估申请">
                          <template #default="scope">
                            <span>{{scope.row.status == 1?'未申请':scope.row.status == 2?'已申请':'--'}}</span>
@@ -68,10 +74,15 @@
                            </el-tag>
                          </template>
                        </el-table-column>
                        <el-table-column prop="status" label="最近评估时间" show-overflow-tooltip>
                          <template #default="scope">
                            <span>{{scope.row.experimentAssessLogs?scope.row.experimentAssessLogs.map(i=>i.assessEndTime.substring(0,16)).join(','): ''}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column prop="assessLevel" label="风险等级">
                          <template #default="scope">
                            <el-tag :type="scope.row.assessLevel == 4?'danger':scope.row.assessLevel == 3 || scope.row.assessLevel == 2?'warning':''">
                              {{scope.row.assessLevel == 1?'低风险':scope.row.assessLevel == 2?'一般风险':scope.row.assessLevel == 3?'较大风险':scope.row.assessLevel == 4?'重大风险':'--'}}
                            <el-tag type="info" :class="projectState.tagBg[scope.row.assessLevel - 1]" style="color:#383838;">
                              {{scope.row.assessLevel == 1 ?'重大风险':scope.row.assessLevel == 2?'较大风险':scope.row.assessLevel == 3?'一般风险':scope.row.assessLevel == 4?'低风险':'--'}}
                            </el-tag>
                          </template>
                        </el-table-column>
@@ -81,10 +92,19 @@
<!--                        <el-table-column prop="updateByUserName" label="最后修改人" show-overflow-tooltip></el-table-column>-->
                        <el-table-column label="操作" width="250" fixed="right">
                            <template #default="scope">
                              <div v-if="scope.row.stagingTag === 1">
                                <el-button size="small" text type="primary" :icon="View" @click="openProjectDialog('查看', scope.row)">查看</el-button>
                                <el-button size="small" text type="primary" :icon="Edit" @click="applyStart('申请开展', scope.row)">申请开展</el-button>
                                <el-button size="small" text type="primary" :icon="View" v-if="scope.row.stage == 4" @click="openReportDialog('查看',scope.row)">查看评估报告</el-button>
                                <el-button size="small" text type="primary" :icon="Edit" @click="applyStart('申请开展', scope.row)">转为已开展</el-button>
                                <el-button size="small" :disabled="scope.row.stage == 2 ? true : false" text type="primary" :icon="Edit" @click="applyAccess( scope.row)">申请评估</el-button>
                                <el-button size="small" type="warning" v-if="scope.row.rectifyStatus == 1" text :icon="Edit" @click="openProjectDialog('整改', scope.row)">整改</el-button>
                                <el-button size="small" text type="danger" :icon="Delete" @click="onDelProject(scope.row)">删除</el-button>
                                <el-button size="small" text type="danger" :icon="Delete" :disabled="scope.row.stage !== 1" @click="onDelProject(scope.row)">删除</el-button>
                                <el-button size="small" text type="primary" :icon="Edit" @click="openProjectDialog('编辑', scope.row)">编辑</el-button>
                              </div>
                              <div v-else>
                                <el-button size="small" text type="primary" :icon="Edit" @click="openProjectDialog('编辑', scope.row)">编辑</el-button>
                                <el-button size="small" text type="primary" :icon="Finished"  @click="saveDevelop(scope.row)">提交</el-button>
                              </div>
                            </template>
                        </el-table-column>
                    </el-table>
@@ -97,6 +117,7 @@
        <project-dialog ref="ProjectDialogRef" @refresh="getProjectData"></project-dialog>
<!--        <apply-start ref="ApplyStartRef"></apply-start>-->
        <test ref="ApplyStartRef" @refresh="getProjectData"></test>
        <report-dialog ref="ReportDialogRef"></report-dialog>
    </div>
</template>
@@ -104,15 +125,14 @@
import {defineAsyncComponent, onMounted, reactive, ref} from "vue";
import {projectApi} from "/@/api/experiment/project";
import {ElMessage, ElMessageBox} from "element-plus";
import { View,Edit, Plus, Delete } from '@element-plus/icons-vue';
import { View,Edit, Plus, Delete,Finished } from '@element-plus/icons-vue';
import {roomApi} from "/@/api/basic/room";
const ReportDialog = defineAsyncComponent(() => import('../../analyse/assessApply/components/reportDialog.vue'));
const ProjectDialog = defineAsyncComponent(() => import('./components/projectDialog.vue'));
const Test = defineAsyncComponent(() => import('./components/applyDialog.vue'))
const ProjectDialogRef = ref();
const ApplyStartRef = ref();
const ProjectDialogRef = ref()
const ApplyStartRef = ref()
const ReportDialogRef = ref()
const projectState = reactive<ProjectStateType>({
    projectData: [],
    searchQuery: {
@@ -121,6 +141,7 @@
        searchParams: {
            experimentName: '',
            experimentType: null,
            assessLevel: null
        }
    },
    total: 0,
@@ -132,7 +153,15 @@
        {id: 5, name: '特种设备类'},
        {id: 6, name: '其它类'},
    ],
    allRoomList: []
    allRoomList: [],
    riskLevelList: [
        {id: 1, name: '重大风险'},
        {id: 2, name: '较大风险'},
        {id: 3, name: '一般风险'},
        {id: 4, name: '低风险'},
    ],
    tagBg: ['red', 'orange', 'yellow', 'blue']
})
const getProjectData = async () => {
@@ -152,9 +181,63 @@
    ProjectDialogRef.value.showProjectDialog(title, value, projectState.allRoomList);
};
const openReportDialog = (title: string,value: ProjectType) =>{
  ReportDialogRef.value.showReportDialog(title, value, projectState.allRoomList);
}
const applyStart = (title: string, value: ProjectType) => {
    ApplyStartRef.value.showApplyStartDialog(value);
};
const applyAccess = (val: ProjectType) => {
  ElMessageBox.confirm(`此操作将申请评估该实验:“${val.experimentName}”,是否继续?`, '提示', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning'
  })
      .then(async () => {
        let res = await projectApi().accessProject([val.id]);
        if (res.data.code === 100) {
          ElMessage({
            type: 'success',
            duration: 2000,
            message: '申请成功'
          });
          await getProjectData();
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      })
      .catch((error) => {
      });
}
const saveDevelop = async (data: any) => {
  ElMessageBox.confirm(`此操作将提交该实验:“${data.experimentName}”,是否继续?`, '提示', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(async () => {
    let res = await projectApi().addProject(data);
    if(res.data.code === 100){
      ElMessage({
        type: 'success',
        message: '提交成功'
      })
      await getProjectData();
    }else{
      ElMessage({
        type: 'warning',
        message: res.data.msg,
      });
    }
  })
      .catch((error) => {
      });
}
const onDelProject = (val: ProjectType) => {
    ElMessageBox.confirm(`此操作将永久删除该实验:“${val.experimentName}”,是否继续?`, '提示', {
@@ -199,8 +282,10 @@
        searchParams: {
            experimentName: '',
            experimentType: null,
            assessLevel: null
        }
    }
    getProjectData()
};
const getRoomData = async () => {
@@ -348,7 +433,18 @@
        color: #0098f5;
    }
}
.red {
    background: rgba(255,0,0,0.6);
}
.orange {
    background: rgba(248,82,8,0.6);
}
.yellow {
    background: rgba(247,255,0,0.6);
}
.blue {
    background: rgba(0,112,192,0.6);
}
:deep(.el-date-editor) {
    width: 100%;
}
@@ -366,4 +462,7 @@
    background-color: var(--el-card-bg-color);
    box-shadow: none;
}
:deep(.el-tag){
    border: none;
}
</style>