事故调查管理代码提交
parent
6dbdf598c7
commit
7847b69c62
|
@ -100,6 +100,12 @@ export const constantRoutes = [
|
|||
hidden: true,
|
||||
component: () => import('@/views/map/index')
|
||||
}
|
||||
// {
|
||||
// path: '/accident/records',
|
||||
// name: 'apiAccidentRecords',
|
||||
// meta: { name: '事故调查' },
|
||||
// component: () => import('@/views/accident/records/index.vue')
|
||||
// }
|
||||
]
|
||||
const createRouter = () => new Router({
|
||||
// mode: 'history', // require service support
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="searchForm" :model="searchForm" label-width="90px">
|
||||
<!-- 搜索查询 start -->
|
||||
<el-row :gutter="24">
|
||||
<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="请输入事故名称" />
|
||||
<el-input v-model="searchForm.incidentName" placeholder="请输入隐患描述" class="filter-item"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发生时间" prop="incidentDates">
|
||||
<el-date-picker
|
||||
v-model="searchForm.incidentDates"
|
||||
|
@ -29,14 +28,14 @@
|
|||
<el-col :span="4">
|
||||
<el-form-item label="事故类型" prop="incidentType">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="事故等级" prop="incidentLevel">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
|
@ -73,25 +72,20 @@
|
|||
<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="incidentDate"/>
|
||||
<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>
|
||||
<el-button icon="el-icon-view" size="mini" @click="goView(row.id)">查看</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="changeDialog('修改',row.id)">修改</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- table 表格 end -->
|
||||
|
||||
<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>
|
||||
</template>
|
||||
|
@ -99,6 +93,7 @@
|
|||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
import waves from '@/directive/waves'
|
||||
import { requestFN } from '../../../../utils/request'
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
|
@ -112,6 +107,10 @@ export default {
|
|||
incidentName: '',
|
||||
/** 发生时间 */
|
||||
incidentDates: [],
|
||||
/** 开始时间 */
|
||||
startTime: null,
|
||||
/** 结束时间 */
|
||||
endTime: null,
|
||||
/** 发生地点 */
|
||||
location: '',
|
||||
/** 事故类型 */
|
||||
|
@ -124,31 +123,9 @@ export default {
|
|||
/** 源列表数据项 */
|
||||
varList: [],
|
||||
/** 事故类型 */
|
||||
incidentTypes: [
|
||||
{
|
||||
id: '01',
|
||||
value: 'yiji',
|
||||
label: '一级事故'
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
value: 'erji',
|
||||
label: '二级事故'
|
||||
}
|
||||
],
|
||||
incidentTypes: [],
|
||||
/** 事故等级 */
|
||||
incidentLevels: [
|
||||
{
|
||||
id: '01',
|
||||
value: 'yiji',
|
||||
label: '一级等级'
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
value: 'erji',
|
||||
label: '二级等级'
|
||||
}
|
||||
],
|
||||
incidentLevels: [],
|
||||
// 列表分页参数
|
||||
listQuery: {
|
||||
/** 当前页数 */
|
||||
|
@ -161,26 +138,45 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getDict()
|
||||
this.searchList()
|
||||
},
|
||||
|
||||
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 + '¤tPage=' + 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() {},
|
||||
|
||||
/**
|
||||
* 获取分页列表
|
||||
*/
|
||||
getList() {},
|
||||
handleReset() {
|
||||
this.searchForm = this.$options.data().searchForm
|
||||
},
|
||||
|
||||
/**
|
||||
* 表格行选择器处理
|
||||
*/
|
||||
handleSelectionChange() {},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection.push(val)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
@ -189,6 +185,37 @@ export default {
|
|||
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>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<template>
|
||||
<0template>
|
||||
<div class="app-container">
|
||||
<el-form ref="searchForm" :model="searchForm" label-width="100px">
|
||||
<el-row :gutter="12">
|
||||
|
@ -193,7 +193,7 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
</0template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
|
|
Loading…
Reference in New Issue