@yqg/permission 1.3.0 → 1.3.1-alpha.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.0",
3
+ "version": "1.3.1-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -2,6 +2,8 @@ import axios from './axios';
2
2
 
3
3
  const urlPrefix = '/crane';
4
4
 
5
+ export const controller = new AbortController();
6
+
5
7
  type apiType = {
6
8
  [key in string]: (params?: any) => Promise<{body: any}>
7
9
  }
@@ -9,7 +11,9 @@ type apiType = {
9
11
  export default {
10
12
  getPermissions: (params: any) => axios.get(`${urlPrefix}/permission/apply`, {params}),
11
13
 
12
- getFlowPreview: (params: any)=> axios.post(`${urlPrefix}/permission/apply/oa/flow/submit/preview`, params),
14
+ getFlowPreview: (params: any) => axios.post(`${urlPrefix}/permission/apply/oa/flow/submit/preview`, params, {
15
+ signal: controller.signal // 关键配置
16
+ }),
13
17
 
14
18
  submitApply: (params: any) => axios.post(`${urlPrefix}/permission/apply/oa/flow/submit`, params),
15
19
 
@@ -1,16 +1,24 @@
1
1
  <template>
2
- <Modal v-model:open="open" :title="t('permissionApply')" width="1100px" @ok="handleOk" :okText="t('submit')"
3
- :maskClosable="false" :ok-button-props="{ loading: loading }" :cancelText="t('cancel')">
2
+ <Modal v-model:open="open" width="1100px" :maskClosable="false">
3
+ <template #footer>
4
+ <Button @click="open = false" v-show="!isAllOwn">{{ t('cancel') }}</Button>
5
+ <Button type="primary" @click="handleOk" :loading="loading">{{ t('submit') }}</Button>
6
+ </template>
7
+ <template #title>
8
+ <span>{{ t('permissionApply') }}</span>
9
+ <span v-show="isAllOwn" class="crane-permission-title-tips">{{ t('isAllOwnTips') }}</span>
10
+ </template>
4
11
  <Form ref="formRef" :model="formState" :labelCol="{ span: 4 }" :wrapperCol="{ span: 19 }">
5
12
  <FormItem :label="t('applyPermission')" name="features"
6
- :rules="[{ required: true, message: t('selectPlaceholder')}]">
13
+ :rules="[{ required: true, message: t('selectPlaceholder') }]">
7
14
  <Spin :spinning="spining">
8
15
  <span v-if="!permissionList.length">
9
- {{t('noPermissionTips')}}
16
+ {{ t('noPermissionTips') }}
10
17
  </span>
11
18
 
12
- <Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200" :expandedKeys="expandedKeys"
13
- :checkedKeys="formState.features" class="crane-permission-tree" @check="onCheck" @expand="expandedKeys = $event">
19
+ <Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200"
20
+ :expandedKeys="expandedKeys" :checkedKeys="formState.features" class="crane-permission-tree"
21
+ @check="onCheck" @expand="expandedKeys = $event">
14
22
  <template #title="item: PermissionType">
15
23
  <div v-if="item.children && item.children.length">
16
24
  {{ item.shortName }}
@@ -23,16 +31,16 @@
23
31
  <CategorySelector v-if="categoryList.length" :categoryList="categoryList" ref="categoryRef" />
24
32
  </Spin>
25
33
  </FormItem>
26
- <FormItem name="applyReason" :label="t('applyReason')" :rules="[{
27
- required: true, message: t('reasonPlaceholder'), trigger: ['change']
28
- }, {
29
- max: 300, message: t('maxLengthTips', {length: 300}), trigger: ['change', 'blur']
30
- }]">
34
+ <FormItem name="applyReason" :label="t('applyReason')" :rules="[{
35
+ required: true, message: t('reasonPlaceholder'), trigger: ['change']
36
+ }, {
37
+ max: 300, message: t('maxLengthTips', { length: 300 }), trigger: ['change', 'blur']
38
+ }]">
31
39
  <Textarea v-model:value.trim="formState.applyReason" :placeholder="t('applyReasonPlaceholder')"
32
- :auto-size="{ minRows: 4, maxRows: 4 }">
33
- </Textarea>
40
+ :auto-size="{ minRows: 4, maxRows: 4 }" :disabled="isAllOwn">
41
+ </Textarea>
34
42
  <span class="reason-tips" style="font-size: 12px">
35
- {{t('applyReasonTips')}}
43
+ {{ t('applyReasonTips') }}
36
44
  </span>
37
45
  </FormItem>
38
46
 
@@ -46,11 +54,11 @@
46
54
  </Modal>
47
55
  </template>
48
56
  <script lang="ts" setup>
49
- import {
50
- reactive,
51
- defineAsyncComponent,
52
- toRef,
53
- ref,
57
+ import {
58
+ reactive,
59
+ defineAsyncComponent,
60
+ toRef,
61
+ ref,
54
62
  watch,
55
63
  PropType,
56
64
  computed
@@ -63,11 +71,12 @@ import {
63
71
  Textarea,
64
72
  message,
65
73
  Tree,
66
- Spin
74
+ Spin,
75
+ Button
67
76
  } from 'ant-design-vue';
68
77
  import SuccessModal from './success-modal.vue';
69
78
  import ApprovalSteps from './approval-steps.vue';
70
- import t, {throttle, deepTree} from '../utils';
79
+ import t, { throttle, deepTree } from '../utils';
71
80
  import useCategory from '../hooks/useCategory';
72
81
  import useDefaultTime from '../hooks/useDefaultTime';
73
82
 
@@ -93,9 +102,17 @@ const props = defineProps({
93
102
  spining: {
94
103
  type: Boolean,
95
104
  default: false
105
+ },
106
+ defaultCheckedIds: {
107
+ type: Array as PropType<string[]>,
108
+ default: () => []
109
+ },
110
+ isAllOwn: {
111
+ type: Boolean,
112
+ default: false
96
113
  }
97
-
98
- });
114
+
115
+ });
99
116
  const emit = defineEmits(['onSubmit', 'onSuccess']);
100
117
 
101
118
  const open = defineModel({
@@ -128,27 +145,31 @@ const getValidTimeOptions = async () => {
128
145
  };
129
146
 
130
147
  getValidTimeOptions();
131
- const handleOk = async() => {
148
+ const handleOk = async () => {
149
+ if (props.isAllOwn) {
150
+ open.value = false;
151
+ return;
152
+ }
132
153
  await Promise.all([formRef.value.validate(), categoryRef.value?.validate()])
133
- loading.value = true;
154
+ loading.value = true;
134
155
  const params = getParams();
135
156
  let res = await Http.submitApply(params);
136
157
  const url = res?.body?.oaFlowUrl;
137
158
  open.value = false;
138
159
  loading.value = false;
139
160
  emit('onSubmit');
140
- successModal.value?.countDown(url, () => emit('onSuccess'));
141
- };
161
+ successModal.value?.countDown(url, () => emit('onSuccess'));
162
+ };
142
163
 
143
164
 
144
165
  const getParams = () => {
145
166
  formState.submitWorkNumber = submitWorkNumber.value;
146
- const roleVoList:{
167
+ const roleVoList: {
147
168
  roleId: number;
148
169
  validTime: string;
149
170
  }[] = [];
150
171
 
151
- const ruleItems: { attributeCategoryId: number, attributeValueIds: number[]}[] = [];
172
+ const ruleItems: { attributeCategoryId: number, attributeValueIds: number[] }[] = [];
152
173
  categoryList.value.forEach((category: CategoryType) => {
153
174
  // 添加有数据范围值的属性
154
175
  if (category.attributeValueIds_view.length) {
@@ -157,10 +178,10 @@ const getParams = () => {
157
178
  attributeValueIds: category.attributeValueIds_view
158
179
  })
159
180
  };
160
-
181
+
161
182
  });
162
183
  deepTree(permissionList.value, (item: any) => {
163
- if (!item.children && formState.features.includes(item.feature)) {
184
+ if (!item.children && formState.features.includes(item.feature) && !item.disabled) {
164
185
  roleVoList.push({
165
186
  roleId: item.roleId,
166
187
  validTime: item.validTime
@@ -187,20 +208,22 @@ const onChangeTime = throttle(async () => {
187
208
  if (params.roleVoList.length === 0) {
188
209
  stepNodes.value = [];
189
210
  return;
190
- }
211
+ };
212
+
191
213
  let res = await Http.getFlowPreview(params);
192
214
  stepNodes.value = res?.body?.nodes || [];
193
- }, 0)
194
- const onCheck = (checkedIds:any, info:any) => {
215
+ }, 1)
216
+ const onCheck = (checkedIds: any, info: any) => {
195
217
  // 如果选择的是子节点,判断是否超过5个,超过的话,删除当前选的节点,并给予提示
196
218
  // 如果选择的是父节点,判断是否超过5个,超过的话,从当前选择的父节点的叶子节点中删除多出的个数,并给予提示
197
219
  let total = 0;
198
220
  let curTotal = 0;
221
+
199
222
  deepTree(permissionList.value, (item: any) => {
200
- if (!item.children && checkedIds.includes(item.feature)) {
223
+ if (!item.children && checkedIds.includes(item.feature) && !item.disabled) {
201
224
  total += 1;
202
225
  }
203
- if (!item.children && formState.features.includes(item.feature)) {
226
+ if (!item.children && formState.features.includes(item.feature) && !item.disabled) {
204
227
  curTotal += 1;
205
228
  }
206
229
  if (!item.children && !formState.features.includes(item.feature)) {
@@ -225,7 +248,7 @@ const onCheck = (checkedIds:any, info:any) => {
225
248
  if (info.node.children && total > MAX_COUNT) {
226
249
  //选择的是父节点,则找出刚选的所有叶子节点, 并且删除其中多余(total-5)的节点
227
250
  const diff = total - MAX_COUNT;
228
- let leafNodes:string[] = [];
251
+ let leafNodes: string[] = [];
229
252
  deepTree([info.node], (item: any) => {
230
253
  if (!item.children && !item.disabled && !formState.features.includes(item.feature)) {
231
254
  leafNodes.push(item.feature);
@@ -256,6 +279,10 @@ watch(() => props.permissionList, (cur) => {
256
279
  })
257
280
  })
258
281
 
282
+ watch(() => props.defaultCheckedIds, (cur) => {
283
+ formState.features = cur.concat(formState.features);
284
+ }, { immediate: true })
285
+
259
286
  watch(() => open.value, (cur) => {
260
287
  if (cur) {
261
288
  formRef.value?.resetFields();
@@ -266,9 +293,17 @@ watch(() => open.value, (cur) => {
266
293
  </script>
267
294
 
268
295
  <style scoped>
296
+ .crane-permission-title-tips {
297
+ color: #FF4D4F;
298
+ font-size: 14px;
299
+ margin-left: 8px;
300
+ font-weight: 400;
301
+ }
302
+
269
303
  :deep(.yqg-permission-tree-list) {
270
304
  margin-top: 4px;
271
305
  }
306
+
272
307
  :deep(.yqg-permission-tree-node-selected) {
273
308
  background: none !important;
274
309
  }
@@ -284,8 +319,9 @@ watch(() => open.value, (cur) => {
284
319
  :deep(.yqg-permission-tree-checkbox+span:hover) {
285
320
  background: none !important;
286
321
  }
322
+
287
323
  :deep(.yqg-permission-tree-treenode) {
288
- width: 100%!important;
324
+ width: 100% !important;
289
325
  }
290
326
 
291
327
  :deep(.yqg-permission-tree-node-content-wrapper-normal) {
@@ -295,5 +331,4 @@ watch(() => open.value, (cur) => {
295
331
  :deep(.yqg-permission-tree-title) {
296
332
  width: 100% !important;
297
333
  }
298
-
299
334
  </style>
@@ -1,51 +1,48 @@
1
1
  <template>
2
- <div v-if="stepNodes?.length > 1" class="crane-step-wraper">
3
- <div v-for="(item, index) in stepNodes" :key="item.auditorName" class="crane-step-node">
4
- <span style="white-space: nowrap;">
5
- {{ item.auditorName }}
6
- <Popover v-if="item.employeeNameList?.length">
7
- <template #content>
8
- <div style="max-width: 400px;">
9
- {{ item.employeeNameList.join('、')}}
10
- </div>
11
- </template>
12
- <ExclamationCircleOutlined style="margin: 0 2px; color: #1677ff;"/>
13
- </Popover>
14
- {{ getSubTip(index) }}
15
- </span>
2
+ <div v-if="stepNodes?.length > 1" class="crane-step-wraper">
3
+ <div v-for="(item, index) in stepNodes" :key="item.auditorName" class="crane-step-node">
4
+ <span style="white-space: nowrap;">
5
+ {{ item.auditorName }}
6
+ <Popover v-if="item.employeeNameList?.length">
7
+ <template #content>
8
+ <div style="max-width: 400px;">
9
+ {{ item.employeeNameList.join('、') }}
10
+ </div>
11
+ </template>
12
+ <ExclamationCircleOutlined style="margin: 0 2px; color: #1677ff;" />
13
+ </Popover>
14
+ {{ getSubTip(index) }}
15
+ </span>
16
+
17
+ <img v-if="index !== stepNodes.length - 1" :src="arrowImg" class="crane-step-icon">
16
18
 
17
- <img
18
- v-if="index !== stepNodes.length - 1"
19
- :src="arrowImg"
20
- class="crane-step-icon">
21
-
22
- </div>
23
19
  </div>
24
- <span v-else-if="stepNodes?.length === 1">
25
- {{t('noNeed')}}
26
- </span>
27
- <span v-else>-</span>
20
+ </div>
21
+ <span v-else-if="stepNodes?.length === 1">
22
+ {{ t('noNeed') }}
23
+ </span>
24
+ <span v-else>-</span>
28
25
  </template>
29
26
  <script lang="ts" setup>
30
- import { PropType, toRef } from 'vue';
31
- import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
32
- import arrowImg from '@/assets/arrow.png';
33
- import { Popover } from 'ant-design-vue';
34
- import t from '../utils';
27
+ import { PropType, toRef } from 'vue';
28
+ import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
29
+ import arrowImg from '@/assets/arrow.png';
30
+ import { Popover } from 'ant-design-vue';
31
+ import t from '../utils';
35
32
 
36
- const props = defineProps({
37
- stepNodes: {
38
- type: Array as PropType<any[]>,
39
- required: true,
40
- default: () => []
41
- },
42
- });
33
+ const props = defineProps({
34
+ stepNodes: {
35
+ type: Array as PropType<any[]>,
36
+ required: true,
37
+ default: () => []
38
+ },
39
+ });
43
40
 
44
- const stepNodes = toRef(props, 'stepNodes');
41
+ const stepNodes = toRef(props, 'stepNodes');
45
42
 
46
- const getSubTip = (index: number) => {
47
- return index === stepNodes.value.length - 1 ? `[${t('end')}]` : index === 0 ? `[${t('start')}]` : '';
48
- }
43
+ const getSubTip = (index: number) => {
44
+ return index === stepNodes.value.length - 1 ? `[${t('end')}]` : index === 0 ? `[${t('start')}]` : '';
45
+ }
49
46
 
50
47
  </script>
51
48
  <style scoped>
@@ -57,10 +54,12 @@
57
54
  line-height: 32px;
58
55
  padding-bottom: 8px;
59
56
  }
57
+
60
58
  .crane-step-node {
61
59
  display: flex;
62
60
  align-items: center;
63
61
  }
62
+
64
63
  .crane-step-icon {
65
64
  margin: 0 8px;
66
65
  height: auto;
@@ -32,7 +32,7 @@ import {
32
32
  TreeSelect
33
33
  } from 'ant-design-vue';
34
34
 
35
- import { defineProps, PropType, ref, computed, defineExpose} from 'vue';
35
+ import { defineProps, PropType, ref, computed, defineExpose } from 'vue';
36
36
  import t from '../utils';
37
37
  import useAttributesCache from '../hooks/useAttributesCache';
38
38
  const SHOW_PARENT = TreeSelect.SHOW_PARENT;
@@ -68,6 +68,7 @@ const validate = () => {
68
68
  });
69
69
  }
70
70
 
71
+
71
72
  defineExpose({
72
73
  validate
73
74
  })
@@ -75,7 +76,6 @@ defineExpose({
75
76
  </script>
76
77
 
77
78
  <style scoped>
78
-
79
79
  .crane-category-wraper {
80
80
  margin-top: 16px;
81
81
  padding: 12px;
@@ -97,11 +97,11 @@ defineExpose({
97
97
  }
98
98
 
99
99
  :deep(.yqg-permission-form-item-required) {
100
- font-size: 12px!important;
100
+ font-size: 12px !important;
101
101
  }
102
102
 
103
103
  :deep(.yqg-permission-form-item-required::before) {
104
- display: none!important;
104
+ display: none !important;
105
105
  }
106
106
 
107
107
  .crane-required {
@@ -118,11 +118,13 @@ defineExpose({
118
118
  line-height: 1;
119
119
  content: "*";
120
120
  }
121
+
121
122
  .crane-category-tips {
122
123
  color: #86909C;
123
124
  font-size: 12px;
124
125
  }
125
- .crane-category-line{
126
+
127
+ .crane-category-line {
126
128
  height: 1px;
127
129
  background-color: #C9CDD4;
128
130
  margin: 10px 0;
@@ -19,10 +19,10 @@
19
19
  :class="['PENDING'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
20
20
  {{ statusMap[item.businessApplyType] }}
21
21
  {{ item.businessApplyType === 'TEMP_OWNER' ? `(${(item?.ownStatusVO?.dayDiff > 0 ?
22
- t('lastDays', {
23
- count:
24
- item?.ownStatusVO?.dayDiff
25
- }) : t('today'))})` : ''}}
22
+ t('lastDays', {
23
+ count:
24
+ item?.ownStatusVO?.dayDiff
25
+ }) : t('today'))})` : '' }}
26
26
  </Tag>
27
27
 
28
28
  <Popover v-if="item.desc">
@@ -35,15 +35,18 @@
35
35
  <Popover v-if="item.relatedCompleteNames?.length">
36
36
  <template #content>
37
37
  <div style="max-width: 400px;">
38
- {{ t('adaptDepartment') }}:{{item.relatedCompleteNames.map((item: any) => {
39
- return item;
40
- }).join('、') }}
38
+ <div>
39
+ {{ t('adaptDepartment') }}:
40
+ </div>
41
+ {{item.relatedCompleteNames.map((item: any) => {
42
+ return item;
43
+ }).join('、')}}
41
44
  </div>
42
45
  </template>
43
46
  <div class="crane-flex-center crane-margin-left-4">
44
47
  <img :src="departmentImg" height="14" width="14">
45
48
  <span class="crane-weak-color crane-margin-left-4">{{ item.relatedCompleteNames.length
46
- }}</span>
49
+ }}</span>
47
50
  </div>
48
51
  </Popover>
49
52
 
@@ -59,15 +62,15 @@
59
62
  </template>
60
63
  <div class="crane-weak-color crane-margin-left-4 crane-text-overflow">
61
64
  {{item.categoryVOS?.map((item:
62
- any) => {
63
- return item.categoryName;
65
+ any) => {
66
+ return item.categoryName;
64
67
  }).join('、')
65
68
  }}
66
69
  </div>
67
70
  </Popover>
68
71
 
69
72
  <!-- 选择框 -->
70
- <span v-if="checkedKeys.includes(item.feature)" class="crane-weak-color crane-margin-left-12">
73
+ <span v-if="checkedKeys.includes(item.feature) && !item.disabled" class="crane-weak-color crane-margin-left-12">
71
74
  {{ t('availableTime') }}:
72
75
  <Select v-model:value="item.validTime" style="width: 100px"
73
76
  :disabled="item.businessApplyType === OWNER_STATUS"
@@ -88,7 +91,7 @@ import t from '../utils';
88
91
 
89
92
  const OWNER_STATUS = 'OWNER';
90
93
 
91
- const levelMap:LevelMapType = {
94
+ const levelMap: LevelMapType = {
92
95
  L1: {
93
96
  color: '#1AA83B',
94
97
  text: t('levels.L1'),
@@ -120,7 +123,7 @@ let props = defineProps({
120
123
  },
121
124
  item: {
122
125
  type: Object as PropType<PermissionType>,
123
- default: () => {}
126
+ default: () => { }
124
127
  }
125
128
  });
126
129
 
@@ -136,7 +139,7 @@ const tempTimeOptions = computed(() => {
136
139
  const getCategoryValue = (category: CategoryType) => {
137
140
  return `【${category.categoryName}】:${category.attributeValues?.map((item: any) => item.attributeName)?.join('、') || t('empty')}`;
138
141
  };
139
-
142
+
140
143
  const onChangeTimeHandler = () => {
141
144
  emit('updateTime', props.item);
142
145
  emit('onChangeTime', props.item);
@@ -149,11 +152,12 @@ const onChangeTimeHandler = () => {
149
152
  display: flex;
150
153
  align-items: center;
151
154
  white-space: nowrap;
152
- }
155
+ }
153
156
 
154
- .permission-item-wraper {
157
+ .permission-item-wraper {
155
158
  padding-right: 32px;
156
- }
159
+ }
160
+
157
161
  .crane-checkbox-line {
158
162
  line-height: 28px;
159
163
  display: flex;
@@ -166,31 +170,36 @@ const onChangeTimeHandler = () => {
166
170
  padding: 2px 4px;
167
171
  line-height: 12px;
168
172
  font-weight: 500;
169
- }
170
- .crane-margin-right-0 {
173
+ }
174
+
175
+ .crane-margin-right-0 {
171
176
  margin-right: 0;
172
- }
173
- .crane-margin-left-4 {
177
+ }
178
+
179
+ .crane-margin-left-4 {
174
180
  margin-left: 4px;
175
- }
176
- .crane-margin-right-4 {
181
+ }
182
+
183
+ .crane-margin-right-4 {
177
184
  margin-right: 4px;
178
- }
179
- .crane-margin-left-12 {
185
+ }
186
+
187
+ .crane-margin-left-12 {
180
188
  margin-left: 12px;
181
- }
182
- .crane-disabled-color {
189
+ }
190
+
191
+ .crane-disabled-color {
183
192
  color: #C9CDD4;
184
- }
185
- .crane-weak-color {
193
+ }
194
+
195
+ .crane-weak-color {
186
196
  color: #86909C;
187
- }
188
- .crane-text-overflow {
197
+ }
198
+
199
+ .crane-text-overflow {
189
200
  max-width: 160px;
190
- overflow: hidden;
191
- text-overflow: ellipsis;
201
+ overflow: hidden;
202
+ text-overflow: ellipsis;
192
203
  white-space: nowrap;
193
- }
194
-
195
-
204
+ }
196
205
  </style>
@@ -2,59 +2,59 @@
2
2
  <contextHolder></contextHolder>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
- import { createVNode } from 'vue';
6
- import { CheckCircleFilled } from '@ant-design/icons-vue';
7
- import { Modal } from 'ant-design-vue';
8
- import t from '../utils';
5
+ import { createVNode } from 'vue';
6
+ import { CheckCircleFilled } from '@ant-design/icons-vue';
7
+ import { Modal } from 'ant-design-vue';
8
+ import t from '../utils';
9
9
 
10
- const [modal, contextHolder] = Modal.useModal();
10
+ const [modal, contextHolder] = Modal.useModal();
11
11
 
12
- const countDown = (url: string, callback?: ()=>void) => {
13
- let secondsToGo = 10;
14
- const modal1 = modal.confirm({
15
- title: t('resoultTitle'),
16
- content: t('successTips'),
17
- cancelText: `${t('close')}(${secondsToGo}s)`,
18
- okText:`${t('viewApprovalDetail')}>>`,
19
- wrapClassName: 'yqg-permission-modal-wrap',
20
- icon: createVNode(CheckCircleFilled, {style: 'color: #52c41a;'}),
21
- onOk: () => {
22
- window.open(url);
23
- modal1.destroy();
24
- callback && callback();
25
- window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
26
- if (!window.YQG_PERMISSION_CALLBACK && !callback) {
27
- location.reload();
28
- }
29
- },
30
- onCancel: () => {
31
- modal1.destroy();
32
- callback && callback();
33
- window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
34
- if (!window.YQG_PERMISSION_CALLBACK && !callback) {
35
- location.reload();
36
- }
37
- },
38
- });
12
+ const countDown = (url: string, callback?: () => void) => {
13
+ let secondsToGo = 10;
14
+ const modal1 = modal.confirm({
15
+ title: t('resoultTitle'),
16
+ content: t('successTips'),
17
+ cancelText: `${t('close')}(${secondsToGo}s)`,
18
+ okText: `${t('viewApprovalDetail')}>>`,
19
+ wrapClassName: 'yqg-permission-modal-wrap',
20
+ icon: createVNode(CheckCircleFilled, { style: 'color: #52c41a;' }),
21
+ onOk: () => {
22
+ window.open(url);
23
+ modal1.destroy();
24
+ callback && callback();
25
+ window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
26
+ if (!window.YQG_PERMISSION_CALLBACK && !callback) {
27
+ location.reload();
28
+ }
29
+ },
30
+ onCancel: () => {
31
+ modal1.destroy();
32
+ callback && callback();
33
+ window.YQG_PERMISSION_CALLBACK && window.YQG_PERMISSION_CALLBACK();
34
+ if (!window.YQG_PERMISSION_CALLBACK && !callback) {
35
+ location.reload();
36
+ }
37
+ },
38
+ });
39
39
 
40
- const interval = setInterval(() => {
41
- secondsToGo -= 1;
42
- modal1.update({
43
- cancelText: `${t('close')}(${secondsToGo}s)`,
44
- });
45
- }, 1000);
40
+ const interval = setInterval(() => {
41
+ secondsToGo -= 1;
42
+ modal1.update({
43
+ cancelText: `${t('close')}(${secondsToGo}s)`,
44
+ });
45
+ }, 1000);
46
46
 
47
- setTimeout(() => {
48
- clearInterval(interval);
49
- modal1.destroy();
50
- }, secondsToGo * 1000);
51
- }
47
+ setTimeout(() => {
48
+ clearInterval(interval);
49
+ modal1.destroy();
50
+ }, secondsToGo * 1000);
51
+ }
52
52
 
53
- defineExpose({countDown});
53
+ defineExpose({ countDown });
54
54
 
55
55
  </script>
56
56
  <style>
57
57
  .yqg-permission-modal-wrap .yqg-permission-modal-confirm-btns {
58
- text-align: center!important;
58
+ text-align: center !important;
59
59
  }
60
60
  </style>