Commit 8b7ccef5 by xinlaa

群发调试等

1 parent dfebd329
...@@ -51,11 +51,10 @@ pushType:群发类型 0 发给客户 1 发给客户群 ...@@ -51,11 +51,10 @@ pushType:群发类型 0 发给客户 1 发给客户群
beginTime:开始时间 beginTime:开始时间
endTime:结束时间} endTime:结束时间}
*/ */
export function getList(data) { export function getList(params) {
return request({ return request({
url: service + "/list", url: service + "/list",
method: "get", params
data
}); });
} }
......
<script> <script>
import * as api from '@/api/customer' import * as api from "@/api/customer";
import { getList as getListTag } from '@/api/customer/tag' import { getList as getListTag } from "@/api/customer/tag";
import { getList as getListOrganization } from '@/api/organization' import { getList as getListOrganization } from "@/api/organization";
import AddTag from '@/components/AddTag' import AddTag from "@/components/AddTag";
import SelectUser from '@/components/SelectUser' import SelectUser from "@/components/SelectUser";
import SelectTag from '@/components/SelectTag' import SelectTag from "@/components/SelectTag";
export default { export default {
name: 'Customer', name: "Customer",
components: { AddTag, SelectUser, SelectTag }, components: { AddTag, SelectUser, SelectTag },
props: {}, props: {},
data() { data() {
...@@ -15,11 +15,11 @@ export default { ...@@ -15,11 +15,11 @@ export default {
query: { query: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: '', // "客户名称", name: "", // "客户名称",
userIds: '', // "添加人id", userIds: "", // "添加人id",
tagIds: '', // "标签id,多个标签,id使用逗号隔开", tagIds: "", // "标签id,多个标签,id使用逗号隔开",
beginTime: '', // "开始时间", beginTime: "", // "开始时间",
endTime: '', // "结束时间" endTime: "" // "结束时间"
}, },
queryTag: [], // 搜索框选择的标签 queryTag: [], // 搜索框选择的标签
queryUser: [], // 搜索框选择的添加人 queryUser: [], // 搜索框选择的添加人
...@@ -27,45 +27,45 @@ export default { ...@@ -27,45 +27,45 @@ export default {
// 日期快捷选项 // 日期快捷选项
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() > Date.now() return time.getTime() > Date.now();
}, },
shortcuts: [ shortcuts: [
{ {
text: '最近一周', text: "最近一周",
onClick(picker) { onClick(picker) {
const end = new Date() const end = new Date();
const start = new Date() const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]) picker.$emit("pick", [start, end]);
}, }
}, },
{ {
text: '最近一个月', text: "最近一个月",
onClick(picker) { onClick(picker) {
const end = new Date() const end = new Date();
const start = new Date() const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]) picker.$emit("pick", [start, end]);
}, }
}, },
{ {
text: '最近三个月', text: "最近三个月",
onClick(picker) { onClick(picker) {
const end = new Date() const end = new Date();
const start = new Date() const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]) picker.$emit("pick", [start, end]);
}, }
}, }
], ]
}, },
loading: false, loading: false,
isMoreFilter: false, isMoreFilter: false,
total: 0, total: 0,
// 添加标签表单 // 添加标签表单
form: { form: {
gourpName: '', gourpName: "",
weTags: [], weTags: []
}, },
list: [], // 客户列表 list: [], // 客户列表
listOrganization: [], // 组织架构列表 listOrganization: [], // 组织架构列表
...@@ -73,181 +73,182 @@ export default { ...@@ -73,181 +73,182 @@ export default {
dialogVisible: false, // 选择标签弹窗显隐 dialogVisible: false, // 选择标签弹窗显隐
dialogVisibleSelectUser: false, // 选择添加人弹窗显隐 dialogVisibleSelectUser: false, // 选择添加人弹窗显隐
dialogVisibleAddTag: false, // 添加标签弹窗显隐 dialogVisibleAddTag: false, // 添加标签弹窗显隐
selectedGroup: '', // 选择的标签分组 selectedGroup: "", // 选择的标签分组
selectedTag: [], // 选择的标签 selectedTag: [], // 选择的标签
removeTag: [], // 可移除的标签 removeTag: [], // 可移除的标签
tagDialogType: { tagDialogType: {
title: '', // 选择标签弹窗标题 title: "", // 选择标签弹窗标题
type: '', // 弹窗类型 type: "" // 弹窗类型
},
} }
};
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() { created() {
this.getList() this.getList();
this.getListTag() this.getListTag();
this.getListOrganization() this.getListOrganization();
}, },
mounted() {}, mounted() {},
methods: { methods: {
getList(page) { getList(page) {
// console.log(this.dateRange); // console.log(this.dateRange);
if (this.dateRange[0]) { if (this.dateRange[0]) {
this.query.beginTime = this.dateRange[0] this.query.beginTime = this.dateRange[0];
this.query.endTime = this.dateRange[1] this.query.endTime = this.dateRange[1];
} else { } else {
this.query.beginTime = '' this.query.beginTime = "";
this.query.endTime = '' this.query.endTime = "";
} }
page && (this.query.pageNum = page) page && (this.query.pageNum = page);
this.loading = true this.loading = true;
api api
.getList(this.query) .getList(this.query)
.then(({ rows, total }) => { .then(({ rows, total }) => {
this.list = rows this.list = rows;
this.total = +total this.total = +total;
this.loading = false this.loading = false;
this.multipleSelection = [] this.multipleSelection = [];
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false;
}) });
}, },
getListTag() { getListTag() {
getListTag().then(({ rows }) => { getListTag().then(({ rows }) => {
this.listTagOneArray = [] this.listTagOneArray = [];
rows.forEach((element) => { rows.forEach(element => {
element.weTags.forEach((d) => { element.weTags.forEach(d => {
this.listTagOneArray.push(d) this.listTagOneArray.push(d);
}) });
}) });
}) });
}, },
getListOrganization() { getListOrganization() {
getListOrganization().then(({ rows }) => { getListOrganization().then(({ rows }) => {
this.listOrganization = Object.freeze(rows) this.listOrganization = Object.freeze(rows);
}) });
}, },
showTagDialog() { showTagDialog() {
this.selectedTag = this.queryTag this.selectedTag = this.queryTag;
this.tagDialogType = { this.tagDialogType = {
title: '选择标签', title: "选择标签",
type: 'query', type: "query"
} };
this.dialogVisible = true this.dialogVisible = true;
this.$refs.selectTag.$forceUpdate() this.$refs.selectTag.$forceUpdate();
}, },
makeTag(type) { makeTag(type) {
this.selectedTag = [] this.selectedTag = [];
if (!this.multipleSelection.length) { if (!this.multipleSelection.length) {
this.msgInfo('请选择一位客户') this.msgInfo("请选择一位客户");
return return;
} }
if (this.multipleSelection.length > 1) { if (this.multipleSelection.length > 1) {
this.msgInfo('同时只能选择一位客户') this.msgInfo("同时只能选择一位客户");
return return;
} }
let isError = false let isError = false;
this.multipleSelection.forEach((element) => { this.multipleSelection.forEach(element => {
element.weFlowerCustomerRels.forEach((child) => { element.weFlowerCustomerRels.forEach(child => {
child.weFlowerCustomerTagRels.forEach((grandchild) => { child.weFlowerCustomerTagRels.forEach(grandchild => {
let filter = this.listTagOneArray.find((d) => { let filter = this.listTagOneArray.find(d => {
return d.tagId === grandchild.tagId return d.tagId === grandchild.tagId;
}) });
// 如果没有匹配到,则说明该便签处于异常状态,可能已被删除或破坏 // 如果没有匹配到,则说明该便签处于异常状态,可能已被删除或破坏
if (!filter) { if (!filter) {
isError = true isError = true;
return return;
} }
this.selectedTag.push(filter) this.selectedTag.push(filter);
}) });
}) });
}) });
if (isError) { if (isError) {
this.msgError('已有标签不在便签库中,或存在异常') this.msgError("已有标签不在便签库中,或存在异常");
return return;
} }
this.tagDialogType = { this.tagDialogType = {
title: type === 'add' ? '增加标签' : '移出标签', title: type === "add" ? "增加标签" : "移出标签",
type: type, type: type
} };
this.removeTag = this.selectedTag.slice() this.removeTag = this.selectedTag.slice();
this.dialogVisible = true this.dialogVisible = true;
this.$refs.selectTag.$forceUpdate() this.$refs.selectTag.$forceUpdate();
}, },
sync() { sync() {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: "Loading",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0, 0, 0, 0.7)', background: "rgba(0, 0, 0, 0.7)"
}) });
api api
.sync() .sync()
.then(() => { .then(() => {
loading.close() loading.close();
this.msgSuccess('后台开始同步数据,请稍后关注进度') this.msgSuccess("后台开始同步数据,请稍后关注进度");
})
.catch((fail) => {
loading.close()
console.log(fail)
}) })
.catch(fail => {
loading.close();
console.log(fail);
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
exportCustomer() { exportCustomer() {
const queryParams = this.query const queryParams = this.query;
this.$confirm('是否确认导出所有客户数据项?', '警告', { this.$confirm("是否确认导出所有客户数据项?", "警告", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning', type: "warning"
}) })
.then(function() { .then(function() {
return api.exportCustomer(queryParams) return api.exportCustomer(queryParams);
}) })
.then((response) => { .then(response => {
this.download(response.msg) this.download(response.msg);
}) })
.catch(function() {}) .catch(function() {});
}, },
selectedUser(list) { selectedUser(list) {
this.queryUser = list this.queryUser = list;
this.query.userIds = list.map((d) => d.userId) + '' this.query.userIds = list.map(d => d.userId) + "";
}, },
submitSelectTag(selected) { submitSelectTag(selected) {
if (this.tagDialogType.type === 'query') { if (this.tagDialogType.type === "query") {
this.query.tagIds = selected.map((d) => d.tagId) + '' this.query.tagIds = selected.map(d => d.tagId) + "";
// debugger; // debugger;
this.queryTag = selected this.queryTag = selected;
this.dialogVisible = false this.dialogVisible = false;
} else { } else {
let data = { let data = {
externalUserid: this.multipleSelection[0].externalUserid, externalUserid: this.multipleSelection[0].externalUserid,
addTag: selected, addTag: selected
} };
let apiType = { let apiType = {
add: 'makeLabel', add: "makeLabel",
remove: 'removeLabel', remove: "removeLabel"
} };
api[apiType[this.tagDialogType.type]](data).then(() => { api[apiType[this.tagDialogType.type]](data).then(() => {
this.msgSuccess('操作成功') this.msgSuccess("操作成功");
this.dialogVisible = false this.dialogVisible = false;
this.getList() this.getList();
}) });
} }
}, },
resetForm(formName) { resetForm(formName) {
this.dateRange = [] this.dateRange = [];
this.queryTag = [] this.queryTag = [];
this.queryUser = [] this.queryUser = [];
this.$refs['queryForm'].resetFields() this.$refs["queryForm"].resetFields();
this.getList(1);
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.multipleSelection = selection this.multipleSelection = selection;
}, }
}, }
} };
</script> </script>
<template> <template>
...@@ -260,7 +261,7 @@ export default { ...@@ -260,7 +261,7 @@ export default {
class="top-search" class="top-search"
size="small" size="small"
> >
<el-form-item label="客户名称"> <el-form-item label="客户名称" prop="name">
<el-input v-model="query.name" placeholder="请输入"></el-input> <el-input v-model="query.name" placeholder="请输入"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="添加人"> <el-form-item label="添加人">
...@@ -380,12 +381,12 @@ export default { ...@@ -380,12 +381,12 @@ export default {
{{ scope.row.name }} {{ scope.row.name }}
<span <span
:style="{ color: scope.row.type === 1 ? '#4bde03' : '#f9a90b' }" :style="{ color: scope.row.type === 1 ? '#4bde03' : '#f9a90b' }"
>{{ { 1: '@微信', 2: '@企业微信' }[scope.row.type] }}</span >{{ { 1: "@微信", 2: "@企业微信" }[scope.row.type] }}</span
> >
<i <i
:class="[ :class="[
'el-icon-s-custom', 'el-icon-s-custom',
{ 1: 'man', 2: 'woman' }[scope.row.gender], { 1: 'man', 2: 'woman' }[scope.row.gender]
]" ]"
></i> ></i>
</template> </template>
...@@ -427,7 +428,7 @@ export default { ...@@ -427,7 +428,7 @@ export default {
@click=" @click="
$router.push({ $router.push({
path: '/customerManage/customerDetail', path: '/customerManage/customerDetail',
query: { id: scope.row.externalUserid }, query: { id: scope.row.externalUserid }
}) })
" "
type="text" type="text"
......
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = [] this.dateRange = []
this.resetForm('queryForm') this.$refs['queryForm'].resetFields()
this.getList(1) this.getList(1)
}, },
goRoute(path, id) { goRoute(path, id) {
...@@ -180,7 +180,7 @@ export default { ...@@ -180,7 +180,7 @@ export default {
label-width="100px" label-width="100px"
class="top-search" class="top-search"
> >
<el-form-item label="使用员工"> <el-form-item label="使用员工" prop="useUserName">
<el-input <el-input
v-model="query.useUserName" v-model="query.useUserName"
placeholder="请输入" placeholder="请输入"
...@@ -196,7 +196,7 @@ export default { ...@@ -196,7 +196,7 @@ export default {
@keyup.enter.native="getList(1)" @keyup.enter.native="getList(1)"
/> />
</el-form-item> --> </el-form-item> -->
<el-form-item label="手机号"> <el-form-item label="手机号" prop="mobile">
<el-input <el-input
v-model="query.mobile" v-model="query.mobile"
placeholder="请输入" placeholder="请输入"
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
@keyup.enter.native="getList(1)" @keyup.enter.native="getList(1)"
/> />
</el-form-item> </el-form-item>
<el-form-item label="活动场景"> <el-form-item label="活动场景" prop="activityScene">
<el-input <el-input
v-model="query.activityScene" v-model="query.activityScene"
placeholder="请输入" placeholder="请输入"
...@@ -212,7 +212,7 @@ export default { ...@@ -212,7 +212,7 @@ export default {
@keyup.enter.native="getList(1)" @keyup.enter.native="getList(1)"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建人"> <el-form-item label="创建人" prop="createBy">
<el-input <el-input
v-model="query.createBy" v-model="query.createBy"
placeholder="请输入" placeholder="请输入"
......
...@@ -109,8 +109,11 @@ export default { ...@@ -109,8 +109,11 @@ export default {
this.form.imageMessage._materialName = image.materialName this.form.imageMessage._materialName = image.materialName
}, },
submit() { submit() {
this.loading = true
let form = JSON.parse(JSON.stringify(this.form)) let form = JSON.parse(JSON.stringify(this.form))
Promise.resolve(() => { form.messageType = this.activeName
Promise.resolve()
.then(() => {
if (form.messageType == 1) { if (form.messageType == 1) {
// debugger // debugger
let dataMediaId = { let dataMediaId = {
...@@ -119,12 +122,13 @@ export default { ...@@ -119,12 +122,13 @@ export default {
name: form.imageMessage._materialName, name: form.imageMessage._materialName,
} }
return getMaterialMediaId(dataMediaId).then((res) => { return getMaterialMediaId(dataMediaId).then((res) => {
// debugger
form.imageMessage.media_id = res.data form.imageMessage.media_id = res.data
}) })
} }
}) })
.then(() => { .then(() => {
form.messageType = this.activeName // debugger
form.tag = form.tag.map((d) => d.tagId) + '' form.tag = form.tag.map((d) => d.tagId) + ''
form.department += '' form.department += ''
form.staffId += '' form.staffId += ''
......
<script> <script>
import TabContent from "./TabContent"; import { getDetail } from '@/api/groupMessage'
import TabContent from './TabContent'
export default { export default {
components: { components: {
TabContent TabContent,
}, },
props: {}, props: {},
data() { data() {
return { return {
activeName: "0", data: {},
activeName: '0',
total1: 0, total1: 0,
total0: 0 total0: 0,
}; }
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() {}, created() {
getDetail(this.$route.query.id).then(({ data }) => {
this.data = data
})
},
mounted() {}, mounted() {},
methods: { methods: {
notice() {} notice() {},
} },
}; }
</script> </script>
<template> <template>
<div> <div>
<div>
创建人:{{ data.sender }}
<div>消息内容:{{ data.content }}</div>
</div>
<!-- <el-button class="notice" type="primary" @click="notice" <!-- <el-button class="notice" type="primary" @click="notice"
>通知员工发送</el-button >通知员工发送</el-button
> --> > -->
......
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
this.resetForm("queryForm"); this.$refs["queryForm"].resetFields();
this.getList(1); this.getList(1);
}, },
// 多选框选中数据 // 多选框选中数据
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
class="top-search" class="top-search"
label-width="100px" label-width="100px"
> >
<el-form-item label="创建人"> <el-form-item label="创建人" prop="sender">
<el-input <el-input
v-model="query.sender" v-model="query.sender"
placeholder="请输入" placeholder="请输入"
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
@keyup.enter.native="getList(1)" @keyup.enter.native="getList(1)"
/> />
</el-form-item> </el-form-item>
<el-form-item label="内容消息"> <el-form-item label="内容消息" prop="content">
<el-input <el-input
v-model="query.content" v-model="query.content"
placeholder="请输入" placeholder="请输入"
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
@keyup.enter.native="getList(1)" @keyup.enter.native="getList(1)"
/> />
</el-form-item> </el-form-item>
<el-form-item label="群发类型"> <el-form-item label="群发类型" prop="pushType">
<el-select v-model="query.pushType" placeholder="请选择" size="small"> <el-select v-model="query.pushType" placeholder="请选择" size="small">
<el-option <el-option
v-for="(value, key, index) in pushType" v-for="(value, key, index) in pushType"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!