<template>
  <div class="work-order-mark__wrapper">
    <vue-editor v-model="content" />
    <el-button class="fr" type="primary" size="mini" style="margin:10px 0px" @click="() => onMark()">保存</el-button>
  </div>
</template>

<script>
import { VueEditor } from 'vue2-editor'
import asyncRequest from '@/apis/service/sellOut/returnGoodWorkOrder'
export default {
  components: { VueEditor },
  props: ['sitem'],
  data: () => ({
    content: '',
    loading: false
  }),
  methods: {
    async onMark() {
      this.loading = true
      const { code, message } = await asyncRequest.setAfterChildRecord({ record: this.content, id: this.sitem.id })
      this.loading = false

      switch (code) {
        case 0:
          this.content = ''
          this.$emit('reload')
          break
        default:
          this.$message.warning(message)
          break
      }
    }
  }
}
</script>
