@yqg/permission 1.3.1-alpha.1 → 1.3.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yqg/permission",
3
- "version": "1.3.1-alpha.1",
3
+ "version": "1.3.1-alpha.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
package/src/App.vue CHANGED
@@ -9,7 +9,6 @@ const color = ref<string>('#1677ff');
9
9
  const locale = ref<LocaleType>('zh-CN');
10
10
 
11
11
  const permissions = reactive([
12
- 'CRANE.APPLY.REQUEST.PERMISSION', 'CRANE.APPLY.REQUEST.ROLE', 'CRANE_APPLY_TABLEAU',
13
12
  ]);
14
13
  // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
15
14
  const changeColor = () => {
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <Modal v-model:open="open" width="1100px" :maskClosable="false">
3
3
  <template #footer>
4
- <Button @click="open = false" v-show="!isAllOwn">{{ t('cancel') }}</Button>
4
+ <Button @click="open = false" v-show="!isAllChecked && permissionList.length">{{ t('cancel') }}</Button>
5
5
  <Button type="primary" @click="handleOk" :loading="loading">{{ t('submit') }}</Button>
6
6
  </template>
7
7
  <template #title>
8
8
  <span>{{ t('permissionApply') }}</span>
9
- <span v-show="isAllOwn" class="crane-permission-title-tips">{{ t('isAllOwnTips') }}</span>
9
+ <span v-show="isAllChecked" class="crane-permission-title-tips">{{ t('isAllOwnTips') }}</span>
10
10
  </template>
11
11
  <Form ref="formRef" :model="formState" :labelCol="{ span: 4 }" :wrapperCol="{ span: 19 }">
12
12
  <FormItem :label="t('applyPermission')" name="features"
@@ -37,8 +37,8 @@
37
37
  max: 300, message: t('maxLengthTips', { length: 300 }), trigger: ['change', 'blur']
38
38
  }]">
39
39
  <Textarea v-model:value.trim="formState.applyReason" :placeholder="t('applyReasonPlaceholder')"
40
- :auto-size="{ minRows: 4, maxRows: 4 }" :disabled="isAllOwn">
41
- </Textarea>
40
+ :auto-size="{ minRows: 4, maxRows: 4 }" :disabled="isAllChecked || !permissionList.length">
41
+ </Textarea>
42
42
  <span class="reason-tips" style="font-size: 12px">
43
43
  {{ t('applyReasonTips') }}
44
44
  </span>
@@ -107,7 +107,7 @@ const props = defineProps({
107
107
  type: Array as PropType<string[]>,
108
108
  default: () => []
109
109
  },
110
- isAllOwn: {
110
+ isAllChecked: {
111
111
  type: Boolean,
112
112
  default: false
113
113
  }
@@ -146,7 +146,7 @@ const getValidTimeOptions = async () => {
146
146
 
147
147
  getValidTimeOptions();
148
148
  const handleOk = async () => {
149
- if (props.isAllOwn) {
149
+ if (props.isAllChecked || !permissionList.value.length) {
150
150
  open.value = false;
151
151
  return;
152
152
  }
@@ -38,9 +38,7 @@
38
38
  <div>
39
39
  {{ t('adaptDepartment') }}:
40
40
  </div>
41
- {{item.relatedCompleteNames.map((item: any) => {
42
- return item;
43
- }).join('、')}}
41
+ <div v-for="item in item.relatedCompleteNames">{{ item }}</div>
44
42
  </div>
45
43
  </template>
46
44
  <div class="crane-flex-center crane-margin-left-4">
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  <div>
44
44
  <Button class="crane-margin-right10" @click="goViewApproval">{{ t('viewApprovalDetail')
45
- }}</Button>
45
+ }}</Button>
46
46
  <Button type="primary" @click="showModal">+ {{ t('applyMore') }}</Button>
47
47
  </div>
48
48
  </template>
@@ -63,7 +63,7 @@
63
63
  </div>
64
64
 
65
65
  <ApplyModal v-model="open" :permissionList="permissionList" :spining="loading" :workNumber="workNumber"
66
- :defaultCheckedIds="defaultCheckedIds" :isAllOwn="isAllOwn" @onSuccess="() => emit('onSuccess')"
66
+ :defaultCheckedIds="defaultCheckedIds" :isAllChecked="isAllChecked" @onSuccess="() => emit('onSuccess')"
67
67
  @onSubmit="getPermissions">
68
68
  </ApplyModal>
69
69
 
@@ -132,7 +132,7 @@ const open = ref(false);
132
132
  const curApproving = ref<PermissionType>();
133
133
  const loading = ref(false);
134
134
  const defaultCheckedIds = ref<string[]>([]);
135
- const isAllOwn = ref(false);
135
+ const isAllChecked = ref(false);
136
136
  let permissionList = ref<PermissionListType>([]);
137
137
  let curStatus = ref<Record<string, any>>({
138
138
  imageUrl: noauthority,
@@ -168,8 +168,8 @@ const getPermissions = async () => {
168
168
  const res = await Http.getPermissions(params);
169
169
  const datalist = useFormat(res.body || []);
170
170
  permissionList.value = datalist.data;
171
- defaultCheckedIds.value = datalist.ownList;
172
- isAllOwn.value = datalist.isAllOwn;
171
+ defaultCheckedIds.value = datalist.checkList;
172
+ isAllChecked.value = datalist.isAllChecked;
173
173
  curStatus.value = useStatus(permissionList.value, curApproving);
174
174
  loading.value = false;
175
175
  };
@@ -9,7 +9,7 @@ const StatusType = {
9
9
  TEMP_OWNER: 'TEMP_OWNER'
10
10
  }
11
11
  export default function useFormat(tree: PermissionListType) {
12
- const ownList: string[] = [];
12
+ const checkList: string[] = [];
13
13
  let allCount: number = 0;
14
14
  function sortTree(
15
15
  tree: PermissionListType,
@@ -22,21 +22,21 @@ export default function useFormat(tree: PermissionListType) {
22
22
  if (!node.children || node.children.length === 0) {
23
23
  node.categoryVOS = (node.categoryVOS || []).filter((item: any) => item.configWay !== Category.AUTO);
24
24
 
25
- if ([StatusType.NO, StatusType.PENDING].includes(node.businessApplyType)) {
25
+ if ([StatusType.NO].includes(node.businessApplyType)) {
26
26
  node.disabled = true;
27
27
  }
28
28
 
29
- if ([StatusType.OWNER].includes(node.businessApplyType) && !node.categoryVOS.length) {
29
+ if (([StatusType.OWNER].includes(node.businessApplyType) && !node.categoryVOS.length) || [StatusType.PENDING].includes(node.businessApplyType)) {
30
30
  node.disabled = true;
31
- ownList.push(node.feature);
31
+ checkList.push(node.feature);
32
32
  }
33
33
  } else {
34
34
  // 递归对子节点进行排序
35
35
  node.children = sortTree(node.children, sortMap, levelSortMap);
36
36
 
37
- // 如果所有子节点都在 ownList 中,那么当前节点也加入 ownList
38
- if (node.children.every((child) => ownList.includes(child.feature))) {
39
- ownList.push(node.feature);
37
+ // 如果所有子节点都在 checkList 中,那么当前节点也加入 checkList
38
+ if (node.children.every((child) => checkList.includes(child.feature))) {
39
+ checkList.push(node.feature);
40
40
  }
41
41
 
42
42
  // 检查所有子节点是否 `disabled === true`
@@ -62,8 +62,8 @@ export default function useFormat(tree: PermissionListType) {
62
62
 
63
63
  return {
64
64
  data: sortTree(tree, sortMap, levelSortMap),
65
- ownList,
66
- isAllOwn: allCount === ownList.length
65
+ checkList,
66
+ isAllChecked: allCount === checkList.length
67
67
  };
68
68
  }
69
69
 
package/src/i18n/zh-CH.ts CHANGED
@@ -3,7 +3,7 @@ export default {
3
3
  applyPermission: '申请权限',
4
4
  applyReason: '申请理由',
5
5
  approvalProcess: '审批流程',
6
- isAllOwnTips: '您当前已拥有该页面所有权限,无需申请',
6
+ isAllOwnTips: '当前页面权限已拥有或审批中,无需申请',
7
7
  applyReasonPlaceholder: '请尽可能详细说明申请原因和使用场景,不要只填写“工作需要”之类的理由,以免影响你获取权限的审批时间。',
8
8
  applyReasonTips: '示例:由于XX项目需要,需要查看/操作XXXX场景/问题,涉及到XXX权限的使用,因此提交申请!',
9
9
  cancel: '取消',
@@ -32,7 +32,7 @@ export default {
32
32
  maxLengthTips: '最多{length}个字符',
33
33
  today: '今天到期',
34
34
  clickToApply: '点击申请权限',
35
- noPermissionTips: '该菜单下暂无权限点',
35
+ noPermissionTips: '该菜单下暂无权限点,无需申请',
36
36
  lastDays: '{count}天',
37
37
  categoryTips: '当前您所拥有的数据范围如下:',
38
38
  empty: '空',