feat: 事故信息管理菜单重构
parent
991ef9ea52
commit
2c930b42b2
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
assetsPublicPath: '/',
|
||||
proxyTable: {
|
||||
'/api': {
|
||||
target: 'http://192.168.0.79:8091/',
|
||||
target: 'http://192.168.0.125:8091/',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"author": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 192.168.0.45",
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
||||
"start": "npm run dev",
|
||||
"unit": "jest --config test/unit/jest.conf.js --coverage",
|
||||
"e2e": "node test/e2e/runner.js",
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="infoForm"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="width: 800px"
|
||||
>
|
||||
<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>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故类型">
|
||||
<el-select v-model="infoForm.hiddenPartList" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in hiddenPartList"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故级别">
|
||||
<el-select v-model="infoForm.incidentLevels" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in incidentLevels"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</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>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故照片">
|
||||
<!-- <el-upload
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
action=""
|
||||
list-type="picture-card"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload> -->
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:file-list="photos"
|
||||
:multiple="false"
|
||||
:limit="1"
|
||||
:on-remove="handleRemovePicture"
|
||||
:on-change="handleChangeIMG"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:before-upload="beforeHiddenUpload"
|
||||
:auto-upload="false"
|
||||
class="avatar-uploader"
|
||||
action="#"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
list-type="picture-card">
|
||||
<i class="el-icon-plus" />
|
||||
</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 class="ui-height" />
|
||||
<div class="ui-foot">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-arrow-left"
|
||||
plain
|
||||
@click="goBack">返回</el-button>
|
||||
<el-button type="primary" @click="confirm">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
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 // 报出日期
|
||||
},
|
||||
formLabelWidth: '140px',
|
||||
hiddenPartList: [], // 事故类型字典
|
||||
incidentLevels: [], // 事故等级字典
|
||||
rules: {
|
||||
incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }],
|
||||
incidentName: [{ required: true, message: '事故名称不能为空', trigger: 'blur' }],
|
||||
HIDDENTYPE: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }],
|
||||
incidentType: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }],
|
||||
incidentLevel: [{ required: true, message: '事故级别不能为空', trigger: 'blur' }],
|
||||
incidentNature: [{ required: true, message: '事故性质不能为空', trigger: 'blur' }],
|
||||
location: [{ required: true, message: '事故发生地点不能为空', trigger: 'blur' }],
|
||||
incidentDate: [{ required: true, message: '事故发生时间不能为空', trigger: 'blur' }],
|
||||
directLoss: [{ required: true, message: '直接经济损失(万元)不能为空', trigger: 'blur' }],
|
||||
injured: [{ required: true, message: '受伤人数不能为空', trigger: 'blur' }],
|
||||
seriouslyInjured: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }],
|
||||
cause: [{ required: true, message: '事故起因不能为空', trigger: 'blur' }],
|
||||
summary: [{ required: true, message: '事故概述不能为空', trigger: 'blur' }],
|
||||
photos: [{ required: true, message: '事故照片不能为空', trigger: 'blur' }],
|
||||
analysis: [{ required: true, message: '原因分析及责任认定不能为空', trigger: 'blur' }],
|
||||
suggestions: [{ required: true, message: '考核建议不能为空', trigger: 'blur' }],
|
||||
measures: [{ required: true, message: '整改措施不能为空', trigger: 'blur' }],
|
||||
creator: [{ required: true, message: '填表人不能为空', trigger: 'blur' }],
|
||||
reportDate: [{ required: true, message: '报出日期不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleRemovePicture() {},
|
||||
|
||||
handleChangeIMG() {},
|
||||
|
||||
handlePictureCardPreview() {},
|
||||
|
||||
beforeHiddenUpload() {},
|
||||
/**
|
||||
* 返回到列表页面
|
||||
*/
|
||||
goBack() {
|
||||
this.$parent.activeName = 'List'
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单确认按钮
|
||||
*/
|
||||
confirm() {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -1,27 +1,29 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="searchForm" :model="searchForm" label-width="100px">
|
||||
<el-row :gutter="12">
|
||||
<el-form ref="searchForm" :model="searchForm" label-width="90px">
|
||||
<!-- 搜索查询 start -->
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="事故名称" prop="incidentName">
|
||||
<el-input v-model="searchForm.incidentName" placeholder="请输入隐患描述" class="filter-item"/>
|
||||
<el-input v-model="searchForm.incidentName" placeholder="请输入事故名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="发生时间" prop="incidentDates">
|
||||
<el-date-picker
|
||||
v-model="searchForm.incidentDates"
|
||||
value-format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-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-input v-model="searchForm.location" placeholder="请输入发生地点" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
|
@ -38,432 +40,176 @@
|
|||
</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 :span="3">
|
||||
<el-button v-waves type="primary" icon="el-icon-search" @click="searchList">查询</el-button>
|
||||
<el-button v-waves icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 搜索查询 end -->
|
||||
|
||||
<!-- 顶部操作按钮 start -->
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-button type="primary" icon="el-icon-circle-plus" @click="handleAddNew">新增</el-button>
|
||||
<el-button icon="el-icon-top-right" @click="handleExport">导出</el-button>
|
||||
<el-button icon="el-icon-s-promotion" @click="handleAllExport">全部导出</el-button>
|
||||
<el-button icon="el-icon-refresh-left" @click="handleRefresh">刷新</el-button>
|
||||
<el-button type="danger" icon="el-icon-delete-solid" @click="handleBatchDel">批量删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 顶部操作按钮 end -->
|
||||
</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"/>
|
||||
|
||||
<!-- table 表格 start -->
|
||||
<div style="margin-top: 16px;">
|
||||
<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>
|
||||
<!-- table 表格 end -->
|
||||
|
||||
<div class="pagination-group">
|
||||
<pagination :total="listQuery.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>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故类型">
|
||||
<el-select v-model="infoForm.hiddenPartList" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in hiddenPartList"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</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="infoForm.incidentLevels" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in incidentLevels"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</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 },
|
||||
components: { Pagination },
|
||||
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: ''
|
||||
/** 事故类型 */
|
||||
incidentType: '',
|
||||
/** 事故等级 */
|
||||
incidentLevel: ''
|
||||
},
|
||||
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 // 报出日期
|
||||
/** 列表加载态 */
|
||||
listLoading: false,
|
||||
/** 源列表数据项 */
|
||||
varList: [],
|
||||
/** 事故类型 */
|
||||
incidentTypes: [
|
||||
{
|
||||
id: '01',
|
||||
value: 'yiji',
|
||||
label: '一级事故'
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
value: 'erji',
|
||||
label: '二级事故'
|
||||
}
|
||||
],
|
||||
/** 事故等级 */
|
||||
incidentLevels: [
|
||||
{
|
||||
id: '01',
|
||||
value: 'yiji',
|
||||
label: '一级等级'
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
value: 'erji',
|
||||
label: '二级等级'
|
||||
}
|
||||
],
|
||||
// 列表分页参数
|
||||
listQuery: {
|
||||
/** 当前页数 */
|
||||
page: 1,
|
||||
/** 分页数 */
|
||||
limit: 20,
|
||||
/** 总页数 */
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
})
|
||||
/**
|
||||
* 查询搜索
|
||||
*/
|
||||
searchList() { },
|
||||
|
||||
/**
|
||||
* 重置搜索条件
|
||||
*/
|
||||
handleReset() {},
|
||||
|
||||
/**
|
||||
* 获取分页列表
|
||||
*/
|
||||
getList() {},
|
||||
|
||||
/**
|
||||
* 表格行选择器处理
|
||||
*/
|
||||
handleSelectionChange() {},
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
handleAddNew() {
|
||||
this.$parent.activeName = 'AddOrEdit'
|
||||
},
|
||||
|
||||
// 刷新按钮
|
||||
reset() {
|
||||
this.searchForm = this.$options.data().searchForm
|
||||
this.getList()
|
||||
this.toggleSelection()
|
||||
},
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
handleExport() {},
|
||||
|
||||
// 批量删除
|
||||
deleteInBulk() {
|
||||
// 获取选中的行数据
|
||||
const selectedRows = this.multipleSelection
|
||||
/**
|
||||
* 全部导出
|
||||
*/
|
||||
handleAllExport() {},
|
||||
|
||||
// 如果没有选中任何行,则提示用户
|
||||
if (selectedRows.length === 0) {
|
||||
this.$message.warning('请选择要删除的行')
|
||||
return
|
||||
}
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
handleRefresh() {},
|
||||
|
||||
// 弹出确认框
|
||||
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
|
||||
},
|
||||
|
||||
formatDate(date, format) {
|
||||
return formatDate(date, format)
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
handleBatchDel() {}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
@ -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="incidentDates">
|
||||
<el-date-picker
|
||||
v-model="searchForm.incidentDates"
|
||||
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>
|
||||
<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-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-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>
|
||||
<el-form-item :label-width="formLabelWidth" label="事故类型">
|
||||
<el-select v-model="infoForm.hiddenPartList" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in hiddenPartList"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</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="infoForm.incidentLevels" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in incidentLevels"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
</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
|
||||
},
|
||||
|
||||
formatDate(date, format) {
|
||||
return formatDate(date, format)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
|
@ -1,17 +1,19 @@
|
|||
<template>
|
||||
<!-- <component :is="activeName" />-->
|
||||
<div>
|
||||
<List v-show="activeName==='List'" ref="list"/>
|
||||
<!-- <Detail v-if="activeName==='Detail'"/>-->
|
||||
<List v-if="activeName === 'List'" ref="List" />
|
||||
<Add v-if="activeName === 'AddOrEdit'" ref="AddOrEdit" />
|
||||
<!-- <Detail v-if="activeName==='Detail'"/>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from './components/list.vue'
|
||||
import Add from './components/addOrEdit.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
List: List
|
||||
List: List,
|
||||
Add: Add
|
||||
// Detail: Detail
|
||||
},
|
||||
data() {
|
||||
|
@ -23,7 +25,7 @@ export default {
|
|||
watch: {
|
||||
activeName(val) {
|
||||
if (val === 'List') {
|
||||
this.$refs.list.getList()
|
||||
this.$refs.List.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue