<template>
  <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="120px">
    <el-form-item prop="description" :label="$t('code.description')">
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="dataForm.description">
      </el-input>
    </el-form-item>
  </el-form>
</template>

<script>
import basicAdd from "@/mixins/basic-add";
export default {
  mixins: [basicAdd],
  data() {
    return {
      urlOptions: {
        submitURL: "/code/startEightDisciplineSummaryExperience",
      },
      visible: false,
      dataForm: {
        description: "",
        startEightDisciplineId: "",
      },
    };
  },
  computed: {
    dataRule() {
      return {
        description: [{ required: true, message: this.$t("validate.required"), trigger: "blur" }],
      };
    },
  },
  methods: {
    init(id) {
      this.dataForm.startEightDisciplineId = id;
      this.visible = true;
      this.$nextTick(() => {
        this.$refs["dataForm"].resetFields();
      });
    },
    // 表单提交
    dataFormSubmit() {
      this.$refs["dataForm"].validate((valid) => {
        if (!valid) {
          return false;
        }
        let putData = {
          eightDisciplineStatus: 9,
          id: this.dataForm.startEightDisciplineId,
        };
        this.$http.put("/code/startEightDiscipline", putData).then(({ data }) => {
          if (data && data.code === 0) {
          } else {
            this.$message.error(data.msg);
          }
        });
        this.$http
          .post(this.urlOptions.submitURL, this.dataForm)
          .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: () => {
                this.visible = false;
                this.$emit("refreshDataList");
              },
            });
          })
          .catch(() => {});
      });
    },
  },
};
</script>

<style lang="scss">
.mod-sys__menu {
  .menu-list,
  .icon-list {
    .el-input__inner,
    .el-input__suffix {
      cursor: pointer;
    }
  }
  &-icon-popover {
    width: 458px;
    overflow: hidden;
  }
  &-icon-inner {
    width: 478px;
    max-height: 258px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  &-icon-list {
    width: 458px;
    padding: 0;
    margin: -8px 0 0 -8px;
    > .el-button {
      padding: 8px;
      margin: 8px 0 0 8px;
      > span {
        display: inline-block;
        vertical-align: middle;
        width: 18px;
        height: 18px;
        font-size: 18px;
      }
    }
  }
}
</style>