Newer
Older
CallCenterFront / src / views / caseManage / caseManage.vue
zhangyingjie on 16 Apr 2020 7 KB 修改事件管理,完善督办功能
 <!-- 事件查询 -->
<template>
  <app-container>
    <case-search :list-query="listQuery" @search="search"/>
    <case-list-table :list-query="listQuery" :list="list" :total="total" :columns="columns" :list-loading="listLoading" @changePage="changePage">
      <template slot="operations">
        <el-table-column label="操作" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click.stop="goDetail(scope.row)">详情</el-button>
            <!-- <el-button type="text" size="small" @click.stop="">删除</el-button> -->
            <el-button v-if="couldSupervise(scope.row)" type="text" size="small" @click.stop="supervise(scope.row)">督办</el-button>
            <el-button v-if="couldUrge(scope.row)" type="text" size="small" @click.stop="urge(scope.row)">催办</el-button>
            <!-- <el-button v-if="scope.row.state<2" type="text" size="small" @click.stop="">作废</el-button> -->
          </template>
        </el-table-column>
      </template>
    </case-list-table>

    <el-dialog :visible.sync="urgeDialogVisible" :close-on-click-modal="false" title="催办" append-to-body @close="cancelUrge">
      <el-form ref="urgeForm" :model="urgeForm" :rules="urgeRules" label-width="auto">
        <el-form-item label="说明" prop="urgeContent">
          <el-input v-model="urgeForm.urgeContent" type="textarea"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelUrge">取消</el-button>
        <el-button type="primary" @click="submitUrge">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="superviseDialogVisible" :close-on-click-modal="false" title="督办" append-to-body @close="cancelSupervise">
      <el-form ref="superviseForm" :model="superviseForm" :rules="superviseRules" label-width="auto">
        <el-form-item label="说明" prop="urgeContent">
          <el-input v-model="superviseForm.urgeContent" type="textarea"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelSupervise">取消</el-button>
        <el-button type="primary" @click="submitSupervise">确定</el-button>
      </div>
    </el-dialog>
  </app-container>
</template>

<script>
import AppContainer from '@/components/layout/AppContainer'
import CaseSearch from './caseCommon/caseSearch'
import CaseListTable from './caseCommon/caseListTable'
import { searchList } from '@/api/callCase'
import { addUrge } from '@/api/caseUrge'
import { addSupervise } from '@/api/caseSupervise'

export default {
  name: 'CaseManage',
  components: { AppContainer, CaseSearch, CaseListTable },
  data() {
    return {
      list: [],
      total: 0,
      listLoading: true, // 列表加载动画
      listQuery: {
        caseId: '', // 事件编号
        title: '', // 事件标题
        description: '', // 事件内容
        reporterPhone: '', // 联系方式
        reporterName: '', // 联系人
        startTime: '', // 来电开始时间
        endTime: '', // 来电结束时间
        caseState: '', // 处理方式
        state: '', // 处理状态
        isDelay: '', // 事件状态
        source: '', // 事件来源
        caseLevel: '', // 紧急程度
        offset: 1,
        limit: 20,
        sort: 'createTime',
        order: 'desc'
      }, // 筛选条件
      columns: [
        {
          text: '事件标题',
          value: 'title',
          align: 'center'
        },
        {
          text: '联系人',
          value: 'reporterName',
          align: 'center'
        },
        {
          text: '联系方式',
          value: 'reporterPhone',
          align: 'center'
        },
        {
          text: '来电时间',
          value: 'callTime',
          width: 140,
          align: 'center'
        },
        {
          text: '创建时间',
          value: 'createTime',
          width: 140,
          align: 'center'
        },
        {
          text: '处理状态',
          value: 'stateName',
          align: 'center'
        },
        {
          text: '事件内容',
          value: 'description',
          align: 'center'
        },
        {
          text: '处理方式',
          value: 'caseStateName',
          align: 'center'
        }
      ], // 显示列
      urgeDialogVisible: false,
      urgeForm: {
        caseId: '',
        urgeContent: ''
      },
      urgeRules: {
        urgeContent: [{ required: true, message: '请填写催办说明', trigger: ['change', 'blur'] }]
      },
      superviseDialogVisible: false,
      superviseForm: {
        caseId: '',
        urgeContent: ''
      },
      superviseRules: {
        urgeContent: [{ required: true, message: '请填写督办说明', trigger: ['change', 'blur'] }]
      }
    }
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    search(listQuery) {
      console.log('search')
      this.listQuery.offset = 1
      this.fetchData()
    },
    changePage(listQuery) {
      console.log('changePage')
      this.fetchData()
    },
    fetchData() {
      this.listLoading = true
      searchList(this.listQuery).then(response => {
        this.list = response.data.rows
        this.total = response.data.total
        this.listLoading = false
      })
    },
    // 催办权限
    couldUrge(row) {
      if (row.state < 2 && this.hasPerm('/urgeCase') && row.createUser === this.$store.getters.id) {
        return true
      }
      return false
    },
    // 督办权限
    couldSupervise(row) {
      if (row.state === 1 && this.hasPerm('/applySupervise')) {
        return true
      }
      return false
    },
    // 详情
    goDetail(row) {
      this.$router.push({
        path: '/caseDetail/' + row.id,
        query: {
          showProcess: false
        }
      })
    },
    urge(row) {
      this.urgeForm.caseId = row.id
      this.urgeDialogVisible = true
    },
    cancelUrge() {
      this.urgeDialogVisible = false
      this.resetUrgeForm()
    },
    submitUrge() {
      this.$refs['urgeForm'].validate((valid) => {
        if (valid) {
          addUrge(this.urgeForm).then(res => {
            this.$message.success('催办成功')
            this.cancelUrge()
          }).catch((res) => {
            this.cancelUrge()
          })
        }
      })
    },
    resetUrgeForm() {
      this.$refs['urgeForm'].resetFields()
      this.urgeForm = {
        caseId: '',
        urgeContent: ''
      }
    },
    supervise(row) {
      this.superviseForm.caseId = row.id
      this.superviseDialogVisible = true
    },
    cancelSupervise() {
      this.superviseDialogVisible = false
      this.resetSuperviseForm()
    },
    submitSupervise() {
      this.$refs['superviseForm'].validate((valid) => {
        if (valid) {
          addSupervise(this.superviseForm).then(res => {
            this.$message.success('督办成功')
            this.cancelSupervise()
          }).catch((res) => {
            this.cancelSupervise()
          })
        }
      })
    },
    resetSuperviseForm() {
      this.$refs['superviseForm'].resetFields()
      this.superviseForm = {
        caseId: '',
        urgeContent: ''
      }
    }
  }
}
</script>