Commit b98d30a5 by 胡悦

一客一群修复bug

1 parent c93f7f33
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="124px"> <el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="124px">
<el-form-item label="自定义群名" prop="groupName"> <el-form-item label="自定义群名" prop="groupName">
<el-input <el-input
v-model="basicForm.groupName" v-model.trim="basicForm.groupName"
size="small" size="small"
placeholder="为群聊设个自定义组名,如“VIP服务群”" placeholder="为群聊设个自定义组名,如“VIP服务群”"
maxlength="10" maxlength="10"
...@@ -24,11 +24,10 @@ ...@@ -24,11 +24,10 @@
v-model="basicForm.groupNameRule" v-model="basicForm.groupNameRule"
style="line-height: 40px; font-size: 14px; max-width: 600px;" style="line-height: 40px; font-size: 14px; max-width: 600px;"
> >
<el-radio <el-radio v-for="(rule, index) in nameRules" :label="rule.id" :key="index">
v-for="(rule, index) in nameRules" {{ rule.rule }}
:label="rule.id" <span class="rule-tips">{{rule.tips}}</span>
:key="index" </el-radio>
>{{ rule.rule }}<span class="rule-tips">{{rule.tips}}</span></el-radio>
</el-radio-group> </el-radio-group>
<!-- <div class="form-tips">群聊名称后缀将以日期及序号进行累加,如“新车售后一组211011-1群”</div> --> <!-- <div class="form-tips">群聊名称后缀将以日期及序号进行累加,如“新车售后一组211011-1群”</div> -->
</el-form-item> </el-form-item>
...@@ -90,7 +89,6 @@ ...@@ -90,7 +89,6 @@
</div> </div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 编辑入群欢迎语 --> <!-- 编辑入群欢迎语 -->
...@@ -120,15 +118,15 @@ ...@@ -120,15 +118,15 @@
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
</div> </div>
<basic-dialog <basic-dialog
:title="'选择成员'" :title="'选择成员'"
:width="'1142px'" :width="'1142px'"
:isVisible="membersVisible" :isVisible="membersVisible"
@confirmDialog="handleConfirm" @confirmDialog="handleConfirm"
@closeDialog="membersVisible = !membersVisible" @closeDialog="membersVisible = !membersVisible"
> >
<!-- <SelectMembers islord="false" :selectData="selectData" ref="membersForm"></SelectMembers> --> <!-- <SelectMembers islord="false" :selectData="selectData" ref="membersForm"></SelectMembers> -->
<SelectMember ref="membersForm" v-if="membersVisible" :selectData="selectData"></SelectMember> <SelectMember ref="membersForm" v-if="membersVisible" :selectData="selectData" :followData="followData"></SelectMember>
</basic-dialog> </basic-dialog>
<!-- <SelectMember ref="membersForm"></SelectMember> --> <!-- <SelectMember ref="membersForm"></SelectMember> -->
<select-follow @selectTable="selectTable" ref="selectEmpForm"></select-follow> <select-follow @selectTable="selectTable" ref="selectEmpForm"></select-follow>
</div> </div>
...@@ -151,28 +149,28 @@ export default { ...@@ -151,28 +149,28 @@ export default {
data() { data() {
const validatorUser = (rule, value, callback) => { const validatorUser = (rule, value, callback) => {
console.log(this.basicForm.userList) console.log(this.basicForm.userList)
const followList = this.basicForm.followList const followList = this.basicForm.followList
let userList = [] let userList = []
if (this.basicForm.userList && this.basicForm.userList.length) { if (this.basicForm.userList && this.basicForm.userList.length) {
userList = this.basicForm.followList.concat(this.basicForm.userList) userList = this.basicForm.followList.concat(this.basicForm.userList)
} else {
userList = this.basicForm.followList
}
console.log(userList)
if (!this.basicForm.followList.length) {
callback(new Error('请选择跟进专员'))
} else {
console.log(this.basicForm.followList)
if (userList.length < 2) {
this.$message({
type: 'error',
message: '必须配置2个及以上成员'
})
// callback(new Error('必须配置2个及以上成员'))
} else { } else {
userList = this.basicForm.followList callback()
}
console.log(userList)
if (!this.basicForm.followList.length) {
callback(new Error('请选择跟进专员'))
} else {
console.log(this.basicForm.followList)
if (userList.length < 2) {
this.$message({
type: 'error',
message: '必须配置2个及以上成员'
})
// callback(new Error('必须配置2个及以上成员'))
} else {
callback()
}
} }
}
} }
// const nameVaild = (rule, value, callback) => { // const nameVaild = (rule, value, callback) => {
// console.log(this.$route.params.id) // console.log(this.$route.params.id)
...@@ -215,7 +213,7 @@ export default { ...@@ -215,7 +213,7 @@ export default {
{ {
rule: '自定义群名', rule: '自定义群名',
id: 0 id: 0
}, }
], ],
basicRules: { basicRules: {
groupName: [ groupName: [
...@@ -233,6 +231,7 @@ export default { ...@@ -233,6 +231,7 @@ export default {
followkey: new Date(), followkey: new Date(),
previewFlag: false, previewFlag: false,
selectData: [], selectData: [],
followData: [],
editStatus: false, editStatus: false,
// 跟进专员 // 跟进专员
followVisible: false followVisible: false
...@@ -244,14 +243,13 @@ export default { ...@@ -244,14 +243,13 @@ export default {
this.editStatus = true this.editStatus = true
}, },
deep: true deep: true
}, }
// membersVisible(val) { // membersVisible(val) {
// console.log(val) // console.log(val)
// if (!val) { // if (!val) {
// this.$refs.membersForm.resetSearch() // this.$refs.membersForm.resetSearch()
// } // }
// } // }
}, },
mounted() { mounted() {
if (this.$route.params) { if (this.$route.params) {
...@@ -275,55 +273,55 @@ export default { ...@@ -275,55 +273,55 @@ export default {
console.log(this.basicForm) console.log(this.basicForm)
this.$refs.basicForm.validate(valid => { this.$refs.basicForm.validate(valid => {
if (valid) { if (valid) {
const params = { const params = {
groupName: this.basicForm.groupName, groupName: this.basicForm.groupName,
groupNameRule: this.basicForm.groupNameRule groupNameRule: this.basicForm.groupNameRule
}
const followList = this.basicForm.followList.map(item => {
return {
staffId: item.staffId,
staffName: item.staffName,
follow: 1
} }
}) const followList = this.basicForm.followList.map(item => {
let memberList = []
if (this.basicForm.userList && this.basicForm.userList.map.length) {
memberList = this.basicForm.userList.map(i => {
return { return {
staffId: i.staffId, staffId: item.staffId,
staffName: i.staffName, staffName: item.staffName,
follow: 0 follow: 1
} }
}) })
} let memberList = []
params.userList = followList.concat(memberList) if (this.basicForm.userList && this.basicForm.userList.map.length) {
let apiName = 'insert' memberList = this.basicForm.userList.map(i => {
if (this.basicForm.id) { return {
apiName = 'update' staffId: i.staffId,
params.id = this.basicForm.id staffName: i.staffName,
} follow: 0
console.log(params) }
this.$apis.groupGuest[apiName](params) })
.then(res => { }
if (res) { params.userList = followList.concat(memberList)
let apiName = 'insert'
if (this.basicForm.id) {
apiName = 'update'
params.id = this.basicForm.id
}
console.log(params)
this.$apis.groupGuest[apiName](params)
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.$router.push('/guestGroup/index')
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
.catch(err => {
this.$message({ this.$message({
type: 'success', type: 'error',
message: '操作成功!' message: err.message
}) })
this.$router.push('/guestGroup/index')
} else {
this.$message({
type: 'error',
message: '操作失败'
}) })
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
} }
}) })
}, },
...@@ -378,9 +376,9 @@ export default { ...@@ -378,9 +376,9 @@ export default {
}, },
// 成员弹窗 // 成员弹窗
handleConfirm() { handleConfirm() {
this.basicForm.userList = this.$refs.membersForm.innerTags this.basicForm.userList = this.$refs.membersForm.innerTags
this.selectData = this.basicForm.userList this.selectData = this.basicForm.userList
this.openMembers() this.openMembers()
}, },
handleClose() { handleClose() {
this.membersVisible = false this.membersVisible = false
...@@ -392,10 +390,12 @@ export default { ...@@ -392,10 +390,12 @@ export default {
staffName: item.staffName staffName: item.staffName
} }
}) })
this.followData = this.basicForm.followList.map(i => i.staffId)
this.followkey = new Date() this.followkey = new Date()
}, },
removeFollow(idx) { removeFollow(idx) {
this.basicForm.followList.splice(idx, 1) this.basicForm.followList.splice(idx, 1)
this.followData = this.basicForm.followList.map(i => i.staffId)
this.followkey = new Date() this.followkey = new Date()
} }
} }
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
</el-form> </el-form>
<div class="table-content"> <div class="table-content">
<GLTable <GLTable
:key="key"
v-loading="loading" v-loading="loading"
ref="empTable" ref="empTable"
:tableData="tableEmpData" :tableData="tableEmpData"
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
</div> </div>
<!-- <div class="member-checked"> <!-- <div class="member-checked">
<el-checkbox v-model="searchForm.checked">仅看跟进专员</el-checkbox> <el-checkbox v-model="searchForm.checked">仅看跟进专员</el-checkbox>
</div> --> </div>-->
</div> </div>
<div class="member-right"> <div class="member-right">
<div class="member-title">已选</div> <div class="member-title">已选</div>
...@@ -98,11 +99,10 @@ ...@@ -98,11 +99,10 @@
</template> </template>
<script> <script>
import url from '@/assets/empty.png'
import url from "@/assets/empty.png"
export default { export default {
name: 'SelectMember', name: 'SelectMember',
props: ['selectData'], props: ['selectData', 'followData'],
data() { data() {
return { return {
url: url, url: url,
...@@ -139,17 +139,17 @@ export default { ...@@ -139,17 +139,17 @@ export default {
tableEmpData: [], tableEmpData: [],
allTreeData: [], allTreeData: [],
currentTreeData: [], currentTreeData: [],
innerTags: [] innerTags: [],
key: new Date()
} }
}, },
mounted() { mounted() {
this.listDepartmentTree() this.listDepartmentTree()
}, },
methods: { methods: {
selectionTable(val) { selectionTable(val) {
console.log(val)
this.innerTags = val this.innerTags = val
// this.$emit('selectTable', val)
}, },
// 清空搜索条件 // 清空搜索条件
resetSearch() { resetSearch() {
...@@ -171,10 +171,8 @@ export default { ...@@ -171,10 +171,8 @@ export default {
params.islord = this.islord params.islord = this.islord
} }
this.loading = true this.loading = true
console.log(this.selectData) params.isHavCustomer = true
// params.isHavCustomer = true
this.$apis.groupGuest.listDepartmentTree(params).then(res => { this.$apis.groupGuest.listDepartmentTree(params).then(res => {
console.log(res)
this.loading = false this.loading = false
if (res) { if (res) {
this.tableEmpData = this.getEmployee(res) this.tableEmpData = this.getEmployee(res)
...@@ -187,13 +185,14 @@ export default { ...@@ -187,13 +185,14 @@ export default {
this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item) this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item)
}) })
} }
this.tableParams.checkSelectVal = this.followData
this.key = new Date()
} else { } else {
this.treeData = [] this.treeData = []
} }
}) })
}, },
handleNodeClick(data) { handleNodeClick(data) {
console.log(data)
this.searchForm.department = data.departmentName this.searchForm.department = data.departmentName
this.currentTreeData = data this.currentTreeData = data
this.onHidePopover() this.onHidePopover()
...@@ -219,8 +218,6 @@ export default { ...@@ -219,8 +218,6 @@ export default {
const data = this.currentTreeData const data = this.currentTreeData
const keyword = this.searchForm.name const keyword = this.searchForm.name
let arr = [] let arr = []
// this.loading = true
console.log(keyword, data, this.tableEmpData)
if (data instanceof Array) { if (data instanceof Array) {
data.forEach(i => { data.forEach(i => {
if (i.staffName.indexOf(keyword) != -1) { if (i.staffName.indexOf(keyword) != -1) {
...@@ -266,6 +263,7 @@ export default { ...@@ -266,6 +263,7 @@ export default {
this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item) this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item)
}, },
rowClick(row) { rowClick(row) {
if (this.followData.find(i => i == row.id)) return
this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(row) this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(row)
} }
} }
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
<div class="content"> <div class="content">
<div class="group-name flex"> <div class="group-name flex">
<div class="avator"> <div class="avator">
<img src="@/assets/guestCustom/chat-logo.png" alt="" /> <img src="@/assets/guestCustom/chat-logo.png" alt />
</div> </div>
<div class="group-name-info"> <div class="group-name-info">
<div>{{groupInfo.groupName}}</div> <div>{{groupInfo.groupName}}</div>
<div class="group-name-info-count">{{groupInfo.userList ? groupInfo.userList.length : 0}}人</div> <div
class="group-name-info-count"
>{{groupInfo.userList ? groupInfo.userList.length : 0}}人</div>
</div> </div>
</div> </div>
<div class="text-info"> <div class="text-info">
...@@ -38,7 +40,12 @@ ...@@ -38,7 +40,12 @@
<el-popover placement="top" width="600" trigger="hover"> <el-popover placement="top" width="600" trigger="hover">
<span slot="reference">...({{ followList.length }})</span> <span slot="reference">...({{ followList.length }})</span>
<div class="entmicro-hover"> <div class="entmicro-hover">
<el-tag type="info" v-for="(i, index) in followList" :key="index" :disable-transitions="false"> <el-tag
type="info"
v-for="(i, index) in followList"
:key="index"
:disable-transitions="false"
>
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
{{ i.staffName }}{{ i.departmentName ? `(${i.departmentName})` : '' }} {{ i.staffName }}{{ i.departmentName ? `(${i.departmentName})` : '' }}
</el-tag> </el-tag>
...@@ -60,7 +67,12 @@ ...@@ -60,7 +67,12 @@
<el-popover placement="top" width="600" trigger="hover"> <el-popover placement="top" width="600" trigger="hover">
<span slot="reference">...({{ memberList.length }})</span> <span slot="reference">...({{ memberList.length }})</span>
<div class="entmicro-hover"> <div class="entmicro-hover">
<el-tag type="info" v-for="(i, index) in memberList" :key="index" :disable-transitions="false"> <el-tag
type="info"
v-for="(i, index) in memberList"
:key="index"
:disable-transitions="false"
>
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
{{ i.staffName }}{{ i.departmentName ? `(${i.departmentName})` : '' }} {{ i.staffName }}{{ i.departmentName ? `(${i.departmentName})` : '' }}
</el-tag> </el-tag>
...@@ -82,15 +94,28 @@ ...@@ -82,15 +94,28 @@
</div> </div>
<div class="text-info">更新于:{{currentTime}}</div> <div class="text-info">更新于:{{currentTime}}</div>
</div> </div>
<GLTable class="table" :searchForm="searchForm" ref="groupDetail" :hasNum="false" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :pageConf="pageConf" :tableParams="tableParams" :tableData="tableData"> <GLTable
class="table"
:searchForm="searchForm"
ref="groupDetail"
:hasNum="false"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
:noDataImg="url"
:pageConf="pageConf"
:tableParams="tableParams"
:tableData="tableData"
>
<span slot="customerName" slot-scope="scope"> <span slot="customerName" slot-scope="scope">
<div class="customer"> <div class="customer">
<!-- <div class="customer-img"> <!-- <div class="customer-img">
<img src="@/assets/guestCustom/chat-logo.png" alt="" /> <img src="@/assets/guestCustom/chat-logo.png" alt="" />
</div> --> </div>-->
<div class="customer-name"> <div class="customer-name">
{{ scope.scope.customerName }} {{ scope.scope.customerName }}
<label class="origin">{{ WECHANT_TYPE[scope.scope.type]}}</label> <label
class="origin"
>{{ WECHANT_TYPE[scope.scope.type]}}</label>
</div> </div>
</div> </div>
</span> </span>
...@@ -101,8 +126,11 @@ ...@@ -101,8 +126,11 @@
</el-tag> </el-tag>
</div> </div>
<span slot="status" class="table-status" slot-scope="scope"> <span slot="status" class="table-status" slot-scope="scope">
<span class="statusText" :class="{ 'red-text': scope.scope.delFlag === '-1' }">{{ scope.scope.delFlag == '0' ? '使用' : '解散于' }}</span> <span
<span v-if="scope.scope.delFlag === '-1'" class="gray-text">{{ scope.scope.cancelTime }}</span> class="statusText"
:class="{ 'red-text': scope.scope.delFlag == '-1' }"
>{{ scope.scope.delFlag == '0' ? '使用' : '解散于' }}</span>
<span v-if="scope.scope.delFlag == '-1'" class="gray-text">{{ scope.scope.disMiss }}</span>
</span> </span>
</GLTable> </GLTable>
</div> </div>
...@@ -113,7 +141,7 @@ ...@@ -113,7 +141,7 @@
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> >
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel" type="primary">取消</el-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -171,7 +199,7 @@ export default { ...@@ -171,7 +199,7 @@ export default {
}, },
{ {
label: '现群名称', label: '现群名称',
prop: 'groupName', prop: 'chatName',
align: 'left' align: 'left'
}, },
{ {
...@@ -390,7 +418,7 @@ export default { ...@@ -390,7 +418,7 @@ export default {
//更新数据 //更新数据
refreshData() { refreshData() {
this.$refs.groupDetail.refreshTable() this.$refs.groupDetail.refreshTable()
this.$set(this, 'currentTime', dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')) this.$set(this, 'currentTime', dayjs(new Date()).format('YYYY-MM-DD HH:mm'))
}, },
setTableFinishFun() { setTableFinishFun() {
if (this.$refs.groupDetail.data && !this.$refs.groupDetail.data.length) { if (this.$refs.groupDetail.data && !this.$refs.groupDetail.data.length) {
...@@ -399,11 +427,11 @@ export default { ...@@ -399,11 +427,11 @@ export default {
}, },
getGroupList(id) { getGroupList(id) {
// const id = this.userId // const id = this.userId
this.$apis.groupGuest.detail({id}).then(res => { this.$apis.groupGuest.detail({ id }).then(res => {
if (res) { if (res) {
this.followList = [] this.followList = []
this.memberList = [] this.memberList = []
this.currentTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss') this.currentTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm')
this.groupInfo = res this.groupInfo = res
if (res.userList && res.userList.length) { if (res.userList && res.userList.length) {
res.userList.forEach(item => { res.userList.forEach(item => {
...@@ -614,5 +642,4 @@ i { ...@@ -614,5 +642,4 @@ i {
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</span> </span>
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<!-- <el-button type="text" @click="btnClick('edit', scope.scope)">修改</el-button> <!-- <el-button type="text" @click="btnClick('edit', scope.scope)">修改</el-button>
<el-button type="text" @click="btnClick('detail', scope.scope)">查看详情</el-button> --> <el-button type="text" @click="btnClick('detail', scope.scope)">查看详情</el-button>-->
<GLButton type="text" @click="btnClick('edit', scope.scope)" fn="修改群组">修改</GLButton> <GLButton type="text" @click="btnClick('edit', scope.scope)" fn="修改群组">修改</GLButton>
<GLButton <GLButton
type="text" type="text"
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<!-- <el-button <!-- <el-button
type="text" type="text"
@click="btnClick('status', scope.scope)" @click="btnClick('status', scope.scope)"
>{{ scope.scope.status == 1 ? '停用' : '启用' }}</el-button> --> >{{ scope.scope.status == 1 ? '停用' : '启用' }}</el-button>-->
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
...@@ -245,7 +245,7 @@ export default { ...@@ -245,7 +245,7 @@ export default {
// } // }
// }, // },
mounted() { mounted() {
// this.wxTips() this.wxTips()
}, },
methods: { methods: {
wxTips() { wxTips() {
...@@ -270,6 +270,9 @@ export default { ...@@ -270,6 +270,9 @@ export default {
}) })
}) })
}, },
jumpWx() {
this.$history.push('/settings/enterpriseWechat/index')
},
//搜索表格 //搜索表格
searchTable() { searchTable() {
this.$refs.gueastGroup.refreshTable() this.$refs.gueastGroup.refreshTable()
...@@ -277,7 +280,7 @@ export default { ...@@ -277,7 +280,7 @@ export default {
btnClick(name, rowData) { btnClick(name, rowData) {
switch (name) { switch (name) {
case 'create': case 'create':
this.$router.push('/guestGroup/add/-1') this.$router.push('/guestGroup/add')
break break
case 'edit': case 'edit':
this.$router.push('/guestGroup/add/' + rowData.id) this.$router.push('/guestGroup/add/' + rowData.id)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!