zhongrj
2023-11-22 78afae3aa974b72d1f83a72ad26f242667295709
src/views/userHouse/hireInfoList.vue
@@ -8,14 +8,14 @@
          @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
          @refresh-change="refreshChange" @on-load="onLoad">
          <template slot="menuLeft">
            <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.user_delete"
            <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.houseRental_delete"
              @click="handleDelete">删 除
            </el-button>
            <el-button type="success" size="small" plain v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-upload2" @click="handleImport">导入
            <el-button type="success" size="small" plain v-if="permission.houseRental_import" icon="el-icon-upload2"
              @click="handleImport">导入
            </el-button>
            <el-button type="warning" size="small" plain v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-download" @click="handleExport">导出
            <el-button type="warning" size="small" plain v-if="permission.houseRental_export" icon="el-icon-download"
              @click="handleExport">导出
            </el-button>
          </template>
          <template slot-scope="{row}" slot="tenantName">
@@ -66,6 +66,10 @@
  getDetatil
} from "@/api/userHouse/list/houseRental.js";
import {
  getList as getHouseList,
  getDetatil as getHouseDetail
} from "@/api/userHouse/list/house.js";
import {
  exportBlob
} from "@/api/common";
import {
@@ -84,6 +88,7 @@
import 'nprogress/nprogress.css';
import func from "@/util/func";
import Qs from "qs";
import website from '@/config/website';
export default {
  data() {
    return {
@@ -108,128 +113,265 @@
        index: true,
        selection: true,
        viewBtn: true,
        addBtn:true,
        addBtn: true,
        dialogType: 'drawer',
        dialogClickModal: false,
        column: [{
          label: "房屋",
          prop: "address",
          display: false
        },
        {
          label: "关系",
          prop: "tenantRelationship",
          search: true,
          searchSpan: 4,
          width: 100,
          type: "select",
          dicData: [
            {
              label: "同一户",
              value: 1
        column: [
          {
            label: "房屋",
            prop: "address",
            display: false
          },
          {
            label: "房屋",
            prop: "houseCode",
            hide: true,
            type: "table",
            children: {
              border: true,
              height: 400,
              searchShow: true,
              searchMenuSpan: 6,
              submitText: "确定",
              column: [
                {
                  label: "小区",
                  prop: "districtName",
                  search: true,
                  searchSpan: 4,
                  rules: [
                    {
                      required: true,
                      message: "请选择小区",
                      trigger: "blur",
                    },
                  ],
                }, {
                  label: "地址",
                  prop: "address",
                  width: 180,
                  display: false
                },
                {
                  label: "手机",
                  prop: "phone",
                  rules: [
                    {
                      required: true,
                      message: "请输入绑定手机",
                      trigger: "blur",
                    },
                  ],
                },],
            },
            {
              label: "不同一户",
              value: 2
            page: {
              pageSize: 10,
              currentPage: 1,
              total: 0
            },
            formatter: (row) => {
              console.log(row,888)
              if (!row.districtName) return ''
              return row.districtName + '-' + row.unit  + row.building  + row.room
            },
            onLoad: ({ page, value, data }, callback) => {
              //首次加载去查询对应的值
              if (value) {
                getHouseDetail({
                  houseCode: value
                }).then(res => {
                  var resData = res.data.data;
                  // 查询对应行数据
                  callback(resData)
                  return
                });
              }
              if (page) {
                this.loading = true;
                getHouseList(page.currentPage, page.pageSize, Object.assign(data)).then(res => {
                  const resData = res.data.data;
                  var total = resData.total;
                  var data = resData.records;
                  this.loading = false;
                  this.selectionClear();
                  //分页查询信息
                  callback({
                    total: total,
                    data: data
                  })
                });
              }
            },
            props: {
              label: 'address',
              value: 'houseCode'
            }
          ],
        },
        {
          label: "房屋状态",
          prop: "houseStatus",
          search: true,
          searchSpan: 4,
          width: 100,
          type: "select",
          dicData: [
            {
              label: "部分出租",
              value: 1
          },
          {
            label: "关系",
            prop: "tenantRelationship",
            search: true,
            searchSpan: 4,
            width: 100,
            type: "select",
            dicData: [
              {
                label: "同一户",
                value: 1
              },
              {
                label: "不同一户",
                value: 2
              }
            ],
            rules: [
              {
                required: true,
                message: "请选择关系",
                trigger: "blur",
              },
            ],
          },
          {
            label: "房屋状态",
            prop: "houseStatus",
            search: true,
            searchSpan: 4,
            width: 100,
            type: "select",
            dicData: [
              {
                label: "部分出租",
                value: 1
              },
              {
                label: "全部出租",
                value: 2
              }
            ],
            rules: [
              {
                required: true,
                message: "请选择房屋状态",
                trigger: "blur",
              },
            ],
          },
          {
            label: "用途",
            prop: "rentalUse",
            type: "select",
            search: true,
            searchSpan: 3,
            dataType: "number",
            width: 100,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=rentalUseType",
            props: {
              label: "dictValue",
              value: "dictKey",
            },
            {
              label: "全部出租",
              value: 2
            }
          ],
        },
        {
          label: "租房时间",
          prop: "rentalTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd",
          width: 100,
        },
        {
          label: "到期时间",
          prop: "dueTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd",
          width: 100
        },
        {
          label: "用途",
          prop: "rentalUse",
          type: "select",
          search: true,
          searchSpan: 3,
          dataType: "number",
          width: 100,
          dicUrl: "/api/blade-system/dict-biz/dictionary?code=rentalUseType",
          props: {
            label: "dictValue",
            value: "dictKey",
          }
        },
        {
          label: "租赁期限",
          prop: "dldType",
          width: 100,
          display: false,
          search: true,
          searchSpan: 3,
          type: "select",
          dicData: [
            {
              label: "长期",
              value: 1
            rules: [
              {
                required: true,
                message: "请选择用途",
                trigger: "blur",
              },
            ],
          },
          {
            label: "租房时间",
            prop: "rentalTime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            width: 100,
            rules: [
              {
                required: true,
                message: "请选择租房时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "到期时间",
            prop: "dueTime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            width: 100,
            rules: [
              {
                required: true,
                message: "请选择到期时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "租赁期限",
            prop: "dldType",
            width: 100,
            display: false,
            search: true,
            searchSpan: 3,
            type: "select",
            dicData: [
              {
                label: "长期",
                value: 1
              },
              {
                label: "中期",
                value: 2
              },
              {
                label: "短期",
                value: 3
              }
            ],
          },
          {
            label: "审核状态",
            prop: "auditStatus",
            type: "select",
            width: 80,
            search: true,
            searchSpan: 4,
            display: false,
            dicData: [
              {
                label: "已确认",
                value: 1
              },
              {
                label: "待确认",
                value: 0
              }
            ],
          },
          {
            label: "创建时间",
            prop: "createTime",
            display: false,
            width: 160,
          },
          {
            label: "合同",
            prop: "fileUrls",
            // align:'center',
            width: 80,
            type: "upload",
            listType: "picture-img",
            action: "/api/blade-resource/oss/endpoint/put-file",
            propsHttp: {
              res: "data",
              url: "link",
            },
            {
              label: "中期",
              value: 2
            },
            {
              label: "短期",
              value: 3
            }
          ],
        },
        {
          label: "审核状态",
          prop: "auditStatus",
          type: "select",
          width: 80,
          search: true,
          searchSpan: 4,
          display: false,
          dicData: [
            {
              label: "已确认",
              value: 1
            },
            {
              label: "待确认",
              value: 0
            }
          ],
        },
        {
          label: "创建时间",
          prop: "createTime",
          display: false,
          width: 160,
        },
            hide: true,
            span: 24,
          },
        ]
      },
      data: [],
@@ -290,10 +432,10 @@
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.household_add, false),
        viewBtn: this.vaildData(this.permission.household_view, false),
        delBtn: this.vaildData(this.permission.household_delete, false),
        editBtn: this.vaildData(this.permission.household_edit, false)
        addBtn: this.vaildData(this.permission.houseRental_add, true),
        viewBtn: this.vaildData(this.permission.houseRental_view, true),
        delBtn: this.vaildData(this.permission.houseRental_delete, true),
        editBtn: this.vaildData(this.permission.houseRental_edit, true)
      };
    }
  },
@@ -301,6 +443,15 @@
  },
  methods: {
    rowSave(row, done, loading) {
      if (row.fileUrls.length > 0) {
        var urls = []
        var split = row.fileUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.fileUrls = urls.join(",")
      }
      add(row).then(() => {
        this.initFlag = false;
        this.onLoad(this.page);
@@ -315,6 +466,15 @@
      });
    },
    rowUpdate(row, index, done, loading) {
      if (row.fileUrls.length > 0) {
        var urls = []
        var split = row.fileUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.fileUrls = urls.join(",")
      }
      update(row).then(() => {
        this.initFlag = false;
        this.onLoad(this.page);
@@ -424,6 +584,14 @@
      if (["edit", "view"].includes(type)) {
        getDetatil(this.form.id).then(res => {
          this.form = res.data.data;
          if (this.form.fileUrls.length > 0) {
            var urls = []
            var names = this.form.fileUrls.split(",");
            names.forEach(name => {
              urls.push(website.minioUrl + name)
            })
            this.form.fileUrls = urls.join(",")
          }
        });
      }
      this.initFlag = true;
@@ -440,10 +608,20 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
      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.data.forEach(item => {
          if (item.fileUrls.length > 0) {
            var urls = []
            var names = item.fileUrls.split(",");
            names.forEach(name => {
              urls.push(website.minioUrl + name)
            })
            item.fileUrls = urls.join(",")
          }
        })
        this.loading = false;
        this.selectionClear();
      });