lin
2024-03-11 12bf2d64efe9c62a33fc10b1acdca9ecfcd10fce
src/views/userHouse/hireInfoList.vue
@@ -14,15 +14,30 @@
                    </template>
                    <template slot="menuLeft">
                        <el-button type="danger" :size="size" plain icon="el-icon-delete"
                        <el-button type="primary" size="small" plain icon="el-icon-plus"
                            v-if="permission.houseRental_add" @click="showEditMoel(1)">新 增
                        </el-button>
                        <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(2,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>
                        <!-- <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
                             @click="ManageTenants(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">导出
@@ -31,21 +46,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>
                    <span slot="footer" class="dialog-footer">
                        <el-button @click="roleBox = false">取 消</el-button>
                        <el-button type="primary" @click="submitRole">确 定</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">
                            <el-button type="primary" @click="handleTemplate">
                                点击下载<i class="el-icon-download el-icon--right"></i>
@@ -53,6 +64,10 @@
                        </template>
                    </avue-form>
                </el-dialog>
                <retalInfo ref="RetalInfo"></retalInfo>
            </basic-container>
        </el-col>
    </el-row>
@@ -98,8 +113,11 @@
import func from "@/util/func"
import Qs from "qs"
import website from '@/config/website'
import retalInfo from './components/retalInfo'
export default {
    data () {
    components: {retalInfo},
    data() {
        return {
            roleBox: false,
            form: {},
@@ -125,7 +143,7 @@
                total: 0
            },
            houseHoldOption: {
                height: 'auto',
                height: '500',
                calcHeight: 80,
                tip: false,
                searchShow: true,
@@ -146,12 +164,14 @@
                {
                    label: "电话",
                    prop: "phoneNumber",
                    width: 100,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "身份证号",
                    prop: "idCard",
                    width: 160,
                    // search: true,
                    searchSpan: 4,
                },
@@ -197,6 +217,8 @@
                {
                    label: "地址",
                    prop: "address",
                    minWidth: 160,
                    overHidden: true,
                    display: false
                },
                ]
@@ -207,7 +229,6 @@
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                height: 'auto',
                calcHeight: 80,
                tip: false,
@@ -215,21 +236,23 @@
                index: true,
                selection: true,
                viewBtn: true,
                addBtn: true,
                addBtn: false,
                editBtn: false,
                dialogType: 'drawer',
                dialogClickModal: false,
                column: [
                    {
                        label: "房屋",
                        prop: "address",
                        display: false
                        prop: "houseName",
                        display: false,
                        width:120
                    },
                    {
                        label: "房屋",
                        prop: "houseCode",
                        hide: true,
                        type: "table",
                        children: {
                            border: true,
                            height: 400,
@@ -237,33 +260,24 @@
                            searchMenuSpan: 6,
                            submitText: "确定",
                            column: [
                                {
                                    width: 220,
                                    overHidden: true,
                                    label: '小区名称',
                                    prop: "districtName",
                                    search: true,
                                    searchSpan: 4,
                                    rules: [{
                                        required: true,
                                        message: "请输入小区名称",
                                        trigger: "blur",
                                    },],
                                },
                                // {
                                //     width: 220,
                                //     overHidden: true,
                                //     label: '小区名称',
                                //     prop: "districtName",
                                //     search: true,
                                //     searchSpan: 4,
                                //     rules: [{
                                //         required: true,
                                //         message: "请输入小区名称",
                                //         trigger: "blur",
                                //     },],
                                // },
                                {
                                    label: "地址",
                                    prop: "address",
                                    width: 180,
                                    minWidth: 180,
                                    display: false
                                },
                                {
                                    label: "手机",
                                    prop: "phone",
                                    rules: [{
                                        required: true,
                                        message: "请输入绑定手机",
                                        trigger: "blur",
                                    },],
                                },
                            ],
                        },
@@ -273,9 +287,7 @@
                            total: 0
                        },
                        formatter: (row) => {
                            console.log(row, 888)
                            if (!row.districtName) return ''
                            return row.districtName + '-' + row.unit + row.building + row.room
                            return row.houseName
                        },
                        onLoad: ({
                            page,
@@ -319,7 +331,7 @@
                        prop: "tenantRelationship",
                        search: true,
                        searchSpan: 3,
                        searchLabelWidth: 66,
                        searchLabelWidth: 46,
                        width: 100,
                        type: "select",
                        dicData: [{
@@ -526,7 +538,7 @@
    watch: {},
    computed: {
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
        permissionList() {
            return {
                addBtn: this.vaildData(this.permission.houseRental_add, true),
                viewBtn: this.vaildData(this.permission.houseRental_view, true),
@@ -534,7 +546,7 @@
                editBtn: this.vaildData(this.permission.houseRental_edit, true)
            }
        },
        showConfirmFlag () {
        showConfirmFlag() {
            return (data) => {
                let tags = {}
@@ -554,16 +566,16 @@
            }
        }
    },
    mounted () { },
    mounted() { },
    methods: {
        ManageTenants (item) {
        ManageTenants(item) {
            this.roleBox = true
            this.rowHouseHold = item
            this.onLoadHouseHold()
        },
        onLoadHouseHold () {
        onLoadHouseHold() {
            let params = {
                housingRentalId: this.rowHouseHold.id,
            }
@@ -575,7 +587,7 @@
            })
        },
        houseHoldRowSave (row, done, loading) {
        houseHoldRowSave(row, done, loading) {
            row.aoiName = this.rowHouseHold.aoiName
            row.address = this.rowHouseHold.address
            row.housingRentalId = this.rowHouseHold.id
@@ -593,7 +605,7 @@
                loading()
            })
        },
        rowSave (row, done, loading) {
        rowSave(row, done, loading) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
@@ -616,7 +628,7 @@
                loading()
            })
        },
        rowUpdate (row, index, done, loading) {
        rowUpdate(row, index, done, loading) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
@@ -639,7 +651,7 @@
                loading()
            })
        },
        houseHoldRowUpdate (row, index, done, loading) {
        houseHoldRowUpdate(row, index, done, loading) {
            householdUpdate(row).then(() => {
                this.initFlag = false
                this.onLoadHouseHold()
@@ -653,7 +665,7 @@
                loading()
            })
        },
        houseHoldRowDel (row) {
        houseHoldRowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
@@ -670,7 +682,7 @@
                    })
                })
        },
        rowDel (row) {
        rowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
@@ -687,25 +699,25 @@
                    })
                })
        },
        searchReset () {
        searchReset() {
            this.query = {}
            this.treeDeptId = ''
            this.onLoad(this.page)
        },
        searchChange (params, done) {
        searchChange(params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
        selectionChange(list) {
            this.selectionList = list
        },
        selectionClear () {
        selectionClear() {
            this.selectionList = []
            // this.$refs.crud.toggleSelection();
        },
        handleDelete () {
        handleDelete() {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
@@ -727,16 +739,16 @@
                    this.$refs.crud.toggleSelection()
                })
        },
        handleImport () {
        handleImport() {
            this.excelBox = true
        },
        uploadAfter (res, done, loading, column) {
        uploadAfter(res, done, loading, column) {
            window.console.log(column)
            this.excelBox = false
            this.refreshChange()
            done()
        },
        handleExport () {
        handleExport() {
            const account = func.toStr(this.search.account)
            const realName = func.toStr(this.search.realName)
            this.$confirm("是否导出出租信息数据?", "提示", {
@@ -758,12 +770,12 @@
                })
            })
        },
        handleTemplate () {
        handleTemplate() {
            exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
                downloadXls(res.data, "出租信息数据模板.xlsx")
            })
        },
        beforeOpen (done, type) {
        beforeOpen(done, type) {
            if (["edit", "view"].includes(type)) {
                getDetatil(this.form.id).then(res => {
                    this.form = res.data.data
@@ -780,16 +792,16 @@
            this.initFlag = true
            done()
        },
        currentChange (currentPage) {
        currentChange(currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
        sizeChange(pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
        refreshChange() {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
        onLoad(page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
@@ -809,7 +821,16 @@
                this.loading = false
                this.selectionClear()
            })
        }
        },
        showEditMoel(type,item) {
            if(type == 1){
                this.$refs.RetalInfo.initOpen(type)
            }else {
                this.$refs.RetalInfo.initOpen(type,item.id)
            }
        },
    }
}
</script>