lin
2024-03-22 ebfc739bdbbc0dd0fccd0bf47b7d2d5397c3c511
src/views/userHouse/hireInfoList.vue
@@ -7,59 +7,56 @@
                    @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">
                    <template slot="auditStatus" slot-scope="{row}">
                        <el-tag size="small" :type="showConfirmFlag(row.auditStatus).type">
                    <template slot-scope="{row, size}" slot="auditStatus">
                        <el-tag :size="size" :type="showConfirmFlag(row.auditStatus).type">
                            {{ showConfirmFlag(row.auditStatus).text }}
                        </el-tag>
                    </template>
                    <template slot="menuLeft">
                        <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="scope" slot="menu">
                        <el-button type="text" icon="el-icon-circle-plus-outline" size="small"
                            v-if="permission.househould_manager" @click="ManageTenants(scope.row)">管理租户
                    <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">导出
            </el-button> -->
                    </template>
                    <template slot-scope="{row}" slot="tenantName">
                        <el-tag>{{ row.tenantName }}</el-tag>
                    </template>
                    <template slot-scope="{row}" slot="roleName">
                        <el-tag>{{ row.roleName }}</el-tag>
                    </template>
                    <template slot-scope="{row}" slot="deptName">
                        <el-tag>{{ row.deptName }}</el-tag>
                    </template>
                    <template slot-scope="{row}" slot="userTypeName">
                        <el-tag>{{ row.userTypeName }}</el-tag>
                    </template>
                </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>
@@ -67,6 +64,10 @@
                        </template>
                    </avue-form>
                </el-dialog>
                <retalInfo ref="RetalInfo"></retalInfo>
            </basic-container>
        </el-col>
    </el-row>
@@ -112,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: {},
@@ -139,7 +143,7 @@
                total: 0
            },
            houseHoldOption: {
                height: 'auto',
                height: '500',
                calcHeight: 80,
                tip: false,
                searchShow: true,
@@ -160,12 +164,14 @@
                {
                    label: "电话",
                    prop: "phoneNumber",
                    width: 100,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "身份证号",
                    prop: "idCard",
                    width: 160,
                    // search: true,
                    searchSpan: 4,
                },
@@ -187,17 +193,29 @@
                    }
                    ],
                },
                // {
                //     label: "关系",
                //     prop: "relationship",
                //     type: "select",
                //     dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                //     dataType: "number",
                //     props: {
                //         label: "dictValue",
                //         value: "dictKey",
                //     },
                //     display: false
                // },
                {
                    label: "关系",
                    prop: "relationship",
                    label: "民族",
                    prop: "ethnicity",
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                    // hide: true,
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                    display: false
                },
                {
                    width: 220,
@@ -208,10 +226,26 @@
                    searchSpan: 4,
                    display: false
                },
                // {
                //     label: "地址",
                //     prop: "address",
                //     minWidth: 160,
                //     overHidden: true,
                //     display: false
                // },
                {
                    label: "地址",
                    prop: "address",
                    display: false
                    label: "户籍地址",
                    prop: "hukouRegistration",
                    // hide: true,
                    minWidth: 150,
                    overHidden: true,
                },
                {
                    label: "工作单位",
                    prop: "employer",
                    // editDisplay:false,
                    // hide: true,
                },
                ]
            },
@@ -221,7 +255,6 @@
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                height: 'auto',
                calcHeight: 80,
                tip: false,
@@ -229,21 +262,24 @@
                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,
                        minWidth: 150,
                        overHidden: true,
                    },
                    {
                        label: "房屋",
                        prop: "houseCode",
                        hide: true,
                        type: "table",
                        children: {
                            border: true,
                            height: 400,
@@ -251,33 +287,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",
                                    },],
                                },
                            ],
                        },
@@ -287,9 +314,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,
@@ -333,7 +358,7 @@
                        prop: "tenantRelationship",
                        search: true,
                        searchSpan: 3,
                        searchLabelWidth: 66,
                        searchLabelWidth: 46,
                        width: 100,
                        type: "select",
                        dicData: [{
@@ -540,7 +565,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),
@@ -548,7 +573,7 @@
                editBtn: this.vaildData(this.permission.houseRental_edit, true)
            }
        },
        showConfirmFlag () {
        showConfirmFlag() {
            return (data) => {
                let tags = {}
@@ -568,16 +593,16 @@
            }
        }
    },
    mounted () { },
    mounted() { },
    methods: {
        ManageTenants (item) {
        ManageTenants(item) {
            this.roleBox = true
            this.rowHouseHold = item
            this.onLoadHouseHold()
        },
        onLoadHouseHold () {
        onLoadHouseHold() {
            let params = {
                housingRentalId: this.rowHouseHold.id,
            }
@@ -589,11 +614,14 @@
            })
        },
        houseHoldRowSave (row, done, loading) {
        houseHoldRowSave(row, done, loading) {
            row.aoiName = this.rowHouseHold.aoiName
            row.address = this.rowHouseHold.address
            row.housingRentalId = this.rowHouseHold.id
            row.houseCode = this.rowHouseHold.houseCode
            if (row.idCard) {
                row.cardType = 111
            }
            householdAdd(row).then(() => {
                this.initFlag = false
                this.onLoadHouseHold()
@@ -607,7 +635,7 @@
                loading()
            })
        },
        rowSave (row, done, loading) {
        rowSave(row, done, loading) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
@@ -630,7 +658,7 @@
                loading()
            })
        },
        rowUpdate (row, index, done, loading) {
        rowUpdate(row, index, done, loading) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
@@ -653,7 +681,10 @@
                loading()
            })
        },
        houseHoldRowUpdate (row, index, done, loading) {
        houseHoldRowUpdate(row, index, done, loading) {
            if (row.idCard) {
                row.cardType = 111
            }
            householdUpdate(row).then(() => {
                this.initFlag = false
                this.onLoadHouseHold()
@@ -667,7 +698,7 @@
                loading()
            })
        },
        houseHoldRowDel (row) {
        houseHoldRowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
@@ -684,7 +715,7 @@
                    })
                })
        },
        rowDel (row) {
        rowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
@@ -701,25 +732,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
@@ -741,16 +772,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("是否导出出租信息数据?", "提示", {
@@ -772,12 +803,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
@@ -794,16 +825,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 => {
@@ -823,7 +854,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>