let moudule = {};

moudule = {
  props: {
    wfSendTaskId: String,
    wfInfo: Object,
    current_prefix:String
  },
  inject:['getEditVueTarget'],
  data() {
    return {
      formData: {
        opinion: ''
      },
      showDialog: false
    }
  },
  methods: {
    openDialog() {
      this.showDialog = true
    },
    confirmDialog(){
      this.$refs.form.$baseValidate((valid) => {
        if (valid) {
          let that = this.getEditVueTarget();
          let taskId = this.wfSendTaskId;
          let formData = {
            opinion: this.formData.opinion,
            taskId: taskId
          }
          return that.$http({
            url: this.current_prefix + "/wf/addOpinion",
            method: `post`,
            data: formData,
            isLoading: true,
            modalStrictly: true,
            success: (res) => {
              that.$message({
                message: res.content,
                type: "success",
                duration: 1000,
              });
              this.showDialog = false;
              this.$emit('confirm')
            },
          });
        }
      })
    }
  }
};

export default moudule;
