<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="主榜单编号" prop="usrcode">
        <el-input
          v-model="queryParams.usrcode"
          placeholder="请输入主榜单编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="来源单据类型" prop="srcbllknd">
        <el-input
          v-model="queryParams.srcbllknd"
          placeholder="请输入来源单据类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="来源单据号" prop="srcbllid">
        <el-input
          v-model="queryParams.srcbllid"
          placeholder="请输入来源单据号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务日期" prop="bsndt">
        <el-date-picker clearable
          v-model="queryParams.bsndt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择业务日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="业务类型" prop="bsnid">
        <el-input
          v-model="queryParams.bsnid"
          placeholder="请输入业务类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单据状态" prop="bllstt">
        <el-select v-model="queryParams.bllstt" placeholder="请选择单据状态" clearable>
          <el-option
            v-for="dict in dict.type.pound_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="物料id" prop="itmno">
        <el-input
          v-model="queryParams.itmno"
          placeholder="请输入物料id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料代码" prop="itmcode">
        <el-input
          v-model="queryParams.itmcode"
          placeholder="请输入物料代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料名称" prop="itmname">
        <el-input
          v-model="queryParams.itmname"
          placeholder="请输入物料名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="规格" prop="specification">
        <el-input
          v-model="queryParams.specification"
          placeholder="请输入规格"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计量单位" prop="msrunit">
        <el-input
          v-model="queryParams.msrunit"
          placeholder="请输入计量单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="承运单位" prop="trnunitid">
        <el-input
          v-model="queryParams.trnunitid"
          placeholder="请输入承运单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="承运单位名称" prop="trnunitname">
        <el-input
          v-model="queryParams.trnunitname"
          placeholder="请输入承运单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务单位" prop="bsunitid">
        <el-input
          v-model="queryParams.bsunitid"
          placeholder="请输入业务单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务单位名称" prop="bsunitname">
        <el-input
          v-model="queryParams.bsunitname"
          placeholder="请输入业务单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发货单位" prop="sendunitid">
        <el-input
          v-model="queryParams.sendunitid"
          placeholder="请输入发货单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发货单位名称" prop="sendunitname">
        <el-input
          v-model="queryParams.sendunitname"
          placeholder="请输入发货单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收货单位" prop="recunitid">
        <el-input
          v-model="queryParams.recunitid"
          placeholder="请输入收货单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收货单位名称" prop="recunitname">
        <el-input
          v-model="queryParams.recunitname"
          placeholder="请输入收货单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务磅点id" prop="poundid">
        <el-input
          v-model="queryParams.poundid"
          placeholder="请输入业务磅点id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务榜点名称" prop="poundname">
        <el-input
          v-model="queryParams.poundname"
          placeholder="请输入业务榜点名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="炉号" prop="boilerno">
        <el-input
          v-model="queryParams.boilerno"
          placeholder="请输入炉号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="钢号" prop="steeno">
        <el-input
          v-model="queryParams.steeno"
          placeholder="请输入钢号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="长度" prop="unitlen">
        <el-input
          v-model="queryParams.unitlen"
          placeholder="请输入长度"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="支数和" prop="carnoSum">
        <el-input
          v-model="queryParams.carnoSum"
          placeholder="请输入支数和"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="重量和" prop="carmqtySum">
        <el-input
          v-model="queryParams.carmqtySum"
          placeholder="请输入重量和"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="序号" prop="indexid">
        <el-input
          v-model="queryParams.indexid"
          placeholder="请输入序号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="连铸" prop="lzno">
        <el-input
          v-model="queryParams.lzno"
          placeholder="请输入连铸"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="班别" prop="bbno">
        <el-input
          v-model="queryParams.bbno"
          placeholder="请输入班别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="登记部门" prop="crtorgid">
        <el-input
          v-model="queryParams.crtorgid"
          placeholder="请输入登记部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否启用" prop="isinuse">
        <el-input
          v-model="queryParams.isinuse"
          placeholder="请输入是否启用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="crtdt">
        <el-date-picker clearable
          v-model="queryParams.crtdt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="创建人" prop="crtopr">
        <el-input
          v-model="queryParams.crtopr"
          placeholder="请输入创建人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最后修改时间" prop="lstedtdt">
        <el-date-picker clearable
          v-model="queryParams.lstedtdt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择最后修改时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最后修改人" prop="lstedtopr">
        <el-input
          v-model="queryParams.lstedtopr"
          placeholder="请输入最后修改人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="回传星空ID" prop="fid">
        <el-input
          v-model="queryParams.fid"
          placeholder="请输入回传星空ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="回传星空分录ID" prop="fentity_fentryid">
        <el-input
          v-model="queryParams.fentity_fentryid"
          placeholder="请输入回传星空分录ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="星空单据类型" prop="oabilltype">
        <el-select v-model="queryParams.oabilltype" placeholder="请选择星空单据类型" clearable>
          <el-option
            v-for="dict in dict.type.oa_formid"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" 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"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['measurement/bill:poundmst:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['measurement/bill:poundmst:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['measurement/bill:poundmst:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['measurement/bill:poundmst:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="poundmstList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="主榜单编号" align="center" prop="usrcode" />
      <el-table-column label="来源单据类型" align="center" prop="srcbllknd" />
      <el-table-column label="来源单据号" align="center" prop="srcbllid" />
      <el-table-column label="业务日期" align="center" prop="bsndt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bsndt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="业务类型" align="center" prop="bsnid" />
      <el-table-column label="单据状态" align="center" prop="bllstt">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.pound_status" :value="scope.row.bllstt"/>
        </template>
      </el-table-column>
      <el-table-column label="物料id" align="center" prop="itmno" />
      <el-table-column label="物料代码" align="center" prop="itmcode" />
      <el-table-column label="物料名称" align="center" prop="itmname" />
      <el-table-column label="规格" align="center" prop="specification" />
      <el-table-column label="计量单位" align="center" prop="msrunit" />
      <el-table-column label="承运单位" align="center" prop="trnunitid" />
      <el-table-column label="承运单位名称" align="center" prop="trnunitname" />
      <el-table-column label="业务单位" align="center" prop="bsunitid" />
      <el-table-column label="业务单位名称" align="center" prop="bsunitname" />
      <el-table-column label="发货单位" align="center" prop="sendunitid" />
      <el-table-column label="发货单位名称" align="center" prop="sendunitname" />
      <el-table-column label="收货单位" align="center" prop="recunitid" />
      <el-table-column label="收货单位名称" align="center" prop="recunitname" />
      <el-table-column label="业务磅点id" align="center" prop="poundid" />
      <el-table-column label="业务榜点名称" align="center" prop="poundname" />
      <el-table-column label="炉号" align="center" prop="boilerno" />
      <el-table-column label="钢号" align="center" prop="steeno" />
      <el-table-column label="长度" align="center" prop="unitlen" />
      <el-table-column label="支数和" align="center" prop="carnoSum" />
      <el-table-column label="重量和" align="center" prop="carmqtySum" />
      <el-table-column label="序号" align="center" prop="indexid" />
      <el-table-column label="钢种" align="center" prop="steeltype" />
      <el-table-column label="线材类型" align="center" prop="linetype" />
      <el-table-column label="连铸" align="center" prop="lzno" />
      <el-table-column label="班别" align="center" prop="bbno" />
      <el-table-column label="仓库名称" align="center" prop="cangKuName" />
      <el-table-column label="仓库编号" align="center" prop="cangKuNumber" />
      <el-table-column label="生产车间编号" align="center" prop="sccjNum" />
      <el-table-column label="登记部门" align="center" prop="crtorgid" />
      <el-table-column label="是否启用" align="center" prop="isinuse" />
      <el-table-column label="创建时间" align="center" prop="crtdt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.crtdt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人" align="center" prop="crtopr" />
      <el-table-column label="最后修改时间" align="center" prop="lstedtdt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lstedtdt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最后修改人" align="center" prop="lstedtopr" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="回传星空ID" align="center" prop="fid" />
      <el-table-column label="回传星空分录ID" align="center" prop="fentity_fentryid" />
      <el-table-column label="星空单据类型" align="center" prop="oabilltype">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.oa_formid" :value="scope.row.oabilltype"/>
        </template>
      </el-table-column>
      <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="['measurement/bill:poundmst:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['measurement/bill:poundmst: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="主榜单编号" prop="usrcode">
          <el-input v-model="form.usrcode" placeholder="请输入主榜单编号" />
        </el-form-item>
        <el-form-item label="来源单据类型" prop="srcbllknd">
          <el-input v-model="form.srcbllknd" placeholder="请输入来源单据类型" />
        </el-form-item>
        <el-form-item label="来源单据号" prop="srcbllid">
          <el-input v-model="form.srcbllid" placeholder="请输入来源单据号" />
        </el-form-item>
        <el-form-item label="业务日期" prop="bsndt">
          <el-date-picker clearable
            v-model="form.bsndt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择业务日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="业务类型" prop="bsnid">
          <el-input v-model="form.bsnid" placeholder="请输入业务类型" />
        </el-form-item>
        <el-form-item label="单据状态" prop="bllstt">
          <el-select v-model="form.bllstt" placeholder="请选择单据状态">
            <el-option
              v-for="dict in dict.type.pound_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="物料id" prop="itmno">
          <el-input v-model="form.itmno" placeholder="请输入物料id" />
        </el-form-item>
        <el-form-item label="物料代码" prop="itmcode">
          <el-input v-model="form.itmcode" placeholder="请输入物料代码" />
        </el-form-item>
        <el-form-item label="物料名称" prop="itmname">
          <el-input v-model="form.itmname" placeholder="请输入物料名称" />
        </el-form-item>
        <el-form-item label="规格" prop="specification">
          <el-input v-model="form.specification" placeholder="请输入规格" />
        </el-form-item>
        <el-form-item label="计量单位" prop="msrunit">
          <el-input v-model="form.msrunit" placeholder="请输入计量单位" />
        </el-form-item>
        <el-form-item label="承运单位" prop="trnunitid">
          <el-input v-model="form.trnunitid" placeholder="请输入承运单位" />
        </el-form-item>
        <el-form-item label="承运单位名称" prop="trnunitname">
          <el-input v-model="form.trnunitname" placeholder="请输入承运单位名称" />
        </el-form-item>
        <el-form-item label="业务单位" prop="bsunitid">
          <el-input v-model="form.bsunitid" placeholder="请输入业务单位" />
        </el-form-item>
        <el-form-item label="业务单位名称" prop="bsunitname">
          <el-input v-model="form.bsunitname" placeholder="请输入业务单位名称" />
        </el-form-item>
        <el-form-item label="发货单位" prop="sendunitid">
          <el-input v-model="form.sendunitid" placeholder="请输入发货单位" />
        </el-form-item>
        <el-form-item label="发货单位名称" prop="sendunitname">
          <el-input v-model="form.sendunitname" placeholder="请输入发货单位名称" />
        </el-form-item>
        <el-form-item label="收货单位" prop="recunitid">
          <el-input v-model="form.recunitid" placeholder="请输入收货单位" />
        </el-form-item>
        <el-form-item label="收货单位名称" prop="recunitname">
          <el-input v-model="form.recunitname" placeholder="请输入收货单位名称" />
        </el-form-item>
        <el-form-item label="业务磅点id" prop="poundid">
          <el-input v-model="form.poundid" placeholder="请输入业务磅点id" />
        </el-form-item>
        <el-form-item label="业务榜点名称" prop="poundname">
          <el-input v-model="form.poundname" placeholder="请输入业务榜点名称" />
        </el-form-item>
        <el-form-item label="炉号" prop="boilerno">
          <el-input v-model="form.boilerno" placeholder="请输入炉号" />
        </el-form-item>
        <el-form-item label="钢号" prop="steeno">
          <el-input v-model="form.steeno" placeholder="请输入钢号" />
        </el-form-item>
        <el-form-item label="长度" prop="unitlen">
          <el-input v-model="form.unitlen" placeholder="请输入长度" />
        </el-form-item>
        <el-form-item label="支数和" prop="carnoSum">
          <el-input v-model="form.carnoSum" placeholder="请输入支数和" />
        </el-form-item>
        <el-form-item label="重量和" prop="carmqtySum">
          <el-input v-model="form.carmqtySum" placeholder="请输入重量和" />
        </el-form-item>
        <el-form-item label="序号" prop="indexid">
          <el-input v-model="form.indexid" placeholder="请输入序号" />
        </el-form-item>
        <el-form-item label="连铸" prop="lzno">
          <el-input v-model="form.lzno" placeholder="请输入连铸" />
        </el-form-item>
        <el-form-item label="班别" prop="bbno">
          <el-input v-model="form.bbno" placeholder="请输入班别" />
        </el-form-item>
        <el-form-item label="仓库名称" prop="cangKuName">
          <el-input v-model="form.cangKuName" placeholder="请输入仓库名称" />
        </el-form-item>
        <el-form-item label="仓库编号" prop="cangKuNumber">
          <el-input v-model="form.cangKuNumber" placeholder="请输入仓库编号" />
        </el-form-item>
        <el-form-item label="生产车间编号" prop="sccjNum">
          <el-input v-model="form.sccjNum" placeholder="请输入生产车间编号" />
        </el-form-item>
        <el-form-item label="登记部门" prop="crtorgid">
          <el-input v-model="form.crtorgid" placeholder="请输入登记部门" />
        </el-form-item>
        <el-form-item label="是否启用" prop="isinuse">
          <el-input v-model="form.isinuse" placeholder="请输入是否启用" />
        </el-form-item>
        <el-form-item label="创建时间" prop="crtdt">
          <el-date-picker clearable
            v-model="form.crtdt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="创建人" prop="crtopr">
          <el-input v-model="form.crtopr" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="最后修改时间" prop="lstedtdt">
          <el-date-picker clearable
            v-model="form.lstedtdt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择最后修改时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最后修改人" prop="lstedtopr">
          <el-input v-model="form.lstedtopr" placeholder="请输入最后修改人" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="回传星空ID" prop="fid">
          <el-input v-model="form.fid" placeholder="请输入回传星空ID" />
        </el-form-item>
        <el-form-item label="回传星空分录ID" prop="fentity_fentryid">
          <el-input v-model="form.fentity_fentryid" placeholder="请输入回传星空分录ID" />
        </el-form-item>
        <el-form-item label="星空单据类型" prop="oabilltype">
          <el-select v-model="form.oabilltype" placeholder="请选择星空单据类型">
            <el-option
              v-for="dict in dict.type.oa_formid"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </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 { listPoundmst, getPoundmst, delPoundmst, addPoundmst, updatePoundmst } from "@/api/measurement/bill/poundmst"

export default {
  name: "Poundmst",
  dicts: ['pound_status', 'oa_formid'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 主榜单信息表格数据
      poundmstList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        usrcode: null,
        srcbllknd: null,
        srcbllid: null,
        bsndt: null,
        bsnid: null,
        bllstt: null,
        itmno: null,
        itmcode: null,
        itmname: null,
        specification: null,
        msrunit: null,
        trnunitid: null,
        trnunitname: null,
        bsunitid: null,
        bsunitname: null,
        sendunitid: null,
        sendunitname: null,
        recunitid: null,
        recunitname: null,
        poundid: null,
        poundname: null,
        boilerno: null,
        steeno: null,
        unitlen: null,
        carnoSum: null,
        carmqtySum: null,
        indexid: null,
        steeltype: null,
        linetype: null,
        lzno: null,
        bbno: null,
        cangKuName: null,
        cangKuNumber: null,
        sccjNum: null,
        crtorgid: null,
        isinuse: null,
        crtdt: null,
        crtopr: null,
        lstedtdt: null,
        lstedtopr: null,
        fid: null,
        fentity_fentryid: null,
        oabilltype: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询主榜单信息列表 */
    getList() {
      this.loading = true
      listPoundmst(this.queryParams).then(response => {
        this.poundmstList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        usrcode: null,
        srcbllknd: null,
        srcbllid: null,
        bsndt: null,
        bsnid: null,
        bllstt: null,
        itmno: null,
        itmcode: null,
        itmname: null,
        specification: null,
        msrunit: null,
        trnunitid: null,
        trnunitname: null,
        bsunitid: null,
        bsunitname: null,
        sendunitid: null,
        sendunitname: null,
        recunitid: null,
        recunitname: null,
        poundid: null,
        poundname: null,
        boilerno: null,
        steeno: null,
        unitlen: null,
        carnoSum: null,
        carmqtySum: null,
        indexid: null,
        steeltype: null,
        linetype: null,
        lzno: null,
        bbno: null,
        cangKuName: null,
        cangKuNumber: null,
        sccjNum: null,
        crtorgid: null,
        isinuse: null,
        crtdt: null,
        crtopr: null,
        lstedtdt: null,
        lstedtopr: null,
        remark: null,
        fid: null,
        fentity_fentryid: null,
        oabilltype: 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
      getPoundmst(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) {
            updatePoundmst(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addPoundmst(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除主榜单信息编号为"' + ids + '"的数据项？').then(function() {
        return delPoundmst(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('measurement/bill/poundmst/export', {
        ...this.queryParams
      }, `poundmst_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
