<template>
  <!-- 辅料修改质检作业页面 -->
  <div id="contractDetails">
    <page-title>质检作业</page-title>

    <div class="main">
      <span class="text">修改质检作业</span>
      <span class="a"></span>
    </div>

    <div class="contractTitle">
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="187" v-model="form1"></dil-form>
        </div>
      </div>
    </div>

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

<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      // 表单
      form1: {},
      // 表格
      table1: {},
      contractId: "",
    };
  },
  mounted() {
    this.information();
  },
  methods: {
  information() {
      //编辑运输计划
      this.axios
        .post("/api/v1/tms/getQualityResultById/" + this.$route.params.resultId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form1 = e;
          });
        });
    },

    handleCheckedCitiesChange(value) {
      console.log(value);
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {
      let QR = {
        resultId: this.$route.params.resultId,
        resultIssampling: this.form1.resultIssampling,
        resultDeduction: this.form1.resultDeduction,
        resultSamplingPointId: this.form1.resultSamplingPointId,
        resultDeductionDescription: this.form1.resultDeductionDescription
      };
    
      var val = this.value;
      if (
        QR.resultIssampling==null||
        QR.resultDeduction==null||
        QR.resultSamplingPointId==null||
        QR.resultDeductionDescription==null
      ) this.$message.error("存在空值！");
      else
      this.axios
        .post("/api/v1/tms/updateQualityResult", QR)
        .then(() => {
          this.$message({
            type: "success",  
            message: "修改成功!",
          });
          this.$router.go(-1);
        });
    },
  },
};
</script>
<style lang="scss" scoped>
// @import "@/styles/appoint/contract/ContractInsert.scss";
</style>