Commit b4a3bfac by xinla

Merge branch 'front_end_dev_2.0' of https://gitee.com/LinkWeChat/link-wechat into front_end_dev_2.0

2 parents e267daa6 1f3a1cbb
......@@ -14,14 +14,18 @@ export default {
type: String,
default: '选择标签'
},
selected: {
type: Array,
default: () => []
},
// add: 打标签,remove: 移除标签
// selected: {
// type: Array,
// default: () => [],
// },
type: {
type: String,
default: 'add'
},
destroyOnClose: Boolean,
defaultValues: {
type: Array,
default: () => []
}
},
data() {
......@@ -30,41 +34,48 @@ export default {
listOneArray: [],
selectedGroup: '', // 选择的标签分组
removeTag: [],
Pselected: []
Pselected: [],
selectedList: []
}
},
watch: {
// type(val) {
// val === 'remove' && (this.removeTag = this.selected.slice())
// },
selected(val) {
if (this.type === 'add') {
this.Pselected = []
val.forEach((element) => {
let find = this.listOneArray.find((d) => {
return element.tagId === d.tagId
})
this.Pselected.push(find)
})
} else if (this.type === 'remove') {
this.removeTag = val.slice()
this.Pselected = val.slice()
}
// this.list = JSON.parse(JSON.stringify(this.list))
},
list(val) {
if (this.type === 'add') {
this.Pselected = []
this.selected.forEach((element) => {
let find = this.listOneArray.find((d) => {
return element.tagId === d.tagId
})
this.Pselected.push(find)
})
} else if (this.type === 'remove') {
this.removeTag = this.selected.slice()
this.Pselected = this.selected.slice()
}
// selected(val) {
// if (this.type === 'add') {
// this.Pselected = []
// val.forEach((element) => {
// let find = this.listOneArray.find((d) => {
// return element.tagId === d.tagId
// })
// this.Pselected.push(find)
// })
// } else if (this.type === 'remove') {
// this.removeTag = val.slice()
// this.Pselected = val.slice()
// }
// // this.list = JSON.parse(JSON.stringify(this.list))
// },
// list (val) {
// if (this.type === 'add') {
// this.Pselected = []
// this.selected.forEach((element) => {
// let find = this.listOneArray.find((d) => {
// return element.tagId === d.tagId
// })
// this.Pselected.push(find)
// })
// } else if (this.type === 'remove') {
// this.removeTag = this.selected.slice()
// this.Pselected = this.selected.slice()
// }
// },
defaultValues: {
handler(val = []) {
this.selectedList = [...val]
},
immediate: true
}
},
computed: {
......@@ -75,7 +86,11 @@ export default {
},
set(val) {
this.$emit('update:visible', val)
// this.$nextTick(()=> this.selectedList = [])
}
},
checkedTagMap() {
return new Set(this.selectedList.map((i) => i.tagId || (typeof i == 'string' && i)))
}
},
created() {
......@@ -83,6 +98,14 @@ export default {
},
mounted() {},
methods: {
// getUserTags() {
// getUserTags(this, this.externalUserid)
// .then(res => {
// if(res.code == 200) {
// console.log(res)
// }
// })
// },
getList() {
getList().then(({ rows }) => {
// this.list = Object.freeze(rows)
......@@ -96,30 +119,35 @@ export default {
})
},
submit() {
if (!this.Pselected.length) {
this.msgError('请至少选择一个标签')
return
}
// if (!this.Pselected.length) {
// this.msgError('请至少选择一个标签')
// return
// }
this.$emit('success', JSON.parse(JSON.stringify(this.selectedList)))
this.Pvisible = false
this.$emit('success', this.Pselected)
},
isChecked(unit) {
// debugger
return this.Pselected.some((el) => {
return unit.tagId === el.tagId
})
onSelectTag(tag) {
const existIdx = this.selectedList.findIndex((i) => i.tagId === tag.tagId)
if (existIdx > -1) {
this.selectedList.splice(existIdx, 1)
} else {
this.selectedList.push(tag)
}
},
toJson(data) {
return JSON.stringify(data)
},
setTagSelect(data) {
return this.checkedTagMap.has(data.tagId) || this.checkedTagMap.has(data.tagName)
}
}
}
</script>
<template>
<el-dialog :title="title" :visible.sync="Pvisible">
<div class="dialog-content">
<span class="mr20">选择分组</span>
<el-dialog :title="title" :visible.sync="Pvisible" :destroy-on-close="destroyOnClose">
<div>
<!-- <span class="mr20">选择分组</span>
<el-select v-model="selectedGroup" placeholder="请选择">
<el-option label="所有标签" value></el-option>
<el-option
......@@ -129,16 +157,14 @@ export default {
:value="item.groupId"
></el-option>
</el-select>
<slot></slot>
<div v-if="Pvisible">
<div class="mt20" v-if="Pvisible">
<el-checkbox-group v-if="type !== 'remove'" v-model="Pselected">
<template v-for="(item, index) in list">
<div
class="checkbox-li"
class="bfc-d mr30"
v-if="item.groupId === selectedGroup || !selectedGroup"
:key="index"
>
<div class="checkbox-group-title">{{ item.gourpName }}</div>
<template v-for="(unit, unique) in item.weTags">
<el-checkbox
v-if="unit.name.trim()"
......@@ -151,7 +177,7 @@ export default {
</div>
</template>
</el-checkbox-group>
<el-checkbox-group class="mt20" v-else v-model="Pselected">
<el-checkbox-group v-else v-model="Pselected">
<template v-for="(item, index) in removeTag">
<el-checkbox
v-if="item.groupId === selectedGroup || !selectedGroup"
......@@ -161,7 +187,22 @@ export default {
>
</template>
</el-checkbox-group>
</div>
</div> -->
<section class="label-group">
<div v-for="item in list" :key="item.groupId" class="label-group-item">
<div class="label-group-item-title">{{ item.gourpName }}</div>
<div v-if="item.weTags" class="label-group-item-body">
<el-tag
v-for="tag in item.weTags"
:key="tag.tagId"
:type="setTagSelect(tag) ? '' : 'info'"
@click="onSelectTag(tag)"
>{{ tag.name }}</el-tag
>
</div>
</div>
</section>
<slot></slot>
</div>
<div slot="footer">
<el-button @click="Pvisible = false">取 消</el-button>
......@@ -179,20 +220,25 @@ export default {
.mr30 {
margin-right: 30px;
}
.dialog-content {
overflow: auto;
max-height: calc(85vh - 150px);
}
.label-group {
max-height: 400px;
overflow-x: hidden;
overflow-y: scroll;
&-item {
margin: 10px;
border-bottom: 1px solid #f1f1f1;
.checkbox-li {
.checkbox-group-title {
font-size: 16px;
margin-bottom: 15px;
color: #aaa;
}
padding: 20px 0 15px 0;
& + .checkbox-li {
border-top: 1px solid #eee;
&-title {
font-weight: 700;
line-height: 24px;
}
&-body {
padding: 10px 0;
}
.el-tag {
cursor: pointer;
}
}
}
</style>
<script>
import { getTree, getList } from '@/api/organization'
import { createUniqueString } from '@/utils'
export default {
name: 'SelectUser',
components: {},
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: '组织架构'
},
// 是否 只选择叶子节点(人员节点)/禁止选择父节点(部门节点)
isOnlyLeaf: {
type: Boolean,
default: true
},
// 是否单选
isSigleSelect: {
type: Boolean,
default: false
import { getTree, getList } from '@/api/organization'
import { createUniqueString } from '@/utils'
export default {
name: 'SelectUser',
components: {},
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '组织架构',
},
// 是否 只选择叶子节点(人员节点)/禁止选择父节点(部门节点)
isOnlyLeaf: {
type: Boolean,
default: true,
},
// 是否单选
isSigleSelect: {
type: Boolean,
default: false,
},
defaultValues: {
type: Array,
default: () => []
},
destroyOnClose: Boolean
},
defaultValues: {
type: Array,
default: () => []
}
},
data() {
let isOnlyLeaf = this.isOnlyLeaf
return {
treeData: [],
userList: [],
defaultProps: {
label: 'name',
children: 'children',
disabled(data, node) {
return isOnlyLeaf && !data.userId
data () {
let isOnlyLeaf = this.isOnlyLeaf
return {
treeData: [],
userList: [],
defaultProps: {
label: 'name',
children: 'children',
disabled (data, node) {
return isOnlyLeaf && !data.userId
},
isLeaf (data, node) {
return !data.id
},
},
isLeaf(data, node) {
return !!data.userId
}
}
}
},
watch: {},
computed: {
Pvisible: {
get() {
// this.getTree();
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
defaultCheckedKeys() {
const checkedList = []
const checkedUserList = []
if (!Array.isArray(this.defaultValues) || this.defaultValues.length == 0) {
this.userList = []
} else {
this.defaultValues.forEach((i) => {
const id = this.isOnlyLeaf ? i.userId : i.userId || i.id
if (id) {
checkedList.push(id)
checkedUserList.push(i)
}
})
this.userList = checkedUserList
watch: {
defaultValues (value) {
if (this.$refs.tree) this.$refs.tree.setCheckedKeys([])
}
return checkedList
}
},
created() {},
mounted() {},
methods: {
loadNode(node, resolve) {
if (node.level === 0) {
if (!Array.isArray(this.defaultValues) || this.defaultValues.length == 0) {
},
computed: {
Pvisible: {
get () {
// this.getTree();
return this.visible
},
set (val) {
this.$emit('update:visible', val)
},
},
defaultCheckedKeys () {
const checkedList = []
const checkedUserList = []
if (
!Array.isArray(this.defaultValues) ||
this.defaultValues.length == 0
) {
this.userList = []
}
getTree().then(({ data }) => {
data.forEach((element) => {
element.key = createUniqueString()
})
let _data = this.handleTree(data)
// console.log('d', data)
resolve(_data)
// api.getList({ department: _data[0].id }).then(({ rows, total }) => {
// _data && rows.unshift(..._data);
// resolve(rows);
// });
})
} else {
getList({ department: node.data.id, isActivate: 1 }).then(({ rows }) => {
rows.forEach((element) => {
element.key = createUniqueString()
} else {
this.defaultValues.forEach(i => {
const id = this.isOnlyLeaf ? i.userId : (i.userId || i.id)
if (id) {
checkedList.push(id)
checkedUserList.push(i)
}
})
node.data.children && rows.push(...node.data.children)
resolve(rows)
})
this.userList = checkedUserList
}
return checkedList
}
},
// 选择变化
handleCheckChange(data, checked, indeterminate) {
// debugger
if (checked) {
if (this.isSigleSelect) {
// 单选情况
this.$refs.tree.setCheckedKeys([data.key])
created () { },
mounted () { },
methods: {
loadNode (node, resolve) {
if (node.level === 0) {
if (!Array.isArray(this.defaultValues) ||
this.defaultValues.length == 0
) {
this.userList = []
}
getTree().then(({ data }) => {
// data.forEach((element) => {
// element.key = createUniqueString()
// })
let _data = this.handleTree(data)
resolve(_data)
// api.getList({ department: _data[0].id }).then(({ rows, total }) => {
// _data && rows.unshift(..._data);
// resolve(rows);
// });
})
} else {
getList({ department: node.data.id, isActivate: 1 }).then(
({ rows }) => {
// rows.forEach((element) => {
// element.key = createUniqueString()
// })
node.data.children && rows.push(...node.data.children)
resolve(rows)
}
)
}
if (this.isOnlyLeaf) {
if (data.userId) {
this.userList.push(data)
},
handleTree (data) {
return data.map(i => {
if (i.id) {
i.userId = i.id
i.isParty = true
}
return i
})
},
// 选择变化
handleCheckChange (data, checked, indeterminate) {
// console.log(arguments)
if (checked) {
if (this.isSigleSelect) {
// 单选情况
this.$refs.tree.setCheckedKeys([data.userId])
}
if (this.isOnlyLeaf) {
if (data.userId && !data.isParty) {
this.userList.push(data)
}
} else {
const isExist = this.userList.findIndex(i => i.userId === data.userId) > -1
!isExist && this.userList.push(data)
}
} else {
this.userList.push(data)
// let index = this.userList.indexOf(data)
let index = this.userList.findIndex(i => i.userId === data.userId)
index > -1 && this.userList.splice(index, 1)
}
} else {
let index = this.userList.indexOf(data)
// console.log(data, checked, indeterminate);
},
// 确 定
submit () {
this.Pvisible = false
this.$emit('success', [...this.userList])
},
// 取消选择
cancle (key) {
this.$refs.tree.setChecked(key, false)
let index = this.userList.findIndex(i => i.userId === key)
index > -1 && this.userList.splice(index, 1)
}
// console.log(data, checked, indeterminate);
},
// 确 定
submit() {
this.Pvisible = false
this.$emit('success', this.userList)
let order = this.defaultValues.findIndex(i => i.userId === key)
order > -1 && this.defaultValues.splice(order, 1)
},
},
// 取消选择
cancle(key) {
this.$refs.tree.setChecked(key, false)
}
}
}
</script>
setChecked
<template>
<el-dialog :title="title" :visible.sync="Pvisible" :close-on-click-modal="false">
<el-dialog :title="title" :visible.sync="Pvisible" :destroy-on-close="destroyOnClose">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="12" :xs="24">
<div class="head-container">
<!-- <div>部门架构</div> -->
<!-- :filter-node-method="filterNode" -->
<el-tree
node-key="key"
ref="tree"
lazy
accordion
show-checkbox
:check-on-click-node="false"
:expand-on-click-node="true"
:load="loadNode"
:props="defaultProps"
:default-checked-keys="defaultCheckedKeys"
:check-strictly="!isOnlyLeaf"
@check-change="handleCheckChange"
></el-tree>
<el-tree node-key="userId" ref="tree" lazy accordion show-checkbox :check-on-click-node="false" :expand-on-click-node="true" :default-checked-keys="defaultCheckedKeys" :load="loadNode" :props="defaultProps" :check-strictly="!isOnlyLeaf" @check-change="handleCheckChange"></el-tree>
</div>
</el-col>
<!--用户数据-->
<el-col :span="12" :xs="24" class="user-list">
<el-row :gutter="10">选择人员列表</el-row>
<el-row v-for="(item, index) in userList" :key="index">
<i class="el-icon-user-solid"></i>
{{ item.name }}
<i class="el-icon-minus fr cp" title="取消选择" @click="cancle(item.key)"></i>
<i class="el-icon-minus fr cp" title="取消选择" @click="cancle(item.userId)"></i>
</el-row>
</el-col>
</el-row>
......@@ -182,9 +189,9 @@ setChecked
</template>
<style lang="scss" scoped>
.user-list {
.el-row {
line-height: 26px;
.user-list {
.el-row {
line-height: 26px;
}
}
}
</style>
......@@ -402,7 +402,7 @@
/** 获取欢迎语列表 */
getWelList () {
this.welLoading = true
getList(this, this.welQuery).then(({ rows }) => {
getList(this.welQuery).then(({ rows }) => {
this.welList = rows
this.$refs.table.$forceUpdate()
this.welLoading = false
......
......@@ -199,7 +199,7 @@
weEmpleCodeUseScops: [],
empleCodeRosterDto: [
{
type: 1,
type: 0,
weEmpleCodeUseScops: [], // 员工
weekday: [1, 2, 3, 4, 5, 6, 7], // 周期
qrRuleType: 2,
......@@ -590,7 +590,7 @@
this.codeForm.empleCodeRosterDto.push({
weEmpleCodeUseScops: [], // 员工
weekday: [], // 周期
type: 2,
type: 1,
startDate: '', // 开始时间
endDate: '', // 结束时间
})
......@@ -630,9 +630,8 @@
}
myObj.attachments.push(...data.materialMsgList)
if (this.codeForm.qrRuleType === 1) {
console.log(this.codeForm)
let obj = {
type: 1,
type: 0,
scopeId: this.codeForm.weEmpleCodeUseScops[0].scopeId ? this.codeForm.weEmpleCodeUseScops[0].scopeId : '',
userIds: this.codeForm.weEmpleCodeUseScops.map(dd => dd.businessId)
}
......
......@@ -230,7 +230,7 @@
methods: {
editFn () {
this.$router.push({
path: '/wechat/drainageCode/staff/' + 'add',
path: '/drainageCode/' + 'staffAdd',
query: {
id: this.form.id
}
......
......@@ -14,7 +14,7 @@
<div class="item-list">
<div class="item" :class="{'active': groupIndex == key}" v-for="(group, key) in groupList" :key="group.id" @click="switchGroup(key, group)">
<div class="name">{{ group.name }}</div>
<el-dropdown v-if="groupIndex == key" class="dropdown" @command="onGroupCommand($event, group)">
<el-dropdown v-if="groupIndex == key && group.flag === 0" class="dropdown" @command="onGroupCommand($event, group)">
<span class="dot">
<!-- <img :src="require('@/assets/drainageCode/more.png')" alt=""> -->
<i class="el-icon-more"></i>
......@@ -177,6 +177,8 @@
groupId: '',
qrName: '', // 活码名称
qrUserName: undefined,
orderByColumn: 'wqc.create_time',
isAsc: 'desc'
},
userArray: [], // 选择人员
userArrayStr: "",
......
......@@ -41,9 +41,13 @@
computed: {},
created () {
this.form.id = this.$route.query.id
let data = JSON.parse(localStorage.getItem('obj'))
this.form = Object.assign(this.form, data)
this.form.welcomeMsgTplType = this.form.welcomeMsgTplType.toString()
if (this.form.id) {
let data = JSON.parse(localStorage.getItem('obj'))
this.form = Object.assign(this.form, data)
this.form.welcomeMsgTplType = this.form.welcomeMsgTplType.toString()
} else {
this.form.welcomeMsgTplType = this.$route.query.welcomeMsgTplType
}
this.name = this.form.welcomeMsgTplType === '1' ? '活码' : this.form.welcomeMsgTplType === '2' ? '员工' : '入群'
this.type = this.form.id ? '编辑' : '新建'
this.$route.meta.title = (this.form.id ? '编辑' : '新建') + '欢迎语'
......
......@@ -24,6 +24,7 @@
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="欢迎语" align="center" prop="welcomeMsg" min-width="250" show-overflow-tooltip/>
<el-table-column v-if="type === '2'" label="员工" prop="userNames" align="center"></el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
......@@ -148,11 +149,11 @@
goRoute (data) {
let query = {}
if (data) {
localStorage.setItem('obj', JSON.stringify(data))
query.id = data.id
} else {
query.welcomeMsgTplType = this.type
}
localStorage.setItem('obj', JSON.stringify(data))
this.$router.push({
path: '/drainageCode/welcomeAdd',
query: query
......
......@@ -6,8 +6,8 @@
<el-step title="群发内容"></el-step>
</el-steps>
</div>
<div v-if="currentActive === 1">
<el-form style="width: 60%;" ref="form" :model="form" :rules="rules" label-width="100px">
<div class="g-card g-pad20" v-if="currentActive === 1">
<el-form style="width: 60%;margin:0 auto;" ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="群发类型" required prop="chatType">
<el-radio-group v-model="form.chatType">
<el-radio :label=1>群发客户</el-radio>
......@@ -283,7 +283,6 @@
nextStep () {
this.$refs.form.validate(validate => {
if (!validate) return
if (this.form.chatType === 1) {
let data = {
userIds: '',
......@@ -302,7 +301,11 @@
data.trackState = this.form.trackState
getCustomerList(data).then(res => {
this.form.customerList = res.data
this.currentActive = 2
if (res.data && res.data.length) {
this.currentActive = 2
} else {
this.msgError('未找到可发送客户!')
}
})
} else {
this.currentActive = 2
......
......@@ -168,14 +168,14 @@
},
queryMember: {
userName: '',
msgId: '',
msgTemplateId: '',
pageNum: 1,
pageSize: 10,
status: ''
},
queryCustomer: {
customerName: '',
msgId: '',
msgTemplateId: '',
status: '',
pageNum: 1,
pageSize: 10
......@@ -201,8 +201,8 @@
computed: {},
created () {
this.msgId = this.$route.query.id
this.queryMember.msgId = this.msgId
this.queryCustomer.msgId = this.msgId
this.queryMember.msgTemplateId = this.msgId
this.queryCustomer.msgTemplateId = this.msgId
this.getDetail()
this.getMemberList()
this.getCustomerList()
......
......@@ -14,7 +14,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发送类型" prop="timedTask">
<el-form-item label="发送类型" prop="isTask">
<el-select v-model="query.isTask" placeholder="请选择发送类型" size="mini">
<el-option v-for="(value, key, index) in timedTask" :label="value" :value="key" :key="index">
</el-option>
......@@ -46,8 +46,8 @@
<template slot-scope="scope">
<!-- v-hasPermi="['enterpriseWechat:view']" -->
<el-button size="mini" type="text" @click="goRoute(scope.row.id, 'detail')">详情</el-button>
<el-divider v-if="scope.row.isTask === 1" direction="vertical"></el-divider>
<el-button size="mini" v-if="scope.row.isTask === 1" type="text" @click="cancelSend(scope.row)">取消发送</el-button>
<el-divider v-if="scope.row.isTask === 1 && scope.row.status === 0" direction="vertical"></el-divider>
<el-button size="mini" v-if="scope.row.isTask === 1 && scope.row.status === 0" type="text" @click="cancelSend(scope.row)">取消发送</el-button>
<!-- <el-button v-hasPermi="['enterpriseWechat:edit']" size="mini" type="text" disabled=""
@click="goRoute(scope.row, 1)">编辑</el-button>
<el-button v-hasPermi="['enterpriseWechat:edit']" size="mini" type="text"
......@@ -89,7 +89,9 @@
pageSize: 10,
content: undefined,
chatType: undefined,
isTask: undefined
isTask: undefined,
orderByColumn: 'create_time',
isAsc: 'desc'
},
pushType: {
1: '发给客户',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!