<template>
  <!-- 运输派单 -->
  <div class="homeworkPath">
    <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>
    </div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <!-- 未接收 -->
      	<el-tab-pane label="未接收" name="third">
						<dilTable v-bind.sync="option0">
              <el-table-column fixed="right" label="操作" width="50">
        <template slot-scope="scope">
          <el-button @click="closeOrder(scope.row.orderId)" type="text" size="small">
            关闭
          </el-button>
        </template>
      </el-table-column>
						</dilTable>
					</el-tab-pane>
      <!-- 未下发 -->
      <el-tab-pane label="已接收" name="first">
        <dilTable v-bind.sync="option1" ref="table">
        </dilTable>
      </el-tab-pane>
      <!-- 已下发 -->
      <el-tab-pane label="已拒绝" name="second">
        <dilTable v-bind.sync="option2">
        </dilTable>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  name: "inplantTMS",
  data() {
    return {
      input: "",
      Time: "",
      activeName: "first",
       option0: {
        // 表格请求数据的地址
        requestUrl: "/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=4"
      },
      option1: {
        // 表格请求数据的地址
        requestUrl: "/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=5"
      },
      option2: {
        // 表格请求数据的地址
        requestUrl: "/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=6"
      }
    };
  },
  methods: {
    closeOrder(orderId) {
      this.$confirm("是否关闭", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
           this.$axios
            .post(
              "/api/v1/oms/closeOmstruckOrde?orderId="+orderId
            )
            .then((res) => {
           if(res.data.code == '200')
              // if(res.data.code)
              this.$router.go(0);
            });
          this.$message({
            type: "success",
            message: "下发成功!",
          });
          // console.log(this.arr[0].text_prop);
         
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消关闭!",
          });
        });
    },
    onclick() {
       if(this.activeName == "first"){
        this.option1.requestUrl = "/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=5&con=" + this.input;
      }else if(this.activeName == "second"){
        this.option2.requestUrl = "/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=6&con=" + this.input;
      }else
      {
        this.option0.requestUrl="/api/v1/oms/getTransportDispatch?apiId=148&orderType=5&orderStatus=4&con="+this.input;
      }
    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
  },
};
</script>
<style lang='scss' scoped>
.homeworkPath {
   .top {
    padding: 1.25rem 1.875rem;
  }
}
</style>