1313 <Row :gutter =" 16" >
1414 <Col span =" 12" >
1515 <FormItem label =" Website" prop =" website" >
16- <Select v-model =" formItem.website" placeholder =" Select Website" @on-change = " onChangeWebsite " >
16+ <Select v-model =" formItem.website" placeholder =" Select Website" disabled >
1717 <Option v-for =" item in webOptions" :value =" item.value" :key =" item.value" >{{ item.label }}</Option >
1818 </Select >
1919 </FormItem >
2020 </Col >
2121 <Col span =" 12" >
2222 <FormItem label =" Name" prop =" name" >
23- <Input v-model.trim =" formItem.name" ></Input >
23+ <Input v-model.trim =" formItem.name" disabled ></Input >
2424 </FormItem >
2525 </Col >
2626 </Row >
3939 </FormItem >
4040 </Col >
4141 </Row >
42+ <!-- <Row :gutter="16">
43+ <Col span="12">
44+ <FormItem label="Parent Category" prop="parent">
45+ <Select v-model="formItem.parent" placeholder="Select Category">
46+ <Option v-for="item in catOptions" :value="item.value" :key="item.value">{{ item.label }}</Option>
47+ </Select>
48+ </FormItem>
49+ </Col>
50+ </Row> -->
4251 <Row :gutter =" 16" >
4352 <Col span =" 12" >
4453 <FormItem >
@@ -95,10 +104,14 @@ export default {
95104 formItem: {
96105 website: ' ' ,
97106 name: ' ' ,
107+ slug: ' ' ,
108+ parent: ' ' ,
98109 icon: ' ' ,
99110 icon_name: ' ' ,
111+ count: ' ' ,
100112 description: ' ' ,
101113 status: true ,
114+ homepage: false ,
102115 createdAt: ' ' ,
103116 userId: Cookies .get (' userDetailId' )
104117 },
@@ -121,10 +134,16 @@ export default {
121134 ]
122135 },
123136 webOptions: [],
137+ catOptions: [],
124138 cloudDetails: {},
125139 name: ' '
126140 }
127141 },
142+ watch: {
143+ ' formItem.website ' : function (val , oldVal ){
144+ this .onChangeWebsite (val);
145+ }
146+ },
128147 methods: {
129148 getRules () {
130149 if (this .formItem .id ) {
@@ -223,26 +242,64 @@ export default {
223242 async mounted () {
224243 let userId = Cookies .get (' userDetailId' )
225244 if (userId !== ' ' && userId !== undefined ) {
226- axios .get (baseUrl + ' /project-configuration?userId=' + userId).then (res => {
245+ await axios .get (baseUrl + ' /project-configuration?userId=' + userId).then (res => {
227246 for (let item of res .data .data ) {
228- this .webOptions .push ({label: item .websiteName , value: item .id , vid: item .configData [1 ].projectSettings [0 ].ProjectVId .vid })
247+ if (item .configData != ' undefined' && Array .isArray (item .configData )) {
248+ this .webOptions .push ({label: item .websiteName , value: item .id , vid: item .configData [1 ].projectSettings [0 ].ProjectVId .vid })
249+ }
229250 }
230251 }).catch (err => {
231252 })
232253 }
233-
234- if (this .fdata != undefined && this .fdata .type === ' editCategory' && this .fdata .categoryName !== ' ' ) {
235- axios .get (categoryUrl + ' ?name =' + this .fdata .categoryName + ' &website=' + this .fdata .website ).then (res => {
254+
255+ if (this .fdata != undefined && this .fdata .type === ' editCategory' && this .fdata .categorySlug !== ' ' ) {
256+ await axios .get (categoryUrl + ' ?slug =' + this .fdata .categorySlug + ' &website=' + this .fdata .website ).then (res => {
236257 if (res .data .total == 1 ) {
237258 this .formItem = res .data .data [0 ]
238259 }
239260 else {
240- this .formItem .name = this .fdata .categoryName ;
261+ this .formItem .name = this .fdata .categorySlug ;
241262 this .formItem .website = this .fdata .website ;
242263 }
243264 }).catch (err => {
244265 console .log (err);
245266 })
267+
268+ // let websiteDetails = _.find(this.webOptions, {value: this.fdata.website});
269+ // let vid = websiteDetails.vid;
270+ // if(vid != undefined && vid != '') {
271+ // this.$Spin.show()
272+ // await axios.get(config.menuCategoriesUrl, {
273+ // headers: {
274+ // Authorization: Cookies.get('auth_token'),
275+ // vid: vid
276+ // }
277+ // })
278+ // .then((res) => {
279+ // let categories = res.data.aggregations.group_by_category.buckets;
280+
281+ // for(let i = 0; i < categories.length; i++) {
282+ // let categorySlug = categories[i].key.toLowerCase().replace(/ /g, '-');
283+
284+ // this.catOptions.push({
285+ // label: categories[i].key.toUpperCase(),
286+ // value: categorySlug
287+ // });
288+ // }
289+ // this.$Spin.hide()
290+ // })
291+ // .catch((e) => {
292+ // this.$Notice.error({ title: 'Error', desc: 'Failed! Please try again.', duration: 2})
293+ // console.log(e);
294+ // })
295+ // }
296+ // else if (this.fdata.website != undefined && this.fdata.website !== '') {
297+ // this.$message({
298+ // showClose: true,
299+ // message: 'Please set "VID" in Project settings to get all of your category list.',
300+ // type: 'info'
301+ // });
302+ // }
246303 }
247304 }
248305}
0 commit comments