dl_site_system/dl_vue/src/views/busi/chatMain/index.vue
2025-08-05 16:38:00 +08:00

284 lines
9.0 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="产品名称" prop="prodName">
<el-input
v-model="queryParams.prodName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="IP" prop="ip">
<el-input
v-model="queryParams.ip"
placeholder="请输入来源IP"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="国家" prop="national">
<el-input
v-model="queryParams.national"
placeholder="请输入国家"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="洲" prop="oceania">
<el-input
v-model="queryParams.oceania"
placeholder="请输入来洲"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="员工名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入员工名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['busi:chatMain:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['busi:chatMain:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['busi:chatMain:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['busi:chatMain:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="chatMainList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column type="index" width="60" label="序号" align="center"/>
<!-- <el-table-column label="客户唯一编码" align="center" prop="cusCode" />-->
<el-table-column align="center" prop="prodName" :min-width="120">
<template slot="header" slot-scope="scope">
<span>产品名称</span>
<el-tooltip class="item" effect="dark" content="鼠标单机数据可查看产品详情"
placement="bottom"
>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
<span @click="goProdDetail(scope.row.prodId)" style="color: #1890ff;cursor: pointer"
>{{ scope.row.prodName }}</span>
</template>
</el-table-column>
<el-table-column label="IP" align="center" prop="ip" />
<el-table-column label="国家" align="center" prop="national" />
<el-table-column label="洲" align="center" prop="oceania" />
<el-table-column label="设备类型" align="center" prop="equipment"/>
<el-table-column label="负责员工" align="center" prop="userName" />
<!-- <el-table-column align="center" prop="nums" >-->
<!-- <template slot="header" slot-scope="scope">-->
<!-- <span>聊天记录数</span>-->
<!-- <el-tooltip class="item" effect="dark" content="鼠标单机数据可查看聊天记录"-->
<!-- placement="bottom"-->
<!-- >-->
<!-- <i class="el-icon-question"></i>-->
<!-- </el-tooltip>-->
<!-- </template>-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag style="cursor: pointer" @click="handleDetail(scope.row)">{{scope.row.nums}}</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="最早聊天时间" width="180" align="center" prop="createTime" >
<template slot-scope="scope">
{{scope.row.createTime | formatDate}}
</template>
</el-table-column>
<el-table-column label="最近聊天时间" width="180" align="center" prop="updateTime" >
<template slot-scope="scope">
{{scope.row.updateTime | formatDate}}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-s-comment"
@click="handleDetail(scope.row)"
>聊天</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 聊天记录弹出框-->
<chat-form ref="chatFrom"></chat-form>
</div>
</template>
<script>
import chatForm from "@/views/busi/chatMain/chatForm";
import { listChatMain, getChatMain, delChatMain, addChatMain, updateChatMain } from "@/api/busi/chatMain";
import Treeselect from '@riophae/vue-treeselect'
import { EventBus } from '@/utils/eventBus';
export default {
name: "ChatMain",
components: { chatForm},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 在线聊天表格数据
chatMainList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
prodName: null,
ip: null,
national: null,
oceania: null,
cusCode: null,
userName: null,
tenantId: null,
},
};
},
filters:{
formatDate(val){
if(val){
return val.slice(0, 16)
}else{
return "-"
}
},
},
mounted(){
EventBus.$on('newMessage', (message) => {
this.$refs.chatFrom.openForm()
});
},
created() {
this.getList();
},
methods: {
/** 查询在线聊天列表 */
getList() {
this.loading = true;
listChatMain(this.queryParams).then(response => {
this.chatMainList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除在线聊天编号为"' + ids + '"的数据项?').then(function() {
return delChatMain(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('busi/chatMain/export', {
...this.queryParams
}, `chatMain_${new Date().getTime()}.xlsx`)
},
/**
* 查看产品详情
*/
goProdDetail(id) {
this.$router.push({ path: '/product/prodForm', query: { id: id } })
},
/**
* 查看聊天记录详情
* @param row
*/
handleDetail(row){
console.log(row,'sdfadsafadsf')
this.$refs.chatFrom.show(row)
}
}
};
</script>