Commit e3589326 authored by 郭铭瑶's avatar 郭铭瑶 🤘

加入权限代码(目前接口还没数据)& 完善

parent de7e2f04
......@@ -114,7 +114,10 @@ const themeOverrides: GlobalThemeOverrides = {
itemColorActive: '#fcf4f5',
},
DataTable: {
fontSizeSmall: '.01rem',
fontSizeSmall: '.08rem',
},
Pagination: {
itemTextColorHover: '#dd505E',
},
}
</script>
......
import OSS from 'ali-oss'
import { useFetchAuth } from '@/hooks/useFetch'
import { useFetchOSSToken } from '@/hooks/useFetch'
import md5 from 'md5'
import { api } from '@/ajax'
export default async function useAliOss(file: any) {
const auth = (await useFetchAuth())?.token
const auth = (await useFetchOSSToken())?.token
const client = new OSS({
region: 'oss-' + auth.region,
accessKeyId: auth.access_key_id,
......
......@@ -105,9 +105,32 @@ export async function useFetchTag(params: QueryProps) {
})
return res && res.data && res.data.result
}
export async function useFetchAuth() {
export async function useFetchOSSToken() {
const res = await ajax.get({
url: api.GET_AUTH,
})
return res && res.data && res.data.result
}
export async function useFetchAuth() {
const res = await ajax.get({
url: api.GET_USER_ID,
})
return res && res.data && res.data.result
}
export async function useFetchUser(params: QueryProps) {
const res = await ajax.get({
url: api.USER,
params,
})
return res && res.data && res.data.result
}
export async function useFetchOrgAuth(params: QueryProps) {
const res = await ajax.get({
url: api.ORG,
params,
})
return res && res.data && res.data.result
}
import { Commit, Dispatch } from './index'
import { useFetchOrg, useFetchMember, useFetchAuth } from '@/hooks/useFetch'
import {
useFetchOrg,
useFetchMember,
useFetchAuth,
useFetchUser,
useFetchOrgAuth,
} from '@/hooks/useFetch'
import dayjs from '@/util/dayjs'
import state from './state'
......@@ -10,7 +16,27 @@ interface Method {
export default {
async getAuth({ commit }: Method) {
commit('SET_AUTH', (await useFetchAuth())?.token)
const userid: number | null = (await useFetchAuth())?.customer?.id || null
if (!userid) return
const orgIds: string[] =
(
await useFetchUser({
keys: '组织id',
q: `paths @ "userid" && string == "${userid}"`,
})
)?.['组织id'] || []
const authList: string[] = await Promise.all(
orgIds.map(
async (id) =>
(
await useFetchOrgAuth({
keys: '权限编码',
q: `paths @ "组织id" && string == "${id}"`,
})
)?.['权限编码'] || '',
),
)
commit('SET_AUTH', { userid, orgIds, authList })
},
async getBasicInfo({ commit }: Method, query?: string) {
commit('SET_BASIC_INFO', {
......
export default {
showLoading: false,
auth: {
region: '',
access_key_id: '',
access_key_secret: '',
bucket: '',
security_token: '',
userid: null,
orgIds: [],
authList: [],
},
showTag: true,
showBasicInfo: true,
......
......@@ -98,6 +98,7 @@ const closeDrawer = () => {
store.commit('SET_ACTIVITY_DRAWER', false)
store.commit('SET_SHOW_BASIC_INFO', true)
store.commit('SET_SHOW_TAG', true)
dateRange.value = []
}
const dateRange = ref<number[]>([])
......
......@@ -129,7 +129,8 @@ const fetchList = useDebounce(async (query?: string) => {
...item.extra,
})) || []
})
const reFetchList = () => {
function clearData() {
model.value = {
dateStart: null,
dateEnd: null,
......@@ -137,6 +138,9 @@ const reFetchList = () => {
rateEnd: null,
type: null,
}
}
const reFetchList = () => {
clearData()
fetchList()
}
onMounted(() => {
......@@ -146,6 +150,7 @@ const show = computed(() => store.state.showActivityListModal)
const close = (val: boolean) => {
store.commit('SET_ACTIVITY_LIST_MODAL', val)
store.commit('SET_SHOW_BASIC_INFO', true)
clearData()
}
const model = ref<any>({})
const typeOptions = computed(() => {
......
......@@ -38,7 +38,7 @@
<span>党员数:{{ item.member }}</span>
</div>
</div>
<n-carousel show-arrow>
<n-carousel :show-arrow="item.length > 4">
<div
v-for="(_, segmentIndex) in new Array(
Math.ceil(item.rooms.length / 4),
......
......@@ -306,10 +306,11 @@ const toPage = (id?: string) => {
width 12rem
height 2.5rem
.menu
height 100%
border-radius .06rem
background $white-bg
display flex
color $font
background $white-bg
.parent
margin .15rem 0
width 1rem
......@@ -320,6 +321,7 @@ const toPage = (id?: string) => {
box-sizing border-box
padding .08rem .12rem
cursor pointer
margin-bottom .05rem
&:hover
&.on
background $light-red
......
......@@ -171,7 +171,7 @@
:default-file-list="memberData.attachment || []"
style="width: 100%"
accept=".docx,.doc,.xlsx,.xls,.csv,.txt"
:on-change="(e) => onChange(e, 'memberData.attachment')"
:on-change="(e) => onFileChange(e, 'memberData.attachment')"
:show-remove-button="mode !== 'view'"
>
<n-button v-if="mode !== 'view'"> 上传附件 </n-button>
......@@ -190,7 +190,9 @@
accept="image/jpg,image/jpeg,image/png,image/img"
list-type="image-card"
:show-remove-button="mode !== 'view'"
:on-change="(e) => onChange(e, 'memberData.attachmentPhoto')"
:on-change="
(e) => onFileChange(e, 'memberData.attachmentPhoto')
"
@preview="handlePreview"
>
点击上传
......@@ -251,7 +253,9 @@
accept="image/jpg,image/jpeg,image/png,image/img"
list-type="image-card"
:show-remove-button="mode !== 'view'"
:on-change="(e) => onChange(e, 'detailData.attachmentPhoto')"
:on-change="
(e) => onFileChange(e, 'detailData.attachmentPhoto')
"
@preview="handlePreview"
>
点击上传
......@@ -272,7 +276,7 @@
accept="image/jpg,image/jpeg,image/png,image/img"
list-type="image-card"
:show-remove-button="mode !== 'view'"
:on-change="(e) => onChange(e, 'detailData.photoList')"
:on-change="(e) => onFileChange(e, 'detailData.photoList')"
@preview="handlePreview"
>
点击上传
......@@ -638,11 +642,6 @@ const submit = () => {
})
}
// const previewFileList = ref([
// {
// url: 'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg',
// },
// ])
const previewImageUrl = ref('')
const showPhoto = ref(false)
function handlePreview({ url }: any) {
......@@ -655,10 +654,11 @@ function getPercent(val: number) {
return val
}
async function onChange(options: any, type: string) {
async function onFileChange(options: any, type: string) {
console.log('change', options, type)
if (!options) return
if (!options.event) {
// 删除
const { url } = options.file
switch (type) {
case 'memberData.attachment':
......
......@@ -61,7 +61,7 @@
<n-layout-header class="head">
<n-space>
<p>{{ curMenu.label }}</p>
<template v-if="curMenu['标签']">
<template v-if="curMenu?.['标签']">
<n-tag
v-for="tag in curMenu['标签'].split(',')"
:key="tag"
......@@ -334,6 +334,15 @@ const close = () => {
store.commit('SET_STRUCT_MODAL', false)
store.commit('SET_SHOW_BASIC_INFO', true)
store.commit('SET_SHOW_TAG', true)
clear()
}
function clear() {
subKey.value = null
curSubMenu.value = {}
expandedKeys.value = []
subExpandedKeys.value = []
curMenu.value = { label: '中共浦东新区花木街道工作委员会', key: 'default' }
curKey.value = 'default'
}
function renderIcon() {
......@@ -510,7 +519,7 @@ const handleExpand = (val: string[]) => {
}
}
const curKey = ref('default')
const curKey = ref<string | null>('default')
const subKey = ref<string | null>(null)
const curMenu = ref<any>({
label: '中共浦东新区花木街道工作委员会',
......@@ -526,6 +535,7 @@ const setCurKey = (val: string, item: any) => {
watch(
() => curMenu.value,
async (data) => {
if (!data) return
if (data && data._hasSub) {
if (data.subList && data.subList.length > 0) {
await Promise.all(
......@@ -562,7 +572,9 @@ watch(
},
)
const showSubordinates = computed(() => curMenu.value._hasSub || !!subKey.value)
const showSubordinates = computed(
() => curMenu.value?._hasSub || !!subKey.value,
)
const subExpandedKeys = ref<string[]>([])
function setSub(data: any) {
if (!data) {
......
......@@ -30,6 +30,8 @@ import ActivityDetail from './components/activity-detail.vue'
import reset from '@images/reset.svg'
import store from '@/store'
store.dispatch('getAuth')
const showReset = computed(() => store.state.showBasicInfo)
const map = ref<any>()
const resetMap = () => map.value && map.value.resetMap()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment