@yqg/permission 1.0.2-beta.0 → 1.0.4-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/dist/{apply-modal-BGEJ1VGl.js → apply-modal-C7hVR1xJ.js} +1212 -1210
- package/dist/{checkbox-item-UGMn0mJf.js → checkbox-item-Bf_S20_z.js} +3 -3
- package/dist/{index-9R-US_u5.js → index-B0kTXjfX.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +54 -54
- package/dist/{yqg-permission-D4E6aSVe.js → yqg-permission-CbkviMn9.js} +1914 -1898
- package/package.json +1 -1
- package/src/App.vue +2 -1
- package/src/components/apply-modal.vue +4 -0
- package/src/components/yqg-permission.vue +31 -8
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -28,9 +28,10 @@ const changeLocale = () => {
|
|
|
28
28
|
<div>1:默认组件</div>
|
|
29
29
|
<!-- 03541 -->
|
|
30
30
|
<!-- 02124 -->
|
|
31
|
+
<!-- 05184 -->
|
|
31
32
|
<yqg-permission
|
|
32
33
|
:permissions="permissions"
|
|
33
|
-
workNumber="
|
|
34
|
+
workNumber="05184"
|
|
34
35
|
businessCode="PPDL"
|
|
35
36
|
:color="color"
|
|
36
37
|
:locale="locale"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
width="800px"
|
|
6
6
|
@ok="handleOk"
|
|
7
7
|
:okText="t('submit')"
|
|
8
|
+
:ok-button-props="{ loading: loading }"
|
|
8
9
|
:cancelText="t('cancel')">
|
|
9
10
|
<Form
|
|
10
11
|
ref="formRef"
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
required: true,
|
|
111
112
|
default: false,
|
|
112
113
|
});
|
|
114
|
+
const loading = ref(false);
|
|
113
115
|
const permissionList = toRef(props, 'permissionList');
|
|
114
116
|
const businessCode = toRef(props, 'businessCode');
|
|
115
117
|
const submitWorkNumber = toRef(props, 'workNumber');
|
|
@@ -137,10 +139,12 @@
|
|
|
137
139
|
|
|
138
140
|
const handleOk = async() => {
|
|
139
141
|
formRef.value.validate().then(async() => {
|
|
142
|
+
loading.value = true;
|
|
140
143
|
const params = getParams();
|
|
141
144
|
let res = await Http.submitApply(params);
|
|
142
145
|
const url = res?.body?.oaFlowUrl;
|
|
143
146
|
open.value = false;
|
|
147
|
+
loading.value = false;
|
|
144
148
|
emit('onSuccess');
|
|
145
149
|
successModal.value?.countDown(url);
|
|
146
150
|
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<ConfigProvider
|
|
3
3
|
v-if="allPermissions.length"
|
|
4
4
|
prefixCls="yqg-permission"
|
|
5
|
+
iconPrefixCls="yqg-permission"
|
|
5
6
|
:theme="{
|
|
6
7
|
token: {
|
|
7
8
|
colorPrimary: props.color,
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
style="margin-top: calc(50vh - 273px)" />
|
|
24
25
|
<!-- 可申请 -->
|
|
25
26
|
<template v-if="curStatus.status === statusMap.DEFAULT">
|
|
26
|
-
<div
|
|
27
|
+
<div class="crane-margin10">
|
|
27
28
|
{{ t('unavailableTips') }}
|
|
28
29
|
</div>
|
|
29
30
|
<div>
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
</div>
|
|
32
33
|
</template>
|
|
33
34
|
<!-- 审批中 -->
|
|
34
|
-
<template v-
|
|
35
|
-
<div
|
|
35
|
+
<template v-if="curStatus.status === statusMap.PENDING">
|
|
36
|
+
<div class="crane-margin10">
|
|
36
37
|
<span
|
|
37
38
|
class="crane-unapply"
|
|
38
39
|
v-html="t('appliedTips', {
|
|
@@ -41,16 +42,16 @@
|
|
|
41
42
|
</span>
|
|
42
43
|
</div>
|
|
43
44
|
<div>
|
|
44
|
-
<Button
|
|
45
|
+
<Button class="crane-margin-right10" @click="goViewApproval">{{t('viewApprovalDetail')}}</Button>
|
|
45
46
|
<Button type="primary" @click="showModal">+ {{t('applyMore')}}</Button>
|
|
46
47
|
</div>
|
|
47
48
|
</template>
|
|
48
49
|
<!-- 不可申请 -->
|
|
49
|
-
<div v-
|
|
50
|
+
<div v-if="curStatus.status === statusMap.NO" class="crane-margin10">
|
|
50
51
|
{{ t('unapplyTips') }}
|
|
51
52
|
<Popover>
|
|
52
53
|
<template #content>
|
|
53
|
-
{{t('manager')}}: {{ curStatus.tips }}
|
|
54
|
+
<div style="max-width: 400px;">{{t('manager')}}: {{ curStatus.tips }}</div>
|
|
54
55
|
</template>
|
|
55
56
|
<span style="color: #1677ff;">{{t('callManager') }}</span>
|
|
56
57
|
</Popover>
|
|
@@ -113,6 +114,7 @@
|
|
|
113
114
|
const emit = defineEmits(['onSuccess']);
|
|
114
115
|
|
|
115
116
|
const open = ref(false);
|
|
117
|
+
const curApproving = ref<PermissionType>();
|
|
116
118
|
let permissionList = ref<PermissionListType>([]);
|
|
117
119
|
let curStatus = ref<Record<string, any>>({
|
|
118
120
|
imageUrl: noauthority,
|
|
@@ -149,10 +151,16 @@
|
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
const getStatus = (data: PermissionListType) => {
|
|
152
|
-
if (!data.length)
|
|
154
|
+
if (!data.length) {
|
|
155
|
+
return {
|
|
156
|
+
imageUrl: noauthority,
|
|
157
|
+
status: '',
|
|
158
|
+
};
|
|
159
|
+
}
|
|
153
160
|
const current = data.find((per) => per.businessApplyType === statusMap.PENDING);
|
|
154
161
|
const cannotApply = data.every((per) => per.businessApplyType === statusMap.NO);
|
|
155
162
|
if (current) {
|
|
163
|
+
curApproving.value = current;
|
|
156
164
|
return {
|
|
157
165
|
imageUrl: applyUrl,
|
|
158
166
|
status: statusMap.PENDING,
|
|
@@ -168,9 +176,18 @@
|
|
|
168
176
|
tips: data[0].admin?.map((item) => item.name)?.join('、'),
|
|
169
177
|
};
|
|
170
178
|
};
|
|
171
|
-
return
|
|
179
|
+
return {
|
|
180
|
+
imageUrl: noauthority,
|
|
181
|
+
status: statusMap.DEFAULT,
|
|
182
|
+
}
|
|
172
183
|
};
|
|
173
184
|
|
|
185
|
+
const goViewApproval = () => {
|
|
186
|
+
if (curApproving.value?.oaFlowUrl) {
|
|
187
|
+
window.open(curApproving.value.oaFlowUrl);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
174
191
|
const getPermissions = async () => {
|
|
175
192
|
if (!allPermissions.value.length || !props.businessCode || !props.workNumber) return;
|
|
176
193
|
|
|
@@ -205,5 +222,11 @@
|
|
|
205
222
|
font-size: 14px;
|
|
206
223
|
white-space: nowrap;
|
|
207
224
|
}
|
|
225
|
+
.crane-margin10 {
|
|
226
|
+
margin: 10px;
|
|
227
|
+
}
|
|
228
|
+
.crane-margin-right10 {
|
|
229
|
+
margin-right: 10px;
|
|
230
|
+
}
|
|
208
231
|
</style>
|
|
209
232
|
|