将事故/事件分离开
parent
0f75e526de
commit
f565276ed7
|
@ -0,0 +1,479 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="infoForm"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="180px"
|
||||||
|
style="width: 900px"
|
||||||
|
>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件案号" prop="incidentNumber">
|
||||||
|
<el-input v-model="infoForm.incidentNumber" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件名称" prop="incidentName">
|
||||||
|
<el-input v-model="infoForm.incidentName" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件类型" prop="incidentType">
|
||||||
|
<el-select v-model="infoForm.incidentType" :disabled="isDisabled" placeholder="请选择">
|
||||||
|
<el-option v-for="item in incidentTypes" :key="item.id" :label="item.name" :value="item.id"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item :label-width="formLabelWidth" label="事件级别" prop="incidentLevel">-->
|
||||||
|
<!-- <el-select v-model="infoForm.incidentLevel" :disabled="isDisabled" placeholder="请选择">-->
|
||||||
|
<!-- <el-option v-for="item in incidentLevels" :key="item.id" :label="item.name" :value="item.id"/>-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件发生地点" prop="location">
|
||||||
|
<el-input v-model="infoForm.location" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件发生时间" prop="incidentDate">
|
||||||
|
<el-date-picker
|
||||||
|
:disabled="isDisabled"
|
||||||
|
v-model="infoForm.incidentDate"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="选择事件发生时间"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
style="width: 100%;"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="直接经济损失(万元)" prop="directLoss">
|
||||||
|
<el-input v-model="infoForm.directLoss" :disabled="isDisabled" type="number" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="受伤人数" prop="injured">
|
||||||
|
<el-input v-model="infoForm.injured" :disabled="isDisabled" type="number" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="死亡人数" prop="fatalities">
|
||||||
|
<el-input v-model="infoForm.fatalities" :disabled="isDisabled" type="number" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="重伤人数" prop="seriouslyInjured">
|
||||||
|
<el-input v-model="infoForm.seriouslyInjured" :disabled="isDisabled" type="number" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件起因" prop="cause">
|
||||||
|
<el-input v-model="infoForm.cause" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事件概述" prop="summary">
|
||||||
|
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定" prop="analysis">
|
||||||
|
<el-input v-model="infoForm.analysis" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="考核建议" prop="suggestions">
|
||||||
|
<el-input v-model="infoForm.suggestions" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="整改措施" prop="measures">
|
||||||
|
<el-input v-model="infoForm.measures" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
||||||
|
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="报出日期" prop="reportDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="infoForm.reportDate"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择报出日期"
|
||||||
|
style="width: 100%;"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
:file-list="infoForm.fileList"
|
||||||
|
:multiple="false"
|
||||||
|
:auto-upload="true"
|
||||||
|
:limit="limitNum"
|
||||||
|
:on-remove="handleRemovePicture"
|
||||||
|
:on-preview="handlePictureCardPreview"
|
||||||
|
:before-upload="beforeAccidentUpload"
|
||||||
|
:on-error="handleError"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
name="file"
|
||||||
|
action="#"
|
||||||
|
accept=".jpg,.jpeg,.png"
|
||||||
|
list-type="picture-card">
|
||||||
|
<i class="el-icon-plus"/>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="!isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
:file-list="infoForm.fileAddressList"
|
||||||
|
:multiple="false"
|
||||||
|
:auto-upload="true"
|
||||||
|
:limit="limitNum"
|
||||||
|
:on-remove="handleRemoveAnnex"
|
||||||
|
:before-upload="beforeEventUpload"
|
||||||
|
:on-error="handleError"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
name="file"
|
||||||
|
action="#"
|
||||||
|
accept=".doc,.docx,.pdf,.xlsx">
|
||||||
|
<el-button :disabled="isDisabled" size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
||||||
|
<a
|
||||||
|
v-if="infoForm.fileAddressList != null && infoForm.fileAddressList.length !== 0"
|
||||||
|
:href="infoForm.fileAddressList[0].url"
|
||||||
|
style="display: flex;flex-wrap: wrap;gap: 10px;"
|
||||||
|
|
||||||
|
>{{ infoForm.fileAddressList[0].name }}</a>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogImgVisible">
|
||||||
|
<div v-if="infoForm.fileList.length > 0">
|
||||||
|
<img :src="infoForm.fileList[0].url" width="100%" alt="">
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
import { upload } from '@/utils/upload'
|
||||||
|
import formatDate from '@/utils/dateformat'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
config: config,
|
||||||
|
infoForm: {
|
||||||
|
id: '', // 主键ID
|
||||||
|
incidentNumber: '', // 事件案号
|
||||||
|
incidentName: '', // 事件名称
|
||||||
|
incidentType: null, // 事件类型
|
||||||
|
companyName: '', // 所属公司
|
||||||
|
incidentLevel: '', // 事件级别
|
||||||
|
incidentNature: '', // 事件性质
|
||||||
|
location: '', // 事件发生地点
|
||||||
|
incidentDate: null, // 事件发生时间
|
||||||
|
directLoss: '', // 直接经济损失(万元)
|
||||||
|
injured: null, // 受伤人数
|
||||||
|
fatalities: null, // 死亡人数
|
||||||
|
seriouslyInjured: null, // 重伤人数
|
||||||
|
cause: '', // 事件起因
|
||||||
|
summary: '', // 事件概述
|
||||||
|
fileList: [], // 事件照片
|
||||||
|
fileAddressList: [], // 附件地址
|
||||||
|
analysis: '', // 原因分析及责任认定
|
||||||
|
suggestions: '', // 考核建议
|
||||||
|
measures: '', // 整改措施
|
||||||
|
creator: '', // 填表人
|
||||||
|
reportDate: null // 报出日期
|
||||||
|
},
|
||||||
|
formLabelWidth: '140px',
|
||||||
|
/** 事件类型 */
|
||||||
|
incidentTypes: [],
|
||||||
|
/** 事件等级 */
|
||||||
|
incidentLevels: [],
|
||||||
|
tableName: '',
|
||||||
|
/** 图片上传限制个数 */
|
||||||
|
limitNum: 1,
|
||||||
|
/** 预览弹窗 */
|
||||||
|
dialogImgVisible: false,
|
||||||
|
rules: {
|
||||||
|
incidentNumber: [{ required: true, message: '事件案号不能为空', trigger: 'blur' }],
|
||||||
|
incidentName: [{ required: true, message: '事件名称不能为空', trigger: 'blur' }],
|
||||||
|
incidentType: [{ required: true, message: '事件类型不能为空', trigger: 'blur' }],
|
||||||
|
incidentNature: [{ required: true, message: '事件性质不能为空', trigger: 'blur' }],
|
||||||
|
location: [{ required: true, message: '事件发生地点不能为空', trigger: 'blur' }],
|
||||||
|
incidentDate: [{ required: true, message: '事件发生时间不能为空', trigger: 'blur' }],
|
||||||
|
cause: [{ required: true, message: '事件起因不能为空', trigger: 'blur' }],
|
||||||
|
summary: [{ required: true, message: '事件概述不能为空', trigger: 'blur' }],
|
||||||
|
fileList: [{ 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' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
isDisabled() {
|
||||||
|
return this.$parent.tableName === '查看'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getDict()
|
||||||
|
const id = this.$parent.id
|
||||||
|
this.tableName = this.$parent.tableName
|
||||||
|
if (id == null || id === '') {
|
||||||
|
this.infoForm = this.$options.data().infoForm
|
||||||
|
} else {
|
||||||
|
// 若有数据项的ID, 则请求接口并回显表单
|
||||||
|
requestFN('/accident/' + id, {}).then((data) => {
|
||||||
|
this.infoForm = {
|
||||||
|
...data.info,
|
||||||
|
fileList: [
|
||||||
|
{
|
||||||
|
name: 'photo',
|
||||||
|
url: config.fileUrl + data.info.photos,
|
||||||
|
remotePathName: data.info.photos
|
||||||
|
}
|
||||||
|
],
|
||||||
|
fileAddressList: [
|
||||||
|
{
|
||||||
|
name: '附件',
|
||||||
|
url: config.fileUrl + data.info.attachmentAddress,
|
||||||
|
remotePathName: data.info.attachmentAddress
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
const fileAddress = this.infoForm.fileAddressList[0].remotePathName
|
||||||
|
if (fileAddress == null || fileAddress === '') {
|
||||||
|
this.infoForm.fileAddressList = []
|
||||||
|
}
|
||||||
|
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
||||||
|
this.infoForm.reportDate = new Date(data.info.reportDate)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 文件列表移除文件时的钩子
|
||||||
|
*/
|
||||||
|
handleRemovePicture(file) {
|
||||||
|
if (file.remotePathName) {
|
||||||
|
requestFN(`/accident/delete/photos`, {
|
||||||
|
path: file.remotePathName
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.result === 'success') {
|
||||||
|
this.infoForm.fileList = []
|
||||||
|
this.$message({
|
||||||
|
message: '文件删除成功',
|
||||||
|
type: 'info',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件列表移除文件时的钩子
|
||||||
|
*/
|
||||||
|
handleRemoveAnnex(file) {
|
||||||
|
if (file.remotePathName) {
|
||||||
|
requestFN(`/accident/delete/photos`, {
|
||||||
|
path: file.remotePathName
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.result === 'success') {
|
||||||
|
this.infoForm.fileAddressList = []
|
||||||
|
this.$message({
|
||||||
|
message: '文件删除成功',
|
||||||
|
type: 'info',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击文件列表中已上传的文件时的钩子
|
||||||
|
*/
|
||||||
|
handlePictureCardPreview(file) {
|
||||||
|
this.dialogImgVisible = true
|
||||||
|
this.dialogImageUrl = file.url
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传失败时的钩子处理
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line handle-callback-err
|
||||||
|
handleError(err, file, fileList) {
|
||||||
|
this.$message({
|
||||||
|
message: `${file.name}上传失败, 请稍后重试`,
|
||||||
|
type: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件超出个数限制的钩子处理
|
||||||
|
*/
|
||||||
|
handleExceed(files, fileList) {
|
||||||
|
this.$message.warning(`当前限制选择 ${this.limitNum} 个文件,本次选择了 ${files.length} 个文件`)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。
|
||||||
|
*/
|
||||||
|
beforeAccidentUpload(file) {
|
||||||
|
if (!file) {
|
||||||
|
this.$message({
|
||||||
|
message: '请上传图片',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
||||||
|
const isImage = types.includes(file.type)
|
||||||
|
if (!isImage) {
|
||||||
|
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
|
if (data.result === 'success') {
|
||||||
|
this.infoForm = {
|
||||||
|
...this.infoForm,
|
||||||
|
fileList: [{
|
||||||
|
name: file.name,
|
||||||
|
url: config.fileUrl + data.path,
|
||||||
|
remotePathName: data.path
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。
|
||||||
|
*/
|
||||||
|
beforeEventUpload(file) {
|
||||||
|
if (!file) {
|
||||||
|
this.$message({
|
||||||
|
message: '请上传附件',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
|
if (data.result === 'success') {
|
||||||
|
this.infoForm = {
|
||||||
|
...this.infoForm,
|
||||||
|
fileAddressList: [{
|
||||||
|
name: file.name,
|
||||||
|
url: config.fileUrl + data.path,
|
||||||
|
remotePathName: data.path
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回到列表页面
|
||||||
|
*/
|
||||||
|
goBack() {
|
||||||
|
this.handleResetInitForm()
|
||||||
|
this.image = []
|
||||||
|
this.dialogImageUrl = ''
|
||||||
|
this.$parent.activeName = 'List'
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单清空处理
|
||||||
|
*/
|
||||||
|
handleResetInitForm() {
|
||||||
|
this.infoForm = {
|
||||||
|
id: '', // 主键ID
|
||||||
|
incidentNumber: '', // 事件案号
|
||||||
|
incidentName: '', // 事件名称
|
||||||
|
incidentType: null, // 事件类型
|
||||||
|
companyName: '', // 所属公司
|
||||||
|
incidentLevel: '', // 事件级别
|
||||||
|
incidentNature: '', // 事件性质
|
||||||
|
location: '', // 事件发生地点
|
||||||
|
incidentDate: null, // 事件发生时间
|
||||||
|
directLoss: '', // 直接经济损失(万元)
|
||||||
|
injured: null, // 受伤人数
|
||||||
|
fatalities: null, // 死亡人数
|
||||||
|
seriouslyInjured: null, // 重伤人数
|
||||||
|
cause: '', // 事件起因
|
||||||
|
summary: '', // 事件概述
|
||||||
|
fileList: [], // 事件照片
|
||||||
|
fileAddressList: [], // 附件
|
||||||
|
analysis: '', // 原因分析及责任认定
|
||||||
|
suggestions: '', // 考核建议
|
||||||
|
measures: '', // 整改措施
|
||||||
|
creator: '', // 填表人
|
||||||
|
reportDate: null // 报出日期
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单确认按钮
|
||||||
|
*/
|
||||||
|
confirm() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
|
this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
|
const address = this.infoForm.fileAddressList
|
||||||
|
const params = {
|
||||||
|
...this.infoForm,
|
||||||
|
photos: this.infoForm.fileList[0].remotePathName,
|
||||||
|
attachmentAddress: address == null || address.length === 0 ? address[0].remotePathName : '',
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
delete params.fileList
|
||||||
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
||||||
|
.then((response) => {
|
||||||
|
// 删除成功后的处理
|
||||||
|
this.$message.success(this.tableName + '成功')
|
||||||
|
this.infoForm = this.$options.data().infoForm
|
||||||
|
this.$parent.activeName = 'List'
|
||||||
|
// eslint-disable-next-line handle-callback-err
|
||||||
|
}).catch((error) => {
|
||||||
|
this.$message.error(this.tableName + '失败')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典
|
||||||
|
*/
|
||||||
|
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>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,354 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form ref="searchForm" :model="searchForm" label-width="100px">
|
||||||
|
<el-row :gutter="22">
|
||||||
|
<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="6">
|
||||||
|
<el-form-item label="发生时间" prop="incidentDates">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="searchForm.incidentDates"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
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="请输入发生地点" />
|
||||||
|
</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.id" :label="item.name" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<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 -->
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- table 表格 start -->
|
||||||
|
<div style="margin-top: 16px;">
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
ref="multipleTable"
|
||||||
|
:data="varList"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
border
|
||||||
|
@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="300">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<el-button icon="el-icon-view" type="success" size="mini" @click="goView(row.id, '查看')">查看</el-button>
|
||||||
|
<el-button icon="el-icon-edit" type="primary" size="mini" @click="goEdit(row.id, '修改')">修改</el-button>
|
||||||
|
<el-button icon="el-icon-delete-solid" type="danger" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<!-- table 表格 end -->
|
||||||
|
|
||||||
|
<div class="pagination-group">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-button type="primary" icon="el-icon-circle-plus" @click="goView('', '新增')">新增</el-button>
|
||||||
|
<el-button icon="el-icon-s-promotion" @click="handleAllExport">全部导出</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete-solid" @click="handleBatchDel">批量删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<pagination :total="listQuery.total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="searchList" />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import waves from '@/directive/waves'
|
||||||
|
import formatDate from '@/utils/dateformat'
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
directives: { waves },
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 搜索查询条件
|
||||||
|
searchForm: {
|
||||||
|
/** 事件名称 */
|
||||||
|
incidentName: '',
|
||||||
|
/** 发生时间 */
|
||||||
|
incidentDates: [],
|
||||||
|
/** 开始时间 */
|
||||||
|
startTime: null,
|
||||||
|
/** 结束时间 */
|
||||||
|
endTime: null,
|
||||||
|
/** 发生地点 */
|
||||||
|
location: '',
|
||||||
|
/** 事件类型 */
|
||||||
|
incidentType: '',
|
||||||
|
/** 事件等级 */
|
||||||
|
incidentLevel: '',
|
||||||
|
/** 类型 */
|
||||||
|
type: ''
|
||||||
|
},
|
||||||
|
/** 当前选中行 */
|
||||||
|
multipleSelection: [],
|
||||||
|
/** 列表加载态 */
|
||||||
|
listLoading: false,
|
||||||
|
/** 源列表数据项 */
|
||||||
|
varList: [],
|
||||||
|
/** 事件类型 */
|
||||||
|
incidentTypes: [],
|
||||||
|
/** 事件等级 */
|
||||||
|
incidentLevels: [],
|
||||||
|
// 列表分页参数
|
||||||
|
listQuery: {
|
||||||
|
/** 当前页数 */
|
||||||
|
page: 1,
|
||||||
|
/** 分页数 */
|
||||||
|
limit: 20,
|
||||||
|
/** 总页数 */
|
||||||
|
total: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getDict()
|
||||||
|
this.searchList()
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 查询搜索
|
||||||
|
*/
|
||||||
|
searchList() {
|
||||||
|
this.listLoading = true
|
||||||
|
const dates = this.searchForm.incidentDates
|
||||||
|
this.searchForm.type = 1
|
||||||
|
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.listQuery.total = data.page.totalResult
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置搜索条件
|
||||||
|
*/
|
||||||
|
handleReset() {
|
||||||
|
this.searchForm = this.$options.data().searchForm
|
||||||
|
this.searchList()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格行选择器处理
|
||||||
|
*/
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.multipleSelection = val
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转查看详情页面
|
||||||
|
*/
|
||||||
|
goView(id, name) {
|
||||||
|
this.$parent.id = id
|
||||||
|
this.$parent.tableName = name
|
||||||
|
this.$parent.activeName = 'AddOrEdit'
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转修改页面
|
||||||
|
*/
|
||||||
|
goEdit(id, name) {
|
||||||
|
this.$parent.id = id
|
||||||
|
this.$parent.tableName = name
|
||||||
|
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('删除成功')
|
||||||
|
this.searchList()
|
||||||
|
// eslint-disable-next-line handle-callback-err
|
||||||
|
}).catch((error) => {
|
||||||
|
this.$message.error('删除失败')
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部导出
|
||||||
|
*/
|
||||||
|
handleAllExport() {
|
||||||
|
this.$confirm('确定要下载excel模板吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
window.location.href = config.httpurl + '/accident/export/excel?type=1'
|
||||||
|
}).catch(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
this.listLoading = false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载附件
|
||||||
|
*/
|
||||||
|
downloadTheAttachment(attachmentAddress) {
|
||||||
|
this.$confirm('确定要下载附件吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
window.location.href = config.fileUrl + attachmentAddress
|
||||||
|
}).catch(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
this.listLoading = false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新
|
||||||
|
*/
|
||||||
|
handleRefresh() {
|
||||||
|
this.searchForm = this.$options.data().searchForm
|
||||||
|
this.searchList()
|
||||||
|
// this.toggleSelection()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
handleBatchDel() {
|
||||||
|
// 获取选中的行数据
|
||||||
|
const selectedRows = this.multipleSelection
|
||||||
|
// 如果没有选中任何行,则提示用户
|
||||||
|
if (this.multipleSelection === '' || selectedRows.length === 0) {
|
||||||
|
this.$message.warning('请选择要删除的行')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 弹出确认框
|
||||||
|
this.$confirm('确定要删除这些记录吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
// 获取所有选中行的 ID
|
||||||
|
let ids = ''
|
||||||
|
selectedRows.forEach(row => {
|
||||||
|
ids += row.id + ','
|
||||||
|
})
|
||||||
|
// 发送批量删除请求
|
||||||
|
const url = '/accident/delete/' + '' + ids
|
||||||
|
requestFN(url).then((response) => {
|
||||||
|
// 删除成功后的处理
|
||||||
|
this.$message.success('删除成功')
|
||||||
|
this.searchList()
|
||||||
|
// eslint-disable-next-line handle-callback-err
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('删除失败')
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
formatDate(date, format) {
|
||||||
|
return formatDate(date, format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.pagination-group {
|
||||||
|
margin-top: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<List v-if="activeName === 'List'" ref="List" />
|
||||||
|
<Add v-if="activeName === 'AddOrEdit'" ref="AddOrEdit" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import List from './components/list.vue'
|
||||||
|
import Add from './components/addOrEdit.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
List: List,
|
||||||
|
Add: Add
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeName: 'List',
|
||||||
|
id: '',
|
||||||
|
tableName: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
activeName(val) {
|
||||||
|
if (val === 'List') {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.List.searchList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
|
@ -32,6 +32,8 @@
|
||||||
v-model="infoForm.incidentDate"
|
v-model="infoForm.incidentDate"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
placeholder="选择事故发生时间"
|
placeholder="选择事故发生时间"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -53,6 +55,29 @@
|
||||||
<el-form-item :label-width="formLabelWidth" label="事故概述" prop="summary">
|
<el-form-item :label-width="formLabelWidth" label="事故概述" prop="summary">
|
||||||
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定" prop="analysis">
|
||||||
|
<el-input v-model="infoForm.analysis" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="考核建议" prop="suggestions">
|
||||||
|
<el-input v-model="infoForm.suggestions" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="整改措施" prop="measures">
|
||||||
|
<el-input v-model="infoForm.measures" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
||||||
|
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label-width="formLabelWidth" label="报出日期" prop="reportDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="infoForm.reportDate"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择报出日期"
|
||||||
|
style="width: 100%;"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
|
@ -73,26 +98,31 @@
|
||||||
<i class="el-icon-plus"/>
|
<i class="el-icon-plus"/>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定" prop="analysis">
|
<el-form-item v-if="!isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
||||||
<el-input v-model="infoForm.analysis" :disabled="isDisabled" autocomplete="off"/>
|
<el-upload
|
||||||
</el-form-item>
|
ref="upload"
|
||||||
<el-form-item :label-width="formLabelWidth" label="考核建议" prop="suggestions">
|
|
||||||
<el-input v-model="infoForm.suggestions" :disabled="isDisabled" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="整改措施" prop="measures">
|
|
||||||
<el-input v-model="infoForm.measures" :disabled="isDisabled" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
|
||||||
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="报出日期" prop="reportDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="infoForm.reportDate"
|
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
type="datetime"
|
:file-list="infoForm.fileAddressList"
|
||||||
placeholder="请选择报出日期"
|
:multiple="false"
|
||||||
style="width: 100%;"
|
:auto-upload="true"
|
||||||
/>
|
:limit="limitNum"
|
||||||
|
:on-remove="handleRemoveAnnex"
|
||||||
|
:before-upload="beforeEventUpload"
|
||||||
|
:on-error="handleError"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
name="file"
|
||||||
|
action="#"
|
||||||
|
accept=".doc,.docx,.pdf,.xlsx">
|
||||||
|
<el-button :disabled="isDisabled" size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
||||||
|
<a
|
||||||
|
v-if="infoForm.fileAddressList != null && infoForm.fileAddressList.length !== 0"
|
||||||
|
:href="infoForm.fileAddressList[0].url"
|
||||||
|
style="display: flex;flex-wrap: wrap;gap: 10px;"
|
||||||
|
|
||||||
|
>{{ infoForm.fileAddressList[0].name }}</a>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
@ -116,8 +146,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { requestFN } from '../../../../utils/request'
|
import { requestFN } from '@/utils/request'
|
||||||
import { upload } from '@/utils/upload'
|
import { upload } from '@/utils/upload'
|
||||||
|
import formatDate from '@/utils/dateformat'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -140,6 +171,8 @@ export default {
|
||||||
cause: '', // 事故起因
|
cause: '', // 事故起因
|
||||||
summary: '', // 事故概述
|
summary: '', // 事故概述
|
||||||
fileList: [], // 事故照片
|
fileList: [], // 事故照片
|
||||||
|
fileAddressList: [], // 附件地址
|
||||||
|
attachmentAddress: '', // 附件地址url
|
||||||
analysis: '', // 原因分析及责任认定
|
analysis: '', // 原因分析及责任认定
|
||||||
suggestions: '', // 考核建议
|
suggestions: '', // 考核建议
|
||||||
measures: '', // 整改措施
|
measures: '', // 整改措施
|
||||||
|
@ -160,13 +193,9 @@ export default {
|
||||||
incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }],
|
incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }],
|
||||||
incidentName: [{ required: true, message: '事故名称不能为空', trigger: 'blur' }],
|
incidentName: [{ required: true, message: '事故名称不能为空', trigger: 'blur' }],
|
||||||
incidentType: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }],
|
incidentType: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }],
|
||||||
incidentLevel: [{ required: true, message: '事故级别不能为空', trigger: 'blur' }],
|
|
||||||
incidentNature: [{ required: true, message: '事故性质不能为空', trigger: 'blur' }],
|
incidentNature: [{ required: true, message: '事故性质不能为空', trigger: 'blur' }],
|
||||||
location: [{ required: true, message: '事故发生地点不能为空', trigger: 'blur' }],
|
location: [{ required: true, message: '事故发生地点不能为空', trigger: 'blur' }],
|
||||||
incidentDate: [{ 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' }],
|
cause: [{ required: true, message: '事故起因不能为空', trigger: 'blur' }],
|
||||||
summary: [{ required: true, message: '事故概述不能为空', trigger: 'blur' }],
|
summary: [{ required: true, message: '事故概述不能为空', trigger: 'blur' }],
|
||||||
fileList: [{ required: true, message: '事故照片不能为空', trigger: 'blur' }],
|
fileList: [{ required: true, message: '事故照片不能为空', trigger: 'blur' }],
|
||||||
|
@ -202,8 +231,21 @@ export default {
|
||||||
url: config.fileUrl + data.info.photos,
|
url: config.fileUrl + data.info.photos,
|
||||||
remotePathName: data.info.photos
|
remotePathName: data.info.photos
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
fileAddressList: [
|
||||||
|
{
|
||||||
|
name: '附件',
|
||||||
|
url: config.fileUrl + data.info.attachmentAddress,
|
||||||
|
remotePathName: data.info.attachmentAddress
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
const fileAddress = this.infoForm.fileAddressList[0].remotePathName
|
||||||
|
if (fileAddress == null || fileAddress === '') {
|
||||||
|
this.infoForm.fileAddressList = []
|
||||||
|
}
|
||||||
|
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
||||||
|
this.infoForm.reportDate = new Date(data.info.reportDate)
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -230,6 +272,26 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件列表移除文件时的钩子
|
||||||
|
*/
|
||||||
|
handleRemoveAnnex(file) {
|
||||||
|
if (file.remotePathName) {
|
||||||
|
requestFN(`/accident/delete/photos`, {
|
||||||
|
path: file.remotePathName
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.result === 'success') {
|
||||||
|
this.infoForm.fileAddressList = []
|
||||||
|
this.$message({
|
||||||
|
message: '文件删除成功',
|
||||||
|
type: 'info',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击文件列表中已上传的文件时的钩子
|
* 点击文件列表中已上传的文件时的钩子
|
||||||
*/
|
*/
|
||||||
|
@ -292,6 +354,34 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。
|
||||||
|
*/
|
||||||
|
beforeEventUpload(file) {
|
||||||
|
if (!file) {
|
||||||
|
this.$message({
|
||||||
|
message: '请上传附件',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
|
if (data.result === 'success') {
|
||||||
|
this.infoForm = {
|
||||||
|
...this.infoForm,
|
||||||
|
fileAddressList: [{
|
||||||
|
name: file.name,
|
||||||
|
url: config.fileUrl + data.path,
|
||||||
|
remotePathName: data.path
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回到列表页面
|
* 返回到列表页面
|
||||||
*/
|
*/
|
||||||
|
@ -339,9 +429,14 @@ export default {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
|
this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
|
const address = this.infoForm.fileAddressList
|
||||||
const params = {
|
const params = {
|
||||||
...this.infoForm,
|
...this.infoForm,
|
||||||
photos: this.infoForm.fileList[0].remotePathName
|
photos: this.infoForm.fileList[0].remotePathName,
|
||||||
|
attachmentAddress: address == null || address.length === 0 ? address[0].remotePathName : '',
|
||||||
|
type: 2
|
||||||
}
|
}
|
||||||
delete params.fileList
|
delete params.fileList
|
||||||
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<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="22">
|
||||||
<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="请输入事故名称" class="filter-item"/>
|
<el-input v-model="searchForm.incidentName" placeholder="请输入事故名称" class="filter-item"/>
|
||||||
|
@ -27,36 +27,28 @@
|
||||||
<el-input v-model="searchForm.location" placeholder="请输入发生地点" />
|
<el-input v-model="searchForm.location" placeholder="请输入发生地点" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3">
|
<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.id" :label="item.name" :value="item.id" />
|
<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="3">
|
<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.id" :label="item.name" :value="item.id" />
|
<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>
|
||||||
<el-col :span="3">
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
<el-button v-waves type="primary" icon="el-icon-search" @click="searchList">查询</el-button>
|
<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-button v-waves icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- 搜索查询 end -->
|
<!-- 搜索查询 end -->
|
||||||
|
|
||||||
<!-- 顶部操作按钮 start -->
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-button type="primary" icon="el-icon-circle-plus" @click="goView('', '新增')">新增</el-button>
|
|
||||||
<el-button icon="el-icon-s-promotion" @click="handleAllExport">全部导出</el-button>
|
|
||||||
<el-button type="danger" icon="el-icon-delete-solid" @click="handleBatchDel">批量删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- 顶部操作按钮 end -->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- table 表格 start -->
|
<!-- table 表格 start -->
|
||||||
|
@ -81,8 +73,8 @@
|
||||||
<el-table-column label="发生地点" prop="location"/>
|
<el-table-column label="发生地点" prop="location"/>
|
||||||
<el-table-column label="操作" width="300">
|
<el-table-column label="操作" width="300">
|
||||||
<template v-slot="{row}">
|
<template v-slot="{row}">
|
||||||
<el-button icon="el-icon-view" size="mini" @click="goView(row.id, '查看')">查看</el-button>
|
<el-button icon="el-icon-view" type="success" size="mini" @click="goView(row.id, '查看')">查看</el-button>
|
||||||
<el-button icon="el-icon-edit" size="mini" @click="goEdit(row.id, '修改')">修改</el-button>
|
<el-button icon="el-icon-edit" type="primary" size="mini" @click="goEdit(row.id, '修改')">修改</el-button>
|
||||||
<el-button icon="el-icon-delete-solid" type="danger" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
<el-button icon="el-icon-delete-solid" type="danger" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -91,7 +83,16 @@
|
||||||
<!-- 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="searchList" />
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-button type="primary" icon="el-icon-circle-plus" @click="goView('', '新增')">新增</el-button>
|
||||||
|
<el-button icon="el-icon-s-promotion" @click="handleAllExport">全部导出</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete-solid" @click="handleBatchDel">批量删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<pagination :total="listQuery.total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="searchList" />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -100,7 +101,7 @@
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
import waves from '@/directive/waves'
|
import waves from '@/directive/waves'
|
||||||
import formatDate from '@/utils/dateformat'
|
import formatDate from '@/utils/dateformat'
|
||||||
import { requestFN } from '../../../../utils/request'
|
import { requestFN } from '@/utils/request'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
|
@ -123,7 +124,11 @@ export default {
|
||||||
/** 事故类型 */
|
/** 事故类型 */
|
||||||
incidentType: '',
|
incidentType: '',
|
||||||
/** 事故等级 */
|
/** 事故等级 */
|
||||||
incidentLevel: ''
|
incidentLevel: '',
|
||||||
|
/** 附件地址 */
|
||||||
|
attachmentAddress: '',
|
||||||
|
/** 类型 */
|
||||||
|
type: ''
|
||||||
},
|
},
|
||||||
/** 当前选中行 */
|
/** 当前选中行 */
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
|
@ -159,6 +164,7 @@ export default {
|
||||||
searchList() {
|
searchList() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
const dates = this.searchForm.incidentDates
|
const dates = this.searchForm.incidentDates
|
||||||
|
this.searchForm.type = 2
|
||||||
if (dates != null && dates.length === 2) {
|
if (dates != null && dates.length === 2) {
|
||||||
this.searchForm.startTime = dates[0]
|
this.searchForm.startTime = dates[0]
|
||||||
this.searchForm.endTime = dates[1]
|
this.searchForm.endTime = dates[1]
|
||||||
|
@ -249,22 +255,13 @@ export default {
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
window.location.href = config.httpurl + '/accident/export/excel'
|
window.location.href = config.httpurl + '/accident/export/excel?type=2'
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
})
|
})
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新
|
|
||||||
*/
|
|
||||||
handleRefresh() {
|
|
||||||
this.searchForm = this.$options.data().searchForm
|
|
||||||
this.searchList()
|
|
||||||
// this.toggleSelection()
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue