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-input v-model="infoForm.incidentName" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故类型"> <el-form-item :label-width="formLabelWidth" label="事故类型">
<el-select v-model="infoForm.hiddenPartList" placeholder="请选择"> <el-select v-model="infoForm.incidentTypes" placeholder="请选择">
<el-option <el-option v-for="item in incidentTypes" :key="item.id" :label="item.name" :value="item.id" />
v-for="item in hiddenPartList"
:key="item.id"
:label="item.type"
:value="item.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故级别"> <el-form-item :label-width="formLabelWidth" label="事故级别">
<el-select v-model="infoForm.incidentLevels" placeholder="请选择"> <el-select v-model="infoForm.incidentLevels" placeholder="请选择">
<el-option <el-option v-for="item in incidentLevels" :key="item.id" :label="item.name" :value="item.id" />
v-for="item in incidentLevels"
:key="item.id"
:label="item.type"
:value="item.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故发生地点"> <el-form-item :label-width="formLabelWidth" label="事故发生地点">
@ -62,18 +54,9 @@
<el-input v-model="infoForm.summary" autocomplete="off"/> <el-input v-model="infoForm.summary" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故照片"> <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 <el-upload
ref="upload" ref="upload"
:file-list="photos" :file-list="image"
:multiple="false" :multiple="false"
:limit="1" :limit="1"
:on-remove="handleRemovePicture" :on-remove="handleRemovePicture"
@ -124,6 +107,8 @@
</template> </template>
<script> <script>
import { requestFN } from '../../../../utils/request'
export default { export default {
data() { data() {
return { return {
@ -143,7 +128,7 @@ export default {
seriouslyInjured: null, // seriouslyInjured: null, //
cause: '', // cause: '', //
summary: '', // summary: '', //
photos: [], // photos: '', //
analysis: '', // analysis: '', //
suggestions: '', // suggestions: '', //
measures: '', // measures: '', //
@ -151,8 +136,13 @@ export default {
reportDate: null // reportDate: null //
}, },
formLabelWidth: '140px', formLabelWidth: '140px',
hiddenPartList: [], // /** 事故类型 */
incidentLevels: [], // incidentTypes: [],
/** 事故等级 */
incidentLevels: [],
tableName: '',
/** 图片文件 */
image: null,
rules: { rules: {
incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }], incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }],
incidentName: [{ 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: { methods: {
handleRemovePicture() {}, 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> </script>

View File

@ -49,7 +49,7 @@
<!-- 顶部操作按钮 start --> <!-- 顶部操作按钮 start -->
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="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-top-right" @click="handleExport"></el-button>
<el-button icon="el-icon-s-promotion" @click="handleAllExport"></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 icon="el-icon-refresh-left" @click="handleRefresh"></el-button>
@ -76,8 +76,8 @@
<el-table-column label="发生地点" prop="location"/> <el-table-column label="发生地点" prop="location"/>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<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" 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="deleteRow(row.id)"></el-button> <el-button icon="el-icon-view" size="mini" @click="deleteRow(row.id)"></el-button>
</template> </template>
</el-table-column> </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' this.$parent.activeName = 'AddOrEdit'
}, },
// /**
* 删除行数据
*/
deleteRow(id) { deleteRow(id) {
if (id === null || id === '') { if (id === null || id === '') {
this.$message.warning('请选择要删除的行') this.$message.warning('请选择要删除的行')

View File

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