|
@@ -1,8 +1,10 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
|
|
- <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
|
|
|
|
- <el-menu-item index="1">选择商品</el-menu-item>
|
|
|
|
|
|
+ <el-menu :default-active="moduleId" class="el-menu-demo" mode="horizontal">
|
|
|
|
+ <el-menu-item v-if="moduleId===1 && modules && modules.firstModulesName" index="1">{{ modules.firstModulesName }}</el-menu-item>
|
|
|
|
+ <el-menu-item v-if="moduleId===2 && modules && modules.secondModulesName" index="2">{{ modules.secondModulesName }}</el-menu-item>
|
|
|
|
+ <el-menu-item v-if="moduleId===3 && modules && modules.thirdModulesName" index="3">{{ modules.thirdModulesName }}</el-menu-item>
|
|
</el-menu>
|
|
</el-menu>
|
|
|
|
|
|
<div class="filter-container" style="margin-top:20px;">
|
|
<div class="filter-container" style="margin-top:20px;">
|
|
@@ -17,7 +19,7 @@
|
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
|
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
|
|
搜索
|
|
搜索
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button class="filter-item" type="primary" icon="el-icon-check">确定选择</el-button>
|
|
|
|
|
|
+ <el-button class="filter-item" type="primary" icon="el-icon-check" @click="confirmChoose()">确定选择</el-button>
|
|
<el-button class="filter-item" type="primary" icon="el-icon-close" @click="toggleSelection()">取消选择</el-button>
|
|
<el-button class="filter-item" type="primary" icon="el-icon-close" @click="toggleSelection()">取消选择</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -54,7 +56,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getList } from '@/api/goods'
|
|
|
|
|
|
+import { getAddList, getModule, saveAddList } from '@/api/goods'
|
|
import Pagination from '@/components/Pagination'
|
|
import Pagination from '@/components/Pagination'
|
|
export default {
|
|
export default {
|
|
components: { Pagination },
|
|
components: { Pagination },
|
|
@@ -70,10 +72,10 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
list: null,
|
|
list: null,
|
|
|
|
+ modules: null,
|
|
classify: null,
|
|
classify: null,
|
|
listLoading: true,
|
|
listLoading: true,
|
|
total: 0,
|
|
total: 0,
|
|
- activeIndex: '1',
|
|
|
|
listQuery: {
|
|
listQuery: {
|
|
index: 1,
|
|
index: 1,
|
|
pageSize: 20,
|
|
pageSize: 20,
|
|
@@ -82,30 +84,67 @@ export default {
|
|
productName: '',
|
|
productName: '',
|
|
shopName: '',
|
|
shopName: '',
|
|
classifyID: ''
|
|
classifyID: ''
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ multipleSelection: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
moduleId: function() {
|
|
moduleId: function() {
|
|
- return window.location.href.split('/').reverse()[0]
|
|
|
|
|
|
+ return window.location.href.split('/').reverse()[0] * 1
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
+ this.getModuleType()
|
|
this.fetchData()
|
|
this.fetchData()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getModuleType() {
|
|
|
|
+ getModule({ organizeID: this.organizeID }).then(response => {
|
|
|
|
+ this.modules = response.data[0]
|
|
|
|
+ })
|
|
|
|
+ },
|
|
fetchData() {
|
|
fetchData() {
|
|
this.listLoading = true
|
|
this.listLoading = true
|
|
- getList(this.listQuery).then(response => {
|
|
|
|
- const { organizeProductsPage, listByEffective } = response.data
|
|
|
|
- this.list = organizeProductsPage.results
|
|
|
|
- this.total = organizeProductsPage.totalRecord
|
|
|
|
|
|
+ getAddList(this.listQuery).then(response => {
|
|
|
|
+ const { productsPage, listByEffective } = response.data
|
|
|
|
+ this.list = productsPage.results
|
|
|
|
+ this.total = productsPage.totalRecord
|
|
this.classify = listByEffective
|
|
this.classify = listByEffective
|
|
this.listLoading = false
|
|
this.listLoading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleFilter() {
|
|
handleFilter() {
|
|
this.fetchData()
|
|
this.fetchData()
|
|
|
|
+ },
|
|
|
|
+ toggleSelection(rows) {
|
|
|
|
+ if (rows) {
|
|
|
|
+ rows.forEach(row => {
|
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(row)
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.multipleTable.clearSelection()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleSelectionChange(val) {
|
|
|
|
+ this.multipleSelection = val
|
|
|
|
+ },
|
|
|
|
+ confirmChoose() {
|
|
|
|
+ console.log(this.multipleSelection)
|
|
|
|
+ const itemsList = []
|
|
|
|
+ this.multipleSelection.map(item => {
|
|
|
|
+ itemsList.push(item.id)
|
|
|
|
+ })
|
|
|
|
+ saveAddList({ itemsList: itemsList, organizeID: this.organizeID, modules: this.moduleId }).then(response => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ title: response.code * 1 === 1 ? 'Success' : 'Error',
|
|
|
|
+ message: response.code * 1 === 1 ? '添加成功' : response.msg,
|
|
|
|
+ type: response.code * 1 === 1 ? 'success' : 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ this.fetchData()
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.fetchData()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|