diff --git a/src/views/Accompany/Accompany.vue b/src/views/Accompany/Accompany.vue index ed66e3b..e55df66 100644 --- a/src/views/Accompany/Accompany.vue +++ b/src/views/Accompany/Accompany.vue @@ -37,30 +37,33 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -188,7 +191,7 @@ import axios from 'axios' import { getToken - } from '@/utils/auth' + } from '@/utils/auth' import { index as siteIndex } from '@/api/site/site' @@ -213,7 +216,7 @@ select: { page: 1, page_size: 20, - keyword: '', + keyword: '', type:1, show_relation: ['cover'] }, @@ -228,6 +231,7 @@ images_ids: [], introduce: '', status: 1, + can_multi_num: 0, content: '', flow_content: '', price_content: '', @@ -242,7 +246,7 @@ 'message': '产品名称必填' }] - }, + }, siteType:[] @@ -262,11 +266,11 @@ } } }, - created() { - if(this.$route.path){ - this.select.type = this.$route.path.split("_")[1] - this.form.type = this.$route.path.split("_")[1] - } + created() { + if(this.$route.path){ + this.select.type = this.$route.path.split("_")[1] + this.form.type = this.$route.path.split("_")[1] + } this.getSite() this.getList() }, @@ -357,30 +361,30 @@ }) } }, - async getSite() { - try { - const res = await siteIndex({ - page: 1, - page_size: 999, - }, false) - this.siteType = res.data - } catch (err) { - console.error(err) - } + async getSite() { + try { + const res = await siteIndex({ + page: 1, + page_size: 999, + }, false) + this.siteType = res.data + } catch (err) { + console.error(err) + } }, async getList() { this.loading = true try { - const res = await index({ - ...this.select, - filter:[{ - key:'type', - op:'eq', - value:this.select.type - }] - }, false) - res.data.map(item=>{ - item.site_id = item.site_id.split(",") + const res = await index({ + ...this.select, + filter:[{ + key:'type', + op:'eq', + value:this.select.type + }] + }, false) + res.data.map(item=>{ + item.site_id = item.site_id.split(",") }) this.tableData = res.data this.total = res.total @@ -409,29 +413,29 @@ const form = deepCopy(this.form) for (const key in form) { form[key] = row[key] - } + } console.log("this.row",row) - if(Array.isArray(row['cover']) && row['cover'].length>0){ - form['cover_id'] = row['cover'][0]?.response?.id ?? '' + if(Array.isArray(row['cover']) && row['cover'].length>0){ + form['cover_id'] = row['cover'][0]?.response?.id ?? '' + } + if(row['images'].length>0){ + let arr = [] + row['images'].map(item=>{ + if(item.response){ + console.log("item.response.id",item.response.id) + arr.push(item.response.id) + }else{ + arr.push(item.id) + } + }) + form['images_ids'] = arr + }else{ + form['images_ids'] = [] } - if(row['images'].length>0){ - let arr = [] - row['images'].map(item=>{ - if(item.response){ - console.log("item.response.id",item.response.id) - arr.push(item.response.id) - }else{ - arr.push(item.id) - } - }) - form['images_ids'] = arr - }else{ - form['images_ids'] = [] - } - if(row.site_id.length>0){ - form.site_id = row.site_id.join(",") + if(row.site_id.length>0){ + form.site_id = row.site_id.join(",") } - console.log("this.form",form) + console.log("this.form",form) // return this.loading = true await save(form, false) @@ -478,4 +482,4 @@ ::v-deep .el-tag+.el-tag { margin-left: 4px; } - +