epmet pc工作端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

680 lines
20 KiB

4 years ago
<template>
<div class="div_main">
4 years ago
<div ref="div_search" class="div_search">
4 years ago
<el-form :inline="true"
:model="formData"
ref="ref_searchform"
4 years ago
:label-width="'100px'">
4 years ago
<div>
<el-form-item label="姓名"
4 years ago
prop="name">
<el-input v-model="formData.name"
4 years ago
size="small"
class="list_item_width_1"
clearable
placeholder="请输入姓名">
</el-input>
</el-form-item>
4 years ago
<el-form-item label="手机号"
4 years ago
prop="mobile">
<el-input v-model="formData.mobile"
4 years ago
size="small"
class="list_item_width_1"
clearable
placeholder="请输入姓名">
</el-input>
</el-form-item>
<el-form-item label="身份证"
prop="idCard">
<el-input v-model="formData.idCard"
4 years ago
size="small"
class="list_item_width_1"
clearable
placeholder="请输入身份证">
</el-input>
</el-form-item>
4 years ago
</div>
<div>
<el-form-item label="来自地区"
prop="sourceAddressCode">
<el-input v-model="formData.sourceAddressCode"
size="small"
class="list_item_width_1"
clearable
placeholder="请输入姓名">
</el-input>
</el-form-item>
<el-form-item label="来到本地时间"
prop="startDate">
4 years ago
<el-date-picker v-model="timeRange"
size="small"
type="daterange"
value-format="yyyy-MM-dd"
@change="handleScheduledTimeChange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间">
</el-date-picker>
</el-form-item>
<el-button style="margin-left:30px"
size="small"
class="diy-button--search"
@click="handleSearch">查询</el-button>
<el-button style="margin-left:10px"
size="small"
class="diy-button--reset"
@click="resetSearch">重置</el-button>
</div>
</el-form>
</div>
<div class="div_table">
<div class="div_btn">
<el-button class="diy-button--add"
size="small"
@click="handleAdd">新增</el-button>
4 years ago
<el-button
4 years ago
class="diy-button--export"
size="small"
@click="handleExportModule">下载模板</el-button>
<el-upload ref="upload"
:multiple='false'
:show-file-list='false'
:before-upload="beforeUpload"
action=""
accept=".xls,.xlsx"
:limit="1"
:on-exceed="handleExceed"
4 years ago
:http-request="uploadHttpRequest">
<el-button size="small"
style="margin-left: 10px"
class="diy-button--delete"
:loading="importLoading">{{importBtnTitle}}</el-button>
4 years ago
</el-upload>
4 years ago
<el-button style="margin-left:10px"
4 years ago
class="diy-button--reset"
size="small"
4 years ago
:loading="exportBtn"
@click="handleExport">{{ exportBtnTitle }}</el-button>
4 years ago
</div>
<el-table class="table"
:data="tableData"
border
:height="tableHeight"
v-loading="tableLoading"
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
style="width: 100%">
<el-table-column label="序号"
header-align="center"
align="center"
type="index"
width="50"></el-table-column>
4 years ago
<el-table-column prop="name"
4 years ago
header-align="center"
align="center"
label="姓名"
4 years ago
width="100">
4 years ago
</el-table-column>
<el-table-column prop="mobile"
header-align="center"
align="center"
label="手机号"
4 years ago
width="120">
4 years ago
</el-table-column>
4 years ago
<el-table-column prop="idCard"
4 years ago
header-align="center"
align="center"
label="身份证"
4 years ago
width="180">
</el-table-column>
4 years ago
<el-table-column prop="detailAddress"
4 years ago
header-align="center"
align="center"
label="现居地"
show-overflow-tooltip
min-width="160">
</el-table-column>
4 years ago
<el-table-column prop="sourceAddress"
4 years ago
header-align="center"
align="center"
label="来自地区"
show-overflow-tooltip
min-width="160">
</el-table-column>
4 years ago
<el-table-column prop="arriveDate"
4 years ago
header-align="center"
align="center"
label="来到本地时间"
width="160">
4 years ago
</el-table-column>
4 years ago
<el-table-column prop="leaveDate"
4 years ago
header-align="center"
align="center"
4 years ago
label="离开本地时间"
width="160">
4 years ago
</el-table-column>
4 years ago
<el-table-column prop="latestNoticeTime"
4 years ago
header-align="center"
align="center"
4 years ago
label="最近一次通知时间"
width="160">
4 years ago
</el-table-column>
4 years ago
<el-table-column prop="remark"
4 years ago
header-align="center"
align="center"
show-overflow-tooltip
4 years ago
label="备注"
min-width="120">
</el-table-column>
4 years ago
<el-table-column prop="heSuanCheckDesc"
4 years ago
header-align="center"
align="center"
label="核酸检测关注名单"
width="160">
4 years ago
</el-table-column>
<el-table-column label="操作"
fixed="right"
width="140"
header-align="center"
align="center"
class="operate">
<template slot-scope="scope">
<el-button type="text"
class="div-table-button--detail"
size="small"
@click="handleDetail(scope.row)">查看</el-button>
<el-button type="text"
class="div-table-button--edit"
size="small"
@click="handleEdit(scope.row)">修改</el-button>
<el-button type="text"
class="div-table-button--delete--noline "
size="small"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div>
<el-pagination @size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="pageSize"
layout="sizes, prev, pager, next, total"
:total="total">
</el-pagination>
</div>
</div>
<!-- 修改弹出框 -->
<el-dialog :visible.sync="formShow"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="diaClose">
4 years ago
<travel-form v-if="formShow" ref="ref_form"
4 years ago
@dialogCancle="addFormCancle"
4 years ago
@dialogOk="addFormOk"></travel-form>
4 years ago
</el-dialog>
</div>
</template>
<script>
4 years ago
import travelForm from './travelForm'
4 years ago
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
let loading // 加载动画
export default {
data () {
return {
4 years ago
exportBtn: false,
exportBtnTitle: '导出',
importBtnTitle: '导入',
importLoading: false,
4 years ago
loading: false,
total: 0,
4 years ago
pageSize: 20,
4 years ago
pageNo: 0,
tableLoading: false,
4 years ago
sHeight: 0,
4 years ago
agencyId: '',
timeRange: [],
formData: {
4 years ago
name: '',//负责人
4 years ago
mobile: '',//联系电话
4 years ago
idCard: '',
sourceAddressCode: '',
startDate: '',
endDate: ''
4 years ago
},
tableData: [],
//form相关
formShow: false,
formTitle: '新增',
}
},
components: {
4 years ago
travelForm
4 years ago
},
async created () {
},
async mounted () {
//获取场所类型
const { user } = this.$store.state
this.agencyId = user.agencyId
await this.loadTable()
4 years ago
this.sHeight = this.$refs.div_search.offsetHeight + 270
4 years ago
},
methods: {
handleSearch () {
this.loadTable()
},
async loadTable () {
this.tableLoading = true
4 years ago
const url = "/epmetuser/tripreport/page"
4 years ago
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placeorg/getlist"
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
...this.formData
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.total = data.total
this.tableData = data.list
4 years ago
// this.tableData.forEach(item => {
// if (item.time) {
// let timeArray = item.time.split(' ')
// item.time = timeArray[0]
// }
4 years ago
4 years ago
// });
4 years ago
} else {
this.$message.error(msg)
}
this.tableLoading = false
},
handleScheduledTimeChange (time) {
if (time) {
4 years ago
this.formData.startDate = time[0]
this.formData.endDate = time[1]
4 years ago
} else {
4 years ago
this.formData.startDate = ''
this.formData.endDate = ''
4 years ago
}
},
diaClose () {
4 years ago
// this.$refs.ref_form.resetData()
4 years ago
this.formShow = false
},
handleDetail (row) {
this.formTitle = '详情'
this.formShow = true
this.$nextTick(() => {
4 years ago
this.$refs.ref_form.initForm('detail', row)
4 years ago
})
},
handleAdd () {
this.formTitle = '新增'
this.formShow = true
this.$nextTick(() => {
4 years ago
this.$refs.ref_form.initForm('add', '')
4 years ago
})
},
handleEdit (row) {
this.formTitle = '修改'
this.formShow = true
this.$nextTick(() => {
4 years ago
this.$refs.ref_form.initForm('edit', row)
4 years ago
})
},
addFormCancle () {
this.formShow = false
},
addFormOk () {
this.formShow = false
this.loadTable()
},
async handleDelete (row) {
this.$confirm("确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.deleteNat(row)
})
.catch(err => {
if (err == "cancel") {
}
});
},
async deleteNat (row) {
4 years ago
const url = "/epmetuser/tripreport/delete"
4 years ago
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteam/del"
4 years ago
let params = [row.id]
4 years ago
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.$message({
type: "success",
message: "删除成功"
});
this.loadTable()
} else {
this.$message.error(msg)
}
},
//重置搜索条件
resetSearch () {
4 years ago
this.$refs.ref_searchform.resetFields()
this.formData.startDate = ''
this.formData.endDate = ''
this.timeRange = []
4 years ago
this.pageSize = 20
4 years ago
this.pageNo = 1
4 years ago
this.loadTable()
},
handleSizeChange (val) {
this.pageSize = val
this.pageNo = 1
this.loadTable()
},
handleCurrentChange (val) {
this.pageNo = val
this.loadTable()
},
//导出表格
async handleExport () {
4 years ago
this.exportBtn = true
this.exportBtnTitle = '正在导出...'
4 years ago
let params = {
4 years ago
...this.formData
4 years ago
}
4 years ago
// .post('epmetuser/icresiuser/exportExcel', params)
// await axios({
// url: window.SITE_CONFIG['apiURL'] + '/epmetuser/tripreport/export',
// // url: 'epmetuser/icresiuser/exportExcel',
// method: 'post',
// data: params,
// responseType: 'blob'
// })
await this.$http({
method: 'POST',
url: '/epmetuser/tripreport/export',
responseType: 'blob',
data: params
})
.then(res => {
console.log('resllll', res)
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName)
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download', fileName)
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象
})
.catch((err) => {
console.log('获取导出情失败', err)
this.$message.error('获取导出失败')
})
this.exportBtnTitle = '导出'
this.exportBtn = false
4 years ago
},
// 下载文件
download (data, fileName) {
if (!data) {
return
}
var csvData = new Blob([data])
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(csvData, fileName);
}
// for Non-IE (chrome, firefox etc.)
else {
var a = document.createElement('a');
document.body.appendChild(a);
a.style = 'display: none';
var url = window.URL.createObjectURL(csvData);
a.href = url;
a.download = fileName;
a.click();
a.remove();
window.URL.revokeObjectURL(url);
}
},
4 years ago
async handleExportModule () {
4 years ago
let title = ''
title = '房屋模板'
4 years ago
const url = "/epmetuser/tripreport/template-download"
4 years ago
let params = {}
4 years ago
await this.$http({
method: 'POST',
4 years ago
url,
4 years ago
responseType: 'blob',
data: params
})
.then(res => {
console.log('res----dddd', res)
// this.download(res.data, title + '.xls')
if (res.headers["content-disposition"]) {
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName)
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download', fileName)
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象
} else this.$message.error('下载失败')
})
.catch(err => {
console.log('err', err)
return this.$message.error('网络错误')
})
4 years ago
},
// 上传文件之前的钩子
beforeUpload (file) {
this.files = file;
const isText = file.type === 'application/vnd.ms-excel'
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
if (!isText && !isTextComputer) {
this.$message.error('请选择正确格式的文件')
return false
} else {
this.fileName = file.name;
return true
}
},
// 上传文件个数超过定义的数量
handleExceed (files, fileList) {
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
},
4 years ago
async uploadHttpRequest (file) {
this.importLoading = true
this.importBtnTitle = '正在上传中...'
this.$message({
showClose: true,
message: '导入中,请到系统管理-导入记录中查看进度',
duration: 0
})
const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加
formData.append('file', file.file) //添加文件对象
await this.$http
.post('/epmetuser/tripreport/import', formData).then(res => {
console.log('res-up', res)
if (res.data.code == 0 && res.data.msg == 'success') {
// this.$message.success('导入成功')
this.loadTable()
} else this.$message.error(res.data.msg)
}).catch(err => {
console.log('失败', err)
file.onError() //上传失败的文件会从文件列表中删除
// this.$message.error('导入失败')
})
this.importLoading = false
this.importBtnTitle = '导入'
this.$refs.upload.clearFiles()
},
4 years ago
async uploadFile () {
if (this.fileName == "") {
this.$message.warning('请选择要上传的文件!')
return false
}
this.$message({
showClose: true,
message: '导入中,请到系统管理-导入记录中查看进度',
duration: 0
})
//清空上传列表
this.$refs['upload'].clearFiles()
var url = '/gov/org/house/houseimport'
let fileFormData = new FormData();
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
this.importRoomLoading = true
window.app.ajax.post2(url, fileFormData,
(data, rspMsg) => {
if (data.code === 0 && data.msg == 'success') {
// this.$message.success('导入成功')
} else {
// this.$message({
// showClose: true,
// message: rspMsg,
// duration: 0,
// type: "error"
// })
// this.$message.error(rspMsg)
}
this.$emit('refreshTree')
this.loadTable()
this.importRoomLoading = false
},
(rspMsg, data) => {
this.importRoomLoading = false
}, { headers: { 'Content-Type': 'multipart/form-data' } })
}
},
computed: {
tableHeight () {
4 years ago
const h = this.clientHeight - this.sHeight + this.iframeHeigh
const _h = this.clientHeight - this.sHeight
return this.$store.state.inIframe ? h : _h
4 years ago
},
4 years ago
...mapGetters(['clientHeight', 'iframeHeight'])
4 years ago
},
watch: {
},
props: {
}
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/management/epidemic.scss";
</style>