<template>
  <!-- 修改供应商信息 -->
  <div id="contractDetails">
    <page-title>编辑</page-title>
    <div class="main">
      <span class="text">供应商信息</span>
    </div>
    <div class="contractTitle">
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="321" v-model="form1"></dil-form>
        </div>
      </div>
    </div>

    <div class="button-box">
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
      <el-button @click="onClickCancel">返回</el-button>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
//import { sjTime } from "@/js/sharedJsFile";
export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
    };
  },
 
  mounted() {
      console.log(this.$route)
    this.information();
  },
  methods: {
    information() {
      console.log("supplierId",this.$router.params);
      //编辑
      this.$axios
        .post(
          "/api/v1/rms/getSupplierById/" +
            this.$route.params.supplierId
        )
        .then((res) => {
            console.log(res)
          res.data.data.forEach((e) => {
            this.form1 = e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.supplierId);
          });
        });
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {
      console.log(this.form1)
       let RmsSupplier={
        supplierId: this.form1.supplierId,
        supplierName: this.form1.supplierName,
        supplierAddress: this.form1.supplierAddress,
        supplierRegisterDate: sjTime(this.form1.supplierRegisterDate),
        supplierContactsName: this.form1.supplierContactsName,
        supplierContactNumber: this.form1.supplierContactNumber
      };
        this.$axios
          .post(
            "/api/v1/rms/updateSupplier",
            RmsSupplier
          )
          .then((res) => {
            if (res.data.code == "200") {
              this.$router.go(-1);
            }
          });
    },
  },
};
</script>
<style lang="scss" scoped>

</style>