1717 </div >
1818 <div class =" source-content" >
1919 <div class =" source-filter" >
20- <tiny-select v-model =" sourceCategory" :options =" categoryOptions" placeholder =" 请选择分组" @change =" categoryChange" > </tiny-select >
21- <tiny-search
22- class =" search"
23- v-model =" searchWords"
24- placeholder =" 按资源名称搜索"
25- clearable
20+ <tiny-select
21+ v-model =" sourceCategory"
22+ :options =" categoryOptions"
23+ placeholder =" 请选择分组"
24+ @change =" categoryChange"
2625 >
26+ </tiny-select >
27+ <tiny-search class =" search" v-model =" searchWords" placeholder =" 按资源名称搜索" clearable >
2728 <template #prefix >
2829 <tiny-icon-search />
2930 </template >
4546 <div class =" source-list" >
4647 <div v-for =" (item, index) in sourceList" :key =" item.id" class =" source-item" >
4748 <img :src =" item.thumbnailUrl ?? item.resourceUrl" />
48- <tiny-radio v-model =" selectedSourceIndex" @change =" selectSource(index)" :label =" index" text =" " ></tiny-radio >
49+ <tiny-radio
50+ v-model =" selectedSourceIndex"
51+ @change =" selectSource(index)"
52+ :label =" index"
53+ text =" "
54+ ></tiny-radio >
4955 <div class =" source-name-wrap" >
5056 <span :title =" item.name" >{{ item.name }}</span >
5157 </div >
6874 </div >
6975</template >
7076<script >
71- import { ref , reactive , watch } from ' vue'
72- import { Popover , Button , Input , Search , Select , Divider , RadioGroup , Radio } from ' @opentiny/vue'
77+ import { ref , watch } from ' vue'
78+ import { Popover , Button , Input , Search , Select , Divider , Radio } from ' @opentiny/vue'
7379import { iconClose , iconSearch } from ' @opentiny/vue-icon'
7480import { SearchEmpty } from ' @opentiny/tiny-engine-common'
7581import { useNotify } from ' @opentiny/tiny-engine-meta-register'
76- import { fetchResourceListByGroupId , fetchResourceGroupByAppId } from ' ./http'
82+ import { fetchResourceGroupByAppId } from ' ./http'
7783
7884const isShow = ref (false )
7985
@@ -94,7 +100,6 @@ export default {
94100 TinySelect: Select,
95101 TinyDivider: Divider,
96102 TinyRadio: Radio,
97- TinyRadioGroup: RadioGroup,
98103 SearchEmpty,
99104 TinyIconClose: iconClose (),
100105 TinyIconSearch: iconSearch ()
@@ -126,26 +131,28 @@ export default {
126131 const selectedSourceIndex = ref ()
127132
128133 const getResourceData = () => {
129- fetchResourceGroupByAppId ().then ((res ) => {
130- categoryData .value = res
131- categoryOptions .value = res .map ((item ) => ({ label: item .name , value: item .id , resources: item .resources }))
132- if (categoryOptions .value .length ) {
133- sourceCategory .value = categoryOptions .value [0 ].value
134- sourceOriginList .value = categoryOptions .value [0 ].resources
135- sourceList .value = categoryOptions .value [0 ].resources
136- openPopover ()
137- }
138- }).catch (error => {
139- useNotify ({
140- type: ' error' ,
141- message: error
134+ fetchResourceGroupByAppId ()
135+ .then ((res ) => {
136+ categoryData .value = res
137+ categoryOptions .value = res .map ((item ) => ({ label: item .name , value: item .id , resources: item .resources }))
138+ if (categoryOptions .value .length ) {
139+ sourceCategory .value = categoryOptions .value [0 ].value
140+ sourceOriginList .value = categoryOptions .value [0 ].resources
141+ sourceList .value = categoryOptions .value [0 ].resources
142+ openPopover ()
143+ }
144+ })
145+ .catch ((error ) => {
146+ useNotify ({
147+ type: ' error' ,
148+ message: error
149+ })
142150 })
143- })
144151 }
145152
146153 const categoryChange = () => {
147- sourceOriginList .value = categoryData .value .find (item => item .id === sourceCategory .value ).resources
148- sourceList .value = sourceOriginList .value .filter (item => item .name .includes (searchWords .value ))
154+ sourceOriginList .value = categoryData .value .find (( item ) => item .id === sourceCategory .value ).resources
155+ sourceList .value = sourceOriginList .value .filter (( item ) => item .name .includes (searchWords .value ))
149156 }
150157
151158 const selectSource = (sourceIndex ) => {
@@ -164,7 +171,7 @@ export default {
164171 watch (
165172 () => searchWords .value ,
166173 () => {
167- sourceList .value = sourceOriginList .value .filter (item => item .name .includes (searchWords .value ))
174+ sourceList .value = sourceOriginList .value .filter (( item ) => item .name .includes (searchWords .value ))
168175 }
169176 )
170177
@@ -286,7 +293,7 @@ export default {
286293 gap : 16px ;
287294
288295 .empty-wrap {
289- width : 100%
296+ width : 100% ;
290297 }
291298
292299 .source-item {
0 commit comments