第八周总结
完成了团队作业安全风险部分部门字段的重构行,下一步可以开始试着做分模块统计了。
<div class="other-buttons-wrapper">
<el-button @click="add" type="primary" v-if="userData.type !== '监察员'">
添加数据
</el-button>
<el-button @click="openQueryDialog" type="primary">
分组查询
</el-button>
<el-upload
action="http://localhost:9090/safetyrisk/import"
method="post"
:on-success="handleImport"
:before-upload="beforeUpload"
accept=".xlsx,.xls"
>
<el-button type="primary" v-if="userData.type !== '监察员'">
批量导入
</el-button>
</el-upload>
<el-button @click="exportData" type="primary" v-if="userData.type !== '监察员'">
批量导出
</el-button>
</div>
<el-dialog
v-model="dialogVisible"
title="添加/编辑风险记录"
width="50%"
:before-close="handleClose"
:confirmButtonText="'提交'"
:cancelButtonText="'关闭'"
>
<span>
<el-form
:label-position="labelPosition"
label-width="100px"
:model="form"
style="max-width: 800px"
>
<el-form-item label="id">
<el-input v-model="form.id" disabled />
</el-form-item>
<el-form-item label="风险编码">
<el-input v-model="form.risk_code" :disabled="form.id!== ''" />
</el-form-item>
<!-- 拆分后的四个部门字段 -->
<el-form-item label="公司">
<el-input v-model="form.company" :disabled="userData.type === '安全员'" />
</el-form-item>
<el-form-item label="部门">
<el-input v-model="form.new_department" :disabled="userData.type === '安全员'" />
</el-form-item>
<el-form-item label="工区">
<el-input v-model="form.work_area" :disabled="userData.type === '安全员'" />
</el-form-item>
<el-form-item label="班组">
<el-input v-model="form.team" :disabled="userData.type === '安全员'" />
</el-form-item>
<!-- 其他字段保持不变 -->
<el-form-item label="专业系统">
<el-input v-model="form.professional_system" />
</el-form-item>
<el-form-item label="风险类别">
<el-input v-model="form.risk_category" />
</el-form-item>
<el-form-item label="风险项目">
<el-input v-model="form.risk_item" />
</el-form-item>
<el-form-item label="风险项点">
<el-input v-model="form.risk_point" />
</el-form-item>
<el-form-item label="风险等级">
<el-radio-group v-model="form.risk_level">
<el-radio label="重大">重大</el-radio>
<el-radio label="较大">较大</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="低">低</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="危害程度">
<el-radio-group v-model="form.harm_degree">
<el-radio label="较高">较高</el-radio>
<el-radio label="高">高</el-radio>
<el-radio label="中">中</el-radio>
<el-radio label="低">低</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="管控措施">
<el-input v-model="form.control_measures" />
</el-form-item>
<el-form-item label="管控岗位">
<el-input v-model="form.control_position" />
</el-form-item>
<el-form-item label="管控人员">
<el-input v-model="form.control_personnel" :disabled="userData.type === '安全员'" />
</el-form-item>
<el-form-item label="量化要求">
<el-input v-model="form.quantified_requirements" />
</el-form-item>
<!-- 对安全员隐藏审核状态 -->
<el-form-item label="审核状态" v-if="userData.type !== '安全员'">
<el-radio-group v-model="form.review_status">
<el-radio label="待审核">待审核</el-radio>
<el-radio label="已通过">已通过</el-radio>
<el-radio label="已拒绝">已拒绝</el-radio>
</el-radio-group>
</el-form-item>
<!-- 对安全员隐藏审核日期 -->
<el-form-item label="审核日期" v-if="userData.type !== '安全员' && form.review_status !== '待审核'">
<el-date-picker
v-model="form.review_date"
type="date"
placeholder="选择审核日期"
disabled
/>
</el-form-item>
</el-form>
</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="save">
确认
</el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="queryDialogVisible"
title="分组查询"
width="50%"
:before-close="handleQueryDialogClose"
:confirmButtonText="'确认查询'"
:cancelButtonText="'关闭'"
>
<span>
<el-form
:label-position="labelPosition"
label-width="100px"
:model="queryForm"
style="max-width: 800px"
>
<el-form-item label="id">
<el-input v-model="queryForm.id" />
</el-form-item>
<el-form-item label="风险编码">
<el-input v-model="queryForm.risk_code" />
</el-form-item>
<el-form-item label="公司">
<el-input v-model="queryForm.company" />
</el-form-item>
<el-form-item label="部门">
<el-input v-model="queryForm.new_department" />
</el-form-item>
<el-form-item label="工区">
<el-input v-model="queryForm.work_area" />
</el-form-item>
<el-form-item label="班组">
<el-input v-model="queryForm.team" />
</el-form-item>
<el-form-item label="专业系统">
<el-input v-model="queryForm.professional_system" />
</el-form-item>
<el-form-item label="风险类别">
<el-input v-model="queryForm.risk_category" />
</el-form-item>
<el-form-item label="风险项目">
<el-input v-model="queryForm.risk_item" />
</el-form-item>
<el-form-item label="风险项点">
<el-input v-model="queryForm.risk_point" />
</el-form-item>
<el-form-item label="风险等级">
<el-radio-group v-model="queryForm.risk_level">
<el-radio label="重大">重大</el-radio>
<el-radio label="较大">较大</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="低">低</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="危害程度">
<el-radio-group v-model="queryForm.harm_degree">
<el-radio label="较高">较高</el-radio>
<el-radio label="高">高</el-radio>
<el-radio label="中">中</el-radio>
<el-radio label="低">低</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="管控措施">
<el-input v-model="queryForm.control_measures" />
</el-form-item>
<el-form-item label="管控岗位">
<el-input v-model="queryForm.control_position" />
</el-form-item>
<el-form-item label="管控人员">
<el-input v-model="queryForm.control_personnel" />
</el-form-item>
<el-form-item label="量化要求">
<el-input v-model="queryForm.quantified_requirements" />
</el-form-item>
<el-form-item label="录入时间">
<el-date-picker
v-model="queryForm.entry_date"
type="date"
placeholder="选择录入时间"
/>
</el-form-item>
<el-form-item label="审核状态">
<el-radio-group v-model="queryForm.review_status">
<el-radio label="待审核">待审核</el-radio>
<el-radio label="已通过">已通过</el-radio>
<el-radio label="已拒绝">已拒绝</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核日期">
<el-date-picker
v-model="queryForm.review_date"
type="date"
placeholder="选择审核日期"
/>
</el-form-item>
</el-form>
</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="queryDialogVisible = false">取消</el-button>
<el-button @click="clearQueryForm">清除筛选条件</el-button>
<el-button type="primary" @click="queryData">
确认查询
</el-button>
</span>
</template>
</el-dialog>
<!-- 表格和分页组件 -->
<el-table :data="tableData" stripe style="width: 100%">
<el-table-column prop="id" label="id" />
<el-table-column prop="risk_code" label="风险编码" />
<el-table-column prop="company" label="公司" />
<el-table-column prop="new_department" label="部门" />
<el-table-column prop="work_area" label="工区" />
<el-table-column prop="team" label="班组" />
<el-table-column prop="professional_system" label="专业系统" />
<el-table-column prop="risk_category" label="风险类别" />
<el-table-column prop="risk_item" label="风险项目" />
<el-table-column prop="risk_point" label="风险项点" />
<el-table-column prop="risk_level" label="风险等级" />
<el-table-column prop="harm_degree" label="危害程度" />
<el-table-column prop="control_measures" label="管控措施" />
<el-table-column prop="control_position" label="管控岗位" />
<el-table-column prop="control_personnel" label="管控人员" />
<el-table-column prop="quantified_requirements" label="量化要求" />
<!-- 对安全员隐藏审核状态 -->
<el-table-column prop="review_status" label="审核状态" v-if="userData.type!== '安全员'" />
<!-- 对安全员隐藏审核日期 -->
<el-table-column prop="review_date" label="审核日期" v-if="userData.type!== '安全员'" />
<el-table-column fixed="right" label="Operations" width="120">
<template #default="scope">
<!-- 普通用户显示修改和删除按钮 -->
<div v-if="userData.type!== '监察员'">
<el-button link type="primary" size="small" @click="handleEdit(scope.row)">
修改
</el-button>
<el-popconfirm title="确认删除?" @confirm="handleDelete(scope.row.id)">
<template #reference>
<el-button link type="primary" size="small">删除数据</el-button>
</template>
</el-popconfirm>
</div>
<!-- 监察员显示审核通过和拒绝通过按钮,仅当记录为待审核状态 -->
<div v-else-if="scope.row.review_status === '待审核'">
<el-button link type="primary" size="small" @click="handleReview(scope.row, '已通过')">
审核通过
</el-button>
<el-button link type="danger" size="small" @click="handleReview(scope.row, '已拒绝')">
拒绝通过
</el-button>
</div>
<!-- 监察员查看已审核记录 -->
<div v-else-if="userData.type === '监察员'">
<span class="text-gray-500">已审核</span>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
/>
</div>
</div>


浙公网安备 33010602011771号