@yqg/permission 1.0.7-beta.0 → 1.0.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.0.7-beta.0",
3
+ "version": "1.0.9-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
package/src/App.vue CHANGED
@@ -8,9 +8,14 @@ type LocaleType = 'zh-CN' | 'en-US' | 'id-ID' | 'fil-PH';
8
8
  const color = ref<string>('#1677ff');
9
9
  const locale = ref<LocaleType>('zh-CN');
10
10
 
11
- const permissions = reactive([
12
- 'CRANE.EMPLOYEE.QUERY', 'CRANE.EMPLOYEE.DETAIL_QUERY', 'CRANE.EMPLOYEE.ATTRIBUTE_CREATE', 'CRANE.EMPLOYEE.ROLE_ASSIGN'
13
- ]);
11
+ const permissions = reactive(['CRANE.ROLE.QUERY',
12
+ 'CRANE.ROLE.CREATE',
13
+ 'CRANE.ROLE.UPDATE',
14
+ 'CRANE.ROLE.DELETE',
15
+ 'CRANE.ROLE.PERMISSION_ASSIGN',
16
+ 'CRANE.ROLE.EMPLOYEE_ASSIGN',
17
+ 'CRANE.ROLE.DETAIL_QUERY',
18
+ 'CRANE.ROLE.EXPORT']);
14
19
  // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
15
20
  const changeColor = () => {
16
21
  color.value = color.value === '#f00' ? '#1677ff' : '#f00';
@@ -37,7 +42,7 @@ const changeLocale = () => {
37
42
  businessCode="CRANE"
38
43
  :color="color"
39
44
  :locale="locale"
40
- @success="() => {console.log('成功')}"
45
+ @onSuccess="() => {console.log('成功')}"
41
46
  >
42
47
  </yqg-permission>
43
48
  </div>
@@ -113,7 +113,7 @@
113
113
  },
114
114
 
115
115
  });
116
- const emit = defineEmits(['onSuccess']);
116
+ const emit = defineEmits(['onSubmit', 'onSuccess']);
117
117
  const open = defineModel({
118
118
  required: true,
119
119
  default: false,
@@ -156,8 +156,8 @@
156
156
  const url = res?.body?.oaFlowUrl;
157
157
  open.value = false;
158
158
  loading.value = false;
159
-
160
- successModal.value?.countDown(url, () => emit('onSuccess'));
159
+ emit('onSubmit');
160
+ successModal.value?.countDown(url, () => emit('onSuccess'));
161
161
  })
162
162
  };
163
163
 
@@ -172,9 +172,8 @@
172
172
  }
173
173
 
174
174
  const onChangeHandler = throttle(async () => {
175
- if (formState.roleIds.length > 5) {
176
- formState.roleIds.pop();
177
- return message.warning(t('maxCountTips', {count: 5}));
175
+ if (formState.roleIds.length > 1) {
176
+ return;
178
177
  }
179
178
 
180
179
  if (!formState.roleIds.length) {
@@ -187,6 +186,14 @@
187
186
  stepNodes.value = res?.body?.nodes || [];
188
187
  }, 0)
189
188
 
189
+ watch(() => formState.roleIds, (val) => {
190
+ // 写到watch里避免闪烁
191
+ if (val.length > 1) {
192
+ formState.roleIds.pop();
193
+ message.warning(t('maxCountTips', {count: 5}));
194
+ }
195
+ })
196
+
190
197
  watch(() => open.value, (cur) => {
191
198
  if (cur) {
192
199
  formRef.value?.resetFields();
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="crane-checkbox-line">
3
3
  <Checkbox
4
- :value="item.roleId"
4
+ :value="item.roleId"
5
5
  :disabled="['OWNER', 'PENDING', 'NO'].includes(props.item.businessApplyType)"
6
6
  @change="onCheck">
7
7
  <div class="crane-flex-center crane-checkbox-label">
@@ -30,7 +30,8 @@
30
30
  </Tag>
31
31
  <Popover>
32
32
  <template #content>
33
- {{t('lastDays', {count: item?.ownStatusVO?.dayDiff})}}
33
+ <span v-if="item?.ownStatusVO?.dayDiff>0">{{t('lastDays', {count: item?.ownStatusVO?.dayDiff})}}</span>
34
+ <span v-else>{{ t('taday') }}</span>
34
35
  </template>
35
36
  <Tag
36
37
  v-if="item.businessApplyType === 'TEMP_OWNER'"
@@ -76,7 +76,8 @@
76
76
  :permissionList="permissionList"
77
77
  :workNumber="workNumber"
78
78
  :businessCode="businessCode"
79
- @onSuccess="getPermissions">
79
+ @onSuccess="() => emit('onSuccess')"
80
+ @onSubmit="getPermissions">
80
81
  </ApplyModal>
81
82
 
82
83
  </ConfigProvider>
package/src/i18n/en-US.ts CHANGED
@@ -28,6 +28,10 @@ export default {
28
28
  availableTime: '有效期',
29
29
  selectPlaceholder: '请选择权限点',
30
30
  reasonPlaceholder: '请输入申请理由',
31
+ maxCountTips: '一次最多只可申请{count}个权限',
32
+ maxLengthTips: '最多{length}个字符',
33
+ lastDays: '{count}天后到期',
34
+ taday: '今天到期',
31
35
  availiables: {
32
36
  SEVEN_DAYS: '7天',
33
37
  THIRTY_DAYS: '30天',
@@ -43,7 +47,8 @@ export default {
43
47
  status: {
44
48
  PENDING: '审批中',
45
49
  NO: '不可申请',
46
- OWNER: '已拥有',
50
+ OWNER: '永久拥有',
51
+ TEMP_OWNER: '临时拥有',
47
52
  },
48
53
  operationType: {
49
54
  QUERY: '查询',
package/src/i18n/zh-CH.ts CHANGED
@@ -31,6 +31,7 @@ export default {
31
31
  maxCountTips: '一次最多只可申请{count}个权限',
32
32
  maxLengthTips: '最多{length}个字符',
33
33
  lastDays: '{count}天后到期',
34
+ taday: '今天到期',
34
35
  availiables: {
35
36
  SEVEN_DAYS: '7天',
36
37
  THIRTY_DAYS: '30天',