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

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

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