<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="编号两位前缀+YYMMNNNN" prop="billNo">
        <el-input
          v-model="queryParams.billNo"
          placeholder="请输入编号两位前缀+YYMMNNNN"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="活动号" prop="actId">
        <el-input
          v-model="queryParams.actId"
          placeholder="请输入活动号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="客户id" prop="corpId">
        <el-input
          v-model="queryParams.corpId"
          placeholder="请输入客户id"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务员id" prop="transUserName">
        <el-input
          v-model="queryParams.transUserName"
          placeholder="请输入业务员id"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="调度员id" prop="planUserName">
        <el-input
          v-model="queryParams.planUserName"
          placeholder="请输入调度员id"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="1进口2出口3内贸4其他" prop="billType">
        <el-select v-model="queryParams.billType" placeholder="请选择1进口2出口3内贸4其他" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="1集装箱2大件3散货" prop="transType">
        <el-select v-model="queryParams.transType" placeholder="请选择1集装箱2大件3散货" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="1重去重回2重去空回3空去重回" prop="transProp">
        <el-input
          v-model="queryParams.transProp"
          placeholder="请输入1重去重回2重去空回3空去重回"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否有合同(1有，0没有)" prop="ifContracted">
        <el-input
          v-model="queryParams.ifContracted"
          placeholder="请输入是否有合同(1有，0没有)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同号" prop="contractNo">
        <el-input
          v-model="queryParams.contractNo"
          placeholder="请输入合同号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="参考号" prop="refNo">
        <el-input
          v-model="queryParams.refNo"
          placeholder="请输入参考号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="账期类型：天数、月底" prop="accstlType">
        <el-select v-model="queryParams.accstlType" placeholder="请选择账期类型：天数、月底" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="账期天数" prop="accdays">
        <el-input
          v-model="queryParams.accdays"
          placeholder="请输入账期天数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="品名id" prop="goodsId">
        <el-input
          v-model="queryParams.goodsId"
          placeholder="请输入品名id"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="货值" prop="goodsPrice">
        <el-input
          v-model="queryParams.goodsPrice"
          placeholder="请输入货值"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="损耗类型：公斤、千分百" prop="goodsLossType">
        <el-select v-model="queryParams.goodsLossType" placeholder="请选择损耗类型：公斤、千分百" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="耗损标准" prop="goodsLossStd">
        <el-input
          v-model="queryParams.goodsLossStd"
          placeholder="请输入耗损标准"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="提单号" prop="mblno">
        <el-input
          v-model="queryParams.mblno"
          placeholder="请输入提单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="船名" prop="ysl">
        <el-input
          v-model="queryParams.ysl"
          placeholder="请输入船名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="航次" prop="voy">
        <el-input
          v-model="queryParams.voy"
          placeholder="请输入航次"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="起运港ID" prop="pol">
        <el-input
          v-model="queryParams.pol"
          placeholder="请输入起运港ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="目的港ID" prop="pod">
        <el-input
          v-model="queryParams.pod"
          placeholder="请输入目的港ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划件数或总箱量" prop="qtyPlan">
        <el-input
          v-model="queryParams.qtyPlan"
          placeholder="请输入计划件数或总箱量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="已安排数" prop="qtyDisPatch">
        <el-input
          v-model="queryParams.qtyDisPatch"
          placeholder="请输入已安排数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划重量" prop="weightPlan">
        <el-input
          v-model="queryParams.weightPlan"
          placeholder="请输入计划重量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="箱型箱量明细表自动生成" prop="cntrDesc">
        <el-input
          v-model="queryParams.cntrDesc"
          placeholder="请输入箱型箱量明细表自动生成"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="车号列表，根据派车自动生成" prop="carNoList">
        <el-input
          v-model="queryParams.carNoList"
          placeholder="请输入车号列表，根据派车自动生成"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="装车地" prop="loadAddr">
        <el-input
          v-model="queryParams.loadAddr"
          placeholder="请输入装车地"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="装车联系人" prop="loadAttn">
        <el-input
          v-model="queryParams.loadAttn"
          placeholder="请输入装车联系人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系电话" prop="loadAttntel">
        <el-input
          v-model="queryParams.loadAttntel"
          placeholder="请输入联系电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="要求装车时间" prop="loadDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.loadDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择要求装车时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="装卸货地" prop="mdLoadAddr">
        <el-input
          v-model="queryParams.mdLoadAddr"
          placeholder="请输入装卸货地"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="装卸货联系人" prop="mdLoadAttn">
        <el-input
          v-model="queryParams.mdLoadAttn"
          placeholder="请输入装卸货联系人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="装卸货联系电话" prop="mdLoadAttnTel">
        <el-input
          v-model="queryParams.mdLoadAttnTel"
          placeholder="请输入装卸货联系电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="要求装卸货时间" prop="mdLoadDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.mdLoadDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择要求装卸货时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="卸车地" prop="unLoadAddr">
        <el-input
          v-model="queryParams.unLoadAddr"
          placeholder="请输入卸车地"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="卸车联系人" prop="unLoadAttn">
        <el-input
          v-model="queryParams.unLoadAttn"
          placeholder="请输入卸车联系人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="卸车联系电话" prop="unLoadAttnTel">
        <el-input
          v-model="queryParams.unLoadAttnTel"
          placeholder="请输入卸车联系电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="要求卸车时间" prop="unLoadDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.unLoadDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择要求卸车时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="规定线路(将来会做基础资料)" prop="routeId">
        <el-input
          v-model="queryParams.routeId"
          placeholder="请输入规定线路(将来会做基础资料)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="线路描述" prop="routeDesc">
        <el-input
          v-model="queryParams.routeDesc"
          placeholder="请输入线路描述"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否要求回单(1要求，0不要求)" prop="ifWaybill">
        <el-input
          v-model="queryParams.ifWaybill"
          placeholder="请输入是否要求回单(1要求，0不要求)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否要求开票(1要求，0不要求)" prop="ifNeedinvDr">
        <el-input
          v-model="queryParams.ifNeedinvDr"
          placeholder="请输入是否要求开票(1要求，0不要求)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务完成日期" prop="postDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.postDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择业务完成日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="状态(1新建，2暂存，6提交)" prop="billStatus">
        <el-select v-model="queryParams.billStatus" placeholder="请选择状态(1新建，2暂存，6提交)" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="备注" prop="remarks">
        <el-input
          v-model="queryParams.remarks"
          placeholder="请输入备注"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['fleet:ftmsorderbills:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['fleet:ftmsorderbills:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['fleet:ftmsorderbills:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['fleet:ftmsorderbills:export']"
        >导出</el-button>
      </el-col>
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="ftmsorderbillsList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="备注" align="center" prop="id" />
      <el-table-column label="编号两位前缀+YYMMNNNN" align="center" prop="billNo" />
      <el-table-column label="活动号" align="center" prop="actId" />
      <el-table-column label="客户id" align="center" prop="corpId" />
      <el-table-column label="业务员id" align="center" prop="transUserName" />
      <el-table-column label="调度员id" align="center" prop="planUserName" />
      <el-table-column label="1进口2出口3内贸4其他" align="center" prop="billType" />
      <el-table-column label="1集装箱2大件3散货" align="center" prop="transType" />
      <el-table-column label="1重去重回2重去空回3空去重回" align="center" prop="transProp" />
      <el-table-column label="是否有合同(1有，0没有)" align="center" prop="ifContracted" />
      <el-table-column label="合同号" align="center" prop="contractNo" />
      <el-table-column label="参考号" align="center" prop="refNo" />
      <el-table-column label="账期类型：天数、月底" align="center" prop="accstlType" />
      <el-table-column label="账期天数" align="center" prop="accdays" />
      <el-table-column label="品名id" align="center" prop="goodsId" />
      <el-table-column label="货值" align="center" prop="goodsPrice" />
      <el-table-column label="损耗类型：公斤、千分百" align="center" prop="goodsLossType" />
      <el-table-column label="耗损标准" align="center" prop="goodsLossStd" />
      <el-table-column label="提单号" align="center" prop="mblno" />
      <el-table-column label="船名" align="center" prop="ysl" />
      <el-table-column label="航次" align="center" prop="voy" />
      <el-table-column label="起运港ID" align="center" prop="pol" />
      <el-table-column label="目的港ID" align="center" prop="pod" />
      <el-table-column label="计划件数或总箱量" align="center" prop="qtyPlan" />
      <el-table-column label="已安排数" align="center" prop="qtyDisPatch" />
      <el-table-column label="计划重量" align="center" prop="weightPlan" />
      <el-table-column label="箱型箱量明细表自动生成" align="center" prop="cntrDesc" />
      <el-table-column label="车号列表，根据派车自动生成" align="center" prop="carNoList" />
      <el-table-column label="装车地" align="center" prop="loadAddr" />
      <el-table-column label="装车联系人" align="center" prop="loadAttn" />
      <el-table-column label="联系电话" align="center" prop="loadAttntel" />
      <el-table-column label="要求装车时间" align="center" prop="loadDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.loadDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="装卸货地" align="center" prop="mdLoadAddr" />
      <el-table-column label="装卸货联系人" align="center" prop="mdLoadAttn" />
      <el-table-column label="装卸货联系电话" align="center" prop="mdLoadAttnTel" />
      <el-table-column label="要求装卸货时间" align="center" prop="mdLoadDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.mdLoadDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="卸车地" align="center" prop="unLoadAddr" />
      <el-table-column label="卸车联系人" align="center" prop="unLoadAttn" />
      <el-table-column label="卸车联系电话" align="center" prop="unLoadAttnTel" />
      <el-table-column label="要求卸车时间" align="center" prop="unLoadDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.unLoadDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="规定线路(将来会做基础资料)" align="center" prop="routeId" />
      <el-table-column label="线路描述" align="center" prop="routeDesc" />
      <el-table-column label="是否要求回单(1要求，0不要求)" align="center" prop="ifWaybill" />
      <el-table-column label="是否要求开票(1要求，0不要求)" align="center" prop="ifNeedinvDr" />
      <el-table-column label="业务完成日期" align="center" prop="postDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.postDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态(1新建，2暂存，6提交)" align="center" prop="billStatus" />
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['fleet:ftmsorderbills:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['fleet:ftmsorderbills:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改订单主对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="编号两位前缀+YYMMNNNN" prop="billNo">
          <el-input v-model="form.billNo" placeholder="请输入编号两位前缀+YYMMNNNN" />
        </el-form-item>
        <el-form-item label="活动号" prop="actId">
          <el-input v-model="form.actId" placeholder="请输入活动号" />
        </el-form-item>
        <el-form-item label="客户id" prop="corpId">
          <el-input v-model="form.corpId" placeholder="请输入客户id" />
        </el-form-item>
        <el-form-item label="业务员id" prop="transUserName">
          <el-input v-model="form.transUserName" placeholder="请输入业务员id" />
        </el-form-item>
        <el-form-item label="调度员id" prop="planUserName">
          <el-input v-model="form.planUserName" placeholder="请输入调度员id" />
        </el-form-item>
        <el-form-item label="1进口2出口3内贸4其他" prop="billType">
          <el-select v-model="form.billType" placeholder="请选择1进口2出口3内贸4其他">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="1集装箱2大件3散货" prop="transType">
          <el-select v-model="form.transType" placeholder="请选择1集装箱2大件3散货">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="1重去重回2重去空回3空去重回" prop="transProp">
          <el-input v-model="form.transProp" placeholder="请输入1重去重回2重去空回3空去重回" />
        </el-form-item>
        <el-form-item label="是否有合同(1有，0没有)" prop="ifContracted">
          <el-input v-model="form.ifContracted" placeholder="请输入是否有合同(1有，0没有)" />
        </el-form-item>
        <el-form-item label="合同号" prop="contractNo">
          <el-input v-model="form.contractNo" placeholder="请输入合同号" />
        </el-form-item>
        <el-form-item label="参考号" prop="refNo">
          <el-input v-model="form.refNo" placeholder="请输入参考号" />
        </el-form-item>
        <el-form-item label="账期类型：天数、月底" prop="accstlType">
          <el-select v-model="form.accstlType" placeholder="请选择账期类型：天数、月底">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="账期天数" prop="accdays">
          <el-input v-model="form.accdays" placeholder="请输入账期天数" />
        </el-form-item>
        <el-form-item label="品名id" prop="goodsId">
          <el-input v-model="form.goodsId" placeholder="请输入品名id" />
        </el-form-item>
        <el-form-item label="货值" prop="goodsPrice">
          <el-input v-model="form.goodsPrice" placeholder="请输入货值" />
        </el-form-item>
        <el-form-item label="损耗类型：公斤、千分百" prop="goodsLossType">
          <el-select v-model="form.goodsLossType" placeholder="请选择损耗类型：公斤、千分百">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="耗损标准" prop="goodsLossStd">
          <el-input v-model="form.goodsLossStd" placeholder="请输入耗损标准" />
        </el-form-item>
        <el-form-item label="提单号" prop="mblno">
          <el-input v-model="form.mblno" placeholder="请输入提单号" />
        </el-form-item>
        <el-form-item label="船名" prop="ysl">
          <el-input v-model="form.ysl" placeholder="请输入船名" />
        </el-form-item>
        <el-form-item label="航次" prop="voy">
          <el-input v-model="form.voy" placeholder="请输入航次" />
        </el-form-item>
        <el-form-item label="起运港ID" prop="pol">
          <el-input v-model="form.pol" placeholder="请输入起运港ID" />
        </el-form-item>
        <el-form-item label="目的港ID" prop="pod">
          <el-input v-model="form.pod" placeholder="请输入目的港ID" />
        </el-form-item>
        <el-form-item label="计划件数或总箱量" prop="qtyPlan">
          <el-input v-model="form.qtyPlan" placeholder="请输入计划件数或总箱量" />
        </el-form-item>
        <el-form-item label="已安排数" prop="qtyDisPatch">
          <el-input v-model="form.qtyDisPatch" placeholder="请输入已安排数" />
        </el-form-item>
        <el-form-item label="计划重量" prop="weightPlan">
          <el-input v-model="form.weightPlan" placeholder="请输入计划重量" />
        </el-form-item>
        <el-form-item label="箱型箱量明细表自动生成" prop="cntrDesc">
          <el-input v-model="form.cntrDesc" placeholder="请输入箱型箱量明细表自动生成" />
        </el-form-item>
        <el-form-item label="车号列表，根据派车自动生成" prop="carNoList">
          <el-input v-model="form.carNoList" placeholder="请输入车号列表，根据派车自动生成" />
        </el-form-item>
        <el-form-item label="装车地" prop="loadAddr">
          <el-input v-model="form.loadAddr" placeholder="请输入装车地" />
        </el-form-item>
        <el-form-item label="装车联系人" prop="loadAttn">
          <el-input v-model="form.loadAttn" placeholder="请输入装车联系人" />
        </el-form-item>
        <el-form-item label="联系电话" prop="loadAttntel">
          <el-input v-model="form.loadAttntel" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="要求装车时间" prop="loadDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.loadDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择要求装车时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="装卸货地" prop="mdLoadAddr">
          <el-input v-model="form.mdLoadAddr" placeholder="请输入装卸货地" />
        </el-form-item>
        <el-form-item label="装卸货联系人" prop="mdLoadAttn">
          <el-input v-model="form.mdLoadAttn" placeholder="请输入装卸货联系人" />
        </el-form-item>
        <el-form-item label="装卸货联系电话" prop="mdLoadAttnTel">
          <el-input v-model="form.mdLoadAttnTel" placeholder="请输入装卸货联系电话" />
        </el-form-item>
        <el-form-item label="要求装卸货时间" prop="mdLoadDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.mdLoadDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择要求装卸货时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="卸车地" prop="unLoadAddr">
          <el-input v-model="form.unLoadAddr" placeholder="请输入卸车地" />
        </el-form-item>
        <el-form-item label="卸车联系人" prop="unLoadAttn">
          <el-input v-model="form.unLoadAttn" placeholder="请输入卸车联系人" />
        </el-form-item>
        <el-form-item label="卸车联系电话" prop="unLoadAttnTel">
          <el-input v-model="form.unLoadAttnTel" placeholder="请输入卸车联系电话" />
        </el-form-item>
        <el-form-item label="要求卸车时间" prop="unLoadDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.unLoadDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择要求卸车时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="规定线路(将来会做基础资料)" prop="routeId">
          <el-input v-model="form.routeId" placeholder="请输入规定线路(将来会做基础资料)" />
        </el-form-item>
        <el-form-item label="线路描述" prop="routeDesc">
          <el-input v-model="form.routeDesc" placeholder="请输入线路描述" />
        </el-form-item>
        <el-form-item label="是否要求回单(1要求，0不要求)" prop="ifWaybill">
          <el-input v-model="form.ifWaybill" placeholder="请输入是否要求回单(1要求，0不要求)" />
        </el-form-item>
        <el-form-item label="是否要求开票(1要求，0不要求)" prop="ifNeedinvDr">
          <el-input v-model="form.ifNeedinvDr" placeholder="请输入是否要求开票(1要求，0不要求)" />
        </el-form-item>
        <el-form-item label="业务完成日期" prop="postDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.postDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择业务完成日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="状态(1新建，2暂存，6提交)">
          <el-radio-group v-model="form.billStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="删除状态" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listFtmsorderbills, getFtmsorderbills, delFtmsorderbills, addFtmsorderbills, updateFtmsorderbills, exportFtmsorderbills } from "@/api/fleet/ftmsorderbills";

export default {
  name: "Ftmsorderbills",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 订单主表格数据
      ftmsorderbillsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        billNo: null,
        actId: null,
        corpId: null,
        transUserName: null,
        planUserName: null,
        billType: null,
        transType: null,
        transProp: null,
        ifContracted: null,
        contractNo: null,
        refNo: null,
        accstlType: null,
        accdays: null,
        goodsId: null,
        goodsPrice: null,
        goodsLossType: null,
        goodsLossStd: null,
        mblno: null,
        ysl: null,
        voy: null,
        pol: null,
        pod: null,
        qtyPlan: null,
        qtyDisPatch: null,
        weightPlan: null,
        cntrDesc: null,
        carNoList: null,
        loadAddr: null,
        loadAttn: null,
        loadAttntel: null,
        loadDate: null,
        mdLoadAddr: null,
        mdLoadAttn: null,
        mdLoadAttnTel: null,
        mdLoadDate: null,
        unLoadAddr: null,
        unLoadAttn: null,
        unLoadAttnTel: null,
        unLoadDate: null,
        routeId: null,
        routeDesc: null,
        ifWaybill: null,
        ifNeedinvDr: null,
        postDate: null,
        billStatus: null,
        remarks: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询订单主列表 */
    getList() {
      this.loading = true;
      listFtmsorderbills(this.queryParams).then(response => {
        this.ftmsorderbillsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        billNo: null,
        actId: null,
        corpId: null,
        transUserName: null,
        planUserName: null,
        billType: null,
        transType: null,
        transProp: null,
        ifContracted: null,
        contractNo: null,
        refNo: null,
        accstlType: null,
        accdays: null,
        goodsId: null,
        goodsPrice: null,
        goodsLossType: null,
        goodsLossStd: null,
        mblno: null,
        ysl: null,
        voy: null,
        pol: null,
        pod: null,
        qtyPlan: null,
        qtyDisPatch: null,
        weightPlan: null,
        cntrDesc: null,
        carNoList: null,
        loadAddr: null,
        loadAttn: null,
        loadAttntel: null,
        loadDate: null,
        mdLoadAddr: null,
        mdLoadAttn: null,
        mdLoadAttnTel: null,
        mdLoadDate: null,
        unLoadAddr: null,
        unLoadAttn: null,
        unLoadAttnTel: null,
        unLoadDate: null,
        routeId: null,
        routeDesc: null,
        ifWaybill: null,
        ifNeedinvDr: null,
        postDate: null,
        billStatus: 0,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remarks: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加订单主";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getFtmsorderbills(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改订单主";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateFtmsorderbills(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addFtmsorderbills(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除订单主编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delFtmsorderbills(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有订单主数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportFtmsorderbills(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    }
  }
};
</script>
