Commit b3ec9e46 by xinlaa

组织架构,客户修改调试

1 parent 00dc4418
...@@ -34,17 +34,11 @@ export function sync() { ...@@ -34,17 +34,11 @@ export function sync() {
* 编辑客户标签 * 编辑客户标签
* @param {*} data * @param {*} data
* { * {
"userid": "添加此客户添加人的id",
"externalUserid": "外部联系人userid", "externalUserid": "外部联系人userid",
"addTag": [{ "addTag": [{
"id": "标签id", "id": "标签id",
"groupId": "标签组id", "groupId": "标签组id",
"name": "标签名" "name": "标签名"
}],
"removeTag": [{
"id": "标签id",
"groupId": "标签组id",
"name": "标签名"
}] }]
} }
*/ */
...@@ -55,3 +49,23 @@ export function makeLabel(data) { ...@@ -55,3 +49,23 @@ export function makeLabel(data) {
data data
}) })
} }
/**
* 移除客户标签
* @param {*} data
* {
"externalUserid": "外部联系人userid",
"addTag": [{
"id": "标签id",
"groupId": "标签组id",
"name": "标签名"
}]
}
*/
export function removeLabel(data) {
return request({
url: service + '/removeLabel',
method: 'DELETE',
data
})
}
...@@ -146,6 +146,17 @@ export function startOrStop(data) { ...@@ -146,6 +146,17 @@ export function startOrStop(data) {
} }
/** /**
* 用户删除接口
* @param {*} userId
*/
export function remove(userId) {
return request({
url: serviceUser + '/' + userId,
method: 'DELETE',
})
}
/**
* 同步成员 * 同步成员
*/ */
export function syncUser() { export function syncUser() {
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.$store.dispatch("LogOut").then(() => { this.$store.dispatch("LogOut").then(() => {
location.href = "/index"; location.href = "/";
}); });
}); });
}, },
......
...@@ -16,10 +16,22 @@ export default { ...@@ -16,10 +16,22 @@ export default {
dateRange: [], dateRange: [],
treeData: [], treeData: [],
userList: [], userList: [],
status: {
0: "启用",
1: "禁用",
6: "离职",
},
statusActivate: {
1: "已激活",
2: "已禁用",
4: "未激活",
5: "退出企业",
6: "删除",
},
total: 0, total: 0,
defaultProps: { defaultProps: {
label: "name", label: "name",
children: "children", childr启用en: "children",
}, },
form: {}, form: {},
dialogVisible: false, dialogVisible: false,
...@@ -141,7 +153,7 @@ export default { ...@@ -141,7 +153,7 @@ export default {
let form = JSON.parse(JSON.stringify(this.form)); let form = JSON.parse(JSON.stringify(this.form));
form.department += ""; form.department += "";
form.isLeaderInDept += ""; form.isLeaderInDept += "";
api[form.id ? "updateUser" : "addUser"](form) api[form.userId ? "updateUser" : "addUser"](form)
.then(() => { .then(() => {
this.msgSuccess("操作成功"); this.msgSuccess("操作成功");
this.dialogVisible = false; this.dialogVisible = false;
...@@ -154,15 +166,30 @@ export default { ...@@ -154,15 +166,30 @@ export default {
}); });
}, },
startOrStop(data) { startOrStop(data) {
// 0: 启用,1:禁用
let params = { let params = {
id: data.id, userId: data.userId,
enable: data.enable == 1 ? false : true, enable: data.enable == 1 ? 0 : 1,
}; };
api.startOrStop(params).then(() => { api.startOrStop(params).then(() => {
this.msgSuccess("操作成功"); this.msgSuccess("操作成功");
this.getList(); this.getList();
}); });
}, },
/** 删除按钮操作 */
remove(id) {
// const operIds = id || this.ids + "";
this.$confirm("是否确认删除吗?", "警告", {
type: "warning",
})
.then(function () {
return api.remove(id);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
});
},
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
...@@ -318,7 +345,7 @@ export default { ...@@ -318,7 +345,7 @@ export default {
</template>--> </template>-->
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="isActivate"> <el-table-column label="状态" align="center" prop="isActivate">
<template slot-scope="scope">{{scope.row.isActivate == 1 ? '已激活' : '未激活'}}</template> <template slot-scope="scope">{{statusActivate[scope.row.isActivate]}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
...@@ -329,26 +356,27 @@ export default { ...@@ -329,26 +356,27 @@ export default {
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-hasPermi="['contacts:organization:view']" v-hasPermi="['contacts:organization:view']"
size="mini"
type="text" type="text"
icon="el-icon-view"
@click="edit(scope.row, 0)" @click="edit(scope.row, 0)"
>查看</el-button> >查看</el-button>
<el-button <el-button
v-hasPermi="['contacts:organization:forbidden']" v-hasPermi="['contacts:organization:forbidden']"
v-if="scope.row.userId !== 1" v-if="scope.row.userId !== 1 && scope.row.enable < 2"
size="mini"
type="text" type="text"
icon="el-icon-close-notification"
@click="startOrStop(scope.row)" @click="startOrStop(scope.row)"
>{{scope.row.enable == 1 ? '禁用' : '启用'}}</el-button> >{{status[scope.row.enable]}}</el-button>
<el-button <el-button
v-if="scope.row.enable < 2"
v-hasPermi="['contacts:organization:edit']" v-hasPermi="['contacts:organization:edit']"
size="mini"
type="text" type="text"
icon="el-icon-edit"
@click="edit(scope.row, 1)" @click="edit(scope.row, 1)"
>编辑</el-button> >编辑</el-button>
<el-button
v-if="scope.row.enable < 2"
v-hasPermi="['customerManage:tag:remove']"
@click="remove(scope.row.userId)"
type="text"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -75,6 +75,7 @@ export default { ...@@ -75,6 +75,7 @@ export default {
dialogVisibleAddTag: false, // 添加标签弹窗显隐 dialogVisibleAddTag: false, // 添加标签弹窗显隐
selectedGroup: "", // 选择的标签分组 selectedGroup: "", // 选择的标签分组
selectedTag: [], // 选择的标签 selectedTag: [], // 选择的标签
removeTag: [], // 可移除的标签
tagDialogType: { tagDialogType: {
title: "", // 选择标签弹窗标题 title: "", // 选择标签弹窗标题
type: "", // 弹窗类型 type: "", // 弹窗类型
...@@ -113,6 +114,12 @@ export default { ...@@ -113,6 +114,12 @@ export default {
getListTag() { getListTag() {
getListTag().then(({ rows }) => { getListTag().then(({ rows }) => {
this.listTag = Object.freeze(rows); this.listTag = Object.freeze(rows);
this.listTagOneArray = [];
this.listTag.forEach((element) => {
element.weTags.forEach((d) => {
this.listTagOneArray.push(d);
});
});
}); });
}, },
getListOrganization() { getListOrganization() {
...@@ -128,7 +135,7 @@ export default { ...@@ -128,7 +135,7 @@ export default {
}; };
this.dialogVisible = true; this.dialogVisible = true;
}, },
makeTag() { makeTag(type) {
this.selectedTag = []; this.selectedTag = [];
if (!this.multipleSelection.length) { if (!this.multipleSelection.length) {
this.msgInfo("请选择一位客户"); this.msgInfo("请选择一位客户");
...@@ -139,21 +146,21 @@ export default { ...@@ -139,21 +146,21 @@ export default {
return; return;
} }
this.tagDialogType = { this.tagDialogType = {
title: "为客户增加标签", title: type === "add" ? "增加标签" : "移出标签",
type: "customer", type: type,
}; };
this.multipleSelection.forEach((element) => { this.multipleSelection.forEach((element) => {
// debugger; // debugger;
element.weFlowerCustomerRels.forEach((child) => { element.weFlowerCustomerRels.forEach((child) => {
child.weFlowerCustomerTagRels.forEach((grandchild) => { child.weFlowerCustomerTagRels.forEach((grandchild) => {
this.selectedTag.push({ let filter = this.listTagOneArray.find((d) => {
id: grandchild.tagId, return d.tagId === grandchild.tagId;
name: grandchild.tagName,
}); });
this.selectedTag.push(filter);
}); });
}); });
}); });
this.removeTag = this.selectedTag.slice();
this.dialogVisible = true; this.dialogVisible = true;
}, },
sync() { sync() {
...@@ -174,18 +181,23 @@ export default { ...@@ -174,18 +181,23 @@ export default {
}, },
submitSelectTag(formName) { submitSelectTag(formName) {
if (this.tagDialogType.type === "query") { if (this.tagDialogType.type === "query") {
this.query.tagIds = this.selectedTag.map((d) => d.id) + ""; this.query.tagIds = this.selectedTag.map((d) => d.tagId) + "";
// debugger; // debugger;
this.queryTag = this.selectedTag; this.queryTag = this.selectedTag;
this.dialogVisible = false; this.dialogVisible = false;
} else if (this.tagDialogType.type === "customer") { } else {
let data = { let data = {
userid: this.multipleSelection[0].externalUserid,
externalUserid: this.multipleSelection[0].externalUserid, externalUserid: this.multipleSelection[0].externalUserid,
addTag: this.selectedTag,
};
let apiType = {
add: "makeLabel",
remove: "removeLabel",
}; };
api.makeLabel(this.selectedTag).then(() => { api[apiType[this.tagDialogType.type]](data).then(() => {
this.msgSuccess("操作成功"); this.msgSuccess("操作成功");
this.dialogVisible = false; this.dialogVisible = false;
this.getList();
}); });
} }
}, },
...@@ -278,13 +290,14 @@ export default { ...@@ -278,13 +290,14 @@ export default {
type="primary" type="primary"
size="mini" size="mini"
icon="el-icon-s-flag" icon="el-icon-s-flag"
@click="makeTag" @click="makeTag('add')"
>打标签</el-button> >打标签</el-button>
<el-button <el-button
v-hasPermi="['customerManage:customer:removeTag']" v-hasPermi="['customerManage:customer:removeTag']"
type="primary" type="primary"
size="mini" size="mini"
icon="el-icon-brush" icon="el-icon-brush"
@click="makeTag('remove')"
>移除标签</el-button> >移除标签</el-button>
<el-button <el-button
v-hasPermi="['customerManage:customer:sync']" v-hasPermi="['customerManage:customer:sync']"
...@@ -320,10 +333,12 @@ export default { ...@@ -320,10 +333,12 @@ export default {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="corpName" label="公司名称" align="center"></el-table-column> <el-table-column prop="corpName" label="公司名称" align="center"></el-table-column>
<el-table-column prop="address" label="添加人(首位)" align="center"> <el-table-column prop="userName" label="添加人(首位)" align="center">
<template slot-scope="scope">{{ scope.row.weFlowerCustomerRels[0].userName }}</template> <template slot-scope="scope">{{ scope.row.weFlowerCustomerRels[0].userName }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="添加时间" align="center"></el-table-column> <el-table-column prop="createTime" label="添加时间" align="center">
<template slot-scope="scope">{{ scope.row.weFlowerCustomerRels[0].createTime }}</template>
</el-table-column>
<el-table-column prop="address" label="标签" align="center"> <el-table-column prop="address" label="标签" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item, index) in scope.row.weFlowerCustomerRels" :key="index"> <div v-for="(item, index) in scope.row.weFlowerCustomerRels" :key="index">
...@@ -366,24 +381,36 @@ export default { ...@@ -366,24 +381,36 @@ export default {
v-for="(item, index) in listTag" v-for="(item, index) in listTag"
:key="index" :key="index"
:label="item.gourpName" :label="item.gourpName"
:value="item.id" :value="item.groupId"
></el-option> ></el-option>
</el-select> </el-select>
<div class="mt20"> <div class="mt20">
<el-checkbox-group v-model="selectedTag"> <el-checkbox-group v-model="selectedTag" v-if="tagDialogType.type !== 'remove'">
<template v-for="(item, index) in listTag"> <template v-for="(item, index) in listTag">
<div class="bfc-d" v-show="item.id === selectedGroup || !selectedGroup" :key="index"> <div
class="bfc-d"
v-show="item.groupId === selectedGroup || !selectedGroup"
:key="index"
>
<el-checkbox <el-checkbox
:label="unit" :label="unit"
value-key="id"
v-for="(unit, unique) in item.weTags" v-for="(unit, unique) in item.weTags"
:key="index + unique" :key="index + unique"
>{{unit.name}}</el-checkbox> >{{unit.name}}</el-checkbox>
</div> </div>
</template> </template>
</el-checkbox-group> </el-checkbox-group>
<el-checkbox-group v-else v-model="selectedTag">
<template v-for="(item, index) in removeTag">
<el-checkbox
v-if="item.groupId === selectedGroup || !selectedGroup"
:label="item"
:key="index"
>{{item.name}}</el-checkbox>
</template>
</el-checkbox-group>
</div> </div>
<div class="mt20" v-show="tagDialogType.type === 'customer'"> <div class="mt20" v-show="tagDialogType.type === 'add'">
<el-button type="primary" @click="dialogVisibleAddTag = true">添加标签</el-button> <el-button type="primary" @click="dialogVisibleAddTag = true">添加标签</el-button>
</div> </div>
</div> </div>
...@@ -447,4 +474,7 @@ export default { ...@@ -447,4 +474,7 @@ export default {
color: #f753b2; color: #f753b2;
} }
} }
.bfc-d + .bfc-d .el-checkbox:first-child {
margin-left: 10px;
}
</style> </style>
...@@ -5,7 +5,10 @@ export default { ...@@ -5,7 +5,10 @@ export default {
name: "CustomerDetail", name: "CustomerDetail",
data() { data() {
return { return {
customer: {}, datePickerVisible: false,
customer: {
weFlowerCustomerRels: [],
},
}; };
}, },
created() { created() {
...@@ -29,22 +32,28 @@ export default { ...@@ -29,22 +32,28 @@ export default {
<div> <div>
<!-- <el-button slot="append" circle icon="el-icon-back" @click="$router.back()"></el-button>返回 --> <!-- <el-button slot="append" circle icon="el-icon-back" @click="$router.back()"></el-button>返回 -->
<div class="flex aic"> <div class="flex aic">
<el-avatar <el-avatar :size="100" :src="customer.avatar"></el-avatar>
:size="100"
src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
></el-avatar>
<div class="info-wrap"> <div class="info-wrap">
<div style="margin-bottom: 20px;"> <div class="mb10">
{{customer.groupName}} {{customer.name}}
<span <span
:style="{color: customer.type === 1 ? '#4bde03' : '#f9a90b'}" :style="{color: customer.type === 1 ? '#4bde03' : '#f9a90b'}"
>{{ ({1: '@微信', 2: '@企业微信'})[customer.type] }}</span> >{{ ({1: '@微信', 2: '@企业微信'})[customer.type] }}</span>
<i :class="['el-icon-s-custom', ({1: 'man', 2: 'woman'})[customer.gender]]"></i> <i :class="['el-icon-s-custom', ({1: 'man', 2: 'woman'})[customer.gender]]"></i>
</div> </div>
<div class="info"> <div class="info">
出生日期:{{customer.createTime || '--'}} 出生日期:{{customer.birthday || '--'}}
<i class="el-icon-edit"></i> <div class="ml20" style="position: absolute;">
<el-date-picker v-model="customer.createTime" type="date" placeholder="选择日期"></el-date-picker> <el-date-picker
v-if="datePickerVisible"
v-model="customer.birthday"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期便于以后客情维护"
@blur="datePickerVisible = false"
></el-date-picker>
<i v-else class="el-icon-edit" @click="datePickerVisible = true"></i>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -53,28 +62,36 @@ export default { ...@@ -53,28 +62,36 @@ export default {
<div> <div>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">备注名:</el-col> <el-col :span="10">备注名:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">{{customer.name}}</el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">标签:</el-col> <el-col :span="10">标签:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">
<div v-for="(item, index) in customer.weFlowerCustomerRels" :key="index">
<el-tag
type="info"
v-for="(unit, unique) in item.weFlowerCustomerTagRels"
:key="unique"
>{{unit.tagName}}</el-tag>
</div>
</el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">个人标签:</el-col> <el-col :span="10">个人标签:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">{{"--"}}</el-col>
</el-row> </el-row>
<el-divider></el-divider> <el-divider></el-divider>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">添加人:</el-col> <el-col :span="10">添加人:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">{{customer.weFlowerCustomerRels[0].userName}}</el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">所在部门:</el-col> <el-col :span="10">所在部门:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">{{"--"}}</el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10">添加时间:</el-col> <el-col :span="10">添加时间:</el-col>
<el-col :span="12">Dora</el-col> <el-col :span="12">{{customer.weFlowerCustomerRels[0].createTime}}</el-col>
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
...@@ -106,6 +123,7 @@ export default { ...@@ -106,6 +123,7 @@ export default {
margin-left: 20px; margin-left: 20px;
.info { .info {
color: #aaa; color: #aaa;
line-height: 32px;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!