<template>
  <!-- 汽运单价页面 -->
  <div class="salePlan">
    <div class="top">
      <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
      <el-button type="primary" class="btn" @click="onclick">
        <i class="el-icon-search"></i>查询
      </el-button>
      

      <el-button type="primary" @click="btnclick(0)">
        <i class="el-icon-plus"></i>新增
      </el-button>
       <el-button type="primary" @click="exportData()"><i class="el-icon-download"></i>导出(Excel)</el-button>
    </div>
    <dilTable ref="excelDom" v-bind.sync="option">
      <el-table-column fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <el-button @click="click(scope.row.priceId)" type="text" size="small"
            >修改</el-button
          >
          <el-button
            type="text"
            size="small"
            @click="deleteclick(scope.row.priceId)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </dilTable>
  </div>
</template>
<script>
export default {
  name: "TransportPrice",
  data() {
    return {
      input: "",
      option: {
        // 表格请求数据的地址
        requestUrl:
          "/api/v1/ams/getAmsContractTransportPrice1?apiId=109",
      },
      tableTitle:'汽运单价'
    };
  },
  methods: {
    onclick() {
      this.option.requestUrl =
        "/api/v1/ams/getAmsContractTransportPrice?apiId=109&con=" +
        this.input;
    },
    btnclick() {
      this.$router.push("/addTransportPrice");
    },
    click(priceId) {
      this.$router.push("/editTransportPrice/" + priceId);
    },
    deleteclick(scope) {
      let priceId = scope;
      this.$confirm("是否删除", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          this.axios
            .post(
              "/api/v1/ams/deleteAmsContractTransportPrice1?priceId=" +
                priceId
            )
            .then((res) => {
              if (res.data.code == "200") {
                this.$router.go(0);
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消删除!",
          });
        });
    },
    
  },
  
};
</script>
<style lang='scss' scoped>
.salePlan {
  .top {
    padding: 1.25rem 1.875rem;
  }
}
</style>