<template>
  <div class="app-container">
    <div v-show="viewState == 1">
      <div class="tab-header webtop">
        <!--标题-->
        <div>{{ viewTitle }}</div>
        <!--start 添加修改按钮-->
        <div>
          <el-button type="primary" size="small" v-if="formobj.saleTypeKey == '' || formobj.saleTypeKey == '2'" @click="handleChoose()">选择车辆</el-button>
          <el-button type="primary" size="small" :disabled="submitdisabled" @click="handleSave()">保存
          </el-button>
          <el-button type="primary" size="small" :disabled="submitdisabled" @click="handleSubmit()">提交
          </el-button>
        </div>
      </div>
      <div class="">
        <div class="titwu">公司开票申请单</div>
        <el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
          <el-row style="border-top: 1px solid #E0E3EB">
            <el-col :span="8">
              <div class="span-sty">发起人</div>
              <el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">发起部门</div>
              <el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">发起日期</div>
              <el-form-item><span class="addinputInfo">{{ formobj.applyDate }}</span></el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <div class="span-sty">销售专员</div>
              <el-form-item><span class="addinputInfo">{{ formobj.staffName }}</span></el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">销售部门</div>
              <el-form-item><span class="addinputInfo">{{ formobj.saleDeptName }}</span></el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">销售类型</div>
              <el-form-item><span class="addinputInfo">{{ formobj.saleTypeValue }}</span></el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <div class="span-sty">合同编号</div>
              <el-form-item><span class="addinputInfo">{{ formobj.contractNo }}</span></el-form-item>
            </el-col>
            <el-col :span="8" class="tlineheightb">
              <div class="span-sty">开票单位</div>
              <el-form-item><span class="addinputInfo">{{ formobj.openTickUnitName }}</span></el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">客户名称</div>
              <el-form-item><span class="addinputInfo">{{ formobj.customerName }}</span></el-form-item>
            </el-col>
          </el-row>
          <div class="title titleOne">
            <div>主车开票信息</div>
            <div><el-button type="primary" size="mini" class="btntopblueline" @click="handleLookByDingDan()">查看销售订单</el-button></div>
          </div>
          <el-row>
            <el-col :span="6">
              <div class="span-sty"><span class="icon">*</span>单台开票金额</div>
              <el-form-item><el-input :disabled="formobj.saleTypeKey == '2'" v-model="formobj.oneBillMoney" @keyup.native="UpNumber" clearable placeholder="" class="addinputw"/></el-form-item>
            </el-col>
            <el-col :span="6">
              <div class="span-sty">开票类型默认</div>
              <el-form-item>
                <el-select :disabled="formobj.saleTypeKey == '2'" v-model="formobj.openTickTypeValue" placeholder="请选择" @change="changeOpenTickType" class="addinputInfo">
                  <el-option v-for="item in openTickType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <div class="span-sty">开票名称默认</div>
              <el-form-item>
                <el-select :disabled="formobj.saleTypeKey == '2'" v-model="formobj.openTickName" placeholder="请选择" @change="changeOpenTick" filterable class="addinputInfo">
                  <el-option v-for="item in openTick_list" :key="item.sid" :label="item.name" :value="item.name"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item>
                <el-button :disabled="formobj.saleTypeKey == '2'" type="primary" size="small" @click="handlePreserve">维护开票信息</el-button>
              </el-form-item>
            </el-col>
          </el-row>
          <el-table :key="tableKey" :data="formobj.finBillVehicles" :index="index" border style="width: 100%">
            <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
            <el-table-column v-if="formobj.saleTypeKey == ''" label="操作" align="center" width="80">
              <template slot-scope="scope">
                <el-button type="danger" size="mini" @click="handleDelete(scope.row, scope.$index)">删除</el-button>
              </template>
            </el-table-column>
            <el-table-column label="车架号" align="center" width="100">
              <template slot-scope="scope">
                <span>{{ scope.row.vinNo }}</span>
              </template>
            </el-table-column>
            <el-table-column label="合格证状态" align="center" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.certificateStateValue }}</span>
              </template>
            </el-table-column>
            <el-table-column label="开票类型" align="center" width="250">
              <template slot-scope="scope">
                <el-select :disabled="formobj.saleTypeKey == '2'" v-model="scope.row.billTypeValue" placeholder="请选择" @change="changeBillType($event, scope.row)">
                  <el-option v-for="item in openTickType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="开票名称" align="center" width="250">
              <template slot-scope="scope">
                <el-select :disabled="formobj.saleTypeKey == '2'" v-model="scope.row.openTickName" placeholder="请选择" @change="changeOpenTickName($event, scope.row)" filterable>
                  <el-option v-for="item in openTick_list" :key="item.sid" :label="item.name" :value="item.name"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="开票信息" align="center" min-width="300">
              <template slot-scope="scope">
                <span>{{ scope.row.openTickRemarks }}</span>
              </template>
            </el-table-column>
            <el-table-column v-show="formobj.saleTypeKey == '2'" label="资方信审终审状态" align="center" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.xSState }}</span>
              </template>
            </el-table-column>
          </el-table>
          <el-row>
            <el-col :span="24">
              <div class="span-sty">开票金额合计</div>
              <el-form-item><span class="addinputInfo">{{ totalBillMoney() }}</span></el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="span-sty">备注</div>
              <el-form-item><el-input v-model="formobj.remarks" clearable placeholder="" class="addinputw" /></el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="span-sty">开票状态</div>
              <el-form-item><span class="addinputInfo">{{ formobj.billStateValue }}</span></el-form-item>
            </el-col>
          </el-row>
          <div v-if="formobj.finBillTrailers !== null">
            <div class="title">挂车开票信息(挂车的开票类型、开票名称与主车相同)</div>
            <el-table :key="billingKey" :data="formobj.finBillTrailers" :index="index" border style="width: 100%">
              <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
              <el-table-column label="挂车车架号" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.gcVinNo }}</span>
                </template>
              </el-table-column>
              <el-table-column label="主车车架号" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.vinNo }}</span>
                </template>
              </el-table-column>
              <el-table-column label="开票金额" align="center">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.oneBillMoney" @keyup.native="UpNumber" clearable placeholder=""/>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="title">证件(营业执照或身份证)</div>
          <el-row>
            <el-col :span="24">
              <upload ref="uploadImg" v-model="image_list1" :accept="accept" :limit="50" bucket="map" :upload-data="{ type: '0001' }"/>
            </el-col>
          </el-row>
          <div class="title">车辆买卖合同</div>
          <el-row>
            <el-col :span="24">
              <upload ref="uploadImg" v-model="image_list2" :accept="accept" :limit="50" bucket="map" :upload-data="{ type: '0001' }"/>
            </el-col>
          </el-row>
          <div class="title">车辆登记合同(开票名称与客户名称不一致时上传)</div>
          <el-row>
            <el-col :span="24">
              <el-form-item>
                <upload ref="uploadImg" v-model="image_list4" :accept="accept" :limit="50" bucket="map" :upload-data="{ type: '0001' }"/>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
    <!-- 查看销售订单详情 -->
    <salesOrder v-show="viewState == 2" ref="divInfo" @doback="resetState"/>
    <weihukaipiaoxinxi v-show="viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="resetData"/>
    <selectCar  v-show="viewState == 4" ref="divSelect" @doback="resetState" @backData="backData"/>
  </div>
</template>

<script>
import { fetchDetailsBySid, saveOrUpdate, submit, fetchByContractNo } from '@/api/anruifinmanagement/finwaitinvoiceapply'
import { selectAllDisList2, typeValues } from '@/api/jichuxinxi/dictcommons'
import upload from '@/components/uploadFile/upload'
import salesOrder from '../publicPage/salesOrder'
import weihukaipiaoxinxi from './relation/weihukaipiaoxinxi'
import selectCar from './relation/selectCar'

export default {
  name: '',
  components: {
    upload,
    salesOrder,
    weihukaipiaoxinxi,
    selectCar
  },
  data() {
    return {
      viewTitle: '',
      viewState: 1,
      submitdisabled: false,
      diploma_list: [],
      accept: '.jpg,.jpeg,.png,.JPG,.JPEG',
      tableKey: 0,
      billingKey: 1,
      index: 0,
      openTick_list: [],
      openTickType_list: [],
      image_list1: [],
      image_list2: [],
      image_list4: [],
      formobj: {
        applyDate: '',
        arrearsMoney: '',
        arrearsOpenYYKey: '',
        arrearsOpenYYValue: '',
        billNo: '',
        billStateKey: '',
        billStateValue: '',
        cldjhtApplicationAppendxs: [],
        carBuyContractImages: [],
        contractNo: '',
        contractSid: '',
        createByName: '',
        customerName: '',
        customerSid: '',
        deptName: '',
        deptSid: '',
        finBillTrailers: [],
        finBillVehicles: [],
        isDelayBill: '',
        isHighAndLowOpen: '',
        isLQOrigInvoice: '',
        khkpsqsApplicationAppendxs: [],
        kpxxqrsApplicationAppendxs: [],
        modelName: '',
        modelSid: '',
        nodeSid: '',
        nodeState: '',
        oneBillMoney: '',
        openTickName: '',
        openTickSid: '',
        openTickTypeKey: '',
        openTickTypeValue: '',
        openTickUnitName: '',
        openTickUnitSid: '',
        orgSidPath: '',
        procDefId: '',
        procInstSid: '',
        remarks: '',
        returnedMoneyDate: '',
        saleDeptName: '',
        saleDeptSid: '',
        saleTypeKey: '',
        saleTypeValue: '',
        showBtnStr: '',
        sid: '',
        staffName: '',
        staffSid: '',
        totalBillMoney: '',
        useOrgSid: '',
        createBySid: '',
        zjApplicationAppendxs: []
      },
      rules: {}
    }
  },
  created() {
    console.log('url:' + window.location.href)
    var one = window.location.href.indexOf('&data') + 6
    const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用
    const obj = JSON.parse(decodeURIComponent(data))
    this.showInfo(obj.businessSid)
  },
  mounted() {
    window.parent.postMessage({
      cmd: 'returnHeight',
      params: {
        // 告诉父级页面，子页面的弹框高度。
        code: 2,
        data: 450 + 'px'
      }
    }, '*')
  },
  methods: {
    init() {
      typeValues({ type: 'invoiceType' }).then((res) => {
        if (res.success) {
          this.openTickType_list = res.data
        }
      })
    },
    UpNumber(e) {
      e.target.value = e.target.value.replace(/[^\d]/g, '') // 清除“数字”和“.”"-"以外的字符
      e.target.value = e.target.value.replace(/^00/, '0') // 开头不能有两个0
      if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') {
        // 以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
        console.log(e.target.value)
        e.target.value = parseFloat(e.target.value)
      }
    },
    showInfo(sid) {
      this.init()
      this.viewTitle = '【编辑】公司开票申请'
      this.$nextTick(() => {
        this.$refs['form_obj'].clearValidate()
      })
      fetchDetailsBySid(sid).then((res) => {
        if (res.success) {
          this.formobj = res.data
          fetchByContractNo(this.formobj.contractNo).then((res) => {
            if (res.success) {
              if (res.data.oneBillMoney !== '') {
                this.formobj.oneBillMoney = res.data.oneBillMoney
              }
            }
          })
          this.formobj.orgSidPath = window.sessionStorage.getItem('defaultOrgPath')
          this.formobj.instanceId = res.data.procInstSid
          this.formobj.userSid = window.sessionStorage.getItem('userSid')
          selectAllDisList2({ orgSid: this.formobj.useOrgSid, staffSid: this.formobj.staffSid, state: '1' }).then((resp) => {
            if (resp.success) {
              this.openTick_list = resp.data
            }
          })
          if (this.formobj.cldjhtApplicationAppendxs.length > 0) {
            this.formobj.cldjhtApplicationAppendxs.forEach((e) => {
              this.image_list4.push({
                name: e.fileName,
                url: e.fileUrl
              })
            })
          }
          if (this.formobj.carBuyContractImages.length > 0) {
            this.formobj.carBuyContractImages.forEach((e) => {
              this.image_list2.push({
                name: e.fileName,
                url: e.fileUrl
              })
            })
          }
          if (this.formobj.zjApplicationAppendxs.length > 0) {
            this.formobj.zjApplicationAppendxs.forEach((e) => {
              this.image_list1.push({
                name: e.fileName,
                url: e.fileUrl
              })
            })
          }
        }
      })
    },
    handleLookByDingDan() {
      this.viewState = 2
      this.$refs['divInfo'].showInfo(this.formobj.busSalesOrderSid)
    },
    resetState() {
      this.viewState = 1
    },
    resetData() {
      this.viewState = 1
      selectAllDisList2({ orgSid: this.formobj.useOrgSid, staffSid: this.formobj.staffSid, state: '1' }).then((resp) => {
        if (resp.success) {
          this.openTick_list = resp.data
        }
      })
    },
    // 开票金额合计
    totalBillMoney() {
      if (this.formobj.oneBillMoney !== '' && this.formobj.finBillVehicles.length > 0) {
        this.formobj.totalBillMoney = parseFloat(this.formobj.oneBillMoney) * parseFloat(this.formobj.finBillVehicles.length)
      }
      return this.formobj.totalBillMoney
    },
    // 选择车辆 -- 新增申请才可选择车辆
    handleChoose() {
      this.viewState = 4
      this.$refs['divSelect'].showData(this.formobj.finBillVehicles, this.formobj.contractNo, this.formobj.orgSidPath)
    },
    // 删除车辆 -- 通过新增申请选择的车辆才可删除
    handleDelete(row, index) {
      this.formobj.finBillVehicles.splice(index, 1)
    },
    // 选择车辆 -- 返回数据 -- 通过新增申请
    backData(value) {
      this.viewState = 1
      value = JSON.parse(JSON.stringify(value))
      if (value.length > 0) {
        this.formobj.createByName = value[0].userName
        this.formobj.createBySid = value[0].userSid
        this.formobj.deptName = value[0].deptName
        this.formobj.deptSid = value[0].deptSid
        this.formobj.applyDate = value[0].applyDate
        this.formobj.staffName = value[0].sellerName
        this.formobj.staffSid = value[0].staffSid
        this.formobj.saleDeptName = value[0].sellerDept
        this.formobj.saleDeptSid = value[0].staffDeptSid
        this.formobj.saleTypeValue = value[0].saleType
        this.formobj.saleTypeKey = value[0].saleTypeKey
        this.formobj.contractNo = value[0].contractId
        this.formobj.openTickUnitName = value[0].invoicingUnit
        this.formobj.customerName = value[0].name
        this.formobj.customerSid = value[0].customerSid
        this.formobj.useOrgSid = value[0].useOrgSid
        this.formobj.busSalesOrderSid = value[0].busSalesOrderSid
        this.formobj.billStateValue = '正常开票'
        this.formobj.billStateKey = '001'
        this.formobj.modelName = value[0].modelName
        this.formobj.modelSid = value[0].modelSid
        fetchByContractNo(this.formobj.contractNo).then((res) => {
          if (res.success) {
            if (res.data.oneBillMoney !== '') {
              this.formobj.oneBillMoney = res.data.oneBillMoney
            }
          }
        })
        selectAllDisList2({ orgSid: this.formobj.useOrgSid, staffSid: this.formobj.staffSid, state: '1' }).then((resp) => {
          if (resp.success) {
            this.openTick_list = resp.data
          }
        })
        value.forEach((e) => {
          // 循环赋值主车车辆列表
          this.formobj.finBillVehicles.push({
            vinNo: e.vin,
            vehSid: e.vinSid,
            certificateStateValue: e.certificateState,
            certificateStateKey: e.certificateStateKey,
            billTypeValue: e.invoiceType,
            billTypeKey: e.invoiceTypeKey,
            openTickName: e.invoiceName,
            openTickSid: e.openTickSid,
            openTickRemarks: e.invoiceInfo,
            xSState: e.xSState
          })
          // 循环赋值挂车列表
          if (e.finBillTrailers.length > 0) {
            e.finBillTrailers.forEach((h) => {
              this.formobj.finBillTrailers.push({
                gcVinNo: h.gcVinNo,
                vinNo: h.vinNo,
                oneBillMoney: ''
              })
            })
          }
        })
      }
    },
    changeOpenTickType(val) {
      const choose = this.openTickType_list.filter((item) => item.dictValue === val)
      if (choose !== null && choose.length > 0) {
        this.formobj.openTickTypeKey = choose[0].dictKey
        this.formobj.openTickName = ''
        this.formobj.openTickSid = ''
        if (this.formobj.finBillVehicles.length > 0) {
          for (var i = 0; i < this.formobj.finBillVehicles.length; i++) {
            this.formobj.finBillVehicles[i].billTypeValue = choose[0].dictValue
            this.formobj.finBillVehicles[i].billTypeKey = choose[0].dictKey
          }
        }
        if (this.formobj.finBillVehicles.length > 0) {
          for (var k = 0; k < this.formobj.finBillVehicles.length; k++) {
            this.formobj.finBillVehicles[k].openTickName = ''
            this.formobj.finBillVehicles[k].openTickSid = ''
            this.formobj.finBillVehicles[k].openTickRemarks = ''
          }
        }
      }
    },
    changeOpenTick(val) {
      if (this.formobj.openTickTypeValue === '') {
        this.$message({ showClose: true, type: 'error', message: '请选择开票类型' })
        return
      }
      const choose = this.openTick_list.filter((item) => item.name === val)
      if (choose !== null && choose.length > 0) {
        if ((choose[0].openTickTypeValue !== this.formobj.openTickTypeValue || !choose[0].companyIs) && this.formobj.openTickTypeValue === '增值税专用发票') {
          this.$message({ showClose: true, type: 'error', message: '因开票信息与所选开票类型不符，请维护开票信息' })
          this.formobj.openTickName = ''
          this.formobj.openTickSid = ''
        } else {
          this.formobj.openTickSid = choose[0].sid
          if (this.formobj.finBillVehicles.length > 0) {
            for (var i = 0; i < this.formobj.finBillVehicles.length; i++) {
              this.formobj.finBillVehicles[i].openTickName = choose[0].name
              this.formobj.finBillVehicles[i].openTickSid = choose[0].sid
              this.formobj.finBillVehicles[i].openTickRemarks = choose[0].openTickRemarks
            }
          }
        }
      }
    },
    changeBillType(val, row) {
      const choose = this.openTickType_list.filter((item) => item.dictValue === val)
      if (choose !== null && choose.length > 0) {
        row.billTypeKey = choose[0].dictKey
        row.openTickName = ''
        row.openTickSid = ''
        row.openTickRemarks = ''
      }
    },
    changeOpenTickName(val, row) {
      if (row.billTypeValue === '') {
        this.$message({ showClose: true, type: 'error', message: '请选择开票类型' })
        return
      }
      const choose = this.openTick_list.filter((item) => item.name === val)
      if (choose !== null && choose.length > 0) {
        if ((choose[0].openTickTypeValue !== row.billTypeValue || !choose[0].companyIs) && row.billTypeValue === '增值税专用发票') {
          this.$message({ showClose: true, type: 'error', message: '因开票信息与所选开票类型不符，请维护开票信息' })
          row.openTickName = ''
          row.openTickSid = ''
          row.openTickRemarks = ''
        } else {
          row.openTickSid = choose[0].sid
          row.openTickRemarks = choose[0].openTickRemarks
        }
      }
    },
    handlePreserve() {
      this.viewState = 3
      this.$refs['divAdd'].showEdit(this.formobj.openTickName, this.formobj.useOrgSid, this.openTick_list, '开票申请')
    },
    handleSave() {
      if (this.formobj.oneBillMoney === '') {
        this.$message({ showClose: true, type: 'error', message: '单条开票金额不能为空' })
        return
      }
      this.$refs['form_obj'].validate((valid) => {
        if (valid) {
          this.getUrl()
          this.submitdisabled = true
          saveOrUpdate(this.formobj).then((res) => {
            if (res.success) {
              this.$message({ showClose: true, type: 'success', message: '保存成功' })
              // 子页面向父级页面传递值(关闭弹框)
              window.parent.postMessage({
                cmd: 'returnHeight',
                params: {
                  // 操作成功，告诉父级页面关闭弹框
                  code: 1
                }
              }, '*')
            } else {
              this.submitdisabled = false
            }
          }).catch(() => {
            this.submitdisabled = false
          })
        }
      })
    },
    handleSubmit() {
      if (this.formobj.oneBillMoney === '') {
        this.$message({ showClose: true, type: 'error', message: '单条开票金额不能为空' })
        return
      }
      for (var i = 0; i < this.formobj.finBillVehicles.length; i++) {
        if (this.formobj.finBillVehicles[i].openTickName === '') {
          this.$message({ showClose: true, type: 'error', message: this.formobj.finBillVehicles[i].vinNo + '的开票名称不能为空' })
          return
        }
        if (this.formobj.finBillVehicles[i].openTickRemarks === '') {
          this.$message({ showClose: true, type: 'error', message: this.formobj.finBillVehicles[i].vinNo + '的开票信息为空,请完善经销商信息或客户信息' })
          return
        }
      }
      this.$refs['form_obj'].validate((valid) => {
        if (valid) {
          this.getUrl()
          this.submitdisabled = true
          submit(this.formobj).then((res) => {
            if (res.success) {
              this.$message({ showClose: true, type: 'success', message: '提交成功' })
              // 子页面向父级页面传递值(关闭弹框)
              window.parent.postMessage({
                cmd: 'returnHeight',
                params: {
                  // 操作成功，告诉父级页面关闭弹框
                  code: 1
                }
              }, '*')
            } else {
              this.submitdisabled = false
            }
          }).catch(() => {
            this.submitdisabled = false
          })
        }
      })
    },
    getUrl() {
      if (this.image_list1.length > 0) {
        const aa = []
        for (var i = 0; i < this.image_list1.length; i++) {
          aa.push({
            attachType: '',
            billAppSid: '',
            createByName: window.sessionStorage.getItem('name'),
            fileSid: '',
            fileName: this.image_list1[i].name,
            fileType: this.image_list1[i].name.substr(this.image_list1[i].name.lastIndexOf('.')),
            fileUrl: this.image_list1[i].url,
            sid: ''
          })
        }
        this.formobj.zjApplicationAppendxs = aa
      } else {
        this.formobj.zjApplicationAppendxs = []
      }
      if (this.image_list2.length > 0) {
        const bb = []
        for (var k = 0; k < this.image_list2.length; k++) {
          bb.push({
            attachType: '',
            billAppSid: '',
            createByName: window.sessionStorage.getItem('name'),
            fileSid: '',
            fileName: this.image_list2[k].name,
            fileType: this.image_list2[k].name.substr(this.image_list2[k].name.lastIndexOf('.')),
            fileUrl: this.image_list2[k].url,
            sid: ''
          })
        }
        this.formobj.carBuyContractImages = bb
      } else {
        this.formobj.carBuyContractImages = []
      }
      if (this.image_list4.length > 0) {
        const cc = []
        for (var n = 0; n < this.image_list4.length; n++) {
          cc.push({
            attachType: '',
            billAppSid: '',
            createByName: window.sessionStorage.getItem('name'),
            fileSid: '',
            fileName: this.image_list4[n].name,
            fileType: this.image_list4[n].name.substr(this.image_list4[n].name.lastIndexOf('.')),
            fileUrl: this.image_list4[n].url,
            sid: ''
          })
        }
        this.formobj.cldjhtApplicationAppendxs = cc
      } else {
        this.formobj.cldjhtApplicationAppendxs = []
      }
    }
  }
}
</script>

<style scoped>
.titwu {
  font-size: 28px;
  text-align: center;
  padding: 30px 0 20px 0;
}
.titleOne {
  padding: 7px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.span-sty {
  width: 100px !important;
}
.addinputInfo {
  margin-left: 90px !important;
}
.addinputw {
  margin-left: 90px !important;
}
.tlineheightb {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}
/deep/ .tlineheightb .el-form-item .el-form-item__content .addinputInfo {
  line-height: 15px !important;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}
</style>
