修复导出相关问题

hyx_2024-9-25_tongbu
shanao 2024-09-10 14:09:40 +08:00
parent a116151652
commit 164f70a0a4
2 changed files with 1 additions and 470 deletions

View File

@ -241,7 +241,7 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.listLoading = false this.listLoading = false
window.open(config.httpurl + '/export/excel') window.location.href = config.httpurl + '/accident/export/excel'
}).catch(() => { }).catch(() => {
this.listLoading = false this.listLoading = false
}) })

View File

@ -1,469 +0,0 @@
<0template>
<div class="app-container">
<el-form ref="searchForm" :model="searchForm" label-width="100px">
<el-row :gutter="12">
<el-col :span="4">
<el-form-item label="事故名称" prop="incidentName">
<el-input v-model="searchForm.incidentName" placeholder="请输入隐患描述" class="filter-item"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="发生时间" prop="incidentDates">
<el-date-picker
v-model="searchForm.incidentDates"
value-format="yyyy-MM-dd"
style="width: 100%"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="发生地点" prop="location">
<el-input v-model="searchForm.location" placeholder="请输入关键字" class="filter-item"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="事故类型" prop="incidentType">
<el-select v-model="searchForm.incidentType" placeholder="请选择">
<el-option v-for="item in incidentTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="事故等级" prop="incidentLevel">
<el-select v-model="searchForm.incidentLevel" placeholder="请选择">
<el-option v-for="item in incidentLevels" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getList">
查询
</el-button>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-refresh" @click="reset">
重置
</el-button>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-refresh" @click="changeDialog('添加')">
添加
</el-button>
<el-button v-waves class="filter-item" type="danger" icon="el-icon-delete" @click="deleteInBulk">
批量删除
</el-button>
<!-- <el-button v-waves class="filter-item" type="warning" icon="el-icon-star-off" @click="chongzhi">-->
<!-- 导出-->
<!-- </el-button>-->
<!-- <el-button v-waves class="filter-item" type="warning" icon="el-icon-star-off" @click="chongzhi">-->
<!-- 导出全部-->
<!-- </el-button>-->
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="getList">
刷新
</el-button>
</el-col>
</el-row>
</el-form>
<el-table
v-loading="listLoading"
ref="multipleTable"
:data="varList"
border
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"/>
<el-table-column label="事故名称" prop="incidentName"/>
<el-table-column label="所属公司" prop="companyName"/>
<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="操作" width="100">
<template v-slot="{row}">
<el-button v-show="edit" icon="el-icon-view" size="mini" @click="goView(row.id)"></el-button>
<el-button v-show="edit" icon="el-icon-view" size="mini" @click="changeDialog('修改',row.id)"></el-button>
<el-button v-show="del" icon="el-icon-view" size="mini" @click="deleteRow(row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<div class="page-btn-group">
<div/>
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList"/>
</div>
<el-dialog :visible.sync="dialogFormVisible" :title="dialogTitle">
<el-form :model="infoForm">
<el-form-item :label-width="formLabelWidth" label="事故案号">
<el-input v-model="infoForm.incidentNumber" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故名称">
<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>
</el-form-item>
<!-- <el-form-item :label-width="formLabelWidth" label="所属公司">-->
<!-- <el-select v-model="form.region" placeholder="请选择">-->
<!-- <el-option label="区域一" value="shanghai"/>-->
<!-- <el-option label="区域二" value="beijing"/>-->
<!-- </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-select>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故发生地点">
<el-input v-model="infoForm.location" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故发生时间">
<el-date-picker
v-model="infoForm.incidentDate"
type="date"
placeholder="选择日期"
style="width: 100%;"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd HH:mm:ss"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="直接经济损失">
<el-input v-model="infoForm.directLoss" type="number" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="受伤人数">
<el-input v-model="infoForm.injured" type="number" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="死亡人数">
<el-input v-model="infoForm.fatalities" type="number" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="重伤人数">
<el-input v-model="infoForm.seriouslyInjured" type="number" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故起因">
<el-input v-model="infoForm.cause" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="事故概述">
<el-input v-model="infoForm.summary" autocomplete="off"/>
</el-form-item>
<!-- TODO 图片
<el-form-item :label-width="formLabelWidth" label="事故照片">-->
<!-- <el-upload-->
<!-- action="https://jsonplaceholder.typicode.com/posts/"-->
<!-- list-type="picture-card"-->
<!-- !multiple-->
<!-- limit="1">-->
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
<el-form-item :label-width="formLabelWidth" label="原因分析及责任认定">
<el-input v-model="infoForm.analysis" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="考核建议">
<el-input v-model="infoForm.suggestions" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="整改措施">
<el-input v-model="infoForm.measures" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="填表人">
<el-input v-model="infoForm.creator" autocomplete="off"/>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="报出日期">
<el-date-picker
v-model="infoForm.reportDate"
type="date"
placeholder="选择日期"
style="width: 100%;"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd HH:mm:ss"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="saveOrUpdate"> </el-button>
</div>
</el-dialog>
</div>
</0template>
<script>
import Pagination from '@/components/Pagination'
import waves from '@/directive/waves'
import { requestFN } from '@/utils/request'
import SelectTree from '@/components/SelectTree'
import formatDate from '@/utils/dateformat'
export default {
components: { Pagination, SelectTree },
directives: { waves },
data() {
return {
listLoading: true,
add: false,
del: false,
edit: false,
dialogFormVisible: false,
listQuery: {
page: 1,
limit: 20
},
total: 0,
varList: [],
hiddenPartList: [], //
incidentLevels: [], //
multipleSelection: [], //
formLabelWidth: '120px',
dialogTitle: '',
searchForm: {
incidentName: '',
incidentDates: [],
location: '',
incidentLevel: '',
incidentType: ''
},
infoForm: {
id: '', // ID
incidentNumber: '', //
incidentName: '', //
incidentType: null, //
companyName: '', //
incidentLevel: '', //
incidentNature: '', //
location: '', //
incidentDate: null, //
directLoss: '', //
injured: null, //
fatalities: null, //
seriouslyInjured: null, //
cause: '', //
summary: '', //
photos: '', //
analysis: '', //
suggestions: '', //
measures: '', //
creator: '', //
reportDate: null //
}
}
},
created() {
this.getDict()
this.getList()
},
methods: {
//
getList() {
this.listLoading = true
const url = '/accident/page?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page
requestFN(url, { ...this.searchForm }).then((data) => {
this.listLoading = false
this.varList = data.varList
this.total = data.page.totalResult
this.hasButton()
}).catch((e) => {
this.listLoading = false
})
},
//
reset() {
this.searchForm = this.$options.data().searchForm
this.getList()
this.toggleSelection()
},
//
deleteInBulk() {
//
const selectedRows = this.multipleSelection
//
if (selectedRows.length === 0) {
this.$message.warning('请选择要删除的行')
return
}
//
this.$confirm('确定要删除这些记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// ID
const ids = selectedRows.map(row => row.id).join(',')
//
const url = '/accident/delete/' + '' + ids
requestFN(url).then((response) => {
//
this.$message.success('删除成功')
this.getList() //
// eslint-disable-next-line handle-callback-err
}).catch((error) => {
this.$message.error('删除失败')
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
this.getList()
},
//
deleteRow(id) {
if (id === null || id === '') {
this.$message.warning('请选择要删除的行')
return
}
//
this.$confirm('确定要删除这调记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
const url = '/accident/delete/' + '' + id
requestFN(url).then((response) => {
//
this.$message.success('删除成功')
this.getList() //
// eslint-disable-next-line handle-callback-err
}).catch((error) => {
this.$message.error('删除失败')
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
this.getList()
},
//
handleSelectionChange(val) {
this.multipleSelection.push(val)
},
//
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else {
this.$refs.multipleTable.clearSelection()
}
},
// TODO
hasButton() {
var keys = 'hidden:add,hidden:del,hidden:edit,toExcel'
requestFN(
'/head/hasButton',
{
keys: keys
}
).then((data) => {
this.add = data.hiddenfhadminadd
this.del = data.hiddenfhadmindel
this.edit = data.hiddenfhadminedit
}).catch((e) => {
this.listLoading = false
})
},
//
getDict() {
requestFN(
'dictionaries/listSelectTree?tm=' + new Date().getTime(),
{
DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'
}
).then((data) => {
this.hiddenlevelList = JSON.parse(data.zTreeNodes)
console.info(this.hiddenlevelList)
}).catch((e) => {
this.listLoading = false
})
requestFN(
'/dictionaries/listSelectTree',
{
DICTIONARIES_ID: '3babc15144444bdc8d763d0af2bdfff6'
}
).then((data) => {
this.hiddenTypeList = JSON.parse(data.zTreeNodes)
})
requestFN(
'/dictionaries/listSelectTree',
{
DICTIONARIES_ID: '18c0a9aea6e54feab9f4ab3f46e0bc86'
}
).then((data) => {
this.hiddenType2List = JSON.parse(data.zTreeNodes)
})
//
requestFN(
'/hiddenRegion/listAll'
).then((data) => {
console.log(data)
this.hiddenPartList = JSON.parse(data.zTreeNodes)
}).catch((e) => {
this.listLoading = false
})
},
//
changeDialog(title, id) {
this.dialogFormVisible = true
this.dialogTitle = title
if (title === '修改') {
requestFN('/accident/' + id, {}).then((data) => {
this.infoForm = data.info
}).catch((e) => {
this.listLoading = false
})
}
},
//
saveOrUpdate() {
requestFN('/accident' + (this.dialogTitle === '修改' ? '/update' : '/save'), this.infoForm)
.then((response) => {
//
this.$message.success(this.dialogTitle + '成功')
this.getList() //
this.infoForm = this.$options.data().infoForm
// eslint-disable-next-line handle-callback-err
}).catch((error) => {
this.$message.error(this.dialogTitle + '失败')
})
},
goView(id) {
this.$parent.activeName = 'Detail'
this.$parent.hiddenId = id
},
formatDate(date, format) {
return formatDate(date, format)
}
}
}
</script>
<style lang="scss" scoped>
</style>