From e989421722e522f4879a354a15ba14912d7acaaa Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期五, 24 二月 2023 16:49:38 +0800
Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/scienceexperimentweb

---
 src/views/analyse/identify/index.vue |  395 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 395 insertions(+), 0 deletions(-)

diff --git a/src/views/analyse/identify/index.vue b/src/views/analyse/identify/index.vue
new file mode 100644
index 0000000..320da4a
--- /dev/null
+++ b/src/views/analyse/identify/index.vue
@@ -0,0 +1,395 @@
+<template>
+    <div class="home-container">
+        <div style="height: 100%">
+            <el-row class="homeCard">
+                <div class="basic-line">
+                    <span>评估计划名称:</span>
+                    <el-input v-model="identifyState.searchQuery.assessPlanName" clearable filterable class="input-box" placeholder="评估计划名称">
+                    </el-input>
+                </div>
+                <div class="basic-line">
+                    <span>实验名称:</span>
+                    <el-input v-model="identifyState.searchQuery.experimentName" clearable filterable class="input-box" placeholder="实验名称">
+                    </el-input>
+                </div>
+                <div style="padding-bottom: 10px">
+                    <el-button type="primary" @click="getIdentifyData">查询</el-button>
+                    <el-button plain @click="reset">重置</el-button>
+                </div>
+            </el-row>
+            <div class="homeCard">
+                <div class="main-card">
+                    <el-row class="cardTop">
+                        <el-col :span="12" class="mainCardBtn">
+<!--                            <el-button type="primary" :icon="Plus" size="default" @click="openIdentifyQuery('新增', {})">新增</el-button>-->
+                            <!--                            <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>-->
+                        </el-col>
+                        <!--                        <el-button type="primary" :icon="Refresh" size="default" />-->
+                    </el-row>
+                    <el-table ref="multipleTableRef" :data="identifyState.identifyData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }">
+                        <el-table-column prop="assessPlanName" label="评估计划名称"/>
+                        <el-table-column prop="identificationMethod" label="辨识方法" show-overflow-tooltip>
+                            <template #default="scope">
+                                <span>{{`${identifyState.identificationMethodList.find(item =>item.id === scope.row.identificationMethod)?.name}`}}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column prop="identificationUser" label="计划负责人" />
+                        <el-table-column prop="evaluateUser" label="评价专家" />
+                        <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
+                        <el-table-column prop="createByUserName" label="创建人" show-overflow-tooltip></el-table-column>
+                        <el-table-column prop="updateTime" label="最后修改时间" show-overflow-tooltip></el-table-column>
+                        <el-table-column prop="updateByUserName" label="最后修改人" show-overflow-tooltip></el-table-column>
+                        <el-table-column prop="planExecStatus" label="状态" show-overflow-tooltip>
+                            <template #default="scope">
+                                <div>
+                                    <div v-if="scope.row.planExecStatus === 2">
+                                        <el-tag :type="'info'">
+                                            {{ '未辨识' }}
+                                        </el-tag>
+                                    </div>
+                                    <div v-if="scope.row.planExecStatus === 3">
+                                        <el-tag :type="'success'">
+                                            {{ '已辨识' }}
+                                        </el-tag>
+                                    </div>
+                                </div>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="操作" width="250">
+                            <template #default="scope">
+                                <el-button size="small" text type="primary" v-if="scope.row.planExecStatus === 2" @click="accessIdentify(scope.row)">提交</el-button>
+                                <el-button size="small" text type="primary" :icon="View" @click="openIdentifyQuery('查看', scope.row)">查看</el-button>
+                                <el-button size="small" text type="primary" v-if="scope.row.planExecStatus === 2" :icon="Edit" @click="openIdentifyQuery('编辑', scope.row)">编辑</el-button>
+                                <el-button size="small" text type="danger" :icon="Delete" @click="onDelIdentify(scope.row)">删除</el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                    <div class="pageBtn">
+                        <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="identifyState.searchQuery.pageIndex" background v-model:page-size="identifyState.searchQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="identifyState.total" class="page-position"> </el-pagination>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <identify-query-dialog ref="identifyQueryDialogRef" @refresh="getIdentifyData"></identify-query-dialog>
+    </div>
+</template>
+
+<script setup lang="ts">
+import {defineAsyncComponent, onMounted, reactive, ref} from "vue";
+import {identifyApi} from "/@/api/analyse/identify";
+import {ElMessage, ElMessageBox} from "element-plus";
+import { Edit, View, Plus, Delete } from '@element-plus/icons-vue';
+import {planApi} from "/@/api/analyse/plan";
+import {userApi} from "/@/api/systemManage/user";
+
+const IdentifyQueryDialog = defineAsyncComponent(() => import('./components/identifyQuery.vue'));
+
+const identifyQueryDialogRef = ref();
+
+const identifyState = reactive<IdentifyStateType>({
+    identifyData: [],
+    searchQuery: {
+        pageIndex: 1,
+        pageSize: 10,
+        assessPlanName: '',
+        experimentName: '',
+        tag: 1,
+    },
+    total: 0,
+    planList: [
+    ],
+    personList: [],
+    identificationMethodList: [
+        {id:1, name: 'PHA'},
+        {id:2, name: 'JHA'},
+        {id:3, name: 'SCL'},
+        {id:4, name: 'HAZOP'},
+        {id:5, name: '类比法'},
+    ],
+    evaluateMethodList: [
+        {id:1, name: 'LEC'},
+        {id:2, name: 'LS'},
+        {id:3, name: 'MES'},
+        {id:4, name: 'RS'},
+    ]
+    // deviceUnitList: [
+    //     {id:1, name: '台'},
+    //     {id:2, name: '个'},
+    //     {id:3, name: '件'}
+    // ]
+});
+
+const getIdentifyData = async () => {
+    let res = await identifyApi().getIdentifyByList(identifyState.searchQuery);
+    if(res.data.code === 100){
+        identifyState.identifyData = res.data.data;
+        identifyState.total = res.data.total;
+    }else{
+        ElMessage({
+            type: 'warning',
+            message: res.data.msg
+        });
+    }
+};
+
+const getAllPlanList = async () => {
+    let res = await planApi().getAllPlan();
+    if(res.data.code === 100){
+        identifyState.planList = JSON.parse(JSON.stringify(res.data.data));
+    }else{
+        ElMessage({
+            type: 'warning',
+            message: res.data.msg
+        });
+    }
+};
+
+const getPersonList = async () => {
+    let res = await userApi().getUserList({
+        roleId: 1,
+        usePage: false,
+        pageIndex: 1,
+        pageSize: 10
+    });
+    if(res.data.code === 100){
+        identifyState.personList = JSON.parse(JSON.stringify(res.data.data));
+    }else{
+        ElMessage({
+            type: 'warning',
+            message: res.data.msg
+        })
+    }
+};
+
+const openIdentifyQuery = (title: string, value: IdentifyType) => {
+    identifyQueryDialogRef.value.showIdentifyQuery(title, value, identifyState.planList, identifyState.personList);
+};
+
+const onDelIdentify = (val: IdentifyType) => {
+    ElMessageBox.confirm(`此操作将永久删除该辨识,是否继续?`, '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'warning'
+    })
+        .then(async () => {
+            let res = await identifyApi().deleteIdentifyById({ id: val.id });
+            if (res.data.code === 100) {
+                ElMessage({
+                    type: 'success',
+                    duration: 2000,
+                    message: '删除成功'
+                });
+                await getIdentifyData();
+            } else {
+                ElMessage({
+                    type: 'warning',
+                    message: res.data.msg
+                });
+            }
+        })
+        .catch((error) => {
+        });
+};
+
+const accessIdentify = (val: IdentifyType) => {
+    ElMessageBox.confirm(`此操作将派发该计划:“${val.assessPlanName}”,是否继续?`, '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'warning'
+    })
+        .then(async () => {
+            let res = await identifyApi().submitIdentify({ id: val.id});
+            if (res.data.code === 100) {
+                ElMessage({
+                    type: 'success',
+                    duration: 2000,
+                    message: '提交成功'
+                });
+                await getIdentifyData();
+            } else {
+                ElMessage({
+                    type: 'warning',
+                    message: res.data.msg
+                });
+            }
+        })
+        .catch((error) => {
+        });
+};
+
+const onHandleSizeChange = (val: number) => {
+    identifyState.searchQuery.pageSize = val;
+    getIdentifyData();
+};
+
+const onHandleCurrentChange = (val: number) => {
+    identifyState.searchQuery.pageIndex = val;
+    getIdentifyData();
+};
+
+const reset = () => {
+    identifyState.searchQuery = {
+        pageIndex: 1,
+        pageSize: 10,
+        assessPlanName: '',
+        experimentName: '',
+        tag: 1,
+    }
+};
+
+onMounted(() => {
+    getIdentifyData();
+    getAllPlanList();
+    getPersonList();
+});
+
+</script>
+
+<style scoped lang="scss">
+$homeNavLengh: 8;
+.home-container {
+    height: calc(100vh - 144px);
+    box-sizing: border-box;
+    overflow: hidden;
+    .homeCard {
+        width: 100%;
+        padding: 20px;
+        box-sizing: border-box;
+        background: #fff;
+        border-radius: 4px;
+
+        .main-card {
+            width: 100%;
+            height: 100%;
+            .cardTop {
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                margin-bottom: 20px;
+                .mainCardBtn {
+                    margin: 0;
+                }
+            }
+            .pageBtn {
+                height: 60px;
+                display: flex;
+                align-items: center;
+                justify-content: right;
+
+                .demo-pagination-block + .demo-pagination-block {
+                    margin-top: 10px;
+                }
+                .demo-pagination-block .demonstration {
+                    margin-bottom: 16px;
+                }
+            }
+        }
+        &:last-of-type {
+            height: calc(100% - 100px);
+        }
+    }
+    .el-row {
+        display: flex;
+        align-items: center;
+        margin-bottom: 20px;
+        &:last-child {
+            margin-bottom: 0;
+        }
+        .grid-content {
+            align-items: center;
+            min-height: 36px;
+        }
+
+        .topInfo {
+            display: flex;
+            align-items: center;
+            font-size: 16px;
+            font-weight: bold;
+
+            & > div {
+                white-space: nowrap;
+                margin-right: 20px;
+            }
+        }
+    }
+}
+.stepItem {
+    width: 100%;
+    display: flex;
+    align-items: flex-start;
+    margin-bottom: 30px;
+    margin-left: 30px;
+    padding-bottom: 30px;
+    border-left: 2px solid #ccc;
+    &:first-of-type {
+        margin-top: 30px;
+    }
+    &:last-of-type {
+        margin-bottom: 0;
+        border-left: none;
+    }
+    .stepNum {
+        width: 30px;
+        height: 30px;
+        border-radius: 15px;
+        box-sizing: border-box;
+        color: #333;
+        border: 1px solid #999;
+        line-height: 28px;
+        text-align: center;
+        margin-right: 10px;
+        margin-left: -16px;
+        margin-top: -30px;
+    }
+    .stepCard {
+        width: 100%;
+        margin-top: -30px;
+
+        .box-card {
+            width: 100%;
+            &:deep(.el-card__header) {
+                padding: 10px 15px;
+            }
+            .card-header {
+                width: 100%;
+                display: flex;
+                justify-content: space-between;
+                align-items: center;
+                & > div:first-of-type {
+                    margin-right: 80px;
+                    font-size: 18px;
+                    font-weight: bold;
+                }
+            }
+        }
+    }
+    &:hover .card-header {
+        color: #0098f5;
+    }
+    &:hover .stepNum {
+        border: 2px solid #0098f5;
+        color: #0098f5;
+    }
+}
+
+:deep(.el-date-editor) {
+    width: 100%;
+}
+.el-select {
+    width: 100%;
+}
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
+    background-color: var(--el-card-bg-color);
+    color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__inner) {
+    color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__wrapper) {
+    background-color: var(--el-card-bg-color);
+}
+:deep(.el-range-editor.is-disabled input){
+    background-color: var(--el-card-bg-color);
+    color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+</style>

--
Gitblit v1.9.2