hyx_2024-9-25_tongbu
parent
7847b69c62
commit
a77e81bbf0
|
@ -14,21 +14,13 @@
|
|||
<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 v-model="infoForm.incidentTypes" 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="事故级别">
|
||||
<el-select v-model="infoForm.incidentLevels" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in incidentLevels"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"/>
|
||||
<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="事故发生地点">
|
||||
|
@ -62,18 +54,9 @@
|
|||
<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"
|
||||
:file-list="image"
|
||||
:multiple="false"
|
||||
:limit="1"
|
||||
:on-remove="handleRemovePicture"
|
||||
|
@ -124,6 +107,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { requestFN } from '../../../../utils/request'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -143,7 +128,7 @@ export default {
|
|||
seriouslyInjured: null, // 重伤人数
|
||||
cause: '', // 事故起因
|
||||
summary: '', // 事故概述
|
||||
photos: [], // 事故照片
|
||||
photos: '', // 事故照片
|
||||
analysis: '', // 原因分析及责任认定
|
||||
suggestions: '', // 考核建议
|
||||
measures: '', // 整改措施
|
||||
|
@ -151,8 +136,13 @@ export default {
|
|||
reportDate: null // 报出日期
|
||||
},
|
||||
formLabelWidth: '140px',
|
||||
hiddenPartList: [], // 事故类型字典
|
||||
incidentLevels: [], // 事故等级字典
|
||||
/** 事故类型 */
|
||||
incidentTypes: [],
|
||||
/** 事故等级 */
|
||||
incidentLevels: [],
|
||||
tableName: '',
|
||||
/** 图片文件 */
|
||||
image: null,
|
||||
rules: {
|
||||
incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }],
|
||||
incidentName: [{ required: true, message: '事故名称不能为空', trigger: 'blur' }],
|
||||
|
@ -177,6 +167,21 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getDict()
|
||||
const id = this.$parent.id
|
||||
this.tableName = this.$parent.tableName
|
||||
if (id == null || id === '') {
|
||||
this.infoForm = this.$options.data().infoForm
|
||||
} else {
|
||||
requestFN('/accident/' + id, {}).then((data) => {
|
||||
this.infoForm = data.info
|
||||
}).catch((e) => {
|
||||
this.listLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleRemovePicture() {},
|
||||
|
||||
|
@ -195,7 +200,39 @@ export default {
|
|||
/**
|
||||
* 表单确认按钮
|
||||
*/
|
||||
confirm() {}
|
||||
confirm() {
|
||||
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), this.infoForm)
|
||||
.then((response) => {
|
||||
// 删除成功后的处理
|
||||
this.$message.success(this.tableName + '成功')
|
||||
this.getList() // 重新获取数据
|
||||
this.infoForm = this.$options.data().infoForm
|
||||
// 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>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<!-- 顶部操作按钮 start -->
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-button type="primary" icon="el-icon-circle-plus" @click="handleAddNew">新增</el-button>
|
||||
<el-button type="primary" icon="el-icon-circle-plus" @click="goView('', '新增')">新增</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>
|
||||
|
@ -76,8 +76,8 @@
|
|||
<el-table-column label="发生地点" prop="location"/>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="{row}">
|
||||
<el-button icon="el-icon-view" size="mini" @click="goView(row.id)">查看</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="changeDialog('修改',row.id)">修改</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="goView(row.id, '查看')">查看</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="goView(row.id, '修改')">修改</el-button>
|
||||
<el-button icon="el-icon-view" size="mini" @click="deleteRow(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -179,13 +179,17 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* 跳转页面
|
||||
*/
|
||||
handleAddNew() {
|
||||
goView(id, name) {
|
||||
this.$parent.id = id
|
||||
this.$parent.tableName = name
|
||||
this.$parent.activeName = 'AddOrEdit'
|
||||
},
|
||||
|
||||
// 删除行数据
|
||||
/**
|
||||
* 删除行数据
|
||||
*/
|
||||
deleteRow(id) {
|
||||
if (id === null || id === '') {
|
||||
this.$message.warning('请选择要删除的行')
|
||||
|
|
|
@ -19,7 +19,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
activeName: 'List',
|
||||
hiddenId: ''
|
||||
id: '',
|
||||
tableName: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
Loading…
Reference in New Issue