<!--
 * @Author: zhp
 * @Date: 2023-01-31 14:12:10
 * @LastEditTime: 2023-07-11 14:40:39
 * @LastEditors: zhp
 * @Description: 
-->
<template>
  <span>
    <el-switch @change="changeStatus" v-model="injectData.ment" :active-value="1"
      :inactive-value="0">
    </el-switch>
  </span>
</template>

<script>
// import { addDynamicRoute } from '@/router'
export default {
  props: {
    injectData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      urlOptions: {
        submitURL: "/supplier/qmsSupplier"
      }
    }
  },
  methods: {
    // 子级
    changeStatus () {
      // 路由参数
     let obj= {
       ment: this.injectData.ment,
        id:this.injectData.id
      }
      this.$http.put(this.urlOptions.submitURL, obj)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.$message({
            message: this.$t("prompt.success"),
            type: "success",
            duration: 500,
            onClose: () => {
              console.log(1111)
              console.log(this.$parent.$parent.$parent.$parent.$parent) 
              this.$parent.$parent.$parent.$parent.$parent.$parent.getDataList()
            },
          });
        })
    }
  },
};
</script>
