diff --git a/src/views/resource/components/addLr.vue b/src/views/resource/components/addLr.vue index 02a78f9..699c100 100644 --- a/src/views/resource/components/addLr.vue +++ b/src/views/resource/components/addLr.vue @@ -245,7 +245,7 @@ }, created() { this.uploadOther.token = getToken(); - this.getProductList() + // this.getProductList() this.getApplicationList() // this.getAppSpecial() }, @@ -301,8 +301,17 @@ page_size: 100, page: this.productPage }) - this.lastPage = res.last_page - this.productList.push(...res.data) + this.lastPage = res.last_page + if(this.type==='editor'){ + const uniqueB = res.data.filter(itemB => + !this.form.product_numbers_details.some(itemC => itemC.id === itemB.id) + ); + this.productList.push(...uniqueB) + }else{ + this.productList.push(...res.data) + } + + }, loadMore() { // 这里写入要触发的方法 @@ -349,8 +358,8 @@ }, - getDetail() { - show({ + async getDetail() { + await show({ table_name: this.table_name, id: this.id }).then(res => { @@ -364,6 +373,10 @@ this.form.separation_mode = res.separation_mode ? res.separation_mode : [] this.form.broad_sample_type = res.broad_sample_type ? res.broad_sample_type : [] this.form.specific_sample = res.specific_sample ? res.specific_sample : [] + if(res.product_numbers_details && res.product_numbers_details.length>0){ + this.productList.unshift(...res.product_numbers_details) + } + if (res.files_details && res.files_details.length > 0) { this.filesList = [] res.files_details.map(item => { @@ -381,16 +394,20 @@ isShow(newVal) { if (newVal) { if (this.type === 'editor') { - this.getDetail() + this.getDetail() + this.getProductList() } else { - this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss') + this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss') + this.getProductList() } } else { this.id = '' this.filesList = [] this.showProgress = false; - this.uploadProgress = 0; + this.uploadProgress = 0; + this.productList = [] + this.productPage = 1 this.form = { category_ids: [], application_ids: [],