|
|
@@ -73,7 +73,7 @@
|
|
|
}}</text>
|
|
|
</view> -->
|
|
|
</view>
|
|
|
- <view class="card-actions" @click.stop v-if="item.status == '10' || item.status == '30'">
|
|
|
+ <view class="card-actions" @click.stop v-if="isAdmin && (item.status == '10' || item.status == '30')">
|
|
|
<view class="btn-box" v-if="item.status == '10'">
|
|
|
<uv-button text="认领" type="primary" shape="circle" size="small" @click="toClaim(item.id)"></uv-button>
|
|
|
</view>
|
|
|
@@ -93,19 +93,40 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, nextTick, watch } from 'vue';
|
|
|
+import { ref, nextTick, watch, computed } from 'vue';
|
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
|
import { debounce } from 'lodash-es';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
+import { useUserStore } from '@/store/modules/user';
|
|
|
import { useFundApi } from '@/api/fund/index';
|
|
|
import { useSystemApi } from '@/api/system/index';
|
|
|
import { onRouterPush } from '@/utils/router';
|
|
|
import { DEFAULT_PAGE_SIZE } from '@/constants/index';
|
|
|
import { formatDate } from '@/utils/date';
|
|
|
|
|
|
+const userStore = useUserStore();
|
|
|
+const { roles } = storeToRefs(userStore);
|
|
|
+
|
|
|
+const ADMIN_ROLES = ['scientific_research_secretary', 'scientific_research_admin', 'sys_admin', 'admin'];
|
|
|
+
|
|
|
+const isAdmin = computed(() => {
|
|
|
+ const userRoles = roles.value || [];
|
|
|
+ return ADMIN_ROLES.some(adminRole =>
|
|
|
+ userRoles.some((r: any) => r.roleCode === adminRole)
|
|
|
+ );
|
|
|
+});
|
|
|
+
|
|
|
+const allTabs = [{ name: '待认领', type: '10' }, { name: '已认领', type: '20' }, { name: '认领中', type: '30' }];
|
|
|
+const tabList = computed(() => {
|
|
|
+ if (isAdmin.value) {
|
|
|
+ return allTabs;
|
|
|
+ }
|
|
|
+ return [{ name: '已认领', type: '20' }];
|
|
|
+});
|
|
|
+
|
|
|
const fundApi = useFundApi();
|
|
|
const systemApi = useSystemApi();
|
|
|
|
|
|
-const tabList = ref([{ name: '待认领', type: '10' }, { name: '已认领', type: '20' }, { name: '认领中', type: '30' }]);
|
|
|
const currentTab = ref(0);
|
|
|
|
|
|
const queryParams = ref({
|
|
|
@@ -228,7 +249,7 @@ const toClaim = (id: number) => {
|
|
|
};
|
|
|
|
|
|
const handleCardClick = (item: any) => {
|
|
|
- if (item.status == '10') {
|
|
|
+ if (isAdmin.value && item.status == '10') {
|
|
|
toClaim(item.id);
|
|
|
} else {
|
|
|
toViewDetail(item.id);
|
|
|
@@ -236,6 +257,7 @@ const handleCardClick = (item: any) => {
|
|
|
};
|
|
|
|
|
|
onLoad(() => {
|
|
|
+ queryParams.value.status = tabList.value[0]?.type || '20';
|
|
|
getDict();
|
|
|
fetchListData(true);
|
|
|
});
|