Commit 8c1a3046 by 前端

commit

1 parent bc718d23
......@@ -20,7 +20,7 @@ export const fetchConfig = function (isEnv = true) {
// }
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
return new Http().get('http://192.168.3.171:7300/mock/6345096902322627d6b83e83/battles/config')
return new Http().get('https://oss-config.glsx.com.cn/mock/635fc7a254298ae78614407a/battles/config')
}
export const config = {
install(vue, cfg) {
......
......@@ -23,7 +23,7 @@
</div>
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="(label, idx) in userList" :key="idx" type="info" closable :disable-transitions="false" @close="remove(ids)">
<el-tag v-for="(label, idx) in userList" :key="idx" type="info" closable :disable-transitions="false" @close="remove(idx)">
{{ label.name }}
</el-tag>
</div>
......@@ -42,6 +42,7 @@ export default {
isIndeterminate: false,
checkAll: false,
ids: [],
selectIds: [],
expandedKeys: [],
defaultIds: [],
departmentList: [],
......@@ -80,7 +81,7 @@ export default {
this.handleNodeClick()
},
handleCheckAllChange(val) {
console.log(val)
console.log(this.ids)
val ? this.$refs.tree.setCheckedKeys(this.ids) : this.$refs.tree.setCheckedKeys([])
this.handleNodeClick()
this.isIndeterminate = false
......@@ -102,7 +103,7 @@ export default {
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.departmentList = data
this.initData(this.departmentList)
await this.initData(this.departmentList)
this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => {
if (this.selectlist.length > 0) {
......@@ -113,69 +114,59 @@ export default {
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
const entmicroStaffResponses = item.entmicroStaffResponses || []
entmicroStaffResponses.forEach(staff => {
let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
this.ids.push(staff.staffId)
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
}
})
const child = item.children || []
child.forEach(staff => {
let child = this.$common.utils.deepClone(item.children) || []
child = child.filter((staff, idx) => {
if (staff.staffName) {
console.log(staff.staffName)
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
this.ids.push(staff.staffId)
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
} else if (staff.entmicroStaffResponses) {
staff.staffId=staff.id
return true
}
})
const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (item.children.length == 0 && item.entmicroStaffResponses === null) {
// console.log(item, item.entmicroStaffResponses)
if (!item.staffName && item.entmicroStaffResponses === null) {
data.splice(index, 1)
}
this.initData(children)
children.length && this.initData(children)
})
},
// transformData(treeData) {
// let children = []
// treeData.forEach((item, index) => {
// if (item.entmicroStaffResponses && item.entmicroStaffResponses.length > 0) {
// children.push({
// staffName: item.departmentName,
// id: item.id,
// children: this.transformData(item.entmicroStaffResponses)
// })
// } else {
// children.push({
// staffName: item.staffName,
// id: item.staffId,
// userId: item.userId,
// staffId: item.staffId
// })
// this.ids.push(item.staffId)
// }
// })
// return children
// },
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
search() {},
handleNodeClick() {
this.userList = this.$refs.tree.getCheckedNodes().filter(item => item.children.length == 0)
this.userList = this.$refs.tree.getCheckedNodes().filter(item => item.children && item.children.length == 0)
this.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length
this.checkAll = this.userList.length === this.ids.length
},
remove(index) {
this.userList.splice(index, 1)
let ids = this.userList.map(item => item.id)
let ids = this.userList.map(item => item.staffId)
this.$refs.tree.setCheckedKeys(ids)
this.isIndeterminate = ids.length < this.ids.length
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!