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.
974 lines
25 KiB
974 lines
25 KiB
<template>
|
|
<div>
|
|
<div class="div_btn">
|
|
<el-button v-if="showYhymInfo && customerId !== '1535072605621841922'" style="" class="diy-button--reset" size="small" :loading="yhymLoading" @click="handleYhymInfo">
|
|
补全一房一码信息
|
|
</el-button>
|
|
<el-button
|
|
v-if="showYhymInfo && customerId !== '1535072605621841922'"
|
|
style=""
|
|
class="diy-button--export"
|
|
size="small"
|
|
:loading="xcxmLoading"
|
|
@click="createBatchNeiQrUrl"
|
|
>
|
|
补全小程序小区码
|
|
</el-button>
|
|
<el-button style="" class="diy-button--add" size="small" @click="handleAdd">新增小区</el-button>
|
|
|
|
<div class="btn_upload" v-if="showImportBtn">
|
|
<el-button style="" class="diy-button--export" size="small" @click="handleExportModule('community')">下载小区模板</el-button>
|
|
|
|
<el-upload
|
|
:headers="$getElUploadHeaders()"
|
|
ref="upload_community"
|
|
style=""
|
|
:multiple="false"
|
|
:show-file-list="false"
|
|
:before-upload="
|
|
file => {
|
|
beforeUpload(file, 'community');
|
|
}
|
|
"
|
|
action=""
|
|
accept=".xls,.xlsx"
|
|
:http-request="
|
|
() => {
|
|
uploadFile('community');
|
|
}
|
|
"
|
|
>
|
|
<el-button style="margin-left:10px" size="small" class="diy-button--delete">导入小区数据</el-button>
|
|
</el-upload>
|
|
|
|
<el-button style=";margin-left:10px" class="diy-button--export" size="small" @click="handleExportModule('building')">下载楼栋模板</el-button>
|
|
|
|
<el-upload
|
|
:headers="$getElUploadHeaders()"
|
|
style=""
|
|
ref="upload_building"
|
|
:multiple="false"
|
|
:show-file-list="false"
|
|
:before-upload="
|
|
file => {
|
|
beforeUpload(file, 'building');
|
|
}
|
|
"
|
|
action=""
|
|
accept=".xls,.xlsx"
|
|
:http-request="
|
|
() => {
|
|
uploadFile('building');
|
|
}
|
|
"
|
|
>
|
|
<el-button style="margin-left:10px" size="small" class="diy-button--delete">导入楼栋数据</el-button>
|
|
</el-upload>
|
|
<el-button style=";margin-left:10px" class="diy-button--export" size="small" @click="handleExportModule('room')">下载房屋模板</el-button>
|
|
|
|
<el-upload
|
|
:headers="$getElUploadHeaders()"
|
|
style=""
|
|
ref="upload_room"
|
|
:multiple="false"
|
|
:show-file-list="false"
|
|
:before-upload="
|
|
file => {
|
|
beforeUpload(file, 'room');
|
|
}
|
|
"
|
|
action=""
|
|
accept=".xls,.xlsx"
|
|
:http-request="
|
|
() => {
|
|
uploadFile('room');
|
|
}
|
|
"
|
|
>
|
|
<el-button style="margin-left:10px" size="small" class="diy-button--delete">导入房屋数据</el-button>
|
|
</el-upload>
|
|
</div>
|
|
<el-button style="margin-left:10px" class="diy-button--reset" size="small" @click="handleExportOpen">导出</el-button>
|
|
<el-button v-if="agencyObj.level == 'community'" style="margin-left:10px" class="diy-button--qrcode" size="small" @click="handleDownQr(agencyObj, 'community')">
|
|
社区二维码
|
|
</el-button>
|
|
<el-button style="float:left;margin-left:10px" class="diy-button--more" size="small" @click="deleteBatch">批量删除</el-button>
|
|
<!-- <el-button style=";margin-left:10px"
|
|
class="diy-button--export"
|
|
size="small"
|
|
:disabled="yihuyidangDisabled"
|
|
@click="handleExportYihuyidang()">导出一户一档</el-button> -->
|
|
|
|
<el-button size="small" v-if="displayedBaobiaoBtn" class="diy-button--add" @click="reportForm">智能填报</el-button>
|
|
</div>
|
|
|
|
<div class="div_table_item">
|
|
<el-table
|
|
ref="ref_table"
|
|
:data="tableData"
|
|
border
|
|
:height="tableHeight"
|
|
v-loading="tableLoading"
|
|
:header-cell-style="{ background: '#2195FE', color: '#FFFFFF' }"
|
|
style="width: 100%"
|
|
:show-overflow-tooltip="true"
|
|
@select-all="selectAll"
|
|
@selection-change="selectionChange"
|
|
>
|
|
<el-table-column type="selection" :selectable="checkSelect" width="55"></el-table-column>
|
|
<el-table-column prop="neighborHoodName" label="小区名称" min-width="100">
|
|
<template slot-scope="scope">
|
|
<a class="name-a" @click="handleToNextLevel(scope.row)">{{ scope.row.neighborHoodName }}</a>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="agencyName" label="所属组织" min-width="100"></el-table-column>
|
|
<el-table-column prop="gridName" label="所属网格" min-width="120"></el-table-column>
|
|
<el-table-column prop="viliageTypeName" label="小区/自然村类型" min-width="80"></el-table-column>
|
|
<el-table-column prop="openTypeName" label="开放类型" min-width="80"></el-table-column>
|
|
<el-table-column prop="area" label="面积(平方米)" min-width="100"></el-table-column>
|
|
|
|
<el-table-column prop="buildYear" label="建筑年代" min-width="80"></el-table-column>
|
|
|
|
<el-table-column prop="gridName" label="详细地址" min-width="120" show-overflow-tooltip="true"></el-table-column>
|
|
|
|
<!-- <el-table-column prop="总单元数"
|
|
label="所属网格"
|
|
min-width="80">
|
|
</el-table-column>
|
|
<el-table-column prop="总户数"
|
|
label="所属网格"
|
|
min-width="80">
|
|
</el-table-column> -->
|
|
<el-table-column prop="address" label="详细地址" min-width="180"></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 v-if="scope.row.showBtn" type="text" class="div-table-button--edit" size="small" @click="handleEdit(scope.row)">修改</el-button>
|
|
|
|
<el-button v-if="scope.row.showBtn" type="text" class="div-table-button--delete" 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="detailShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
:title="'小区详情'"
|
|
width="850px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="detailFormCancle"
|
|
>
|
|
<community-detail ref="ref_form_detail" @diaDetailClose="detailFormCancle"></community-detail>
|
|
</el-dialog>
|
|
|
|
<!-- 修改弹出框 -->
|
|
<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"
|
|
>
|
|
<community-form ref="ref_form" @dialogCancle="addFormCancle" @dialogOk="addFormOk"></community-form>
|
|
</el-dialog>
|
|
|
|
<el-dialog title="导出" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
|
|
<div>
|
|
<el-button class="diy-button--reset" size="small" @click="handleExport">导出小区数据</el-button>
|
|
<el-button class="diy-button--export" size="small" :disabled="yihuyidangDisabled" @click="handleExportYihuyidang()">导出一户一档</el-button>
|
|
<el-button class="diy-button--qrcode" size="small" :disabled="yihuyimaDisabled" :loading="exportBtn" @click="handleExportYihuyima()">导出一房一码</el-button>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<!-- <el-button type="primary" @click="dialogVisible = false">确 定</el-button> -->
|
|
</span>
|
|
</el-dialog>
|
|
|
|
<baobiao ref="baobiao" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CommunityForm from './communityForm';
|
|
import CommunityDetail from './communityDetail';
|
|
|
|
import { requestPost } from '@/js/dai/request';
|
|
import { mapGetters } from 'vuex';
|
|
import { Loading } from 'element-ui'; // 引入Loading服务
|
|
import axios from 'axios';
|
|
import baobiao from '@/views/modules/cpts/baobiao';
|
|
|
|
let loading; // 加载动画
|
|
export default {
|
|
data() {
|
|
return {
|
|
importBuildingLoading: false,
|
|
importRoomLoading: false,
|
|
importCommunityLoading: false,
|
|
total: 0,
|
|
pageSize: 20,
|
|
pageNo: 0,
|
|
tableLoading: true,
|
|
|
|
showImportBtn: false, //是否显示操作按钮,根据登录人所属组织判断
|
|
roleList: [], //角色列表
|
|
showYhymInfo: false, // 是否显示补全一房一码信息按钮
|
|
yhymLoading: false,
|
|
xcxmLoading: false,
|
|
|
|
agencyObj: {}, //树所选的组织对象
|
|
|
|
tableData: [],
|
|
validTableDataNum: 0, //有效的数据数量,即有权限操作的数据数量
|
|
selection: [],
|
|
showDeletBtn: false,
|
|
|
|
//form相关
|
|
formShow: false,
|
|
formTitle: '新增小区',
|
|
|
|
detailShow: false,
|
|
|
|
files: '',
|
|
fileName: '',
|
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/gov/org/neighborhood/import',
|
|
yihuyidangDisabled: false,
|
|
yihuyimaDisabled: false,
|
|
exportBtn: false,
|
|
dialogVisible: false, // 导出
|
|
|
|
displayedBaobiaoBtn: false,
|
|
customerId: '' //烟台的客户id : 1535072605621841922
|
|
};
|
|
},
|
|
components: {
|
|
baobiao,
|
|
CommunityForm,
|
|
CommunityDetail
|
|
},
|
|
async mounted() {
|
|
this.customerId = localStorage.getItem('customerId');
|
|
this.displayedBaobiaoBtn = await this.$refs.baobiao.existsTemplate({
|
|
elseParams: {
|
|
categoryKeys: ['house_info'],
|
|
categoryKey: 'house_info'
|
|
}
|
|
});
|
|
},
|
|
computed: {
|
|
tableHeight() {
|
|
return this.$store.state.inIframe ? this.clientHeight - 425 + this.iframeHeight : this.clientHeight - 425;
|
|
},
|
|
|
|
...mapGetters(['clientHeight', 'iframeHeight'])
|
|
},
|
|
methods: {
|
|
reportForm() {
|
|
let paramMap = {
|
|
pageSize: this.pageSize,
|
|
pageNo: this.pageNo,
|
|
level: this.agencyObj.level,
|
|
id: this.agencyObj.id,
|
|
ownerName: this.ownerName,
|
|
ownerPhone: this.ownerPhone,
|
|
rentFlag: this.rentFlag,
|
|
purpose: this.purpose,
|
|
remark: this.remark,
|
|
sortType: this.sortType,
|
|
updateStartDate: this.updateStartDate,
|
|
updateEndDate: this.updateEndDate
|
|
};
|
|
this.$refs.baobiao.init({
|
|
elseParams: {
|
|
categoryKeys: ['house_info'],
|
|
categoryKey: 'house_info',
|
|
paramMap
|
|
}
|
|
});
|
|
},
|
|
async loadTable(fromTree, treeObj) {
|
|
console.log(111, this.staffAgencyId);
|
|
// 是否显示补全一房一码信息按钮
|
|
this.roleList = localStorage.getItem('roleList');
|
|
if (this.roleList.indexOf('root_manager') > -1 || this.roleList.indexOf('manager') > -1) {
|
|
this.showYhymInfo = true;
|
|
} else {
|
|
this.showYhymInfo = false;
|
|
}
|
|
this.tableLoading = true;
|
|
if (fromTree) {
|
|
this.agencyObj = treeObj;
|
|
if (this.agencyObj.level === 'community') {
|
|
//只有社区和网格显示操作按钮
|
|
if (this.agencyObj.id === this.staffAgencyId) {
|
|
//如果所选树的组织id和登录人员id相同,有权限
|
|
this.showImportBtn = true;
|
|
} else {
|
|
this.showImportBtn = false;
|
|
}
|
|
} else if (this.agencyObj.level === 'grid') {
|
|
//网格下
|
|
if (this.agencyObj.pid === this.staffAgencyId) {
|
|
//如果所选树的父级组织id和登录人员id相同,有权限
|
|
this.showImportBtn = true;
|
|
} else {
|
|
this.showImportBtn = false;
|
|
}
|
|
} else {
|
|
this.showImportBtn = false;
|
|
}
|
|
}
|
|
|
|
const url = '/gov/org/neighborhood/neighborhoodlist';
|
|
|
|
let params = {
|
|
pageSize: this.pageSize,
|
|
pageNo: this.pageNo,
|
|
|
|
level: this.agencyObj.level,
|
|
id: this.agencyObj.id
|
|
};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
|
|
if (code === 0) {
|
|
this.validTableDataNum = 0;
|
|
this.total = data.total;
|
|
data.list.forEach(item => {
|
|
if (item.agencyId === this.staffAgencyId) {
|
|
item.showBtn = true;
|
|
this.validTableDataNum++;
|
|
} else {
|
|
item.showBtn = false;
|
|
}
|
|
});
|
|
this.tableData = data.list;
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
this.tableLoading = false;
|
|
},
|
|
|
|
checkSelect(row, index) {
|
|
let isChecked = false;
|
|
if (row.showBtn) {
|
|
// 判断里面是否存在某个参数
|
|
isChecked = true;
|
|
} else {
|
|
isChecked = false;
|
|
}
|
|
return isChecked;
|
|
},
|
|
|
|
diaClose() {
|
|
this.$refs.ref_form.resetData();
|
|
this.formShow = false;
|
|
},
|
|
|
|
async handleDetail(row) {
|
|
// this.formTitle = '小区详情'
|
|
// this.formShow = true
|
|
// const _data = await this.detail(row)
|
|
// this.$nextTick(() => {
|
|
// this.$refs.ref_form.initForm('detail', _data, this.agencyObj)
|
|
// })
|
|
|
|
this.detailShow = true;
|
|
|
|
const _data = await this.detail(row);
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form_detail.initForm(_data);
|
|
});
|
|
},
|
|
|
|
handleAdd() {
|
|
this.formTitle = '新增小区';
|
|
this.formShow = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('add', null, this.agencyObj);
|
|
});
|
|
},
|
|
async detail(row) {
|
|
const url = '/gov/org/houseInformation/neighborhoodDetail/' + row.neighborHoodId;
|
|
|
|
const { data, code, msg } = await requestPost(url);
|
|
|
|
if (code === 0) {
|
|
return data;
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
// 补全一房一码点击事件
|
|
async handleYhymInfo() {
|
|
this.yhymLoading = true;
|
|
const url = '/gov/org/house/createBatchHouseCodeAndUrl';
|
|
|
|
let params = {};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
|
|
if (code === 0) {
|
|
this.yhymLoading = false;
|
|
this.$message({
|
|
type: 'success',
|
|
message: '批量生成成功'
|
|
});
|
|
} else if (code > 8000) {
|
|
this.yhymLoading = false;
|
|
this.$message({
|
|
showClose: true,
|
|
message: msg,
|
|
duration: 0
|
|
});
|
|
} else {
|
|
this.yhymLoading = false;
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
// 补全小程序一户一码
|
|
async createBatchNeiQrUrl() {
|
|
this.xcxmLoading = true;
|
|
const url = '/gov/org/neighborhood/createBatchNeiQrUrl';
|
|
|
|
let params = {};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
|
|
if (code === 0) {
|
|
this.xcxmLoading = false;
|
|
this.$message({
|
|
type: 'success',
|
|
message: '批量生成成功'
|
|
});
|
|
} else if (code > 8000) {
|
|
this.xcxmLoading = false;
|
|
this.$message({
|
|
showClose: true,
|
|
message: msg,
|
|
duration: 0
|
|
});
|
|
} else {
|
|
this.xcxmLoading = false;
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
async handleEdit(row) {
|
|
this.formTitle = '修改小区';
|
|
this.formShow = true;
|
|
const _data = await this.detail(row);
|
|
|
|
this.$nextTick(() => {
|
|
console.log(_data);
|
|
if (_data.propertyList.length > 0) {
|
|
_data.propertyId = _data.propertyList[0].id;
|
|
} else {
|
|
_data.propertyId = '';
|
|
}
|
|
this.$refs.ref_form.initForm('edit', _data, this.agencyObj);
|
|
});
|
|
},
|
|
|
|
handleToNextLevel(row) {
|
|
this.$emit('toNextLevel', row, 'community');
|
|
},
|
|
|
|
addFormCancle() {
|
|
this.formShow = false;
|
|
},
|
|
detailFormCancle() {
|
|
this.$refs.ref_form_detail.diaDestroy();
|
|
this.detailShow = false;
|
|
},
|
|
addFormOk() {
|
|
this.formShow = false;
|
|
this.loadTable();
|
|
this.$emit('refreshTree');
|
|
},
|
|
|
|
deleteBatch() {
|
|
if (this.selection.length > 0) {
|
|
this.$confirm('确认删除选择的小区?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
this.deleteCommunityBatch();
|
|
})
|
|
.catch(err => {
|
|
if (err == 'cancel') {
|
|
// this.$message({
|
|
// type: "info",
|
|
// message: "已取消删除"
|
|
// });
|
|
}
|
|
});
|
|
} else {
|
|
this.$message.warning('请先选择要删除的小区');
|
|
}
|
|
},
|
|
selectAll(selection) {
|
|
this.selection = selection;
|
|
},
|
|
selectionChange(selection) {
|
|
this.selection = selection;
|
|
},
|
|
|
|
async handleDelete(row) {
|
|
this.$confirm('确认删除?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
this.deleteCommunity(row);
|
|
})
|
|
.catch(err => {
|
|
if (err == 'cancel') {
|
|
// this.$message({
|
|
// type: "info",
|
|
// message: "已取消删除"
|
|
// });
|
|
}
|
|
});
|
|
},
|
|
|
|
async deleteCommunityBatch() {
|
|
let ids = [];
|
|
console.log(this.selection);
|
|
this.selection.forEach(element => {
|
|
ids.push(element.neighborHoodId);
|
|
});
|
|
|
|
const url = '/gov/org/house/delete';
|
|
|
|
let params = {
|
|
type: 'neighborHood',
|
|
ids: ids
|
|
};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: 'success',
|
|
message: '删除成功'
|
|
});
|
|
this.$emit('refreshTree');
|
|
this.loadTable();
|
|
} else if (code > 8000) {
|
|
this.$message({
|
|
showClose: true,
|
|
message: msg,
|
|
duration: 0
|
|
});
|
|
this.$emit('refreshTree');
|
|
this.loadTable();
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
async deleteCommunity(row) {
|
|
const url = '/gov/org/neighborhood/neighborhooddel';
|
|
|
|
let params = {
|
|
neighborHoodId: row.neighborHoodId
|
|
};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: 'success',
|
|
message: '删除成功'
|
|
});
|
|
this.$emit('refreshTree');
|
|
this.loadTable();
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
async handleDownQr(row, type) {
|
|
let title = row.label + '二维码.png';
|
|
// const url = window.SITE_CONFIG['apiURL'] + `/gov/org/icneighborhood/createQrCode/${row.neighborHoodId}`
|
|
const url = '/gov/org/agency/create-qrcode';
|
|
const _id = type == 'community' ? row.id : row.neighborHoodId;
|
|
const params = {
|
|
id: _id,
|
|
type
|
|
};
|
|
await axios({
|
|
method: 'POST',
|
|
url: window.SITE_CONFIG['apiURL'] + url,
|
|
data: params,
|
|
responseType: 'blob'
|
|
}).then(res => {
|
|
console.log('res----1r', res);
|
|
if (res.data) {
|
|
// let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
|
|
// console.log('filename', fileName)
|
|
this.download(res.data, title); //释放掉blob对象
|
|
} else this.$message.error('下载失败');
|
|
// this.download(res.data, '1.png')
|
|
});
|
|
},
|
|
// 导出按钮点击事件
|
|
handleExportOpen() {
|
|
this.dialogVisible = true;
|
|
},
|
|
//导出表格 以前是导出 现在改成导出房屋数据
|
|
async handleExport() {
|
|
let title = this.agencyObj.label;
|
|
title = title + '—小区列表';
|
|
|
|
const url = '/gov/org/neighborhood/exportneighborhoodinfo';
|
|
let params = {
|
|
level: this.agencyObj.level,
|
|
id: this.agencyObj.id
|
|
};
|
|
|
|
app.ajax.exportFilePost(
|
|
url,
|
|
params,
|
|
(data, rspMsg) => {
|
|
this.download(data, title + '.xls');
|
|
},
|
|
(rspMsg, data) => {
|
|
this.$message.error(rspMsg);
|
|
}
|
|
);
|
|
},
|
|
|
|
handleClose(done) {
|
|
this.dialogVisible = false;
|
|
},
|
|
|
|
// 下载文件
|
|
download(data, downFileName) {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
|
|
var csvData = new Blob([data]);
|
|
|
|
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
window.navigator.msSaveOrOpenBlob(csvData, downFileName);
|
|
}
|
|
// 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 = downFileName;
|
|
a.click();
|
|
a.remove();
|
|
window.URL.revokeObjectURL(url);
|
|
}
|
|
},
|
|
|
|
handleExportModule(type) {
|
|
let title = '';
|
|
let url = '';
|
|
if (type === 'community') {
|
|
title = '小区导入模板';
|
|
url = '/gov/org/neighborhood/exporttemplate';
|
|
} else if (type === 'building') {
|
|
title = '楼栋导入模板';
|
|
url = '/gov/org/building/exporttemplate';
|
|
} else if (type === 'room') {
|
|
title = '房间导入模板';
|
|
url = '/gov/org/house/exporttemplate';
|
|
}
|
|
|
|
let params = {};
|
|
|
|
app.ajax.exportFilePost(
|
|
url,
|
|
params,
|
|
(data, rspMsg) => {
|
|
this.download(data, title + '.xls');
|
|
},
|
|
(rspMsg, data) => {
|
|
this.$message.error(rspMsg);
|
|
}
|
|
);
|
|
},
|
|
|
|
//导出一户一档
|
|
handleExportYihuyidang() {
|
|
this.yihuyidangDisabled = true;
|
|
let title = this.agencyObj.label;
|
|
title = title + '-一户一档';
|
|
let url = '/gov/org/house/exportHouseUser';
|
|
|
|
let params = {
|
|
agencyId: '',
|
|
gridId: '',
|
|
ownerName: this.ownerName,
|
|
ownerPhone: this.ownerPhone,
|
|
rentFlag: this.rentFlag,
|
|
purpose: this.purpose,
|
|
remark: this.remark,
|
|
updateStartDate: this.updateStartDate,
|
|
updateEndDate: this.updateEndDate
|
|
};
|
|
|
|
if (this.agencyObj.level === 'grid') {
|
|
params.gridId = this.agencyObj.id;
|
|
params.agencyId = '';
|
|
} else {
|
|
params.gridId = '';
|
|
params.agencyId = this.agencyObj.id;
|
|
}
|
|
|
|
app.ajax.exportFilePost(
|
|
url,
|
|
params,
|
|
(data, rspMsg) => {
|
|
this.download(data, title + '.xls');
|
|
this.yihuyidangDisabled = false;
|
|
},
|
|
(rspMsg, data) => {
|
|
this.yihuyidangDisabled = false;
|
|
this.$message.error(rspMsg);
|
|
}
|
|
);
|
|
},
|
|
|
|
// 导出一房一码
|
|
|
|
handleExportYihuyima() {
|
|
this.exportBtn = true;
|
|
this.yihuyimaDisabled = true;
|
|
let title = this.agencyObj.label;
|
|
title = title + '-一房一码';
|
|
let url = '/gov/org/house/downloadZip';
|
|
|
|
let params = {
|
|
level: this.agencyObj.level,
|
|
id: this.agencyObj.id
|
|
};
|
|
|
|
app.ajax.exportFilePost(
|
|
url,
|
|
params,
|
|
(data, rspMsg) => {
|
|
this.download(data, title + '.Zip');
|
|
this.exportBtn = false;
|
|
this.yihuyimaDisabled = false;
|
|
},
|
|
(rspMsg, data) => {
|
|
this.exportBtn = false;
|
|
this.yihuyimaDisabled = false;
|
|
this.$message.error(rspMsg);
|
|
}
|
|
);
|
|
},
|
|
|
|
// 上传文件之前的钩子
|
|
beforeUpload(file, type) {
|
|
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('请选择正确格式的文件');
|
|
this.files = null;
|
|
this.fileName = '';
|
|
return false;
|
|
} else {
|
|
this.fileName = file.name;
|
|
return true;
|
|
}
|
|
},
|
|
// 上传文件个数超过定义的数量
|
|
handleExceed(files, fileList) {
|
|
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`);
|
|
},
|
|
|
|
async uploadFile(type) {
|
|
if (this.fileName == '') {
|
|
this.$message.warning('请选择要上传的文件!');
|
|
return false;
|
|
}
|
|
|
|
this.$message({
|
|
showClose: true,
|
|
message: '导入中,请到系统管理-导入记录中查看进度',
|
|
duration: 0
|
|
});
|
|
|
|
//清空上传列表
|
|
let url = '';
|
|
|
|
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 === 'grid' ? 'grid' : 'agency'); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名
|
|
|
|
if (type === 'community') {
|
|
this.importCommunityLoading = true;
|
|
this.$refs['upload_community'].clearFiles();
|
|
url = '/gov/org/icneighborhood/neighborhoodimport';
|
|
} else if (type === 'building') {
|
|
this.$refs['upload_building'].clearFiles();
|
|
url = '/gov/org/building/buildingimport';
|
|
this.importBuildingLoading = true;
|
|
} else if (type === 'room') {
|
|
this.$refs['upload_room'].clearFiles();
|
|
url = '/gov/org/house/houseimport';
|
|
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.showMessage(rspMsg)
|
|
if (type === 'community') {
|
|
this.importCommunityLoading = false;
|
|
} else if (type === 'building') {
|
|
this.importBuildingLoading = false;
|
|
} else if (type === 'room') {
|
|
this.importRoomLoading = false;
|
|
}
|
|
},
|
|
(rspMsg, data) => {
|
|
if (type === 'community') {
|
|
this.importCommunityLoading = false;
|
|
} else if (type === 'building') {
|
|
this.importBuildingLoading = false;
|
|
} else if (type === 'room') {
|
|
this.importRoomLoading = false;
|
|
}
|
|
// this.$message.error(rspMsg)
|
|
},
|
|
{ headers: { 'Content-Type': 'multipart/form-data' } }
|
|
);
|
|
},
|
|
|
|
showMessage(msg) {
|
|
this.$alert(msg, '操作结果', {
|
|
confirmButtonText: '关闭',
|
|
callback: action => {
|
|
this.$emit('refreshTree');
|
|
this.loadTable();
|
|
}
|
|
});
|
|
},
|
|
handleSizeChange(val) {
|
|
this.pageSize = val;
|
|
this.pageNo = 1;
|
|
this.loadTable();
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.pageNo = val;
|
|
this.loadTable();
|
|
},
|
|
|
|
// 开启加载动画
|
|
startLoading() {
|
|
loading = Loading.service({
|
|
lock: true, // 是否锁定
|
|
text: '正在加载……', // 加载中需要显示的文字
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色
|
|
});
|
|
},
|
|
// 结束加载动画
|
|
endLoading() {
|
|
// clearTimeout(timer);
|
|
if (loading) {
|
|
loading.close();
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
selection(val) {
|
|
if (val.length > 0) {
|
|
this.showDeletBtn = true;
|
|
} else {
|
|
this.showDeletBtn = false;
|
|
}
|
|
}
|
|
},
|
|
props: {
|
|
staffAgencyId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
ownerName: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
ownerPhone: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
rentFlag: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
purpose: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
remark: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
updateStartDate: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
updateEndDate: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
@import '@/assets/scss/modules/visual/communityManage.scss';
|
|
</style>
|
|
|
|
<style>
|
|
.el-message.is-closable .el-message__content {
|
|
line-height: 20px;
|
|
}
|
|
</style>
|
|
|