hCxlz.vue 6.35 KB
<template>
    <div class="main">
        <el-dialog
                title="户重新落宗"
                :visible.sync="isVisible"
                width="50%"
                @close="close"
                :modal-append-to-body="false"
        >
            <div class="content">
                <div class="input-suffix">
                    宗 地:
                    <input
                            placeholder="请选择宗地" v-model="zdxx" readonly="readonly"
                    />
                    <el-button type="primary" @click="xzzdVisible = true">选择宗地</el-button>
                </div>
                <div class="input-suffix">
                    自然幢:
                    <el-select v-model="hcxlzData.zrzbsm" filterable placeholder="请选择" @change="zrzChange">
                        <el-option
                                v-for="item in zrzList"
                                :key="item.xmmc"
                                :label="item.label"
                                :value="item.bsm">
                        </el-option>
                    </el-select>
                </div>
                <div class="input-suffix">
                    逻辑幢:
                    <el-select v-model="hcxlzData.ljzbsm" filterable placeholder="请选择" @change="ljzChange">
                        <el-option
                                v-for="item in ljzList"
                                :key="item.bsm"
                                :label="item.ljzmc"
                                :value="item.bsm">
                        </el-option>
                    </el-select>
                </div>
                <div class="input-suffix">
                    幢单元:
                    <el-select v-model="hcxlzData.zdybsm" filterable placeholder="请选择">
                        <el-option
                                v-for="item in zdyList"
                                :key="item.bsm"
                                :label="item.zdymc"
                                :value="item.bsm">
                        </el-option>
                    </el-select>
                </div>
            </div>
            <div class="footer">
                <el-button type="primary" @click="save">保存</el-button>
                <el-button type="primary" @click="cancel">取消</el-button>
            </div>
            <query-data :centerDialogVisible="xzzdVisible" @close="xzzdClose" @getData="getZdxx"></query-data>
        </el-dialog>
    </div>
</template>

<script>
    import queryData from './../../components/queryData/queryData'
    import {zdXlcd, hzl} from './../../api/zd'
    import {Message} from 'element-ui'
    export default {
        name: "hCxlz",
        components: {queryData},
        data() {
            return {
                zd: {},
                zrz: {},
                ljz: {},
                zdy: {},
                xzzdVisible: false,
                isVisible: false,
                zdxx: '',    // 宗地信息
                hcxlzData: {
                    bsms: [],
                    zrzbsm: '',
                    ljzbsm: '',
                    zdybsm: ''
                },
                total: 1,
                zrzList: [],
                ljzList: [],
                zdyList: []
            }
        },
        props: {
            hCxlzVisble: {
                type: Boolean,
                default: false
            },
            bsms: {
                type: Array
            }
        },
        mounted() {
        },
        methods: {
            ljzChange: function () {
                const item = this.ljzList.find(i => i.bsm == this.hcxlzData.ljzbsm)
                this.hcxlzData.zdybsm = ''
                this.zdyList = item.list;
                this.zdyList.push({
                    zdymc: '空',
                    bsm: ''
                })
            },
            zrzChange: function () {
                const item = this.zrzList.find(i => i.bsm == this.hcxlzData.zrzbsm);
                this.hcxlzData.ljzbsm = ''
                this.hcxlzData.zdybsm = ''
                this.ljzList = item.ljzList;
                this.ljzList.push({
                    ljzmc: '空',
                    bsm: ''
                })
                this.zdyList = item.zdyList;
                this.zdyList.push({
                    zdymc: '空',
                    bsm: ''
                })
            },
            getZrz: function (bsm) {
                zdXlcd(bsm).then(res => {
                    this.zrzList = res.result;
                })
            },
            getZdxx: function (val) {
                console.log(val, "宗地信息")
                this.zd = val
                this.zdxx = val.xmmc + "(" + val.zddm + ")";
            },
            xzzdClose: function () {
                this.xzzdVisible = false;
            },
            result: function () {
                this.hcxlzData = {
                    bsms: [],
                    zrzbsm: '',
                    ljzbsm: '',
                    zdybsm: ''
                };
            },
            cancel() {
                console.log("cancel......")
                this.close();
            },
            save() {
                console.log("save.......")
                if (this.hcxlzData.zrzbsm == '') {
                    Message.error("请选择自然幢")
                    return;
                }
                hzl(this.hcxlzData).then(res => {
                    if (res.success) {
                        this.close();
                    } else {
                        Message.error(res.message)
                    }
                });
            },
            close() {
                this.$emit('close', false);
                this.result();
            },
        },
        watch: {
            hCxlzVisble: function (val) {
                this.isVisible = val
            },
            zd: function (val) {
                //this.getZrz(val.glbsm)
                this.getZrz('815c80d0d5b35968432fdd9c654dd134')
            }
        }
    }
</script>

<style scoped lang="less">
    .input-suffix {
        input {
            width: 210px;
            height: 30px;
            border-radius: 3px;
            border-color: #BBB;
        }
    }

    .content {
        text-align: center;
    }

    .footer {
        margin-top: 20px;
        text-align: center;
    }
</style>