事故调查管理代码提交
parent
071fe616ca
commit
f58761937f
|
@ -0,0 +1,469 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="searchForm" :model="searchForm" label-width="100px">
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="事故名称" prop="incidentName">
|
||||
<el-input v-model="searchForm.incidentName" placeholder="请输入隐患描述" class="filter-item"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发生时间" prop="incidentName">
|
||||
<el-date-picker
|
||||
v-model="searchForm.incidentName"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="发生地点" prop="location">
|
||||
<el-input v-model="searchForm.location" placeholder="请输入关键字" class="filter-item"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO 待实现数据字典-->
|
||||
<!-- <el-col :span="4">-->
|
||||
<!-- <el-form-item label="事故类型" prop="keySource">-->
|
||||
<!-- <el-select v-model="searchForm.incidentType" placeholder="请选择">-->
|
||||
<!-- <el-option v-for="item in incidentTypes" :key="item.value" :label="item.label" :value="item.value" />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="4">-->
|
||||
<!-- <el-form-item label="事故等级" prop="keySource">-->
|
||||
<!-- <el-select v-model="searchForm.incidentLevel" placeholder="请选择">-->
|
||||
<!-- <el-option v-for="item in incidentLevels" :key="item.value" :label="item.label" :value="item.value" />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="4">
|
||||
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getList">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="primary" icon="el-icon-refresh" @click="reset">
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="primary" icon="el-icon-refresh" @click="changeDialog('添加')">
|
||||
添加
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="danger" icon="el-icon-delete" @click="deleteInBulk">
|
||||
批量删除
|
||||
</el-button>
|
||||
<!-- <el-button v-waves class="filter-item" type="warning" icon="el-icon-star-off" @click="chongzhi">-->
|
||||
<!-- 导出-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button v-waves class="filter-item" type="warning" icon="el-icon-star-off" @click="chongzhi">-->
|
||||
<!-- 导出全部-->
|
||||
<!-- </el-button>-->
|
||||
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="getList">
|
||||
刷新
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
ref="multipleTable"
|
||||
:data="varList"
|
||||
border
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="事故名称" prop="incidentName"/>
|
||||
<el-table-column label="所属公司" prop="companyName"/>
|
||||
<el-table-column label="发生时间" prop="incidentDate">
|
||||
<template v-slot="{row}">
|
||||
{{ formatDate(row.incidentDate, 'YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发生地点" prop="location"/>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="{row}">
|
||||
<el-button v-show="edit" icon="el-icon-view" size="mini" @click="goView(row.id)">查看</el-button>
|
||||
<el-button v-show="edit" icon="el-icon-view" size="mini" @click="changeDialog('修改',row.id)">修改</el-button>
|
||||
<el-button v-show="del" icon="el-icon-view" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="page-btn-group">
|
||||
<div/>
|
||||
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList"/>
|
||||
</div>
|
||||
<el-dialog :visible.sync="dialogFormVisible" :title="dialogTitle">
|
||||
<el-form :model="infoForm">
|
||||
<el-form-item :label-width="formLabelWidth" label="事故案号">
|
||||
<el-input v-model="infoForm.incidentNumber" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故名称">
|
||||
<el-input v-model="infoForm.incidentName" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<!-- TODO 需要数据字典-->
|
||||
<!-- <el-form-item :label-width="formLabelWidth" label="事故类型">-->
|
||||
<!-- <el-select v-model="hiddenPartList" placeholder="请选择活动区域">-->
|
||||
<!-- <el-option label="区域一" value="shanghai"/>-->
|
||||
<!-- <el-option label="区域二" value="beijing"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item :label-width="formLabelWidth" label="所属公司">-->
|
||||
<!-- <el-select v-model="form.region" placeholder="请选择活动区域">-->
|
||||
<!-- <el-option label="区域一" value="shanghai"/>-->
|
||||
<!-- <el-option label="区域二" value="beijing"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item :label-width="formLabelWidth" label="事故级别">-->
|
||||
<!-- <el-select v-model="incidentLevels" placeholder="请选择活动区域">-->
|
||||
<!-- <el-option label="区域一" value="shanghai"/>-->
|
||||
<!-- <el-option label="区域二" value="beijing"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item :label-width="formLabelWidth" label="事故发生地点">
|
||||
<el-input v-model="infoForm.location" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故发生时间">
|
||||
<el-date-picker
|
||||
v-model="infoForm.incidentDate"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
format="yyyy 年 MM 月 dd 日"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="直接经济损失">
|
||||
<el-input v-model="infoForm.directLoss" type="number" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="受伤人数">
|
||||
<el-input v-model="infoForm.injured" type="number" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="死亡人数">
|
||||
<el-input v-model="infoForm.fatalities" type="number" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="重伤人数">
|
||||
<el-input v-model="infoForm.seriouslyInjured" type="number" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故起因">
|
||||
<el-input v-model="infoForm.cause" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故概述">
|
||||
<el-input v-model="infoForm.summary" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<!-- TODO 图片
|
||||
<el-form-item :label-width="formLabelWidth" label="事故照片">-->
|
||||
<!-- <el-upload-->
|
||||
<!-- action="https://jsonplaceholder.typicode.com/posts/"-->
|
||||
<!-- list-type="picture-card"-->
|
||||
<!-- !multiple-->
|
||||
<!-- limit="1">-->
|
||||
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
|
||||
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
|
||||
<!-- </el-upload>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定">
|
||||
<el-input v-model="infoForm.analysis" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="考核建议">
|
||||
<el-input v-model="infoForm.suggestions" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="整改措施">
|
||||
<el-input v-model="infoForm.measures" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="填表人">
|
||||
<el-input v-model="infoForm.creator" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="报出日期">
|
||||
<el-date-picker
|
||||
v-model="infoForm.reportDate"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
format="yyyy 年 MM 月 dd 日"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="saveOrUpdate">提 交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
import waves from '@/directive/waves'
|
||||
import { requestFN } from '@/utils/request'
|
||||
import SelectTree from '@/components/SelectTree'
|
||||
import formatDate from '@/utils/dateformat'
|
||||
|
||||
export default {
|
||||
components: { Pagination, SelectTree },
|
||||
directives: { waves },
|
||||
data() {
|
||||
return {
|
||||
listLoading: true,
|
||||
add: false,
|
||||
del: false,
|
||||
edit: false,
|
||||
dialogFormVisible: false,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 20
|
||||
},
|
||||
total: 0,
|
||||
varList: [],
|
||||
hiddenPartList: [], // 事故类型字典
|
||||
incidentLevels: [], // 事故等级字典
|
||||
multipleSelection: [], // 选中行数据
|
||||
formLabelWidth: '120px',
|
||||
dialogTitle: '',
|
||||
searchForm: {
|
||||
incidentName: '',
|
||||
incidentDates: [],
|
||||
location: '',
|
||||
incidentLevel: '',
|
||||
incidentType: ''
|
||||
},
|
||||
infoForm: {
|
||||
id: '', // 主键ID
|
||||
incidentNumber: '', // 事故案号
|
||||
incidentName: '', // 事故名称
|
||||
incidentType: null, // 事故类型
|
||||
companyName: '', // 所属公司
|
||||
incidentLevel: '', // 事故级别
|
||||
incidentNature: '', // 事故性质
|
||||
location: '', // 事故发生地点
|
||||
incidentDate: null, // 事故发生时间
|
||||
directLoss: '', // 直接经济损失(万元)
|
||||
injured: null, // 受伤人数
|
||||
fatalities: null, // 死亡人数
|
||||
seriouslyInjured: null, // 重伤人数
|
||||
cause: '', // 事故起因
|
||||
summary: '', // 事故概述
|
||||
photos: '', // 事故照片
|
||||
analysis: '', // 原因分析及责任认定
|
||||
suggestions: '', // 考核建议
|
||||
measures: '', // 整改措施
|
||||
creator: '', // 填表人
|
||||
reportDate: null // 报出日期
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
const url = '/accident/page?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page
|
||||
requestFN(url, { ...this.searchForm }).then((data) => {
|
||||
this.listLoading = false
|
||||
this.varList = data.varList
|
||||
this.total = data.page.totalResult
|
||||
this.hasButton()
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 刷新按钮
|
||||
reset() {
|
||||
this.searchForm = this.$options.data().searchForm
|
||||
this.getList()
|
||||
this.toggleSelection()
|
||||
},
|
||||
|
||||
// 批量删除
|
||||
deleteInBulk() {
|
||||
// 获取选中的行数据
|
||||
const selectedRows = this.multipleSelection
|
||||
|
||||
// 如果没有选中任何行,则提示用户
|
||||
if (selectedRows.length === 0) {
|
||||
this.$message.warning('请选择要删除的行')
|
||||
return
|
||||
}
|
||||
|
||||
// 弹出确认框
|
||||
this.$confirm('确定要删除这些记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 获取所有选中行的 ID
|
||||
const ids = selectedRows.map(row => row.id).join(',')
|
||||
|
||||
// 发送批量删除请求
|
||||
const url = '/accident/delete/' + '' + ids
|
||||
requestFN(url).then((response) => {
|
||||
// 删除成功后的处理
|
||||
this.$message.success('删除成功')
|
||||
this.getList() // 重新获取数据
|
||||
// eslint-disable-next-line handle-callback-err
|
||||
}).catch((error) => {
|
||||
this.$message.error('删除失败')
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 删除行数据
|
||||
deleteRow(id) {
|
||||
if (id === null || id === '') {
|
||||
this.$message.warning('请选择要删除的行')
|
||||
return
|
||||
}
|
||||
|
||||
// 弹出确认框
|
||||
this.$confirm('确定要删除这调记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 发送删除请求
|
||||
const url = '/accident/delete/' + '' + id
|
||||
requestFN(url).then((response) => {
|
||||
// 删除成功后的处理
|
||||
this.$message.success('删除成功')
|
||||
this.getList() // 重新获取数据
|
||||
// eslint-disable-next-line handle-callback-err
|
||||
}).catch((error) => {
|
||||
this.$message.error('删除失败')
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 选中行数据
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection.push(val)
|
||||
},
|
||||
|
||||
// 清空选中行数据
|
||||
toggleSelection(rows) {
|
||||
if (rows) {
|
||||
rows.forEach(row => {
|
||||
this.$refs.multipleTable.toggleRowSelection(row)
|
||||
})
|
||||
} else {
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
}
|
||||
},
|
||||
|
||||
// 判断按钮权限,用于是否显示按钮 TODO 待实现
|
||||
hasButton() {
|
||||
var keys = 'hidden:add,hidden:del,hidden:edit,toExcel'
|
||||
requestFN(
|
||||
'/head/hasButton',
|
||||
{
|
||||
keys: keys
|
||||
}
|
||||
).then((data) => {
|
||||
this.add = data.hiddenfhadminadd
|
||||
this.del = data.hiddenfhadmindel
|
||||
this.edit = data.hiddenfhadminedit
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 获取数据字典数据
|
||||
getDict() {
|
||||
requestFN(
|
||||
'dictionaries/listSelectTree?tm=' + new Date().getTime(),
|
||||
{
|
||||
DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'
|
||||
}
|
||||
).then((data) => {
|
||||
this.hiddenlevelList = JSON.parse(data.zTreeNodes)
|
||||
console.info(this.hiddenlevelList)
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
requestFN(
|
||||
'/dictionaries/listSelectTree',
|
||||
{
|
||||
DICTIONARIES_ID: '3babc15144444bdc8d763d0af2bdfff6'
|
||||
}
|
||||
).then((data) => {
|
||||
this.hiddenTypeList = JSON.parse(data.zTreeNodes)
|
||||
})
|
||||
requestFN(
|
||||
'/dictionaries/listSelectTree',
|
||||
{
|
||||
DICTIONARIES_ID: '18c0a9aea6e54feab9f4ab3f46e0bc86'
|
||||
}
|
||||
).then((data) => {
|
||||
this.hiddenType2List = JSON.parse(data.zTreeNodes)
|
||||
})
|
||||
// 隐患部位
|
||||
requestFN(
|
||||
'/hiddenRegion/listAll'
|
||||
).then((data) => {
|
||||
console.log(data)
|
||||
this.hiddenPartList = JSON.parse(data.zTreeNodes)
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 修改弹窗状态
|
||||
changeDialog(title, id) {
|
||||
this.dialogFormVisible = true
|
||||
this.dialogTitle = title
|
||||
if (title === '修改') {
|
||||
requestFN('/accident/' + id, {}).then((data) => {
|
||||
this.infoForm = data.info
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 添加或者修改
|
||||
saveOrUpdate() {
|
||||
requestFN('/accident' + (this.dialogTitle === '修改' ? '/update' : '/save'), this.infoForm)
|
||||
.then((response) => {
|
||||
// 删除成功后的处理
|
||||
this.$message.success(this.dialogTitle + '成功')
|
||||
this.getList() // 重新获取数据
|
||||
this.infoForm = this.$options.data().infoForm
|
||||
// eslint-disable-next-line handle-callback-err
|
||||
}).catch((error) => {
|
||||
this.$message.error(this.dialogTitle + '失败')
|
||||
})
|
||||
},
|
||||
|
||||
goView(id) {
|
||||
this.$parent.activeName = 'Detail'
|
||||
this.$parent.hiddenId = id
|
||||
},
|
||||
translate(id, list) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].BIANMA === id || list[i].value === id || list[i].id === id) return list[i].NAME || list[i].label
|
||||
}
|
||||
},
|
||||
formatDate(date, format) {
|
||||
return formatDate(date, format)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<!-- <component :is="activeName" />-->
|
||||
<div>
|
||||
<List v-show="activeName==='List'" ref="list"/>
|
||||
<Detail v-if="activeName==='Detail'"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from './list.vue'
|
||||
import Detail from './components/detail'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
List: List,
|
||||
Detail: Detail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'List',
|
||||
hiddenId: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
activeName(val) {
|
||||
if (val === 'List') {
|
||||
this.$refs.list.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
Loading…
Reference in New Issue