From 345f6db874dbb0788ab33371d7dd5edfb311764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=99=93=E7=90=AA?= Date: Tue, 20 Sep 2022 16:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=B0=81=E8=A3=85=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=A4=9A=E9=80=89=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/learun-app/organize-picker.vue | 28 +++- .../components/learun-app/organize-tree.vue | 22 ++- .../LearunApp-2.2.0/pages.json | 6 + .../pages/common/select-organize-multiple.vue | 141 ++++++++++++++++++ 4 files changed, 186 insertions(+), 11 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/common/select-organize-multiple.vue diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-picker.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-picker.vue index 97403aaa4..1bf856f2a 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-picker.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-picker.vue @@ -24,7 +24,8 @@ export default { placeholder: {}, readonly: {}, rootId: {}, - rootType: {} + rootType: {}, + multiple: {} }, methods: { @@ -34,16 +35,18 @@ export default { } this.ONCE('select-organize', data => { - this.$emit('input', data.id) - this.$emit('change', data.id) + this.$emit('input', data.id||data.map(t=>t.id).toString()) + this.$emit('change', data.id||data.map(t=>t.id).toString()) }) const rootType = this.rootType || { user: 'department', department: 'company', company: 'company' }[this.type] const rootId = this.rootId - + + let url_ = this.multiple?"select-organize-multiple":"select-organize" + this.SET_PARAM(this.value) const url = rootId - ? `/pages/common/select-organize?type=${this.type}&rootId=${rootId}&rootType=${rootType}` - : `/pages/common/select-organize?type=${this.type}` + ? `/pages/common/${url_}?type=${this.type}&rootId=${rootId}&rootType=${rootType}` + : `/pages/common/${url_}?type=${this.type}` this.NAV_TO(url) } @@ -54,8 +57,17 @@ export default { if (!this.value) { return this.placeholder } - const orgItem = this.GET_GLOBAL(this.type)[this.value] - + + const list = this.GET_GLOBAL(this.type) + + let values = this.value.split(",") + if(values.length>1){ + const orgItems = values.map(t=>list[t].name).toString() + return orgItems + } + + const orgItem = list[this.value] + return orgItem ? orgItem.name : this.placeholder }, diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-tree.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-tree.vue index 125e56741..d1f65275a 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-tree.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/organize-tree.vue @@ -33,7 +33,8 @@ - 选择 + 选择 + 取消选择 @@ -53,6 +54,7 @@ :root="child" :button="button" :level="level" + :value="value" /> @@ -67,7 +69,8 @@ export default { root: { default: () => ({ type: 'company', id: '0' }) }, level: { default: 'user' }, button: {}, - open: { default: true } + open: { default: true }, + value:{}, }, data() { @@ -76,7 +79,8 @@ export default { isLoading: false, isLoadOk: false, isEmpty: false, - children: [] + children: [], + selectIds:[] } }, @@ -87,6 +91,9 @@ export default { methods: { // 组件被创建 async init() { + if(this.value){ + this.selectIds = this.value.split(",") + } // 如果自己是根节点,则创建时直接加载子节点 if (this.open) { await this.loadChildren() @@ -111,6 +118,15 @@ export default { this.loadChildren() }, + + itemClick(root){ + if(this.selectIds.indexOf(root.id) !== -1){ + this.selectIds.splice(this.selectIds.indexOf(root.id),1) + }else{ + this.selectIds.push(root.id) + } + this.$emit('buttonClick', root) + }, // 加载子节点 async loadChildren() { diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json index 4f49600f8..ad510e5b2 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json @@ -153,6 +153,12 @@ "navigationBarTitleText": "选择公司/部门/员工" } }, + { + "path": "pages/common/select-organize-multiple", + "style": { + "navigationBarTitleText": "选择公司/部门/员工" + } + }, { "path": "pages/common/select-layer", "style": { diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/common/select-organize-multiple.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/common/select-organize-multiple.vue new file mode 100644 index 000000000..4051cea59 --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/common/select-organize-multiple.vue @@ -0,0 +1,141 @@ + + + + +