提交 c54ce2e7 authored 作者: lhh's avatar lhh

update

上级 4c4b2222
...@@ -7,6 +7,9 @@ import { getNameByValue, groupTypeList, updateStatusRuleList } from '@/utils/dic ...@@ -7,6 +7,9 @@ import { getNameByValue, groupTypeList, updateStatusRuleList } from '@/utils/dic
import { getGroupList, deleteGroup } from '../api' import { getGroupList, deleteGroup } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import SelectUser from '@/components/SelectUser.vue' import SelectUser from '@/components/SelectUser.vue'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const FormDialog = defineAsyncComponent(() => import('../components/FormDialog.vue')) const FormDialog = defineAsyncComponent(() => import('../components/FormDialog.vue'))
const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue')) const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue'))
...@@ -121,7 +124,7 @@ function handleView(row: Group) { ...@@ -121,7 +124,7 @@ function handleView(row: Group) {
<template #header-buttons> <template #header-buttons>
<el-space> <el-space>
<el-dropdown v-permission="['experiment_group_create_dynamic_group', 'experiment_group_create_static_group']"> <el-dropdown v-permission="['experiment_group_create_dynamic_group', 'experiment_group_create_static_group']">
<el-button type="primary" :icon="Plus">新建</el-button> <el-button type="primary" :icon="Plus" v-if="!userStore.status.group_status">新建</el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="handleAdd('2')">新建动态群组</el-dropdown-item> <el-dropdown-item @click="handleAdd('2')">新建动态群组</el-dropdown-item>
...@@ -154,13 +157,20 @@ function handleView(row: Group) { ...@@ -154,13 +157,20 @@ function handleView(row: Group) {
v-permission="['experiment_group_create_dynamic_group', 'experiment_group_update_static_group']" v-permission="['experiment_group_create_dynamic_group', 'experiment_group_update_static_group']"
>编辑</el-button >编辑</el-button
> >
<el-button type="primary" plain @click="handleRemove([row])" v-permission="'experiment_group_delete'">删除</el-button> <el-button type="primary" plain @click="handleRemove([row])" v-permission="'experiment_group_delete'"
>删除</el-button
>
</template> </template>
</AppList> </AppList>
</AppCard> </AppCard>
<!-- 新建/修改群组 --> <!-- 新建/修改群组 -->
<FormDialog v-model="formVisible" :data="currentRow" @update="handleRefresh" v-if="formVisible && currentRow"></FormDialog> <FormDialog
v-model="formVisible"
:data="currentRow"
@update="handleRefresh"
v-if="formVisible && currentRow"
></FormDialog>
<!-- 查看 --> <!-- 查看 -->
<ViewDialog v-model="viewVisible" :data="(currentRow as Group)" v-if="viewVisible && currentRow"></ViewDialog> <ViewDialog v-model="viewVisible" :data="(currentRow as Group)" v-if="viewVisible && currentRow"></ViewDialog>
</template> </template>
...@@ -25,7 +25,7 @@ const emit = defineEmits<{ ...@@ -25,7 +25,7 @@ const emit = defineEmits<{
const userStore = useUserStore() const userStore = useUserStore()
const disabled = computed(() => userStore.status) const disabled = computed(() => userStore.status.tag_status)
const statusList = useMapStore().getMapValuesByKey('system_status') const statusList = useMapStore().getMapValuesByKey('system_status')
......
...@@ -9,6 +9,9 @@ import { useMapStore } from '@/stores/map' ...@@ -9,6 +9,9 @@ import { useMapStore } from '@/stores/map'
import { getNameByValue, updateStatusRuleList, labelList } from '@/utils/dictionary' import { getNameByValue, updateStatusRuleList, labelList } from '@/utils/dictionary'
import { useLabelType } from '../composables/useLabelType' import { useLabelType } from '../composables/useLabelType'
import SelectUser from '@/components/SelectUser.vue' import SelectUser from '@/components/SelectUser.vue'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const LabelFormDialog = defineAsyncComponent(() => import('../components/LabelFormDialog.vue')) const LabelFormDialog = defineAsyncComponent(() => import('../components/LabelFormDialog.vue'))
const LabelViewDialog = defineAsyncComponent(() => import('../components/LabelViewDialog.vue')) const LabelViewDialog = defineAsyncComponent(() => import('../components/LabelViewDialog.vue'))
...@@ -141,14 +144,15 @@ function handleSelect(id: string) { ...@@ -141,14 +144,15 @@ function handleSelect(id: string) {
}) })
} }
</script> </script>
<!-- import { useUserStore } from '@/stores/user'
const userStore = useUserStore() -->
<template> <template>
<AppCard> <AppCard>
<div class="label-wrap"> <div class="label-wrap">
<div class="label-left"><LabelType :active-id="listParams.type_id" @select="handleSelect"></LabelType></div> <div class="label-left"><LabelType :active-id="listParams.type_id" @select="handleSelect"></LabelType></div>
<AppList v-bind="listOptions" ref="appList" class="label-right"> <AppList v-bind="listOptions" ref="appList" class="label-right">
<template #header-buttons> <template #header-buttons>
<el-button type="primary" :icon="Plus" @click="handleAdd" v-permission="'experiment_tag_create'">新建</el-button> <el-button type="primary" :icon="Plus" @click="handleAdd" v-permission="'experiment_tag_create'" v-if="!userStore.status.tag_status">新建</el-button>
</template> </template>
<template #filter-user> <template #filter-user>
<SelectUser v-model="listParams.updated_operator" placeholder="更新人" @change="handleRefresh"></SelectUser> <SelectUser v-model="listParams.updated_operator" placeholder="更新人" @change="handleRefresh"></SelectUser>
......
...@@ -6,6 +6,9 @@ import AppList from '@/components/base/AppList.vue' ...@@ -6,6 +6,9 @@ import AppList from '@/components/base/AppList.vue'
import { getMaterialList, updateMaterial, deleteMaterial } from '../api' import { getMaterialList, updateMaterial, deleteMaterial } from '../api'
import { getNameByValue, materialMethodList, materialUsageList, materialUsersList } from '@/utils/dictionary' import { getNameByValue, materialMethodList, materialUsageList, materialUsersList } from '@/utils/dictionary'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue')) const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue'))
...@@ -149,14 +152,19 @@ async function handleChangeStatus(row: MaterialProp) { ...@@ -149,14 +152,19 @@ async function handleChangeStatus(row: MaterialProp) {
<AppCard> <AppCard>
<AppList border v-bind="listOptions" ref="appList"> <AppList border v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-space> <el-space v-if="!userStore.status.material_status">
<router-link :to="{ path: '/material/create', query: $route.query }"> <router-link :to="{ path: '/material/create', query: $route.query }">
<el-button type="primary" :icon="Plus">营销内容创作</el-button> <el-button type="primary" :icon="Plus">营销内容创作</el-button>
</router-link> </router-link>
</el-space> </el-space>
</template> </template>
<template #table-status="{ row }"> <template #table-status="{ row }">
<el-switch v-model="row.status" active-value="1" inactive-value="0" :before-change="() => handleChangeStatus(row)"></el-switch> <el-switch
v-model="row.status"
active-value="1"
inactive-value="0"
:before-change="() => handleChangeStatus(row)"
></el-switch>
</template> </template>
<template #table-x="{ row }"> <template #table-x="{ row }">
<el-button type="primary" plain @click="handleView(row)">查看</el-button> <el-button type="primary" plain @click="handleView(row)">查看</el-button>
......
...@@ -4,6 +4,9 @@ import { Plus } from '@element-plus/icons-vue' ...@@ -4,6 +4,9 @@ import { Plus } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getMetaEvent, getConnectionsList, deleteMetaEvent } from '../api' import { getMetaEvent, getConnectionsList, deleteMetaEvent } from '../api'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const FormDialog = defineAsyncComponent(() => import('../components/FormDialog.vue')) const FormDialog = defineAsyncComponent(() => import('../components/FormDialog.vue'))
const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue')) const ViewDialog = defineAsyncComponent(() => import('../components/ViewDialog.vue'))
...@@ -55,7 +58,9 @@ const listOptions = computed(() => { ...@@ -55,7 +58,9 @@ const listOptions = computed(() => {
label: '状态', label: '状态',
prop: 'status_name', prop: 'status_name',
computed: (row: any) => { computed: (row: any) => {
return row.row.status === '0' ? `<span style="color: rgb(170, 2, 49)">${row.row.status_name}</span>` : `<span style="color: #00ac27">${row.row.status_name}</span>` return row.row.status === '0'
? `<span style="color: rgb(170, 2, 49)">${row.row.status_name}</span>`
: `<span style="color: #00ac27">${row.row.status_name}</span>`
} }
}, },
{ label: '更新人', prop: 'updated_operator_name' }, { label: '更新人', prop: 'updated_operator_name' },
...@@ -114,7 +119,7 @@ const handleField = function (row: EventProp) { ...@@ -114,7 +119,7 @@ const handleField = function (row: EventProp) {
<AppCard> <AppCard>
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-space> <el-space v-if="!userStore.status.tag_status">
<el-button type="primary" :icon="Plus" @click="handleAdd">新建</el-button> <el-button type="primary" :icon="Plus" @click="handleAdd">新建</el-button>
</el-space> </el-space>
</template> </template>
...@@ -127,7 +132,13 @@ const handleField = function (row: EventProp) { ...@@ -127,7 +132,13 @@ const handleField = function (row: EventProp) {
</AppList> </AppList>
</AppCard> </AppCard>
<!-- 新建/修改 --> <!-- 新建/修改 -->
<FormDialog v-model="formVisible" :data="currentRow" @update="handleRefresh" :option="experimentConnectionOptions || []" v-if="formVisible" /> <FormDialog
v-model="formVisible"
:data="currentRow"
@update="handleRefresh"
:option="experimentConnectionOptions || []"
v-if="formVisible"
/>
<!-- 查看 --> <!-- 查看 -->
<ViewDialog v-model="viewVisible" :data="currentRow" v-if="viewVisible && currentRow" /> <ViewDialog v-model="viewVisible" :data="currentRow" v-if="viewVisible && currentRow" />
<FieldDialog v-model="fieldVisible" :data="currentRow" v-if="fieldVisible && currentRow"></FieldDialog> <FieldDialog v-model="fieldVisible" :data="currentRow" v-if="fieldVisible && currentRow"></FieldDialog>
......
...@@ -5,6 +5,9 @@ import { ElMessageBox, ElMessage } from 'element-plus' ...@@ -5,6 +5,9 @@ import { ElMessageBox, ElMessage } from 'element-plus'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getMemberMeta, deleteMemberMeta } from '../api' import { getMemberMeta, deleteMemberMeta } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const store = useMapStore() const store = useMapStore()
...@@ -48,7 +51,9 @@ const listOptions = computed(() => { ...@@ -48,7 +51,9 @@ const listOptions = computed(() => {
label: '状态', label: '状态',
prop: 'status_name', prop: 'status_name',
computed: (row: any) => { computed: (row: any) => {
return row.row.status === '0' ? `<span style="color: rgb(170, 2, 49)">${row.row.status_name}</span>` : `<span style="color: #00ac27">${row.row.status_name}</span>` return row.row.status === '0'
? `<span style="color: rgb(170, 2, 49)">${row.row.status_name}</span>`
: `<span style="color: #00ac27">${row.row.status_name}</span>`
} }
}, },
{ label: '更新人', prop: 'updated_operator_name' }, { label: '更新人', prop: 'updated_operator_name' },
...@@ -100,7 +105,7 @@ function handleRemove(row: UserProp) { ...@@ -100,7 +105,7 @@ function handleRemove(row: UserProp) {
<AppCard> <AppCard>
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-space> <el-space v-if="!userStore.status.status">
<el-button type="primary" :icon="Plus" @click="handleAdd">新建</el-button> <el-button type="primary" :icon="Plus" @click="handleAdd">新建</el-button>
</el-space> </el-space>
</template> </template>
......
...@@ -15,7 +15,7 @@ interface State { ...@@ -15,7 +15,7 @@ interface State {
organization: OrganizationType | null organization: OrganizationType | null
roles: RoleType[] roles: RoleType[]
permissions: PermissionType[] permissions: PermissionType[]
status: boolean status: any
} }
export const useUserStore = defineStore({ export const useUserStore = defineStore({
...@@ -27,7 +27,7 @@ export const useUserStore = defineStore({ ...@@ -27,7 +27,7 @@ export const useUserStore = defineStore({
project: null, project: null,
roles: [], roles: [],
permissions: [], permissions: [],
status: false status: {}
}), }),
getters: { getters: {
isLogin: state => !!state.user isLogin: state => !!state.user
...@@ -45,7 +45,7 @@ export const useUserStore = defineStore({ ...@@ -45,7 +45,7 @@ export const useUserStore = defineStore({
this.permissions = permissions this.permissions = permissions
await useMapStore().getMapList() await useMapStore().getMapList()
await checkDataStatus().then(res => { await checkDataStatus().then(res => {
this.status = res.data.status this.status = res.data
}) })
}, },
async logout() { async logout() {
......
...@@ -5,7 +5,7 @@ import type { DirectiveBinding } from 'vue' ...@@ -5,7 +5,7 @@ import type { DirectiveBinding } from 'vue'
export function checkPermission(value: string | string[]): boolean { export function checkPermission(value: string | string[]): boolean {
const userStore = useUserStore() const userStore = useUserStore()
// true 是学员且使用公共数据(学员不能自己创建数据) false 学员可以自己创建数据 // true 是学员且使用公共数据(学员不能自己创建数据) false 学员可以自己创建数据
if (!userStore.status) return true // if (!userStore.status) return true
const permissions = userStore.permissions const permissions = userStore.permissions
if (Array.isArray(value)) { if (Array.isArray(value)) {
return permissions.some(item => value.includes(item.tag)) return permissions.some(item => value.includes(item.tag))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论