From dda603c7d836c9e05a854054fbb4de8297053606 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 19 Apr 2025 01:09:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/js/components/DropdownMenu.vue | 7 +- .../js/pages/manage/components/TaskAdd.vue | 62 +++------- .../js/pages/manage/components/TaskDetail.vue | 114 +++++++----------- .../pages/components/general-operation.scss | 3 + .../sass/pages/components/task-add.scss | 11 -- .../sass/pages/components/task-detail.scss | 24 ---- 6 files changed, 67 insertions(+), 154 deletions(-) diff --git a/resources/assets/js/components/DropdownMenu.vue b/resources/assets/js/components/DropdownMenu.vue index 4a5d0b90d..b60288a9b 100644 --- a/resources/assets/js/components/DropdownMenu.vue +++ b/resources/assets/js/components/DropdownMenu.vue @@ -4,17 +4,18 @@ trigger="click" class="general-operation-dropdown" placement="bottom" - size="small" + :size="size" :style="styles" @command="onCommand" @visible-change="visibleChange">
-
  • +
    • @@ -40,6 +41,7 @@ export default { list: [], // 数据列表: [{label: '', value: ''}] active: '', // 当前选中的值 + size: 'small', // 下拉框大小 activeClick: false, // 当前选中的值是否可以被点击 onUpdate: null, // 选中后的回调函数 scrollHide: true, // 滚动立即隐藏 @@ -82,6 +84,7 @@ export default { } this.list = data.list; this.active = data.active && this.list.find(item => item.value === data.active) ? data.active : ''; + this.size = ['small', 'medium', 'large'].includes(data.size) ? data.size : 'small'; this.activeClick = typeof data.activeClick === "boolean" ? data.activeClick : false; this.onUpdate = typeof data.onUpdate === "function" ? data.onUpdate : null; this.scrollHide = typeof data.scrollHide === "boolean" ? data.scrollHide : true; diff --git a/resources/assets/js/pages/manage/components/TaskAdd.vue b/resources/assets/js/pages/manage/components/TaskAdd.vue index 188d26fa0..b82c827c2 100644 --- a/resources/assets/js/pages/manage/components/TaskAdd.vue +++ b/resources/assets/js/pages/manage/components/TaskAdd.vue @@ -123,32 +123,6 @@ @on-show-change="visibleUserSelectShowChange" border/> - -
      - - -
      - - - {{$L('项目人员')}} -
      -
      - -
      - - - {{$L('任务人员')}} -
      -
      - -
      - - - {{$L('指定成员')}} -
      -
      -
      -
      @@ -575,29 +549,21 @@ export default { this.$emit("input", !this.value) }, - showCisibleDropdown(e){ - let eRect = null - if (e === null) { - eRect = this.$refs.visibilityText?.getBoundingClientRect() - } else { - eRect = e.target.getBoundingClientRect() + showCisibleDropdown(event){ + const list = [ + {label: '项目人员', value: 1}, + {label: '任务人员', value: 2}, + {label: '指定成员', value: 3}, + ]; + this.$store.state.menuOperation = { + event, + list, + size: 'large', + active: this.addData.visibility_appoint, + onUpdate: (value) => { + this.dropVisible(value) + } } - if (eRect === null) { - return - } - const boxRect = this.$el.getBoundingClientRect() - const refEl = this.$refs.eDropdownRef.$el - refEl.style.top = (eRect.top - boxRect.top) + 'px' - refEl.style.left = (eRect.left - boxRect.left) + 'px' - refEl.style.width = eRect.width + 'px' - refEl.style.height = eRect.height + 'px' - // - if (this.$refs.eDropdownRef.visible) { - this.$refs.eDropdownRef.hide() - } - setTimeout(() => { - this.$refs.eDropdownRef.show() - }, 0) }, visibleUserSelectShowChange(isShow){ diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index a51c20f3f..06f9c1f01 100755 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -374,60 +374,6 @@
      - -
      - - -
      - - - {{$L('项目人员')}} -
      -
      - -
      - - - {{$L('任务人员')}} -
      -
      - -
      - - - {{$L('指定成员')}} -
      -
      -
      -
      - -
      - - - {{$L('任务延期')}} - - - {{$L('修改时间')}} - - - {{$L('清除时间')}} - - -
      - -
      - - - {{$L('查看附件')}} - - - {{$L('下载附件')}} - - - {{$L('删除附件')}} - - -
      @@ -1623,7 +1569,9 @@ export default { case 'visible': this.visibleForce = true; this.$nextTick(() => { - this.showCisibleDropdown(null); + this.showCisibleDropdown({ + target: this.$refs.visibilityText + }); }); break; @@ -1963,22 +1911,38 @@ export default { }, 0) }, - showCisibleDropdown(e){ - let eRect = null - if (e === null) { - eRect = this.$refs.visibilityText?.getBoundingClientRect() - } else { - eRect = e.target.getBoundingClientRect() + showCisibleDropdown(event){ + const list = [ + {label: '项目人员', value: 1}, + {label: '任务人员', value: 2}, + {label: '指定成员', value: 3}, + ]; + this.$store.state.menuOperation = { + event, + list, + size: 'large', + active: this.taskDetail.visibility, + onUpdate: (value) => { + this.dropVisible(value) + } } - if (eRect === null) { - return - } - this.showDropdown(this.$refs.eDropdownRef, eRect) }, - showAtDropdown({target}){ + showAtDropdown(event){ this.timeOpen = false - this.showDropdown(this.$refs.eDeadlineRef, target.getBoundingClientRect()) + const list = [ + {label: '任务延期', value: 1}, + {label: '修改时间', value: 2}, + {label: '清除时间', value: 3}, + ]; + this.$store.state.menuOperation = { + event, + list, + size: 'large', + onUpdate: (value) => { + this.dropDeadline(value) + } + } }, visibleUserSelectShowChange(isShow){ @@ -2064,9 +2028,21 @@ export default { }) }, - showFileDropdown(file, {target}){ + showFileDropdown(file, event){ this.operationFile = file - this.showDropdown(this.$refs.eFileRef, target.getBoundingClientRect()) + const list = [ + {label: '查看附件', value: 1}, + {label: '下载附件', value: 2}, + {label: '删除附件', value: 3, className: 'task-calc-warn-text'}, + ]; + this.$store.state.menuOperation = { + event, + list, + size: 'large', + onUpdate: (value) => { + this.dropFile(value) + } + } }, dropFile(command) { diff --git a/resources/assets/sass/pages/components/general-operation.scss b/resources/assets/sass/pages/components/general-operation.scss index e9e8919f7..3e8ff4094 100644 --- a/resources/assets/sass/pages/components/general-operation.scss +++ b/resources/assets/sass/pages/components/general-operation.scss @@ -44,6 +44,9 @@ height: 26px; text-align: right; margin-left: 6px; + display: flex; + justify-content: flex-end; + align-items: center; > i { font-size: 14px; diff --git a/resources/assets/sass/pages/components/task-add.scss b/resources/assets/sass/pages/components/task-add.scss index 871673f86..2d9cc0077 100644 --- a/resources/assets/sass/pages/components/task-add.scss +++ b/resources/assets/sass/pages/components/task-add.scss @@ -95,17 +95,6 @@ } .task-add-form, .task-add-advanced { - .calculate-dropdown { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - width: 0; - height: 0; - z-index: -1; - pointer-events: none; - } .title { .ivu-input { font-weight: 500; diff --git a/resources/assets/sass/pages/components/task-detail.scss b/resources/assets/sass/pages/components/task-detail.scss index 1b6c422d1..c746c126e 100644 --- a/resources/assets/sass/pages/components/task-detail.scss +++ b/resources/assets/sass/pages/components/task-detail.scss @@ -605,30 +605,6 @@ color: $primary-desc-color; } } - - .calculate-dropdown { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - width: 0; - height: 0; - z-index: -1; - pointer-events: none; - .calculate-content { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - width: 100%; - height: 100%; - } - .calculate-text { - color: $flow-status-start-color; - } - } } .upload { display: none;