Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bpm fix 250121 #124

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 34 additions & 69 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/api/bpm/processInstance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type ApprovalTaskInfo = {
assigneeUser: User
status: number
reason: string
sign: string
sign: string // TODO @lesan:字段改成 signPicUrl 签名照片。只有 sign 感觉是签名文本哈。
}

// 审批节点信息
Expand Down Expand Up @@ -90,7 +90,7 @@ export const getProcessInstanceCopyPage = async (params: any) => {

// 获取审批详情
export const getApprovalDetail = async (params: any) => {
return await request.get({ url: 'bpm/process-instance/get-approval-detail' , params })
return await request.get({ url: 'bpm/process-instance/get-approval-detail', params })
}

// 获取表单字段权限
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
:value="node.value"
/>
</el-select>
<el-button class="mla" type="danger" link @click="deleteRouterGroup(index)"
>删除</el-button
>
<el-button class="mla" type="danger" link @click="deleteRouterGroup(index)">
删除
</el-button>
</div>
</template>
<Condition
Expand Down Expand Up @@ -67,6 +67,7 @@ import { Plus } from '@element-plus/icons-vue'
import { SimpleFlowNode, NodeType, ConditionType, RouterCondition } from '../consts'
import { useWatchNode, useDrawer, useNodeName } from '../node'
import Condition from './components/Condition.vue'

defineOptions({
name: 'RouterNodeConfig'
})
Expand All @@ -86,9 +87,9 @@ const currentNode = useWatchNode(props)
const { nodeName, showInput, clickIcon, blurEvent } = useNodeName(NodeType.ROUTER_BRANCH_NODE)
const routerGroups = ref<RouterCondition[]>([])
const nodeOptions = ref()

const conditionRef = ref([])
// 保存配置

/** 保存配置 */
const saveConfig = async () => {
// 校验表单
let valid = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
</div>
</div>
</el-tab-pane>
<!-- TODO @lesan:要不抽成 Listener 小组件?类似 Condition.vue -->
<el-tab-pane label="监听器" name="listener">
<el-form ref="listenerFormRef" :model="configForm" label-position="top">
<div v-for="(listener, listenerIdx) in taskListener" :key="listenerIdx">
Expand Down
19 changes: 7 additions & 12 deletions src/directives/permission/hasPermi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { App } from 'vue'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import type {App} from 'vue'
import {useUserStore} from "@/store/modules/user";

const { t } = useI18n() // 国际化

Expand All @@ -18,14 +18,9 @@ export function hasPermi(app: App<Element>) {
}
})
}

const userStore = useUserStore();
const all_permission = '*:*:*'
export const hasPermission = (permission: string[]) => {
const { wsCache } = useCache()
const all_permission = '*:*:*'
const userInfo = wsCache.get(CACHE_KEY.USER)
const permissions = userInfo?.permissions || []

return permissions.some((p: string) => {
return all_permission === p || permission.includes(p)
})
}
return userStore.permissionsSet.has(all_permission) ||
permission.some(permission => userStore.permissionsSet.has(permission))
}
3 changes: 3 additions & 0 deletions src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface UserVO {
interface UserInfoVO {
// USER 缓存
permissions: string[]
permissionsSet: Set<string>
roles: string[]
isSetUser: boolean
user: UserVO
Expand All @@ -24,6 +25,7 @@ interface UserInfoVO {
export const useUserStore = defineStore('admin-user', {
state: (): UserInfoVO => ({
permissions: [],
permissionsSet: new Set<string>(),
roles: [],
isSetUser: false,
user: {
Expand Down Expand Up @@ -58,6 +60,7 @@ export const useUserStore = defineStore('admin-user', {
userInfo = await getInfo()
}
this.permissions = userInfo.permissions
this.permissionsSet = new Set(userInfo.permissions)
this.roles = userInfo.roles
this.user = userInfo.user
this.isSetUser = true
Expand Down
19 changes: 4 additions & 15 deletions src/utils/permission.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import {hasPermission} from "@/directives/permission/hasPermi";


const { t } = useI18n() // 国际化

Expand All @@ -7,21 +9,8 @@ const { t } = useI18n() // 国际化
* @param {Array} value 校验值
* @returns {Boolean}
*/
export function checkPermi(value: string[]) {
if (value && value instanceof Array && value.length > 0) {
const { wsCache } = useCache()
const permissionDatas = value
const all_permission = '*:*:*'
const userInfo = wsCache.get(CACHE_KEY.USER)
const permissions = userInfo?.permissions || []
const hasPermission = permissions.some((permission: string) => {
return all_permission === permission || permissionDatas.includes(permission)
})
return !!hasPermission
} else {
console.error(t('permission.hasPermission'))
return false
}
export function checkPermi(permission: string[]) {
return hasPermission(permission)
}

/**
Expand Down
Loading