@yqg/permission 1.3.8 → 1.3.9-beta.0

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.8",
3
+ "version": "1.3.9-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -14,31 +14,33 @@
14
14
  "preview": "vite preview",
15
15
  "demo:build": "vue-tsc -b && STAGE=test vite build",
16
16
  "prod:build": "vue-tsc -b && STAGE=prod vite build"
17
-
18
17
  },
19
18
  "devDependencies": {
19
+ "@alicloud/cdn20180510": "3.1.2",
20
+ "@alicloud/openapi-client": "0.4.12",
20
21
  "@ant-design/icons-vue": "^7.0.1",
21
22
  "@commitlint/cli": "^19.5.0",
22
23
  "@commitlint/config-conventional": "^19.5.0",
24
+ "@originjs/vite-plugin-commonjs": "1.0.3",
23
25
  "@types/vue": "^2.0.0",
24
26
  "@typescript-eslint/parser": "^8.13.0",
25
27
  "@vitejs/plugin-vue": "^5.1.4",
28
+ "@yqg/max-utils": "^1.0.2",
29
+ "ali-oss": "6.17.1",
26
30
  "ant-design-vue": "4.x",
27
31
  "axios": "^1.7.7",
32
+ "chalk": "5.3.0",
28
33
  "eslint": "^9.14.0",
29
34
  "husky": "^9",
30
35
  "lint-staged": "^13.2.0",
36
+ "ora": "5.4.1",
31
37
  "typescript": "~5.5.4",
32
38
  "vite": "^5.4.9",
33
39
  "vite-plugin-css-injected-by-js": "^3.5.2",
34
40
  "vue": "^3.5.12",
35
- "vue-tsc": "^2.1.8",
36
- "@alicloud/cdn20180510": "3.1.2",
37
- "@alicloud/openapi-client": "0.4.12",
38
- "@originjs/vite-plugin-commonjs": "1.0.3",
39
- "@yqg/max-utils": "^1.0.2",
40
- "ali-oss": "6.17.1",
41
- "chalk": "5.3.0",
42
- "ora": "5.4.1"
41
+ "vue-tsc": "^2.1.8"
42
+ },
43
+ "dependencies": {
44
+ "sharp": "^0.34.3"
43
45
  }
44
46
  }
package/src/App.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, reactive } from 'vue';
2
+ import { ref } from 'vue';
3
3
  import {Button} from 'ant-design-vue';
4
4
 
5
5
  // 中英印尼菲律宾
@@ -9,9 +9,7 @@ const color = ref<string>('#1677ff');
9
9
  const locale = ref<LocaleType>('id-ID');
10
10
 
11
11
  // const permissions = ref('CALL_CENTER.DATA_BUSINESS.QUERY,CALL_CENTER.ENTER_ADMIN,CALL_CENTER.USER.QUERY,CALL_CENTER.USER.MANAGE,CALL_CENTER.BUSINESS.QUERY,CALL_CENTER.SKILL_GROUP.QUERY');
12
- const permissions = reactive([
13
- 'yewei0313.REAQS.DEPAWED_ANQ2.QUERY',
14
- ]);
12
+ const permissions = 'RECONCILIATION.DATA_INGESTION.RESOLVE_TASK.QUERY,RECONCILIATION.DATA_INGESTION.RESOLVE_TASK.CANCEL,RECONCILIATION.DATA_INGESTION.RESOLVE_TASK.FILE_DOWNLOAD';
15
13
  //05615
16
14
  // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
17
15
  const changeColor = () => {
@@ -33,8 +31,8 @@ const changeLocale = () => {
33
31
  <!-- 03541 -->
34
32
  <!-- 02124 -->
35
33
  <!-- 05184 -->
36
- <yqg-permission :permissions="permissions" workNumber="03817" :color="color" :locale="locale"
37
- :omitCategoryIds="[81, 102]" @onSuccess="() => {console.log('成功')}">
34
+ <yqg-permission :omitCategoryIds="[]" :permissions="permissions" workNumber="05004" :color="color" :locale="locale"
35
+ @onSuccess="() => {console.log('成功')}">
38
36
  </yqg-permission>
39
37
  </div>
40
38
  <data class="case-card">
@@ -22,11 +22,9 @@
22
22
  {{ t('noPermissionTips') }}
23
23
  </span>
24
24
  <div v-else :class="{ 'yqg-permission-tree-list-wraper': showScrollBar }">
25
-
26
-
27
25
  <Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200"
28
- :expandedKeys="expandedKeys"
29
- :checkedKeys="formState.features" @check="onCheck" @expand="expandedKeys = $event">
26
+ :expandedKeys="expandedKeys" :checkedKeys="formState.features" @check="onCheck"
27
+ @expand="expandedKeys = $event">
30
28
  <template #title="item: PermissionType">
31
29
  <div v-if="item.children && item.children.length">
32
30
  {{ item.shortName }}
@@ -59,11 +57,12 @@
59
57
 
60
58
  </Form>
61
59
 
62
- <SuccessModal ref="successModal" />
63
-
64
60
  </ConfigProvider>
65
61
 
66
62
  </Modal>
63
+
64
+ <SuccessModal ref="successModal" />
65
+
67
66
  </template>
68
67
  <script lang="ts" setup>
69
68
  import {
@@ -173,15 +172,20 @@ const handleOk = async () => {
173
172
  open.value = false;
174
173
  return;
175
174
  }
176
- await Promise.all([formRef.value.validate(), categoryRef.value?.validate()])
177
- loading.value = true;
178
- const params = getParams();
179
- let res = await Http.submitApply(params);
180
- const url = res?.body?.oaFlowUrl;
181
- open.value = false;
182
- loading.value = false;
183
- emit('onSubmit');
184
- successModal.value?.countDown(url, () => emit('onSuccess'));
175
+ if (loading.value) return;
176
+ try {
177
+ await Promise.all([formRef.value.validate(), categoryRef.value?.validate()])
178
+ loading.value = true;
179
+ const params = getParams();
180
+ let res = await Http.submitApply(params);
181
+ const url = res?.body?.oaFlowUrl;
182
+ open.value = false;
183
+ loading.value = false;
184
+ emit('onSubmit');
185
+ successModal.value?.countDown(url, () => emit('onSuccess'));
186
+ } catch (e) {
187
+ loading.value = false;
188
+ }
185
189
  };
186
190
 
187
191
 
@@ -294,24 +298,22 @@ const onCheck = (checkedIds: any, info: any) => {
294
298
  }
295
299
 
296
300
  const initScrollBar = () => {
297
- const treeHeight = document.querySelector('.yqg-permission-tree-list-holder')?.children?.[0]?.clientHeight || 0;
298
- if (treeHeight > 200) {
299
- // 设置树的高度
300
- showScrollBar.value = true;
301
- } else {
302
- showScrollBar.value = false;
303
- }
301
+ const treeHeight = document.querySelector('.yqg-permission-tree-list-holder')?.children?.[0]?.clientHeight || 0;
302
+ if (treeHeight > 200) {
303
+ // 设置树的高度
304
+ showScrollBar.value = true;
305
+ } else {
306
+ showScrollBar.value = false;
307
+ }
304
308
  }
305
309
 
306
-
307
-
308
310
  watch(() => props.permissionList, (cur) => {
309
311
  expandedKeys.value = [];
310
312
  deepTree(cur, (item: any) => {
311
313
  if (item.children && item.children.length) {
312
314
  expandedKeys.value.push(item.feature);
313
315
  }
314
- })
316
+ });
315
317
 
316
318
  nextTick(() => {
317
319
  initScrollBar();
@@ -378,10 +380,7 @@ const getPopupContainer = ():HTMLElement => {
378
380
  }
379
381
 
380
382
  .yqg-permission-tree-list-wraper :deep(.yqg-permission-tree-list-scrollbar) {
381
- display: block !important;
383
+ display: block !important;
382
384
  }
383
385
 
384
-
385
-
386
-
387
386
  </style>
@@ -19,7 +19,7 @@
19
19
  <span v-else>{{ attributeName }}</span>
20
20
  </template>
21
21
  </TreeSelect>
22
- <span v-if="item.attributeValueIds_view?.includes(ALL_CATEGORY_ID)" style="color: #ff4d4f; font-size: 12px;">
22
+ <span v-if="item.attributeValueIds_view?.includes(-1)" style="color: #ff4d4f; font-size: 12px;">
23
23
  {{ t('categoryChangeTips', { category: item.categoryName }) }}
24
24
  </span>
25
25
  </FormItem>
@@ -36,11 +36,8 @@ import {
36
36
  import { defineProps, PropType, ref, computed, defineExpose } from 'vue';
37
37
  import t from '../utils';
38
38
  import useAttributesCache from '../hooks/useAttributesCache';
39
-
40
39
  const SHOW_PARENT = TreeSelect.SHOW_PARENT;
41
40
 
42
- const ALL_CATEGORY_ID = -1;
43
-
44
41
  const props = defineProps({
45
42
  categoryList: {
46
43
  type: Array as PropType<CategoryType[]>,
@@ -137,7 +137,6 @@ const props = defineProps({
137
137
  required: false,
138
138
  default: () => []
139
139
  },
140
-
141
140
  });
142
141
 
143
142
  const open = ref(false);
@@ -151,6 +150,13 @@ let curStatus = ref<Record<string, any>>({
151
150
  status: '',
152
151
  })
153
152
 
153
+ const needOmitCategoryIds = computed(() => {
154
+ if (Array.isArray(props.omitCategoryIds)) {
155
+ return props.omitCategoryIds;
156
+ }
157
+ return props.omitCategoryIds?.split(',')?.map((item) => Number(item)) || [];
158
+ });
159
+
154
160
  const allPermissions = computed(() => {
155
161
  permissionList.value = [];
156
162
  if (Array.isArray(props.permissions)) {
@@ -159,14 +165,6 @@ const allPermissions = computed(() => {
159
165
  return props.permissions?.split(',')?.filter((item) => item.trim()) || [];
160
166
  });
161
167
 
162
-
163
- const needOmitCategoryIds = computed(() => {
164
- if (Array.isArray(props.omitCategoryIds)) {
165
- return props.omitCategoryIds;
166
- }
167
- return props.omitCategoryIds?.split(',')?.map((item) => Number(item)) || [];
168
- });
169
-
170
168
  const goViewApproval = () => {
171
169
  const url = curApproving.value?.oaFlowUrl;
172
170
  if (!url) return;