<!--中止原因-->
<template>
  <dialog-edit :visible.sync="dialogVisible" :width="'500px'"
               :editModel="editModel" :form="form" :title="$t('documentSealingTaskManage.terminationCauses')"
               :autoSave="false" @onSaved="save" :loading="saveLoading" :saveLabel="$t('documentSealingTaskManage.saveBtn')"
               :api="api" :footerBtnShow="true" :appendToBody="true">
    <el-form :model="form" ref="stopForm">
      <el-form-item prop="cause" :rules="{required: true, message: '请输入终止原因！', trigger: 'blur'}">
        <el-input type="textarea" :autosize="{ minRows: 3, maxRows: 5}" :maxlength="60"
                  :placeholder="$t('documentSealingTaskManage.pleaseterminationCauses')"
                  v-model="form.cause"></el-input>
      </el-form-item>
    </el-form>
<!--    <template slot="footer">-->
<!--      <auth-button size="medium" type="primary" :label="$t('documentSealingTaskManage.saveBtn')" @click="save"></auth-button>-->
<!--      <auth-button size="medium" :label="$t('common.close')" @click="dialogVisible = false" :openPerms="false"></auth-button>-->
<!--    </template>-->
  </dialog-edit>
</template>

<script>
import BasePage from '@/pages/baseEditPage'
import { DialogEdit, authButton } from 'newepoch-components'
import customizejobApi from '@/api/shourangAssetassignee/customizejobApi'
export default {
  extends: new BasePage(),
  name: 'documentSealingTaskManageTermination',
  components: {
    DialogEdit,
    authButton
  },
  data () {
    return {
      saveLoading: false,
      cause: ''
    }
  },
  computed: {
    api () {
      return customizejobApi.participateApi
    }
  },
  methods: {
    save () {
      let _this = this
      _this.$refs.stopForm.validate((valid) => {
        if (valid) {
          let formData = Object.create(null)
          formData = this.form
          formData.stampStatus = '5'
          this.saveLoading = true
          _this.api.putData(formData).then(res => {
            if (res.data) {
              this.success('终止成功！')
              this.$emit('back')
              this.dialogVisible = false
            } else {
              this.error('终止成功！')
            }
          }).finally(() => {
            this.saveLoading = false
          })
        }
      })
    }
  }
}
</script>

<style scoped>
</style>
