Commit 2caec486 by 胡悦

修复bug

1 parent 08b85a68
...@@ -528,7 +528,7 @@ export default { ...@@ -528,7 +528,7 @@ export default {
// 删除人群 // 删除人群
removeCrowd(item, index) { removeCrowd(item, index) {
this.basicForm.crowdList.splice(index, 1) this.basicForm.crowdList.splice(index, 1)
this.$refs.selectCrowd.remove(item) // this.$refs.selectCrowd.remove(item)
this.getCrowdData(this.basicForm.crowdList) this.getCrowdData(this.basicForm.crowdList)
if (!this.basicForm.crowdList.length) { if (!this.basicForm.crowdList.length) {
this.basicForm.userList = [] this.basicForm.userList = []
...@@ -687,6 +687,14 @@ export default { ...@@ -687,6 +687,14 @@ export default {
this.isUpdate = true this.isUpdate = true
this.editStatus = true this.editStatus = true
}) })
} else {
this.basicForm.userList = []
this.basicForm.crowdList = []
this.selectData = []
this.isSelectCrowd = false
this.isUpdate = true
this.editStatus = true
this.key = new Date()
} }
} }
} }
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
previewList(val) { previewList(val) {
if (val.length && val[0].attType == 1) { if (val.length && val[0].attType == 1) {
const attContent = val[0].attContent const attContent = val[0].attContent
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function (res) { const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '') let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity) const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1 let index = parseInt(list.indexOf(word)) + 1
...@@ -128,14 +128,17 @@ export default { ...@@ -128,14 +128,17 @@ export default {
word-break: break-all; word-break: break-all;
display: flex; display: flex;
img { img {
width: 20px; width: 16px;
height: 20px; height: 16px;
vertical-align: middle;
} }
} }
.text { .text {
display: inline-block; display: inline-block;
font-size: 16px; font-size: 12px;
padding: 8px 11px; padding: 8px 11px;
line-height: 16px;
white-space: pre-wrap;
} }
.preview-link { .preview-link {
display: inline-flex; display: inline-flex;
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-05-24 18:18:53 * @Date: 2022-05-24 18:18:53
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-13 16:51:03 * @LastEditTime: 2022-06-14 18:31:20
--> -->
<template> <template>
<div> <div>
<el-dialog :title="'人群筛选'" :width="'1080px'" :visible.sync="crowdVisible"> <el-dialog :title="'人群筛选'" :width="'1080px'" :visible.sync="crowdVisible" v-if="crowdVisible">
<div class="member-wrapper"> <div class="member-wrapper">
<div class="member-left"> <div class="member-left">
<div class="member-title"> <div class="member-title">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</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>
...@@ -97,7 +97,7 @@ export default { ...@@ -97,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
...@@ -122,47 +122,103 @@ export default { ...@@ -122,47 +122,103 @@ export default {
this.$apis.customerTransform.queryCrowdtree(params).then(res => { this.$apis.customerTransform.queryCrowdtree(params).then(res => {
this.tableData = res.crowdUnitList this.tableData = res.crowdUnitList
this.tableTotal = res.total this.tableTotal = res.total
console.log(this.inner) // console.log(this.inner)
console.log(this.tableData) // console.log(this.tableData)
this.tableData.forEach(item => { // this.tableData.forEach(item => {
this.inner.forEach((itm, index) => { // this.inner.forEach((itm, index) => {
if (itm.crowdId == item.crowdId) { // if (itm.crowdId == item.crowdId) {
this.rowClick(item) // this.rowClick(item)
} // }
}) // })
}) // })
this.recoverySelected()
}) })
}, },
beforeSearchFn() { // selectionTable(val) {
return new Promise(resolve => { // this.innerTags = []
Object.assign(this.searchForm.req, {}) // for (let i = 0; i < val.length; i++) {
resolve() // 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)
}
}) })
}, },
selectionTable(val) {
this.innerTags = [] // 恢复选择
for (let i = 0; i < val.length; i++) { addSelected() {
console.log(i) this.$nextTick(() => {
const tagArr = this.innerTags.map(item => item.crowdId) var list = JSON.parse(JSON.stringify(this.innerTags))
if (!tagArr.includes(val[i].crowdId)) { if (list && list.length) {
this.innerTags.push(val[i]) 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)
}
})
} }
})
},
recoverySelected() {
// 翻页,去掉已选项
var selectedData = this.$refs.crowdTable.mutiSelectArr.crowdlist
var deleteList = []
this.addSelected()
if (selectedData) {
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) {
console.log(this.$refs.crowdTable)
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row) this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row)
}, },
search() { search() {
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 = { req: {} } this.searchForm = { keyword: {} }
} }
} }
} }
...@@ -197,7 +253,7 @@ export default { ...@@ -197,7 +253,7 @@ export default {
/deep/ { /deep/ {
.el-table { .el-table {
height: 40vh; // height: 40vh;
overflow-y: auto; overflow-y: auto;
} }
} }
...@@ -207,7 +263,7 @@ export default { ...@@ -207,7 +263,7 @@ export default {
} }
.table-content { .table-content {
max-height: 456px; max-height: 500px;
overflow: auto; overflow: auto;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
...@@ -297,6 +353,7 @@ export default { ...@@ -297,6 +353,7 @@ export default {
.el-dialog__close { .el-dialog__close {
width: 24px; width: 24px;
height: 24px; height: 24px;
font-size: 24px;
} }
} }
.el-pagination { .el-pagination {
......
...@@ -335,11 +335,12 @@ export default { ...@@ -335,11 +335,12 @@ export default {
-webkit-user-modify: read-only !important; -webkit-user-modify: read-only !important;
} }
img { img {
width: 24px; width: 18px;
height: 24px; height: 18px;
-webkit-user-select: none; -webkit-user-select: none;
cursor: default; cursor: default;
pointer-events: none; pointer-events: none;
vertical-align: middle;
} }
.active { .active {
background: #dcdfe6; background: #dcdfe6;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!