Newer
Older
CallCenterFront / src / views / caseManage / components / closureDialog.vue
liyaguang on 27 Jun 2023 2 KB fix(*): 代录事件动态计数
<!-- 快速结案弹窗 -->
<template>
  <el-dialog :visible.sync="showDialog" :close-on-click-modal="false" :close-on-press-escape="false" title="快速结案"
    width="600px" append-to-body @close="closeDialog">
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-row :gutter="20">
        <el-col :span="20">
          <el-form-item label="备注" prop="notes">
            <el-input :rows="5" v-model="form.notes" maxlength="100" show-word-limit size="small" type="textarea" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :loading="btnLoading" type="primary" size="small" @click="saveData">保存</el-button>
      <el-button size="small" @click="closeDialog">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { quicklyClosure } from '@/api/callCase'
export default {
  name: 'ClosureDialog',
  data() {
    return {
      showDialog: false,
      form: {
        notes: '',
        id: ''
      },
      rules: {
        notes: [
          { required: true, message: "备注不能为空", trigger: ["blur", "change"] }
        ]
      },
      btnLoading: false
    }
  },
  methods: {
    initDialog(row) {
      this.showDialog = true
      this.form.id = row.callid
      this.form.notes = ''
      // this.$refs.form.clearValidate('notes')
    },
    closeDialog() {
      this.showDialog = false
    },
    saveData() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.btnLoading = true
          const data = {
            callId: this.form.id,
            quickRemarks: this.form.notes
          }
          // 发送请求
          quicklyClosure(data).then(res => {
            if (res.code === 200) {
              this.btnLoading = false
              this.closeDialog()
              this.$message.success('结案成功')
              this.$emit('refresh')
              this.$store.commit('refreshCount/SET_REFRESH')
            }
          }).catch(() => {
            this.btnLoading = false
          })

        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss"></style>