马宇豪
2025-04-29 e65a116f1ff1d9d99a093f76a9b02a6d27bfb35e
src/views/analyse/identify/components/identifyQuery.vue
@@ -1,21 +1,37 @@
<template>
    <div class="system-menu-dialog-container">
        <el-dialog :title="identifyQueryState.title" v-model="identifyQueryState.identifyQueryVisible" :close-on-click-modal="false" width="800px">
            <el-form ref="identifyFormRef" :rules="identifyQueryState.identifyFormRules" :model="identifyQueryState.identifyQueryForm" size="default" label-width="100px">
        <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-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="identifyQueryState.disabled" v-model="identifyQueryState.identifyQueryForm.identificationMethod" style="width:100%" placeholder="辨识方法" clearable>
                            <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>
@@ -33,10 +49,32 @@
                        <el-table :data="identifyQueryState.list" border fit highlight-current-row style="width: 100%">
                            <el-table-column type="index" label="序号" width="80" />
                            <el-table-column prop="technologyMeasure" label="技术措施" show-overflow-tooltip align="center"></el-table-column>
                            <el-table-column prop="manageMeasure" label="管理措施" show-overflow-tooltip align="center"></el-table-column>
                            <el-table-column prop="educationMeasure" label="教育措施" show-overflow-tooltip align="center"></el-table-column>
                            <el-table-column prop="personalProtectionMeasure" label="防护措施" show-overflow-tooltip align="center"></el-table-column>
                            <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="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>
@@ -49,13 +87,24 @@
                </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>
            <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>
        <identify-dialog ref="identifyDialogRef" @refresh="refreshList"></identify-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>
@@ -64,6 +113,7 @@
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'))
@@ -73,9 +123,14 @@
    activeName: 'identify',
    list: [],
    identifyQueryVisible: false,
    identifyMethodVisible: false,
    currentMethod: null,
    identifyQueryForm: {
        id: null,
        identificationMethod: null,
        assessType: null,
        assessStartTime: '',
        riskUnitName: ''
    },
    identifyForm: {},
    identificationMethodList: [
@@ -86,35 +141,96 @@
        {id:5, name: '类比法'},
    ],
    planList: [],
    personList: []
})
const showIdentifyQuery = (title: string, value: IdentifyType, planList: PlanType [], personList: SystemPersonType []) => {
// 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.list = value.factorQueryDTOList;
    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 = '编辑';
    if(title === '辨识'){
        identifyQueryState.title = '辨识';
    }else {
        identifyQueryState.title = '查看';
    }
};
const openIdentifyDialog = (title: string, value: IdentifyType) => {
    identifyDialogRef.value.showIdentifyDialog(title, identifyQueryState.identifyForm, value);
    identifyDialogRef.value.showIdentifyDialog(title, value, identifyQueryState.identifyQueryForm,identifyQueryState.identifyForm, identifyQueryState.personList);
};
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 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')
    await 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) => {