<template>
  <div class="app-container">
    <el-collapse v-model="activeName" @change="handleChange" accordion>
      <el-collapse-item name="workflowBoard">
        <template slot="title">
          <span style="font-size:20px; margin-left:20px;letter-spacing:2px;color:red">
            <i class="el-icon-warning"></i>
            <span> 当前节点：{{ currentNode == null ? '???' : currentNode.nodeName }}</span>
            <span> 项目编号：{{ nodeBusinessInfo.businessSubId }}</span>
          </span>
          <span style="font-size:15px; margin-left:15px;letter-spacing:2px; color:RGB(168,168,168)">
            点击展开查看实时流程图
          </span>
        </template>
        <WorkflowBoard ref='board' @workflowCommitVerify="workflowCommitVerify" :nodeBusinessInfo="nodeBusinessInfo" />
      </el-collapse-item>
    </el-collapse>
    <div class="button-area">
      <el-button v-if="nodeBusinessInfo.currentNodePermission.commit" class="y-save" type="success" round
        @click="commit('PASS')" :disabled="!nodeBusinessInfo.doWorkflow">提交</el-button>
      <el-button v-if="nodeBusinessInfo.currentNodePermission.reversible" class="y-save" type="warning" round
        @click="commit('REVERSE')" :disabled="!nodeBusinessInfo.doWorkflow">退回</el-button>
      <el-button v-if="nodeBusinessInfo.currentNodePermission.skippable" class="y-save" type="warning" round
        @click="commit('SKIP')" :disabled="!nodeBusinessInfo.doWorkflow">跳过</el-button>
      <el-button v-if="nodeBusinessInfo.currentNodePermission.terminable" class="y-save" type="danger" round
        @click="commit('TERMINATE')" :disabled="!nodeBusinessInfo.doWorkflow">终止</el-button>
      <el-button v-if="nodeBusinessInfo.currentNodePermission.restartable" class="y-save" type="danger" round
        @click="commit('RESTART')" :disabled="!nodeBusinessInfo.doWorkflow">重置</el-button>
      <el-button class="y-save" round type="info" @click="goBack">返回</el-button>
    </div>
    <el-tabs v-model="activeTagName" @tab-click="handleClick" type="border-card">
      <el-tab-pane name="order" class="pane-class" :lazy=true>
        <span slot="label"><i class="el-icon-document"></i> 个贷订单</span>
        <el-form ref="personalForm" :model="personal">
          <div class="createMajor-main-container">
            <div class="postInfo-container">
              <div>
                <el-divider content-position="left">
                  <h3 class="title">
                    <div class="avatar-wrapper icon-title">订单</div>
                    <div class="icon-info">个贷订单</div>
                  </h3>
                </el-divider>
              </div>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="项目编号：" prop="orderId" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.orderId" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="评估目的：" prop="evaluateAim" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.evaluateAim" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="12" :span="6">
                  <el-form-item label="房屋用途：" prop="purpose" label-width="160px" class="postInfo-container-item">
                    <el-checkbox-group v-model="personal.purpose">
                      <el-checkbox-button label="HOUSE" name="purpose">住宅</el-checkbox-button>
                      <el-checkbox-button label="BUSINESS" name="purpose">商业</el-checkbox-button>
                      <el-checkbox-button label="OFFICE" name="purpose">办公</el-checkbox-button>
                      <el-checkbox-button label="INDUSTRIAL" name="purpose">工业</el-checkbox-button>
                      <el-checkbox-button label="OTHER" name="purpose">其他</el-checkbox-button>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="12" :sm="12" :lg="24" :span="6">
                  <el-form-item label="坐落：" prop="location" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.location" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="客户类型：" prop="clienteleType" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.clienteleType" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="客户名称：" prop="clienteleId" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.clientName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="业务来源：" prop="clienteleSubId" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.clientSubName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="客户联系人：" prop="clienteleContactId" label-width="120px"
                    class="postInfo-container-item">
                    <el-input :value="personal.contactName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="联系人电话：" prop="clienteleContactId" label-width="120px"
                    class="postInfo-container-item">
                    <el-input :value="personal.contactTel" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="联系人部门：" prop="clienteleContactId" label-width="120px"
                    class="postInfo-container-item">
                    <el-input :value="personal.cdepartment" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="联系人职务：" prop="clienteleContactId" label-width="120px"
                    class="postInfo-container-item">
                    <el-input :value="personal.cduty" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="中介：" prop="agent" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.agent" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="贷款性质：" prop="loanNature" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.loanNature" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="贷款用途：" prop="loanAim" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.loanAim" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="贷款额度：" prop="loanLimit" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.loanLimit" class="filter-item" readonly disabled>
                      <template slot="append">万元</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="贷款期限：" prop="loanPeriod" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.loanPeriod" class="filter-item" readonly disabled>
                      <template slot="append">年</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="贷款是否到期：" prop="loanExpire" label-width="140px" class="postInfo-container-item">
                    <el-radio v-model="personal.loanExpire" :label="false" border>否</el-radio>
                    <el-radio v-model="personal.loanExpire" :label="true" border>是</el-radio>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="12" :span="6">
                  <el-form-item label="资料说明：" prop="credentials" label-width="120px" class="postInfo-container-item">
                    <el-checkbox-group v-model="personal.credentials">
                      <el-checkbox-button label="HOUSE_CERTIFICATE" name="credentials">房产证</el-checkbox-button>
                      <el-checkbox-button label="LAND_CERTIFICATE" name="credentials">国土证</el-checkbox-button>
                      <el-checkbox-button label="IMMOVABLE_CERTIFICATE" name="credentials">不动产权证</el-checkbox-button>
                      <el-checkbox-button label="NONE" name="credentials">无资料</el-checkbox-button>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="委托人1：" prop="bailorA" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.bailorA" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="委托人1电话：" prop="bailoraTel" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.bailoraTel" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="委托人2：" prop="bailorB" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.bailorB" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="委托人2电话：" prop="bailorbTel" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.bailorbTel" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="6" :span="6">
                  <el-form-item label="终端客户类型：" prop="terminalClienteleType" label-width="140px"
                    class="postInfo-container-item">
                    <el-input :value="personal.terminalClienteleType" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="12" :span="6" v-show="personal.terminalClienteleType != ''">
                  <el-form-item label="终端客户名称：" prop="terminalClienteleId" label-width="140px"
                    class="postInfo-container-item">
                    <el-input :value="personal.tterminalClienteleName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6" v-show="personal.terminalClienteleType == '企业'">
                  <el-form-item label="终端联系人：" prop="terminalClienteleContactId" label-width="120px"
                    class="postInfo-container-item">
                    <el-input :value="personal.tterminalClienteleContactName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" :span="6" v-show="personal.terminalClienteleType != ''">
                  <el-form-item label="终端联系电话：" prop="clienteleType" label-width="140px" class="postInfo-container-item">
                    <el-input :value="personal.tmobile" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="23" :span="12">
                  <el-form-item label="订单备注：" prop="remark" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.remark" class="filter-item" type="text" readonly disabled />
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-form>
        <el-form ref="personalMemberForm" :model="personal" :rules="rules">
          <div class="createMajor-main-container">
            <div class="postInfo-container">
              <div>
                <el-divider content-position="left">
                  <h3 class="title">
                    <div class="avatar-wrapper icon-title">人员</div>
                    <div class="icon-info">项目人员</div>
                  </h3>
                </el-divider>
              </div>
              <el-row class="row-style">
                <el-col :xs="24" :sm="12" :lg="5" :span="6">
                  <el-form-item label="客户经理：" prop="clientManager" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.clientManager" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="12" :lg="5" :span="6">
                  <el-form-item label="内业人员：" prop="inwardStaffName" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.inwardStaffName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="5" :span="6">
                  <el-form-item label="外业人员：" prop="outwardStaff" label-width="120px" class="postInfo-container-item">
                    <el-tooltip v-if="currentNode.nodeCode === 'DEPARTMENT_ALLOCATION'" placement="top-start"
                      content="请确定外业人员" :manual=true v-model="outwardStaffTip">
                      <el-select v-model="personal.outwardStaff" filterable clearable>
                        <el-option v-for="(item, id) in outwardStaffs" :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
                      </el-select>
                    </el-tooltip>
                    <el-input :value="personal.outwardStaffName" class="filter-item" readonly disabled v-else />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="5" :span="6">
                  <el-form-item label="定价内业：" prop="pricingStaffName" label-width="120px" class="postInfo-container-item">
                    <el-input :value="personal.pricingStaffName" class="filter-item" readonly disabled />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="4" :span="6">
                  <el-form-item label-width="160px">
                    <el-button v-if="currentNode.nodeCode === 'DEPARTMENT_ALLOCATION'" type="primary" round
                      @click="saveOutwardStaff()">保存</el-button>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-form>
      </el-tab-pane>
      <el-tab-pane name="scene" class="pane-class" :lazy=true>
        <span slot="label"><i class="el-icon-search"></i> 外业实勘</span>
        <el-form ref="sceneForm" :model="sceneForm" class="form-container" :rules="rules">
          <div class="createMajor-main-container">
            <div class="postInfo-container">
              <div>
                <el-divider content-position="left">
                  <h3 class="title">
                    <div class="avatar-wrapper icon-title">实勘</div>
                    <div class="icon-info">实勘信息</div>
                  </h3>
                </el-divider>
              </div>
              <div>
                <el-row class="row-style" v-if="currentNode.nodeCode === 'SPOT_RECONNAISSANCE'">
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-button type="danger" round @click="saveScene()">保存</el-button>
                  </el-col>
                </el-row>
                <el-row class="row-style" style="margin-top: 10px;">
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="orderId" label-width="120px" class="postInfo-container-item" label="订单号:">
                      <el-input disabled readonly :value="personal.orderId" class="filter-item" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="sceneUserName" label-width="120px" class="postInfo-container-item" label="实勘人:">
                      <el-input disabled readonly :value="personal.outwardStaffName" class="filter-item" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="12" :span="6">
                    <el-form-item prop="productionType" label-width="120px" class="postInfo-container-item" label="坐落：">
                      <el-input disabled readonly :value="personal.location" class="filter-item" />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row class="row-style">
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="inRingDewlling" label-width="120px" class="postInfo-container-item"
                      :rules="{ required: true, message: '绕城内住宅不能为空', trigger: 'blur' }" label="绕城内住宅:">
                      <el-input-number style="width: 100%;" :min="0" v-model="sceneForm.inRingDewlling"
                        :readonly="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'"
                        :disabled="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'" class="filter-item">
                      </el-input-number>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="outRingDewlling" label-width="120px" class="postInfo-container-item"
                      :rules="{ required: true, message: '绕城外住宅不能为空', trigger: 'blur' }" label="绕城外住宅:">
                      <el-input-number style="width: 100%;" :min="0" v-model="sceneForm.outRingDewlling"
                        :readonly="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'"
                        :disabled="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'" class="filter-item">
                      </el-input-number>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="inRingBuilding" label-width="120px" class="postInfo-container-item"
                      :rules="{ required: true, message: '绕城内商业不能为空', trigger: 'blur' }" label="绕城内商业:">
                      <el-input-number style="width: 100%;" :min="0" v-model="sceneForm.inRingBuilding"
                        :readonly="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'"
                        :disabled="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'" class="filter-item">
                      </el-input-number>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6" :span="6">
                    <el-form-item prop="outRingBuilding" label-width="120px" class="postInfo-container-item"
                      :rules="{ required: true, message: '绕城外商业不能为空', trigger: 'blur' }" label="绕城外商业:">
                      <el-input-number style="width: 100%;" :min="0" v-model="sceneForm.outRingBuilding"
                        :readonly="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'"
                        :disabled="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'" class="filter-item">
                      </el-input-number>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row class="row-style">
                  <el-col :xs="24" :sm="12" :lg="24" :span="6">
                    <el-form-item label="实勘备注：" prop="remark" label-width="120px" class="postInfo-container-item">
                      <el-input v-model="sceneForm.remark" :autosize="{ minRows: 3, maxRows: 3 }" class="filter-item"
                        :readonly="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'"
                        :disabled="currentNode.nodeCode != 'SPOT_RECONNAISSANCE'" type="textarea" />
                    </el-form-item>
                  </el-col>
                </el-row>
              </div>
            </div>
          </div>
        </el-form>
      </el-tab-pane>
      <el-tab-pane id="evaluteObject" name="evaluate" class="pane-class" :lazy=true>
        <span slot="label"><i class="el-icon-office-building"></i> 评估对象</span>
        <el-form ref="targetForm" :model="target">
          <div class="createMajor-main-container">
            <div class="postInfo-container">
              <div>
                <el-divider content-position="left">
                  <h3 class="title">
                    <div class="avatar-wrapper icon-title">价格</div>
                    <div class="icon-info">评估价格</div>
                  </h3>
                </el-divider>
              </div>
            </div>
          </div>
          <el-row class="row-style">
            <el-col :xs="24" :sm="12" :lg="18" :span="6">
              <el-form-item label="流程：" prop="acreage" label-width="140px" class="postInfo-container-item">
                <el-switch v-model="target.isOnline" style="margin-bottom: 5px;" active-text="线上" inactive-text="线下"
                  @change="calculateSwith()"
                  :readonly="!(currentNode.nodeCode === 'DETERMINE_PRICE' || currentNode.nodeCode === 'GENERATE_STATEMENT' || currentNode.nodeCode === 'WRITE_REPORT' || currentNode.nodeCode === 'WRITE_LETTER')"
                  :disabled="!(currentNode.nodeCode === 'DETERMINE_PRICE' || currentNode.nodeCode === 'GENERATE_STATEMENT' || currentNode.nodeCode === 'WRITE_REPORT' || currentNode.nodeCode === 'WRITE_LETTER')">
                </el-switch>
              </el-form-item>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="6" :span="6">
              <el-form-item label="打印二维码：" prop="validateCode" label-width="140px" class="postInfo-container-item">
                <a @mouseenter="showQR=true">出入库二维码</a> <a @mouseenter="showQR=false" style="margin-left: 5px">验证二维码</a>
                <div class="qr-code-div">
                  <img v-show="showQR" class="qr-code" :src="target.qrCode" alt="出入库二维码" @click="printQR(target.qrCode)"/>
                  <img v-show="!showQR" class="qr-code" :src="target.validateCode" alt="验证二维码" @click="printQR(target.validateCode)"/>
                </div>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="row-style">
            <el-col :xs="12" :sm="12" :lg="18" :span="6">
              <el-form-item label="项目名称：" prop="location" label-width="140px" class="postInfo-container-item">
                <el-input v-model="personal.location" class="filter-item" />
              </el-form-item>
            </el-col>

          </el-row>
          <el-row class="row-style">
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-form-item label="委托方1：" prop="bailorA" label-width="140px" class="postInfo-container-item">
                <el-input v-model="personal.bailorA" class="filter-item" />
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-form-item label="委托方2：" prop="bailorB" label-width="140px" class="postInfo-container-item">
                <el-input v-model="personal.bailorB" class="filter-item" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="row-style">
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-form-item label="评估面积(平)：" prop="acreage" label-width="140px" class="postInfo-container-item">
                <el-input-number v-model="target.acreage" size="medium" controls-position="right" :min="0" :max="10000"
                  style="width: 100%;"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-form-item label="评估单价(元)：" prop="price" label-width="140px"  class="postInfo-container-item">
                <el-input-number v-model="target.price" size="medium" controls-position="right" :min="0"
                  style="width: 100%;"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-form-item label="评估总价(万元)：" prop="amount" label-width="140px" class="postInfo-container-item">
                <el-input-number v-model="target.amount" size="medium" controls-position="right" :min="0" :precision="2"
                  style="width: 100%;"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="6" :span="6">
              <el-button type="primary" round @click="savePrice()" style="margin-left: 20px;" v-if="(currentNode.nodeCode === 'DETERMINE_PRICE' 
              || currentNode.nodeCode === 'REVIEW_STATEMENT' || currentNode.nodeCode === 'GENERATE_STATEMENT' ||currentNode.nodeCode === 'WRITE_REPORT'  || currentNode.nodeCode === 'WRITE_LETTER'
                || currentNode.nodeCode === 'CHECK_REPORT' || currentNode.nodeCode === 'CHECK_LETTER')">保存</el-button>
            </el-col>
          </el-row>
        </el-form>
      </el-tab-pane>
      <el-tab-pane name="comparable" class="pane-class" :lazy=true >
        <span slot="label"><i class="el-icon-office-building"></i> 可比实例</span>
        <div class="createMajor-main-container">
          <div class="postInfo-container">
            <div>
              <el-divider content-position="left">
                <h3 class="title">
                  <div class="avatar-wrapper icon-title">实例</div>
                  <div class="icon-info">可比实例</div>
                </h3>
              </el-divider>
            </div>
          </div>
        </div>
        <el-form ref="compareToForm" :model="compareList" v-if="target.isOnline">
          <el-row class="row-style">
            <el-col :xs="24" :sm="12" :lg="4" :span="6">
              <el-form-item label="修正系数：" prop="fixValue" label-width="120px"
                :rules="{ required: true, message: '修正系数不能为空', trigger: 'blur' }" class="postInfo-container-item">
                <el-input-number v-model="compareList.fixValue" :step="0.1" :min="1" size="medium" style="width: 100%;"
                  controls-position="right"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="4" :span="6">
              <el-form-item label="是否划拨：" prop="rightsType" label-width="120px"
                :rules="{ required: true, message: '是否划拨不能为空', trigger: 'blur' }" class="postInfo-container-item">
                <el-select v-model="compareList.rightsType" placeholder="请选择" @change="selectRightsType()">
                  <el-option label="划拨" value="ALLOT">划拨</el-option>
                  <el-option label="出让" value="SELL">出让</el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="4" :span="6" v-show="compareList.rightsType === 'ALLOT'">
              <el-form-item label="环线位置：" prop="rollingLevel" label-width="120px"
                :rules="{ required: compareList.rightsType === 'ALLOT', message: '是否划拨不能为空', trigger: 'blur' }"
                class="postInfo-container-item">
                <el-select v-model="compareList.rollingLevel" placeholder="请选择" @change="selectRoll()">
                  <el-option label="二环内" :value=1>二环内</el-option>
                  <el-option label="二至三环" :value=2>二至三环</el-option>
                  <el-option label="三环外" :value=3>三环外</el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="5" :span="6">
              <el-form-item label="计算方式：" prop="calculateType" label-width="120px"
                :rules="{ required: true, message: '计算方式不能为空', trigger: 'blur' }" class="postInfo-container-item">
                <el-select v-model="compareList.calculateType" clearable placeholder="请选择"
                  @change="selectCalculateType()">
                  <el-option label="简单算术平均" value="SIMPLE">简单算术平均</el-option>
                  <el-option label="加权算术平均" value="WEIGHT">加权算术平均</el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :lg="5" :span="6" style="margin-left: 20px;">
              <el-button type="primary" round @click="calulate()"
              v-if="currentNode.nodeCode === 'DETERMINE_PRICE' 
                      || currentNode.nodeCode === 'GENERATE_STATEMENT' 
                      || currentNode.nodeCode === 'WRITE_REPORT' 
                      || currentNode.nodeCode === 'WRITE_LETTER'
                      || currentNode.nodeCode === 'REVIEW_STATEMENT'
                      || currentNode.nodeCode === 'CHECK_REPORT'
                      || currentNode.nodeCode === 'CHECK_LETTER'">计算价格</el-button>
              <el-button type="primary" round @click="calulateAndSave()"
                v-if="currentNode.nodeCode === 'DETERMINE_PRICE' 
                      || currentNode.nodeCode === 'GENERATE_STATEMENT' 
                      || currentNode.nodeCode === 'WRITE_REPORT' 
                      || currentNode.nodeCode === 'WRITE_LETTER'
                      || currentNode.nodeCode === 'REVIEW_STATEMENT'
                      || currentNode.nodeCode === 'CHECK_REPORT'
                      || currentNode.nodeCode === 'CHECK_LETTER'
                      ">计算并保存</el-button>
            </el-col>
          </el-row>
          <el-table v-loading="calculating" element-loading-text="正在计算..." element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(144, 147, 153, 0.5)" :data="compareList.analysisData" border="border" stripe
            :header-cell-style="{ color: '#333333' }" style="
                              border-left: 1px solid #ebeced;
                              border-right: 1px solid #ebeced;
                              color: #333333; font-size: 16px;">
            <el-table-column prop="index" label="指标" width="180" align="center">
              <template scope="scope">
                <span v-if="requiredIndex.includes(scope.row.index)" style="color:red">* </span>
                <span>{{ scope.row.index }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="compareA" label="实例A" align="center">
              <template scope="scope" style="float:right">
                <div v-if="needWeight.includes(scope.row.index)">
                  <el-input style="width:60%" v-model="scope.row.compareA.valueA" />
                  <el-input-number v-model="scope.row.compareA.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '市场状况'">
                  <el-date-picker v-model="scope.row.compareA.valueA" type="month" style="width:60%" value-format="yyyy-MM-ddT00:00:00.000Z" placeholder="选择月">
                  </el-date-picker>
                  <el-input-number v-model="scope.row.compareA.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '楼层/总楼层'">
                  <el-input style="width:26%" v-model="scope.row.compareA.valueA" />
                  <span style="margin-left:2%;margin-right:2%">/</span>
                  <el-input style="width:26%" v-model="scope.row.compareA.valueB" />
                  <el-input-number v-model="scope.row.compareA.weight" :min="1" :max="150" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '修正后价格'">
                  <span v-if="scope.row.compareA.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:20px">￥{{
                      parseFloat(scope.row.compareA.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '权重'">
                  <el-input-number v-if="compareList.calculateType === 'WEIGHT'" v-model="scope.row.compareA.valueA"
                    style="width:100%;" :min="0" :max="1" size="small" :step="0.1"
                    controls-position="right"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '总价(元)'">
                  <span v-if="scope.row.compareA.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:16px">￥{{
                      parseFloat(scope.row.compareA.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '单价(元)'">
                  <el-input-number v-model="scope.row.compareA.valueA" style="width:100%;" :min="0" size="small"
                    controls-position="right"></el-input-number>
                </div>
                <!-- <div v-else-if="scope.row.index === '室内装饰'">
                  <el-select v-model="scope.row.compareA.valueA" placeholder="请选择" style="width:60%">
                    <el-option label="精装" value="精装">精装</el-option>
                    <el-option label="中等装修" value="中等装修">中等装修</el-option>
                    <el-option label="简装" value="简装">简装</el-option>
                    <el-option label="清水" value="清水">清水</el-option>
                  </el-select>
                  <el-input-number v-model="scope.row.compareA.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div> -->
                <div v-else>
                  <el-input style="width:100%" v-model="scope.row.compareA.valueA" />
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="compareB" label="实例B" align="center">
              <template scope="scope" style="float:right">
                <div v-if="needWeight.includes(scope.row.index)">
                  <el-input style="width:60%" v-model="scope.row.compareB.valueA" />
                  <el-input-number v-model="scope.row.compareB.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '市场状况'">
                  <el-date-picker v-model="scope.row.compareB.valueA" type="month" value-format="yyyy-MM-ddT00:00:00.000Z" style="width:60%" placeholder="选择月">
                  </el-date-picker>
                  <el-input-number v-model="scope.row.compareB.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '楼层/总楼层'">
                  <el-input style="width:26%" v-model="scope.row.compareB.valueA" />
                  <span style="margin-left:2%;margin-right:2%">/</span>
                  <el-input style="width:26%" v-model="scope.row.compareB.valueB" />
                  <el-input-number v-model="scope.row.compareB.weight" :min="1" :max="150" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '修正后价格'">
                  <span v-if="scope.row.compareB.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:20px">￥{{
                      parseFloat(scope.row.compareB.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '权重'">
                  <el-input-number v-if="compareList.calculateType === 'WEIGHT'" v-model="scope.row.compareB.valueA"
                    style="width:100%;" :min="0" :max="1" size="small" :step="0.1"
                    controls-position="right"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '总价(元)'">
                  <span v-if="scope.row.compareB.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:16px">￥{{
                      parseFloat(scope.row.compareB.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '单价(元)'">
                  <el-input-number v-model="scope.row.compareB.valueA" style="width:100%;" :min="0" size="small"
                    controls-position="right"></el-input-number>
                </div>
                <!-- <div v-else-if="scope.row.index === '室内装饰'">
                  <el-select v-model="scope.row.compareB.valueA" placeholder="请选择" style="width:60%">
                    <el-option label="精装" value="精装">精装</el-option>
                    <el-option label="中等装修" value="中等装修">中等装修</el-option>
                    <el-option label="简装" value="简装">简装</el-option>
                    <el-option label="清水" value="清水">清水</el-option>
                  </el-select>
                  <el-input-number v-model="scope.row.compareB.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div> -->
                <div v-else>
                  <el-input style="width:100%" v-model="scope.row.compareB.valueA" />
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="compareC" label="实例C" align="center">
              <template scope="scope" style="float:right">
                <div v-if="needWeight.includes(scope.row.index)">
                  <el-input style="width:60%" v-model="scope.row.compareC.valueA" />
                  <el-input-number v-model="scope.row.compareC.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '市场状况'">
                  <el-date-picker v-model="scope.row.compareC.valueA" type="month" value-format="yyyy-MM-ddT00:00:00.000Z" style="width:60%" placeholder="选择月">
                  </el-date-picker>
                  <el-input-number v-model="scope.row.compareC.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '楼层/总楼层'">
                  <el-input style="width:26%" v-model="scope.row.compareC.valueA" />
                  <span style="margin-left:2%;margin-right:2%">/</span>
                  <el-input style="width:26%" v-model="scope.row.compareC.valueB" />
                  <el-input-number v-model="scope.row.compareC.weight" :min="1" :max="150" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '修正后价格'">
                  <span v-if="scope.row.compareC.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:20px">￥{{
                      parseFloat(scope.row.compareC.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '权重'">
                  <el-input-number v-if="compareList.calculateType === 'WEIGHT'" v-model="scope.row.compareC.valueA"
                    style="width:100%;" :min="0" :max="1" size="small" :step="0.1"
                    controls-position="right"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '总价(元)'">
                  <span v-if="scope.row.compareC.valueA"
                    style="color:RGB(144,147,153);font-weight:bold;font-size:16px">￥{{
                      parseFloat(scope.row.compareC.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '单价(元)'">
                  <el-input-number v-model="scope.row.compareC.valueA" style="width:100%;" :min="0" size="small"
                    controls-position="right"></el-input-number>
                </div>
                <!-- <div v-else-if="scope.row.index === '室内装饰'">
                  <el-select v-model="scope.row.compareC.valueA" placeholder="请选择" style="width:60%">
                    <el-option label="精装" value="精装">精装</el-option>
                    <el-option label="中等装修" value="中等装修">中等装修</el-option>
                    <el-option label="简装" value="简装">简装</el-option>
                    <el-option label="清水" value="清水">清水</el-option>
                  </el-select>
                  <el-input-number v-model="scope.row.compareC.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div> -->
                <div v-else>
                  <el-input style="width:100%" v-model="scope.row.compareC.valueA" />
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="target" label="评估对象" align="center">
              <template scope="scope" style="float:right">
                <div v-if="needWeight.includes(scope.row.index)">
                  <el-input style="width:60%" v-model="scope.row.target.valueA" />
                  <el-input-number v-model="scope.row.target.weight" :min="1" size="small" controls-position="right"
                    style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '市场状况'">
                  <el-date-picker v-model="scope.row.target.valueA" type="month" value-format="yyyy-MM-ddT00:00:00.000Z" style="width:60%" placeholder="选择月">
                  </el-date-picker>
                  <el-input-number v-model="scope.row.target.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '楼层/总楼层'">
                  <el-input style="width:26%" v-model="scope.row.target.valueA" />
                  <span style="margin-left:2%;margin-right:2%">/</span>
                  <el-input style="width:26%" v-model="scope.row.target.valueB" />
                  <el-input-number v-model="scope.row.target.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '修正后价格'">
                  <span v-if="scope.row.target.valueA" style="color:red;font-weight:bold;font-size:20px">￥{{
                    parseFloat(scope.row.target.valueA).toLocaleString() }}</span>
                </div>
                <div v-else-if="scope.row.index === '权重'">
                  <el-input-number v-if="false" v-model="scope.row.target.valueA" style="width:100%;" :min="0" :max="1"
                    size="small" :step="0.1" controls-position="right"></el-input-number>
                </div>
                <div v-else-if="scope.row.index === '总价(元)' || scope.row.index === '单价(元)'">
                  <span v-if="scope.row.target.valueA" style="color:red;font-weight:bold;font-size:16px">￥{{
                    parseFloat(scope.row.target.valueA).toLocaleString() }}</span>
                </div>
                <!-- <div v-else-if="scope.row.index === '室内装饰'">
                  <el-select v-model="scope.row.target.valueA" placeholder="请选择" style="width:60%">
                    <el-option label="精装" value="精装">精装</el-option>
                    <el-option label="中等装修" value="中等装修">中等装修</el-option>
                    <el-option label="简装" value="简装">简装</el-option>
                    <el-option label="清水" value="清水">清水</el-option>
                  </el-select>
                  <el-input-number v-model="scope.row.target.weight" :max="150" :min="1" size="small"
                    controls-position="right" style="width:30%;margin-left:10%"></el-input-number>
                </div> -->
                <div v-else>
                  <el-input style="width:100%" v-model="scope.row.target.valueA" />
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </el-tab-pane>
      <el-tab-pane name="certificateInfo" class="pane-class" :lazy=true >
        <span slot="label"><i class="el-icon-postcard"></i> 证件信息</span>
        <el-tabs v-model="certificateInfo">
          <el-tab-pane name="CHANGE" class="pane-class" :lazy=true :disabled="!certificateCouldEdit">
            <span slot="label" :style="certificateCouldEdit ? 'color:red' : 'color:RGB(168,168,168)'"><i
                class="el-icon-refresh"></i> 换证</span>
            <div>
              <el-checkbox-group v-model="changeCredentials" size="medium" style="float: left;">
                <el-checkbox-button label="HOUSE_CERTIFICATE" name="credentials">房产证</el-checkbox-button>
                <el-checkbox-button label="LAND_CERTIFICATE" name="credentials">国土证</el-checkbox-button>
                <el-checkbox-button label="IMMOVABLE_CERTIFICATE" name="credentials">不动产权证</el-checkbox-button>
              </el-checkbox-group>
              <el-button type="danger" round style="float: left; margin-left: 20px;margin-top: 2px"
                @click="saveChangeCer()">确认换证</el-button>
            </div>
          </el-tab-pane>
          <el-tab-pane name="HOUSE_CERTIFICATE" class="pane-class" :lazy=true v-if="houseShow">
            <span slot="label"><i class="el-icon-postcard"></i> 房产证</span>
            <HouseCertificate ref="houseComponent" @custom-event="getPersonalTarget()" :id="target.id"
              :linkAttributes="linkAttributes" :houseCertificateObject="target.houseCertificate"
              :editStatus="certificateCouldEdit">
            </HouseCertificate>
          </el-tab-pane>
          <el-tab-pane name="LAND_CERTIFICATE" class="pane-class" :lazy=true v-if="landShow">
            <span slot="label"><i class="el-icon-postcard"></i> 国土证</span>
            <LandCertificate ref="landComponent" @custom-event="getPersonalTarget()" :id="target.id"
              :linkAttributes="linkAttributes" :landCertificateObject="target.landCertificate"
              :editStatus="certificateCouldEdit"></LandCertificate>
          </el-tab-pane>
          <el-tab-pane name="IMMOVABLE_CERTIFICATE" class="pane-class" :lazy=true v-if="immovalbeShow">
            <span slot="label"><i class="el-icon-postcard"></i> 不动产权证</span>
            <ImmovableCertificate ref="immovComponent" @custom-event="getPersonalTarget()" :id="target.id"
              :linkAttributes="linkAttributes" :immovableCertificateObject="target.immovableCertificate"
              :editStatus="certificateCouldEdit">
            </ImmovableCertificate>
          </el-tab-pane>
        </el-tabs>
      </el-tab-pane>
      <el-tab-pane name="otherInfo" class="pane-class" :lazy=true >
        <span slot="label"><i class="el-icon-chat-line-square"></i> 附加信息</span>
        <el-tabs v-model="otherInfo">
          <el-tab-pane name="entityInfo" class="pane-class" :lazy=true>
            <span slot="label"><i class="el-icon-paperclip"></i> 实物状况</span>
            <EntityInfo @custom-event="getPersonalTarget()" ref="entityCompent" :id="target.id"
              :linkAttributes="linkAttributes" :entityInfoObject="target.entityInfo" :editStatus="certificateCouldEdit">
            </EntityInfo>
          </el-tab-pane>
          <el-tab-pane name="backgroundInfo" class="pane-class" :lazy=true>
            <span slot="label"><i class="el-icon-paperclip"></i> 区位状况</span>
            <BackgroundInfo @custom-event="getPersonalTarget()" :id="target.id" ref="backgroundInfoComponet"
              :backgroundInfoObject="target.backgroundInfo" :linkAttributes="linkAttributes" :editStatus="certificateCouldEdit"></BackgroundInfo>
          </el-tab-pane>
          <el-tab-pane name="sellingAbilityInfo" class="pane-class" :lazy=true>
            <span slot="label"><i class="el-icon-paperclip"></i> 变现能力</span>
            <SellingAbilityInfo @custom-event="getPersonalTarget()" :id="target.id"
              :sellingAbilityInfoObject="target.sellingAbility" :editStatus="certificateCouldEdit"
              :outWardStaffId="personal.outwardStaff" :valueTiming="valueTiming"></SellingAbilityInfo>
          </el-tab-pane>
        </el-tabs>
      </el-tab-pane>
      <el-tab-pane name="producution" class="pane-class" :lazy=true>
        <span slot="label"><i class="el-icon-document-checked"></i> 产品信息</span>
        <div class="createMajor-main-container"
          v-if="currentNode.nodeCode === 'QUOTATION_FEEDBACK' || currentNode.nodeCode === 'STATEMENT_FEEDBACK' ||
          currentNode.nodeCode === 'REPORT_FEEDBACK' || currentNode.nodeCode === 'LETTER_FEEDBACK'">
          <div class="postInfo-container">
            <div>
              <el-divider content-position="left">
                <h3 class="title">
                  <div class="avatar-wrapper icon-title">反馈</div>
                  <div class="icon-info">客户反馈</div>
                </h3>
              </el-divider>
            </div>
            <el-form ref="feedbackFrom" class="form-container" style="margin-top:30px" :rules="rules">
              <el-row>
                <el-col :xs="24" :sm="12" :lg="12" :span="6">
                  <el-form-item label="选择反馈信息：" prop="production" label-width="160px" class="postInfo-container-item">
                    <el-checkbox-group v-model="feedback" @change="saveFeedback()">
                      <el-checkbox-button label="STATEMENT" name="production"  :disabled="!showStatement">出价值意见书</el-checkbox-button>
                      <el-checkbox-button label="CHANGE_STATEMENT" name="production" :disabled="!showChangeStatement">修改意见书</el-checkbox-button>
                      <el-checkbox-button label="REPORT" name="production"  :disabled="!showReport">出报告</el-checkbox-button>
                      <el-checkbox-button label="CHANGE_REPORT" name="production" :disabled="!showChangeReport">修改报告</el-checkbox-button>
                      <el-checkbox-button label="LETTER" name="production"  :disabled="!showLetter">出复评函</el-checkbox-button>
                      <el-checkbox-button label="CHANGE_LETTER" name="production"  :disabled="!showChangeLetter">修改复评函</el-checkbox-button>
                      <el-checkbox-button  label="NONE"
                        name="production">结束</el-checkbox-button>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>
        </div>
        <div class="createMajor-main-container">
          <div class="postInfo-container">
            <div>
              <el-divider content-position="left">
                <h3 class="title">
                  <div class="avatar-wrapper icon-title">产品</div>
                  <div class="icon-info">产品信息</div>
                  <el-button type="text" style="margin-left: 20px;" @click="generateAll()">一键生成</el-button>
                  <el-button type="text" style="margin-left: 20px;" @click="downloadAll()">全部下载</el-button>
                </h3>
              </el-divider>
            </div>
          </div>
        </div>
        <div v-if="showProds" style="display: flex;margin-top: 50px;margin-bottom: 20px; width: 100%;">
          <el-card :body-style="{ padding: '0px' }" shadow="always" style="margin-left: 5%; margin-right: 5%; width: 20%;"
            >
            <img :src="statementCardPNG" class="image">
            <div style="padding: 14px;">
              <span>房地产意见书</span>
              <span class="checked">{{ statementProd.checkState }}<i v-if="statementProd.checkState"
                  class="el-icon-circle-check"></i></span>
              <time class="time">{{ statementProd.modified }}</time>
              <div class="control">
                <el-button type="text" class="button" @click="doStamp(statementProd.files)"
                  :disabled="!statementProd.isOnline">加盖公章</el-button>
                <el-button type="text" class="button" @click="genProductionFile(1)" >系统生成</el-button>
                <el-button type="text" class="button" @click="downloadDoc(statementProd.files)">下载</el-button>
              </div>
              <!-- <a href="#" @click.prevent="openPageoffice()">打开文件</a> -->
            </div>
            <el-upload style="position: relative; top: -10px; padding: 10px;"
              :action="'/api/personalProduction/upload/' + target.id + '/1'" :file-list="statementProd.files" :limit="1"
              :on-exceed="handleExceed" :on-preview="handleAttachmentPreview" :on-success="getProductions"
              :before-remove="handleRemoveFile">
              <el-button type="text" style="position: relative; left: 10px;top: -4px;">手动上传</el-button>
            </el-upload>
          </el-card>
          <el-card :body-style="{ padding: '0px' }" shadow="always" style="margin-left: 5%; margin-right: 5%;width: 20%;"
            v-if="hasReport">
            <img :src="technicCardPNG" class="image">
            <div style="padding: 14px;">
              <span>技术报告</span>
              <span class="checked">{{ technicReportProd.checkState }}<i v-if="technicReportProd.checkState"
                  class="el-icon-circle-check"></i></span>
              <time class="time">{{ technicReportProd.modified }}</time>
              <div class="control">
                <el-button type="text" class="button" @click="doStamp(technicReportProd.files)"
                  :disabled="!technicReportProd.isOnline">加盖公章</el-button>
                <el-button type="text" class="button" @click="genProductionFile(2)"
                  >系统生成</el-button>
                  <el-button type="text" class="button" @click="downloadDoc(technicReportProd.files)">下载</el-button>
              </div>
            </div>
            <el-upload style="position: relative; top: -10px; padding: 10px;"
              :action="'/api/personalProduction/upload/' + target.id + '/2'" :file-list="technicReportProd.files"
              :limit="1" :on-exceed="handleExceed" :on-preview="handleAttachmentPreview" :on-success="getProductions"
              :before-remove="handleRemoveFile">
              <el-button type="text" style="position: relative; left: 10px;top: -4px;"
                >手动上传</el-button>
            </el-upload>
          </el-card>
          <el-card :body-style="{ padding: '0px' }" shadow="always" style="margin-left: 5%; margin-right: 5%;width: 20%;"
            v-if="hasReport">
            <img :src="finalCardPNG" class="image">
            <div style="padding: 14px;">
              <span>结果报告</span>
              <span class="checked">{{ finalReprotProd.checkState }}<i v-if="finalReprotProd.checkState"
                  class="el-icon-circle-check"></i></span>
              <time class="time">{{ finalReprotProd.modified }}</time>
              <div class="control">
                <el-button type="text" class="button" @click="doStamp(finalReprotProd.files)"
                  :disabled="!finalReprotProd.isOnline">加盖公章</el-button>
                <el-button type="text" class="button" @click="genProductionFile(3)"
                  >系统生成</el-button>
                  <el-button type="text" class="button" @click="downloadDoc(finalReprotProd.files)">下载</el-button>
              </div>
            </div>
            <el-upload style="position: relative; top: -10px;padding: 10px;"
              :action="'/api/personalProduction/upload/' + target.id + '/3'" :file-list="finalReprotProd.files" :limit="1"
              :on-exceed="handleExceed" :on-preview="handleAttachmentPreview" :on-success="getProductions"
              :before-remove="handleRemoveFile">
              <el-button type="text" style="position: relative; left: 10px;top: -4px;"
               >手动上传</el-button>
            </el-upload>
          </el-card>
          <el-card :body-style="{ padding: '0px' }" shadow="always" style="margin-left: 5%; margin-right: 5%;width: 20%;"
            v-if="hasLetter">
            <img :src="letterCardPNG" class="image">
            <div style="padding: 14px;">
              <span>复评函</span>
              <span class="checked">{{ letterReprotProd.checkState }}<i v-if="letterReprotProd.checkState"
                  class="el-icon-circle-check"></i></span>
              <time class="time">{{ letterReprotProd.modified }}</time>
              <div class="control">
                <el-button type="text" class="button" @click="downloadDoc(letterReprotProd.files)">下载</el-button>
              </div>
            </div>
            <el-upload style="position: relative; top: -10px;padding: 10px;"
              :action="'/api/personalProduction/upload/' + target.id + '/4'" :file-list="letterReprotProd.files"
              :limit="1" :on-exceed="handleExceed" :on-preview="handleAttachmentPreview" :on-success="getProductions"
              :before-remove="handleRemoveFile">
              <el-button type="text" style="position: relative; left: 10px;top: -4px;"
                >手动上传</el-button>
            </el-upload>
          </el-card>
        </div>
        <div v-else style="display: flex;margin-top: 100px; width: 100%;">
          <span style="color:rgb(144,147,153); margin-left: 2.2%; width: 20%; margin-top:-3%">还没有选择产品类型</span>
        </div>
      </el-tab-pane>
      <el-tab-pane name="workflowLog" class="pane-class" :lazy=true>
        <span slot="label"><i class="el-icon-date"></i> 流程日志</span>
        <div class="createMajor-main-container">
          <div class="postInfo-container">
            <div>
              <el-divider content-position="left">
                <h3 class="title">
                  <div class="avatar-wrapper icon-title">日志</div>
                  <div class="icon-info">流程审批日志</div>
                </h3>
              </el-divider>
            </div>
          </div>
        </div>
        <el-table :data="workflowLogs" stripe :header-row-style="{ color: '#333333' }" border
          style="width: 100%; margin-top:20px">
          <el-table-column prop="nodeName" label="节点名称" align="center">
          </el-table-column>
          <el-table-column prop="state" label="处理结果" align="center">
          </el-table-column>
          <el-table-column prop="handlerName" label="处理人" align="center">
          </el-table-column>
          <el-table-column prop="longTime" label="处理时长" align="center">
          </el-table-column>
          <el-table-column prop="created" label="处理时间" align="center">
          </el-table-column>
          <el-table-column prop="comments" label="处理意见" align="center" show-overflow-tooltip>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
    <el-dialog :visible.sync="decideProductionTypeDialog" width="25%" center top="35vh" custom-class="doWarehouseClass" @closed="cleanFlag()">
      <div>
        <i class="el-icon-warning" style="color:RGB(230,162,60);font-size:22px;margin-right:10px;"></i>
        <span style="position:absolute;top:58px">在此节点是否确定产品类型？</span>
      </div>
      <div style="margin-top:30px;margin-left:20px">
        <el-radio-group v-model="target.feedback">
          <el-radio label="NONE" value="NONE">不确定</el-radio>
          <el-radio label="STATEMENT" value="STATEMENT">价值意见书</el-radio>
          <el-radio label="REPORT" value="REPORT">报告</el-radio>
          <el-radio label="LETTER" value="LETTER">复评函或意见函</el-radio>
        </el-radio-group>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="decideProductionTypeDialog = false">取消</el-button>
        <el-button type="primary" @click="saveFeedbackWhenPrice()">保存</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="inWarehouseDialog" width="30%" center top="35vh" custom-class="doWarehouseClass">
      <div>
        <i class="el-icon-warning" style="color:RGB(230,162,60);font-size:22px;margin-right:10px;"></i>
        <span style="position:absolute;top:58px;padding-right:50px;font-size: 20px">{{ warehouseTip }}</span>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="inWarehouseDialog = false">取 消</el-button>
        <el-button type="primary" @click="doInWareHouse()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="outWarehouseDialog" width="30%" center top="35vh" custom-class="doWarehouseClass">
      <div>
        <i class="el-icon-warning" style="color:RGB(230,162,60);font-size:22px;margin-right:10px;"></i>
        <span style="position:absolute;top:58px;font-size: 20px">{{ warehouseTip }}</span>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="outWarehouseDialog = false">取 消</el-button>
        <el-button type="primary" @click="doOutWareHouse()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="checkDialog" width="1000px" center top="25vh" custom-class="doWarehouseClass" @closed="cleanFlag()">
      <el-divider content-position="left">产品审核</el-divider>
      <el-form ref="targetForm" :model="target">
        <el-row>
          <el-col :xs="24" :sm="12" :lg="24" :span="6">
            <el-form-item label="项目名称：" prop="location" label-width="140px" class="postInfo-container-item">
              <el-input :value="target.location" class="filter-item" disabled readonly style=" width: 100%" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :sm="12" :lg="8" :span="6">
            <el-form-item label="委托方1：" prop="bailorA" label-width="140px" class="postInfo-container-item">
              <el-input :value="personal.bailorA" disabled readonly class="filter-item" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="8" :span="6">
            <el-form-item label="委托方2：" prop="bailorB" label-width="140px" class="postInfo-container-item">
              <el-input :value="personal.bailorB" disabled readonly class="filter-item" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :sm="12" :lg="8" :span="6">
            <el-form-item label="评估面积：" prop="acreage" label-width="140px" class="postInfo-container-item">
              <el-input v-model="target.acreage" disabled readonly>
                <template slot="append">
                  <span>平</span>
                </template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="8" :span="6">
            <el-form-item label="评估单价：" prop="price" label-width="140px" class="postInfo-container-item">
              <el-input v-model="target.price" disabled readonly>
                <template slot="append">
                  <span>元</span>
                </template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="8" :span="6">
            <el-form-item label="评估总价：" prop="amount" label-width="140px" class="postInfo-container-item">
              <el-input v-model="target.amount" disabled readonly>
                <template slot="append">
                  <span>万元</span>
                </template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :sm="12" :lg="24" :span="6">
            <el-form-item label="备注：" prop="amount" label-width="140px" class="postInfo-container-item">
              <span style="font-weight: bolder; color: red;">本人已对评估结果信息及报告文档完成审核，已确认无误。</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="target.amount==null || target.amount===0">
          <el-col :xs="24" :sm="12" :lg="24" :span="6">
            <el-form-item label="" prop="" label-width="140px" class="postInfo-container-item">
              <span style="font-weight: bolder; color: red;">当前评估总价为0万元，审核有误！</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :sm="12" :lg="24" :span="6">
            <el-button type="info" style="margin-left: 40%;" @click="checkDialog = false">取消</el-button>
            <el-button type="success" @click="checkPass()" :disabled="target.amount==null || target.amount===0">确认</el-button>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <el-dialog  :visible.sync="checkerDialog" width="50%" center top="25vh" custom-class="doWarehouseClass" @closed="cleanCheckId()">
            <el-card shadow="never" class="card">
                <div>
                    <el-divider content-position="left">请确定审核人员</el-divider>
                    <el-radio-group v-model="checkerId" size="medium">
                        <div v-for="(u,id) in checkers" class="xRadio">
                            <el-radio  border  :label="u.id"  >{{ u.name }} </el-radio>
                        </div>
                    </el-radio-group>
                </div>
            </el-card>
            <div style="display: flex;">
                <el-button style="margin-left: 43%; margin-top: 10px;" type="info" @click="checkerDialog=false">取消</el-button>
                <el-button style="margin-top: 10px; float: right;" type="success" @click="commit('PASS')">确认</el-button>
            </div>
        </el-dialog>
  </div>
</template>
<script>
import YDetailPageLayout from '@/components/YDetailPageLayout/index_detail'
import WorkflowBoard from '@/components/workflowBoard'
import { calculateTargetPrice, validateParams } from '@/utils/personalUtil'
import HouseCertificate from '@/components/personalForms/houseCertificate'
import LandCertificate from '@/components/personalForms/landCertificate'
import ImmovableCertificate from '@/components/personalForms/immovableCertificate'
import EntityInfo from '@/components/personalForms/entityInfo'
import BackgroundInfo from '@/components/personalForms/backgroundInfo'
import SellingAbilityInfo from '@/components/personalForms/sellingAbilityInfo'
import existPNG from '@/assets/images/exist.png'
import emptyPNG from '@/assets/images/empty.png'
import { POBrowser } from 'js-pageoffice'
import utils from '@/utils/utils'
import Decimal from 'decimal.js';

export default {
  name: 'personalTodoDetail',
  components: {
    YDetailPageLayout,
    WorkflowBoard,
    HouseCertificate,
    LandCertificate,
    ImmovableCertificate,
    EntityInfo,
    BackgroundInfo,
    SellingAbilityInfo
  },
  watch: {
    $route(to, from) {
      if (to.path === from.path){
        this.personalId = to.query.id;
        this.businessSubId = to.query.orderId;
        this.isOnline = to.query.isOnline === 'true';
        this.nodeBusinessInfo.currentNodeInstanceCode = to.query.currentNodeCode;
        this.nodeBusinessInfo.doWorkflow = to.query.doWorkflow === 'true';
        this.nodeBusinessInfo.businessId = to.query.id;
        this.nodeBusinessInfo.businessSubId = to.query.orderId;
        this.activeTagName = this.jumpTabs();
        this.getPersonalTarget();
        this.getPersonal();
        this.getOutWardStaffList();
        this.getWorkflowLogs();
        this.getCurrentNodeInfo();
        this.getProductions();
        this.getScene();
      }
    },
    personal: {
      handler(newVal, oldVal) {
        if (newVal.outwardStaff) {
          this.outwardStaffTip = false;
        } else {
          this.outwardStaffTip = true;
        }
        this.certificateInfo = newVal.credentials[0];
        if (newVal.credentials.includes("HOUSE_CERTIFICATE")) {
          this.houseShow = true;
        } else {
          this.houseShow = false;
        }
        if (newVal.credentials.includes("LAND_CERTIFICATE")) {
          this.landShow = true;
        } else {
          this.landShow = false;
        }
        if (newVal.credentials.includes("IMMOVABLE_CERTIFICATE")) {
          this.immovalbeShow = true;
        } else {
          this.immovalbeShow = false;
        }
        this.changeCredentials = newVal.credentials;
      },
      deep: true
    },
    activeTagName: {
      handler(newVal, oldVal) {
        if (newVal != 'order') {
          this.outwardStaffTip = false;
        }
      },
    },
    target: {
      handler(newVal, oldVal) {
        this.getPersonal();
        if (newVal.acreage != null && newVal.price != null && newVal.price !=null && newVal.price != 0) {
          let acrege = Decimal(newVal.acreage);
          let price = Decimal(newVal.price);
          let wan = Decimal(10000);
          let amount = acrege.mul(price).div(wan);
          newVal.amount = utils.roundToDecimalPlace(amount,2)
        }
      
        if (newVal.id) {
          this.getProductions();
        }
        if (newVal.isOnline) {
          this.jumpTabs();
        }
        if (this.$refs.backgroundInfoComponet) {
            this.$refs.backgroundInfoComponet.refreshLinkAttributes();
        }
      },
      deep: true
    },
    feedback: {
      handler(newVal, oldVal) {
        if (this.currentNode.nodeCode === 'STATEMENT_FEEDBACK' && !newVal.includes("STATEMENT")) {
          //this.feedback.push("STATEMENT");
        }
        // if (this.currentNode.nodeCode === 'QUOTATION_FEEDBACK' && newVal.length>1) {
        //   this.$message("只能选择一种产品类型。");
        //   //this.feedback = oldVal;
        // }
        // if (this.currentNode.nodeCode === 'STATEMENT_FEEDBACK' && newVal.length!=2) {
        //   this.$message("只能选择一种产品类型。");
        //   //this.feedback = oldVal;
        // }
        // if ((newVal.includes("REPORT") && newVal.includes("LETTER")) ||
        //     (newVal.includes("REPORT") && newVal.includes("NONE")) ||
        //     (newVal.includes("LETTER") && newVal.includes("NONE"))) {
        //     this.$message('除意见书以外，只能选择剩余中的一种选项');
        //   //this.feedback = oldVal;
        // }

        this.nodeBusinessInfo.production = this.feedback;
        this.$refs.board.getInstanceQueue();
        if (this.feedback.includes("STATEMENT")) {
          this.hasStatement = true;
        } else {
          this.hasStatement = false;
        }
        if (this.feedback.includes("REPORT")) {
          this.hasReport = true;
        } else {
          this.hasReport = false;
        }
        if (this.feedback.includes("LETTER")) {
          this.hasLetter = true;
        } else {
          this.hasLetter = false;
        }

        if (this.feedback.length > 0) {
          this.showProds = true
        } else {
          this.showProds = false;
        }
      },
      deep: true
    },
    'compareList.analysisData': {
      handler(newVal, oldVal) {
        if (newVal[2].compareA.valueA && newVal[5].compareA.valueA) {
          newVal[1].compareA.valueA = newVal[2].compareA.valueA * newVal[5].compareA.valueA;
        }
        if (newVal[2].compareB.valueA && newVal[5].compareB.valueA) {
          newVal[1].compareB.valueA = newVal[2].compareB.valueA * newVal[5].compareB.valueA;
        }
        if (newVal[2].compareC.valueA && newVal[5].compareC.valueA) {
          newVal[1].compareC.valueA = newVal[2].compareC.valueA * newVal[5].compareC.valueA;
        }
      },
      deep: true,
    },
    certificateInfo: {
      handler() {
        this.$nextTick(() => {
          if (this.$refs.immovComponent) {
            this.$refs.immovComponent.refreshLinkAttributes();

          }
          if (this.$refs.houseComponent) {
            this.$refs.houseComponent.refreshLinkAttributes();
          }
          if (this.$refs.landComponent) {
            this.$refs.landComponent.refreshLinkAttributes();
          }
        })
      },
      immediate: true
    }
  },
  computed: {
    certificateCouldEdit() {
      let currentNodeCode = this.$route.query.currentNodeCode;
      if (currentNodeCode === 'GENERATE_STATEMENT' || currentNodeCode === 'WRITE_REPORT' || currentNodeCode === 'WRITE_LETTER'
        || currentNodeCode === 'REVIEW_STATEMENT' || currentNodeCode === 'CHECK_REPORT' || currentNodeCode === 'CHECK_LETTER'
      ) {
        return true;
      } else {
        return false;
      }

    },
    showStatement(){
      if (this.$route.query.currentNodeCode=== 'QUOTATION_FEEDBACK'){
          return true;
      }
      
    },
    showChangeStatement(){
      if (this.$route.query.currentNodeCode=== 'STATEMENT_FEEDBACK'){
        return true;
      }
    },
    showReport(){
      if (this.$route.query.currentNodeCode=== 'QUOTATION_FEEDBACK' || this.$route.query.currentNodeCode=== 'STATEMENT_FEEDBACK'){
        return true;
      }
    },
    showChangeReport(){
      if (this.$route.query.currentNodeCode=== 'REPORT_FEEDBACK' ){
        return true;
      }   
    },
    showLetter(){
      if (this.$route.query.currentNodeCode=== 'QUOTATION_FEEDBACK' ||this.$route.query.currentNodeCode=== 'REPORT_FEEDBACK' || this.$route.query.currentNodeCode=== 'STATEMENT_FEEDBACK'){
        return true;
      }
    },
    showChangeLetter(){
      if (this.$route.query.currentNodeCode=== 'LETTER_FEEDBACK' ){
        return true;
      }   
    }
  },

  data() {
    return {
      rules: {
        outwardStaff: [
          { required: true, message: '外业人员不能为空', trigger: 'blur' },
        ],
      },
      workflowLogs: [],
      activeName: null,
      activeTagName: null,
      nodeBusinessInfo: {
        currentNodePermission: {
          commit: true,
          reversible: true,
          restartable: true,
          terminable: true,
          skippable: true,
        },
        mainBusiness: "PERSONAL_BUSINESS",
        doWorkflow: false,
        businessId: null,
        currentNodeInstanceId: null,
        currentNodeInstanceCode: null,
        production: [],
        businessSubId: null,
        ifFeedback: null,
        ccId: null
      },
      currentNode: {
        flowId: null,
        pnodeId: null,
        nodeId: null,
        flowCode: null,
        nodeName: "",
        nodeCode: null,
        state: "",
        instanceId: null,
        sequence: null,
        restartable: null,
        reversible: null,
        skippable: null,
        terminable: null,
        tasks: []
      },
      personal: {
        id: null,
        clientManagerId: null,
        clientManager: null,
        evaluateAim: null,
        purpose: [],
        location: null,
        clienteleType: null,
        clienteleId: null,
        cclienteleName: null,
        cclienteleSubName: null,
        agent: null,
        cclienteleContactName: null,
        cmobile: null,
        cdepartment: null,
        cduty: null,
        loanNature: null,
        loanAim: null,
        loanLimit: null,
        loanPeriod: null,
        loanExpire: false,
        credentials: [],
        bailorA: null,
        bailorATel: null,
        bailorB: null,
        bailorBTel: null,
        terminalClienteleType: null,
        tterminalClienteleName: null,
        tterminalClienteleContactName: null,
        tmobile: null,
        remark: null,
        inwardStaffName: null,
        outwardStaff: null,
        outwardStaffName: null,
        pricingStaffName: null,
        inwardStaffName: null,
      },
      outwardStaffs: [],
      outwardStaffTip: true,
      certificateName: null,
      otherInfo: 'entityInfo',
      certificateInfo: null,
      target: {
        id: null,
        personalId: null,
        location: null,
        bailorA: null,
        bailorB: null,
        acreage: null,
        amount: null,
        price: null,
        isOnline: null,
        feedback: null,
        houseCertificate: null,
        landCertificate: null,
        immovableCertificate: null,
        entityInfo: null,
        backgroundInfo: null,
        sellingAbility: null,
        sellMoney: null,
        sellMoneyBase: null,
        sellMoneyRate: null,
        validateCode: null
      },
      compareList: {
        targetId: null,
        calculateId: null,
        fixValue: 1,
        rightsType: 'SELL',
        rollingLevel: 1,
        calculateType: 'SIMPLE',
        method: 'COMPARE',
        analysisData: [
          {
            "sorted": null,
            "index": "坐落",
            "compareA": { valueA: null },
            "compareB": { valueA: null },
            "compareC": { valueA: null },
            "target": { valueA: null },
          },
          {
            "sorted": null,
            "index": "总价(元)",
            "compareA": { valueA: null },
            "compareB": { valueA: null },
            "compareC": { valueA: null },
            "target": { valueA: null },
          },
          {
            "sorted": null,
            "index": "单价(元)",
            "compareA": { valueA: null },
            "compareB": { valueA: null },
            "compareC": { valueA: null },
            "target": { valueA: null },
          },
          {
            "sorted": null,
            "index": "市场状况",
            "compareA": { valueA: null, weight: 100 },
            "compareB": { valueA: null, weight: 100 },
            "compareC": { valueA: null, weight: 100 },
            "target": { valueA: null, weight: 100 },
          },
          {
            "sorted": null,
            "index": "所在楼栋",
            "compareA": { valueA: '对中庭', weight: 100 },
            "compareB": { valueA: '对中庭', weight: 100 },
            "compareC": { valueA: '对中庭', weight: 100 },
            "target": { valueA: '对中庭', weight: 100 },
          },
          {
            "sorted": null,
            "index": "建筑面积(平)",
            "compareA": { valueA: 0, weight: 100 },
            "compareB": { valueA: 0, weight: 100 },
            "compareC": { valueA: 0, weight: 100 },
            "target": { valueA: 0, weight: 100 },
          },
          {
            "sorted": null,
            "index": "楼层/总楼层",
            "compareA": { valueA: null, valueb: null, weight: 100 },
            "compareB": { valueA: null, valueb: null, weight: 100 },
            "compareC": { valueA: null, valueb: null, weight: 100 },
            "target": { valueA: null, valueb: null, weight: 100 },
          },
          {
            "sorted": null,
            "index": "户型",
            "compareA": { valueA: null, weight: 100 },
            "compareB": { valueA: null, weight: 100 },
            "compareC": { valueA: null, weight: 100 },
            "target": { valueA: null, weight: 100 },
          },
          {
            "sorted": null,
            "index": "室内装饰",
            "compareA": { valueA: null, weight: 100 },
            "compareB": { valueA: null, weight: 100 },
            "compareC": { valueA: null, weight: 100 },
            "target": { valueA: null, weight: 100 },
          },
          {
            "sorted": null,
            "index": "其他",
            "compareA": { valueA: null, weight: 100 },
            "compareB": { valueA: null, weight: 100 },
            "compareC": { valueA: null, weight: 100 },
            "target": { valueA: null, weight: 100 },
          },
          {
            "sorted": null,
            "index": "修正后价格",
            "compareA": { valueA: null },
            "compareB": { valueA: null },
            "compareC": { valueA: null },
            "target": { valueA: null },
          }
        ],
        price: null,
        amount: null,
        acreage: null,
        sellMoney: null,
        sellMoneyBase: null,
        sellMoneyRate: null
      },
      needWeight: ['所在楼栋', '建筑面积(平)', '户型', '其他','室内装饰'],
      requiredIndex: ['单价(元)', '坐落', '市场状况', '所在楼栋', '建筑面积(平)', '户型', '室内装饰', '楼层/总楼层', '权重'],
      calculateWeight: {
        "sorted": null,
        "index": "权重",
        "compareA": { valueA: null },
        "compareB": { valueA: null },
        "compareC": { valueA: null },
        "target": { valueA: null },
      },
      calculating: false,
      decideProductionTypeDialog: false,
      linkAttributes: {
        location: null,
        bailor1: null,
        bailor1Tel: null,
        bailor2: null,
        bailor2Tel: null,
        acreage: null,
        allFloor: null,
        purpose: null,
        ownerName: null,
        atFloor: null,
        communityName:null

      },
      statementProd: {
        id: null,
        targetId: null,
        files: [],
        created: null,
        checkState: null,
        isOnline: null
      },
      technicReportProd: {
        id: null,
        targetId: null,
        files: [],
        created: null,
        checkState: null
      },
      finalReprotProd: {
        id: null,
        targetId: null,
        files: [],
        created: null,
        checkState: null
      },
      letterReprotProd: {
        id: null,
        targetId: null,
        files: [],
        created: null,
        checkSatae: null
      },
      statementCardPNG: emptyPNG,
      technicCardPNG: emptyPNG,
      finalCardPNG: emptyPNG,
      letterCardPNG: emptyPNG,
      outWarehouseDialog: false,
      inWarehouseDialog: false,
      warehouseTip: null,
      productionId: null,
      hasStatement: false,
      hasReport: false,
      hasLetter: false,
      feedback: null,
      checkDialog: false,
      checkProDTO: {
        targetId: null,
        production: null
      },
      showProds: true,
      sceneForm: {
        id: null,
        personalId: null,
        inRingDewlling: null,
        outRingDewlling: null,
        inRingBuilding: null,
        outRingBuilding: null,
        remark: null
      },
      houseShow: false,
      immovalbeShow: false,
      landShow: false,
      changeCredentials: [],
      showQR:true,
      checkerDialog:false,
      checkerId:null,
      checkers:[],
      decideProduction:false,
      checkStateFlag:false,
      valueTiming:null

    }
  },

  created() {
    this.personalId = this.$route.query.id;
    this.businessSubId = this.$route.query.orderId;
    this.isOnline = this.$route.query.isOnline === 'true';
    this.nodeBusinessInfo.currentNodeInstanceCode = this.$route.query.currentNodeCode;
    this.nodeBusinessInfo.doWorkflow = this.$route.query.doWorkflow === 'true';
    this.nodeBusinessInfo.businessId = this.$route.query.id;
    this.nodeBusinessInfo.businessSubId = this.$route.query.orderId;
    this.activeTagName = this.jumpTabs();
    this.getPersonalTarget();
    this.getPersonal();
    this.getOutWardStaffList();
    this.getWorkflowLogs();
    this.getCurrentNodeInfo();
    this.getProductions();
    this.getScene();

  },

  methods: {
    getPersonal() {
      if (this.personalId) {
        this.$api.personal.detail(this.personalId).then(res => {
          if (res.code === 200) {
            res.data.credentials = JSON.parse(res.data.credentials);
            res.data.purpose = JSON.parse(res.data.purpose);
            this.personal = res.data;
            // this.linkAttributes.location = this.personal.location;
            // this.linkAttributes.bailor1 = this.personal.bailorA;
            // this.linkAttributes.bailor1Tel = this.personal.bailoraTel;
            // this.linkAttributes.bailor2 = this.personal.bailorB;
            // this.linkAttributes.bailor2Tel = this.personal.bailorbTel;
            this.linkAttributes.purpose = this.personal.purpose;
            if (this.personal.evaluateAim === '抵押') {
              this.linkAttributes.ownerName = this.personal.bailorA;
            }

            this.nodeBusinessInfo.ccId = this.personal.clienteleId;
          }
        })
      }
    },
    getPersonalTarget() {
      if (this.personalId) {
        this.$api.personalTarget.detail(this.personalId).then(res => {
          if (res.code === 200) {
            this.target = res.data;
            //如果没有单价，则只用总价。 个贷多套有这情况
            if (this.target.price==null || this.target.price===0){
                if (this.target.amount){
                  let amount = Decimal(this.target.amount);
                  let wan = Decimal(10000);
                  this.target.amount = utils.roundToDecimalPlace(amount.div(wan),2);
                }
            }
            this.linkAttributes.acreage = this.target.acreage;
            if (res.data.isOnline) {
              this.getCaluateTable(res.data.id)
            }
            if (res.data.houseCertificate) {
              this.target.houseCertificate = JSON.parse(res.data.houseCertificate);
              this.linkAttributes.location = this.target.houseCertificate.location;
            }
            if (res.data.landCertificate) {
              this.target.landCertificate = JSON.parse(res.data.landCertificate) 
            }
            if (res.data.immovableCertificate) {
              this.target.immovableCertificate = JSON.parse(res.data.immovableCertificate);
              this.linkAttributes.location = this.target.immovableCertificate.location;
            }
            if (res.data.entityInfo) {
              this.target.entityInfo = JSON.parse(res.data.entityInfo);
            }
            if (res.data.backgroundInfo) {
              this.target.backgroundInfo = JSON.parse(res.data.backgroundInfo);
              this.linkAttributes.location = this.target.backgroundInfo.location;
            }
            if (res.data.sellingAbility) {
              this.target.sellingAbility = JSON.parse(res.data.sellingAbility);
            }
            if (res.data.feedback) {
              this.feedback = JSON.parse(res.data.feedback);
              this.nodeBusinessInfo.production = this.feedback;
              this.nodeBusinessInfo.ifFeedback = this.feedback?false:true;
            } else {
              this.feedback = []
            }
            this.qrCodeUrl = this.target.qrCode;
          }
        })
      }
    },
    getCurrentNodeInfo() {
      if (this.personalId) {
        this.$api.workNodeInstance.currentNode({ "mainBusiness": "PERSONAL_BUSINESS", "businessId": this.personalId, "businessSubId": this.businessSubId }).then(res => {
          if (res.code === 200) {
            if (res.data) {
              this.currentNode = res.data;
              this.nodeBusinessInfo.currentInstanceNodeId = res.data.instanceId;
              this.nodeBusinessInfo.currentNodeInstanceCode = res.data.nodeCode;
              this.nodeBusinessInfo.currentNodePermission.restartable = res.data.restartable;
              this.nodeBusinessInfo.currentNodePermission.reversible = res.data.reversible;
              this.nodeBusinessInfo.currentNodePermission.skippable = res.data.skippable;
              this.nodeBusinessInfo.currentNodePermission.terminable = res.data.terminable;
            }
          }
        })
      }
    },
    handleClick(tab) {
      if ("producution" === tab && this.feedback == null) {
        this.feedback = [];
      }
      if ("scene" === tab) {
        this.getScene();
      }
    },

    getWorkflowLogs() {
      let param = {
        businessId: this.personalId,
        businessType: 'PERSONAL_BUSINESS',
        businessSubId: this.businessSubId
      }
      this.$api.workflowLog.list(param).then(res => {
        if (res.code === 200) {
          this.workflowLogs = res.data;
          const sences = this.workflowLogs.filter(item=>item.nodeName=='现场勘查');
          this.valueTiming = sences[sences.length-1].created
        }
      })
    },
    workflowCommitVerify(val, callback) {
      let commit = val.commit;
      let verify = new Object();
      verify.state = true;
      verify.productionType = this.feedback;
      verify.nextHandlerId = this.checkerId;
      if (commit.state === 'PASS') {
        let nodeCode = this.nodeBusinessInfo.currentNodeInstanceCode;
        switch (nodeCode) {
          case 'DEPARTMENT_ALLOCATION':
            if (!this.personal.outwardStaff) {
              this.$message('请确定外业人员后，再提交流程。')
              verify.state = false;
            } else {
              verify.nextHandlerId = this.personal.outwardStaff;
            }
            callback(verify);
            return;
          case "DETERMINE_PRICE":
            if (!this.decideProduction) {
              verify.state = false;
              callback(verify);
              this.decideProductionTypeDialog = true
              return;
            } else {
              callback(verify);
              return;
            }
          case "GENERATE_STATEMENT":
          case "WRITE_REPORT":
          case "WRITE_LETTER":
            // if (this.isOnline) {
            //   let ok = true;
            //   this.personal.credentials.forEach(item => {
            //     if (item === 'HOUSE_CERTIFICATE' && !this.target.houseCertificate) {
            //       this.$notify({
            //         title: '提示',
            //         message: '请先完成房产证信息录入再提交，否则请切换为线下流程。',
            //         type: 'error',
            //         duration: 2000
            //       });
            //       ok = false;
                
            //     }
            //     if (item === 'LAND_CERTIFICATE' && !this.target.landCertificate) {
            //       this.$notify({
            //         title: '提示',
            //         message: '请先完成国土证信息录入再提交，否则请切换为线下流程。',
            //         type: 'error',
            //         duration: 2000
            //       });
            //       ok = false;
                
            //     }
            //     if (item === 'IMMOVABLE_CERTIFICATE' && !this.target.immovableCertificate) {
            //       this.$notify({
            //         title: '提示',
            //         message: '请先完成不动产权证信息录入再提交，否则请切换为线下流程。',
            //         type: 'error',
            //         duration: 2000
            //       });
            //       ok = false;
                
            //     }
            //   })
            //   if (!ok){
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (this.compareList.calculateId==null || this.compareList.targetId==null){
            //     this.$notify({
            //       title: '提示',
            //       message: '请先完成可比实例表。',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (ok && nodeCode === 'GENERATE_STATEMENT' && (this.statementProd == null || this.statementProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '请生成意见书，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (ok && nodeCode === 'WRITE_REPORT' && (this.technicReportProd == null || this.technicReportProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '请生成报告，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (ok && nodeCode === 'WRITE_LETTER' && (this.letterReprotProd == null || this.letterReprotProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '请生成复评函，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
              
            // }
            // else{
            //   if (nodeCode === 'GENERATE_STATEMENT' && (this.statementProd == null || this.statementProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '流程类型为下线请上传意见书，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (nodeCode === 'WRITE_REPORT' && (this.technicReportProd == null || this.technicReportProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '流程类型为下线请上传报告，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            //   if (nodeCode === 'WRITE_LETTER' && (this.letterReprotProd == null || this.letterReprotProd.files.length === 0)) {
            //     this.$notify({
            //       title: '提示',
            //       message: '流程类型为下线请上传复评函，再提交流程',
            //       type: 'error',
            //       duration: 2000
            //     });
            //     verify.state = false;
            //     callback(verify);
            //     return;
            //   }
            // }
            if (!verify.nextHandlerId ){
              this.checkerDialog = true;
              this.$api.user.postUserVOList("个贷审核岗").then(res => {
                  if (res.code === 200) {
                    this.checkers = res.data;
                    //默认复审人
                    this.checkerId = res.data[0].id;
                  }
                })
              verify.state = false;
              callback(verify);
              return;
            }
            callback(verify);
            return;
          case "REVIEW_STATEMENT":
            if (!this.checkStateFlag) {
              verify.state = false;
              callback(verify);
              this.checkProDTO.production = "STATEMENT";
              this.checkProDTO.targetId = this.target.id;
              this.getPersonalTarget();
              this.checkDialog = true
              return;
            }
            callback(verify);
            return;

          case "CHECK_REPORT":
            if (!this.checkStateFlag) {
              verify.state = false;
              callback(verify);
              this.checkProDTO.production = "REPORT";
              this.checkProDTO.targetId = this.target.id;
              this.getPersonalTarget();
              this.checkDialog = true
              return;
            }
            callback(verify);
            return;
          case "CHECK_LETTER":
            if (!this.checkStateFlag) {
              verify.state = false;
              callback(verify);
              this.checkProDTO.production = "LETTER";
              this.checkProDTO.targetId = this.target.id;
              this.getPersonalTarget();
              this.checkDialog = true
              return;
            }
            callback(verify);
            return;
          case "QUOTATION_FEEDBACK":
            if (this.feedback.length != 1) {
              verify.state = false;
              callback(verify);
              this.$message("还没有确定产品类型");
              return;
            }
            callback(verify);
            return;
          case "STATEMENT_FEEDBACK":
            if (this.feedback.length != 2) {
              verify.state = false;
              callback(verify);
              this.$message("意见书送达后，还没有确定后续产品类型。");
              return;
            }
            callback(verify);
            return;
        }
      }
    },
    handleChange(tab) {
      if (this.outwardStaffTip) {
        this.outwardStaffTip = false;
      }
    },
    goBack() {
      const back = this.$route.query.back
      if (back) {
        this.$router.push(back)
      }
    },
    getOutWardStaffList() {
      this.$api.user.postUser("个贷外业岗").then(res => {
        if (res.code === 200) {
          this.outwardStaffs = res.data;
        }
      })
    },
    saveOutwardStaff() {
      this.$refs.personalMemberForm.validate(valid => {
        if (valid) {
          if (this.personal.id) {
            const personalMember = new Object();
            personalMember.id = this.personal.id;
            personalMember.outwardStaff = this.personal.outwardStaff
            const taskRecordDTO = this.buildTaskRecordDTO(personalMember);
            this.$api.personal.allotOutward(taskRecordDTO).then(res => {
              if (res.code === 200 && res.data) {
                this.$notify({
                  title: '成功',
                  message: '保存成功,请提交节点继续流程。',
                  type: 'success',
                  duration: 2000
                });
              } else {
                this.$notify({
                  title: '失败',
                  message: '保存失败,请提联系系统管理员',
                  type: 'success',
                  duration: 2000
                });
              }
            })
          }
        }
      })
    },
    //构建任务处理对象
    buildTaskRecordDTO(data) {
      const taskRecordDTO = new Object();
      taskRecordDTO.recordId = this.currentNode.tasks[0].recordId;
      taskRecordDTO.taskData = data;
      return taskRecordDTO;
    },
    //提交节点
    commit(state) {
      this.$refs.board.commit(state);
    },
    jumpTabs() {
      const orderTag = ['OPENING_ORDER', 'DEPARTMENT_ALLOCATION'];
      const evaluate = ['DETERMINE_PRICE', 'REVIEW_STATEMENT', 'CHECK_REPORT', 'CHECK_LETTER'];
      const certificates = ['GENERATE_STATEMENT', 'WRITE_REPORT', 'WRITE_LETTER']
      const scenesTag = ['SPOT_RECONNAISSANCE']
      const nodeCode = this.$route.query.currentNodeCode;
      if (orderTag.includes(nodeCode)) {
        return 'order';
      }
      if (evaluate.includes(nodeCode)) {
        return 'evaluate'
      }
      if (certificates.includes(nodeCode) && this.isOnline) {
        return 'certificateInfo';
      }
      if (this.feedback == null) {
        this.feedback = [];
      }
      if (scenesTag.includes(nodeCode)) {
        return 'scene';
      }
      return 'producution'
    },
    calulate(){
      this.calculating = true;
      this.$refs.compareToForm.validate(valid => {
        if (valid) {
          if (validateParams(this.compareList.analysisData)) {
            this.compareList = calculateTargetPrice(this.compareList);
          }
        }
      })
      setTimeout(() => {
        this.calculating = false;
      }, 500)
    },
    calulateAndSave() {
      this.calculating = true;
      this.$refs.compareToForm.validate(valid => {
        if (valid) {
          if (validateParams(this.compareList.analysisData)) {
            this.compareList = calculateTargetPrice(this.compareList);
          }
        }
      })
      this.saveCalulateResult();
      setTimeout(() => {
        this.calculating = false;
      }, 500)
    },
    saveCalulateResult() {
      this.target.amount = this.compareList.amount;
      this.target.price = this.compareList.price;
      this.target.acreage = this.compareList.acreage;
      this.compareList.targetId = this.target.id;
      this.target.sellMoneyRate = this.compareList.sellMoneyRate;
      this.target.sellMoney = this.compareList.sellMoney;
      this.target.sellMoneyBase = this.compareList.sellMoneyBase;
      let message = this.target.price?'价格保存成功。':'价格未计算，暂存可比实例信息。';
      let type = this.target.price?'success':'warning';
      let taskRecord = this.buildTaskRecordDTO(this.compareList);
      this.$api.personalCalculate.calculate(taskRecord).then(res => {
        if (res.code === 200 && res.data) {
          this.getCaluateTable(this.target.id);
          this.$notify({
            title: '成功',
            message: message,
            type: type,
            duration: 2000
          });
        } else {
          this.$notify({
            title: '失败',
            message: '保存失败',
            type: 'error',
            duration: 2000
          });
        }
      })
    },
    savePrice() {
      this.$refs.targetForm.validate(valid => {
        if (valid) {
          let target = new Object();
          target.id = this.target.id;
          target.personalId = this.target.personalId;
          target.price = this.target.price
          target.amount = this.target.amount*10000;
          target.acreage = this.target.acreage;
          target.location = this.personal.location;
          target.bailorA = this.personal.bailorA;
          target.bailorB = this.personal.bailorB;
          let taskRecord = this.buildTaskRecordDTO(target);
          this.$api.personalTarget.price(taskRecord).then(res => {
            if (res.code === 200 && res.data) {
              this.$notify({
                title: '成功',
                message: '保存成功',
                type: 'success',
                duration: 2000
              });
              this.getPersonalTarget();
            } else {
              this.$notify({
                title: '失败',
                message: '保存失败',
                type: 'error',
                duration: 2000
              });
            }
          })
        }
      })
    },
    getCaluateTable(targetId) {
      if (targetId) {
        this.$api.personalCalculate.getResult(targetId).then(res => {
          if (res.code === 200 && res.data) {
            this.compareList = res.data;
            this.linkAttributes.allFloor = this.compareList.analysisData[6].target.valueB;
            this.linkAttributes.atFloor = this.compareList.analysisData[6].target.valueA;
            this.linkAttributes.houseType = this.compareList.analysisData[7].target.valueA;
            this.linkAttributes.communityName = this.compareList.analysisData[0].target.valueA;
            this.selectCalculateType();
          }else {
            this.defalutYearMonth();
          }
        })
      }
    },
    calculateSwith() {
      this.$api.personalTarget.calculateSwith(this.target.isOnline, this.target.id).then(res => {
        if (res.code === 200 && res.data) {
          this.isOnline = this.target.isOnline;
        }
      })
      if (this.target.isOnline && !this.compareList.calculateId) {
        this.getCaluateTable(this.target.id);
      }

    },
    selectCalculateType() {
      let data = this.compareList.analysisData
      if (this.compareList.calculateType === 'SIMPLE') {
        let dataX = data.filter(function (item) {
          return item.index != '权重'
        })
        this.compareList.analysisData = dataX;
      } else {
        if (!data.map(item => item.index).includes("权重")) {
          data.splice(10, 0, this.calculateWeight)
        }
      }
    },
    saveFeedbackWhenPrice() {
      this.decideProduction = true;
      if (this.target.id && this.target.feedback && this.target.feedback != 'NONE') {
        this.nodeBusinessInfo.ifFeedback = false;
        this.nodeBusinessInfo.production = [this.target.feedback];
        const feedbackReq = new Object();
        feedbackReq.feedback = this.target.feedback;
        feedbackReq.id = this.target.id;
        feedbackReq.personalId = this.target.personalId;
        this.$api.personalTarget.feedback(feedbackReq);
      }
      this.decideProductionTypeDialog = false;
      this.commit("PASS");
    },
    genProductionFile(tag) {
      const certificates = this.personal.credentials
      for (let i in certificates) {
        if (certificates[i] === 'HOUSE_CERTIFICATE' && !this.target.houseCertificate) {
          this.$message('房产证未点击保存');
          return;
        }
        if (certificates[i] === 'LAND_CERTIFICATE' && !this.target.landCertificate) {
          this.$message('国土证未点击保存');
          return;
        }
        if (certificates[i] === 'IMMOVABLE_CERTIFICATE' && !this.target.immovableCertificate) {
          this.$message('不动产权证未点击保存');
          return;
        }
      }
      if (!this.target.entityInfo) {
        this.$message('实物状况未点击保存');
        return;
      }
      if (!this.target.backgroundInfo) {
        this.$message('区位状况未点击保存');
        return;
      }
      if (!this.target.sellingAbility) {
        this.$message('变现能力未点击保存');
        return;
      }
      this.$confirm('系统生成将会覆盖原有文档，请确认是否继续？', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        if (this.personal.id && this.target.id) {
          this.$api.personalProduction.genFile(this.personal.id, tag).then(res => {
            if (res.code === 200 && res.data) {
              this.$notify({
                title: '成功',
                message: '生成文档成功',
                type: 'success',
                duration: 2000
              });
              this.getProductions();
              this.getPersonalTarget();
            } else {
              this.$notify({
                title: '失败',
                message: '生成文档失败',
                type: 'error',
                duration: 2000
              });
            }
          })
        }
      })
    },
    getProductions() {
      if (this.target.id) {
        this.$api.personalProduction.getProductions(this.target.id).then(res => {
          if (res.code === 200) {
            const words = res.data
            words.forEach(word => {
              if (word.production === 'STATEMENT') {
                this.statementProd = word;
                const fs = [];
                if (word.filePath) {
                  this.statementCardPNG = existPNG;
                  const sta = JSON.parse(word.filePath)
                  sta.id = word.id;
                  fs.push(sta);
                } else {
                  this.statementCardPNG = emptyPNG;
                }
                this.statementProd.files = fs;
              }
              if (word.production === 'TECHNIC') {
                this.technicReportProd = word;
                const fs = [];
                if (word.filePath) {
                  const tec = JSON.parse(word.filePath)
                  tec.id = word.id;
                  this.technicCardPNG = existPNG;
                  fs.push(tec);
                } else {
                  this.technicCardPNG = emptyPNG;
                }
                this.technicReportProd.files = fs;
              }
              if (word.production === 'FINAL') {
                this.finalReprotProd = word;
                const fs = [];
                if (word.filePath) {
                  const final = JSON.parse(word.filePath)
                  final.id = word.id;
                  this.finalCardPNG = existPNG;
                  fs.push(final);
                } else {
                  this.finalCardPNG = emptyPNG;
                }
                this.finalReprotProd.files = fs;
              }
              if (word.production === 'LETTER') {
                this.letterReprotProd = word;
                const fs = [];
                if (word.filePath) {
                  const final = JSON.parse(word.filePath)
                  final.id = word.id;
                  this.letterCardPNG = existPNG;
                  fs.push(final);
                } else {
                  this.letterCardPNG = emptyPNG;
                }
                this.letterReprotProd.files = fs;
              }
            });
          }
        })
      }
    },
    handleExceed(files, fileList) {
      this.$message(`当前限制选择 1个文件，本次选择了 ${files.length} 个文件`);
    },
    handleAttachmentPreview(file) {
      // window.open(file.url)
      // this.officeFileView(name,url);
      this.openPageoffice(file.name,file.url);
    },
    handleRemoveFile(file, fileList) {
      this.$confirm('请确认是否移除已存在的报告?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        let pid = file.id;
        if (pid) {
          this.$api.personalProduction.removeFile(pid).then(res => {
            if (res.code === 200 && res.data) {
              this.$notify({
                title: '成功',
                message: '文档移除成功',
                type: 'success',
                duration: 2000
              });
              this.getProductions();
            }
          })
        }
      })
    },
    selectRoll() {
      let roll = this.compareList.rollingLevel;
      this.compareList.sellMoneyRate = 0.01;
      if (roll === 1) {
        this.compareList.sellMoneyBase = 12000;
        this.compareList.sellMoney = 12000 * 0.01;
      } else if (roll === 2) {
        this.compareList.sellMoneyBase = 10800;
        this.compareList.sellMoney = 10800 * 0.01;
      } else {
        this.compareList.sellMoneyBase = 10100;
        this.compareList.sellMoney = 10100 * 0.01;
      }
    },
    selectRightsType() {
      if (this.compareList.rightsType === 'SELL') {
        this.compareList.sellMoneyRate = null;
        this.compareList.sellMoneyBase = null;
        this.compareList.sellMoney = null;
        this.target.sellMoneyRate = null;
        this.target.sellMoneyBase = null;
        this.target.sellMoney = null;
      } else {
        this.selectRoll();
      }
    },
    doStamp(files) {
      const file = files[0];
      if (file) {
        this.$api.businessProduction.doStamp(file).then(res => {
          if (res.code === 200 && res.data) {
            this.$notify({
              title: '成功',
              message: '加盖公章成功',
              type: 'success',
              duration: 2000
            });
          } else {
            this.$notify({
              title: '失败',
              message: '加盖公章失败',
              type: 'error',
              duration: 2000
            });
          }
        })
      } else {
        this.$notify({
          title: '失败',
          message: '加盖公章失败，请先生成意见书或报告',
          type: 'error',
          duration: 2000
        });
      }

    },
    checkPass() {
      this.checkStateFlag = true;
      if (this.checkProDTO.targetId && this.checkProDTO.production) {
        const taskRecordDTO = this.buildTaskRecordDTO(this.checkProDTO);
        this.$api.personalProduction.checkPass(taskRecordDTO).then(res => {
          if (res.code === 200 && res.data) {
            this.$notify({
              title: '成功',
              message: '审核成功',
              type: 'success',
              duration: 2000
            });
            const prodType = this.checkProDTO.production;
            if (prodType === 'REPORT') {
              this.technicReportProd.checkState = '已审核';
              this.finalReprotProd.checkState = '已审核';
            }
            if (prodType === 'STATEMENT') {
              this.statementProd.checkState = '已审核';
            }
            if (prodType === 'LETTER') {
              this.letterReprotProd.checkState = '已审核';
            }
            this.commit("PASS");
          } else {
            this.$notify({
              title: '失败',
              message: '审核失败',
              type: 'error',
              duration: 2000
            });
          }
          this.checkDialog = false;
        })
      }

    },
    warehouse() {
      const code = this.currentNode.nodeCode;
      if (code === 'STATEMENT_IN') {
        const orderId = this.personal.orderId
        this.warehouseTip = "请确认将项目编号为[" + orderId + "]的意见书入库？";
        this.checkProDTO.production = "STATEMENT";
        this.checkProDTO.targetId = this.target.id;
        this.inWarehouseDialog = true;
      }
      const orderId = this.personal.orderId
      if (code === 'STATEMENT_OUT') {
        this.warehouseTip = "请确认将项目编号为[" + orderId + "]的意见书出库？";
        this.checkProDTO.production = "STATEMENT";
        this.checkProDTO.targetId = this.target.id;
        this.outWarehouseDialog = true;
      }
      if (code === 'REPORT_IN') {
        this.warehouseTip = "请确认将项目编号为[" + orderId + "]的报告入库？";
        this.checkProDTO.production = "REPORT";
        this.checkProDTO.targetId = this.target.id;

        this.inWarehouseDialog = true;
      }
      if (code === 'REPORT_OUT') {
        this.warehouseTip = "请确认将项目编号为[" + orderId + "]的报告出库？";
        this.checkProDTO.production = "REPORT";
        this.checkProDTO.targetId = this.target.id;
        this.outWarehouseDialog = true;
      }


    },
    doInWareHouse() {
      if (this.checkProDTO.targetId && this.checkProDTO.production) {
        let taskRecordDTO = this.buildTaskRecordDTO(this.checkProDTO);
        this.$api.personalProduction.inWareHouse(taskRecordDTO).then(res => {
          if (res.code === 200 && res.data) {
            this.$notify({
              title: '成功',
              message: '入库操作成功',
              type: 'success',
              duration: 2000
            });
          } else {
            this.$notify({
              title: '失败',
              message: '入库操作失败',
              type: 'error',
              duration: 2000
            });
          }
        })
      }
      this.inWarehouseDialog = false;

    },
    doOutWareHouse() {
      if (this.checkProDTO.targetId && this.checkProDTO.production) {
        let taskRecordDTO = this.buildTaskRecordDTO(this.checkProDTO);
        this.$api.personalProduction.outWareHouse(taskRecordDTO).then(res => {
          if (res.code === 200 && res.data) {
            this.$notify({
              title: '成功',
              message: '出库操作成功',
              type: 'success',
              duration: 2000
            });
          } else {
            this.$notify({
              title: '失败',
              message: '出库操作失败',
              type: 'error',
              duration: 2000
            });
          }
        })
      }
      this.outWarehouseDialog = false;
    },
    saveFeedback() {
      let flag = true;
      const oldFeedback = JSON.parse(this.target.feedback);
      console.log(oldFeedback)
      if (oldFeedback) {
        oldFeedback.forEach(element => {
          if (!this.feedback.includes(element)) {
            if (element === 'STATEMENT' && this.statementProd.id) {
              this.$message("不能移除已存在的产品类型");
              flag = false;
            }
            if (element === 'REPORT' && (this.technicReportProd.id || this.finalReprotProd.id)) {
              this.$message("不能移除已存在的产品类型");
              flag = false;
            }
          }
        });
        if (this.currentNode.nodeCode === 'QUOTATION_FEEDBACK' && this.feedback.length > 1) {
          this.$message("只能选择一种产品类型");
          flag = false;
        }
        if (this.currentNode.nodeCode === 'STATEMENT_FEEDBACK' && this.feedback.length > 2) {
          this.$message("只能选择一种产品类型");
          flag = false;
        }
        if (this.currentNode.nodeCode === 'REPORT_FEEDBACK' && this.feedback.length > 3) {
          this.$message("只能选择一种产品类型");
          flag = false;
        }
        if (this.currentNode.nodeCode === 'LETTER_FEEDBACK' && this.feedback.length > 4) {
          this.$message("只能选择一种产品类型");
          flag = false;
        }
      }
      if (flag) {
        const feedbackDTO = new Object();
        feedbackDTO.id = this.target.id;
        feedbackDTO.personalId = this.target.personalId;
        if (this.feedback.length == 0) {
          return;
        }
        feedbackDTO.feedback = JSON.stringify(this.feedback);
        const taskRecordDTO = this.buildTaskRecordDTO(feedbackDTO)
        this.$api.personalTarget.doFeedback(taskRecordDTO).then(res => {
          if (res.code === 200 && res.data) {
            this.$notify({
              title: '成功',
              message: '反馈客户信息成功',
              type: 'success',
              duration: 2000
            });
            this.getPersonalTarget();
          } else {
            this.$notify({
              title: '失败',
              message: '反馈客户信息失败',
              type: 'error',
              duration: 2000
            });
          }
        })
      } else {
        this.feedback = oldFeedback;
      }
    },
    saveScene() {
      this.$refs.sceneForm.validate((valid) => {
        if (valid) {
          if (this.sceneForm.id) {
            const taskRecordDTO = this.buildTaskRecordDTO(this.sceneForm)
            this.$api.personalScene.saveScene(taskRecordDTO).then(res => {
              if (res.code === 200 && res.data) {
                this.$notify({
                  title: '成功',
                  message: '实勘信息更新成功',
                  type: 'success',
                  duration: 2000
                })
                this.getScene();
              }
            })
          } else {
            this.sceneForm.personalId = this.personal.id;
            const taskRecordDTO = this.buildTaskRecordDTO(this.sceneForm)
            this.$api.personalScene.saveScene(taskRecordDTO).then(res => {
              if (res.code === 200 && res.data) {
                this.$notify({
                  title: '成功',
                  message: '实勘信息添加成功',
                  type: 'success',
                  duration: 2000
                })
                this.getScene();
              }
            })
          }
        }
      })
    },
    getScene() {
      this.$api.personalScene.getScene(this.personalId).then(res => {
        if (res.code === 200 && res.data) {
          this.sceneForm = res.data;
        }
      })
    },
    saveChangeCer() {
      this.$confirm('是否确定需要换证。换证之后，已录入的证件信息将被清空。请确认？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const personal = new Object();
        personal.id = this.personal.id;
        personal.credentials = JSON.stringify(this.changeCredentials);
        this.$api.personal.changeCredentials(personal).then(res => {
          if (res.code === 200) {
            this.$notify({
              title: '成功',
              message: '换证成功',
              type: 'success',
              duration: 2000
            });
            this.getPersonal();
          }
        })
      })

    },
    // 文档预览
    officeFileView(name, url) {
      if (name || url) {
        const route = this.$router.resolve({
          path: "/office/view/window",
          query: {
            // 文档标题
            title: name,
            // 文档url地址
            url: url,
            mode: 'edit'
          }
        });
        // 在新窗口打开页面
        window.open(route.href, "_blank");
      } else {
        this.$notify({
          title: '失败',
          message: 'url为空，无法打开，如未保存请保存后再试！',
          type: 'error',
          duration: 2000
        });
      }
    },
    printQR(path) {
      if (!path) {
        this.$message("二维码还未生成，无法打印。")
        return;
      }
      let routeUrl = this.$router.resolve({
        path: `/print/code?path=${path}`
      });
      window.open(routeUrl.href, '_blank');

    },

    defalutYearMonth(){
      const currentDate = new Date();
      const currentYear = currentDate.getFullYear();
      let month = currentDate.getMonth();
      this.compareList.analysisData[3].target.valueA = new Date(currentYear,month,2);
      if (month==1){
        this.compareList.analysisData[3].compareC.valueA = new Date(currentYear-1,12,2)
        this.compareList.analysisData[3].compareB.valueA = new Date(currentYear-1,11,2)
        this.compareList.analysisData[3].compareA.valueA = new Date(currentYear-1,10,2)
      }else if(month==2){
        this.compareList.analysisData[3].compareC.valueA = new Date(currentYear,month-1,2)
        this.compareList.analysisData[3].compareB.valueA = new Date(currentYear-1,12,2)
        this.compareList.analysisData[3].compareA.valueA = new Date(currentYear-1,11,2)
      }else if(month==3){
        this.compareList.analysisData[3].compareC.valueA = new Date(currentYear,month-1,2)
        this.compareList.analysisData[3].compareB.valueA = new Date(currentYear,month-2,2)
        this.compareList.analysisData[3].compareA.valueA = new Date(currentYear-1,12,2)
      }
      else{
        this.compareList.analysisData[3].compareC.valueA = new Date(currentYear,month-1,2)
        this.compareList.analysisData[3].compareB.valueA = new Date(currentYear,month-2,2)
        this.compareList.analysisData[3].compareA.valueA = new Date(currentYear,month-3,2)
      }
     
    },
    generateAll(){
      const certificates = this.personal.credentials
      for (let i in certificates) {
        if (certificates[i] === 'HOUSE_CERTIFICATE' && !this.target.houseCertificate) {
          this.$message('房产证未点击保存');
          return;
        }
        if (certificates[i] === 'LAND_CERTIFICATE' && !this.target.landCertificate) {
          this.$message('国土证未点击保存');
          return;
        }
        if (certificates[i] === 'IMMOVABLE_CERTIFICATE' && !this.target.immovableCertificate) {
          this.$message('不动产权证未点击保存');
          return;
        }
      }
      if (!this.target.entityInfo) {
        this.$message('实物状况未点击保存');
        return;
      }
      if (!this.target.backgroundInfo) {
        this.$message('区位状况未点击保存');
        return;
      }
      if (!this.target.sellingAbility) {
        this.$message('变现能力未点击保存');
        return;
      }
      this.$confirm('系统生成将会覆盖原有文档，请确认是否继续？', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        if (this.personal.id && this.target.id) {
          this.$api.personalProduction.genFileAll(this.personal.id).then(res => {
            if (res.code === 200 && res.data) {
              this.$notify({
                title: '成功',
                message: '一键生成成功',
                type: 'success',
                duration: 2000
              });
              this.getProductions();
              this.getPersonalTarget();
            } else {
              this.$notify({
                title: '失败',
                message: '一键生成失败',
                type: 'error',
                duration: 2000
              });
            }
          })
        }
      })
    },
    downloadAll(){
      if (this.target.id) {
        let fileName = this.businessSubId;
        this.$api.personalProduction.downloadPkg(this.target.id).then(res=>{
          let blob = new Blob([res],{type:"application/octet-stream;"})
            const url = window.URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.setAttribute('download',fileName+'产品包.zip');
            document.body.appendChild(link);
            link.click();
        })
      }
    },
    downloadDoc(files){
      if (files[0] && files[0].url){
        window.open('http://mbs.scdayou.com'+files[0].url,'_blank');
      }
    },
    cleanCheckId(){
      this.checkerId = null;
    },
    cleanFlag(){
      this.decideProduction = false;
      this.checkStateFlag = false;
    },
    openPageoffice(fileName,fileUrl) {
       let paramJson={};
       paramJson.fileName=fileName;
       paramJson.fileUrl=fileUrl;
       let paramString=JSON.stringify(paramJson);
       //openWindow()第三个参数用来向弹出的PageOffice浏览器（POBrowser）窗口传递参数(参数长度不限)，支持json格式字符串。
       //此处为了方便演示，我们传递了file_id和file_name两个参数，具体以您实际开发为准。
      POBrowser.openWindow('/admin/#/showDoc', 'width=1150px;height=900px;',paramString);
     },
  }
}
</script>
<style lang="scss" scoped>
.row-style {
  margin-left: 40px;
  margin-right: 1%;
}

.major-radio {
  width: 92px
}

.task-class {
  /deep/ .el-form-item__label {
    color: red;
  }
}

.evaluate-table {
  margin-left: 40px;
  margin-top: 35px;
}

.pane-class {
  width: 100%;
  overflow-y: scroll;
}

/deep/ .cell-class {
  font-size: 13px;
  color: black;
}

.table {
  /deep/ thead {
    .el-table-column--selection {
      .cell {
        display: none;
      }
    }
  }
}

/deep/.doWarehouseClass {
  border-radius: 10px;
}

.button-area {
  position: absolute;
  top: 20px;
  right: 50px;
}

.error-type {
  margin-right: 5px;
}

.error-type:hover {
  cursor: pointer;
}

.box-card {
  margin-top: 40px
}

.time {
  font-size: 13px;
  color: #999;
  float: right;
  margin-top: 5px;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  float: left;
}

.image {
  width: 100%;
  padding: 0%;
  display: block;
}

.control {
  z-index: 999;
  position: relative;
  top: 10px;
}

.checked {
  margin-left: 10px;
  font-size: 12px;
  color: green;
}

.qr-code-div {
  background-color: RGB(245, 245, 245);
  width: 150px;
  height: 150px;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-code {
  width: 150px;
  height: 150px;
  z-index: 999;
  border: 1px #919398 solid;
  border-radius: 5px;
}

.qr-code-div:hover {
  cursor: pointer;
  // background-color:RGB(220,220,220); 
  // width: 180px;
  // height: 180px;

}
a:hover{
  cursor: pointer;
  color: #5a9cf8
}
.xRadio{
  margin-right: 5px;
  margin-bottom: 10px;
  float: left;
}
</style>
  