<template>
|
<div class="system-menu-dialog-container">
|
<el-dialog :title="identifyQueryState.title" v-model="identifyQueryState.identifyQueryVisible" :close-on-click-modal="false" width="800px" @close="resetData()">
|
<el-form ref="identifyFormRef" :model="identifyQueryState.identifyQueryForm" size="default" label-width="160px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="风险评价计划名称" prop="id">
|
<el-select class="input-length" :disabled="true" v-model="identifyQueryState.identifyQueryForm.id" style="width:100%" placeholder="风险评价计划名称" clearable>
|
<el-option v-for="item in identifyQueryState.planList" :key="item.id" :label="item.assessPlanName" :value="item.id"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
|
<!-- <el-form-item label="评价类型">-->
|
<!-- <el-input v-model="identifyQueryState.identifyQueryForm.assessType" readonly></el-input>-->
|
<!-- </el-form-item>-->
|
<!-- </el-col>-->
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="计划开始评价时间">
|
<el-input v-model="identifyQueryState.identifyQueryForm.assessStartTime" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="评价风险分析单元">
|
<el-input v-model="identifyQueryState.identifyQueryForm.riskUnitName" readonly placeholder="暂无风险分析单元"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col style="display: flex;align-items: center" :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="辨识方法" prop="identificationMethod">
|
<el-select class="input-length" disabled v-model="identifyQueryState.identifyQueryForm.identificationMethod" style="width:100%" placeholder="辨识方法" clearable>
|
<el-option v-for="item in identifyQueryState.identificationMethodList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-button size="default" v-if="identifyQueryState.identifyForm.planExecStatus == 2" type="primary" @click="openChangeMethod()">修改辨识方法</el-button>
|
</el-col>
|
</el-row>
|
</el-form>
|
<div class="checkUnit-point">
|
<el-tabs class="active" v-model="identifyQueryState.activeName">
|
<el-tab-pane label="辨识信息" name="identify">
|
<div style="padding-bottom: 10px" v-if="identifyQueryState.identifyForm.planExecStatus === 2">
|
<el-button size="default" type="primary" @click="openIdentifyDialog('新增', '')">
|
<el-icon>
|
<ele-FolderAdd />
|
</el-icon>
|
新增
|
</el-button>
|
</div>
|
|
<el-table :data="identifyQueryState.list" border fit highlight-current-row style="width: 100%">
|
<el-table-column type="index" label="序号" width="80" />
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 1" prop="phaCheckItem" label="检查项目" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 1" prop="phaRiskFactor" label="存在风险因素" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 1" prop="phaResult" label="可能存在后果" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 2" prop="jhaCheckItem" label="作业步骤" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 2" prop="jhaRiskFactor" label="存在风险因素" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 2" prop="jhaResult" label="可能存在后果" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 3" prop="sclCheckItem" label="检查项目" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 3" prop="sclCheckStandard" label="检查标准" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 3" prop="sclCheckUnstandard" label="不符合标准情况" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 3" prop="sclCheckResult" label="主要后果" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopNode" label="节点" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopParam" label="参数" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopParamDesc" label="参数描述" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopNode" label="节点" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopGuide" label="引导词" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopDeviation" label="偏差" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopPossibleCauses" label="可能原因" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 4" prop="hazopResult" label="可能存在后果" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 5" prop="analogyCheckItem" label="检查项目" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 5" prop="analogyReference" label="类比参照" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 5" prop="analogyRiskFactor" label="存在风险因素" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column v-if="identifyQueryState.identifyForm.identificationMethod == 5" prop="analogyResult" label="可能存在后果" show-overflow-tooltip align="center"></el-table-column>
|
<el-table-column prop="result" label="辨识结果" show-overflow-tooltip align="center">
|
<template #default="scope">
|
<span>{{scope.row.result == 1?'有风险':scope.row.result == 2?'无风险':'--'}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="150" align="center">
|
<template #default="scope">
|
<el-button size="default" text type="primary" @click="openIdentifyDialog('查看', scope.row)">查看</el-button>
|
<el-button size="default" text type="primary" v-if="identifyQueryState.identifyForm.planExecStatus === 2" @click="openIdentifyDialog('编辑', scope.row)">编辑</el-button>
|
<el-button size="default" text type="danger" v-if="identifyQueryState.identifyForm.planExecStatus === 2" @click="onDelIdentifyQuery(scope.$index, scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
<template #footer>
|
<span class="Query-footer">
|
<el-button @click="identifyQueryState.identifyQueryVisible = !identifyQueryState.identifyQueryVisible" size="default">取 消</el-button>
|
<el-button v-if="identifyQueryState.identifyForm.planExecStatus === 2" type="primary" @click="identifyQueryState.identifyQueryVisible = !identifyQueryState.identifyQueryVisible" size="default">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<el-dialog title="修改辨识方法" v-model="identifyQueryState.identifyMethodVisible" width="30%">
|
<el-select class="input-length" v-model="identifyQueryState.currentMethod" style="width:100%" placeholder="辨识方法" clearable>
|
<el-option v-for="item in identifyQueryState.identificationMethodList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
<template #footer>
|
<span class="Query-footer">
|
<el-button @click="identifyQueryState.identifyMethodVisible = false" size="default">取 消</el-button>
|
<el-button type="primary" @click="conFirmChange()" size="default">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<identify-dialog ref="identifyDialogRef" @refresh="getIdentifyData"></identify-dialog>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import {defineAsyncComponent, reactive, ref} from "vue";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
import {identifyApi} from "/@/api/analyse/identify";
|
import {isValidKey} from "/@/utils/methods";
|
import {userApi} from "/@/api/systemManage/user";
|
|
const identifyDialogRef = ref()
|
const IdentifyDialog = defineAsyncComponent(() => import('./identifyDialog.vue'))
|
|
const identifyQueryState = reactive<IdentifyQueryType>({
|
title: '',
|
activeName: 'identify',
|
list: [],
|
identifyQueryVisible: false,
|
identifyMethodVisible: false,
|
currentMethod: null,
|
identifyQueryForm: {
|
id: null,
|
identificationMethod: null,
|
assessType: null,
|
assessStartTime: '',
|
riskUnitName: ''
|
},
|
identifyForm: {},
|
identificationMethodList: [
|
{id:1, name: 'PHA'},
|
{id:2, name: 'JHA'},
|
{id:3, name: 'SCL'},
|
{id:4, name: 'HAZOP'},
|
{id:5, name: '类比法'},
|
],
|
planList: [],
|
personList: []
|
})
|
|
// const getAssessInfo =(value: number|null)=>{
|
// const data = identifyQueryState.planList.find(item => item.id === value) as PlanType
|
// }
|
|
const showIdentifyQuery = (title: string, value: IdentifyType, planList: PlanType [], personList: AllPersonListType []) => {
|
identifyQueryState.identifyQueryVisible = true;
|
identifyQueryState.identifyForm = value;
|
identifyQueryState.planList = planList;
|
identifyQueryState.personList = personList
|
identifyQueryState.list = value.factorQueryDTOList
|
// getAssessInfo(identifyQueryState.identifyQueryForm.id);
|
for(let i in identifyQueryState.identifyQueryForm){
|
if(isValidKey(i, identifyQueryState.identifyQueryForm)){
|
identifyQueryState.identifyQueryForm[i] = value[i]
|
}
|
}
|
|
if(title === '辨识'){
|
identifyQueryState.title = '辨识';
|
}else {
|
identifyQueryState.title = '查看';
|
}
|
};
|
|
const openIdentifyDialog = (title: string, value: IdentifyType) => {
|
identifyDialogRef.value.showIdentifyDialog(title, value, identifyQueryState.identifyQueryForm,identifyQueryState.identifyForm, identifyQueryState.personList);
|
};
|
|
const openChangeMethod = ()=>{
|
identifyQueryState.currentMethod = identifyQueryState.identifyQueryForm.identificationMethod
|
identifyQueryState.identifyMethodVisible = true
|
}
|
|
const conFirmChange = async () =>{
|
let res = await identifyApi().UpdateIdentifyMethod({
|
id: identifyQueryState.identifyQueryForm.id,
|
identificationMethodId: identifyQueryState.currentMethod
|
});
|
if(res.data.code === 100){
|
ElMessage({
|
type: 'success',
|
message: '辨识方法修改成功'
|
})
|
identifyQueryState.identifyQueryForm.identificationMethod = identifyQueryState.currentMethod,
|
identifyQueryState.currentMethod = identifyQueryState.currentMethod,
|
emit('refresh')
|
getIdentifyData()
|
}else{
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
})
|
}
|
identifyQueryState.identifyMethodVisible = false
|
}
|
|
const resetData = ()=>{
|
emit('refresh')
|
}
|
|
// const refreshList = (type: number, data: IdentifyType) => {
|
// if(type === 1){
|
// identifyQueryState.list?.push(data)
|
// }else{
|
// (<Array<IdentifyType>>identifyQueryState.list)[identifyQueryState.list?.findIndex(item => item.id === data.id) as number] = data
|
// }
|
// };
|
|
const getIdentifyData = async () => {
|
let res = await identifyApi().getIdentifyByList(
|
{
|
pageIndex: 1,
|
pageSize: 10,
|
assessPlanName: '',
|
experimentName: '',
|
tag: 1,
|
assessPlanId: identifyQueryState.identifyForm.id
|
}
|
);
|
if(res.data.code === 100){
|
identifyQueryState.list = res.data.data[0].factorQueryDTOList
|
}else{
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
};
|
|
const onDelIdentifyQuery = (index: number, val: IdentifyType) => {
|
ElMessageBox.confirm(`此操作将永久删除该辨识,是否继续?`, '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(async () => {
|
let data = { id: val.id, analogyId: val.analogyId, hazopId: val.hazopId, jhaId: val.jhaId, phaId: val.phaId, sclId: val.sclId, }
|
let res = await identifyApi().deleteIdentifyById(data);
|
if (res.data.code === 100) {
|
(<Array<IdentifyType>>identifyQueryState.list).splice(index, 1)
|
ElMessage({
|
type: 'success',
|
duration: 2000,
|
message: '删除成功'
|
});
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
})
|
.catch((error) => {
|
console.log(error);
|
});
|
};
|
|
const emit = defineEmits(['refresh'])
|
|
defineExpose({
|
showIdentifyQuery
|
})
|
</script>
|
|
<style scoped>
|
|
</style>
|