//资源管理运力
<template>
  <div class="steel_inbound">
    <div class="sache">
      <el-input
        placeholder="请输入内容"
        v-model="textInput"
        clearable>
      </el-input>
      <el-button type="primary" class="btn" @click="onclick">
        <i class="el-icon-search"></i>查询
      </el-button>
       <el-button type="primary" class="btn" @click="toInsert">
        <i class="el-icon-plus"></i>新增
      </el-button>
    </div>
    <div class="table">
      <dilTable v-bind.sync="options">
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="updateCapacity(scope.row.capacityId)"
            >
              修改
            </el-button>
          </template>
        </el-table-column>
      </dilTable>
    </div>
  </div>
</template>
<script>
import { getCookie } from "@/utils/util.js";
export default {
  data(){
    return{
     name:"homeworkPath",
     textInput:"",
     restaurants: [],
     ssoId:null,
     options:{
        // first请求数据的地址
        requestUrl: "",
      },
    }
  },
  created(){
    if(getCookie("orgCode") == "chengyunshang"){
      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId");
    }else{
      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + this.ssoId;
    }
  },
  methods:{
    onclick(){
      if(getCookie("orgCode") == "chengyunshang"){
      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") +"&con=" +this.textInput + "&i=" + new Date();
    }else{
      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null +"&con=" +this.textInput + "&i=" + new Date();
    }
    },
     toInsert() {
      this.$router.push("/addCapacity");
    },
    updateCapacity(capacityId){
      this.$router.push("/editCapacity/" + capacityId)
    },
    deleteCapacity(scope){
      this.$confirm("是否删除", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
          this.axios
            .post("/api/v1/rms/deleteCapacity/" + scope.row.capacityId)
            .then((res) => {
              if (res.data.code == 200) {
                this.$message({
                  type: "success",
                  message: "删除成功!",
                });     
                this.$router.go(0);
              } else {
                this.$message({
                  message: "删除失败",
                  type: "warning",
                });
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "删除操作已取消!",
          });
        });
    },
    },
  }

</script>
<style lang="scss" scode>
.steel_inbound{
  .sache{
    padding: 1.25rem 0.375rem;
    .el-input {
      width: 20%;
      margin-right: 1.25rem;
    }
  }
  }
</style>
