完成测试

hyx_2024-9-29_tongbu
shanao 2024-09-13 17:50:44 +08:00
parent ce9d974e99
commit 4fb73fab50
3 changed files with 21 additions and 9 deletions

View File

@ -55,8 +55,8 @@
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="photos"> <el-form-item :label-width="formLabelWidth" label="事故照片" prop="photos">
<el-image <el-image
:src="config.fileUrl+infoForm.photos" :src="image(infoForm.photos, true)"
:preview-src-list="[config.fileUrl+infoForm.photos]" :preview-src-list="image(infoForm.photos,false)"
style="width: 100px; height: 100px"/> style="width: 100px; height: 100px"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定" prop="analysis"> <el-form-item :label-width="formLabelWidth" label="原因分析及责任认定" prop="analysis">
@ -206,6 +206,9 @@ export default {
).then((data) => { ).then((data) => {
this.incidentLevels = JSON.parse(data.zTreeNodes) this.incidentLevels = JSON.parse(data.zTreeNodes)
}) })
},
image(url, flag) {
return flag ? config.fileUrl + url : [config.fileUrl + url]
} }
} }
} }

View File

@ -4,7 +4,7 @@
<el-row :gutter="24"> <el-row :gutter="24">
<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="5"> <el-col :span="5">
@ -13,7 +13,7 @@
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="-"
@ -64,12 +64,15 @@
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
> >
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="事故名称" prop="incidentName"/> <el-table-column align="center" label="事故名称" prop="incidentName"/>
<el-table-column align="center" label="所属公司" prop="companyName"/> <el-table-column align="center" label="所属公司" prop="companyName"/>
<el-table-column align="center" label="发生时间" prop="incidentDate"/> <el-table-column align="center" label="发生时间" prop="incidentDate">
<template v-slot="{row}">
{{ formatDate(row.incidentDate,'YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column align="center" label="发生地点" prop="location"/> <el-table-column align="center" label="发生地点" prop="location"/>
<el-table-column align="center" label="操作" width="300"> <el-table-column align="center" 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>
</template> </template>
@ -87,6 +90,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 {
@ -147,7 +151,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, corpInfoId: this.$parent.corpInfoId }).then((data) => { requestFN(url, { ...this.searchForm, corpInfoId: this.$parent.corpInfoId }).then((data) => {
@ -164,6 +167,7 @@ export default {
*/ */
handleReset() { handleReset() {
this.searchForm = this.$options.data().searchForm this.searchForm = this.$options.data().searchForm
this.searchList()
}, },
/** /**
@ -209,6 +213,10 @@ export default {
this.handleResetInitForm() this.handleResetInitForm()
this.$parent.activeName = 'ListCount' this.$parent.activeName = 'ListCount'
this.$parent.corpInfoId = '' this.$parent.corpInfoId = ''
},
formatDate(date, format) {
return formatDate(date, format)
} }
} }
} }

View File

@ -4,7 +4,7 @@
<el-row :gutter="12"> <el-row :gutter="12">
<el-col :span="5"> <el-col :span="5">
<el-form-item label="企业名称" prop="corpInfoId"> <el-form-item label="企业名称" prop="corpInfoId">
<el-select v-model="corpInfoId" placeholder="请选择"> <el-select v-model="corpInfoId" filterable placeholder="请选择">
<el-option v-for="item in corpinfos" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in corpinfos" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -120,6 +120,7 @@ export default {
*/ */
handleReset() { handleReset() {
this.corpInfoId = this.$options.data().corpInfoId this.corpInfoId = this.$options.data().corpInfoId
this.searchList()
}, },
/** /**