Commit 5b87d7ed by 胡悦

修复bug

1 parent df024a26
......@@ -18,7 +18,7 @@
height: treeHeight + 20 + 'px'
}"
>
<GLTable ref="saleTable" v-loading="loading" :tableData="tableEmpData" :tableParams="tableParams" :hasNum="false" :hasPage="false" @selectionTable="selectionTable">
<GLTable :key="key" ref="saleTable" v-loading="loading" :tableData="tableEmpData" :tableParams="tableParams" :hasNum="false" :hasPage="false" @selectionTable="selectionTable">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" v-show="!group.staffName" @click="selectGroup(scope.scope)">设为群主</el-button>
<el-button type="text" v-show="group.staffName && scope.scope.staffName == group.staffName" @click="cancelGroup">取消群主</el-button>
......@@ -30,12 +30,13 @@
<script>
export default {
name: 'selectEmp',
props: ['selectData'],
props: ['selectData', 'key'],
data() {
return {
treeHeight: 0,
staffName: '',
listTree: [],
isFirst: true,
defaultProps: {
children: 'children',
label: 'departmentName'
......@@ -75,45 +76,58 @@ export default {
}
},
watch: {
selectData(val) {
console.log(this.group)
console.log(val)
if (val.length == 0) {
this.clearSelection()
} else {
val.forEach(i => {
const row = this.getEmployee(this.listTree).find(j => j.staffId == i.staffId)
console.log(row)
this.clearSelect(row)
// if (i.masterStatus == 1) this.group = i
})
}
selectData: {
handler(val) {
console.log(this.group)
console.log(val)
if (val.length == 0) {
this.clearSelection()
} else {
this.$nextTick(() => {
val.forEach(i => {
const row = this.getEmployee(this.listTree).find(j => j.staffId == i.staffId)
console.log(row)
this.clearSelect(row)
})
})
this.group = val.find(i => i.masterStatus == 1)
}
},
immediate: true
}
},
methods: {
selectionTable(val) {
console.log(val, this.group)
console.log(val, this.group, this.isFirst)
this.$emit('selectTable', val)
this.allGroup = val
const hasGroup = val.find(item => item.staffId == this.group.staffId)
if (!hasGroup) {
this.cancelGroup()
}
// if (val && !this.isFirst) {
// val.forEach(i => {
// const row = this.getEmployee(this.listTree).find(j => j.staffId == i.staffId)
// console.log(row)
// this.clearSelect(row)
// })
// }
},
listDepartmentTree() {
this.$apis.groupGuest.listDepartmentTree({ merchantId: 10001001, addChildrensFlag: true }).then(res => {
this.listTree = res
this.loading = false
this.isFirst = false
this.listTree[0].entmicroStaffResponses = this.getEmployee(this.listTree)
console.log(this.listTree, this.selectData)
this.currentArr = this.$common.utils.deepClone(this.listTree[0].entmicroStaffResponses)
this.selectData.forEach(i => {
const row = this.getEmployee(this.listTree).find(j => j.staffId == i.staffId)
console.log(row)
this.clearSelect(row)
// if (i.masterStatus == 1) this.group = i
})
this.gruop = this.selectData.find(i => i.masterStatus == 1)
this.$nextTick(() => {
this.selectData.forEach(i => {
const row = this.getEmployee(this.listTree).find(j => j.staffId == i.staffId)
console.log(row)
this.clearSelect(row)
})
document.getElementsByClassName('el-tree-node__expand-icon')[0].click()
document.getElementsByClassName('el-tree-node__content')[0].click()
if (this.selectData.find(i => i.masterStatus == 1)) {
......@@ -135,12 +149,15 @@ export default {
this.currentArr = this.$common.utils.deepClone(data.entmicroStaffResponses)
// this.listEntmicroStaff()
},
selectGroup(data) {
selectGroup(data, flag = false) {
console.log(data)
this.group = data
const obj = this.allGroup.find(item => item.staffId == data.staffId)
if (!obj) this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(data)
this.$emit('group', this.group)
// 标识是否从父组件修改
if (!flag) {
const obj = this.allGroup.find(item => item.staffId == data.staffId)
if (!obj) this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(data)
this.$emit('group', this.group)
}
},
cancelGroup() {
this.group = {}
......@@ -160,32 +177,27 @@ export default {
return arr
},
searchTable(search) {
const arr = []
this.currentArr.forEach(item => {
console.log(item.staffName.indexOf(search) != -1)
if (item.staffName.indexOf(search) != -1) {
console.log(item)
arr.push(item)
}
})
let arr = []
if (search) {
this.currentArr.forEach(item => {
console.log(item.staffName.indexOf(search) != -1)
if (item.staffName.indexOf(search) != -1) {
console.log(item)
arr.push(item)
}
})
} else {
arr = this.$common.utils.deepClone(this.listTree[0].entmicroStaffResponses)
}
this.tableEmpData = arr
}
// listEntmicroStaff(staffName) {
// let params = {
// departmentId: this.departmentId,
// staffName: staffName ? staffName : this.staffName,
// merchantid: this.$globalState.session.merchantId
// }
// this.$apis.emp.listEntmicroStaff(params).then(res => {
// this.tableEmpData = res
// })
// }
},
created() {
this.listDepartmentTree()
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.treeHeight = clientHeight - 800
this.listDepartmentTree()
console.log(this.selectData, '.....')
}
}
......
......@@ -13,7 +13,7 @@
</div>
<div>
<div class="select-sale-panel">
<select-emp :selectData.sync="selectData" @group="handlGroup" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<select-emp :key="key" :selectData.sync="selectData" @group="handlGroup" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<div class="popper__arrow"></div>
</div>
</div>
......@@ -28,7 +28,7 @@
import selectEmp from './selectEmp.vue'
export default {
name: 'SelectMembers',
props: ['selectData'],
props: ['selectData', 'key'],
components: {
selectEmp
},
......@@ -79,25 +79,20 @@ export default {
console.log(this.newTag)
this.$refs.selectEmpTabel.searchTable(this.newTag)
},
handlGroup(val) {
console.log(val)
resetSearch() {
this.newTag = ''
this.$refs.selectEmpTabel.searchTable()
},
handlGroup(val, flag = false) {
console.log(val, '=-=-=-=-=')
this.group = val
// 标识从父组件修改
if (flag) {
this.$refs.selectEmpTabel.selectGroup(val, true)
}
},
cancelGroup() {
this.$refs.selectEmpTabel.cancelGroup()
},
onSubmit() {
if (this.innerTags.length == 0) {
this.$message({
message: '请选择成员',
type: 'error'
})
return
}
let userIds = []
this.innerTags.forEach(item => {
userIds.push(item.userId)
})
}
}
}
......
......@@ -323,11 +323,13 @@ export default {
updateList(val) {
this.previewList = val
this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1)
if (obj) {
this.text = obj.attContent
} else {
this.text = ''
if (val) {
const obj = val.find(item => item.attType == 1)
if (obj) {
this.text = obj.attContent
} else {
this.text = ''
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!