hyx_2024-10-30_new
shanao 2024-09-08 22:08:29 +08:00
parent 5aa6676248
commit 6e97caf3a4
3 changed files with 74 additions and 32 deletions

View File

@ -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>

View File

@ -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('请选择要删除的行')

View File

@ -19,7 +19,8 @@ export default {
data() {
return {
activeName: 'List',
hiddenId: ''
id: '',
tableName: ''
}
},
watch: {