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.
976 lines
30 KiB
976 lines
30 KiB
<template>
|
|
<div class="div_main">
|
|
<div ref="div_search" class="div_search">
|
|
<el-form :inline="true"
|
|
:model="formData"
|
|
ref="ref_searchform"
|
|
:label-width="'100px'">
|
|
<div>
|
|
|
|
<el-form-item label="姓名"
|
|
prop="name">
|
|
<el-input v-model="formData.name"
|
|
size="small"
|
|
class="list_item_width_1"
|
|
clearable
|
|
placeholder="请输入姓名">
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
<el-form-item label="手机号"
|
|
prop="mobile">
|
|
<el-input v-model="formData.mobile"
|
|
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"
|
|
size="small"
|
|
class="list_item_width_1"
|
|
clearable
|
|
placeholder="请输入身份证">
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</div>
|
|
<div>
|
|
|
|
<el-form-item label="来自地区"
|
|
prop="sourceAddress">
|
|
<el-input v-model="formData.sourceAddress"
|
|
size="small"
|
|
class="list_item_width_1"
|
|
clearable
|
|
placeholder="请输入地区">
|
|
</el-input>
|
|
<!-- <el-cascader ref="nowArea" size="small" class="list_item_width_1" :props="areaProps"
|
|
v-model="searchAreacode" clearable @change="handleAreaChange"></el-cascader> -->
|
|
</el-form-item>
|
|
|
|
<el-form-item label="来到本地时间"
|
|
prop="startDate">
|
|
<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>
|
|
|
|
<el-button
|
|
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"
|
|
:http-request="uploadHttpRequest">
|
|
<el-button size="small"
|
|
style="margin-left: 10px"
|
|
class="diy-button--delete"
|
|
:loading="importLoading">{{importBtnTitle}}</el-button>
|
|
</el-upload>
|
|
|
|
<el-button style="margin-left:10px"
|
|
class="diy-button--reset"
|
|
size="small"
|
|
:loading="exportBtn"
|
|
@click="handleExport">{{ exportBtnTitle }}</el-button>
|
|
<el-button style="margin-left:15px"
|
|
class="diy-button--more"
|
|
size="small"
|
|
@click="handleSendNotice">发送通知</el-button>
|
|
<el-button style="margin-left:15px"
|
|
class="diy-button--more"
|
|
size="small"
|
|
@click="handleAttention">加入核酸检测关注</el-button>
|
|
<el-button style="margin-left:15px"
|
|
class="diy-button--more"
|
|
size="small"
|
|
@click="handleDeletes">取消核酸检测关注</el-button>
|
|
</div>
|
|
|
|
<el-table class="table"
|
|
:data="tableData"
|
|
border
|
|
:height="tableHeight"
|
|
v-loading="tableLoading"
|
|
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
|
|
style="width: 100%"
|
|
@selection-change="handleSelectionChange">
|
|
<el-table-column type="selection"
|
|
width="55" fixed="left"></el-table-column>
|
|
<el-table-column label="序号"
|
|
header-align="center"
|
|
align="center"
|
|
type="index"
|
|
width="50" fixed="left"></el-table-column>
|
|
|
|
<el-table-column prop="name"
|
|
header-align="center"
|
|
align="center"
|
|
label="姓名"
|
|
width="100" fixed="left">
|
|
</el-table-column>
|
|
<el-table-column prop="mobile"
|
|
header-align="center"
|
|
align="center"
|
|
label="手机号"
|
|
width="120">
|
|
</el-table-column>
|
|
<el-table-column prop="idCard"
|
|
header-align="center"
|
|
align="center"
|
|
label="身份证"
|
|
width="180">
|
|
</el-table-column>
|
|
<el-table-column prop="detailAddress"
|
|
header-align="center"
|
|
align="center"
|
|
label="现居地"
|
|
show-overflow-tooltip
|
|
min-width="160">
|
|
<template slot-scope="scope">
|
|
{{scope.row.presentAddress + scope.row.detailAddress}}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="sourceAddress"
|
|
header-align="center"
|
|
align="center"
|
|
label="来自地区"
|
|
show-overflow-tooltip
|
|
min-width="180">
|
|
</el-table-column>
|
|
<el-table-column prop="arriveDate"
|
|
header-align="center"
|
|
align="center"
|
|
label="来到本地时间"
|
|
width="160">
|
|
</el-table-column>
|
|
<el-table-column prop="leaveDate"
|
|
header-align="center"
|
|
align="center"
|
|
label="离开本地时间"
|
|
width="160">
|
|
</el-table-column>
|
|
<el-table-column prop="latestNoticeTime"
|
|
header-align="center"
|
|
align="center"
|
|
label="最近一次通知时间"
|
|
width="160">
|
|
</el-table-column>
|
|
<el-table-column prop="remark"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="备注"
|
|
min-width="120">
|
|
</el-table-column>
|
|
<el-table-column prop="heSuanCheckDesc"
|
|
header-align="center"
|
|
align="center"
|
|
label="核酸检测关注名单"
|
|
width="160">
|
|
</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>
|
|
<!-- v-if="scope.row.userType != 'resi'" -->
|
|
<el-button type="text"
|
|
class="div-table-button--edit"
|
|
size="small"
|
|
@click="handleEdit(scope.row)">修改</el-button>
|
|
|
|
<!-- <el-popover popper-class="btn-popper"
|
|
placement="bottom"
|
|
style="margin-left:10px"
|
|
width="20"
|
|
trigger="click">
|
|
<div class="table-more-btn">
|
|
<el-button type="text"
|
|
class="div-table-button--detail--noline"
|
|
size="small"
|
|
@click="handleNoticeList(scope.row)">通知记录</el-button>
|
|
</div>
|
|
|
|
<div class="table-more-btn">
|
|
<el-button type="text"
|
|
class="div-table-button--detail--noline"
|
|
size="small"
|
|
@click="handleVisiteList(scope.row) ">随访记录</el-button>
|
|
</div>
|
|
<div v-if="scope.row.userType != 'resi'" class="table-more-btn">
|
|
<el-button type="text"
|
|
class="div-table-button--delete--noline "
|
|
size="small"
|
|
@click="handleDelete(scope.row)">删除</el-button>
|
|
</div>
|
|
|
|
<el-button type="text"
|
|
size="small"
|
|
class="div-table-button--more"
|
|
slot="reference">更多<i class="el-icon-caret-bottom"></i></el-button>
|
|
</el-popover> -->
|
|
<el-dropdown trigger="hover">
|
|
<span class="el-dropdown-link" style="margin-left:10px;">
|
|
<el-button type="text"
|
|
size="small"
|
|
class="div-table-button--more"
|
|
slot="reference">更多<i class="el-icon-caret-bottom"></i></el-button>
|
|
</span>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item>
|
|
<el-button type="text"
|
|
class="div-table-button--detail--noline"
|
|
size="small"
|
|
@click="handleNoticeList(scope.row)">通知记录</el-button>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item>
|
|
<el-button type="text"
|
|
class="div-table-button--detail--noline"
|
|
size="small"
|
|
@click="handleVisiteList(scope.row) ">随访记录</el-button>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item>
|
|
<el-button type="text"
|
|
class="div-table-button--delete--noline "
|
|
size="small"
|
|
@click="handleDelete(scope.row)">删除</el-button>
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
|
|
</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">
|
|
<travel-form v-if="formShow" ref="ref_form"
|
|
@dialogCancle="addFormCancle"
|
|
@dialogOk="addFormOk"></travel-form>
|
|
</el-dialog>
|
|
<!-- 发送通知弹出框 -->
|
|
<el-dialog :visible.sync="sendNoticeFormShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
title="发送通知"
|
|
width="1050px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="diaClose">
|
|
<nf-send-notice ref="ref_sendnotice"
|
|
@dialogCancle="diaClose"></nf-send-notice>
|
|
</el-dialog>
|
|
<!-- 通知记录弹出框 -->
|
|
<el-dialog :visible.sync="noticeListFormShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
title="通知记录"
|
|
width="1050px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="diaClose">
|
|
<nf-notice-list ref="ref_noticelist"
|
|
@dialogCancle="diaClose"></nf-notice-list>
|
|
</el-dialog>
|
|
<!-- 随访记录弹出框 -->
|
|
<el-dialog :visible.sync="visiteListFormShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
title="随访记录"
|
|
width="1050px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="diaClose">
|
|
<nf-visite-list ref="ref_visitelist"
|
|
@dialogCancle="diaClose"></nf-visite-list>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import travelForm from './travelForm'
|
|
import nfNoticeList from './natFocus/nfNoticeList'
|
|
import nfSendNotice from './natFocus/nfSendNotice'
|
|
import nfVisiteList from './natFocus/nfVisiteList'
|
|
|
|
import { requestPost } from "@/js/dai/request";
|
|
import { mapGetters } from 'vuex'
|
|
|
|
let loading // 加载动画
|
|
export default {
|
|
data () {
|
|
return {
|
|
sendNoticeFormShow: false,
|
|
visiteListFormShow: false,
|
|
noticeListFormShow: false,
|
|
exportBtn: false,
|
|
exportBtnTitle: '导出',
|
|
importBtnTitle: '导入',
|
|
importLoading: false,
|
|
loading: false,
|
|
total: 0,
|
|
pageSize: 20,
|
|
pageNo: 0,
|
|
tableLoading: false,
|
|
sHeight: 0,
|
|
searchAreacode: [],
|
|
agencyId: '',
|
|
selectionAll: [],
|
|
timeRange: [],
|
|
formData: {
|
|
name: '',//负责人
|
|
mobile: '',//联系电话
|
|
idCard: '',
|
|
sourceAddress: '',
|
|
sourceAddressCode: '',
|
|
startDate: '',
|
|
endDate: ''
|
|
},
|
|
|
|
tableData: [],
|
|
|
|
//form相关
|
|
formShow: false,
|
|
formTitle: '新增',
|
|
areaProps: {
|
|
lazy: true,
|
|
checkStrictly: true,
|
|
lazyLoad: this.lzayLoadArea
|
|
}
|
|
|
|
}
|
|
},
|
|
components: {
|
|
travelForm,
|
|
nfNoticeList,
|
|
nfSendNotice,
|
|
nfVisiteList
|
|
},
|
|
async created () {
|
|
|
|
},
|
|
async mounted () {
|
|
//获取场所类型
|
|
|
|
|
|
const { user } = this.$store.state
|
|
console.log('user-----', user)
|
|
this.agencyId = user.agencyId
|
|
|
|
|
|
await this.loadTable()
|
|
this.sHeight = this.$refs.div_search.offsetHeight + 270
|
|
},
|
|
|
|
methods: {
|
|
lzayLoadArea(node, resolve) {
|
|
this.getArea(node, resolve)
|
|
// setTimeout(() => {
|
|
|
|
// }, 1000)
|
|
},
|
|
handleSearch () {
|
|
this.loadTable()
|
|
},
|
|
|
|
handleSelectionChange(val) {
|
|
console.log('val----', val)
|
|
this.selectionAll = val
|
|
},
|
|
async getArea (node, resolve) {
|
|
|
|
const url = "/commonservice/areacode/nextarea"
|
|
let params = {
|
|
parentLevel: node.data ? node.data.level : '',
|
|
parentAreaCode: node.data ? node.data.code : ''
|
|
}
|
|
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
|
|
if (code === 0) {
|
|
const nodes = data.map(item => ({
|
|
value: item.areaCode, //
|
|
label: item.areaName,
|
|
code: item.areaCode,
|
|
level: item.level,
|
|
leaf: node.level >= 4 // 5层级
|
|
}))
|
|
resolve(nodes)
|
|
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
|
|
},
|
|
async loadTable () {
|
|
this.tableLoading = true
|
|
|
|
const url = "/epmetuser/tripreport/page"
|
|
// 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
|
|
|
|
// this.tableData.forEach(item => {
|
|
// if (item.time) {
|
|
// let timeArray = item.time.split(' ')
|
|
// item.time = timeArray[0]
|
|
// }
|
|
|
|
// });
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
this.tableLoading = false
|
|
},
|
|
handleAreaChange(val) {
|
|
|
|
if (val.length > 0) {
|
|
const len = val.length - 1
|
|
this.formData.sourceAddressCode = val[len]
|
|
} else this.formData.sourceAddressCode = ''
|
|
},
|
|
handleScheduledTimeChange (time) {
|
|
if (time) {
|
|
this.formData.startDate = time[0]
|
|
this.formData.endDate = time[1]
|
|
|
|
} else {
|
|
this.formData.startDate = ''
|
|
this.formData.endDate = ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
diaClose () {
|
|
// this.$refs.ref_form.resetData()
|
|
this.formShow = false
|
|
this.sendNoticeFormShow = false
|
|
this.noticeListFormShow = false
|
|
this.visiteListFormShow = false
|
|
},
|
|
handleNoticeList (row) {
|
|
this.noticeListFormShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_noticelist.initTable(row.idCard, '0')
|
|
})
|
|
|
|
},
|
|
handleVisiteList (row) {
|
|
|
|
this.visiteListFormShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_visitelist.initTable(row, '0')
|
|
|
|
})
|
|
|
|
},
|
|
handleSendNotice () {
|
|
if (this.selectionAll.length === 0) {
|
|
this.$message.info('请选择要通知的人员')
|
|
return false
|
|
}
|
|
this.sendNoticeFormShow = true
|
|
this.$nextTick(() => {
|
|
const arr = this.selectionAll.map(item => {
|
|
return {
|
|
userId: item.userId,
|
|
idCard: item.idCard,
|
|
mobile: item.mobile
|
|
}
|
|
})
|
|
this.$refs.ref_sendnotice.initForm(arr, '0')
|
|
})
|
|
|
|
},
|
|
handleAttention(row) {
|
|
if (this.selectionAll.length === 0) {
|
|
this.$message.info('请选择要加入关注的名单')
|
|
return false
|
|
}
|
|
this.$confirm("确认选择的名单加入关注?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
})
|
|
.then(() => {
|
|
this.saveFocus(row)
|
|
})
|
|
.catch(err => {
|
|
console.log('err-----', err)
|
|
|
|
});
|
|
},
|
|
|
|
async handleDeletes (row) {
|
|
if (this.selectionAll.length === 0) {
|
|
this.$message.info('请选择要取消关注的名单')
|
|
return false
|
|
}
|
|
this.$confirm("确认取消关注选择的名单?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
})
|
|
.then(() => {
|
|
this.deleteFocus(row)
|
|
})
|
|
.catch(err => {
|
|
if (err == "cancel") {
|
|
|
|
}
|
|
|
|
});
|
|
},
|
|
async saveFocus (row) {
|
|
const url = "/epmetuser/icEpidemicSpecialAttention/vaccination-add"
|
|
// let idCards = []
|
|
|
|
// this.selectionAll.forEach(element => {
|
|
// idCards.push(element.idCard)
|
|
// });
|
|
let params = {
|
|
list: this.selectionAll.map(item => {
|
|
return {
|
|
name: item.name,
|
|
mobile: item.mobile,
|
|
idCard: item.idCard,
|
|
attentionType: 2
|
|
}
|
|
})
|
|
}
|
|
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "操作成功"
|
|
});
|
|
|
|
this.loadTable()
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
},
|
|
async deleteFocus (row) {
|
|
const url = "/epmetuser/icEpidemicSpecialAttention/cancel-attention"
|
|
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteam/del"
|
|
let idCards = []
|
|
|
|
this.selectionAll.forEach(element => {
|
|
idCards.push(element.idCard)
|
|
});
|
|
let params = {
|
|
attentionType: 2,
|
|
idCards: idCards
|
|
}
|
|
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "操作成功"
|
|
});
|
|
|
|
this.loadTable()
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
},
|
|
|
|
handleDetail (row) {
|
|
this.formTitle = '行程详情'
|
|
this.formShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('detail', row)
|
|
})
|
|
},
|
|
|
|
handleAdd () {
|
|
this.formTitle = '新增行程'
|
|
this.formShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('add', '')
|
|
})
|
|
},
|
|
|
|
handleEdit (row) {
|
|
this.formTitle = '修改'
|
|
this.formShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('edit', row)
|
|
})
|
|
},
|
|
|
|
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) {
|
|
const url = "/epmetuser/tripreport/delete"
|
|
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteam/del"
|
|
|
|
let params = [row.id]
|
|
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "删除成功"
|
|
});
|
|
|
|
this.loadTable()
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
},
|
|
|
|
//重置搜索条件
|
|
resetSearch () {
|
|
this.$refs.ref_searchform.resetFields()
|
|
this.formData.startDate = ''
|
|
this.formData.endDate = ''
|
|
this.searchAreacode = []
|
|
this.timeRange = []
|
|
this.pageSize = 20
|
|
this.pageNo = 1
|
|
this.loadTable()
|
|
},
|
|
|
|
|
|
handleSizeChange (val) {
|
|
this.pageSize = val
|
|
this.pageNo = 1
|
|
this.loadTable()
|
|
},
|
|
handleCurrentChange (val) {
|
|
this.pageNo = val
|
|
this.loadTable()
|
|
},
|
|
|
|
//导出表格
|
|
async handleExport () {
|
|
this.exportBtn = true
|
|
this.exportBtnTitle = '正在导出...'
|
|
let params = {
|
|
...this.formData
|
|
}
|
|
|
|
// .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
|
|
|
|
},
|
|
|
|
// 下载文件
|
|
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);
|
|
}
|
|
|
|
},
|
|
|
|
async handleExportModule () {
|
|
let title = ''
|
|
title = '房屋模板'
|
|
|
|
const url = "/epmetuser/tripreport/template-download"
|
|
let params = {}
|
|
await this.$http({
|
|
method: 'POST',
|
|
url,
|
|
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('网络错误')
|
|
})
|
|
},
|
|
|
|
// 上传文件之前的钩子
|
|
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 个文件,请删除后继续上传`)
|
|
},
|
|
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()
|
|
},
|
|
|
|
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 () {
|
|
const h = this.clientHeight - this.sHeight + this.iframeHeigh
|
|
const _h = this.clientHeight - this.sHeight
|
|
return this.$store.state.inIframe ? h : _h
|
|
|
|
},
|
|
|
|
...mapGetters(['clientHeight', 'iframeHeight'])
|
|
},
|
|
watch: {
|
|
|
|
},
|
|
props: {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped >
|
|
@import "@/assets/scss/modules/management/epidemic.scss";
|
|
</style>
|
|
|
|
|
|
|