配置easycom,目前页面中因为需要用到getName方法,所以先不使用

This commit is contained in:
砂糖
2025-07-16 11:49:57 +08:00
parent da226892fa
commit 62ef81065c
4 changed files with 148 additions and 71 deletions

View File

@@ -0,0 +1,67 @@
<template>
<uni-data-select
v-model="innerValue"
:localdata="projectOptions"
:placeholder="placeholder"
:clear="clear"
:filterable="filterable"
@change="onChange"
/>
</template>
<script>
import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
import { listProject } from '@/api/oa/project'
export default {
name: 'OaProjectSelect',
components: { uniDataSelect },
props: {
value: [String, Number],
placeholder: {
type: String,
default: '请选择项目'
},
clear: {
type: Boolean,
default: true
},
filterable: {
type: Boolean,
default: true
}
},
data() {
return {
projectOptions: [],
innerValue: this.value
}
},
watch: {
value(val) {
this.innerValue = val
},
innerValue(val) {
this.$emit('input', val)
this.$emit('update:value', val)
this.$emit('change', val)
}
},
mounted() {
this.getProjectOptions()
},
methods: {
getProjectOptions() {
listProject().then(res => {
this.projectOptions = (res.rows || []).map(item => ({
text: item.projectName,
value: item.projectId
}))
})
},
onChange(val) {
this.innerValue = val
}
}
}
</script>

View File

View File

@@ -350,5 +350,11 @@
"app-plus": {
"bounce": "none"
}
}
},
"easycom": {
"autoscan": true,
"custom": {
"^oa-(.*)": "components/oa/oa-$1/index.vue"
}
}
}

View File

@@ -1,68 +1,66 @@
<template>
<view class="report-schedule">
<!-- 视图切换按钮 -->
<view class="gantt-toggle-bar">
<u-button :type="!showGanttView ? 'primary' : 'default'" size="mini"
@click="showGanttView = false">表格视图</u-button>
<u-button :type="showGanttView ? 'primary' : 'default'" size="mini" @click="showGanttView = true">甘特图视图</u-button>
<!-- header始终显示 -->
<view class="search-bar">
<view class="search-container">
<view class="task-type-button-container">
<view class="task-type-button" @click="openDrawer">
<uni-icons type="settings" color="#2979ff" size="22"></uni-icons>
</view>
<!-- 新增视图切换按钮 -->
<view class="task-type-button" @click="toggleGanttView">
<uni-icons :type="showGanttView ? 'list' : 'calendar'" color="#2979ff" size="22"></uni-icons>
</view>
</view>
<view class="search-input custom-search-input">
<input v-model="searchName" class="input" type="text" placeholder="搜索排产名称" @confirm="onSearch"
@keyup.enter="onSearch" />
<view class="search-icon" @click="onSearch">
<uni-icons type="search" color="#bbb" size="20"></uni-icons>
</view>
<view v-if="searchName" class="clear-icon" @click="onClearSearch">
<uni-icons type="closeempty" color="#bbb" size="18"></uni-icons>
</view>
</view>
<view class="add-button" @click="handleAdd">
<uni-icons type="plusempty" color="#2979ff" size="22"></uni-icons>
</view>
</view>
</view>
<!-- 筛选抽屉 -->
<uni-drawer ref="drawerRef" mode="left" :width="320">
<view class="drawer-content">
<view class="drawer-title">筛选</view>
<view class="drawer-form">
<view class="drawer-form-item">
<text class="drawer-label">项目</text>
<uni-data-select v-model="filterProject" :localdata="projectOptions" placeholder="请选择项目" :clear="true"
filterable />
</view>
<view class="drawer-form-item">
<text class="drawer-label">执行人</text>
<uni-data-select v-model="filterHeader" :localdata="headerOptions" placeholder="请选择执行人" :clear="true"
filterable />
</view>
<view class="drawer-form-item">
<text class="drawer-label">日期</text>
<uni-datetime-picker v-model="filterDateRange" type="daterange" rangeSeparator="至"
start-placeholder="开始日期" end-placeholder="结束日期" :clear-icon="true" style="width:100%" />
</view>
</view>
<view class="drawer-btns">
<button class="drawer-btn-primary" @click="applyFilterAndClose">确定</button>
<button class="drawer-btn" @click="resetFilterAndClose">重置</button>
<button class="drawer-btn" @click="closeDrawer">关闭</button>
</view>
</view>
</uni-drawer>
<!-- 内容区根据showGanttView切换 -->
<gantt v-if="showGanttView" :chart-data="ganttChartData" />
<view v-else>
<!-- 顶栏 -->
<view class="search-bar">
<view class="search-container">
<view class="task-type-button-container">
<view class="task-type-button" @click="openDrawer">
<uni-icons type="list" color="#2979ff" size="22"></uni-icons>
</view>
</view>
<view class="search-input custom-search-input">
<input v-model="searchName" class="input" type="text" placeholder="搜索排产名称" @confirm="onSearch"
@keyup.enter="onSearch" />
<view class="search-icon" @click="onSearch">
<uni-icons type="search" color="#bbb" size="20"></uni-icons>
</view>
<view v-if="searchName" class="clear-icon" @click="onClearSearch">
<uni-icons type="closeempty" color="#bbb" size="18"></uni-icons>
</view>
</view>
<view class="add-button" @click="handleAdd">
<uni-icons type="plusempty" color="#2979ff" size="22"></uni-icons>
</view>
</view>
</view>
<!-- 筛选抽屉 -->
<uni-drawer ref="drawerRef" mode="left" :width="320">
<view class="drawer-content">
<view class="drawer-title">筛选</view>
<view class="drawer-form">
<view class="drawer-form-item">
<text class="drawer-label">项目</text>
<uni-data-select v-model="filterProject" :localdata="projectOptions" placeholder="请选择项目" :clear="true"
filterable />
</view>
<view class="drawer-form-item">
<text class="drawer-label">执行人</text>
<uni-data-select v-model="filterHeader" :localdata="headerOptions" placeholder="请选择执行人" :clear="true"
filterable />
</view>
<view class="drawer-form-item">
<text class="drawer-label">日期</text>
<uni-datetime-picker v-model="filterDateRange" type="daterange" rangeSeparator="至"
start-placeholder="开始日期" end-placeholder="结束日期" :clear-icon="true" style="width:100%" />
</view>
</view>
<view class="drawer-btns">
<button class="drawer-btn-primary" @click="applyFilterAndClose">确定</button>
<button class="drawer-btn" @click="resetFilterAndClose">重置</button>
<button class="drawer-btn" @click="closeDrawer">关闭</button>
</view>
</view>
</uni-drawer>
<!-- 自定义列表右滑菜单uni-ui实现 -->
<scroll-view scroll-y style="height: 100vh;" @scrolltolower="loadMore">
<view v-if="reportScheduleList.length">
@@ -546,6 +544,12 @@ export default {
}
]
}
},
toggleGanttView() {
this.showGanttView = !this.showGanttView;
if (this.showGanttView) {
this.ganttChartData = this.getGanttChartData(this.reportScheduleList);
}
}
}
}
@@ -573,7 +577,18 @@ export default {
}
.task-type-button-container {
position: relative;
display: flex;
gap: 12rpx;
}
.task-type-button {
width: 60rpx;
height: 60rpx;
background-color: transparent;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.search-input {
@@ -609,17 +624,6 @@ export default {
align-items: center;
}
.task-type-button,
.add-button {
width: 60rpx;
height: 60rpx;
background-color: transparent;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.drawer-content {
padding: 32rpx 24rpx 24rpx 24rpx;
}