1616 <span >{{this.$t('message.console.sideNavList.function.name')}}</span >
1717 </h3 >
1818 <div class =" app-list" >
19- <div v-for =" (item, index) in favoriteApps" :key =" item.title" class =" app-item-wrap" :class =" {shadow:setting}" @click =" setting?null:linkTo(item, item.url)" >
20- <div v-if =" setting" class =" close-wrap" @click.stop =" deleteFavoriteApp(item.favouritesId, index)" ><i class =" fi-cross1" ></i ></div >
19+ <div class =" nodata-tips" v-if =" favoriteApps.length===0" >{{$t('message.workSpace.home.tips')}}</div >
20+ <div v-else v-for =" (item, index) in favoriteApps" :key =" item.title" class =" app-item-wrap" :class =" {shadow:setting}" @click =" setting?null:linkTo(item, item.url)" >
21+ <div v-if =" setting" class =" close-wrap" @click.stop =" deleteFavoriteApp(item.id, index)" ><i class =" fi-cross1" ></i ></div >
2122 <i class =" app-icon" :class =" iconSplit(item.icon)[0]" :style =" `color: ${iconSplit(item.icon)[1]}`" ></i >
2223 <span class =" label" >{{$t('message.workSpace.home.enter', {text: item.title})}}</span >
2324 </div >
25+
2426
2527 <div v-if =" setting" class =" app-item-add" @click =" show = true" >
2628 <i class =" fi-plus add" ></i >
3941
4042
4143 <Card class =" right" >
42- <h3 class =" item-header" >
44+ <div class =" nodata-tips" v-if =" !adminApps.title" >{{$t('message.workSpace.home.tips')}}</div >
45+ <h3 v-if =" adminApps.title" class =" item-header" >
4346 <span >{{adminApps.title}}</span >
4447 </h3 >
45- <div class =" app-list" >
48+ <div v-if = " adminApps.title " class =" app-list" >
4649 <div v-for =" item in adminApps.appInstances" :key =" item.title" class =" app-item-wrap" @click =" navTo(item, item.accessButtonUrl)" >
4750 <i class =" app-icon" :class =" iconSplit(item.icon)[0]" :style =" `color: ${iconSplit(item.icon)[1]}`" ></i >
4851 <span class =" label" >{{item.accessButton}}</span >
4952 </div >
5053 </div >
5154
52- < Spin fix v-if = " !adminApps.title " ></ Spin >
55+
5356 </Card >
5457 </div >
5558
5659 <div class =" app-list-main" >
5760 <div class =" app-list-tabs" :class =" {hideBar: search}" >
58- <Tabs >
61+ <div class =" nodata-tips" v-if =" tabsApplication.length===0" >{{$t('message.workSpace.home.tips')}}</div >
62+ <Tabs v-else >
5963 <Tab-pane v-for =" (type, index) in tabsApplication" :label =" type.title" :key =" type.title" >
6064 <div class =" pane-wrap" >
6165 <Card v-for =" item in tabsApplication[index].appInstances" :key =" item.name" class =" pane-item" >
123127 <FormItem :label =" $t('message.workSpace.home.selectApp')"
124128 prop =" selectApp" >
125129 <Select v-model =" formDynamic.selectApp" >
126- <Option v-for =" item in apps" :value =" `${item.id}`" :key =" `${item.id}`" >{{ item.title }}</Option >
130+ <Option v-for =" item in apps" :value =" `${item.id}`" :key =" `${item.id}`" :disabled = " item.had " >{{ item.title }}</Option >
127131 </Select >
128132 </FormItem >
129133 </Form >
@@ -199,23 +203,23 @@ export default {
199203 init (){
200204
201205 api .fetch (` /dss/workspaces/${ this .workspaceId } ` , ' get' ).then (data => {
202- this .workspaceData = data;
206+ this .workspaceData = data . workspace ;
203207 })
204208
205209 api .fetch (` /dss/workspaces/${ this .workspaceId } /favorites` , ' get' ).then (data => {
206- this .favoriteApps = data;
210+ this .favoriteApps = data . favorites ;
207211 })
208212
209213 api .fetch (` /dss/workspaces/${ this .workspaceId } /managements` , ' get' ).then (data => {
210- this .adminApps = data .managements ? data .managements [0 ]: [] ;
214+ this .adminApps = data .managements [ 0 ] ? data .managements [0 ]: {} ;
211215 })
212216
213217 api .fetch (` /dss/workspaces/${ this .workspaceId } /applications` , ' get' ).then (data => {
214- this .applications = data .applications ;
218+ this .applications = data .applications || [] ;
215219 })
216220 },
217221 deleteFavoriteApp (favouritesId , index ){
218- api .fetch (` /dss/workspaces/${ this .workspaceId } /favorites` , ' delete' ).then (data => {
222+ api .fetch (` /dss/workspaces/${ this .workspaceId } /favorites/ ${ favouritesId } ` , ' delete' ).then (data => {
219223 this .favoriteApps .splice (index, 1 );
220224 })
221225 },
@@ -225,12 +229,12 @@ export default {
225229 if (valid) {
226230 // this.addAppLoading = true;
227231 this .show = false ;
228- api .fetch (` /dss/workspaces/${ this .workspaceId } /favorites` , {applicationId : this .formDynamic .selectApp },' post' ).then (data => {
232+ api .fetch (` /dss/workspaces/${ this .workspaceId } /favorites` , {menuApplicationId : parseInt ( this .formDynamic .selectApp , 10 ) },' post' ).then (data => {
229233 const app = this .findAppByApplicationId (this .formDynamic .selectApp )
230234 this .favoriteApps .push ({
231235 ... app,
232- " favouritesId " : data .favouritesId ,
233- " applicationId " : app .id , // application表里的id
236+ " id " : data .favouritesId ,
237+ " menuApplicationId " : app .id , // application表里的id
234238 })
235239 })
236240 }
@@ -289,8 +293,14 @@ export default {
289293 },
290294 apps : function (){
291295 if (this .formDynamic .selectType ){
292- const arr = this .applications .filter (item => item .id == this .formDynamic .selectType );
293- return arr[0 ].appInstances ;
296+ const result = this .applications .find (item => item .id == this .formDynamic .selectType );
297+ result .appInstances .map (item => {
298+ item .had = false ;
299+ if (this .favoriteApps .find (fItem => item .id === fItem .menuApplicationId )){
300+ item .had = true ;
301+ }
302+ })
303+ return result .appInstances ;
294304 }
295305 return [];
296306 },
0 commit comments