File tree Expand file tree Collapse file tree
frontend/src/modules/admin/modules/collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 </lf-field >
5757 </article >
5858
59- <!-- Description -->
59+ <!-- Category -->
6060 <article class =" mb-5" >
6161 <lf-field label-text =" Category" >
6262 <div class =" flex" >
6565 v-model =" form.type"
6666 placeholder =" Select type"
6767 class =" w-full type-select"
68+ clearable
6869 >
6970 <el-option label =" Industry" value =" vertical" />
7071 <el-option label =" Stack" value =" horizontal" />
7879 filterable
7980 clearable
8081 remote
81- :disabled =" !form.type.length"
82+ :disabled =" !form.type? .length"
8283 :remote-method =" fetchCategories"
84+ @clear =" () => {
85+ form.type = null
86+ form.categoryId = null
87+ }"
8388 >
8489 <el-option
8590 v-if =" collection"
@@ -177,7 +182,7 @@ const form = reactive<CollectionFormModel>({
177182 name: ' ' ,
178183 description: ' ' ,
179184 type: ' ' ,
180- categoryId: ' ' ,
185+ categoryId: null ,
181186 projects: [],
182187});
183188
@@ -209,7 +214,7 @@ const fillForm = (record?: CollectionModel) => {
209214 if (record ) {
210215 Object .assign (form , record );
211216 form .type = record .category .categoryGroupType ;
212- form .categoryId = record .categoryId || ' ' ;
217+ form .categoryId = record .categoryId || null ;
213218 }
214219
215220 formSnapshot ();
@@ -291,7 +296,7 @@ const fetchCategories = (query: string) => {
291296 offset: 0 ,
292297 limit: 20 ,
293298 query ,
294- groupType: form .type ,
299+ groupType: form .type || undefined ,
295300 })
296301 .then ((res ) => {
297302 form .categoryId = ! form .categoryId ? (props .collection ?.categoryId || ' ' ) : form .categoryId ;
@@ -302,7 +307,7 @@ const fetchCategories = (query: string) => {
302307watch (
303308 () => form .type ,
304309 () => {
305- form .categoryId = ' ' ;
310+ form .categoryId = null ;
306311 fetchCategories (' ' );
307312 },
308313);
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export interface CollectionModel {
1515export interface CollectionFormModel {
1616 name : string ;
1717 description : string ;
18- type : string ;
19- categoryId : string ;
18+ type : string | null ;
19+ categoryId : string | null ;
2020 projects : InsightsProjectModel [ ] ;
2121}
You can’t perform that action at this time.
0 commit comments