Commit 8b7ccef5 by xinlaa

群发调试等

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