master
lion 1 year ago
parent 0277c4811b
commit f53ebd5478

@ -8,7 +8,7 @@
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>Application Samples
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" filterable v-model="form.application_type_id" placeholder="Please Select">
<el-select style="width:100%" filterable multiple collapse-tags v-model="form.application_type_id" placeholder="Please Select">
<el-option v-for="item in appCategoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@ -21,7 +21,7 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Product Phase
</div>
<div class="xy-table-item-content">
<el-select multiple filterable style="width:100%" v-model="form.category_id" placeholder="Please Select">
<el-select multiple filterable collapse-tags style="width:100%" v-model="form.category_id" placeholder="Please Select">
<el-option v-for="(item,index) in productCategoryList" :key="index" :label="item.name" :value="item.id">
</el-option>
</el-select>
@ -48,6 +48,20 @@
</div>
</div>
</template>
<!-- <template v-slot:is_top>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Top
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_top"
placeholder="Please Select">
<el-option v-for="item in [{id:0,value:'No'},{id:1,value:'Yes'}]" :key="item.id" :label="item.value"
:value="item.id"></el-option>
</el-select>
</div>
</div>
</template> -->
<template v-slot:keywords>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
@ -225,10 +239,11 @@
width: 340
}],
form: {
application_type_id: '',
application_type_id: [],
category_id: [],
number: '',
title: "",
// is_top:0,
keywords:'',
separation: [],
branch: [],
@ -334,6 +349,8 @@
this.form.application_details = res.application_details ? res.application_details : [],
this.form.tag_ids = res.tag_ids?res.tag_ids:[],
this.form.category_id = res.category_id?res.category_id:[],
this.form.application_type_id = res.application_type_id?res.application_type_id:[],
// this.form.is_top = res.is_top?res.is_top:0
this.form.separation = res.separation?res.separation:[]
this.form.branch = res.branch?res.branch:[]
this.form.topic = res.topic?res.topic:[]
@ -361,10 +378,11 @@
this.id = ''
this.filesList = []
this.form = {
application_type_id: '',
application_type_id: [],
category_id: [],
number: '',
title: "",
// is_top:0,
keywords:'',
separation: [],
branch: [],

@ -8,7 +8,8 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Product Phase
</div>
<div class="xy-table-item-content">
<el-select multiple collapse-tags filterable style="width:100%" v-model="form.category_ids" placeholder="Please Select">
<el-select multiple collapse-tags filterable style="width:100%" v-model="form.category_ids"
placeholder="Please Select">
<el-option v-for="(item,index) in categoryList" :key="index" :label="item.name" :value="item.id">
</el-option>
</el-select>
@ -36,40 +37,53 @@
<el-input placeholder="Please Input" style="width:100%" v-model="form.title"></el-input>
</div>
</div>
</template>
<template v-slot:source>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Source
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.source"></el-input>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Release Time
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.date" style="width:100%" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" placeholder="Please Select">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:source>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Source
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.source"></el-input>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Release Time
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.date" style="width:100%" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="Please Select">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:link>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>Link
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Link
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.link"></el-input>
</div>
</div>
</template>
<template v-slot:files>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>File
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' :limit="1" :file-list="filesList" ref="pictureUpload"
:auto-upload="true" :data="uploadOther" :on-success="handlesuccess" :on-remove="handleRemove">
<el-button size="small" type="primary">upload</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:product_numbers>
<div class="xy-table-item">
@ -91,9 +105,9 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Separation Mode
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.separation_mode" placeholder="Please Select">
<el-option v-for="item in separationModeList" :key="item.id" :label="item.value"
:value="item.id">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.separation_mode"
placeholder="Please Select">
<el-option v-for="item in separationModeList" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
@ -105,9 +119,9 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Broad Sample Type
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.broad_sample_type" placeholder="Please Select">
<el-option v-for="item in applicationList" :key="item.id" :label="item.name"
:value="item.id">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.broad_sample_type"
placeholder="Please Select">
<el-option v-for="item in applicationList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
@ -119,9 +133,9 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Specific Sample
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.specific_sample" placeholder="Please Select">
<el-option v-for="item in appSpecialList" :key="item.id" :label="item.name"
:value="item.id">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.specific_sample"
placeholder="Please Select">
<el-option v-for="item in applicationList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
@ -141,13 +155,16 @@
import resource from "@/mixin/resources.js"
import {
index as getCategory
} from "@/api/product/category.js"
import {
index as getApplication
} from "@/api/application/category.js"
import {
index as getProduct
} from "@/api/product/category.js"
import {
index as getApplication
} from "@/api/application/category.js"
import {
index as getProduct
} from "@/api/product/index.js"
import {
getToken
} from '@/utils/auth'
export default {
mixins: [resource],
data() {
@ -157,17 +174,23 @@
id: '',
type: 'add',
productList: [],
categoryList: [],
applicationList: [],
appSpecialList:[],
categoryList: [],
applicationList: [],
appSpecialList: [],
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_UPLOAD_API}`,
filesList: [],
form: {
category_ids: [],
application_ids:[],
category_ids: [],
application_ids: [],
year: "",
title: "",
source:'',
date:'',
title: "",
source: '',
date: '',
link: '',
files: [],
product_numbers: [],
separation_mode: [],
broad_sample_type: [],
@ -182,66 +205,78 @@
required: true,
message: 'Please Input'
}],
link: [{
required: true,
message: 'Please Input'
}]
// link: [{
// required: true,
// message: 'Please Input'
// }]
}
}
},
created() {
this.getCategoryList()
this.getProductList()
this.getApplicationList()
this.getAppSpecial()
this.uploadOther.token = getToken();
this.getCategoryList()
this.getProductList()
this.getApplicationList()
// this.getAppSpecial()
},
methods: {
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
},
async getCategoryList() {
const res = await getCategory({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
type:2
sort_name: 'sort',
type: 2
})
this.categoryList = res.data
},
async getApplicationList() {
const res = await getApplication({
page_size: 9999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
filter:[{
key:'type',
op:'eq',
value:0
}]
})
this.applicationList = res.data
},
async getAppSpecial() {
const res = await getApplication({
page_size: 9999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
filter:[{
key:'type',
op:'eq',
value:1
}]
})
this.appSpecialList = res.data
},
async getProductList() {
const res = await getProduct({
page_size: 9999,
page: 1
})
this.productList = res.data
},
},
async getApplicationList() {
const res = await getApplication({
page_size: 9999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
// filter:[{
// key:'type',
// op:'eq',
// value:0
// }]
})
this.applicationList = res.data
},
async getAppSpecial() {
const res = await getApplication({
page_size: 9999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
filter: [{
key: 'type',
op: 'eq',
value: 1
}]
})
this.appSpecialList = res.data
},
async getProductList() {
const res = await getProduct({
page_size: 9999,
page: 1
})
this.productList = res.data
},
submit() {
@ -249,6 +284,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 = []
}
console.log("this.form", this.form)
// return
@ -271,14 +319,24 @@
table_name: this.table_name,
id: this.id
}).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.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:[]
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.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.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
})
})
}
})
}
},
@ -287,23 +345,25 @@
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}else{
this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss')
} else {
this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss')
}
} else {
this.id = ''
this.id = ''
this.filesList = []
this.form = {
category_ids: [],
application_ids:[],
year: "",
title: "",
source:'',
date:'',
category_ids: [],
application_ids: [],
year: "",
title: "",
source: '',
date: '',
link: '',
product_numbers: [],
separation_mode: [],
broad_sample_type: [],
files: [],
product_numbers: [],
separation_mode: [],
broad_sample_type: [],
specific_sample: [],
}
this.$refs['dialog'].reset()
@ -315,8 +375,7 @@
</script>
<style scoped lang="scss">
// ::v-deep .detail_list,
// ::v-deep .remark {
// flex-basis: 100%;
// }
::v-deep .files{
flex-basis: 100%;
}
</style>

Loading…
Cancel
Save