@@ -101,10 +103,11 @@
+ :auto-upload="true" :data="uploadOther" :on-progress="handleProgress" :on-success="handlesuccess"
+ :on-remove="handleRemove">
upload
-
-
+
+
@@ -116,12 +119,25 @@
PN:
-
+
+
+
+ 搜索
+ 清空
+
- There is no more data
- Loading More
+
+ Loading....
+
+
+
There is no more data
+
Loading More
+
+
@@ -195,11 +211,13 @@
data() {
return {
table_name: 'literature_references',
+ loading: false,
isShow: false,
id: '',
- type: 'add',
- productPage:1,
- lastPage:0,
+ type: 'add',
+ productPage: 1,
+ lastPage: 0,
+ number_keyword:'',
productList: [],
categoryList: [],
applicationList: [],
@@ -207,18 +225,18 @@
uploadOther: {
token: ""
},
- action: `${process.env.VUE_APP_UPLOAD_API}`,
- showProgress:false,
- uploadProgress:0,
+ action: `${process.env.VUE_APP_UPLOAD_API}`,
+ showProgress: false,
+ uploadProgress: 0,
filesList: [],
form: {
category_ids: [],
application_ids: [],
year: "",
title: "",
- source: '',
- is_top:0,
- is_visible:1,
+ source: '',
+ is_top: 0,
+ is_visible: 1,
date: '',
link: '',
files: [],
@@ -249,22 +267,22 @@
this.getApplicationList()
// this.getAppSpecial()
},
- methods: {
- handleRemove(file, fileList) {
- this.filesList = fileList
- },
- handlesuccess(response, file, fileList) {
- if (response && response.hasOwnProperty('errcode')) {
- this.$Message.warning(response.errmsg || '')
- this.filesList = []
- return
- }
- this.filesList = fileList
- },
- handleProgress(event, file, fileList) {
- this.showProgress = true;
- this.uploadProgress = event.percent;
- console.log("uploadProgress",this.showProgress,uploadProgress,event)
+ methods: {
+ handleRemove(file, fileList) {
+ this.filesList = fileList
+ },
+ handlesuccess(response, file, fileList) {
+ if (response && response.hasOwnProperty('errcode')) {
+ this.$Message.warning(response.errmsg || '')
+ this.filesList = []
+ return
+ }
+ this.filesList = fileList
+ },
+ handleProgress(event, file, fileList) {
+ this.showProgress = true;
+ this.uploadProgress = event.percent;
+ console.log("uploadProgress", this.showProgress, uploadProgress, event)
},
async getApplicationList() {
@@ -295,31 +313,54 @@
})
this.appSpecialList = res.data
},
+ changeItem(e){
+ console.log("e",e)
+ },
+ remoteMethod(query) {
- async getProductList() {
+ this.productPage =1
+ this.productList = []
+ this.getProductList(query)
+ },
+ clearMethod(){
+ this.productPage =1
+ this.number_keyword = ''
+ this.productList = []
+ if (this.form.product_numbers_details && this.form.product_numbers_details.length > 0) {
+ this.productList.unshift(...this.form.product_numbers_details)
+ }
+ this.getProductList()
+ },
+ async getProductList(query) {
+ this.loading = true;
const res = await getProduct({
page_size: 100,
- page: this.productPage
- })
- 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)
- }
-
+ page: this.productPage,
+ filter: [{
+ key: 'number',
+ op: 'like',
+ value: this.number_keyword?this.number_keyword:''
+ }]
+ })
+ 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)
+ }
+ this.loading = false
- },
- loadMore() {
- // 这里写入要触发的方法
- this.productPage += 1;
- if(this.productPage>this.lastPage){
- return
- }
- this.getProductList();
+ },
+ loadMore() {
+ // 这里写入要触发的方法
+ this.productPage += 1;
+ if (this.productPage > this.lastPage) {
+ return
+ }
+ this.getProductList();
},
submit() {
@@ -328,19 +369,19 @@
this.form.id = this.id
} else {
this.form.id = ''
- }
- let _files = []
- if (this.filesList.length > 0) {
- for (var h of this.filesList) {
- if (h.response) {
- _files.push(h.response.id)
- } else {
- _files.push(h.id)
- }
- }
- this.form.files = _files
- } else {
- this.form.files = []
+ }
+ let _files = []
+ if (this.filesList.length > 0) {
+ for (var h of this.filesList) {
+ if (h.response) {
+ _files.push(h.response.id)
+ } else {
+ _files.push(h.id)
+ }
+ }
+ this.form.files = _files
+ } else {
+ this.form.files = []
}
console.log("this.form", this.form)
// return
@@ -365,27 +406,27 @@
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
this.form.date = res.date ? res.date : this.$moment().format('YYYY-MM-DD HH:mm:ss')
-
- this.form.is_visible = res.is_visible ? res.is_visible : 0
+
+ this.form.is_visible = res.is_visible ? res.is_visible : 0
this.form.is_top = res.is_top ? res.is_top : 0
this.form.category_ids = res.category_ids ? res.category_ids : []
this.form.product_numbers = res.product_numbers ? res.product_numbers : []
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 => {
- this.filesList.push({
- name: item.original_name,
- id: item.id,
- url: item.url
- })
- })
+ 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 => {
+ this.filesList.push({
+ name: item.original_name,
+ id: item.id,
+ url: item.url
+ })
+ })
}
})
}
@@ -394,30 +435,30 @@
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.productList = []
+ this.id = ''
+ this.filesList = []
+ this.showProgress = false;
+ this.uploadProgress = 0;
+ this.productList = []
this.productPage = 1
this.form = {
category_ids: [],
application_ids: [],
year: "",
title: "",
- source: '',
- is_top:0,
- is_visible:1,
+ source: '',
+ is_top: 0,
+ is_visible: 1,
date: '',
- link: '',
+ link: '',
files: [],
product_numbers: [],
separation_mode: [],
@@ -433,7 +474,8 @@