@jari-ace/element-plus-component 0.4.1 → 0.4.3

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.3",
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
@@ -42,7 +42,8 @@ import {
42
42
  ElDropdownItem,
43
43
  ElDropdownMenu,
44
44
  ElIcon,
45
- ElTag
45
+ ElTag,
46
+ ElTooltip
46
47
  } from "element-plus";
47
48
  import type { AceFile } from "./types";
48
49
 
@@ -98,6 +99,7 @@ const files = ref<FileInfo[]>([]);
98
99
  const classificationLevels = ref<ClassificationLevel[]>([]);
99
100
  const allowedClassificationLevels = ref<ClassificationLevel[]>([]);
100
101
  const classificationLevelMap = ref<Map<number, string>>();
102
+ const highestClassificationLevel = ref<number>();
101
103
  const user = ref<Ace.User>();
102
104
  const selectedFileClassificationLevel = ref(50);
103
105
  const curAttachToken = ref<string>();
@@ -170,18 +172,7 @@ let uppy: Uppy | undefined;
170
172
  curAttachToken.value = props.attachToken;
171
173
 
172
174
  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
- )
175
+ await updateAllowedClassificationLevels();
185
176
  if (props.attachToken) {
186
177
  await initLoad();
187
178
  } else {
@@ -194,6 +185,22 @@ onUnmounted(() => {
194
185
  uppy = undefined;
195
186
  });
196
187
 
188
+ async function updateAllowedClassificationLevels() {
189
+ user.value = useLoginUser();
190
+ const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
191
+ classificationLevels.value = await useSystemClassificationLevels();
192
+ classificationLevelMap.value = await useSystemClassificationLevelMap();
193
+ allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
194
+ highestClassificationLevel.value = Math.min(...allowedClassificationLevels.value.map(l=>l.value))
195
+ console.log(`附件控件密级调试:
196
+ 表单密级:`, props.classificationLevel, `
197
+ 用户密级:`, user.value?.classifiedLevel, `
198
+ 表单/用户密级比较后取最低密级:`, cl, `
199
+ 系统密级:`, classificationLevels.value, `
200
+ 最终可选密级:`, allowedClassificationLevels.value
201
+ );
202
+ }
203
+
197
204
  async function loadFileInfos() {
198
205
  if (!curAttachToken.value) {
199
206
  files.value = [];
@@ -487,6 +494,8 @@ watch(() => props.attachToken, () => {
487
494
  }
488
495
  });
489
496
 
497
+ watch(()=> props.classificationLevel, updateAllowedClassificationLevels)
498
+
490
499
  </script>
491
500
 
492
501
  <template>
@@ -530,12 +539,17 @@ watch(() => props.attachToken, () => {
530
539
  {{ prettyBytes(scope.row.fileSize) }}
531
540
  </template>
532
541
  </el-table-column>
533
- <el-table-column prop="classifiedLevel" width="60">
542
+ <el-table-column prop="classifiedLevel" width="80">
534
543
  <template #default="scope">
535
544
  <el-tag
536
545
  :type="scope.row.classifiedLevel < 50 ? (scope.row.classifiedLevel < 30 ? 'danger' : 'warning') : 'info'">
537
546
  {{ classificationLevelMap?.get(scope.row.classifiedLevel) }}
538
547
  </el-tag>
548
+ <el-tooltip v-if="scope.row.classifiedLevel < highestClassificationLevel" content="文件密级已高于当前许可范围,请立即删除">
549
+ <el-icon color="#F56C6C">
550
+ <warning-filled/>
551
+ </el-icon>
552
+ </el-tooltip>
539
553
  </template>
540
554
  </el-table-column>
541
555
  <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";