@yqg/permission 1.0.6-beta.0 → 1.0.6

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.6-beta.0",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -13,16 +13,14 @@
13
13
  "dev": "vite",
14
14
  "preview": "vite preview"
15
15
  },
16
- "dependencies": {
17
- "@ant-design/icons-vue": "^7.0.1",
16
+ "devDependencies": {
17
+ "@ant-design/icons-vue": "^7.0.1",
18
18
  "@commitlint/cli": "^19.5.0",
19
19
  "@commitlint/config-conventional": "^19.5.0",
20
20
  "ant-design-vue": "4.x",
21
21
  "axios": "^1.7.7",
22
22
  "vite-plugin-css-injected-by-js": "^3.5.2",
23
- "vue": "^3.5.12"
24
- },
25
- "devDependencies": {
23
+ "vue": "^3.5.12",
26
24
  "@typescript-eslint/parser": "^8.13.0",
27
25
  "@vitejs/plugin-vue": "^5.1.4",
28
26
  "eslint": "^9.14.0",
package/src/App.vue CHANGED
@@ -8,16 +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.ROLE.QUERY',
11
+ const permissions = reactive(['CRANE.ROLE.QUERY',
13
12
  'CRANE.ROLE.CREATE',
14
13
  'CRANE.ROLE.UPDATE',
15
14
  'CRANE.ROLE.DELETE',
16
15
  'CRANE.ROLE.PERMISSION_ASSIGN',
17
16
  'CRANE.ROLE.EMPLOYEE_ASSIGN',
18
17
  'CRANE.ROLE.DETAIL_QUERY',
19
- 'CRANE.ROLE.EXPORT',
20
- ]);
18
+ 'CRANE.ROLE.EXPORT']);
21
19
  // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
22
20
  const changeColor = () => {
23
21
  color.value = color.value === '#f00' ? '#1677ff' : '#f00';
@@ -40,11 +38,11 @@ const changeLocale = () => {
40
38
  <!-- 05184 -->
41
39
  <yqg-permission
42
40
  :permissions="permissions"
43
- workNumber="05181"
41
+ workNumber="EX03385"
44
42
  businessCode="CRANE"
45
43
  :color="color"
46
44
  :locale="locale"
47
- @success="() => {console.log('成功')}"
45
+ @onSuccess="() => {console.log('成功')}"
48
46
  >
49
47
  </yqg-permission>
50
48
  </div>
@@ -5,6 +5,7 @@
5
5
  width="800px"
6
6
  @ok="handleOk"
7
7
  :okText="t('submit')"
8
+ :maskClosable="false"
8
9
  :ok-button-props="{ loading: loading }"
9
10
  :cancelText="t('cancel')">
10
11
  <Form
@@ -112,7 +113,7 @@
112
113
  },
113
114
 
114
115
  });
115
- const emit = defineEmits(['onSuccess']);
116
+ const emit = defineEmits(['onSubmit', 'onSuccess']);
116
117
  const open = defineModel({
117
118
  required: true,
118
119
  default: false,
@@ -155,8 +156,8 @@
155
156
  const url = res?.body?.oaFlowUrl;
156
157
  open.value = false;
157
158
  loading.value = false;
158
-
159
- successModal.value?.countDown(url, () => emit('onSuccess'));
159
+ emit('onSubmit');
160
+ successModal.value?.countDown(url, () => emit('onSuccess'));
160
161
  })
161
162
  };
162
163
 
@@ -172,8 +173,7 @@
172
173
 
173
174
  const onChangeHandler = throttle(async () => {
174
175
  if (formState.roleIds.length > 5) {
175
- formState.roleIds.pop();
176
- return message.warning(t('maxCountTips', {count: 5}));
176
+ return;
177
177
  }
178
178
 
179
179
  if (!formState.roleIds.length) {
@@ -186,6 +186,14 @@
186
186
  stepNodes.value = res?.body?.nodes || [];
187
187
  }, 0)
188
188
 
189
+ watch(() => formState.roleIds, (val) => {
190
+ // 写到watch里避免闪烁
191
+ if (val.length > 5) {
192
+ formState.roleIds.pop();
193
+ message.warning(t('maxCountTips', {count: 5}));
194
+ }
195
+ })
196
+
189
197
  watch(() => open.value, (cur) => {
190
198
  if (cur) {
191
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'"
@@ -21,17 +21,17 @@
21
21
  onOk: () => {
22
22
  window.open(url);
23
23
  modal1.destroy();
24
- if (callback) {
25
- callback();
26
- } else {
24
+ callback && callback();
25
+ window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
26
+ if (!window.YQG_PERMISSION_CALLBACK && !callback) {
27
27
  location.reload();
28
28
  }
29
29
  },
30
30
  onCancel: () => {
31
31
  modal1.destroy();
32
- if (callback) {
33
- callback();
34
- } else {
32
+ callback && callback();
33
+ window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
34
+ if (!window.YQG_PERMISSION_CALLBACK && !callback) {
35
35
  location.reload();
36
36
  }
37
37
  },
@@ -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>
@@ -195,6 +196,7 @@
195
196
  };
196
197
 
197
198
  const goViewApproval = () => {
199
+ console.log(curApproving.value)
198
200
  if (curApproving.value?.oaFlowUrl) {
199
201
  window.open(curApproving.value.oaFlowUrl);
200
202
  }
@@ -215,6 +217,7 @@
215
217
  };
216
218
 
217
219
  const showModal = () => {
220
+ getPermissions();
218
221
  open.value = !open.value;
219
222
  };
220
223
 
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天',
@@ -53,3 +53,6 @@ declare type formStateType = {
53
53
  submitWorkNumber: string,
54
54
 
55
55
  };
56
+ declare interface Window {
57
+ YQG_PERMISSION_CALLBACK?: () => void;
58
+ }
package/src/vite-env.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />