|
|
@@ -103,6 +103,22 @@
|
|
|
<el-radio :label="2">自动发课添加好友</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item v-if="bindForm.addType === 1" label="所属销售">
|
|
|
+ <el-select
|
|
|
+ v-model="bindForm.companyUserId"
|
|
|
+ placeholder="请选择销售(不选则绑定当前登录销售)"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 320px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyUserList"
|
|
|
+ :key="item.userId"
|
|
|
+ :label="formatCompanyUserLabel(item)"
|
|
|
+ :value="item.userId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<el-divider content-position="left">选择用户</el-divider>
|
|
|
@@ -233,6 +249,7 @@
|
|
|
<script>
|
|
|
import {
|
|
|
listImFriendshipBind,
|
|
|
+ listBindCompanyUser,
|
|
|
listBindUser,
|
|
|
listBindExternalContact,
|
|
|
addUserAndSaleFriend
|
|
|
@@ -258,8 +275,10 @@ export default {
|
|
|
companyUserNickName: null
|
|
|
},
|
|
|
bindForm: {
|
|
|
- addType: 1
|
|
|
+ addType: 1,
|
|
|
+ companyUserId: null
|
|
|
},
|
|
|
+ companyUserList: [],
|
|
|
userLoading: false,
|
|
|
userList: [],
|
|
|
userTotal: 0,
|
|
|
@@ -289,8 +308,26 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getList()
|
|
|
+ this.loadCompanyUserList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ loadCompanyUserList() {
|
|
|
+ listBindCompanyUser().then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.companyUserList = res.data || []
|
|
|
+ if (this.companyUserList.length === 1) {
|
|
|
+ this.bindForm.companyUserId = this.companyUserList[0].userId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formatCompanyUserLabel(item) {
|
|
|
+ if (!item) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ const name = item.nickName || item.userName || ''
|
|
|
+ return name ? `${name}(${item.userId})` : String(item.userId)
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.loading = true
|
|
|
listImFriendshipBind(this.queryParams).then(response => {
|
|
|
@@ -310,6 +347,7 @@ export default {
|
|
|
this.handleQuery()
|
|
|
},
|
|
|
handleAddTypeChange() {
|
|
|
+ this.bindForm.companyUserId = null
|
|
|
this.selectedUsers = []
|
|
|
this.selectedUser = null
|
|
|
this.selectedExternal = null
|
|
|
@@ -403,10 +441,14 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
this.submitLoading = true
|
|
|
- addUserAndSaleFriend({
|
|
|
+ const payload = {
|
|
|
addType: 1,
|
|
|
userIds: this.selectedUsers.map(item => this.resolveRowUserId(item))
|
|
|
- }).then(res => {
|
|
|
+ }
|
|
|
+ if (this.bindForm.companyUserId != null && this.bindForm.companyUserId !== '') {
|
|
|
+ payload.companyUserId = this.bindForm.companyUserId
|
|
|
+ }
|
|
|
+ addUserAndSaleFriend(payload).then(res => {
|
|
|
this.$message.success(res.msg || '操作成功')
|
|
|
this.handleAddTypeChange()
|
|
|
this.activeTab = 'list'
|