//计皮
<template>
  <!-- 零星物资计皮作业页面 -->
  <div class="homeworkPath">
    <div class="top">
      <span class="text">装车结束时间：</span>
      <el-date-picker
        v-model="startTime"
        type="datetime"
        placeholder="选择日期"
        style="width:200px"
      >
      </el-date-picker>
      <span class="text">至</span>
      <el-date-picker
        v-model="endTime"
        type="datetime"
        placeholder="选择日期"
        style="width:200px"
      >
      </el-date-picker>
      <el-input
        placeholder="请输入内容"
        v-model="input"
        clearable
        style="width:200px"
      >
      </el-input>
      <el-button type="primary" class="btn" @click="onclick">
        <i class="el-icon-search"></i>
      </el-button>
    </div>
    <div class="table"><dilTable v-bind.sync="option"> </dilTable></div>
  </div>
</template>

<script>
import { getCookie } from "@/utils/util.js";
import { sjTime } from "@/utils/sharedJsFile";
export default {
  name: "homeworkPath",
  data() {
    return {
      input: "",
      option: {
        // 表格请求数据的地址
        requestUrl: ""
      }
    };
  },
  created() {
    if (
      getCookie("orgCode") == "dagangadmin" ||
      getCookie("orgCode") == "zidonghuabu"
    ) {
      this.option.requestUrl =
        "/api/v1/tms/getAllJiMaoResult?apiId=358&orderType=11";
    } else {
      this.option.requestUrl =
        "/api/v1/tms/getAllJiMaoResult?apiId=358&orderType=11&userId=" +
        getCookie("orgCode");
    }
  },
  methods: {
    onclick() {
      let orgCode = null;
      let startTime = null;
      let endTime = null;
      if (this.startTime && this.endTime) {
        startTime = sjTime(this.startTime);
        endTime = sjTime(this.endTime);
      }
      if (
        getCookie("orgCode") != "dagangadmin" &&
        getCookie("orgCode") != "zidonghuabu" &&
        getCookie("orgCode") != "wuliuchuyunzhongxin"
      ) {
        orgCode = getCookie("orgCode");
      }
      this.option.requestUrl =
        "/api/v1/tms/getAllJiMaoResult?apiId=358&orderType=11&userId=" +
        orgCode +
        "&startTime=" +
        startTime +
        "&endTime=" +
        endTime +
        "&con=" +
        this.input +
        "&i=" +
        new Date();
    }
  }
};
</script>
<style lang="scss" scoped>
.homeworkPath {
  .top {
    margin-left: 20px;
    margin-top: 20px;
  }
  .table {
    margin-left: 20px;
    margin-top: 20px;
  }
}
</style>
