深海科学与工程研究所安全巡检系统
祖安之光
2025-10-15 6390fa18f5c2df1158a0d664786797b0e8b2fbf9
src/views/hazardMng/hazardReport/index.vue
@@ -8,6 +8,7 @@
              plain
              icon="Plus"
              @click="openDialog('add',{})"
              v-if="isAuthority"
          >新增</el-button>
        </el-form-item>
        <el-form-item label="隐患名称:" >
@@ -34,21 +35,22 @@
          </el-select>
        </el-form-item>
        <el-form-item label="整改部门/研究组:" >
          <el-select v-model="queryParams.reformDeptId" placeholder="请选择" clearable>
            <el-option
                v-for="item in deptList"
                :key="item.deptId"
                :label="item.deptName"
                :value="item.deptId">
            </el-option>
          </el-select>
<!--          <el-select v-model="queryParams.reformDeptId" placeholder="请选择" clearable>-->
<!--            <el-option-->
<!--                v-for="item in deptList"-->
<!--                :key="item.deptId"-->
<!--                :label="item.deptName"-->
<!--                :value="item.deptId">-->
<!--            </el-option>-->
<!--          </el-select>-->
          <el-cascader v-model="queryParams.reformDeptId" placeholder="请选择" :options="deptList" :show-all-levels="false" :props="{value: 'deptId',label: 'deptName',children: 'children',emitPath: false,checkStrictly: true}"/>
        </el-form-item>
        <el-form-item label="整改人:" >
          <el-select v-model="queryParams.reformUserId" placeholder="请选择" clearable>
            <el-option
                v-for="item in userList"
                :key="item.userId"
                :label="item.userName"
                :label="item.nickName"
                :value="item.userId">
            </el-option>
          </el-select>
@@ -78,8 +80,8 @@
      <el-table-column prop="hazardRoom" align="center" label="房间号"/>
      <el-table-column prop="reformDeptName" align="center" label="整改部门/研究组"/>
      <el-table-column prop="reformUserName" align="center" label="整改人"/>
      <el-table-column prop="updateBy" align="center" label="隐患等记人"/>
      <el-table-column prop="updateTime" align="center" label="隐患等记时间"/>
      <el-table-column prop="createBy" align="center" label="隐患登记人"/>
      <el-table-column prop="createTime" align="center" label="隐患登记时间"/>
      <el-table-column label="操作" align="center">
        <template #default="scope">
          <el-button link type="primary" @click="openDialog('view',scope.row)">查看</el-button>
@@ -122,7 +124,8 @@
    hazardSource: null,
    hazardLevel: null,
    reformDeptId: null,
    reformUserId: null
    reformUserId: null,
    hazardsType: 1
  },
  dataList: [],
  deptList: [],
@@ -130,31 +133,19 @@
  sourceList: [
    {
      id: 1,
      name: '日常排查'
      name: '综合检查'
    },
    {
      id: 2,
      name: '综合性排查'
      name: '部门检查'
    },
    {
      id: 3,
      name: '专业性排查'
      name: '实验室自查'
    },
    {
      id: 4,
      name: '季节性排查'
    },
    {
      id: 5,
      name: '重点时段及节假日前排查'
    },
    {
      id: 6,
      name: '外聘专家诊断式排查'
    },
    {
      id: 7,
      name: '其他'
      name: '专项检查'
    }
  ],
  levelList: [
@@ -222,14 +213,17 @@
      {
        label: '整改部门/研究组',
        prop: 'reformDeptId',
        type: 'select',
        rules: [{ required: true, message: '请选择部门', trigger: 'blur' }],
        options: () => {
          return state.deptList.map(dept => ({
            value: dept.deptId,
            label: dept.deptName
          }))
        type: 'cascader',
        showAllLevels: false,
        props: {
          value: 'deptId',
          label: 'deptName',
          children: 'children',
          emitPath: false,
          checkStrictly: true
        },
        rules: [{ required: true, message: '请选择部门', trigger: 'blur' }],
        options: () => state.deptList,
        changeEvent: 'getUserListByRole'
      },
      {
@@ -240,7 +234,7 @@
        options: () => {
          return state.userList.map(user => ({
            value: user.userId,
            label: user.userName
            label: user.nickName
          }))
        }
      },
@@ -263,14 +257,21 @@
      return res.code === 200 ? res.data : []
    }
  },
  api: {}
  api: {},
  isAuthority: false
});
const { queryParams, total, dataList, deptList, userList, formConfig, dataLoader, api, sourceList, levelList } = toRefs(state);
const { queryParams, total, dataList, deptList, userList, formConfig, dataLoader, api, sourceList, levelList, isAuthority } = toRefs(state)
const userStore = useUserStore()
onMounted(async ()=>{
  await getList()
  await getDeptList()
  await getUserList()
  if(userStore.roles.includes('admin') || userStore.roles.includes('sys_admin') || userStore.roles.includes('place_safety_officer')){
    state.isAuthority = true
  }else{
    state.isAuthority = false
  }
})
onUnmounted(()=>{
@@ -279,14 +280,13 @@
function getDeptList() {
  listDept({}).then(response => {
    state.deptList = response.data
    state.deptList = proxy.handleTree(response.data, "deptId")
  });
}
function getUserList() {
  listUser().then(res => {
  listUser({pageNum: 1,pageSize: 999}).then(res => {
    state.userList = res.rows;
    state.total = res.total;
  })
};
@@ -327,7 +327,8 @@
    hazardSource: null,
    hazardLevel: null,
    reformDeptId: null,
    reformUserId: null
    reformUserId: null,
    hazardsType: 1
  }
  await getList()
}
@@ -353,9 +354,8 @@
const handleSubmit = async (data, type) => {
  const params = JSON.parse(JSON.stringify(data))
  console.log(params,'para')
  params.reformDeptName = state.deptList.find(i=>i.deptId == params.reformDeptId)?.deptName
  params.reformUserName = state.userList.find(i=>i.userId == params.reformUserId)?.userName
  // params.reformDeptName = state.deptList.find(i=>i.deptId == params.reformDeptId)?.deptName
  params.reformUserName = state.userList.find(i=>i.userId == params.reformUserId)?.nickName
  // 调用API保存数据
  if (type === '新增') {
    delete params.id