Commit 5b87d7ed by 胡悦

修复bug

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