@jari-ace/element-plus-component 0.4.1 → 0.4.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@jari-ace/element-plus-component",
3
3
  "private": false,
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "main": "lib/index.umd.cjs",
6
6
  "module": "lib/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "animate.css": "^4.1.1",
26
26
  "pretty-bytes": "^7.1.0",
27
27
  "vue-pdf-embed": "^2.1.3",
28
- "@jari-ace/app-bolts": "0.5.11"
28
+ "@jari-ace/app-bolts": "0.6.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/lodash-es": "^4.17.12",
@@ -10,7 +10,7 @@ import {
10
10
  useLoginUser
11
11
  } from "@jari-ace/app-bolts";
12
12
  import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
13
- import { ArrowDown, Download, Upload } from "@element-plus/icons-vue";
13
+ import { ArrowDown, Download, Upload, WarningFilled } from "@element-plus/icons-vue";
14
14
  import {
15
15
  useSystemClassificationLevelMap,
16
16
  useSystemClassificationLevels
@@ -98,6 +98,7 @@ const files = ref<FileInfo[]>([]);
98
98
  const classificationLevels = ref<ClassificationLevel[]>([]);
99
99
  const allowedClassificationLevels = ref<ClassificationLevel[]>([]);
100
100
  const classificationLevelMap = ref<Map<number, string>>();
101
+ const highestClassificationLevel = ref<number>();
101
102
  const user = ref<Ace.User>();
102
103
  const selectedFileClassificationLevel = ref(50);
103
104
  const curAttachToken = ref<string>();
@@ -170,18 +171,7 @@ let uppy: Uppy | undefined;
170
171
  curAttachToken.value = props.attachToken;
171
172
 
172
173
  onMounted(async () => {
173
- user.value = useLoginUser();
174
- const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
175
- classificationLevels.value = await useSystemClassificationLevels();
176
- classificationLevelMap.value = await useSystemClassificationLevelMap();
177
- allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
178
- console.log(`附件控件密级调试:
179
- 表单密级:`, props.classificationLevel, `
180
- 用户密级:`, user.value?.classifiedLevel, `
181
- 表单/用户密级比较后取最低密级:`, cl, `
182
- 系统密级:`, classificationLevels.value, `
183
- 最终可选密级:`, allowedClassificationLevels.value
184
- )
174
+ await updateAllowedClassificationLevels();
185
175
  if (props.attachToken) {
186
176
  await initLoad();
187
177
  } else {
@@ -194,6 +184,22 @@ onUnmounted(() => {
194
184
  uppy = undefined;
195
185
  });
196
186
 
187
+ async function updateAllowedClassificationLevels() {
188
+ user.value = useLoginUser();
189
+ const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
190
+ classificationLevels.value = await useSystemClassificationLevels();
191
+ classificationLevelMap.value = await useSystemClassificationLevelMap();
192
+ allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
193
+ highestClassificationLevel.value = Math.min(...allowedClassificationLevels.value.map(l=>l.value))
194
+ console.log(`附件控件密级调试:
195
+ 表单密级:`, props.classificationLevel, `
196
+ 用户密级:`, user.value?.classifiedLevel, `
197
+ 表单/用户密级比较后取最低密级:`, cl, `
198
+ 系统密级:`, classificationLevels.value, `
199
+ 最终可选密级:`, allowedClassificationLevels.value
200
+ );
201
+ }
202
+
197
203
  async function loadFileInfos() {
198
204
  if (!curAttachToken.value) {
199
205
  files.value = [];
@@ -487,6 +493,8 @@ watch(() => props.attachToken, () => {
487
493
  }
488
494
  });
489
495
 
496
+ watch(()=> props.classificationLevel, updateAllowedClassificationLevels)
497
+
490
498
  </script>
491
499
 
492
500
  <template>
@@ -530,12 +538,17 @@ watch(() => props.attachToken, () => {
530
538
  {{ prettyBytes(scope.row.fileSize) }}
531
539
  </template>
532
540
  </el-table-column>
533
- <el-table-column prop="classifiedLevel" width="60">
541
+ <el-table-column prop="classifiedLevel" width="80">
534
542
  <template #default="scope">
535
543
  <el-tag
536
544
  :type="scope.row.classifiedLevel < 50 ? (scope.row.classifiedLevel < 30 ? 'danger' : 'warning') : 'info'">
537
545
  {{ classificationLevelMap?.get(scope.row.classifiedLevel) }}
538
546
  </el-tag>
547
+ <el-tooltip v-if="scope.row.classifiedLevel < highestClassificationLevel" content="文件密级已高于当前许可范围,请立即删除">
548
+ <el-icon color="#F56C6C">
549
+ <warning-filled/>
550
+ </el-icon>
551
+ </el-tooltip>
539
552
  </template>
540
553
  </el-table-column>
541
554
  <el-table-column align="right" width="150" fixed="right">
@@ -10,7 +10,14 @@
10
10
  :expand-on-click-node="false"
11
11
  v-bind="$attrs" @current-change="currentChange" :props="{
12
12
  class: (node: TreeNodeData) => selected?.id === node.id ? 'selected-group' : 'group',
13
- }"></el-tree>
13
+ }">
14
+
15
+ <template #default="{ data }">
16
+ <div>
17
+ <div class="name">{{ data.label }} <el-tag v-if="data.resourceScoped" type="info">资源域</el-tag></div>
18
+ </div>
19
+ </template>
20
+ </el-tree>
14
21
  </div>
15
22
  </template>
16
23
 
@@ -24,7 +31,7 @@ import {
24
31
  useUserGroupApi,
25
32
  } from "@jari-ace/app-bolts";
26
33
  import {type TreeNodeType, useTreeData} from "../../../hooks/useTreeData";
27
- import {ElOption, ElSelect, ElTree, vLoading} from "element-plus";
34
+ import {ElOption, ElSelect, ElTree, vLoading, ElTag} from "element-plus";
28
35
  import type {TreeNodeData} from "element-plus/es/components/tree/src/tree.type";
29
36
  import {useAppInstances} from "../../../hooks/useAppInstances";
30
37
  import {useGroups} from "../../../hooks/useGroups";