<template>
  <div class="withinLine">
    <el-button @click="abnormal" :disabled="disabled" type="primary" size="mini">设为异常</el-button>
  </div>
</template>

<script>
import buttonMixin from './button_mixin.js'
import { MessageBox } from '@zjlib/element-ui2'
import { orderBaseFlag } from "@/api/workOrderPool.js"
export default {
  mixins: [buttonMixin],
  methods: {
    abnormal() {
      this.lockBtn()
      MessageBox.confirm('是否确定将此单设置为异常单，请谨慎操作', '设为异常确认', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        orderBaseFlag({ flag: true, orderBaseId: this.orderInfo.id, orderFlagEnum: "YI_CHANGE" }).then(res => {
          this.unlockBtn()
          // 编辑保存后不跳转列表，刷新数据
          this.acquireVerify(this, 'getorderDetail')()
          // 刷新操作记录
          this.acquireVerify(this, 'getOrderBaseLogList')()
          this.$message({
            type: 'success',
            message: '设置成功！'
          })
        }).catch(() => {
          this.unlockBtn()
        })
      }).catch(() => {
        this.unlockBtn()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.withinLine {
  display: inline-block;

  ::v-deep .el-button {
    margin-left: 0;
    margin-right: 10px;
    margin-bottom: 10px;
  }
}
</style>
