<template>
  <div class="main">
    <MOSTY.FromPage :title="data.config.title" @closeDialog="black" contentH="calc(100vh - 263px)">
      <template #content>
        <div class="xsl">
          <div class="Box">
            <div class="title">车辆基本信息登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <table class="onetab" align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
              <tr>
                <td>车辆所属单位名称</td>
                <td colspan="3"> {{ data.fromObj.deptname }}</td>
              </tr>
              <tr>
                <td>车牌号码</td>
                <td> {{ data.fromObj.carnumber }}</td>
                <td>车辆颜色</td>
                <td> {{ data.fromObj.color }}</td>
              </tr>
              <tr>
                <td>车辆类型</td>
                <td> {{ data.fromObj.cartype }}</td>
                <td>车辆型号</td>
                <td> {{ data.fromObj.carmodel }}</td>
              </tr>
              <tr>
                <td>购置日期</td>
                <td> {{ data.fromObj.purchasedate }}</td>
                <td>购置金额</td>
                <td> {{ data.fromObj.gzje }}</td>
              </tr>
              <tr>
                <td>注册日期</td>
                <td> {{ data.fromObj.runDate }}</td>
                <td>车辆用途</td>
                <td> <dict-tag v-if="data.fromObj.carpurpose" :options="D_TB_CLYT" :value="data.fromObj.carpurpose"
                    color="black" :tag="false" />
                  <span v-else>无</span>
                </td>
              </tr>
              <tr>
                <td>车辆外观照片</td>
                <td colspan="3">
                  <div style="
                      width: 64%;
                      margin: auto;
                      overflow: hidden;
                      height: 155px;
                    ">
                    <MOSTY.Upload width="150px" v-if='data.fromObj.picture' :limit="1" :nopicer="false" :isImg="true"
                      :ShowfileList="false" v-model="data.fromObj.picture" @filehandleChange="changeFiles"
                      :disabled="true">
                    </MOSTY.Upload>
                    <img v-else :src="getImgUrl('img/emptyImg.jpg')" alt="" style="height:180px;width:237px;">
                  </div>
                </td>
              </tr>
            </table>
          </div>
          <div class="Box">
            <div class="title">车辆主要技术特性</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
              <tr class="onetd">
                <td colspan="2">厂牌</td>
                <td>{{ data.fromObj.label }}</td>
                <td colspan="2">车型</td>
                <td>{{ data.fromObj.carmodel }}</td>
                <td colspan="2">车辆类型</td>
                <td>{{ data.fromObj.cartype }}</td>
                <td rowspan="4" colspan="3">
                  <div style="
                      width: 64%;
                      margin: auto;
                      overflow: hidden;
                      height: 155px;
                    ">
                    <MOSTY.Upload width="150px" v-if='data.fromObj.picture' :limit="1" :nopicer="false" :isImg="true"
                      :ShowfileList="false" v-model="data.fromObj.picture" @filehandleChange="changeFiles"
                      :disabled="true">
                    </MOSTY.Upload>
                    <img v-else :src="getImgUrl('img/emptyImg.jpg')" alt="" style="height:180px;width:237px;">
                  </div>
                </td>
              </tr>
              <tr>
                <td colspan="2">驱动型式</td>
                <td>{{ data.fromObj.drivertype }}</td>
                <td colspan="2">功 率</td>
                <td>{{ data.fromObj.power }}</td>
                <td colspan="2">最大牵引力</td>
                <td>{{ data.fromObj.maxforce }}</td>
              </tr>
              <tr>
                <td colspan="2">发动机号</td>
                <td>{{ data.fromObj.enginenum }}</td>
                <td colspan="2">车架号</td>
                <td>{{ data.fromObj.vin }}</td>
                <td colspan="2">载客数</td>
                <td>{{ data.fromObj.passengers }}人</td>
              </tr>
              <tr>
                <td colspan="2">燃 料</td>
                <td>{{ data.fromObj.fuel }}</td>
                <td colspan="2">自重</td>
                <td>{{ data.fromObj.weight }}</td>
                <td colspan="2">载质量</td>
                <td>{{ data.fromObj.deadweight }}吨</td>
              </tr>

              <tr>
                <td rowspan="3">车辆外观</td>
                <td>长</td>
                <td>{{ data.fromObj.length }}</td>
                <td rowspan="3">车厢规格</td>
                <td>长</td>
                <td>{{ data.fromObj.longcar }}</td>
                <td colspan="2">轴距</td>
                <td>{{ data.fromObj.wheelbase }}</td>
                <td colspan="2">车身颜色</td>
                <td>{{ data.fromObj.color }}</td>
              </tr>
              <tr>
                <td>宽</td>
                <td>{{ data.fromObj.width }}</td>
                <td>宽</td>
                <td>{{ data.fromObj.pawidth }}</td>
                <td rowspan="2">轮距</td>
                <td>前</td>
                <td>{{ data.fromObj.frontTrack }}</td>
                <td rowspan="2">轮胎</td>
                <td>规格</td>
                <td>{{ data.fromObj.tireSize }}</td>
              </tr>
              <tr>
                <td>高</td>
                <td>{{ data.fromObj.height }}</td>
                <td>高</td>
                <td>{{ data.fromObj.carhigh }}</td>
                <td>后</td>
                <td>{{ data.fromObj.rearTrack }}</td>
                <td>条数</td>
                <td>{{ data.fromObj.tireCount }}</td>
              </tr>
              <tr>
                <td colspan="2">车主</td>
                <td colspan="3">{{ data.fromObj.cityorgname }}</td>
                <td colspan="2">地址</td>
                <td colspan="5">{{ data.fromObj.address }}</td>
              </tr>
              <tr>
                <td colspan="2">生产厂家</td>
                <td colspan="3">{{ data.fromObj.oem }}</td>
                <td colspan="2">购买日期</td>
                <td colspan="5">{{ data.fromObj.purchasedate }}</td>
              </tr>
              <tr>
                <td colspan="2">车辆来源</td>
                <td colspan="3">{{ data.fromObj.source }}</td>
                <td colspan="2">调来日期</td>
                <td colspan="2">{{ data.fromObj.jumpDate }}</td>
                <td colspan="2">投产日期</td>
                <td colspan="1">{{ data.fromObj.runDate }}</td>
              </tr>
              <tr>
                <td colspan="2">机动行驶证复印件</td>
                <td colspan="10">
                  <div style="
                      width: 80%;
                      margin: auto;
                      overflow: hidden;
                      height: 100%;
                    ">
                    <MOSTY.Upload width="250px" v-if='data.fromObj.operatefile' :limit="1" :nopicer="false"
                      :isImg="true" :ShowfileList="false" v-model="data.fromObj.operatefile"
                      @filehandleChange="changeFiles" :disabled="true">
                    </MOSTY.Upload>
                    <img v-else :src="getImgUrl('img/emptyImg.jpg')" alt="" style="height:180px;width:237px;">
                  </div>
                </td>
              </tr>
              <tr>
                <td colspan="2">机动行驶证副页复印件</td>
                <td colspan="10">
                  <div style="
                      width: 80%;
                      margin: auto;
                      overflow: hidden;
                      height:100%;
                    ">
                    <MOSTY.Upload width="250px" v-if='data.fromObj.photocopy2Id' :limit="1" :nopicer="false"
                      :isImg="true" :ShowfileList="false" v-model="data.fromObj.photocopy2Id"
                      @filehandleChange="changeFiles" :disabled="true">
                    </MOSTY.Upload>
                    <img v-else :src="getImgUrl('img/emptyImg.jpg')" alt="" style="height:180px;width:237px;">
                  </div>
                </td>
              </tr>
            </table>

          </div>
          <div class="Box">
            <div class="title">机动车登记证书登记表(复印件)</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>

            <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
              <tr>
                <td>
                  <div style="
                      width: 80%;
                      margin: auto;
                      overflow: hidden;
                      height:100%;
                    ">
                    <MOSTY.Upload width="250px" v-if='data.fromObj.signfile' :limit="1" :nopicer="false" :isImg="true"
                      :ShowfileList="false" v-model="data.fromObj.signfile" @filehandleChange="changeFiles"
                      :disabled="true">
                    </MOSTY.Upload>
                    <img v-else :src="getImgUrl('img/emptyImg.jpg')" alt="" style="height:180px;width:237px;">
                  </div>
                </td>
              </tr>
            </table>
          </div>
          <div class="Box">
            <div class="title">驾驶员变动登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.carchangeList" border style="width: 100%">
                <el-table-column prop="changetime" label="时间"> </el-table-column>
                <el-table-column prop="changetype" label="类型">
                  <template #default="{ row }">
                    <span v-if="row.changetype == '1'">绑定</span>
                    <span v-if="row.changetype == '2'">解绑</span>
                    <span v-else>无</span>
                  </template>
                </el-table-column>
                <el-table-column prop="username" label="姓名"> </el-table-column>
                <el-table-column prop="sex" label="性别">
                  <template #default="{ row }">
                    <dict-tag v-if="row.sex" :options="D_BZ_XB" :value="row.sex" :tag="false" />
                    <span v-else>无</span>
                  </template>
                </el-table-column>
                <el-table-column prop="age" label="年龄"> </el-table-column>
                <el-table-column prop="driveage" label="驾年"> </el-table-column>
                <el-table-column prop="changedesc" label="变动原因">
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">车辆调动登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.carMoveList" border style="width: 100%">
                <el-table-column prop="moveDate" label="调动日期">
                </el-table-column>
                <el-table-column prop="moveUnit" label="调动单位">
                </el-table-column>
                <el-table-column prop="importUnit" label="调入单位">
                </el-table-column>
                <el-table-column prop="moveCause" label="调动原因">
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">随车工具、资料登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.carGoodsList" border style="width: 100%">
                <el-table-column prop="registerDate" label="登记日期">
                </el-table-column>
                <el-table-column prop="goodName" label="工具（资料）名称">
                </el-table-column>
                <el-table-column prop="size" label="规格"> </el-table-column>
                <el-table-column prop="unit" label="单位"> </el-table-column>
                <el-table-column prop="count" label="数量"> </el-table-column>
                <el-table-column prop="used" label="新旧程度"> </el-table-column>
                <el-table-column prop="driver" label="驾驶员签名">
                </el-table-column>
                <el-table-column prop="principal" label="负责人签名">
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">车辆（大件、总成及肇事）维修情况登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
              <tr>
                <td rowspan="2">维修开始日期</td>
                <td rowspan="2">维修结束日期</td>
                <td rowspan="2">承修单位</td>
                <td colspan="5">维修内容</td>
                <td rowspan="2">维修金额</td>
                <td rowspan="2">驾驶员</td>
              </tr>
              <tr>
                <td colspan="2">维修项</td>
                <td>单价</td>
                <td>数量</td>
                <td>金额</td>
              </tr>
              <tr v-for='item in data.carMaintainList' :key='item'>
                <td :rowspan="item.maintenance.length ? item.maintenance.length : 1">{{ item.maintainDate }}</td>
                <td :rowspan="item.maintenance.length ? item.maintenance.length : 1">{{ item.maintainEndDate }}</td>
                <td :rowspan="item.maintenance.length ? item.maintenance.length : 1">{{ item.contractor }}</td>

                <td colspan="5" :rowspan="item.maintenance.length ? item.maintenance.length : 1">
                  <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:100%">
                    <tr v-for='it in item.maintenance' :key='it'>
                      <td width='75px'>{{ it.info }}</td>
                      <td width='50px'>{{ it.money }}</td>
                      <td width='50px'>{{ it.count }}</td>
                      <td width='50px'>{{ it.allMoney }}</td>
                    </tr>
                  </table>

                </td>
                <td :rowspan="item.maintenance.length ? item.maintenance.length : 1">{{ item.maintainRmb }}</td>
                <td :rowspan="item.maintenance.length ? item.maintenance.length : 1">{{ item.driver }}</td>
              </tr>
            </table>

          </div>
          <div class="Box">
            <div class="title">车辆行驶里程记录</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.carMileageList" border style="width: 100%">
                <el-table-column prop="startDate" label="何年何月 至 年何月">
                  <template #default="{ row }">
                    <span>{{ row.startDate }}至{{ row.endUnit }}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="driver" label="驾驶员"> </el-table-column>
                <el-table-column prop="mileage" label="安全行驶公里	">
                </el-table-column>
                <!-- <el-table-column prop="sum" label="累计运货多少吨	">
                </el-table-column> -->
                <el-table-column prop="bz" label="备 注	"> </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">轮胎消耗记录表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.cartireDrainList" border style="width: 100%">
                <el-table-column prop="tireDate" label="装胎时间">
                </el-table-column>
                <el-table-column prop="ruleCount" label="额定条数">
                </el-table-column>
                <el-table-column prop="renewCount" label="换胎条数">
                </el-table-column>
                <el-table-column prop="economy" label="节约超支"> </el-table-column>
                <el-table-column prop="driver" label="驾驶员"> </el-table-column>
                <el-table-column prop="tireDate" label="装胎时间">
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">车辆燃料消耗信息</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.carfuelDrainList" border style="width: 100%">
                <el-table-column prop="startDate" label="起止日期">
                  <template #default="{ row }">
                    <span>{{ row.startDate }}至{{ row.endUnit }}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="mileage" label="行驶里程	"> </el-table-column>
                <el-table-column prop="consume" label="燃油消耗	"> </el-table-column>
                <el-table-column label="燃油定额比（升/百公里）	">
                  <el-table-column prop="quota" label="定额	"> </el-table-column>
                  <el-table-column prop="savings" label="节余	"> </el-table-column>
                  <el-table-column prop="loss" label="亏损	"> </el-table-column>
                </el-table-column>
                <el-table-column prop="driver" label="驾驶员	"> </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="Box">
            <div class="title">车辆事故交通事故登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.famaly" border style="width: 100%">
                <el-table-column prop="jname" label="事故发生日期">
                </el-table-column>
                <el-table-column prop="jsex" label="事故发生地点">
                </el-table-column>
                <el-table-column prop="jage" label="事故类别及责任">
                </el-table-column>
                <el-table-column prop="jworkunit" label="事故简要经过及车辆损坏情况">
                </el-table-column>
                <el-table-column prop="jworkunit" label="损失金额（元）">
                </el-table-column>
                <el-table-column prop="jworkunit" label="事故简要经过">
                </el-table-column>
                <el-table-column prop="jworkunit" label="驾驶员"> </el-table-column>
              </el-table>
              <div style="margin-top: 20px">
                注:只登记1000元以上的事故（无论有无责任）
              </div>
            </div>
          </div>
          <div class="Box">
            <div class="title">车辆报废鉴定登记表</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div v-if="data.carscrapList && data.carscrapList.length > 0" v-for="(item, index) in data.carscrapList"
              :key="index">
              <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
                <tr class="twotd">
                  <td colspan="1">累计行驶里程</td>
                  <td colspan="1"> {{ item.deptname }}</td>
                  <td colspan="1">累计使用年限</td>
                  <td colspan="1"> {{ item.usedLife }}年</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 报废原因:{{ item.scrapCause }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 1、发动机技术鉴定：{{ item.motorIdentify }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 2、变速箱技术鉴定：{{ item.gearboxIdentify }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 3、前后桥技术鉴定：{{ item.axleIdentify }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 4、车架技术鉴定：{{ item.frameIdentify }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 5、车身技术鉴定：{{ item.bodyworkIdentify }}</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl">
                    <div>鉴定小组意见：{{ item.idea }}</div>
                    <div>鉴定人：{{ item.expert }}</div>
                  </td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 审批意见：{{ item.approvalIdea }}</td>
                </tr>
              </table>

            </div>
            <div v-else>
              <table align="center" cellspacing="0" cellpadding="0" border="1" style="width:1000px">
                <tr class="twotd">
                  <td colspan="1">累计行驶里程</td>
                  <td colspan="1"> </td>
                  <td colspan="1">累计使用年限</td>
                  <td colspan="1"> 年</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 报废原因:</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 1、发动机技术鉴定：</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 2、变速箱技术鉴定：</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 3、前后桥技术鉴定：</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 4、车架技术鉴定：</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 5、车身技术鉴定：</td>
                </tr>
                <tr>
                  <td colspan="4" class="texl">
                    <div>鉴定小组意见：</div>
                    <div>鉴定人：</div>
                  </td>
                </tr>
                <tr>
                  <td colspan="4" class="texl"> 审批意见：</td>
                </tr>
              </table>

            </div>
          </div>
          <div class="Box">
            <div class="title">车辆月检记录</div>
            <div class="desc">
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)"></div>
              <div style="width: calc(100% / 3)">
                NO：{{ data.fromObj.carnumber }}
              </div>
            </div>
            <div class="describe" style="width: calc(100% - 40px); margin-left: 20px; margin-top: 10px">
              <el-table :data="data.famaly" border style="width: 100%">
                <el-table-column prop="jname" label="检查时间"> </el-table-column>
                <el-table-column prop="jsex" label="检查人"> </el-table-column>
                <el-table-column prop="jage" label="检查详情"> </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </template>
      <template #footer>
        <el-button @click="black()"> <el-icon>
            <DocumentDelete />
          </el-icon>
          <span>关闭</span></el-button>
      </template>
    </MOSTY.FromPage>


  </div>
</template>

<script setup>
import { getImgUrl } from "@/utils/tools.js"
import {
  reactive,
  ref,
  watchEffect,
  getCurrentInstance,
  onMounted,
  watch,
  nextTick
} from "vue";
import * as MOSTY from "@/components/MyComponents/index";
import { getApi } from "@/api/tobAcco_api.js";
import PageTitle from "@/components/PageTitle/PageTitle.vue";
const { proxy } = getCurrentInstance();
const { D_TB_CLYT } = proxy.$dict("D_TB_CLYT");
const { D_BZ_XB } = proxy.$dict("D_BZ_XB");
const { D_BZ_CLAQZNH } = proxy.$dict("D_BZ_CLAQZNH");
const { D_BZ_JDCLXNYCBS } = proxy.$dict("D_BZ_JDCLXNYCBS");
const props = defineProps({
  addDiaShow: {
    type: Boolean,
    default: false
  },
  editObj: {
    type: Object,
    default: () => { }
  },
  configobj: { type: Object, default: () => { } }
});
const emit = defineEmits("changePage");
const data = reactive({
  fromObj: {},
  img: [],
  tableData: [],
  carMoveList: [], //车辆调动信息表
  carGoodsList: [], //随车工具、资料登记
  carMaintainList: [], //车辆维修保养信息表
  carMileageList: [], //车辆行驶里程记录
  cartireDrainList: [], //轮胎消耗记录表
  carfuelDrainList: [], //车辆燃料消耗信息表
  carchangeList: [], //驾驶员变动信息表
  carscrapList: [],//车辆报废鉴定表
  famaly: [], //家庭主要成员
  love: {}, //爱人
  config: {
    title: "",
    saveBtnShow: true,
    wbjlShow: false,
    jcrzShow: false
  }
});


//获取详情
function getmain(id) {
  if (id) {
    //查询驾驶员信息表详情
    getApi({ id: id }, "/mosty-jcgl/car/queryCarMsgDetail").then(async (res) => {
      if (res) {
        data.fromObj = res;
        data.fromObj.cartype = data.fromObj.cartype ? await getzdmc(data.fromObj.cartype) : null;
      }
    });
    //查询驾驶员变动信息表详情
    getApi({ id: id }, "/mosty-jcgl/carChange/queryByCarmsgid").then((res) => {
      if (res) {
        data.carchangeList = res;
      }
    });
    //查询车辆调动信息表详情
    getApi({ id: id }, "/mosty-jcgl/move/queryByCarmsgid").then((res) => {
      if (res) {
        data.carMoveList = res;
      }
    });
    //查询随车物品详情
    getApi({ id: id }, "/mosty-jcgl/goods/queryByCarmsgid").then((res) => {
      if (res) {
        data.carGoodsList = res;
      }
    });
    //查询车辆维修保养信息表
    getApi({ id: id }, "/mosty-jcgl/maintain/queryByCarmsgid").then((res) => {
      if (res) {
        data.carMaintainList = res;
        data.carMaintainList.forEach((el) => {
          el.maintenance = el.maintenance ? JSON.parse(el.maintenance) : "";
          // let arr = [];
          // el.text.forEach((e) => {
          //   let str =
          //     e.info +
          //     "(数量：" +
          //     e.count +
          //     ",单价：" +
          //     e.money +
          //     "元），共计" +
          //     e.allMoney +
          //     "元";
          //   arr.push(str);
          // });
          // el.text = arr;
        });
      }
    });
    //查询车辆行驶里程表详情
    getApi({ id: id }, "/mosty-jcgl/carMileage/queryByCarmsgid").then((res) => {
      if (res) {
        data.carMileageList = res;
      }
    });
    //查询轮胎消耗记录表详情
    getApi({ id: id }, "/mosty-jcgl/tireDrain/queryByCarmsgid").then((res) => {
      if (res) {
        data.cartireDrainList = res;
      }
    });
    //查询 车辆燃料消耗表详情
    getApi({ id: id }, "/mosty-jcgl/fuelDrain/queryByCarmsgid").then((res) => {
      if (res) {
        data.carfuelDrainList = res;
      }
    });
    //查询车辆报废鉴定表详情
    getApi({ id: id }, "/mosty-jcgl/scrap/queryByCarmsgid").then((res) => {
      if (res) {
        data.carscrapList = res;
      }
    });
  }
}
const getzdmc = async (zdmc) => {
  return new Promise(ok => {
    getApi({ dm: zdmc, zdbh: "D_TB_CLLX" }, '/mosty-base/sys-dict-item/getDetailByZdbh').then((res) => {
      ok(res ? res.zdmc : '')
    })
  })
}

const black = () => {
  emit("changePage", "Main");
};
onMounted(() => {
  if (props.editObj) {
    data.config = JSON.parse(JSON.stringify(props.editObj));
  }
  getmain(props.editObj.id);
});

</script>

<style lang="scss" scoped>
.onetab {
  >tr {
    >td {
      width: 20%;
    }
  }

}

.texl {
  text-align: left;
  text-indent: 2em;
}

.onetd {
  >td {
    width: 10%;
  }
}

.twotd {
  >td {
    width: 20%;
  }
}

.desc {
  display: flex;
  width: 1000px;
  margin-left: 20px;
  margin-top: 20px;
}

td {
  text-align: center;
  height: 50px;
}

::v-deep .el-cascader,
::v-deep .el-select {
  width: 100%;
}

.Box {
  margin-top: 10px;
  margin-bottom: 10px;
  margin-left: 150px;
  // width: calc(100% - 300px);
  color: black;
  font-size: 20px;

  .title {
    text-align: center;
    margin-top: 20px;
    font-size: 25px;
    font-weight: 700;
  }
}

.xsl {
  height: calc(100vh - 25vh);
  overflow-y: scroll;
}
</style>
