@yqg/permission 1.3.0-alpha.9 → 1.3.1-1.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-L-62MLld.js → apply-modal-B4niAWln.js} +3882 -4161
- package/dist/{category-selector-BY2CDs7z.js → category-selector-CJ2VLSr7.js} +81 -81
- package/dist/{index-BTczN9dE.js → index-CJ_Ktj6t.js} +1828 -1836
- package/dist/{index-C6YJSbYD.js → index-CZ6UV6_X.js} +4 -4
- package/dist/index.js +2 -2
- package/dist/permission-item-Bm9OiOSx.js +1252 -0
- package/dist/{yqg-permission-CQegf22C.js → yqg-permission-Cb-_sywm.js} +3739 -3695
- package/dist/yqg-permission.umd.js +65 -65
- package/package.json +9 -10
- package/src/App.vue +14 -28
- package/src/axios/index.ts +1 -1
- package/src/components/apply-modal.vue +162 -75
- package/src/components/approval-steps.vue +39 -40
- package/src/components/category-selector.vue +27 -12
- package/src/components/permission-item.vue +49 -37
- package/src/components/success-modal.vue +45 -45
- package/src/components/yqg-permission.vue +169 -141
- package/src/hooks/useAttributesCache.ts +23 -1
- package/src/hooks/useCategory.ts +2 -1
- package/src/hooks/useFormat.ts +20 -7
- package/src/i18n/en-US.ts +50 -50
- package/src/i18n/in-ID.ts +57 -0
- package/src/i18n/index.ts +5 -2
- package/src/i18n/zh-CH.ts +4 -10
- package/src/style/reset.css +3 -0
- package/src/typings/index.d.ts +8 -0
- package/src/utils/index.ts +16 -2
- package/src/yqg-permission/react.js +0 -0
- package/tsconfig.app.json +8 -8
- package/dist/permission-item-Q0DEMUdN.js +0 -1250
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
v-show="categoryValuesMap[item.id]?.length"
|
|
9
9
|
:rules="[{ required: true, message: t('pleaseChoose'), trigger: ['change', 'blur'] }]">
|
|
10
10
|
<TreeSelect treeCheckable treeDefaultExpandAll :tree-data="categoryValuesMap[item.id]" showSearch
|
|
11
|
-
allowClear v-model:value="item.attributeValueIds_view"
|
|
12
|
-
v-model:searchValue="searchValue"
|
|
13
|
-
|
|
11
|
+
allowClear v-model:value="item.attributeValueIds_view"
|
|
12
|
+
treeNodeFilterProp="attributeName" v-model:searchValue="searchValue"
|
|
13
|
+
:fieldNames="{ label: 'attributeName', value: 'id' }" treeNodeLabelProp="attributeName"
|
|
14
|
+
:show-checked-strategy="SHOW_PARENT">
|
|
14
15
|
<template #title="{ attributeName }">
|
|
15
16
|
<span v-if="searchValue.toLowerCase() && attributeName.includes(searchValue.toLowerCase())"
|
|
16
17
|
style="color: #1677ff; font-weight: bold;">{{ attributeName
|
|
@@ -21,6 +22,9 @@
|
|
|
21
22
|
<span v-if="item.attributeValueIds_view?.includes(-1)" style="color: #ff4d4f; font-size: 12px;">
|
|
22
23
|
{{ t('categoryChangeTips', { category: item.categoryName }) }}
|
|
23
24
|
</span>
|
|
25
|
+
<span v-if="getDeleteAttributesNames(item)" style="color: #ff4d4f; font-size: 12px;">
|
|
26
|
+
{{ t('deleteCategoryTips', { categorys: getDeleteAttributesNames(item) }) }}
|
|
27
|
+
</span>
|
|
24
28
|
</FormItem>
|
|
25
29
|
</template>
|
|
26
30
|
</Form>
|
|
@@ -32,7 +36,7 @@ import {
|
|
|
32
36
|
TreeSelect
|
|
33
37
|
} from 'ant-design-vue';
|
|
34
38
|
|
|
35
|
-
import { defineProps, PropType, ref, computed, defineExpose} from 'vue';
|
|
39
|
+
import { defineProps, PropType, ref, computed, defineExpose } from 'vue';
|
|
36
40
|
import t from '../utils';
|
|
37
41
|
import useAttributesCache from '../hooks/useAttributesCache';
|
|
38
42
|
const SHOW_PARENT = TreeSelect.SHOW_PARENT;
|
|
@@ -44,6 +48,14 @@ const props = defineProps({
|
|
|
44
48
|
},
|
|
45
49
|
})
|
|
46
50
|
|
|
51
|
+
|
|
52
|
+
const formRef = ref();
|
|
53
|
+
const searchValue = ref('');
|
|
54
|
+
const {
|
|
55
|
+
categoryValuesMap,
|
|
56
|
+
getDeleteAttributesNames
|
|
57
|
+
} = useAttributesCache(props);
|
|
58
|
+
|
|
47
59
|
const categoryInfo = computed(() => {
|
|
48
60
|
return {
|
|
49
61
|
categoryList: props.categoryList
|
|
@@ -53,20 +65,22 @@ const showForm = computed(() => {
|
|
|
53
65
|
// 判断是否有数据
|
|
54
66
|
return Object.values(categoryValuesMap).some(item => item.length > 0);
|
|
55
67
|
});
|
|
56
|
-
|
|
57
|
-
const searchValue = ref('');
|
|
58
|
-
const { categoryValuesMap } = useAttributesCache(props);
|
|
68
|
+
|
|
59
69
|
|
|
60
70
|
// 返回promise
|
|
61
71
|
const validate = () => {
|
|
62
72
|
return new Promise((resolve, reject) => {
|
|
73
|
+
if (!formRef.value) {
|
|
74
|
+
resolve(true);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
63
77
|
formRef.value.validate().then(() => {
|
|
64
78
|
resolve(true);
|
|
65
79
|
}).catch(() => {
|
|
66
80
|
reject(false);
|
|
67
81
|
});
|
|
68
82
|
});
|
|
69
|
-
}
|
|
83
|
+
};
|
|
70
84
|
|
|
71
85
|
defineExpose({
|
|
72
86
|
validate
|
|
@@ -75,7 +89,6 @@ defineExpose({
|
|
|
75
89
|
</script>
|
|
76
90
|
|
|
77
91
|
<style scoped>
|
|
78
|
-
|
|
79
92
|
.crane-category-wraper {
|
|
80
93
|
margin-top: 16px;
|
|
81
94
|
padding: 12px;
|
|
@@ -97,11 +110,11 @@ defineExpose({
|
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
:deep(.yqg-permission-form-item-required) {
|
|
100
|
-
font-size: 12px!important;
|
|
113
|
+
font-size: 12px !important;
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
:deep(.yqg-permission-form-item-required::before) {
|
|
104
|
-
display: none!important;
|
|
117
|
+
display: none !important;
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
.crane-required {
|
|
@@ -118,11 +131,13 @@ defineExpose({
|
|
|
118
131
|
line-height: 1;
|
|
119
132
|
content: "*";
|
|
120
133
|
}
|
|
134
|
+
|
|
121
135
|
.crane-category-tips {
|
|
122
136
|
color: #86909C;
|
|
123
137
|
font-size: 12px;
|
|
124
138
|
}
|
|
125
|
-
|
|
139
|
+
|
|
140
|
+
.crane-category-line {
|
|
126
141
|
height: 1px;
|
|
127
142
|
background-color: #C9CDD4;
|
|
128
143
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
t('lastDays', {
|
|
23
|
+
count:
|
|
24
|
+
item?.ownStatusVO?.dayDiff
|
|
25
|
+
}) : t('today'))})` : '' }}
|
|
26
26
|
</Tag>
|
|
27
27
|
|
|
28
28
|
<Popover v-if="item.desc">
|
|
@@ -34,16 +34,17 @@
|
|
|
34
34
|
|
|
35
35
|
<Popover v-if="item.relatedCompleteNames?.length">
|
|
36
36
|
<template #content>
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
<div class="crane-department-wraper">
|
|
38
|
+
<div>
|
|
39
|
+
{{ t('adaptDepartment') }}:
|
|
40
|
+
</div>
|
|
41
|
+
<div v-for="item in item.relatedCompleteNames">{{ item }}</div>
|
|
41
42
|
</div>
|
|
42
43
|
</template>
|
|
43
44
|
<div class="crane-flex-center crane-margin-left-4">
|
|
44
45
|
<img :src="departmentImg" height="14" width="14">
|
|
45
46
|
<span class="crane-weak-color crane-margin-left-4">{{ item.relatedCompleteNames.length
|
|
46
|
-
|
|
47
|
+
}}</span>
|
|
47
48
|
</div>
|
|
48
49
|
</Popover>
|
|
49
50
|
|
|
@@ -59,15 +60,15 @@
|
|
|
59
60
|
</template>
|
|
60
61
|
<div class="crane-weak-color crane-margin-left-4 crane-text-overflow">
|
|
61
62
|
{{item.categoryVOS?.map((item:
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
any) => {
|
|
64
|
+
return item.categoryName;
|
|
64
65
|
}).join('、')
|
|
65
66
|
}}
|
|
66
67
|
</div>
|
|
67
68
|
</Popover>
|
|
68
69
|
|
|
69
70
|
<!-- 选择框 -->
|
|
70
|
-
<span v-if="checkedKeys.includes(item.feature)" class="crane-weak-color crane-margin-left-12">
|
|
71
|
+
<span v-if="checkedKeys.includes(item.feature) && !item.disabled" class="crane-weak-color crane-margin-left-12">
|
|
71
72
|
{{ t('availableTime') }}:
|
|
72
73
|
<Select v-model:value="item.validTime" style="width: 100px"
|
|
73
74
|
:disabled="item.businessApplyType === OWNER_STATUS"
|
|
@@ -88,7 +89,7 @@ import t from '../utils';
|
|
|
88
89
|
|
|
89
90
|
const OWNER_STATUS = 'OWNER';
|
|
90
91
|
|
|
91
|
-
const levelMap:LevelMapType = {
|
|
92
|
+
const levelMap: LevelMapType = {
|
|
92
93
|
L1: {
|
|
93
94
|
color: '#1AA83B',
|
|
94
95
|
text: t('levels.L1'),
|
|
@@ -120,7 +121,7 @@ let props = defineProps({
|
|
|
120
121
|
},
|
|
121
122
|
item: {
|
|
122
123
|
type: Object as PropType<PermissionType>,
|
|
123
|
-
default: () => {}
|
|
124
|
+
default: () => { }
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
127
|
|
|
@@ -136,7 +137,7 @@ const tempTimeOptions = computed(() => {
|
|
|
136
137
|
const getCategoryValue = (category: CategoryType) => {
|
|
137
138
|
return `【${category.categoryName}】:${category.attributeValues?.map((item: any) => item.attributeName)?.join('、') || t('empty')}`;
|
|
138
139
|
};
|
|
139
|
-
|
|
140
|
+
|
|
140
141
|
const onChangeTimeHandler = () => {
|
|
141
142
|
emit('updateTime', props.item);
|
|
142
143
|
emit('onChangeTime', props.item);
|
|
@@ -145,15 +146,21 @@ const onChangeTimeHandler = () => {
|
|
|
145
146
|
|
|
146
147
|
</script>
|
|
147
148
|
<style scoped>
|
|
149
|
+
.crane-department-wraper {
|
|
150
|
+
max-width: 600px;
|
|
151
|
+
max-height: 300px;
|
|
152
|
+
overflow-y: scroll;
|
|
153
|
+
}
|
|
148
154
|
.crane-flex-center {
|
|
149
155
|
display: flex;
|
|
150
156
|
align-items: center;
|
|
151
157
|
white-space: nowrap;
|
|
152
|
-
|
|
158
|
+
}
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
.permission-item-wraper {
|
|
155
161
|
padding-right: 32px;
|
|
156
|
-
|
|
162
|
+
}
|
|
163
|
+
|
|
157
164
|
.crane-checkbox-line {
|
|
158
165
|
line-height: 28px;
|
|
159
166
|
display: flex;
|
|
@@ -166,31 +173,36 @@ const onChangeTimeHandler = () => {
|
|
|
166
173
|
padding: 2px 4px;
|
|
167
174
|
line-height: 12px;
|
|
168
175
|
font-weight: 500;
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.crane-margin-right-0 {
|
|
171
179
|
margin-right: 0;
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.crane-margin-left-4 {
|
|
174
183
|
margin-left: 4px;
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.crane-margin-right-4 {
|
|
177
187
|
margin-right: 4px;
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.crane-margin-left-12 {
|
|
180
191
|
margin-left: 12px;
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.crane-disabled-color {
|
|
183
195
|
color: #C9CDD4;
|
|
184
|
-
|
|
185
|
-
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.crane-weak-color {
|
|
186
199
|
color: #86909C;
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.crane-text-overflow {
|
|
189
203
|
max-width: 160px;
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
text-overflow: ellipsis;
|
|
192
206
|
white-space: nowrap;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
207
|
+
}
|
|
196
208
|
</style>
|
|
@@ -2,59 +2,59 @@
|
|
|
2
2
|
<contextHolder></contextHolder>
|
|
3
3
|
</template>
|
|
4
4
|
<script lang="ts" setup>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
10
|
+
const [modal, contextHolder] = Modal.useModal();
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const interval = setInterval(() => {
|
|
41
|
+
secondsToGo -= 1;
|
|
42
|
+
modal1.update({
|
|
43
|
+
cancelText: `${t('close')}(${secondsToGo}s)`,
|
|
44
|
+
});
|
|
45
|
+
}, 1000);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
clearInterval(interval);
|
|
49
|
+
modal1.destroy();
|
|
50
|
+
}, secondsToGo * 1000);
|
|
51
|
+
}
|
|
52
52
|
|
|
53
|
-
|
|
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>
|