<template>
<!-- 实时库存 -->
  <div class="steel_real">
    <div class="form-box">
        <div class="form-one">
          <dil-form :formId="308" v-model="form1"></dil-form>
        </div>
      </div>
    
    <div class="button-box">
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
      <el-button @click="onClickCancel">返回</el-button>
    </div>
  </div>
</template>
<script>
export default {
 name:"steel_real",
data(){
   return {
     form1:{},
     option: {
      requestUrl: "/api/v1/wms/selectGridMaterialListByGridId?apiId=155&gridId="+this.$route.params.gridId,
      },
    };
  },
  mounted(){
    this.information();
  },
  methods:{
    information() {
      //渲染数据
      this.axios
        .post(
          "api/v1/wms/selectGridMaterialListByGridId?gridId=" +
            this.$route.params.gridId
        )
        .then((res) => {
            console.log(res.data.data)
          res.data.data.forEach((e) => {
            this.form1 = e;
          });
        });
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {
      let map = {
        gridId: this.$route.params.gridId,
        materialQualified: this.form1.materialQualified,
      };
      if (
        map.materialQualified == null
      )
        this.$message.error("必填项存在空值！");
      else
        this.axios
          .post(
            "/api/v1/wms/updateRmsMaterialSteelDemotion",
            map
          )
          .then((res) => {
              console.log("res.data",res.data)
            if (res.data.code == "200") {
              this.$router.go(-1);
            }
          });
    },
  },
};
</script>
<style lang="scss" scode>

.steel_real {
    padding: 1.25rem 1.875rem;
}
</style>