Commit fbb40b5c by xinla

--no commit message

1 parent 63ce2f27
...@@ -23,6 +23,19 @@ export function getDetail(id) { ...@@ -23,6 +23,19 @@ export function getDetail(id) {
return request({ return request({
url: service + '/' + id, url: service + '/' + id,
method: 'get', method: 'get',
}).then((data) => {
if (data.emplList) {
let emplNames = data.emplNames?.split(',')
data.users = data.emplList?.split(',').map((e, i) => ({ id: e, name: emplNames[i] }))
}
if (data.tagList) {
let emplNames = data.emplNames?.split(',')
data.users = data.tagList?.split(',').map((e, i) => ({ id: e, name: emplNames[i] }))
}
if (data.emplList) {
let emplNames = data.emplNames?.split(',')
data.users = data.emplList?.split(',').map((e, i) => ({ id: e, name: emplNames[i] }))
}
}) })
} }
...@@ -68,6 +81,14 @@ export function getDetail(id) { ...@@ -68,6 +81,14 @@ export function getDetail(id) {
} }
*/ */
export function add(data) { export function add(data) {
data = Object.assign({}, data, {
emplList: data.users?.map((e) => e.id) + '',
emplNames: data.users?.map((e) => e.name) + '',
tagList: data.tags?.map((e) => e.id) + '',
tagNames: data.tags?.map((e) => e.name) + '',
chatIdList: data.chatList?.map((e) => e.id) + '',
chatIdListNames: data.chatList?.map((e) => e.name) + '',
})
return request({ return request({
url: service + '/add', url: service + '/add',
method: 'post', method: 'post',
......
...@@ -3,7 +3,7 @@ import { getDetail, add, update } from '@/api/communityOperating/newCustomer' ...@@ -3,7 +3,7 @@ import { getDetail, add, update } from '@/api/communityOperating/newCustomer'
import PhoneDialog from '@/components/PhoneDialog' import PhoneDialog from '@/components/PhoneDialog'
export default { export default {
components: { PhoneDialog }, components: { PhoneDialog, SelectGroup: defineAsyncComponent(() => import('@/components/SelectGroup.vue')) },
data() { data() {
return { return {
selectedUserList: [], selectedUserList: [],
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
groupQrCode: {}, groupQrCode: {},
rules: Object.freeze({ rules: Object.freeze({
codeName: [{ required: true, message: '该项为必填项', trigger: 'blur' }], codeName: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
emplList: [{ required: true, message: '该项为必填项', trigger: 'blur' }], users: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
tagList: [{ required: true, message: '该项为必填项', trigger: 'change' }], tagList: [{ required: true, message: '该项为必填项', trigger: 'change' }],
groupCodeId: [{ required: true, message: '该项为必填项', trigger: 'blur' }], groupCodeId: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
welcomeMsg: [{ required: true, message: '该项为必填项', trigger: 'blur' }], welcomeMsg: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
...@@ -34,24 +34,22 @@ export default { ...@@ -34,24 +34,22 @@ export default {
} }
}, },
watch: { watch: {
tags: { // tags: {
deep: true, // deep: true,
handler(tags) { // handler(tags) {
this.form.tagList = tags.map((t) => t.tagId) // this.form.tagList = tags.map((t) => t.tagId)
}, // },
}, // },
users: { // users: {
deep: true, // deep: true,
handler(users) { // handler(users) {
this.form.emplList = users.map((u) => u.businessId) // this.form.emplList = users.map((u) => u.businessId)
this.$refs.form.validateField('emplList') // this.$refs.form.validateField('emplList')
}, // },
}, // },
}, },
created() { created() {
this.newGroupId = this.$route.query.id this.$route.query.id && this.getDetail(this.$route.query.id)
this.newGroupId && this.getDetail(this.newGroupId)
// this.$route.meta.title = (this.newGroupId ? '编辑' : '新建') + '新客自动拉群'
}, },
methods: { methods: {
/** 获取详情 */ /** 获取详情 */
...@@ -72,44 +70,33 @@ export default { ...@@ -72,44 +70,33 @@ export default {
this.form.groupCodeId = '' this.form.groupCodeId = ''
} }
this.tags = data.tagList || []
this.users = data.emplList || []
this.loading = false this.loading = false
}) })
}, },
// 选择人员变化事件 // 选择人员变化事件
submitSelectUser(users) { submitSelectUser(users) {
this.users = users.map((d) => { this.form.users = users.map((d) => {
return { return {
businessId: d.id || d.userId, id: d.id || d.userId,
businessName: d.name, name: d.name,
businessIdType: d.userId ? 2 : 1,
mobile: d.mobile,
empleCodeId: d.empleCodeId,
} }
}) })
}, },
onSelectUser() { onSelectUser() {
this.selectedUserList = [] this.selectedUserList = this.form.users?.map((dd, index) => {
let arr = []
if (this.users && this.users.length) {
arr = this.users.map((dd, index) => {
return { return {
userId: dd.businessId, userId: dd.id,
name: dd.businessName, name: dd.name,
} }
}) })
}
this.selectedUserList = arr
this.dialogVisibleSelectUser = true this.dialogVisibleSelectUser = true
}, },
// 客户标签选择 // 客户标签选择
submitSelectTag(tags) { submitSelectTag(tags) {
this.tags = tags.map((t) => { this.form.tags = tags.map((t) => {
return { return {
tagId: t.tagId, id: t.tagId,
tagName: t.name, name: t.name,
} }
}) })
}, },
...@@ -123,8 +110,8 @@ export default { ...@@ -123,8 +110,8 @@ export default {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.loading = true this.loading = true
if (this.newGroupId) { if (this.$route.query.id) {
update(this.newGroupId, this.form) update(this.$route.query.id, this.form)
.then(() => { .then(() => {
this.msgSuccess('更新成功') this.msgSuccess('更新成功')
this.loading = false this.loading = false
...@@ -160,10 +147,10 @@ export default { ...@@ -160,10 +147,10 @@ export default {
<el-form-item label="活码名称" prop="codeName"> <el-form-item label="活码名称" prop="codeName">
<el-input v-model="form.codeName" maxlength="30" show-word-limit placeholder="请输入" clearable></el-input> <el-input v-model="form.codeName" maxlength="30" show-word-limit placeholder="请输入" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="使用员工" prop="emplList"> <el-form-item label="使用员工" prop="users">
<el-button type="primary" @click="onSelectUser">选择员工</el-button> <el-button type="primary" @click="onSelectUser">选择员工</el-button>
<br /> <br />
<TagEllipsis :list="form.users" limit="10" defaultProps="businessName"></TagEllipsis> <TagEllipsis :list="form.users" limit="10"></TagEllipsis>
</el-form-item> </el-form-item>
<!-- <el-form-item label="选择群活码" prop="groupCodeId"> <!-- <el-form-item label="选择群活码" prop="groupCodeId">
...@@ -183,9 +170,7 @@ export default { ...@@ -183,9 +170,7 @@ export default {
<TagEllipsis :list="form.tags" limit="10" defaultProps="tagName"></TagEllipsis> <TagEllipsis :list="form.tags" limit="10" defaultProps="tagName"></TagEllipsis>
</el-form-item> </el-form-item>
<el-form-item label="添加设置" prop="skipVerify"> <el-form-item label="添加设置" prop="skipVerify">
<el-checkbox :true-label="1" :false-label="0" v-model="form.skipVerify"> <el-checkbox v-model="form.skipVerify">客户添加时无需经过确认自动成为好友</el-checkbox>
客户添加时无需经过确认自动成为好友
</el-checkbox>
</el-form-item> </el-form-item>
</div> </div>
<div class="g-card"> <div class="g-card">
...@@ -261,14 +246,18 @@ export default { ...@@ -261,14 +246,18 @@ export default {
<!-- 选择使用员工弹窗 --> <!-- 选择使用员工弹窗 -->
<SelectUser <SelectUser
:isWechat="false"
v-model:visible="dialogVisibleSelectUser" v-model:visible="dialogVisibleSelectUser"
title="选择使用员工" title="选择使用员工"
:defaultValues="selectedUserList" :defaultValues="selectedUserList"
@success="submitSelectUser"></SelectUser> @success="submitSelectUser"></SelectUser>
<!-- 选择标签弹窗 --> <!-- 选择标签弹窗 -->
<SelectTag v-model:visible="dialogVisibleSelectTag" :selected="tags" @success="submitSelectTag"></SelectTag> <SelectTag v-model:visible="dialogVisibleSelectTag" :selected="form.tags" @success="submitSelectTag"></SelectTag>
<SelectGroup
v-model:visible="showSelectModal"
:defaults="form.groupList"
@submit="(data) => (form.groupList = data)"></SelectGroup>
<!-- 选择二维码弹窗 --> <!-- 选择二维码弹窗 -->
<!-- <SelectQrCode <!-- <SelectQrCode
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!