|
|
@@ -3,9 +3,11 @@
|
|
|
<!-- 搜索+筛选栏 -->
|
|
|
<view class="top-box">
|
|
|
<view class="input-item">
|
|
|
- <image class="icon search-icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/search.png" mode="widthFix"></image>
|
|
|
- <input v-model="searchKeywords" @input="handleSearchInput" placeholder="请输入发起人姓名、手机号" placeholder-class="placeholder" />
|
|
|
- </view>
|
|
|
+ <image class="icon search-icon"
|
|
|
+ src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/search.png" mode="widthFix"></image>
|
|
|
+ <input v-model="searchKeywords" @input="handleSearchInput" placeholder="请输入发起人姓名、手机号"
|
|
|
+ placeholder-class="placeholder" />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 顶部选项卡 -->
|
|
|
@@ -20,13 +22,19 @@
|
|
|
<view class="sub-tabs-wrapper">
|
|
|
<!-- 动态子标签 -->
|
|
|
<view class="sub-tabs">
|
|
|
- <view class="sub-tab-item" :class="{ active: currentSubTab === 'all' || currentSubTab === 'taskCreate' }" @click="openSubTabPopup('all')">
|
|
|
- <text>{{ selectedSubTabLabels['all'] || '全部审核' }}</text>
|
|
|
- <image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png" mode="widthFix"></image>
|
|
|
+ <view class="sub-tab-item"
|
|
|
+ :class="{ active: currentSubTab === 'all' || currentSubTab === 'taskCreate' }"
|
|
|
+ @click="openSubTabPopup('all')">
|
|
|
+ <text>{{ selectedSubTabLabels['all'] || '全部审核' }}</text>
|
|
|
+ <image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png"
|
|
|
+ mode="widthFix"></image>
|
|
|
</view>
|
|
|
- <view class="sub-tab-item" :class="{ active: currentSubTab === 'unfinished' || currentSubTab === 'finished' }" @click="openSubTabPopup('unfinished')">
|
|
|
- <text>{{ selectedSubTabLabels['unfinished'] || '最新发起' }}</text>
|
|
|
- <image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png" mode="widthFix"></image>
|
|
|
+ <view class="sub-tab-item"
|
|
|
+ :class="{ active: currentSubTab === 'unfinished' || currentSubTab === 'finished' }"
|
|
|
+ @click="openSubTabPopup('unfinished')">
|
|
|
+ <text>{{ selectedSubTabLabels['unfinished'] || '最新发起' }}</text>
|
|
|
+ <image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png"
|
|
|
+ mode="widthFix"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 子标签弹窗 -->
|
|
|
@@ -34,28 +42,35 @@
|
|
|
<view class="sub-tab-popup" v-if="showSubTabPopup">
|
|
|
<view class="sub-tab-options">
|
|
|
<!-- 全部审核选项 -->
|
|
|
- <template v-if="currentPopupType === 'all'">
|
|
|
- <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'all' }" @click="selectSubTabOption('all', '全部审核')">
|
|
|
- <text>全部审核</text>
|
|
|
- </view>
|
|
|
- <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'taskCreate' }" @click="selectSubTabOption('taskCreate', '任务创建')">
|
|
|
- <text>任务创建</text>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- <!-- 最新发起选项 -->
|
|
|
- <template v-else-if="currentPopupType === 'unfinished'">
|
|
|
- <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['unfinished'] === 'unfinished' }" @click="selectSubTabOption('unfinished', '最新发起')">
|
|
|
- <text>最新发起</text>
|
|
|
- </view>
|
|
|
- <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['unfinished'] === 'finished' }" @click="selectSubTabOption('finished', '最早发起')">
|
|
|
- <text>最早发起</text>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
+ <template v-if="currentPopupType === 'all'">
|
|
|
+ <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'all' }"
|
|
|
+ @click="selectSubTabOption('all', '全部审核')">
|
|
|
+ <text>全部审核</text>
|
|
|
+ </view>
|
|
|
+ <view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'taskCreate' }"
|
|
|
+ @click="selectSubTabOption('taskCreate', '任务创建')">
|
|
|
+ <text>任务创建</text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <!-- 最新发起选项 -->
|
|
|
+ <template v-else-if="currentPopupType === 'unfinished'">
|
|
|
+ <view class="sub-tab-option"
|
|
|
+ :class="{ active: selectedSubTabOptions['unfinished'] === 'unfinished' }"
|
|
|
+ @click="selectSubTabOption('unfinished', '最新发起')">
|
|
|
+ <text>最新发起</text>
|
|
|
+ </view>
|
|
|
+ <view class="sub-tab-option"
|
|
|
+ :class="{ active: selectedSubTabOptions['unfinished'] === 'finished' }"
|
|
|
+ @click="selectSubTabOption('finished', '最早发起')">
|
|
|
+ <text>最早发起</text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 列表内容 -->
|
|
|
- <scroll-view class="content" scroll-y refresher-enabled :refresher-triggered="refreshing" @refresherrefresh="onRefresh" @refresherrestore="onRestore">
|
|
|
+ <scroll-view class="content" scroll-y refresher-enabled :refresher-triggered="refreshing"
|
|
|
+ @refresherrefresh="onRefresh" @refresherrestore="onRestore">
|
|
|
<view class="task-card" v-for="(item, index) in currentList" :key="index" @click="goDetails(item)">
|
|
|
<!-- 任务/审核标题+状态 -->
|
|
|
<view class="card-top">
|
|
|
@@ -72,15 +87,17 @@
|
|
|
<text>{{ item.auditName || '未设置' }}</text>
|
|
|
</view>
|
|
|
<view class="time-item">
|
|
|
- <text class="title">任务类型:</text>
|
|
|
- <text>{{ getBusinessTypeLabel(item.businessType) }}</text>
|
|
|
- </view>
|
|
|
+ <text class="title">任务类型:</text>
|
|
|
+ <text>{{ getBusinessTypeLabel(item.businessType) }}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 操作按钮 -->
|
|
|
<view class="operate-btn-group">
|
|
|
<view class="share-btn" @click="handleShare(item)">
|
|
|
- <image class="share-icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_user.png" mode="widthFix"></image>
|
|
|
+ <image class="share-icon"
|
|
|
+ src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_user.png"
|
|
|
+ mode="widthFix"></image>
|
|
|
<text>{{ item.initiatorName || '未命名' }}</text>
|
|
|
</view>
|
|
|
<view class="date">
|
|
|
@@ -96,8 +113,9 @@
|
|
|
<view class="filter-content" @click.stop>
|
|
|
<view class="filter-header">
|
|
|
<view class="filter-title">筛选</view>
|
|
|
- <image class="filter-close-btn" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_close.png" @click="closeFilter"
|
|
|
- mode="widthFix"></image>
|
|
|
+ <image class="filter-close-btn"
|
|
|
+ src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_close.png"
|
|
|
+ @click="closeFilter" mode="widthFix"></image>
|
|
|
</view>
|
|
|
|
|
|
<view class="filter-form">
|
|
|
@@ -174,119 +192,122 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import utils from '@/utils/common.js'
|
|
|
+ import utils from '@/utils/common.js'
|
|
|
import TabPopup from '@/components/tab-popup.vue'
|
|
|
- import { getPendingAuditList, searchCompanyUser } from '@/api/audit.js'
|
|
|
-
|
|
|
+ import {
|
|
|
+ getPendingAuditList,
|
|
|
+ searchCompanyUser
|
|
|
+ } from '@/api/audit.js'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
TabPopup
|
|
|
},
|
|
|
data() {
|
|
|
- return {
|
|
|
- processTemplate: null,
|
|
|
- popShow: false,
|
|
|
- showFilter: false,
|
|
|
- selectedTabItem: '',
|
|
|
- searchKeywords: '',
|
|
|
- searchTimer: null,
|
|
|
- filters: {
|
|
|
- applyTimeStart: '',
|
|
|
- applyTimeEnd: '',
|
|
|
- finishTimeStart: '',
|
|
|
- finishTimeEnd: '',
|
|
|
- auditTimeStart: '',
|
|
|
- auditTimeEnd: '',
|
|
|
- taskBelong: 'my',
|
|
|
- finishStatus: '',
|
|
|
- belongType: ''
|
|
|
- },
|
|
|
- refreshing: false,
|
|
|
- showSubTabPopup: false,
|
|
|
- currentPopupType: 'all',
|
|
|
- // 为每种类型的弹窗分别存储选中的选项
|
|
|
- selectedSubTabOptions: {
|
|
|
- all: 'all',
|
|
|
- unfinished: 'unfinished'
|
|
|
- },
|
|
|
- selectedSubTabLabels: {
|
|
|
- all: '全部审核',
|
|
|
- unfinished: '最新发起'
|
|
|
- },
|
|
|
- // 顶部选项卡数组
|
|
|
- topTabs: [{
|
|
|
- label: '待办',
|
|
|
- value: 'todo',
|
|
|
- badge: 0
|
|
|
- },
|
|
|
- {
|
|
|
- label: '已办',
|
|
|
- value: 'done',
|
|
|
- badge: 0
|
|
|
- },
|
|
|
- {
|
|
|
- label: '我发起的',
|
|
|
- value: 'myInitiate',
|
|
|
- badge: 0
|
|
|
- }
|
|
|
- ],
|
|
|
- currentTopTab: 0,
|
|
|
- currentSubTab: 'all',
|
|
|
- // 子标签数组
|
|
|
- taskSubTabs: [{
|
|
|
- label: '全部审批',
|
|
|
- value: 'all'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '最新发起',
|
|
|
- value: 'unfinished'
|
|
|
- }
|
|
|
- ],
|
|
|
- tabsList: ['全部审批', '任务创建'],
|
|
|
- tabsList2: ['最新发起', '最早发起'],
|
|
|
- // auditSubTabs: [{
|
|
|
- // label: '全部',
|
|
|
- // value: 'all'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // label: '驳回',
|
|
|
- // value: 'rejected'
|
|
|
- // }
|
|
|
- // ],
|
|
|
- // 加载状态
|
|
|
- loading: {
|
|
|
- todo: false,
|
|
|
- done: false,
|
|
|
- myInitiate: false
|
|
|
+ return {
|
|
|
+ processTemplate: null,
|
|
|
+ popShow: false,
|
|
|
+ showFilter: false,
|
|
|
+ selectedTabItem: '',
|
|
|
+ searchKeywords: '',
|
|
|
+ searchTimer: null,
|
|
|
+ filters: {
|
|
|
+ applyTimeStart: '',
|
|
|
+ applyTimeEnd: '',
|
|
|
+ finishTimeStart: '',
|
|
|
+ finishTimeEnd: '',
|
|
|
+ auditTimeStart: '',
|
|
|
+ auditTimeEnd: '',
|
|
|
+ taskBelong: 'my',
|
|
|
+ finishStatus: '',
|
|
|
+ belongType: ''
|
|
|
+ },
|
|
|
+ refreshing: false,
|
|
|
+ showSubTabPopup: false,
|
|
|
+ currentPopupType: 'all',
|
|
|
+ // 为每种类型的弹窗分别存储选中的选项
|
|
|
+ selectedSubTabOptions: {
|
|
|
+ all: 'all',
|
|
|
+ unfinished: 'unfinished'
|
|
|
+ },
|
|
|
+ selectedSubTabLabels: {
|
|
|
+ all: '全部审核',
|
|
|
+ unfinished: '最新发起'
|
|
|
+ },
|
|
|
+ // 顶部选项卡数组
|
|
|
+ topTabs: [{
|
|
|
+ label: '待办',
|
|
|
+ value: 'todo',
|
|
|
+ badge: 0
|
|
|
},
|
|
|
- // 列表数据
|
|
|
- todoList: [], // 待办列表(index=0)
|
|
|
- doneList: [], // 已办列表(index=1)
|
|
|
- myInitiateList: [] // 我发起的列表(index=2)
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- currentSubTabsList() {
|
|
|
- return this.taskSubTabs;
|
|
|
-
|
|
|
- // if (this.currentTopTab === 0) return this.taskSubTabs;
|
|
|
- // if (this.currentTopTab === 1) return this.auditSubTabs;
|
|
|
- // if (this.currentTopTab === 2) return this.myInitiateList;
|
|
|
+ {
|
|
|
+ label: '已办',
|
|
|
+ value: 'done',
|
|
|
+ badge: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '我发起的',
|
|
|
+ value: 'myInitiate',
|
|
|
+ badge: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ currentTopTab: 0,
|
|
|
+ currentSubTab: 'all',
|
|
|
+ // 子标签数组
|
|
|
+ taskSubTabs: [{
|
|
|
+ label: '全部审批',
|
|
|
+ value: 'all'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '最新发起',
|
|
|
+ value: 'unfinished'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ tabsList: ['全部审批', '任务创建'],
|
|
|
+ tabsList2: ['最新发起', '最早发起'],
|
|
|
+ // auditSubTabs: [{
|
|
|
+ // label: '全部',
|
|
|
+ // value: 'all'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '驳回',
|
|
|
+ // value: 'rejected'
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
+ // 加载状态
|
|
|
+ loading: {
|
|
|
+ todo: false,
|
|
|
+ done: false,
|
|
|
+ myInitiate: false
|
|
|
},
|
|
|
- currentList() {
|
|
|
- if (this.currentTopTab === 0) return this.todoList;
|
|
|
- if (this.currentTopTab === 1) return this.doneList;
|
|
|
- if (this.currentTopTab === 2) return this.myInitiateList;
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad() {
|
|
|
- // 页面加载时的初始化操作
|
|
|
- this.loadData();
|
|
|
- utils.getDicts("FLOW_TEMPLATE").then(res => {
|
|
|
- this.processTemplate = res;
|
|
|
- console.log("流程模板", this.processTemplate)
|
|
|
- });
|
|
|
+ // 列表数据
|
|
|
+ todoList: [], // 待办列表(index=0)
|
|
|
+ doneList: [], // 已办列表(index=1)
|
|
|
+ myInitiateList: [], // 我发起的列表(index=2)
|
|
|
+ // 初始化/加载状态控制,避免初次进入重复请求
|
|
|
+ isInitializing: true,
|
|
|
+ hasLoadedOnce: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentSubTabsList() {
|
|
|
+ return this.taskSubTabs;
|
|
|
+
|
|
|
},
|
|
|
+ currentList() {
|
|
|
+ if (this.currentTopTab === 0) return this.todoList;
|
|
|
+ if (this.currentTopTab === 1) return this.doneList;
|
|
|
+ if (this.currentTopTab === 2) return this.myInitiateList;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ // 页面加载时的初始化操作
|
|
|
+ this.loadData();
|
|
|
+ utils.getDicts("FLOW_TEMPLATE").then(res => {
|
|
|
+ this.processTemplate = res;
|
|
|
+ console.log("流程模板", this.processTemplate)
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
onRefresh() {
|
|
|
this.refreshing = true;
|
|
|
@@ -304,41 +325,39 @@ import utils from '@/utils/common.js'
|
|
|
this.showSubTabPopup = true;
|
|
|
},
|
|
|
selectSubTabOption(value, label) {
|
|
|
- // 根据当前弹窗类型更新对应类型的选中选项
|
|
|
- this.selectedSubTabOptions[this.currentPopupType] = value;
|
|
|
- this.selectedSubTabLabels[this.currentPopupType] = label;
|
|
|
- this.currentSubTab = value;
|
|
|
- this.showSubTabPopup = false;
|
|
|
- // 这里可以添加根据选择的子标签过滤数据的逻辑
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
+ // 根据当前弹窗类型更新对应类型的选中选项
|
|
|
+ this.selectedSubTabOptions[this.currentPopupType] = value;
|
|
|
+ this.selectedSubTabLabels[this.currentPopupType] = label;
|
|
|
+ this.currentSubTab = value;
|
|
|
+ this.showSubTabPopup = false;
|
|
|
+ // 这里可以添加根据选择的子标签过滤数据的逻辑
|
|
|
+ },
|
|
|
selectTabItem(item) {
|
|
|
this.selectedTabItem = item;
|
|
|
this.popShow = false;
|
|
|
},
|
|
|
goDetails(item) {
|
|
|
- console.log("跳转参数",item)
|
|
|
+ console.log("跳转参数", item)
|
|
|
uni.navigateTo({
|
|
|
url: `/pages_task/approvalTaskDetail?taskId=${item.id}&businessType=${item.businessType}`
|
|
|
})
|
|
|
},
|
|
|
switchTopTab(index) {
|
|
|
- this.currentTopTab = index;
|
|
|
- this.currentSubTab = 'all';
|
|
|
- // 重置所有子标签选项
|
|
|
- this.selectedSubTabOptions = {
|
|
|
- all: 'all',
|
|
|
- unfinished: 'unfinished'
|
|
|
- };
|
|
|
- this.selectedSubTabLabels = {
|
|
|
- all: '全部审核',
|
|
|
- unfinished: '最新发起'
|
|
|
- };
|
|
|
- this.popShow = false;
|
|
|
- this.showSubTabPopup = false;
|
|
|
- // 切换标签时重新加载数据
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
+ this.currentTopTab = index;
|
|
|
+ this.currentSubTab = 'all';
|
|
|
+ // 重置所有子标签选项
|
|
|
+ this.selectedSubTabOptions = {
|
|
|
+ all: 'all',
|
|
|
+ unfinished: 'unfinished'
|
|
|
+ };
|
|
|
+ this.selectedSubTabLabels = {
|
|
|
+ all: '全部审核',
|
|
|
+ unfinished: '最新发起'
|
|
|
+ };
|
|
|
+ this.popShow = false;
|
|
|
+ this.showSubTabPopup = false;
|
|
|
+ // 切换标签仅切换展示数据
|
|
|
+ },
|
|
|
closeFilter() {
|
|
|
this.showFilter = false
|
|
|
},
|
|
|
@@ -360,259 +379,225 @@ import utils from '@/utils/common.js'
|
|
|
console.log('筛选条件:', this.filters)
|
|
|
// 筛选后重新加载数据
|
|
|
this.loadData()
|
|
|
- },
|
|
|
- getAuditNameDisplay(auditName) {
|
|
|
- if (!auditName) return '未设置'
|
|
|
- switch (auditName) {
|
|
|
- case '完成任务审核':
|
|
|
- return '"完成任务"审核'
|
|
|
- case '定级审核':
|
|
|
- return '"讲者定级"审核'
|
|
|
- default:
|
|
|
- // 对于其他审核类型,在最开始和审核前都加双引号
|
|
|
- const prefix = auditName.replace('审核', '')
|
|
|
- return '"' + prefix + '"审核'
|
|
|
- }
|
|
|
- },
|
|
|
- handleShare(item) {
|
|
|
- uni.showToast({
|
|
|
- title: '分享功能待实现',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- },
|
|
|
- handleSearchInput() {
|
|
|
- // 防抖处理,避免频繁请求
|
|
|
- if (this.searchTimer) {
|
|
|
- clearTimeout(this.searchTimer)
|
|
|
- }
|
|
|
-
|
|
|
- this.searchTimer = setTimeout(async () => {
|
|
|
- if (this.searchKeywords.trim()) {
|
|
|
- try {
|
|
|
- // 调用搜索发起人接口
|
|
|
- const res = await searchCompanyUser({
|
|
|
- keywords: this.searchKeywords.trim(),
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
- })
|
|
|
-
|
|
|
- if (res.code === 200 && res.rows) {
|
|
|
- // 根据当前标签页更新对应列表
|
|
|
- if (this.currentTopTab === 0) {
|
|
|
- this.todoList = res.rows.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: '待审核',
|
|
|
- statusClass: 'status-createPending',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- } else if (this.currentTopTab === 1) {
|
|
|
- this.doneList = res.rows.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: item.status === 1 ? '已通过' : '已驳回',
|
|
|
- statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- } else if (this.currentTopTab === 2) {
|
|
|
- this.myInitiateList = res.rows.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: '待审核',
|
|
|
- statusClass: 'status-createPending',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 搜索结果为空,清空对应列表
|
|
|
- if (this.currentTopTab === 0) {
|
|
|
- this.todoList = []
|
|
|
- } else if (this.currentTopTab === 1) {
|
|
|
- this.doneList = []
|
|
|
- } else if (this.currentTopTab === 2) {
|
|
|
- this.myInitiateList = []
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.error('搜索失败', e)
|
|
|
- uni.showToast({
|
|
|
- title: '搜索失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 搜索框为空,重新加载默认数据
|
|
|
- this.loadData()
|
|
|
- }
|
|
|
- }, 300)
|
|
|
- },
|
|
|
- // 加载审批数据
|
|
|
- async loadData() {
|
|
|
- try {
|
|
|
- // 无论当前标签是什么,都调用getPendingAuditList请求
|
|
|
- const userInfoStr = uni.getStorageSync('userInfo')
|
|
|
- const userInfo = userInfoStr ? (typeof userInfoStr === 'string' ? JSON.parse(userInfoStr) : userInfoStr) : {}
|
|
|
- // 获取不同status的数据total并更新badge
|
|
|
- const getBadgeData = async () => {
|
|
|
- // 获取待办数据(total)
|
|
|
- const todoParams = {
|
|
|
- initiatorName: userInfo.nickName || '',
|
|
|
- initiatorPhone: userInfo.phone || '',
|
|
|
- status: 1,
|
|
|
- sort: 0,
|
|
|
- userId: userInfo.userId || '',
|
|
|
- companyId: userInfo.companyId || 0
|
|
|
- }
|
|
|
- const todoRes = await getPendingAuditList(todoParams)
|
|
|
- this.topTabs[0].badge = todoRes.code === 200 ? (todoRes.total || 0) : 0
|
|
|
-
|
|
|
- // 获取已办数据(total)
|
|
|
- const doneParams = {
|
|
|
- initiatorName: userInfo.nickName || '',
|
|
|
- initiatorPhone: userInfo.phone || '',
|
|
|
- status: 2,
|
|
|
- sort: 0,
|
|
|
- userId: userInfo.userId || '',
|
|
|
- companyId: userInfo.companyId || 0
|
|
|
- }
|
|
|
- const doneRes = await getPendingAuditList(doneParams)
|
|
|
- this.topTabs[1].badge = doneRes.code === 200 ? (doneRes.total || 0) : 0
|
|
|
-
|
|
|
- // 获取我发起的数据(total)
|
|
|
- const myInitiateParams = {
|
|
|
- initiatorName: userInfo.nickName || '',
|
|
|
- initiatorPhone: userInfo.phone || '',
|
|
|
- status: '',
|
|
|
- sort: 0,
|
|
|
- userId: userInfo.userId || '',
|
|
|
- companyId: userInfo.companyId || 0
|
|
|
+ },
|
|
|
+ getAuditNameDisplay(auditName) {
|
|
|
+ if (!auditName) return '未设置'
|
|
|
+ switch (auditName) {
|
|
|
+ case '完成任务审核':
|
|
|
+ return '"完成任务"审核'
|
|
|
+ case '定级审核':
|
|
|
+ return '"讲者定级"审核'
|
|
|
+ default:
|
|
|
+ // 对于其他审核类型,在最开始和审核前都加双引号
|
|
|
+ const prefix = auditName.replace('审核', '')
|
|
|
+ return '"' + prefix + '"审核'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleShare(item) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '分享功能待实现',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSearchInput() {
|
|
|
+ // 初次进入时不触发重新加载,避免重复请求
|
|
|
+ if (this.isInitializing) return;
|
|
|
+ // 防抖处理,避免频繁请求
|
|
|
+ if (this.searchTimer) {
|
|
|
+ clearTimeout(this.searchTimer)
|
|
|
+ }
|
|
|
|
|
|
+ this.searchTimer = setTimeout(async () => {
|
|
|
+ if (this.searchKeywords.trim()) {
|
|
|
+ try {
|
|
|
+ // 调用搜索发起人接口
|
|
|
+ const res = await searchCompanyUser({
|
|
|
+ keywords: this.searchKeywords.trim(),
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ })
|
|
|
+
|
|
|
+ if (res.code === 200 && res.rows) {
|
|
|
+ // 根据当前标签页更新对应列表
|
|
|
+ if (this.currentTopTab === 0) {
|
|
|
+ this.todoList = res.rows.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: '待审核',
|
|
|
+ statusClass: 'status-createPending',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+ } else if (this.currentTopTab === 1) {
|
|
|
+ this.doneList = res.rows.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: item.status === 1 ? '已通过' : '已驳回',
|
|
|
+ statusClass: item.status === 1 ? 'status-finish' :
|
|
|
+ 'status-rejected',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+ } else if (this.currentTopTab === 2) {
|
|
|
+ this.myInitiateList = res.rows.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: '待审核',
|
|
|
+ statusClass: 'status-createPending',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 搜索结果为空,清空对应列表
|
|
|
+ if (this.currentTopTab === 0) {
|
|
|
+ this.todoList = []
|
|
|
+ } else if (this.currentTopTab === 1) {
|
|
|
+ this.doneList = []
|
|
|
+ } else if (this.currentTopTab === 2) {
|
|
|
+ this.myInitiateList = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('搜索失败', e)
|
|
|
+ uni.showToast({
|
|
|
+ title: '搜索失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 搜索框为空,重新加载默认数据
|
|
|
+ if (this.hasLoadedOnce) {
|
|
|
+ this.loadData()
|
|
|
}
|
|
|
- const myInitiateRes = await getPendingAuditList(myInitiateParams)
|
|
|
- this.topTabs[2].badge = myInitiateRes.code === 200 ? (myInitiateRes.total || 0) : 0
|
|
|
}
|
|
|
-
|
|
|
- // 先获取所有badge数据
|
|
|
- await getBadgeData()
|
|
|
-
|
|
|
- // 获取当前标签页的数据
|
|
|
+ }, 300)
|
|
|
+ },
|
|
|
+ // 加载审批数据
|
|
|
+ async loadData() {
|
|
|
+ try {
|
|
|
+ const userInfoStr = uni.getStorageSync('userInfo')
|
|
|
+ const userInfo = userInfoStr ? (typeof userInfoStr === 'string' ? JSON.parse(userInfoStr) :
|
|
|
+ userInfoStr) : {}
|
|
|
+ // 一次请求获取全部列表与badge
|
|
|
const params = {
|
|
|
initiatorName: userInfo.nickName || '',
|
|
|
initiatorPhone: userInfo.phone || '',
|
|
|
- status: this.currentTopTab === 0 ? 1 : this.currentTopTab === 1 ? 2 : '',
|
|
|
- sort: 0,
|
|
|
userId: userInfo.userId || '',
|
|
|
- companyId: this.currentTopTab === 2 ? 1 : (userInfo.companyId || 0)
|
|
|
+ companyId: userInfo.companyId || 0
|
|
|
}
|
|
|
- const res = await getPendingAuditList(params)
|
|
|
- if (res.code === 200) {
|
|
|
- // 处理返回的数据
|
|
|
- const responseData = res.rows || [];
|
|
|
-
|
|
|
- // 直接使用responseData作为对应列表的数据
|
|
|
- if (this.currentTopTab === 0) {
|
|
|
- // 待办列表
|
|
|
- this.loading.todo = true
|
|
|
- this.todoList = responseData.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: '待审核',
|
|
|
- statusClass: 'status-createPending',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- this.loading.todo = false
|
|
|
- } else if (this.currentTopTab === 1) {
|
|
|
- // 已办列表
|
|
|
- this.loading.done = true
|
|
|
- this.doneList = responseData.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: item.status === 1 ? '已通过' : '已驳回',
|
|
|
- statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- this.loading.done = false
|
|
|
- } else if (this.currentTopTab === 2) {
|
|
|
- // 我发起的列表
|
|
|
- this.loading.myInitiate = true
|
|
|
- this.myInitiateList = responseData.map(item => ({
|
|
|
- auditName: item.auditName || '未知审核',
|
|
|
- statusText: '待审核',
|
|
|
- statusClass: 'status-createPending',
|
|
|
- id: item.id,
|
|
|
- status: item.status,
|
|
|
- auditType: item.auditType,
|
|
|
- businessId: item.businessId,
|
|
|
- businessType: item.businessType,
|
|
|
- createTime: item.createTime,
|
|
|
- initiatorName: item.initiatorName
|
|
|
- }))
|
|
|
- this.loading.myInitiate = false
|
|
|
- }
|
|
|
-
|
|
|
- // 这里不再需要更新badge,因为已经在getBadgeData中更新过了
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '获取审核列表失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.error('加载数据失败', e)
|
|
|
+ const res = await getPendingAuditList(params)
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ const map = res.data.map || {}
|
|
|
+ // 更新badge
|
|
|
+ this.topTabs[0].badge = res.data.pendingDataCount || 0
|
|
|
+ this.topTabs[1].badge = res.data.completedDataCount || 0
|
|
|
+ this.topTabs[2].badge = res.data.myInitiationsCount || 0
|
|
|
+
|
|
|
+ // 标准化映射函数
|
|
|
+ const mapPending = (arr = []) => arr.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: '待审核',
|
|
|
+ statusClass: 'status-createPending',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+ const mapCompleted = (arr = []) => arr.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: item.status === 1 ? '已通过' : '已驳回',
|
|
|
+ statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+ const mapMyInitiations = (arr = []) => arr.map(item => ({
|
|
|
+ auditName: item.auditName || '未知审核',
|
|
|
+ statusText: '待审核',
|
|
|
+ statusClass: 'status-createPending',
|
|
|
+ id: item.id,
|
|
|
+ status: item.status,
|
|
|
+ auditType: item.auditType,
|
|
|
+ businessId: item.businessId,
|
|
|
+ businessType: item.businessType,
|
|
|
+ createTime: item.createTime,
|
|
|
+ initiatorName: item.initiatorName
|
|
|
+ }))
|
|
|
+
|
|
|
+ // 更新三个列表
|
|
|
+ this.loading.todo = true
|
|
|
+ this.loading.done = true
|
|
|
+ this.loading.myInitiate = true
|
|
|
+ const pendingRaw = map.pendingData || map['pendingData'] || map['pendingData '] || []
|
|
|
+ const completedRaw = map.completedData || map['completedData'] || map['completedData '] || []
|
|
|
+ const myInitiationsRaw = map.myInitiations || map['myInitiations'] || map['myInitiations '] || []
|
|
|
+ this.todoList = mapPending(pendingRaw)
|
|
|
+ this.doneList = mapCompleted(completedRaw)
|
|
|
+ this.myInitiateList = mapMyInitiations(myInitiationsRaw)
|
|
|
+ this.loading.todo = false
|
|
|
+ this.loading.done = false
|
|
|
+ this.loading.myInitiate = false
|
|
|
+ this.hasLoadedOnce = true
|
|
|
+ this.isInitializing = false
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
|
- title: '加载数据失败',
|
|
|
+ title: '获取审核列表失败',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
- // 重置加载状态
|
|
|
- this.loading.todo = false
|
|
|
- this.loading.done = false
|
|
|
- this.loading.myInitiate = false
|
|
|
- }
|
|
|
- },
|
|
|
- // 格式化时间
|
|
|
- formatTime(timeStr) {
|
|
|
- if (!timeStr) return ''
|
|
|
- const date = new Date(timeStr)
|
|
|
- const year = date.getFullYear()
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
- const day = String(date.getDate()).padStart(2, '0')
|
|
|
- const hours = String(date.getHours()).padStart(2, '0')
|
|
|
- const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
- return `${year}-${month}-${day} ${hours}:${minutes}`
|
|
|
- },
|
|
|
- getBusinessTypeLabel(businessType) {
|
|
|
- if (!businessType || !this.processTemplate) {
|
|
|
- return '未设置'
|
|
|
- }
|
|
|
- const dictItem = this.processTemplate.find(item => item.dictValue === businessType)
|
|
|
- return dictItem ? dictItem.dictLabel : businessType
|
|
|
- }
|
|
|
+ this.isInitializing = false
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('加载数据失败', e)
|
|
|
+ uni.showToast({
|
|
|
+ title: '加载数据失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ // 重置加载状态
|
|
|
+ this.loading.todo = false
|
|
|
+ this.loading.done = false
|
|
|
+ this.loading.myInitiate = false
|
|
|
+ this.isInitializing = false
|
|
|
}
|
|
|
+ },
|
|
|
+ // 格式化时间
|
|
|
+ formatTime(timeStr) {
|
|
|
+ if (!timeStr) return ''
|
|
|
+ const date = new Date(timeStr)
|
|
|
+ const year = date.getFullYear()
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0')
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
+ return `${year}-${month}-${day} ${hours}:${minutes}`
|
|
|
+ },
|
|
|
+ getBusinessTypeLabel(businessType) {
|
|
|
+ if (!businessType || !this.processTemplate) {
|
|
|
+ return '未设置'
|
|
|
+ }
|
|
|
+ const dictItem = this.processTemplate.find(item => item.dictValue === businessType)
|
|
|
+ return dictItem ? dictItem.dictLabel : businessType
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -768,10 +753,10 @@ import utils from '@/utils/common.js'
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
&.active {
|
|
|
- background: rgba(56,139,255,0.15);
|
|
|
+ background: rgba(56, 139, 255, 0.15);
|
|
|
color: #ffffff;
|
|
|
color: #388BFF;
|
|
|
- border: 1rpx solid #388BFF ;
|
|
|
+ border: 1rpx solid #388BFF;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1018,4 +1003,4 @@ import utils from '@/utils/common.js'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|