123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <div class="main">
- <div class="search" v-if="!communitStatus">
- <dmp-newsearch :normal="normal" :query="mixins_query" @search="queryList">
- <template slot="companyOrgId">
- <select-tree
- class="new-select-tree"
- selectTreeTitle="请选择公司"
- placeholder="请选择公司"
- :options="companyArray"
- :props="defaultProps"
- v-model="mixins_query.companyOrgId"
- />
- </template>
- <div class="search-icon opt" slot="right-opt">
- <el-tooltip class="item" effect="light" placement="bottom" content="新增">
- <i class="iconfont" @click="addOrEdit('add')"></i>
- </el-tooltip>
- </div>
- </dmp-newsearch>
- </div>
- <zz-table
- v-if="!communitStatus"
- :cols="cols"
- :settings="{ showIndex: true, stripe: true }"
- :loading="mixins_onQuery"
- :data="mixins_list"
- :pageset="mixins_pageset"
- @page-change="pageChange"
- >
- <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="deleteOne(scope.row.id)"></i>
- </el-tooltip>
- </div>
- </template>
- </zz-table>
- <add-communit v-else :params="activeData" @clerOwnerStatus="clerOwnerStatus" :isAdd="isAdd"></add-communit>
- </div>
- </template>
- <script>
- import list from '@utils/list.js';
- import addCommunit from './pageJump/AddOrEdit.vue';
- export default {
- mixins: [list],
- components: { addCommunit },
- data() {
- return {
- cols: [
- {
- label: '社区名称',
- prop: 'communityName'
- },
- {
- label: '所属公司',
- prop: 'companyName'
- },
- {
- label: '所在地区',
- prop: 'mangerName'
- },
- {
- label: '详细地址',
- prop: 'address'
- },
- {
- label: '负责人',
- prop: 'contactPerson'
- },
- {
- label: '负责人电话',
- prop: 'phone'
- },
- {
- label: '操作',
- prop: 'opt',
- slot: 'opt'
- }
- ],
- normal: [
- {
- prop: 'communityName',
- placeholder: '社区名称'
- },
- {
- prop: 'companyOrgId',
- slot: 'companyOrgId'
- }
- ],
- activeData: {},
- isAdd: true,
- communitStatus: '',
- defaultProps: {
- value: 'id', // 唯一标识
- label: 'orgName', // 标签显示
- children: 'orgs' // 子级
- }
- };
- },
- computed: {
- companyArray() {
- return this.$store.getters['getCompanyArray'];
- }
- },
- methods: {
- queryList(type = 'search') {
- this.mixins_search(type);
- },
- clerOwnerStatus() {
- this.communitStatus = '';
- this.activeData = {};
- this.isAdd = true;
- this.mixins_search();
- },
- addOrEdit(todo, row) {
- if (todo == 'edit') {
- this.activeData = row;
- this.isAdd = false;
- }
- this.communitStatus = todo;
- },
- //单个删除
- deleteOne(ids) {
- this.$msgBox(`刪除社区`, '删除后将无法恢复,请问是否继续?')
- .then(() => {
- this.$http.get('/assets/community/delete', { id: ids }).then(({ status }) => {
- if (0 === status) {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- this.mixins_search();
- } else {
- this.$message.error('删除失败!');
- }
- });
- })
- .catch(() => {});
- },
- getCompany(type) {
- this.$http.postForm('/sc-user-center/org/getOrgTree', { orgType: type }).then(({ status, data, msg }) => {
- if (status === 0 && data) {
- if (type == 'company') {
- this.$store.commit('setCompanyArray', data);
- } else if (type == 'department') {
- this.$store.commit('setDepartmentArray', data);
- }
- }
- });
- }
- },
- created() {
- if (this.$store.getters['getCompanyArray'].length === 0) {
- this.getCompany('company');
- }
- if (this.$store.getters['getDepartmentArray'].length === 0) {
- this.getCompany('department');
- }
- this.mixins_post = 'post';
- this.mixins_dataUrl = '/assets/community/page';
- this.mixins_search();
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|