Commit 8c1a3046 by 前端

commit

1 parent bc718d23
...@@ -20,7 +20,7 @@ export const fetchConfig = function (isEnv = true) { ...@@ -20,7 +20,7 @@ export const fetchConfig = function (isEnv = true) {
// } // }
//return window.fetch('https://', {}).then(res => res.json()) //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' }) // 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 = { export const config = {
install(vue, cfg) { install(vue, cfg) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div class="input-tag-wrapper"> <div class="input-tag-wrapper">
<div class="tag-box"> <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 }} {{ label.name }}
</el-tag> </el-tag>
</div> </div>
...@@ -42,6 +42,7 @@ export default { ...@@ -42,6 +42,7 @@ export default {
isIndeterminate: false, isIndeterminate: false,
checkAll: false, checkAll: false,
ids: [], ids: [],
selectIds: [],
expandedKeys: [], expandedKeys: [],
defaultIds: [], defaultIds: [],
departmentList: [], departmentList: [],
...@@ -80,7 +81,7 @@ export default { ...@@ -80,7 +81,7 @@ export default {
this.handleNodeClick() this.handleNodeClick()
}, },
handleCheckAllChange(val) { handleCheckAllChange(val) {
console.log(val) console.log(this.ids)
val ? this.$refs.tree.setCheckedKeys(this.ids) : this.$refs.tree.setCheckedKeys([]) val ? this.$refs.tree.setCheckedKeys(this.ids) : this.$refs.tree.setCheckedKeys([])
this.handleNodeClick() this.handleNodeClick()
this.isIndeterminate = false this.isIndeterminate = false
...@@ -102,7 +103,7 @@ export default { ...@@ -102,7 +103,7 @@ export default {
let data = await this.$apis.battle.getlistDepartmentTree(params) let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = [] this.ids = []
this.departmentList = data this.departmentList = data
this.initData(this.departmentList) await this.initData(this.departmentList)
this.expandedKeys = [this.departmentList[0].id] this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => { this.$nextTick(() => {
if (this.selectlist.length > 0) { if (this.selectlist.length > 0) {
...@@ -113,69 +114,59 @@ export default { ...@@ -113,69 +114,59 @@ export default {
initData(data) { initData(data) {
data.forEach((item, index) => { data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName) this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
const entmicroStaffResponses = item.entmicroStaffResponses || [] let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses.forEach(staff => { entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) { if (staff.staffName) {
this.$set(staff, 'name', staff.staffName) this.$set(staff, 'name', staff.staffName)
} else { } else {
this.$set(staff, 'name', staff.departmentName) 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 || [] let child = this.$common.utils.deepClone(item.children) || []
child.forEach(staff => { child = child.filter((staff, idx) => {
if (staff.staffName) { if (staff.staffName) {
console.log(staff.staffName)
this.$set(staff, 'name', staff.staffName) this.$set(staff, 'name', staff.staffName)
} else { } else {
this.$set(staff, 'name', staff.departmentName) 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] const children = [...child, ...entmicroStaffResponses]
item.children = children item.children = children
//清除没有员工的部门 //清除没有员工的部门
if (item.children.length == 0 && item.entmicroStaffResponses === null) { if (!item.staffName && item.entmicroStaffResponses === null) {
// console.log(item, item.entmicroStaffResponses)
data.splice(index, 1) 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) { filterNode(value, data) {
if (!value) return true if (!value) return true
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
search() {}, search() {},
handleNodeClick() { 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.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length
this.checkAll = this.userList.length === this.ids.length this.checkAll = this.userList.length === this.ids.length
}, },
remove(index) { remove(index) {
this.userList.splice(index, 1) 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.$refs.tree.setCheckedKeys(ids)
this.isIndeterminate = ids.length < this.ids.length 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!