Commit 9aa09c08 by 吴云建

添加客服添加标签

parent 62c3ccfa
Showing with 48 additions and 15 deletions
<template> <template>
<el-dialog <el-dialog
class="create-chat" class="create-chat"
title="创建会话" title="添加客服"
:visible="true" :visible="true"
@close="hide" @close="hide"
> >
<div class="search-bar"> <div class="search-bar">
<span class="search-title">用户搜索: </span> <div class="row input-row">
<el-input class="search-input" v-model="searchText"></el-input> <span class="search-title">用户搜索: </span>
<el-button <el-input class="search-input" v-model="searchText"></el-input>
style="margin-left: auto" <el-button
type="primary" style="margin-left: auto"
size="medium" type="primary"
@click="search" size="medium"
>筛选</el-button @click="search"
> >筛选</el-button
>
</div>
<div class="row">
<GeneralTagSelectForFilter
ref="generalTagSelect"
:tagGroups="tagGroups"
class="tag-group"
></GeneralTagSelectForFilter>
</div>
</div> </div>
<div class="users" v-loading="loading"> <div class="users" v-loading="loading">
<div <div
...@@ -50,18 +59,17 @@ ...@@ -50,18 +59,17 @@
<script lang="ts"> <script lang="ts">
import { ListEasy, ListTypes } from "uniplat-sdk"; import { ListEasy, ListTypes } from "uniplat-sdk";
import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import GeneralTagSelectForFilter from "@/components/statistic/GeneralTagSelectForFilter.vue"
import buttonThrottle from "../utils/button-throttle"; import buttonThrottle from "../utils/button-throttle";
import avatar from "@/customer-service/components/avatar.vue"; import avatar from "@/customer-service/components/avatar.vue";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { TagManagerTypes } from "uniplat-sdk"
import chat from "@/customer-service/xim/index"; import chat from "@/customer-service/xim/index";
type User = { type User = {
id: string; id: string;
name: string; name: string;
}; };
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T; type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
@Component({ components: { avatar } }) @Component({ components: { avatar, GeneralTagSelectForFilter } })
export default class ChatCreator extends Vue { export default class ChatCreator extends Vue {
@Prop({ @Prop({
type: Array, type: Array,
...@@ -74,6 +82,7 @@ export default class ChatCreator extends Vue { ...@@ -74,6 +82,7 @@ export default class ChatCreator extends Vue {
this.nextPage(); this.nextPage();
} }
private tagGroups: TagManagerTypes.TagGroup[] = []
private searchText = ""; private searchText = "";
private currentPage = 1; private currentPage = 1;
private total = 0; private total = 0;
...@@ -90,6 +99,15 @@ export default class ChatCreator extends Vue { ...@@ -90,6 +99,15 @@ export default class ChatCreator extends Vue {
await this.getUserList(); await this.getUserList();
} }
private getSelectedTags() {
if (this.$refs.generalTagSelect) {
return (
this.$refs.generalTagSelect as GeneralTagSelectForFilter
).getSelectedTags()
}
return []
}
private async getUserList(searchText: string | null = null) { private async getUserList(searchText: string | null = null) {
this.loading = true; this.loading = true;
const list = chat.getSdk().model("user").list(); const list = chat.getSdk().model("user").list();
...@@ -103,11 +121,13 @@ export default class ChatCreator extends Vue { ...@@ -103,11 +121,13 @@ export default class ChatCreator extends Vue {
const { pageData, getList } = await list.query({ const { pageData, getList } = await list.query({
pageIndex: this.currentPage, pageIndex: this.currentPage,
item_size: this.pageSize, item_size: this.pageSize,
tagFilters: this.getSelectedTags()
}); });
this.total = pageData.record_count; this.total = pageData.record_count;
this.getList = getList; this.getList = getList;
this.userList = this.exactUserList(pageData.rows); this.userList = this.exactUserList(pageData.rows);
this.loading = false; this.loading = false;
this.tagGroups = pageData.tagGroups || []
} }
private exactUserList(rows: any[]) { private exactUserList(rows: any[]) {
...@@ -178,6 +198,9 @@ export default class ChatCreator extends Vue { ...@@ -178,6 +198,9 @@ export default class ChatCreator extends Vue {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.text-right {
text-align: right;
}
.create-chat { .create-chat {
/deep/ .el-dialog__body { /deep/ .el-dialog__body {
padding: 30px 40px; padding: 30px 40px;
...@@ -208,12 +231,22 @@ export default class ChatCreator extends Vue { ...@@ -208,12 +231,22 @@ export default class ChatCreator extends Vue {
} }
} }
.search-bar { .search-bar {
display: flex;
align-items: center; align-items: center;
background: #f5f6fa; background: #f5f6fa;
padding: 12px 20px; padding: 12px 20px;
box-sizing: border-box; box-sizing: border-box;
margin-bottom: 30px; margin-bottom: 30px;
.row + .row {
margin-top: 5px;
}
.tag-group /deep/ .checkbox-group {
padding: 0;
margin-bottom: 0;
}
.input-row {
display: flex;
line-height: 40px;
}
} }
.search-input { .search-input {
width: 160px; width: 160px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment