|
@@ -9,7 +9,7 @@
|
|
|
<a-card size="small" :bordered="false" class="permissionSetting-main">
|
|
|
<!-- 搜索条件 -->
|
|
|
<div class="table-page-search-wrapper">
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="getProductList(1)">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品名称">
|
|
@@ -52,7 +52,7 @@
|
|
|
</a-col>
|
|
|
</template>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
- <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-bottom: 18px;" type="primary" @click="getProductList(1)" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
|
|
|
<a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="permissionSetting-reset">重置</a-button>
|
|
|
<a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
@@ -69,20 +69,22 @@
|
|
|
<a-button id="permissionSetting-product" type="primary" class="button-success" @click="choosePModal('product')">选择产品</a-button>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
- <s-table
|
|
|
+ <a-table
|
|
|
class="sTable"
|
|
|
ref="table"
|
|
|
size="default"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
- :data="loadData"
|
|
|
+ :data-source="loadData"
|
|
|
+ :pagination="paginationProps"
|
|
|
+ :loading="loading"
|
|
|
:scroll="{ x: 1200, y: tableHeight }"
|
|
|
bordered>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button size="small" type="link" class="button-error" @click="handleDel(record)">删除</a-button>
|
|
|
</template>
|
|
|
- </s-table>
|
|
|
+ </a-table>
|
|
|
</a-card>
|
|
|
<!-- 选择产品品牌 -->
|
|
|
<chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
|
|
@@ -100,7 +102,7 @@ import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
|
|
|
import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
|
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
|
import { productTypeQuery } from '@/api/productType'
|
|
|
-import { dealerScopeList, dealerScopeDel } from '@/api/dealerScope'
|
|
|
+import { dealerScopeList, dealerScopeSave, dealerScopeDel } from '@/api/dealerScope'
|
|
|
export default {
|
|
|
components: { STable, VSelect, ChooseProductsModal, ChooseBrandModal, ChooseTypeModal },
|
|
|
data () {
|
|
@@ -117,6 +119,7 @@ export default {
|
|
|
},
|
|
|
productType: [],
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ loading: false, // 表格加载中
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '添加时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
@@ -127,20 +130,30 @@ export default {
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- if (this.tableHeight == 0) {
|
|
|
- this.tableHeight = window.innerHeight - 380
|
|
|
- }
|
|
|
- return dealerScopeList(Object.assign(parameter, this.queryParam, { dealerSn: this.$route.params.sn })).then(res => {
|
|
|
- const data = res.data
|
|
|
- const no = (data.pageNo - 1) * data.pageSize
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].no = no + i + 1
|
|
|
- }
|
|
|
- this.disabled = false
|
|
|
- return data
|
|
|
- })
|
|
|
+ // loadData: parameter => {
|
|
|
+ // this.disabled = true
|
|
|
+ // if (this.tableHeight == 0) {
|
|
|
+ // this.tableHeight = window.innerHeight - 380
|
|
|
+ // }
|
|
|
+ // return dealerScopeList(Object.assign(parameter, this.queryParam, { dealerSn: this.$route.params.sn })).then(res => {
|
|
|
+ // const data = res.data
|
|
|
+ // const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ // for (var i = 0; i < data.list.length; i++) {
|
|
|
+ // data.list[i].no = no + i + 1
|
|
|
+ // }
|
|
|
+ // this.disabled = false
|
|
|
+ // return data
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ loadData: [],
|
|
|
+ pageNo: 1, // 分页页码
|
|
|
+ pageSize: 10, // 分页 每页多少条
|
|
|
+ paginationProps: {
|
|
|
+ showSizeChanger: true, // 是否可以改变 pageSize
|
|
|
+ total: 0, // 分页总条数
|
|
|
+ current: 1,
|
|
|
+ onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
|
|
|
+ onChange: (current) => this.changePage(current)
|
|
|
},
|
|
|
productBrandList: [], // 品牌下拉数据
|
|
|
productTypeList: [], // 分类下拉数据
|
|
@@ -153,6 +166,48 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 经销权 列表
|
|
|
+ getProductList (pageNo) {
|
|
|
+ this.pageNo = pageNo || this.pageNo
|
|
|
+ this.disabled = true
|
|
|
+ if (this.tableHeight == 0) {
|
|
|
+ this.tableHeight = window.innerHeight - 380
|
|
|
+ }
|
|
|
+ const params = {
|
|
|
+ pageNo: this.pageNo,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ dealerScopeList(Object.assign(params, this.queryParam, { dealerSn: this.$route.params.sn })).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.status == 200) {
|
|
|
+ const data = res.data
|
|
|
+ this.paginationProps.total = Number(res.data.count) || 0
|
|
|
+ this.paginationProps.current = data.pageNo
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ }
|
|
|
+ this.loadData = data.list
|
|
|
+ this.disabled = false
|
|
|
+ } else {
|
|
|
+ this.paginationProps.total = 0
|
|
|
+ this.paginationProps.current = 1
|
|
|
+ this.loadData = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 分页 一页多少条change
|
|
|
+ changePageSize (current, pageSize) {
|
|
|
+ this.pageNo = current
|
|
|
+ this.pageSize = pageSize
|
|
|
+ this.getProductList()
|
|
|
+ },
|
|
|
+ // 分页 页码change
|
|
|
+ changePage (current) {
|
|
|
+ this.pageNo = current
|
|
|
+ this.getProductList()
|
|
|
+ },
|
|
|
// 选择产品
|
|
|
choosePModal (type) {
|
|
|
const productList = []
|
|
@@ -199,7 +254,17 @@ export default {
|
|
|
changeData (type) {
|
|
|
const _this = this
|
|
|
if (type == 'product') { // 选择产品
|
|
|
-
|
|
|
+ if (_this.chooseProducts.length > 0) {
|
|
|
+ _this.chooseProducts.map(item => {
|
|
|
+ item.goodsType = 'PRODUCT'
|
|
|
+ item.goodsTypeName = '产品'
|
|
|
+ item.goodsName = item.name
|
|
|
+ item.goodsSn = item.productSn
|
|
|
+ item.goodsCode = item.code
|
|
|
+ delete item.id
|
|
|
+ })
|
|
|
+ this.setData(_this.chooseProducts)
|
|
|
+ }
|
|
|
} else if (type == 'brand') { // 选择品牌
|
|
|
if (_this.chooseBrand.length > 0) {
|
|
|
_this.chooseBrand.map(item => {
|
|
@@ -209,43 +274,33 @@ export default {
|
|
|
item.goodsSn = item.brandSn
|
|
|
delete item.id
|
|
|
})
|
|
|
- this.setData()
|
|
|
+ this.setData(_this.chooseBrand)
|
|
|
}
|
|
|
} else if (type == 'type') { // 选择分类
|
|
|
-
|
|
|
- }
|
|
|
- const loadData = []
|
|
|
-
|
|
|
- if (_this.chooseType.length > 0) {
|
|
|
- _this.chooseType.map(item => {
|
|
|
- const obj = {
|
|
|
- goodsType: 'TYPE_' + item.productTypeLevel,
|
|
|
- goodsTypeName: (item.productTypeLevel == 1 ? '一级' : item.productTypeLevel == 2 ? '二级' : item.productTypeLevel == 3 ? '三级' : '') + '分类',
|
|
|
- goodsName: item.productTypeName,
|
|
|
- goodsSn: item.productTypeSn,
|
|
|
- orderGoodsUnit: undefined,
|
|
|
- orderGoodsQty: ''
|
|
|
- }
|
|
|
- delete item.id
|
|
|
- loadData.push(Object.assign(obj, item))
|
|
|
- })
|
|
|
+ if (_this.chooseType.length > 0) {
|
|
|
+ _this.chooseType.map(item => {
|
|
|
+ item.goodsType = 'TYPE_' + item.productTypeLevel
|
|
|
+ item.goodsTypeName = (item.productTypeLevel == 1 ? '一级' : item.productTypeLevel == 2 ? '二级' : item.productTypeLevel == 3 ? '三级' : '') + '分类'
|
|
|
+ item.goodsName = item.productTypeName
|
|
|
+ item.goodsSn = item.productTypeSn
|
|
|
+ delete item.id
|
|
|
+ })
|
|
|
+ this.setData(_this.chooseType)
|
|
|
+ }
|
|
|
}
|
|
|
- if (_this.chooseProducts.length > 0) {
|
|
|
- _this.chooseProducts.map(item => {
|
|
|
- const obj = {
|
|
|
- goodsType: 'PRODUCT',
|
|
|
- goodsTypeName: '产品',
|
|
|
- goodsName: item.name,
|
|
|
- name: item.name,
|
|
|
- goodsCode: item.code,
|
|
|
- goodsSn: item.productSn,
|
|
|
- orderGoodsUnit: undefined,
|
|
|
- orderGoodsQty: ''
|
|
|
- }
|
|
|
- delete item.id
|
|
|
- loadData.push(Object.assign(obj, item))
|
|
|
- })
|
|
|
+ },
|
|
|
+ // 添加经销权
|
|
|
+ setData (data) {
|
|
|
+ const _this = this
|
|
|
+ const params = {
|
|
|
+ dealerSn: _this.$route.params.sn
|
|
|
}
|
|
|
+ dealerScopeSave(params).then(res => {
|
|
|
+ if (res.data == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.getProductList(1)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 删除
|
|
|
handleDel (row) {
|
|
@@ -258,7 +313,7 @@ export default {
|
|
|
dealerScopeDel({ sn: row.dealerScopeSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
- _this.$refs.table.refresh()
|
|
|
+ _this.getProductList()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -273,7 +328,7 @@ export default {
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
this.productType = []
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ this.getProductList(1)
|
|
|
},
|
|
|
// 返回
|
|
|
handleBack () {
|
|
@@ -313,6 +368,7 @@ export default {
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
+ vm.getProductList(1)
|
|
|
vm.getProductBrand()
|
|
|
vm.getProductType()
|
|
|
})
|