Newer
Older
urbanLifeline_YanAn / src / views / RongyunCommunication / rcloudUnitHistroyTalk.vue
@zhangqy zhangqy on 3 Oct 9 KB first commit
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="发起用户" prop="promoterThridUserId">
        <el-input v-model="queryParams.promoterThridUserId" placeholder="请输入发起用户" clearable @keyup.enter="handleQuery" />
      </el-form-item>

      <el-form-item label="时间区间" prop="time">
        <el-date-picker
          v-model="time"
          type="daterange"
          range-separator="~"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
          format="YYYY-MM-DD"
          value-format="YYYY-MM-DD"
          style="width: 100%"
        />
      </el-form-item>

      <el-form-item label="接听时间" prop="answerTime" v-show="false">
        <el-date-picker
          clearable
          v-model="queryParams.answerTime"
          type="date"
          value-format="YYYY-MM-DD"
          placeholder="请选择接听时间"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="rcloudUnitHistroyTalkList" @selection-change="handleSelectionChange" height="70vh">
      <el-table-column type="expand">
        <template #default="props">
          <HistroyTalkdetail v-if="props" :detail="props.row"></HistroyTalkdetail>
        </template>
      </el-table-column>
      <el-table-column prop="promoterName" label="发起方名称" align="center"> </el-table-column>
      <el-table-column label="发起方号码" align="center" prop="promoterPhone" />
      <el-table-column label="发起方平台" align="center" prop="promoterPlatform">
        <template #default="scope">
          <el-icon color="#79bbff" v-show="scope.row.promoterPlatform == 'web'"><Monitor /></el-icon>
          <el-icon color="#79bbff" v-show="scope.row.promoterPlatform == 'app'"><Iphone /></el-icon>
        </template>
      </el-table-column>
      <el-table-column label="发起日期" align="center" prop="startTime"> </el-table-column>

      <el-table-column label="通话类型" align="center" prop="type">
        <template #default="scope">
          {{ scope.row.type == 1 ? '音频' : '视频' }}
        </template>
      </el-table-column>

      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            link
            type="primary"
            icon="View"
            @click="handleDetail(scope.row)"
            v-hasPermi="['rcloud:rcloudUnitHistroyTalk:view']"
            >详情</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改融合通讯历史通话记录对话框 -->
    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
      <el-form ref="rcloudUnitHistroyTalkRef" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="开始时间" prop="startTime">
          <el-date-picker clearable v-model="form.startTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" prop="endTime">
          <el-date-picker clearable v-model="form.endTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="呼叫类型" prop="groupId">
          <el-input v-model="form.groupId" placeholder="请输入呼叫类型" />
        </el-form-item>
        <el-form-item label="接听时间" prop="answerTime">
          <el-date-picker clearable v-model="form.answerTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择接听时间">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- <el-dialog
      title="融合通讯历史通话记录详情"
      v-model="detailOpen"
      width="1400px"
      append-to-body
      class="dialog-detail-box"
      :close-on-click-modal="false"
    >
      <HistroyTalkdetail v-if="detailOpen" :detail="dialogFormDetail"></HistroyTalkdetail>
    </el-dialog> -->
  </div>
</template>

<script setup name="RcloudUnitHistroyTalk">
import {
  pagercloudUnitHistroyTalkgroupPage,
  getrcloudUnitHistroyTalk,
  delrcloudUnitHistroyTalk,
  addrcloudUnitHistroyTalk,
  updatercloudUnitHistroyTalk,
} from '@/views/RongyunCommunication/rongyunjs/rcloudUnitHistroyTalk';

import HistroyTalkdetail from '@/views/RongyunCommunication/HistroyTalkdetail.vue';
import { nextTick } from 'vue';

const { proxy } = getCurrentInstance();

const rcloudUnitHistroyTalkList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref('');
const detailOpen = ref(false);

const nameList = ref([
  { label: '未响铃', value: 1 },
  { label: '响铃未接听', value: 2 },
  { label: '响铃后挂断', value: 3 },
  { label: '已接听', value: 4 },
]);

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    promoterThridUserId: null,
    answerThridUserId: null,
    type: null,
    answerType: null,
    answerTime: null,
    status: null,
    talkTimeBegin: '',
    talkTimeEnd: '',
  },
  rules: {},
  dialogFormDetail: {}, //详情弹框数据
});

const time = ref([
  proxy.moment(new Date()).subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'),
  proxy.moment().format('YYYY-MM-DD  HH:mm:ss'),
]);

const { queryParams, form, rules, dialogFormDetail } = toRefs(data);

/** 查询融合通讯历史通话记录列表 */
function getList() {
  loading.value = true;

  if (time.value && time.value.length) {
    queryParams.value.talkTimeBegin = time.value[0];
    queryParams.value.talkTimeEnd = time.value[1];
  } else {
    queryParams.value.talkTimeBegin = '';
    queryParams.value.talkTimeEnd = '';
  }

  pagercloudUnitHistroyTalkgroupPage(queryParams.value).then(response => {
    console.log('response', response);
    rcloudUnitHistroyTalkList.value = response.data;
    total.value = response.total;
    loading.value = false;
  });
}

// 取消按钮
function cancel() {
  open.value = false;
  detailOpen.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    id: null,
    registerThridUserId: null,
    startTime: null,
    endTime: null,
    type: null,
    groupId: null,
    answerType: null,
    answerTime: null,
    remark: null,
    status: null,
    delFlag: null,
    createBy: null,
    createTime: null,
    updateBy: null,
    updateTime: null,
  };
  proxy.resetForm('rcloudUnitHistroyTalkRef');
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef');
  time.value = [
    proxy.moment(new Date()).subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'),
    proxy.moment().format('YYYY-MM-DD  HH:mm:ss'),
  ];
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  title.value = '添加融合通讯历史通话记录';
}

/** 修改按钮操作 */
function handleUpdate(row) {
  reset();
  const _id = row.id || ids.value;
  getrcloudUnitHistroyTalk(_id).then(response => {
    form.value = response.data;
    open.value = true;
    title.value = '修改融合通讯历史通话记录';
  });
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs['rcloudUnitHistroyTalkRef'].validate(valid => {
    if (valid) {
      if (form.value.id != null) {
        updatercloudUnitHistroyTalk(form.value).then(response => {
          proxy.$modal.msgSuccess('修改成功');
          open.value = false;
          getList();
        });
      } else {
        addrcloudUnitHistroyTalk(form.value).then(response => {
          proxy.$modal.msgSuccess('新增成功');
          open.value = false;
          getList();
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const _ids = row.id || ids.value;
  proxy.$modal
    .confirm('是否确认删除融合通讯历史通话记录编号为"' + _ids + '"的数据项?')
    .then(function () {
      return delrcloudUnitHistroyTalk(_ids);
    })
    .then(() => {
      getList();
      proxy.$modal.msgSuccess('删除成功');
    })
    .catch(() => {});
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download(
    'rcloud/rcloudUnitHistroyTalk/export',
    {
      ...queryParams.value,
    },
    `rcloudUnitHistroyTalk_${new Date().getTime()}.xlsx`
  );
}
//查看详情操作
function handleDetail(row) {
  dialogFormDetail.value = row;
  nextTick(() => {
    detailOpen.value = true;
  });
}
getList();
</script>