|
@@ -4,14 +4,15 @@
|
|
|
<el-table :data="tableData" header-row-class-name="custom-table-header"
|
|
|
v-el-table-infinite-scroll="getList"
|
|
|
:infinite-scroll-distance="10"
|
|
|
- :infinite-scroll-disabled="disabled">
|
|
|
+ :infinite-scroll-disabled="disabled"
|
|
|
+ @sort-change="sortChange">
|
|
|
<el-table-column label="#" width="60" type="index" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ (scope.$index + 1) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="产品名称" prop="productName" align="center"> </el-table-column>
|
|
|
+ <!-- <el-table-column label="产品名称" prop="productName" align="center"> </el-table-column>
|
|
|
<el-table-column label="上市时间" prop="marketTime" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
@@ -24,8 +25,16 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="参考许可费率" prop="licenseRate" align="center"> </el-table-column>
|
|
|
<el-table-column label="创建人" prop="createPersonName" align="center"> </el-table-column>
|
|
|
- <el-table-column label="产品说明" prop="productExplain" align="center"> </el-table-column>
|
|
|
-
|
|
|
+ <el-table-column label="产品说明" prop="productExplain" align="center"> </el-table-column> -->
|
|
|
+ <el-table-column v-for="item in column" :key="item.value" :prop="item.value" :label="item.name" align="center" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="['name'].includes(item.value)">
|
|
|
+ <el-link @click="handleItem(scope.row, item.value)">{{ scope.row[item.value] }}</el-link>
|
|
|
+ </div>
|
|
|
+ <div v-else v-html="$commonJS.getColumnData(scope.row, item)">
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="150px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-dropdown split-button type="primary" size="small" @click="handleCommand('0', scope.row)"
|
|
@@ -71,7 +80,50 @@ export default {
|
|
|
row:'',
|
|
|
searchOption:{
|
|
|
default:{}
|
|
|
- }
|
|
|
+ },
|
|
|
+ column:{
|
|
|
+ default:()=>{
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ value:'name',
|
|
|
+ type:'String',
|
|
|
+ name:'类别名称'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'marketTime',
|
|
|
+ type:'DateTime',
|
|
|
+ name:'上市时间'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'companyName',
|
|
|
+ type:'String',
|
|
|
+ name:'所属公司'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'licenseRate',
|
|
|
+ type:'String',
|
|
|
+ name:'许可费率'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'description',
|
|
|
+ type:'String',
|
|
|
+ name:'产品说明'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'createName',
|
|
|
+ type:'String',
|
|
|
+ name:'创建人'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:'createTime',
|
|
|
+ type:'DataTime',
|
|
|
+ name:'创建时间'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleMessage:''
|
|
|
+
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -87,6 +139,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ handleMessage(val){
|
|
|
+ if(val){
|
|
|
+ this.updateData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
if(!this.row){
|
|
|
this.disabled = true
|
|
@@ -95,9 +154,70 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //更新数据
|
|
|
+ updateData(){
|
|
|
+ if(this.action.type == 1){
|
|
|
+ if(this.tableData.length == 1){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ var startIndex = this.tableData.findIndex(item=>{
|
|
|
+ return item.id == this.action.id
|
|
|
+ })
|
|
|
+ this.tableData.splice(startIndex,1)
|
|
|
+ var str = this.$commonJS.objectToString(this.searchOption)
|
|
|
+ let params = {
|
|
|
+ ...this.params,
|
|
|
+ searchQuery:str?' AND ':'' + `category_id=${this.row.id}`,//检索条件
|
|
|
+ orderDTOList: this.sort,//排序
|
|
|
+ }
|
|
|
+ this.getList2(params,1)
|
|
|
+ }else if(this.action.type == 2){
|
|
|
+ let params = {
|
|
|
+ ...this.params,
|
|
|
+ searchQuery:`product_id=${this.action.id}`,//检索条件
|
|
|
+ }
|
|
|
+ this.getList2(params,2)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getList2(params,type){
|
|
|
+
|
|
|
+ this.$api.queryProduct(params).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ if(type == 1){
|
|
|
+ var startIndex = (params.current-1)*size
|
|
|
+ var endIndex = this.tableData.length
|
|
|
+ var len = endIndex - startIndex
|
|
|
+ this.tableData.splice(startIndex,len,...res.data.data)
|
|
|
+ this.params.total = res.data.total
|
|
|
+ }else if(type == 2){
|
|
|
+ var startIndex = this.tableData.findIndex(item=>{
|
|
|
+ return item.id == this.action.id
|
|
|
+ })
|
|
|
+ this.tableData.splice(startIndex,1,...res.data.data)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ })
|
|
|
+ },
|
|
|
// 编辑下拉菜单
|
|
|
- handleCommand(val, row) {
|
|
|
- this.$emit('optionsSon',{val,row})
|
|
|
+ handleCommand(option, row) {
|
|
|
+ if(option == 7){
|
|
|
+ this.action={
|
|
|
+ type:'1',
|
|
|
+ id:row.id
|
|
|
+ }
|
|
|
+ this.deletes(row)
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ this.action={
|
|
|
+ type:'2',
|
|
|
+ id:row.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$emit('optionsSon',{option,row})
|
|
|
},
|
|
|
//获取数据
|
|
|
getList() {
|
|
@@ -132,6 +252,32 @@ export default {
|
|
|
this.isFlag = false
|
|
|
}, 1000)
|
|
|
},
|
|
|
+ // 排序方法
|
|
|
+ sortChange({ column, prop, order }) {
|
|
|
+ this.sort=[]//如需要多个字段排序,则不需要清空
|
|
|
+ if (order == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var orderType = {
|
|
|
+ ascending: 0,
|
|
|
+ descending: 1
|
|
|
+ }
|
|
|
+ var params = this.sort.find(item => {
|
|
|
+ return item.orderBy == prop
|
|
|
+ })
|
|
|
+ if (params) {
|
|
|
+ params.orderType = orderType[order]
|
|
|
+ } else {
|
|
|
+ params = {}
|
|
|
+ params.orderBy = prop
|
|
|
+ params.orderType = orderType[order]
|
|
|
+ this.sort.push(params)
|
|
|
+ }
|
|
|
+ this.params.current = 0
|
|
|
+ this.disabled = false
|
|
|
+ this.tableData.splice(0)
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|