事故调查管理代码提交

hyx_2024-9-25_tongbu
shanao 2024-09-06 19:38:37 +08:00
parent 6dbdf598c7
commit 7847b69c62
3 changed files with 145 additions and 53 deletions

View File

@ -100,6 +100,12 @@ export const constantRoutes = [
hidden: true, hidden: true,
component: () => import('@/views/map/index') component: () => import('@/views/map/index')
} }
// {
// path: '/accident/records',
// name: 'apiAccidentRecords',
// meta: { name: '事故调查' },
// component: () => import('@/views/accident/records/index.vue')
// }
] ]
const createRouter = () => new Router({ const createRouter = () => new Router({
// mode: 'history', // require service support // mode: 'history', // require service support

View File

@ -1,14 +1,13 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="searchForm" :model="searchForm" label-width="90px"> <el-form ref="searchForm" :model="searchForm" label-width="100px">
<!-- 搜索查询 start --> <el-row :gutter="12">
<el-row :gutter="24">
<el-col :span="4"> <el-col :span="4">
<el-form-item label="事故名称" prop="incidentName"> <el-form-item label="事故名称" prop="incidentName">
<el-input v-model="searchForm.incidentName" placeholder="请输入事故名称" /> <el-input v-model="searchForm.incidentName" placeholder="请输入隐患描述" class="filter-item"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="8">
<el-form-item label="发生时间" prop="incidentDates"> <el-form-item label="发生时间" prop="incidentDates">
<el-date-picker <el-date-picker
v-model="searchForm.incidentDates" v-model="searchForm.incidentDates"
@ -29,14 +28,14 @@
<el-col :span="4"> <el-col :span="4">
<el-form-item label="事故类型" prop="incidentType"> <el-form-item label="事故类型" prop="incidentType">
<el-select v-model="searchForm.incidentType" placeholder="请选择"> <el-select v-model="searchForm.incidentType" placeholder="请选择">
<el-option v-for="item in incidentTypes" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in incidentTypes" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="事故等级" prop="incidentLevel"> <el-form-item label="事故等级" prop="incidentLevel">
<el-select v-model="searchForm.incidentLevel" placeholder="请选择"> <el-select v-model="searchForm.incidentLevel" placeholder="请选择">
<el-option v-for="item in incidentLevels" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in incidentLevels" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -73,25 +72,20 @@
<el-table-column type="selection" width="55"/> <el-table-column type="selection" width="55"/>
<el-table-column label="事故名称" prop="incidentName"/> <el-table-column label="事故名称" prop="incidentName"/>
<el-table-column label="所属公司" prop="companyName"/> <el-table-column label="所属公司" prop="companyName"/>
<el-table-column label="发生时间" prop="incidentDate"> <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="发生地点" prop="location"/>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template v-slot="{row}"> <template v-slot="{row}">
<el-button v-show="edit" icon="el-icon-view" size="mini" @click="goView(row.id)"></el-button> <el-button 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 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> <el-button icon="el-icon-view" size="mini" @click="deleteRow(row.id)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<!-- table 表格 end --> <!-- table 表格 end -->
<div class="pagination-group"> <div class="pagination-group">
<pagination :total="listQuery.total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> <pagination :total="listQuery.total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="searchList" />
</div> </div>
</div> </div>
</template> </template>
@ -99,6 +93,7 @@
<script> <script>
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import waves from '@/directive/waves' import waves from '@/directive/waves'
import { requestFN } from '../../../../utils/request'
export default { export default {
components: { Pagination }, components: { Pagination },
@ -112,6 +107,10 @@ export default {
incidentName: '', incidentName: '',
/** 发生时间 */ /** 发生时间 */
incidentDates: [], incidentDates: [],
/** 开始时间 */
startTime: null,
/** 结束时间 */
endTime: null,
/** 发生地点 */ /** 发生地点 */
location: '', location: '',
/** 事故类型 */ /** 事故类型 */
@ -124,31 +123,9 @@ export default {
/** 源列表数据项 */ /** 源列表数据项 */
varList: [], varList: [],
/** 事故类型 */ /** 事故类型 */
incidentTypes: [ incidentTypes: [],
{
id: '01',
value: 'yiji',
label: '一级事故'
},
{
id: '02',
value: 'erji',
label: '二级事故'
}
],
/** 事故等级 */ /** 事故等级 */
incidentLevels: [ incidentLevels: [],
{
id: '01',
value: 'yiji',
label: '一级等级'
},
{
id: '02',
value: 'erji',
label: '二级等级'
}
],
// //
listQuery: { listQuery: {
/** 当前页数 */ /** 当前页数 */
@ -161,26 +138,45 @@ export default {
} }
}, },
created() {
this.getDict()
this.searchList()
},
methods: { methods: {
/** /**
* 查询搜索 * 查询搜索
*/ */
searchList() { }, searchList() {
this.listLoading = true
const dates = this.searchForm.incidentDates
if (dates != null && dates.length === 2) {
this.searchForm.startTime = dates[0]
this.searchForm.endTime = dates[1]
}
const url = '/accident/page?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page
requestFN(url, { ...this.searchForm }).then((data) => {
this.listLoading = false
this.varList = data.varList
this.total = data.page.totalResult
}).catch((e) => {
this.listLoading = false
})
},
/** /**
* 重置搜索条件 * 重置搜索条件
*/ */
handleReset() {}, handleReset() {
this.searchForm = this.$options.data().searchForm
/** },
* 获取分页列表
*/
getList() {},
/** /**
* 表格行选择器处理 * 表格行选择器处理
*/ */
handleSelectionChange() {}, handleSelectionChange(val) {
this.multipleSelection.push(val)
},
/** /**
* 新增 * 新增
@ -189,6 +185,37 @@ export default {
this.$parent.activeName = 'AddOrEdit' this.$parent.activeName = 'AddOrEdit'
}, },
//
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('删除成功')
// eslint-disable-next-line handle-callback-err
}).catch((error) => {
this.$message.error('删除失败')
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
this.searchList()
},
/** /**
* 导出 * 导出
*/ */
@ -202,12 +229,71 @@ export default {
/** /**
* 刷新 * 刷新
*/ */
handleRefresh() {}, handleRefresh() {
this.searchForm = this.$options.data().searchForm
this.searchList()
this.toggleSelection()
},
/** /**
* 批量删除 * 批量删除
*/ */
handleBatchDel() {} handleBatchDel() {
//
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.searchList() //
// eslint-disable-next-line handle-callback-err
}).catch((error) => {
this.$message.error('删除失败')
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
this.searchList()
},
/**
* 查询字典
*/
getDict() {
const url = '/dictionaries/listSelectTree'
requestFN(url,
{
DICTIONARIES_ID: '8d4140a900184b60836ad1a6490fd510'
}
).then((data) => {
this.incidentTypes = JSON.parse(data.zTreeNodes)
})
requestFN(url,
{
DICTIONARIES_ID: 'b61a1edc59c0430c8741c5f51aa26c3c'
}
).then((data) => {
this.incidentLevels = JSON.parse(data.zTreeNodes)
})
}
} }
} }
</script> </script>

View File

@ -1,4 +1,4 @@
<template> <0template>
<div class="app-container"> <div class="app-container">
<el-form ref="searchForm" :model="searchForm" label-width="100px"> <el-form ref="searchForm" :model="searchForm" label-width="100px">
<el-row :gutter="12"> <el-row :gutter="12">
@ -193,7 +193,7 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </0template>
<script> <script>
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'