Lou
2024-03-05 294004d03c266c94822d02dea720f47364799275
场所管理、出租房管理修改
3 files modified
1 files added
851 ■■■■■ changed files
src/views/userHouse/components/retalInfo.vue 813 ●●●●● patch | view | raw | blame | history
src/views/userHouse/hireInfoList.vue 31 ●●●● patch | view | raw | blame | history
src/views/userHouse/houseHoldList.vue 3 ●●●● patch | view | raw | blame | history
vue.config.js 4 ●●●● patch | view | raw | blame | history
src/views/userHouse/components/retalInfo.vue
New file
@@ -0,0 +1,813 @@
<template>
    <el-dialog class="place-info-box" title="编辑" append-to-body :visible.sync="roleBox" center @close="roleBoxClose">
        <div class="cur-container-box">
            <div class="content-box">
                <box-title class="m10" :classVal="9" :title="'基本信息'"></box-title>
                <avue-form v-if="baseShow" ref="baseForm" :option="option" v-model="form">
                </avue-form>
                <!-- <box-title class="m10" :classVal="9" :title="'租客信息'"></box-title>
                <avue-crud :option="placeOption" :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="holdCurrentChange" @size-change="holdSizeChange"
                    @refresh-change="refreshHoldChange" @on-load="holdOnLoad">
                </avue-crud> -->
            </div>
            <div class="footer-btn-box">
                <el-button size="small" type="primary" @click="dataUpdate">保 存</el-button>
                <el-button size="small" @click="roleBoxClose">关 闭</el-button>
            </div>
        </div>
    </el-dialog>
</template>
<script>
import {
    getPlace,
    getPlaceExt,
    holdRemove,
    holdAdd,
    holdUpdate,
    getHoldList,
    updatePlaceExt,
} from "@/api/place/place"
import {
    getPlaceList
} from "@/api/doorplateAddress/doorplateAddress"
import website from "@/config/website"
import {
    getList as getHouseList,
    getDetatil as getHouseDetail
} from "@/api/userHouse/list/house.js"
import {
    getDetatil,
    update
} from "@/api/userHouse/list/houseRental.js"
import boxTitle from "./boxTitle"
export default {
    data() {
        //手机号格式校验
        let validatorPhone = function (rule, value, callback) {
            if (value) {
                if (!/^1[3456789]\d{9}$/.test(value)) {
                    callback(new Error("手机号格式有误!"))
                } else {
                    callback()
                }
            }
            callback()
        }
        return {
            roleBox: false,
            baseShow: false,
            restShow: false,
            placeExt: [],
            form: {},
            option: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "房屋",
                        prop: "houseName",
                        display: false
                    },
                    {
                        label: "房屋",
                        prop: "houseCode",
                        hide: true,
                        type: "table",
                        children: {
                            border: true,
                            height: 400,
                            searchShow: true,
                            searchMenuSpan: 6,
                            submitText: "确定",
                            column: [
                                // {
                                //     width: 220,
                                //     overHidden: true,
                                //     label: '小区名称',
                                //     prop: "districtName",
                                //     search: true,
                                //     searchSpan: 4,
                                //     rules: [{
                                //         required: true,
                                //         message: "请输入小区名称",
                                //         trigger: "blur",
                                //     },],
                                // },
                                {
                                    label: "地址",
                                    prop: "address",
                                    minWidth: 180,
                                    display: false
                                },
                            ],
                        },
                        page: {
                            pageSize: 10,
                            currentPage: 1,
                            total: 0
                        },
                        formatter: (row) => {
                            return row.houseName
                        },
                        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: "tenantRelationship",
                        search: true,
                        searchSpan: 3,
                        searchLabelWidth: 46,
                        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",
                        searchSpan: 3,
                        searchLabelWidth: 66,
                        search: true,
                        dataType: "number",
                        width: 100,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=rentalUseType",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [{
                            required: true,
                            message: "请选择用途",
                            trigger: "blur",
                        },],
                    },
                    {
                        width: 100,
                        label: "租房时间",
                        prop: "rentalTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        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: 4,
                        type: "select",
                        dicData: [{
                            label: "长期",
                            value: 1
                        },
                        {
                            label: "中期",
                            value: 2
                        },
                        {
                            label: "短期",
                            value: 3
                        }
                        ],
                    },
                    {
                        width: 80,
                        label: "审核状态",
                        prop: "auditStatus",
                        type: "select",
                        search: true,
                        searchSpan: 4,
                        display: false,
                        slot: true,
                        dicData: [
                            {
                                label: "已确认",
                                value: 1
                            },
                            {
                                label: "待确认",
                                value: 0
                            }
                        ],
                    },
                    {
                        width: 144,
                        label: "创建时间",
                        prop: "createTime",
                        display: false,
                    },
                    {
                        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",
                        },
                        hide: true,
                        span: 24,
                    },
                ]
            },
            placeForm: {},
            optionDetail: {
                submitBtn: false,
                emptyBtn: false,
                column: [{
                    label: "法人信息",
                    prop: "legalPerson",
                },
                {
                    width: 96,
                    label: "法人电话",
                    prop: "legalTel",
                    search: true,
                    searchSpan: 4,
                    slot: true,
                    overHidden: true,
                    rules: [{
                        validator: validatorPhone,
                        trigger: "blur",
                    },],
                },
                {
                    label: "营业执照",
                    prop: "imageUrls",
                    width: 80,
                    type: "upload",
                    listType: "picture-card",
                    dataType: "string",
                    multiple: true,
                    action: "/api/blade-resource/oss/endpoint/put-file",
                    propsHttp: {
                        res: "data",
                        name: "name",
                        url: "link",
                    },
                    span: 24,
                },
                {
                    label: "场所平面图",
                    prop: "planImageUrls",
                    width: 80,
                    type: "upload",
                    listType: "picture-card",
                    dataType: "string",
                    multiple: true,
                    action: "/api/blade-resource/oss/endpoint/put-file",
                    propsHttp: {
                        res: "data",
                        name: "name",
                        url: "link",
                    },
                    span: 24,
                },
                ],
            },
            loading: true,
            placeOption: {
                menu: true,
                height: 300,
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: false,
                addBtn: true,
                delBtn: true,
                editBtn: true,
                border: true,
                index: true,
                dialogClickModal: false,
                column: [{
                    label: "姓名",
                    prop: "name",
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "电话",
                    prop: "phoneNumber",
                    width: 100,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "身份证号",
                    prop: "idCard",
                    width: 160,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "性别",
                    prop: "gender",
                    type: "select",
                    dicData: [{
                        label: "男",
                        value: 1
                    },
                    {
                        label: "女",
                        value: 0
                    },
                    {
                        label: "未知",
                        value: 1
                    }
                    ],
                },
                {
                    label: "关系",
                    prop: "relationship",
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                    display: false
                },
                {
                    width: 220,
                    overHidden: true,
                    label: '小区名称',
                    prop: "aoiName",
                    // search: true,
                    searchSpan: 4,
                    display: false
                },
                {
                    label: "地址",
                    prop: "address",
                    minWidth: 160,
                    overHidden: true,
                    display: false
                },
                ]
            },
            holdPage: {
                pageSize: 20,
                currentPage: 1,
                total: 0,
            },
            houseHoldForm: {},
        }
    },
    components: {
        boxTitle
    },
    inject: ["placeElement"],
    watch: {
        'form.isNine': {
            handler(newData) {
                if (newData) {
                    let nineTypeColumn = this.findObject(
                        this.option.column,
                        'nineType'
                    )
                    if (newData == 1) {
                        nineTypeColumn.display = true
                    } else {
                        nineTypeColumn.display = false
                    }
                }
            },
        },
        'form.isFront': {
            handler(newData) {
                if (newData) {
                    let frontTypeColumn = this.findObject(
                        this.option.column,
                        'frontType'
                    )
                    if (newData == 1) {
                        frontTypeColumn.display = true
                    } else {
                        frontTypeColumn.display = false
                    }
                }
            },
        }
    },
    methods: {
        initOpen(newData) {
            this.getInfo(newData);
            this.roleBox = true
            this.baseShow = true
            this.restShow = false
            return;
            this.curRow = newData
            this.roleBox = true
            this.baseShow = false
            this.restShow = false
            this.form = {}
            this.placeForm = {}
            const that = this
            that.$axios
                .all([getPlace(newData["id"]), getPlaceExt({
                    placeId: newData["id"]
                }), getPlaceList()])
                .then(
                    that.$axios.spread(function (baseInfo, restInfo) {
                        that.form = baseInfo.data.data
                        that.form.location = [
                            that.form.lng,
                            that.form.lat,
                            that.form.location,
                        ].join(",")
                        if (that.form.imageUrls && that.form.imageUrls.length) {
                            that.form.imageUrls = that.form.imageUrls
                                .split(",")
                                .filter((item) => item != "")
                                .map((item) => website.minioUrl + item)
                                .join(",")
                        }
                        if (
                            that.form.placePoiLabelVOList &&
                            that.form.placePoiLabelVOList.length
                        ) {
                            let lebelTwo = that.form.placePoiLabelVOList.find((item) => {
                                return item.type == 2
                            })
                            if (lebelTwo) that.form.label = String(lebelTwo.poiCode)
                            let lebelThree = that.form.placePoiLabelVOList.find((item) => {
                                return item.type == 3
                            })
                            if (lebelThree) that.form.smallLabel = String(lebelThree.poiCode)
                        }
                        that.baseShow = true
                        const data = restInfo.data.data
                        if (data) {
                            let imageUrls = data.imageUrls
                            let planImageUrls = data.planImageUrls
                            if (imageUrls && imageUrls.length) {
                                imageUrls = imageUrls
                                    .split(",")
                                    .filter((item) => item != "")
                                    .map((item) => website.minioUrl + item)
                                    .join(",")
                            }
                            if (planImageUrls && planImageUrls.length) {
                                planImageUrls = planImageUrls
                                    .split(",")
                                    .filter((item) => item != "")
                                    .map((item) => website.minioUrl + item)
                                    .join(",")
                            }
                            that.placeForm = {
                                ...data,
                                imageUrls,
                                planImageUrls,
                            }
                        }
                        that.restShow = true
                    })
                )
        },
        getInfo(id) {
            getDetatil(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(",")
                }
            })
        },
        locationDispose(data) {
            data = data.split(",")
            return {
                longitude: data[0],
                latitude: data[1],
                location: data[2],
            }
        },
        selectionClear() {
            this.$nextTick(() => {
                this.$refs.crud && this.$refs.crud.toggleSelection()
            })
        },
        houseHoldRowUpdate(row, index, done, loading) {
            holdUpdate(row).then(
                () => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        houseHoldRowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return holdRemove(row.id)
                })
                .then(() => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        houseHoldRowSave(row, done, loading) {
            holdAdd({
                ...row,
                placeId: this.curRow.id,
            }).then(
                () => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        refreshHoldChange() {
            this.holdOnLoad(this.holdPage)
        },
        holdOnLoad(holdPage, params = {}) {
            if (!this.curRow.id) return
            let values = {
                ...params,
                placeId: this.curRow.id,
            }
            getHoldList(holdPage.currentPage, holdPage.pageSize, values).then(
                (res) => {
                    const data = res.data.data
                    this.holdPage.total = data.total
                    this.placeExt = data.records
                    this.loading = false
                    this.selectionClear()
                }
            )
        },
        holdCurrentChange(currentPage) {
            this.holdPage.currentPage = currentPage
        },
        holdSizeChange(pageSize) {
            this.holdPage.pageSize = pageSize
        },
        desposeImage(data) {
            if (data) {
                if (data.length > 0) {
                    var urls = []
                    var split = data.split(",").filter((item) => item != "")
                    split.forEach((url) => {
                        var names = url.split("jczz/")
                        urls.push(names[1])
                    })
                    data = urls.join(",")
                }
            }
            return data
        },
        dataUpdate() {
            this.$refs.baseForm.validate((valid, done, msg) => {
                if (valid) {
                    if (this.form.fileUrls.length > 0) {
                var urls = []
                var split = this.form.fileUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                this.form.fileUrls = urls.join(",")
            }
            update(this.form).then(() => {
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                this.getInfo(this.form.id);
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
                } else {
                    console.log("error submit!!")
                    return false
                }
            })
        },
        roleBoxClose() {
            this.form = {}
            this.placeForm = {}
            this.$refs.baseForm && this.$refs.baseForm.resetForm()
            this.$refs.restForm && this.$refs.restForm.resetForm()
            this.baseShow = false
            this.restShow = false
            this.roleBox = false
        },
    },
}
</script>
<style lang="scss" scoped>
.cur-container-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    .content-box {
        margin: 0 4px;
        padding: 0 10px;
        height: 0;
        flex: 1;
        overflow: hidden;
        overflow-y: auto;
    }
    .footer-btn-box {
        margin-top: 10px;
        display: flex;
        justify-content: center;
    }
}
</style>
src/views/userHouse/hireInfoList.vue
@@ -17,9 +17,15 @@
                        <el-button type="danger" size="small" plain icon="el-icon-delete"
                            v-if="permission.houseRental_delete" @click="handleDelete">删 除
                        </el-button>
                    </template>
                    <template slot-scope="{row, size}" slot="menu">
                        <!-- <el-button type="text" :size="size" icon="el-icon-edit" v-if="permission.houseRental_edit"
                            @click="showEditMoel(row)">编 辑
                        </el-button> -->
                        <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
                            v-if="permission.househould_manager" @click="ManageTenants(row)">管理租户
                        </el-button>
@@ -31,16 +37,17 @@
                </avue-crud>
                <el-dialog title="租户管理" append-to-body :visible.sync="roleBox">
                    <avue-crud :option="houseHoldOption" :search.sync="search" :table-loading="loading" :data="houseHold"
                        ref="crud" v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel"
                        @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave" :page.sync="holdPage"
                        @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
                        @current-change="currentChange" @size-change="sizeChange"
                    <avue-crud :option="houseHoldOption" :search.sync="search" :table-loading="loading"
                        :data="houseHold" ref="crud" v-model="houseHoldForm" :permission="permissionList"
                        @row-del="houseHoldRowDel" @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave"
                        :page.sync="holdPage" @search-change="searchChange" @search-reset="searchReset"
                        @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
                        @refresh-change="refreshChange"></avue-crud>
                </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">
                            <el-button type="primary" @click="handleTemplate">
                                点击下载<i class="el-icon-download el-icon--right"></i>
@@ -48,6 +55,10 @@
                        </template>
                    </avue-form>
                </el-dialog>
                <retalInfo ref="RetalInfo"></retalInfo>
            </basic-container>
        </el-col>
    </el-row>
@@ -93,7 +104,10 @@
import func from "@/util/func"
import Qs from "qs"
import website from '@/config/website'
import retalInfo from './components/retalInfo'
export default {
    components: {retalInfo},
    data () {
        return {
            roleBox: false,
@@ -214,6 +228,7 @@
                selection: true,
                viewBtn: true,
                addBtn: true,
                // editBtn: false,
                dialogType: 'drawer',
                dialogClickModal: false,
                column: [
@@ -795,7 +810,11 @@
                this.loading = false
                this.selectionClear()
            })
        }
        },
        showEditMoel(item) {
            this.$refs.RetalInfo.initOpen(item.id)
        },
    }
}
</script>
src/views/userHouse/houseHoldList.vue
@@ -233,7 +233,8 @@
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                    dataType: "number",
                    hide: true,
                    // hide: true,
                    width: 120,
                    props: {
                        label: "dictValue",
                        value: "dictKey",
vue.config.js
@@ -38,8 +38,8 @@
        proxy: {
            "/api": {
                //本地服务接口地址
                target:"http://192.168.2.140:9528",
                // target: "https://srgdjczzxtpt.com:2080/api",
                // target:"http://192.168.2.140:9528",
                target: "https://srgdjczzxtpt.com:2080/api",
                // target: "https://kt39592615.goho.co",
                // target: "http://z4042833u6.wicp.vip",
                // target: "http://localhost:9528",