<template>
    <div class="contrl">
        <div class="title-div">
            <span>完善估价对象实物信息</span>
            <el-button class="genBtn" plain type="danger" @click="genResultDoc()">生成《房地产抵押估价结果报告》
                        <el-icon style="vertical-align: -20%;">
                            <ArrowRightBold />
                        </el-icon>
            </el-button>
        </div>
        <el-tabs v-model="activeName" class="targets-tabs">
            <el-tab-pane :label="'估价对象' + t.tid" :name="t.tid" :lazy="true" v-for="(t, index) in targets">
                <div class="targetTable">
                    <el-table :data="t.list" border stripe size="default"
                        :header-row-style="{ color: '#333333', 'font-size': '16px' }"
                        style="color: #333333; font-size: 16px;">
                        <el-table-column prop="id" label="估价对象" width="30" align="center" />
                        <el-table-column prop="no" label="序号" width="30" align="center" />
                        <el-table-column prop="certificateNo" label="权属证书号" align="center" />
                        <el-table-column prop="ownShipUser" label="权利人" show-overflow-tooltip width="100"
                            align="center" />
                        <el-table-column prop="location" label="坐落" show-overflow-tooltip width="100" align="center" />
                        <el-table-column prop="atFloor" label="所在楼层" width="60" align="center" />
                        <el-table-column prop="structure" label="结构" width="60" align="center" />
                        <el-table-column prop="useTo" label="用途" width="60" align="center" />
                        <el-table-column prop="outerAcreage" label="分摊或占用土地使用权面积(㎡)" align="center" />
                        <el-table-column prop="acreage" label="建筑面积(㎡)" width="60" align="center" />
                        <el-table-column prop="price" label="单价(元/㎡)" width="60" align="center" />
                        <el-table-column prop="amount" label="总价(万元)" width="60" align="center" />
                        <el-table-column prop="landCertificateNo" label="国有土地使用证号" align="center" />
                        <el-table-column prop="landType" label="地类(用途)" width="60" align="center" />
                        <el-table-column label="操作" width="100" align="center">
                            <template v-slot="scope">
                                <el-button type="text" @click="addEntityInfo(scope.row.id, scope.row.no)">实物信息</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </el-tab-pane>
        </el-tabs>
        <el-dialog v-model="entityInfoDialog" width="85%" align-center @closed="cleanId">
            <h2>估价对象{{ tId }}序号{{ tNo }}</h2>
            <el-form :model="entityInfo" label-width="180" style="margin-top: 10px;">
            <el-divider content-position="left"><span style="color:#ff6154;">实物状况</span></el-divider>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="小区名称:" class="form-item" >
                        <el-input v-model="entityInfo.communityName" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="栋号:" class="form-item" >
                        <el-input v-model="entityInfo.buildingNo" clearable>
                            <template #append>
                                <span>栋</span>
                            </template>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="竣工年代:" class="form-item" >
                        <el-date-picker
                            v-model="entityInfo.houseAge"
                            type="year"
                            placeholder="请选择"
                            value-format="YYYY年"
                            />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="使用状况:" class="form-item" >
                        <el-select v-model="entityInfo.useInfo" clearable placeholder="请选择">
                            <el-option   label="出租" value="出租" />
                            <el-option   label="自用" value="自用" />
                            <el-option   label="空置" value="空置" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="产权/实际用途:" class="form-item" >
                        <el-input v-model="entityInfo.useTo" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="建筑外观:" class="form-item" >
                        <el-select v-model="entityInfo.buildingOut" clearable placeholder="请选择">
                            <el-option   label="水泥搓砂" value="水泥搓砂" />
                            <el-option   label="水刷石" value="水刷石" />
                            <el-option   label="刷外墙涂料" value="刷外墙涂料" />
                            <el-option   label="贴外墙砖" value="贴外墙砖" />
                            <el-option   label="真石漆" value="真石漆" />
                            <el-option   label="外墙复合材料" value="外墙复合材料" />
                            <el-option   label="干挂石材" value="干挂石材" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="所在层:" class="form-item" >
                        <el-input-number v-model="entityInfo.atFloor" clearable />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="总楼层:" class="form-item" >
                        <el-input-number v-model="entityInfo.floor" clearable />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="载人电梯（数量）:" class="form-item" >
                        <el-input-number v-model="entityInfo.elevator" clearable />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="层高（米）:" class="form-item" >
                        <el-input-number v-model="entityInfo.roomHigh" clearable />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="户型布局:" class="form-item" >
                        <el-input v-model="entityInfo.roomType" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="成新率:" class="form-item" >
                        <el-select v-model="entityInfo.newPercentage" clearable placeholder="请选择">
                            <el-option   label="全新" value="全新" />
                            <el-option   label="九成新" value="九成新" />
                            <el-option   label="八至九成新" value="八至九成新" />
                            <el-option   label="七至八成新" value="七至八成新" />
                            <el-option   label="六至七成新" value="六至七成新" />
                            <el-option   label="六成新以下" value="六成新以下" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="建筑结构:" class="form-item" >
                        <el-input v-model="entityInfo.buildingStructure" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="基本设施:" class="form-item" >
                        <el-select v-model="entityInfo.baseFacility" clearable placeholder="请选择">
                            <el-option   label="不通气" value="不通气" />
                            <el-option   label="通气" value="通气" />
                            <el-option   label="通气通暖" value="通气通暖" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="中央空调:" class="form-item" >
                        <el-radio-group v-model="entityInfo.centerAirConditioning">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="自动喷淋:" class="form-item" >
                        <el-radio-group v-model="entityInfo.autoSpray">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
               
                <el-col :span="6">
                    <el-form-item label="烟感报警:" class="form-item" >
                        <el-radio-group v-model="entityInfo.smogEmergency">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="消防栓:" class="form-item" >
                        <el-radio-group v-model="entityInfo.fireHydrant">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="网线光纤:" class="form-item" >
                        <el-radio-group v-model="entityInfo.netLine">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="可视对讲系统:" class="form-item" >
                        <el-radio-group v-model="entityInfo.visualSys">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="办公智慧系统:" class="form-item" >
                        <el-radio-group v-model="entityInfo.officeSmartSys">
                            <el-radio :value="true">是</el-radio>
                            <el-radio :value="false" >否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
            </el-row>
           
            <el-divider content-position="left"><span style="color:#ff6154;">装饰装修</span></el-divider>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="客厅地面:" class="form-item" >
                        <el-select v-model="entityInfo.livingroomGround" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="贴400*400地砖" value="贴400*400地砖" />
                            <el-option   label="贴600*600地砖" value="贴600*600地砖" />
                            <el-option   label="贴800*800地砖" value="贴800*800地砖" />
                            <el-option   label="铺实木地板" value="铺实木地板" />
                            <el-option   label="铺强化木地板" value="铺强化木地板" />
                            <el-option   label="贴防滑地砖" value="贴防滑地砖" />
                            <el-option   label="铺马赛克" value="铺马赛克" />
                            <el-option   label="为水泥地坪" value="为水泥地坪" />
                            <el-option   label="为水泥砂浆找平" value="为水泥砂浆找平" />
                            <el-option   label="铺地毯" value="铺地毯" />
                            <el-option   label="刷地坪漆" value="刷地坪漆" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="客厅天棚:" class="form-item" >
                        <el-select v-model="entityInfo.livingroomTop" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="安装石膏吊角线" value="安装石膏吊角线" />
                            <el-option   label="石膏板吊顶装饰" value="石膏板吊顶装饰" />
                            <el-option   label="石膏板吊边顶" value="石膏板吊边顶" />
                            <el-option   label="木质吊顶装饰" value="木质吊顶装饰" />
                            <el-option   label="金属网格吊顶" value="金属网格吊顶" />
                            <el-option   label="塑料扣板吊顶" value="塑料扣板吊顶" />
                            <el-option   label="铝扣板吊顶" value="铝扣板吊顶" />
                            <el-option   label="矿棉板吊顶" value="矿棉板吊顶" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="客厅内墙:" class="form-item" >
                        <el-select v-model="entityInfo.livingroomWall" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="贴墙砖" value="贴墙砖" />
                            <el-option   label="木包装饰" value="木包装饰" />
                            <el-option   label="软包装饰" value="软包装饰" />
                            <el-option   label="贴墙纸" value="贴墙纸" />
                            <el-option   label="贴墙布" value="贴墙布" />
                            <el-option   label="刷白色涂料" value="刷白色涂料" />
                            <el-option   label="局部木质墙裙，其余部分刷乳胶漆" value="局部木质墙裙，其余部分刷乳胶漆" />
                            <el-option   label="瓷砖墙裙，其余部分刷乳胶漆" value="瓷砖墙裙，其余部分刷乳胶漆" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="客厅其他部分:" class="form-item" >
                        <el-select v-model="entityInfo.livingroomOther" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="入户安装防盗门" value="入户安装防盗门" />
                            <el-option   label="入户安装防火门" value="入户安装防火门" />
                            <el-option   label="入户安装铁门" value="入户安装铁门" />
                            <el-option   label="入户安装实木门" value="入户安装实木门" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="卧室地面:" class="form-item" >
                        <el-select v-model="entityInfo.bedroomGround" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="贴400*400地砖" value="贴400*400地砖" />
                            <el-option   label="贴600*600地砖" value="贴600*600地砖" />
                            <el-option   label="贴800*800地砖" value="贴800*800地砖" />
                            <el-option   label="铺实木地板" value="铺实木地板" />
                            <el-option   label="铺强化木地板" value="铺强化木地板" />
                            <el-option   label="贴防滑地砖" value="贴防滑地砖" />
                            <el-option   label="铺马赛克" value="铺马赛克" />
                            <el-option   label="为水泥地坪" value="为水泥地坪" />
                            <el-option   label="为水泥砂浆找平" value="为水泥砂浆找平" />
                            <el-option   label="铺地毯" value="铺地毯" />
                            <el-option   label="刷地坪漆" value="刷地坪漆" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="卧室天棚:" class="form-item" >
                        <el-select v-model="entityInfo.bedroomTop" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="安装石膏吊角线" value="安装石膏吊角线" />
                            <el-option   label="石膏板吊顶装饰" value="石膏板吊顶装饰" />
                            <el-option   label="石膏板吊边顶" value="石膏板吊边顶" />
                            <el-option   label="木质吊顶装饰" value="木质吊顶装饰" />
                            <el-option   label="金属网格吊顶" value="金属网格吊顶" />
                            <el-option   label="塑料扣板吊顶" value="塑料扣板吊顶" />
                            <el-option   label="铝扣板吊顶" value="铝扣板吊顶" />
                            <el-option   label="矿棉板吊顶" value="矿棉板吊顶" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="卧室内墙:" class="form-item" >
                        <el-select v-model="entityInfo.bedroomWall" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="贴墙砖" value="贴墙砖" />
                            <el-option   label="木包装饰" value="木包装饰" />
                            <el-option   label="软包装饰" value="软包装饰" />
                            <el-option   label="贴墙纸" value="贴墙纸" />
                            <el-option   label="贴墙布" value="贴墙布" />
                            <el-option   label="刷白色涂料" value="刷白色涂料" />
                            <el-option   label="局部木质墙裙，其余部分刷乳胶漆" value="局部木质墙裙，其余部分刷乳胶漆" />
                            <el-option   label="瓷砖墙裙，其余部分刷乳胶漆" value="瓷砖墙裙，其余部分刷乳胶漆" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="卧室其他部分:" class="form-item" >
                        <el-select v-model="entityInfo.bedroomOther" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="入户安装防盗门" value="入户安装防盗门" />
                            <el-option   label="入户安装防火门" value="入户安装防火门" />
                            <el-option   label="入户安装铁门" value="入户安装铁门" />
                            <el-option   label="入户安装实木门" value="入户安装实木门" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="厨房及卫生间地面:" class="form-item" >
                        <el-select v-model="entityInfo.bathroomGround" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="贴400*400地砖" value="贴400*400地砖" />
                            <el-option   label="贴600*600地砖" value="贴600*600地砖" />
                            <el-option   label="贴800*800地砖" value="贴800*800地砖" />
                            <el-option   label="铺实木地板" value="铺实木地板" />
                            <el-option   label="铺强化木地板" value="铺强化木地板" />
                            <el-option   label="贴防滑地砖" value="贴防滑地砖" />
                            <el-option   label="铺马赛克" value="铺马赛克" />
                            <el-option   label="为水泥地坪" value="为水泥地坪" />
                            <el-option   label="为水泥砂浆找平" value="为水泥砂浆找平" />
                            <el-option   label="铺地毯" value="铺地毯" />
                            <el-option   label="刷地坪漆" value="刷地坪漆" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="厨房及卫生间天棚:" class="form-item" >
                        <el-select v-model="entityInfo.bathroomTop" 
                            filterable
                            allow-create
                            default-first-option
                            :reserve-keyword="false">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="安装石膏吊角线" value="安装石膏吊角线" />
                            <el-option   label="石膏板吊顶装饰" value="石膏板吊顶装饰" />
                            <el-option   label="石膏板吊边顶" value="石膏板吊边顶" />
                            <el-option   label="木质吊顶装饰" value="木质吊顶装饰" />
                            <el-option   label="金属网格吊顶" value="金属网格吊顶" />
                            <el-option   label="塑料扣板吊顶" value="塑料扣板吊顶" />
                            <el-option   label="铝扣板吊顶" value="铝扣板吊顶" />
                            <el-option   label="矿棉板吊顶" value="矿棉板吊顶" />
                            <el-option   label="其它" value="其它" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="厨房及卫生间内墙:" class="form-item" >
                        <el-select v-model="entityInfo.bathroomWall" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="水泥砂浆刮平" value="水泥砂浆刮平" />
                            <el-option   label="白色腻子刮平" value="白色腻子刮平" />
                            <el-option   label="刷乳胶漆" value="刷乳胶漆" />
                            <el-option   label="贴墙砖" value="贴墙砖" />
                            <el-option   label="木包装饰" value="木包装饰" />
                            <el-option   label="软包装饰" value="软包装饰" />
                            <el-option   label="贴墙纸" value="贴墙纸" />
                            <el-option   label="贴墙布" value="贴墙布" />
                            <el-option   label="刷白色涂料" value="刷白色涂料" />
                            <el-option   label="局部木质墙裙，其余部分刷乳胶漆" value="局部木质墙裙，其余部分刷乳胶漆" />
                            <el-option   label="瓷砖墙裙，其余部分刷乳胶漆" value="瓷砖墙裙，其余部分刷乳胶漆" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="厨房及卫生间其他部分:" class="form-item" >
                        <el-select v-model="entityInfo.bathroomOther" allow-create clearable default-first-option placeholder="请选择">
                            <el-option   label="入户安装防盗门" value="入户安装防盗门" />
                            <el-option   label="入户安装防火门" value="入户安装防火门" />
                            <el-option   label="入户安装铁门" value="入户安装铁门" />
                            <el-option   label="入户安装实木门" value="入户安装实木门" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                
            </el-row>
            <el-row :gutter="24">
                <el-col :span="24">
                    <el-form-item label="土地开发程度:" class="form-item" >
                        <el-select v-model="entityInfo.landDeep" clearable placeholder="请选择" style="width: 100%;">
                            <el-option   label="宗地外“六通”（通上水、通下水、通电、通气、通路、通讯）、宗地内“五通一平”(通上水、通下水、通讯、通电、通路、场地平整)" 
                                        value="宗地外“六通”（通上水、通下水、通电、通气、通路、通讯）、宗地内“五通一平”(通上水、通下水、通讯、通电、通路、场地平整)" />
                            <el-option   label="宗地外“六通”（通上水、通下水、通电、通气、通路、通讯）、宗地内“六通一平”(通上水、通下水、通讯、通电、通气、通路、场地平整)" 
                                        value="宗地外“六通”（通上水、通下水、通电、通气、通路、通讯）、宗地内“六通一平”(通上水、通下水、通讯、通电、通气、通路、场地平整)" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-divider content-position="left"><span style="color:#ff6154;">项目四至</span></el-divider>
            <el-row :gutter="24">
                <el-col :span="6">
                    <el-form-item label="东至:" class="form-item" >
                        <el-input v-model="entityInfo.eastWay" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="西至:" class="form-item" >
                        <el-input v-model="entityInfo.westWay" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="南至:" class="form-item" >
                        <el-input v-model="entityInfo.southWay" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="北至:" class="form-item" >
                        <el-input v-model="entityInfo.northWay" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            content="将此实物信息复制到其他标的物。减少填写麻烦，个别字段若需修改可手动调整。"
                        >
                        <template #reference>
                            <el-button type="success" @click="copyEntityInfo()">复制到其他标的</el-button>
                        </template>
                    </el-popover>
                    <el-button @click="entityInfoDialog = false">取消</el-button>
                    <el-button type="danger" @click="removeEntityInfo()">删除</el-button>
                    <el-button type="primary" @click="saveEntityInfo()">
                        保存
                    </el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>


<script>
import houseGuaranty from '@/api/houseGuaranty';
import houseTargetEntity from '@/api/houseTargetEntity';

export default {

    components: {
    },

    created() {
        this.docId = this.$route.query.id;
        this.getTargets();
    },

    watch:{
        activeName:{
            handler(nv,ov){
                this.getTargetSupplement(nv);
            },
            immediate:true
        },
        
    },

    data() {
        return {
            activeName: '①',
            docId: null,
            targets: [],
            certificateName:'1',
            entityInfoDialog:false,
            entityInfo:{
                id:null,
                businessId:null,
                tid:null,
                tno:null,
                houseAge:null,
                useInfo:null,
                useTo:null,
                buildingOut:null,
                atFloor:null,
                floor:null,
                elevator:null,
                centerAirConditioning:null,
                autoSpray:null,
                smogEmergency:null,
                fireHydrant:null,
                netLine:null,
                visualSys:null,
                buildingStructure:null,
                officeSmartSys:null,
                baseFacility:null,
                roomType:null,
                roomHigh:null,
                newPercentage:null,
                livingroomGround:null,
                livingroomTop:null,
                livingroomWall:null,
                livingroomOther:null,
                bedroomGround:null,
                bedroomTop:null,
                bedroomWall:null,
                bedroomOther:null,
                bathroomGround:null,
                bathroomTop:null,
                bathroomWall:null,
                bathroomOther:null,
                landDeep:null
            },
            tId: null,
            tNo: null
        

        }
    },

    methods: {

        getTargets() {
            houseGuaranty.getTargetsById(this.docId).then(res => {
                if (res.code === 200) {
                    this.targets = res.data;
                    this.getTargetSupplement(this.activeName);
                }
            })
        },

        saveSupplement(t){
            t.docId= this.docId;
            t.baseInfo = JSON.stringify(t.list);
            houseGuaranty.saveSupplement(t).then(res=>{
                if (res.code === 200){
                    ElMessage({
                        message: '估价对象'+t.tid+',补充信息已保存.',
                        type: 'success',
                        plain: true
                    })
                    t.id = res.data;
                }
            })
        },

        getTargetSupplement(tid){
            if (this.docId){
                houseGuaranty.getTarget(this.docId,tid).then(res=>{
                    if (res.code ===200 && res.data!=null){
                        for (let i in this.targets){
                            if (this.targets[i].tid === tid){
                                const list = this.targets[i].list;
                                this.targets[i] = res.data;
                                this.targets[i].list = list;
                            }
                        }
                    }
                })
            }
        },

        addEntityInfo(id,no){
            this.tId = id;
            this.tNo = no;
            houseTargetEntity.get(this.docId,id,no).then(res=>{
                if (res.code === 200 && res.data!=null){
                    this.entityInfo = res.data
                }else{
                    this.entityInfo = {};
                }
            })
            this.entityInfoDialog = true;
        },
        saveEntityInfo(){
            this.entityInfo.businessId = this.docId;
            this.entityInfo.tid= this.tId;
            this.entityInfo.tno = this.tNo;
            houseTargetEntity.save(this.entityInfo).then(res=>{
                if (res.code === 200 && res.data){
                    ElMessage({
                        message: '实物状况保存成功.',
                        type: 'success',
                        plain: true
                    })
                    this.entityInfo.id = res.data;
                }
            })
        },
        cleanId() {
            this.tId = null;
            this.tNo = null;
            this.cers = [];

        },

        removeEntityInfo(){
            ElMessageBox.confirm('请确认是否删除此实物状况信息？', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
                draggable: true,
            }).then(()=>{
                houseTargetEntity.delete(this.entityInfo.id).then(res=>{
                if (res.code === 200 && res.data){
                    ElMessage({
                        message: '实物状况已删除.',
                        type: 'success',
                        plain: true
                    })
                    houseTargetEntity.get(this.docId,this.tId,this.tNo).then(res=>{
                        if (res.code === 200 ){
                            this.entityInfo = {};
                        }
                    })
                }

            })
            })
          
        },

        copyEntityInfo(){
            houseTargetEntity.copyEntityInfo(this.entityInfo.id).then(res=>{
                if (res.code === 200 ){
                    ElMessage({
                        message: '复制成功',
                        type: 'success',
                        plain: true
                    })
                }
            })
        },

        genResultDoc(){
            houseGuaranty.genResultDoc(this.docId).then(res=>{
                if (res.code === 200){
                    if (res.code === 200) {
                    ElMessage({
                        message: '《房地产抵押估价结果报告》生成成功',
                        type: 'success',
                        plain: true
                    })
                    this.$emit('updateTimeline');
                }
                }
            })
        }



    }
}
</script>

<style scoped>
.contrl {
    font-size: 20px;
    width: 70.9%;
    border-right: 1.5px #dae1eb solid;
    padding: 0px 20px 20px 0px;
    float: left;

}

.title-div {
    height: 80px;
    line-height: 80px;
    width: 100%;
    font-size: 20px;
    font-weight: 900;
}

.genBtn{
    float: right;
    margin-top: 30px;
}

/* .el-radio-group {
    --el-radio-group-width: 220px;
}

.el-input {
    --el-input-width: 100%;
} */

:deep(.el-select) {
    width: 220px;
}

:deep(.el-input) {
    width: 220px;
}

:deep(.el-table .cell) {
    padding: 0px;
}

:deep(.el-input__wrapper.is-focus) {
    --el-input-focus-border: #ff6154;
    --el-input-focus-border-color: #ff6154;
}

:deep(.el-radio-group__wrapper.is-focused) {
    box-shadow: #ff6154;
    --el-radio-group-input-focus-border-color: #ff6154;
    --el-color-primary: #ff6154;
}

:deep(.el-radio__input.is-checked .el-radio__inner) {
    background: #ff6154;
    border-color: #ff6154;
}

:deep(.el-radio__inner:hover) {
    border-color: #ff6154;
}

:deep(.el-radio__input.is-checked+.el-radio__label) {
    color: #ff6154;

}
:deep(.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active){
    color: #ff6154;
}
:deep(.el-tabs__item.is-active, .el-tabs__item:hover){
    color: #ff6154;
}
:deep(.el-checkbox__label) {
    font-size: 15px;
}
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
    background-color: #ff6154;
    border-color: #ff6154;
    font-size: 20px;
}
:deep(.el-checkbox__input.is-checked+.el-checkbox__label) {
    color:#ff6154;
    
}
:deep(.el-tabs__active-bar){
    background-color:#ff6154;
}
:deep(.el-tabs__item.is-active) {
    color:#ff6154;
}
:deep(.el-tabs__item:hover){
    color:#ff6154;
}
.certificates-tabs {
 margin-top: 30px;
}

:deep(.el-input__wrapper.is-focus) {
  --el-input-focus-border: #ff6154;
  --el-input-focus-border-color:#ff6154;
}
:deep(.el-button--text:hover){
    color:#ff6154;
}
:deep(.el-button--text){
    color:#ff6154;
}
</style>