测试完成

hyx_2024-9-25_tongbu
shanao 2024-09-13 17:18:25 +08:00
parent 15a8303e21
commit fdbb4d78da
2 changed files with 41 additions and 32 deletions

View File

@ -30,13 +30,12 @@
<el-date-picker <el-date-picker
:disabled="isDisabled" :disabled="isDisabled"
v-model="infoForm.incidentDate" v-model="infoForm.incidentDate"
type="date" type="datetime"
placeholder="选择事故发生时间" placeholder="选择事故发生时间"
style="width: 100%;" style="width: 100%;"
format="yyyy-MM-dd HH:mm:ss" />
value-format="yyyy-MM-dd HH:mm:ss"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="直接经济损失" prop="directLoss"> <el-form-item :label-width="formLabelWidth" label="直接经济损失(万元)" prop="directLoss">
<el-input v-model="infoForm.directLoss" :disabled="isDisabled" type="number" autocomplete="off"/> <el-input v-model="infoForm.directLoss" :disabled="isDisabled" type="number" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="受伤人数" prop="injured"> <el-form-item :label-width="formLabelWidth" label="受伤人数" prop="injured">
@ -90,11 +89,9 @@
<el-date-picker <el-date-picker
v-model="infoForm.reportDate" v-model="infoForm.reportDate"
:disabled="isDisabled" :disabled="isDisabled"
type="date" type="datetime"
placeholder="请选择报出日期" placeholder="请选择报出日期"
style="width: 100%;" style="width: 100%;"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -162,8 +159,7 @@ export default {
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' }],
HIDDENTYPE: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }], incidentType: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }],
incidentType: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }],
incidentLevel: [{ 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' }],
@ -339,21 +335,26 @@ export default {
* 表单确认按钮 * 表单确认按钮
*/ */
confirm() { confirm() {
const params = { this.$refs.form.validate(valid => {
...this.infoForm, if (!valid) {
photos: this.infoForm.fileList[0].remotePathName return false
} }
delete params.fileList const params = {
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params) ...this.infoForm,
.then((response) => { photos: this.infoForm.fileList[0].remotePathName
// }
this.$message.success(this.tableName + '成功') delete params.fileList
this.infoForm = this.$options.data().infoForm requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
this.$parent.activeName = 'List' .then((response) => {
// eslint-disable-next-line handle-callback-err //
}).catch((error) => { this.$message.success(this.tableName + '成功')
this.$message.error(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 + '失败')
})
})
}, },
/** /**

View File

@ -4,16 +4,16 @@
<el-row :gutter="12"> <el-row :gutter="12">
<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"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="6">
<el-form-item label="发生时间" prop="incidentDates"> <el-form-item label="发生时间" prop="incidentDates">
<el-date-picker <el-date-picker
v-model="searchForm.incidentDates" v-model="searchForm.incidentDates"
:default-time="['00:00:00', '23:59:59']" :default-time="['00:00:00', '23:59:59']"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"
style="width: 100%" style="width: 100%"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
@ -27,14 +27,14 @@
<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="4"> <el-col :span="3">
<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="4"> <el-col :span="3">
<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" />
@ -53,7 +53,6 @@
<el-col :span="24"> <el-col :span="24">
<el-button type="primary" icon="el-icon-circle-plus" @click="goView('', '新增')">新增</el-button> <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 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-button type="danger" icon="el-icon-delete-solid" @click="handleBatchDel"></el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -74,7 +73,11 @@
<el-table-column type="selection" width="55"/> <el-table-column type="selection" width="55"/>
<el-table-column label="事故名称" prop="incidentName"/> <el-table-column label="事故名称" prop="incidentName"/>
<el-table-column label="所属公司" prop="companyName"/> <el-table-column label="所属公司" prop="companyName"/>
<el-table-column label="发生时间" prop="incidentDate"/> <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="发生地点" prop="location"/>
<el-table-column label="操作" width="300"> <el-table-column label="操作" width="300">
<template v-slot="{row}"> <template v-slot="{row}">
@ -96,6 +99,7 @@
<script> <script>
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 { requestFN } from '../../../../utils/request' import { requestFN } from '../../../../utils/request'
export default { export default {
@ -158,7 +162,6 @@ export default {
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]
delete this.searchForm.incidentDates
} }
const url = '/accident/page?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page const url = '/accident/page?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page
requestFN(url, { ...this.searchForm }).then((data) => { requestFN(url, { ...this.searchForm }).then((data) => {
@ -175,6 +178,7 @@ export default {
*/ */
handleReset() { handleReset() {
this.searchForm = this.$options.data().searchForm this.searchForm = this.$options.data().searchForm
this.searchList()
}, },
/** /**
@ -318,6 +322,10 @@ export default {
).then((data) => { ).then((data) => {
this.incidentLevels = JSON.parse(data.zTreeNodes) this.incidentLevels = JSON.parse(data.zTreeNodes)
}) })
},
formatDate(date, format) {
return formatDate(date, format)
} }
} }
} }