123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <template>
- <div class="content">
- <building-tree @buildingInformation="buildingInformation" :buildingType="1" v-if="!showaddDialog"></building-tree>
- <div class="content-right" v-if="!showaddDialog">
- <div class="search">
- <el-input clearable placeholder="房屋号" class="search-input" v-trim v-model="mixins_query.roomNumber"></el-input>
- <el-select v-model="mixins_query.useStatus" clearable placeholder="请选择社区名称">
- <el-option v-for="item in statusOptions" :label="item.label" :value="item.val" :key="item">{{ item.label }}</el-option>
- </el-select>
- <el-button
- class="search-btn"
- type="primary"
- @click="mixins_search"
- :disabled="mixins_onQuery"
- :loading="mixins_onQuery"
- icon="el-icon-search"
- >搜索
- </el-button>
- <div class="search-icon">
- <template>
- <el-dropdown type="primary" @command="addCommand">
- <span class="iconfont"></span>
- <el-dropdown-menu slot="dropdown" hide-on-click="false" class="device-search-dropdown">
- <el-dropdown-item command="add">单个添加</el-dropdown-item>
- <el-dropdown-item command="batchAdd">
- <div class="upload_div">
- <xk-upload class="upload_class" @callback="mixins_search" :params="{ importType: 'HOUSE' }">
- <span class="upload_text" slot="content">批量添加</span>
- </xk-upload>
- </div>
- </el-dropdown-item>
- <el-dropdown-item command="template">下载模板</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- <el-tooltip class="item" effect="light" placement="bottom" content="删除">
- <i class="iconfont" @click="deluserbyidsFn"></i>
- </el-tooltip>
- <el-tooltip class="item" effect="light" placement="bottom" content="导出">
- <i class="zoniot_font zoniot-icon-daochu2" @click="exportExcel()"></i>
- </el-tooltip>
- </div>
- </div>
- <zz-table
- :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
- :cols="cols"
- :loading="mixins_onQuery"
- :data="mixins_list"
- :pageset="mixins_pageset"
- @page-change="pageChange"
- @selection-change="selectionChange"
- >
- <template slot-scope="scope" slot="useStatus">
- <span v-if="scope.row.useStatus == 0">空置</span>
- <span v-if="scope.row.useStatus == 1">居住</span>
- </template>
- <template slot-scope="scope" slot="opt" class="opt">
- <div class="opt">
- <el-tooltip effect="light" placement="bottom" content="编辑">
- <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
- </el-tooltip>
- <el-tooltip effect="light" placement="bottom" content="删除">
- <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteRow(scope.row)"></i>
- </el-tooltip>
- <el-tooltip class="item" effect="light" placement="bottom" content="查看">
- <i class="zoniot_font zoniot-icon-xiangqing" @click="lookPage(scope.row)"></i>
- </el-tooltip>
- </div>
- </template>
- </zz-table>
- </div>
- <save-edits v-else :params="activeData" @clerOwnerStatus="clerOwnerStatus" :isAdd="isAdd"></save-edits>
- </div>
- </template>
- <script>
- import list from '@utils/list.js';
- import saveEdits from './saveEdits.vue';
- export default {
- mixins: [list],
- name:'housingManagement',
- data() {
- return {
- statusOptions: [
- { label: '空置', val: 0 },
- { label: '居住', val: 1 }
- ],
- cols: [
- {
- label: '所属社区',
- prop: 'communityName',
- width: 120
- },
- {
- label: '楼栋名称',
- prop: 'buildingName'
- },
- {
- label: '单元',
- prop: 'unitName'
- },
- {
- label: '房屋号',
- prop: 'roomNumber'
- },
- {
- label: '建筑面积',
- prop: 'buildingArea',
- format(val) {
- if (!!val) {
- return val + '㎡';
- } else {
- return '--';
- }
- }
- },
- {
- label: '使用面积',
- prop: 'useArea',
- format(val) {
- if (!!val) {
- return val + '㎡';
- } else {
- return '--';
- }
- }
- },
- {
- label: '房屋类型',
- prop: 'buildingType',
- format(val) {
- if (val == 1) {
- return '住宅';
- } else if (val == 2) {
- return '商用';
- } else {
- return '--';
- }
- }
- },
- {
- label: '使用状态',
- slot: 'useStatus'
- },
- {
- label: '操作',
- slot: 'opt',
- width: 150
- }
- ],
- showaddDialog: '',
- selectRow: [],
- mixins_post: 'post',
- isAdd: true,
- activeData: {}
- };
- },
- components: {
- saveEdits
- },
- methods: {
- lookPage(row) {
- this.$router.push({
- path: '/housingManagement/details',
- query: {
- id: row.id
- }
- });
- },
- addCommand(command) {
- if (command === 'add') {
- this.addOrEdit('todo');
- }
- if (command === 'template') {
- this.__exportExcel('/sc-community/excel/download/template', { importType: 'HOUSE' });
- return;
- }
- },
- clerOwnerStatus() {
- this.showaddDialog = '';
- this.activeData = {};
- this.isAdd = true;
- this.mixins_search();
- },
- addOrEdit(todo, row) {
- if (todo == 'edit') {
- this.activeData = row;
- this.isAdd = false;
- }
- this.showaddDialog = todo;
- },
- deleteRow(row) {
- const { communityName, buildingName, unitName, roomNumber } = row;
- let title = `您确定要删除“${communityName}${buildingName}${unitName}${roomNumber}”号房间`;
- this.$msgBox(title)
- .then(() => {
- this.$http
- .post('/sc-community/assets/house/delete', [row.id])
- .then(({ status, msg }) => {
- if (0 === status) {
- this.$message.success(msg);
- this.mixins_search();
- } else {
- this.$message.error(msg);
- }
- })
- .catch(() => {});
- })
- .catch(() => {});
- },
- selectionChange(val) {
- this.selectRow = val;
- },
- deluserbyidsFn() {
- //获取选中列表的ids
- let ids = [];
- if (!this.selectRow.length) {
- this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
- return;
- }
- this.selectRow.forEach((v) => {
- ids.push(v.id);
- });
- this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
- .then(() => {
- this.$http.post('/sc-community/assets/house/delete', ids).then(({ status, data, msg }) => {
- if (0 === status) {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- this.mixins_search();
- } else {
- this.$message.error(msg);
- }
- });
- })
- .catch(() => {});
- },
- buildingInformation(data) {
- if (!!data.type && data.type == 'community') {
- this.mixins_query = {communityId:data.value,buildingType:1};
- } else {
- this.mixins_query.communityId = data.communityId;
- this.mixins_query.id = data.roomId;
- this.mixins_query.buildingId = data.buildingId;
- this.mixins_query.unitName = data.unitId;
- }
- this.mixins_search();
- },
- //导出
- exportExcel() {
- this.__exportExcel('/sc-community/assets/house/export/excel', this.mixins_query);
- },
- communityNameList() {
- this.$http.get('/sc-community/assets/community/list', {}).then((res) => {
- this.$store.commit('setCommunityArray', res.data);
- });
- }
- },
- created() {
- this.mixins_dataUrl = '/sc-community/assets/house/page'; // 分页查询接口
- this.mixins_query = {
- buildingType: 1
- };
- this.communityNameList();
- this.mixins_search('search');
- }
- };
- </script>
- <style lang="scss" scoped>
- .content {
- .content-right {
- width: calc(100% - 280px);
- float: right;
- }
- }
- </style>
|