Commit 47c5c539 by 王志慧

commit

1 parent ba28ed77
...@@ -336,9 +336,9 @@ export default { ...@@ -336,9 +336,9 @@ export default {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
max-width: 200px; max-width: 200px;
text-overflow: ellipsis; // text-overflow: ellipsis;
overflow: hidden; // overflow: hidden;
white-space: nowrap; // white-space: nowrap;
} }
.el-tree-node__expand-icon { .el-tree-node__expand-icon {
color: #5850ff; color: #5850ff;
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-05-24 18:18:53 * @Date: 2022-05-24 18:18:53
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-05-31 10:41:36 * @LastEditTime: 2022-06-14 18:21:41
--> -->
<template> <template>
<div> <div>
<el-dialog :title="'人群筛选'" :visible.sync="crowdVisible"> <el-dialog :title="'人群筛选'" :width="'1080px'" :visible.sync="crowdVisible" v-if="crowdVisible">
<div class="member-wrapper" v-loading="crowdLoading"> <div class="member-wrapper">
<div class="member-left"> <div class="member-left">
<div class="member-title"> <div class="member-title">
人群列表 人群列表
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
<div class="member-content"> <div class="member-content">
<el-form :inline="true" class="member-form" :model="searchForm" @submit.native.prevent> <el-form :inline="true" class="member-form" :model="searchForm" @submit.native.prevent>
<el-form-item label="人群名称" style="margin-bottom: 0" size="small"> <el-form-item label="人群名称" style="margin-bottom: 0" size="small">
<el-input :size="size" v-model.trim="searchForm.keyword" @keyup.enter.native="search" placeholder="请输入关键字搜索"></el-input> <el-input :size="size" v-model.trim="searchForm.keyword" @keyup.enter.native="search" clearable placeholder="请输入关键字搜索"></el-input>
</el-form-item> </el-form-item>
<el-form-item label style="margin-bottom: 0;margin-left:10px" size="small"> <el-form-item label style="margin-bottom: 0;margin-left:10px" size="small">
<el-button type="primary" :size="size" @click="search">搜索</el-button> <el-button type="primary" :size="size" @click="search">搜索</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="table-content"> <div class="table-content">
<GLTable v-loading="loading" ref="crowdTable" :tableData="tableData" @refreshTable="search" :tableTotal="tableTotal" :layout="layout" :tableParams="crowdTableParams" :hasNum="true" :pageConf="pageConf" :noDataImg="url" @selectionTable="selectionTable" @row-click="rowClick"></GLTable> <GLTable v-loading="loading" ref="crowdTable" :tableData="tableData" @refreshTable="search" :tableTotal="tableTotal" :layout="layout" :tableParams="crowdTableParams" :hasNum="true" :pageConf="pageConf" :noDataImg="url" @selectionTable="handleSelectionTable" @row-click="rowClick"></GLTable>
</div> </div>
</div> </div>
</div> </div>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<div class="member-name">人群({{ innerTags.length }}项)</div> <div class="member-name">人群({{ innerTags.length }}项)</div>
<div class="input-tag-wrapper"> <div class="input-tag-wrapper">
<div class="tag-box"> <div class="tag-box">
<el-tag v-for="(tag, idx) in innerTags" :key="idx" type="info" closable :disable-transitions="false" @close="remove(tag)"> <el-tag v-for="(tag, idx) in innerTags" :key="idx" type="info" closable :disable-transitions="false" @close="remove(tag, idx)">
{{ tag.crowdName }} {{ tag.crowdName }}
</el-tag> </el-tag>
</div> </div>
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="crowdVisible = false">取 消</el-button> <el-button style="width: 68px;" size="small" @click="crowdVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click.native="handleConfirm">确 定</el-button> <el-button style="width: 68px;" size="small" type="primary" @click.native="handleConfirm">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
...@@ -55,7 +55,6 @@ export default { ...@@ -55,7 +55,6 @@ export default {
return { return {
url: 0, url: 0,
crowdVisible: false, crowdVisible: false,
crowdLoading: false,
searchForm: { keyword: '' }, searchForm: { keyword: '' },
innerTags: [], innerTags: [],
inner: [], inner: [],
...@@ -84,7 +83,9 @@ export default { ...@@ -84,7 +83,9 @@ export default {
}, },
{ {
label: '人群描述', label: '人群描述',
prop: 'crowdDesc' prop: 'crowdDesc',
width: '200',
line: 1
}, },
{ {
label: '人数', label: '人数',
...@@ -96,7 +97,7 @@ export default { ...@@ -96,7 +97,7 @@ export default {
}, },
methods: { methods: {
init(val) { init(val) {
console.log(val) // console.log(val)
this.inner = this.$common.utils.deepClone(val) this.inner = this.$common.utils.deepClone(val)
this.innerTags = this.$common.utils.deepClone(val) this.innerTags = this.$common.utils.deepClone(val)
this.crowdVisible = true this.crowdVisible = true
...@@ -108,7 +109,6 @@ export default { ...@@ -108,7 +109,6 @@ export default {
}) })
}, },
getCrowdList() { getCrowdList() {
this.crowdLoading = true
var params = { var params = {
req: { req: {
keyword: this.searchForm.keyword, keyword: this.searchForm.keyword,
...@@ -122,42 +122,103 @@ export default { ...@@ -122,42 +122,103 @@ export default {
this.$apis.channel.queryCrowdtree(params).then(res => { this.$apis.channel.queryCrowdtree(params).then(res => {
this.tableData = res.crowdUnitList this.tableData = res.crowdUnitList
this.tableTotal = res.total this.tableTotal = res.total
this.tableData.forEach(item => { // console.log(this.inner)
this.inner.forEach((itm, index) => { // console.log(this.tableData)
if (itm.crowdId == item.crowdId) { // this.tableData.forEach(item => {
this.rowClick(item) // this.inner.forEach((itm, index) => {
// if (itm.crowdId == item.crowdId) {
// this.rowClick(item)
// }
// })
// })
this.recoverySelected()
})
},
// selectionTable(val) {
// this.innerTags = []
// for (let i = 0; i < val.length; i++) {
// const tagArr = this.innerTags.map(item => item.crowdId + '')
// console.log(tagArr)
// if (!tagArr.includes(val[i].crowdId)) {
// this.innerTags.push(val[i])
// }
// console.log(this.innerTags)
// }
// },
// 选择/取消
handleSelectionTable(val) {
var list = JSON.parse(JSON.stringify(this.innerTags))
this.innerTags = []
val.forEach(item => {
if (this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
} }
}) })
list.forEach(item => {
if (this.tableData.findIndex(k => k.crowdId == item.crowdId) == '-1' && this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
}
}) })
},
// 恢复选择
addSelected() {
this.$nextTick(() => { this.$nextTick(() => {
this.crowdLoading = false var list = JSON.parse(JSON.stringify(this.innerTags))
if (list && list.length) {
list.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], true)
}
}) })
}
}) })
}, },
selectionTable(val) { recoverySelected() {
console.log(val) // 翻页,去掉已选项
this.innerTags = [] var selectedData = this.$refs.crowdTable.mutiSelectArr.crowdlist
for (let i = 0; i < val.length; i++) { var deleteList = []
const tagArr = this.innerTags.map(item => item.crowdId) this.addSelected()
if (!tagArr.includes(val[i].crowdId)) { if (selectedData) {
this.innerTags.push(val[i]) selectedData.forEach(item => {
if (this.innerTags.findIndex(subItem => subItem.crowdId == item.crowdId) == -1) {
deleteList.push(item)
}
})
this.deleteSelected(deleteList)
} }
},
// 删除选中
deleteSelected(deleteList) {
this.$nextTick(() => {
deleteList.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], false)
} }
})
})
}, },
remove(item) { remove(item) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(item) var idx = this.innerTags.findIndex(k => k.crowdId == item.crowdId)
this.innerTags.splice(idx, 1)
if (this.tableData.map(k => k.crowdId).includes(item.crowdId)) {
var i = this.tableData.findIndex(k => k.crowdId == item.crowdId)
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[i])
}
}, },
rowClick(row) { rowClick(row) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row) this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row)
}, },
search() { search() {
this.inner = this.$common.utils.deepClone(this.innerTags)
this.getCrowdList() this.getCrowdList()
}, },
handleConfirm() { handleConfirm() {
// console.log(this.innerTags)
this.$emit('crowdData', this.innerTags) this.$emit('crowdData', this.innerTags)
this.crowdVisible = false this.crowdVisible = false
this.searchForm.keyword = '' this.searchForm = { keyword: {} }
} }
} }
} }
...@@ -166,12 +227,14 @@ export default { ...@@ -166,12 +227,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.member-wrapper { .member-wrapper {
display: flex; display: flex;
.member-title { .member-title {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
font-weight: 600; font-weight: 500;
line-height: 22px; line-height: 22px;
margin-bottom: 6px; margin-bottom: 6px;
span { span {
display: inline-block; display: inline-block;
padding-left: 5px; padding-left: 5px;
...@@ -180,35 +243,42 @@ export default { ...@@ -180,35 +243,42 @@ export default {
font-weight: 500; font-weight: 500;
} }
} }
.member-left { .member-left {
width: 800px; width: 800px;
.member-content { .member-content {
border: 1px solid #eee; border: 1px solid #eee;
padding-bottom: 20px; padding-bottom: 20px;
/deep/ { /deep/ {
.el-table { .el-table {
height: 40vh; // height: 40vh;
overflow-y: auto; overflow-y: auto;
} }
} }
.member-form { .member-form {
padding: 10px 20px; padding: 10px 20px;
} }
.table-content { .table-content {
max-height: 456px; max-height: 500px;
overflow: auto; overflow: auto;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
} }
.member-checked { .member-checked {
text-align: right; text-align: right;
margin-top: 10px; margin-top: 10px;
} }
} }
.member-right { .member-right {
width: 286px; width: 286px;
margin-left: 14px; margin-left: 14px;
.member-name { .member-name {
font-size: 14px; font-size: 14px;
color: #333; color: #333;
...@@ -218,10 +288,12 @@ export default { ...@@ -218,10 +288,12 @@ export default {
} }
} }
} }
.tag-box { .tag-box {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.input-tag-wrapper { .input-tag-wrapper {
position: relative; position: relative;
font-size: 14px; font-size: 14px;
...@@ -239,24 +311,28 @@ export default { ...@@ -239,24 +311,28 @@ export default {
align-items: center; align-items: center;
max-height: 500px; max-height: 500px;
overflow: auto; overflow: auto;
// margin-bottom: 10px; // margin-bottom: 10px;
i { i {
color: #75acff; color: #75acff;
margin-right: 3px; margin-right: 3px;
font-size: 14px; font-size: 14px;
} }
/deep/ input { /deep/ input {
/* input { */ /* input { */
/* background-color: red!important; 调试用的样式 */ /* background-color: red!important; 调试用的样式 */
outline: none !important; outline: none !important;
border: none !important; border: none !important;
} }
/deep/ .el-input { /deep/ .el-input {
min-width: 150px; min-width: 150px;
width: auto; width: auto;
flex: 1; flex: 1;
} }
} }
.el-tag { .el-tag {
margin-right: 10px; margin-right: 10px;
line-height: 22px; line-height: 22px;
...@@ -264,7 +340,28 @@ export default { ...@@ -264,7 +340,28 @@ export default {
height: 24px; height: 24px;
background: #fafbfe !important; background: #fafbfe !important;
} }
/deep/.el-dialog__title {
/deep/ {
.el-dialog__title {
font-weight: 600; font-weight: 600;
}
.el-dialog__header {
padding: 20px;
}
.el-dialog__headerbtn {
height: 30px;
.el-dialog__close {
width: 24px;
height: 24px;
}
}
.el-pagination {
padding-left: 20px;
border-top: 1px solid #e8e8ea;
padding-top: 16px;
}
.el-table:before {
display: none;
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!