linwe
2023-12-14 0213c6b37748e96570125bc7a12bf2e7cc5a500f
数据管理优化
8 files modified
1229 ■■■■ changed files
src/api/userHouse/list/house.js 10 ●●●●● patch | view | raw | blame | history
src/api/userHouse/list/houseHold.js 11 ●●●●● patch | view | raw | blame | history
src/api/userHouse/list/userHouseList.js 14 ●●●●● patch | view | raw | blame | history
src/views/article/article.vue 171 ●●●●● patch | view | raw | blame | history
src/views/place/index.vue 8 ●●●●● patch | view | raw | blame | history
src/views/userHouse/houseHoldList.vue 142 ●●●● patch | view | raw | blame | history
src/views/userHouse/houseList.vue 869 ●●●●● patch | view | raw | blame | history
vue.config.js 4 ●●●● patch | view | raw | blame | history
src/api/userHouse/list/house.js
@@ -58,6 +58,14 @@
  })
}
export const getDetatils = (params) => {
  return request({
    url: '/api/blade-house/house/getHouseDetail',
    method: 'get',
    params: params
  })
}
export const saveOrUpdateHouseLabel = (ids, type) => {
  return request({
    url: '/api/blade-house/house/saveOrUpdateHouseLabel',
@@ -67,4 +75,4 @@
      type
    }
  })
}
}
src/api/userHouse/list/houseHold.js
@@ -59,6 +59,15 @@
    }
  })
}
export const getDetatils = (id) => {
  return request({
    url: '/api/blade-household/household/getDetail',
    method: 'get',
    params: {
      id
    }
  })
}
export const saveOrUpdateHouseLabel = (ids, type) => {
  return request({
@@ -69,4 +78,4 @@
      type
    }
  })
}
}
src/api/userHouse/list/userHouseList.js
@@ -70,3 +70,17 @@
    }
  })
}
export const saveOrUpdateHouseholdLabel = (row) => {
  return request({
    url: '/api/blade-householdLabel/householdLabel/saveOrUpdateHouseholdLabel',
    method: 'post',
    data: row
  })
}
export const removeHouseholdLabel = (row) => {
  return request({
    url: '/api/blade-householdLabel/householdLabel/removeHouseholdLabel',
    method: 'post',
    data: row
  })
}
src/views/article/article.vue
@@ -49,7 +49,7 @@
      <span slot="title" class="dialog-footer">
        {{discussForm.ontitle}}
      </span>
      <div id="" v-if="discussForm.eventType == 2">
      <div id="" v-if="discussForm.eventType == 1">
        <avue-form @submit="handleSubmit" :option="optionDiscuss" v-model="discussForm"></avue-form>
      </div>
@@ -59,15 +59,6 @@
      </div>
    </el-dialog>
    <!-- <el-dialog title="用户数据导入" append-to-body :visible.sync="dialogVisibles" width="555px">
      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
        <template slot="excelTemplate">
          <el-button type="primary" @click="handleTemplate">
            点击下载<i class="el-icon-download el-icon--right"></i>
          </el-button>
        </template>
      </avue-form>
    </el-dialog> -->
@@ -340,7 +331,7 @@
              }
            }, {
              labelWidth: 100,
              label: '开启投票',
              label: '开启',
              prop: 'openFlag',
              type: 'radio',
              button: true,
@@ -354,52 +345,7 @@
                value: 1
              }]
            },
            {
              labelWidth: 100,
              label: '人数限制',
              prop: 'numberRestrictions',
              type: 'number',
              button: true,
              row: true,
              min: 0,
              max: 99999999,
              controlsPosition: '',
              step: 10,
              offset: 6,
            }, {
              labelWidth: 100,
              label: '投票限制',
              prop: 'voteRestrictions',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '一人一票',
                value: 0
              }, {
                label: '一户一票',
                value: 1
              }]
            }, {
              labelWidth: 100,
              label: '用户限制',
              prop: 'userRestrictions',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '不限制',
                value: 0
              }, {
                label: '必须绑定手机',
                value: 1
              }, {
                label: '必须绑定房屋',
                value: 2
              }]
            },
            {
              label: "截止时间",
              row: true,
@@ -414,14 +360,12 @@
        optionDiscuss: {
          column: [{
              label: "",
              // labelWidth: 20,
              type: 'title',
              prop: "title",
              span: 24,
              row: true,
              offset: 2,
              styles: {
                // color: 'red',
                fontSize: '24px'
              }
            }, {
@@ -441,72 +385,18 @@
              }]
            }, {
              labelWidth: 100,
              label: '多房屋可重复',
              prop: 'repeatVote',
              label: '开启签名',
              prop: 'signatureFlag',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '不可以',
                label: '开启',
                value: 0
              }, {
                label: '可以',
                label: '不开启',
                value: 1
              }]
            }, {
              labelWidth: 100,
              label: '投票限制',
              prop: 'voteRestrictions',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '一人一票',
                value: 0
              }, {
                label: '一户一票',
                value: 1
              }]
            }, {
              labelWidth: 100,
              label: '用户限制',
              prop: 'userRestrictions',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '不限制',
                value: 0
              }, {
                label: '必须绑定手机',
                value: 1
              }, {
                label: '必须绑定房屋',
                value: 2
              }]
            }, {
              labelWidth: 100,
              label: '票数公开',
              prop: 'voteNumberPublic',
              type: 'radio',
              button: true,
              row: true,
              offset: 6,
              dicData: [{
                label: '全程公开',
                value: 0
              }, {
                label: '投票后公开',
                value: 1
              }, {
                label: '投票结束后公开',
                value: 2
              }, {
                label: '不公开',
                value: 3
              }]
            },
            {
@@ -518,35 +408,6 @@
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "timestamp",
            },
            // {
            //   labelWidth: 100,
            //   label: '人数限制',
            //   prop: 'numberRestrictions',
            //   type: 'number',
            //   button: true,
            //   row: true,
            //   min: 0,
            //   max: 99999999,
            //   controlsPosition: '',
            //   step: 10,
            //   offset: 6,
            // },
            // {
            //   labelWidth: 100,
            //   label: '指定用户',
            //   prop: 'appointUser',
            //   type: 'radio',
            //   button: true,
            //   row: true,
            //   offset: 6,
            //   dicData: [{
            //     label: '不限制',
            //     value: 0
            //   }, {
            //     label: '指定用户可见',
            //     value: 1
            //   }]
            // },
          ]
        },
        districtTree: [],
@@ -752,14 +613,14 @@
          getNotice(this.form.id).then((res) => {
            let data = res.data.data
            // data.forEach(item=>{
              if(data.url.length>0){
                var urls = []
                var names = data.url.split(",");
                names.forEach(name=>{
                  urls.push(website.minioUrl + name)
                })
                data.url = urls.join(",")
              }
            if (data.url.length > 0) {
              var urls = []
              var names = data.url.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              data.url = urls.join(",")
            }
            // })
            this.form = data;
          });
@@ -889,4 +750,4 @@
  .avue-upload__icon {
    line-height: 6;
  }
</style>
</style>
src/views/place/index.vue
@@ -17,16 +17,18 @@
    </avue-crud>
    <el-dialog title="场所维护" append-to-body :visible.sync="roleBox" center>
      <h3>基本信息:</h3>
      <avue-form :option="optionDetail" v-model="placeForm"></avue-form>
      <h3>从业人员:</h3>
      <avue-crud :option="placeOption" :search.sync="search" :table-loading="loading" :data="placeExt" ref="crud"
        v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel" @row-update="houseHoldRowUpdate"
        @row-save="houseHoldRowSave" :page.sync="holdPage" @current-change="currentChange" @size-change="sizeChange">
      </avue-crud>
      <avue-form :option="optionDetail" v-model="placeForm"></avue-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="roleBox = false">取 消</el-button>
        <el-button type="primary" @click="submitRole">确 定</el-button>
        <el-button type="primary" @click="submitRole">提 交</el-button>
      </span>
    </el-dialog>
src/views/userHouse/houseHoldList.vue
@@ -22,10 +22,6 @@
            <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
              @click="manageLabel(scope.row)">标签
            </el-button>
            <!--  <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入
            </el-button>
            <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
            </el-button> -->
          </template>
          <template slot-scope="{row}" slot="tenantName">
            <el-tag>{{ row.tenantName }}</el-tag>
@@ -52,20 +48,21 @@
          </span>
        </el-dialog>
        <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center   width="600px">
          <div id="" v-for="(item1,index1) in labelData">
        <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
          <div id="" v-for="(item,index) in labelData">
            <el-row>
              <el-col :span="24">
                <div>
                  <el-divider content-position="left">{{item1.name}}</el-divider>
                  <el-divider content-position="left">{{item.name}}</el-divider>
                </div>
              </el-col>
            </el-row>
            <div id="" class="grid-container2" v-if="item1.children">
                <div class="grid-item"  v-for="(item2,index2) in item1.children "    @click="changLabel(item2)">
                  {{item2.name}}
                </div>
            <div id="" class="grid-container2" v-if="item.children">
              <div class="grid-item" :style="{ backgroundColor: item2.color}" v-for="(item2,index2) in item.children "
                @click="changLabel(item2)">
                {{item2.name}}
              </div>
            </div>
          </div>
@@ -76,12 +73,13 @@
          </span>
        </el-dialog>
        <el-dialog :title="'编辑标签' +  currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
          <avue-form :option="labelOption" v-model="excelForm">
            <template slot="excelTemplate">
            </template>
        <el-dialog :title="'编辑标签   ' +  currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
          <avue-form :option="labelOption" v-model="labelForm" :submit="onsubmit">
          </avue-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="editLabelFlge = false">取 消</el-button>
            <el-button type="primary" @click="onsubmit">确 定</el-button>
          </span>
        </el-dialog>
@@ -105,8 +103,13 @@
    remove,
    add,
    update,
    getDetatil
    getDetatil,
    getDetatils
  } from "@/api/userHouse/list/houseHold.js";
  import {
    removeHouseholdLabel,
    saveOrUpdateHouseholdLabel
  } from "@/api/userHouse/list/userHouseList.js";
  import {
    getLabelList,
  } from '@/api/label/label'
@@ -222,30 +225,38 @@
        data: [],
        excelForm: {},
        labelForm: {},
        labelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [{
            label: '级别',
            prop: 'radio',
            prop: 'color',
            type: 'radio',
            button: true,
            row: true,
            dicData: [{
              label: '撤销',
              value: -1
              value: '#EBEDF0'
            }, {
              label: '绿',
              value: 0
              value: '#30D17C'
            }, {
              label: '黄',
              value: 1
              value: '#FFB42B'
            }, {
              label: '红',
              value: ''
              value: '#EA1F1F'
            }],
            rules: [{
              required: true,
              message: "请选择",
              trigger: "blur"
            }]
          }, {
            row: true,
            label: '备注',
            prop: 'input',
            prop: 'remark',
            type: 'input'
          }]
        },
@@ -296,7 +307,9 @@
            }
          ]
        },
        currentLabel:""
        currentLabel: {},
        currentRow: {},
        householdLabelList: [],
      };
    },
    watch: {},
@@ -314,19 +327,74 @@
    mounted() {},
    methods: {
      onsubmit() {
        if (this.labelForm.color === '#EBEDF0') {
          let params = {
            householdId: this.currentRow.id,
            labelId: this.currentLabel.id
          }
          removeHouseholdLabel(params).then(res => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.editLabelFlge = false
            this.manageLabel(this.currentRow)
            this.loading = false;
          })
        } else {
          this.labelForm.houseCode = this.currentRow.houseCode
          this.labelForm.householdId = this.currentRow.id
          this.labelForm.labelId = this.currentLabel.id
          this.labelForm.lableType = 1
          saveOrUpdateHouseholdLabel(this.labelForm).then(res => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.editLabelFlge = false
            this.manageLabel(this.currentRow)
            this.loading = false;
          })
        }
      },
      changLabel(item) {
        this.editLabelFlge = true
        this.currentLabel = item;
        this.labelForm.color = item.color
        this.labelForm.remark = item.remark
      },
      manageLabel() {
      manageLabel(item) {
        this.currentRow = item
        this.labelFlag = true
        let params = {
          parentId: 1000
        }
        // 查询标签
        getLabelList(Object.assign(params)).then(res => {
          const data = res.data.data;
          this.labelData = data;
          // this.labelData = data;
          this.loading = false;
          // 查询详情
          getDetatils(item.id).then(res => {
            this.householdLabelList = res.data.data.householdLabelList;
            this.loading = false;
            // 将细类放到一起
            data.forEach(e => {
              e.children.forEach(f => {
                if (this.householdLabelList.length > 0) {
                  this.householdLabelList.forEach(h => {
                    if (Number(f.id) == h.labelId) {
                      f['color'] = h.color
                      f['remark'] = h.remark
                    }
                  })
                }
              })
            })
            this.labelData = data;
          });
        });
      },
      rowSave(row, done, loading) {
@@ -490,18 +558,20 @@
    grid-gap: 10px; */
    display: flex;
    flex-wrap: wrap;
    padding-bottom:20px;
    padding-bottom: 20px;
  }
  .grid-item{
    padding:8px 14px;
    border:1px solid #dcdfe6;
    margin-right:10px;
    margin-bottom:10px;
  .grid-item {
    padding: 8px 14px;
    border: 1px solid #dcdfe6;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 20px;
  }
  .grid-item:hover{
  .grid-item:hover {
    background-color: #e8f4ff;
    color:#017BFC;
    color: #017BFC;
    cursor: pointer;
  }
@@ -512,4 +582,4 @@
  .box .el-scrollbar__wrap {
    overflow: scroll;
  }
</style>
</style>
src/views/userHouse/houseList.vue
@@ -2,8 +2,8 @@
  <el-row>
    <el-col :span="24">
      <basic-container>
        <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" v-model="form"
          :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
        <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud"
          v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
          :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
          @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
          @refresh-change="refreshChange" @on-load="onLoad">
@@ -22,7 +22,11 @@
            <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
              @click="handleHouseholdManager(scope.row)">住户管理
            </el-button>
            <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
              @click="manageLabel(scope.row)">标签
            </el-button>
          </template>
          <template slot-scope="{row}" slot="tenantName">
            <el-tag>{{ row.tenantName }}</el-tag>
          </template>
@@ -47,6 +51,29 @@
            <el-button type="primary" @click="submitRole">确 定</el-button>
          </span>
        </el-dialog>
        <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
          <div id="" class="grid-container2">
            <div class="grid-item" :style="{ backgroundColor: item.color}" v-for="(item,index) in labelData "
              @click="changLabel(item)">
              {{item.name}}
            </div>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button @click="labelFlag = false">取 消</el-button>
            <el-button type="primary" @click="submitRole">确 定</el-button>
          </span>
        </el-dialog>
        <el-dialog :title="'编辑标签   ' +  currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
          <avue-form :option="labelOption" v-model="labelForm" :submit="onsubmit">
          </avue-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="editLabelFlge = false">取 消</el-button>
            <el-button type="primary" @click="onsubmit">确 定</el-button>
          </span>
        </el-dialog>
        <el-dialog title="用户数据导入" append-to-body :visible.sync="excelBox" width="555px">
          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
            <template slot="excelTemplate">
@@ -57,7 +84,7 @@
          </avue-form>
        </el-dialog>
        <el-dialog title="住户管理" append-to-body :visible.sync="householdManagerVisible" width="70%" height="60%">
            <householdManager ref="householdManager"/>
          <householdManager ref="householdManager" />
        </el-dialog>
      </basic-container>
    </el-col>
@@ -65,383 +92,495 @@
</template>
<script>
import {
  getList,
  remove,
  add,
  update,
  getDetatil
} from "@/api/userHouse/list/house.js";
import {
  exportBlob
} from "@/api/common";
import {
  mapGetters
} from "vuex";
import website from '@/config/website';
import {
  getToken
} from '@/util/auth';
import {
  downloadXls
} from "@/util/util";
import {
  dateNow
} from "@/util/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import func from "@/util/func";
import householdManager from "./components/householdManager";
import Qs from "qs";
export default {
  components: {
    householdManager
  },
  data() {
    return {
      householdManagerVisible:false,
      form: {},
      search: {},
      excelBox: false,
      selectionList: [],
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      option: {
        height: 'auto',
        calcHeight: 80,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        selection: true,
        viewBtn: true,
        dialogType: 'drawer',
        dialogClickModal: false,
        menuWidth:280,
        column: [{
          label: "房屋编号",
          prop: "houseCode",
          width: 180,
          hide: true,
          display: false
        },
        {
          label: "地址",
          prop: "address",
          width: 180,
          display: false
        },
        {
          label: "小区",
          prop: "districtName",
          search: true,
          rules: [
            {
  import {
    getList,
    remove,
    add,
    update,
    getDetatil,
    getDetatils
  } from "@/api/userHouse/list/house.js";
  import {
    removeHouseholdLabel,
    saveOrUpdateHouseholdLabel
  } from "@/api/userHouse/list/userHouseList.js";
  import {
    getLabelList,
  } from '@/api/label/label'
  import {
    exportBlob
  } from "@/api/common";
  import {
    mapGetters
  } from "vuex";
  import website from '@/config/website';
  import {
    getToken
  } from '@/util/auth';
  import {
    downloadXls
  } from "@/util/util";
  import {
    dateNow
  } from "@/util/date";
  import NProgress from 'nprogress';
  import 'nprogress/nprogress.css';
  import func from "@/util/func";
  import householdManager from "./components/householdManager";
  import Qs from "qs";
  export default {
    components: {
      householdManager
    },
    data() {
      return {
        labelData: [],
        labelForm: {},
        userHouseLabelVOList: [],
        currentLabel: {},
        labelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [{
            label: '级别',
            prop: 'color',
            type: 'radio',
            button: true,
            row: true,
            dicData: [{
              label: '撤销',
              value: '#EBEDF0'
            }, {
              label: '绿',
              value: '#30D17C'
            }, {
              label: '黄',
              value: '#FFB42B'
            }, {
              label: '红',
              value: '#EA1F1F'
            }],
            rules: [{
              required: true,
              message: "请选择小区",
              trigger: "blur",
            },
          ],
        },
        {
          label: "手机",
          prop: "phone",
          rules: [
            {
              required: true,
              message: "请输入绑定手机",
              trigger: "blur",
            },
          ],
        },
        {
          label: "幢",
          prop: "building",
          hide: true
        },
        {
          label: "单元",
          prop: "unit",
          hide: true
        },
        {
          label: "室",
          prop: "room",
          hide: true
        },
        {
          label: "楼层",
          prop: "floor",
          type: "number",
          rules: [
            {
              required: true,
              message: "请输入楼层",
              trigger: "blur",
            },
          ],
        },
        {
          label: "面积",
          prop: "area",
          type: "number",
        },
        {
          label: "物业费",
          prop: "propertyPrice",
          type: "number",
        },
        {
          label: "服务到期",
          prop: "serviceDue",
          type: "datetime",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd",
        },
        ]
      },
      data: [],
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [{
          label: '模板上传',
          prop: 'excelFile',
          type: 'upload',
          drag: true,
          loadText: '模板上传中,请稍等',
          span: 24,
          propsHttp: {
            res: 'data'
          },
          tip: '请上传 .xls,.xlsx 标准格式文件',
          action: "/api/blade-system/user/import-user"
        },
        {
          label: "数据覆盖",
          prop: "isCovered",
          type: "switch",
          align: "center",
          width: 80,
          dicData: [{
            label: "否",
            value: 0
          },
          {
            label: "是",
            value: 1
          }
          ],
          value: 0,
          slot: true,
          rules: [{
            required: true,
            message: "请选择是否覆盖",
            trigger: "blur"
              message: "请选择",
              trigger: "blur"
            }]
          }, {
            row: true,
            label: '备注',
            prop: 'remark',
            type: 'input'
          }]
        },
        {
          label: '模板下载',
          prop: 'excelTemplate',
          formslot: true,
          span: 24,
        editLabelFlge: false,
        labelFlag: false,
        householdManagerVisible: false,
        form: {},
        search: {},
        excelBox: false,
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 80,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          viewBtn: true,
          dialogType: 'drawer',
          dialogClickModal: false,
          menuWidth: 280,
          column: [{
              label: "房屋编号",
              prop: "houseCode",
              width: 180,
              hide: true,
              display: false
            },
            {
              label: "地址",
              prop: "address",
              width: 180,
              display: false
            },
            {
              label: "小区",
              prop: "districtName",
              search: true,
              rules: [{
                required: true,
                message: "请选择小区",
                trigger: "blur",
              }, ],
            },
            {
              label: "手机",
              prop: "phone",
              rules: [{
                required: true,
                message: "请输入绑定手机",
                trigger: "blur",
              }, ],
            },
            {
              label: "幢",
              prop: "building",
              hide: true
            },
            {
              label: "单元",
              prop: "unit",
              hide: true
            },
            {
              label: "室",
              prop: "room",
              hide: true
            },
            {
              label: "楼层",
              prop: "floor",
              type: "number",
              rules: [{
                required: true,
                message: "请输入楼层",
                trigger: "blur",
              }, ],
            },
            {
              label: "面积",
              prop: "area",
              type: "number",
            },
            {
              label: "物业费",
              prop: "propertyPrice",
              type: "number",
            },
            {
              label: "服务到期",
              prop: "serviceDue",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
            },
          ]
        },
        data: [],
        excelForm: {},
        excelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [{
              label: '模板上传',
              prop: 'excelFile',
              type: 'upload',
              drag: true,
              loadText: '模板上传中,请稍等',
              span: 24,
              propsHttp: {
                res: 'data'
              },
              tip: '请上传 .xls,.xlsx 标准格式文件',
              action: "/api/blade-system/user/import-user"
            },
            {
              label: "数据覆盖",
              prop: "isCovered",
              type: "switch",
              align: "center",
              width: 80,
              dicData: [{
                  label: "否",
                  value: 0
                },
                {
                  label: "是",
                  value: 1
                }
              ],
              value: 0,
              slot: true,
              rules: [{
                required: true,
                message: "请选择是否覆盖",
                trigger: "blur"
              }]
            },
            {
              label: '模板下载',
              prop: 'excelTemplate',
              formslot: true,
              span: 24,
            }
          ]
        }
        ]
      }
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.house_add, true),
        viewBtn: this.vaildData(this.permission.house_view, true),
        delBtn: this.vaildData(this.permission.house_delete, true),
        editBtn: this.vaildData(this.permission.house_edit, true)
      };
    }
  },
  mounted() {
  },
  methods: {
    handleHouseholdManager(row){
      var that = this
      this.householdManagerVisible = true
      this.$nextTick(() => {
        that.$refs.householdManager.init(row)
        })
    },
    rowSave(row, done, loading) {
      add(row).then(() => {
        this.initFlag = false;
        this.onLoad(this.page);
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        done();
      }, error => {
        window.console.log(error);
        loading();
      });
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(() => {
        this.initFlag = false;
        this.onLoad(this.page);
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        done();
      }, error => {
        window.console.log(error);
        loading();
      });
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    searchReset() {
      this.query = {};
      this.treeDeptId = '';
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
    watch: {},
    computed: {
      ...mapGetters(["userInfo", "permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.house_add, true),
          viewBtn: this.vaildData(this.permission.house_view, true),
          delBtn: this.vaildData(this.permission.house_delete, true),
          editBtn: this.vaildData(this.permission.house_edit, true)
        };
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    handleImport() {
      this.excelBox = true;
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
    handleExport() {
      this.$confirm("是否导出房屋数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        NProgress.start();
        var data = {
          ...this.query
    mounted() {},
    methods: {
      onsubmit() {
        if (this.labelForm.color === '#EBEDF0') {
          let params = {
            householdId: this.currentRow.id,
            labelId: this.currentLabel.id
          }
          removeHouseholdLabel(params).then(res => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.editLabelFlge = false
            this.manageLabel(this.currentRow)
            this.loading = false;
          })
        } else {
          this.labelForm.houseCode = this.currentRow.houseCode
          this.labelForm.householdId = this.currentRow.id
          this.labelForm.labelId = this.currentLabel.id
          this.labelForm.lableType = 2
          saveOrUpdateHouseholdLabel(this.labelForm).then(res => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.editLabelFlge = false
            this.manageLabel(this.currentRow)
            this.loading = false;
          })
        }
        data = Qs.stringify(data);
        exportBlob(
          `/api/blade-house/house/export-house?${this.website.tokenHeader}=${getToken()}&` + data
        ).then(res => {
          downloadXls(res.data, `房屋数据表${dateNow()}.xlsx`);
          NProgress.done();
      },
      changLabel(item) {
        this.editLabelFlge = true
        this.currentLabel = item;
        this.labelForm.color = item.color
        this.labelForm.remark = item.remark
      },
      manageLabel(item) {
        this.currentRow = item
        this.labelFlag = true
        let params = {
          parentId: 1001
        }
        // 查询标签
        getLabelList(Object.assign(params)).then(res => {
          const data = res.data.data;
          this.loading = false;
          // 查询详情
          getDetatils({
            houseCode: item.houseCode
          }).then(res => {
            if (res.data.data) {
              this.userHouseLabelVOList = res.data.data.userHouseLabelVOList;
              this.loading = false;
              // 将细类放到一起
              data.forEach(f => {
                if (this.userHouseLabelVOList.length > 0) {
                  this.userHouseLabelVOList.forEach(h => {
                    if (Number(f.id) == h.labelId) {
                      f['color'] = h.color
                      f['remark'] = h.remark
                    }
                  })
                }
              })
            }
            this.labelData = data;
          });
        });
      },
      handleHouseholdManager(row) {
        var that = this
        this.householdManagerVisible = true
        this.$nextTick(() => {
          that.$refs.householdManager.init(row)
        })
      });
    },
    handleTemplate() {
      exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
        downloadXls(res.data, "房屋数据模板.xlsx");
      })
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetatil({
          id: this.form.id
        }).then(res => {
          this.form = res.data.data;
      },
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.initFlag = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.initFlag = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      searchReset() {
        this.query = {};
        this.treeDeptId = '';
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      handleImport() {
        this.excelBox = true;
      },
      uploadAfter(res, done, loading, column) {
        window.console.log(column);
        this.excelBox = false;
        this.refreshChange();
        done();
      },
      handleExport() {
        this.$confirm("是否导出房屋数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          NProgress.start();
          var data = {
            ...this.query
          }
          data = Qs.stringify(data);
          exportBlob(
            `/api/blade-house/house/export-house?${this.website.tokenHeader}=${getToken()}&` + data
          ).then(res => {
            downloadXls(res.data, `房屋数据表${dateNow()}.xlsx`);
            NProgress.done();
          })
        });
      },
      handleTemplate() {
        exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
          downloadXls(res.data, "房屋数据模板.xlsx");
        })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetatil({
            id: this.form.id
          }).then(res => {
            this.form = res.data.data;
          });
        }
        this.initFlag = true;
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
      this.initFlag = true;
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    }
  }
};
  };
</script>
<style>
.box {
  height: 800px;
}
  .box {
    height: 800px;
  }
.el-scrollbar {
  height: 100%;
}
  .el-scrollbar {
    height: 100%;
  }
.box .el-scrollbar__wrap {
  overflow: scroll;
}
</style>
  .box .el-scrollbar__wrap {
    overflow: scroll;
  }
</style>
vue.config.js
@@ -26,8 +26,8 @@
    proxy: {
      '/api': {
        //本地服务接口地址
        // target: 'http://localhost:9528',
        target: 'http://192.168.0.102:9528',
        target: 'http://localhost:9528',
        // target: 'http://192.168.0.102:9528',
        //远程演示服务地址,可用于直接启动项目
        //target: 'https://saber.bladex.cn/api',
        changeOrigin: true,