|
@@ -68,7 +68,15 @@
|
|
ref="table"
|
|
ref="table"
|
|
size="small"
|
|
size="small"
|
|
:rowKey="(record) => record.productSn"
|
|
:rowKey="(record) => record.productSn"
|
|
- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onChange, onSelect: onSelectChange, onSelectAll: onSelectAllChange }"
|
|
|
|
|
|
+ :row-selection="{
|
|
|
|
+ selectedRowKeys: selectedRowKeys,
|
|
|
|
+ onChange: onChange,
|
|
|
|
+ onSelect: onSelectChange,
|
|
|
|
+ onSelectAll: onSelectAllChange,
|
|
|
|
+ getCheckboxProps:record =>({props: {
|
|
|
|
+ disabled: (this.type == 'supplier') && (this.selectedRowKeys.indexOf(record.productSn) > -1)
|
|
|
|
+ }})
|
|
|
|
+ }"
|
|
:data-source="loadData"
|
|
:data-source="loadData"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
:pagination="paginationProps"
|
|
:pagination="paginationProps"
|
|
@@ -102,7 +110,7 @@ import { STable } from '@/components'
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
import { productTypeQuery } from '@/api/productType'
|
|
import { productTypeQuery } from '@/api/productType'
|
|
import { dealerScopeValidProduct } from '@/api/dealerScope'
|
|
import { dealerScopeValidProduct } from '@/api/dealerScope'
|
|
-import { productPricedList } from '@/api/product'
|
|
|
|
|
|
+import { productPricedList, productList } from '@/api/product'
|
|
export default {
|
|
export default {
|
|
name: 'ChooseProductsModal',
|
|
name: 'ChooseProductsModal',
|
|
components: { STable },
|
|
components: { STable },
|
|
@@ -117,7 +125,7 @@ export default {
|
|
return []
|
|
return []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- type: { // 类型,经销权设置dealership
|
|
|
|
|
|
+ type: { // 类型,经销权设置dealership, 供应商添加产品supplier
|
|
type: String,
|
|
type: String,
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
@@ -235,11 +243,22 @@ export default {
|
|
},
|
|
},
|
|
// 保存
|
|
// 保存
|
|
handleSave () {
|
|
handleSave () {
|
|
|
|
+ const _this = this
|
|
if (this.selectedRowKeys.length < 1) {
|
|
if (this.selectedRowKeys.length < 1) {
|
|
this.$message.warning('请在列表勾选后再进行操作!')
|
|
this.$message.warning('请在列表勾选后再进行操作!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- this.$emit('ok', this.selectedRows)
|
|
|
|
|
|
+ if (this.type == 'supplier') { // 供应商增加产品
|
|
|
|
+ const arr = []
|
|
|
|
+ this.selectedRowKeys.map(item => {
|
|
|
|
+ if (_this.chooseData.indexOf(item) == -1) {
|
|
|
|
+ arr.push(item)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.$emit('ok', arr)
|
|
|
|
+ } else {
|
|
|
|
+ this.$emit('ok', this.selectedRows)
|
|
|
|
+ }
|
|
this.isShow = false
|
|
this.isShow = false
|
|
},
|
|
},
|
|
onChange (selectedRowKeys, selectedRows) {
|
|
onChange (selectedRowKeys, selectedRows) {
|
|
@@ -247,29 +266,33 @@ export default {
|
|
},
|
|
},
|
|
onSelectChange (record, selected, selectedRows, nativeEvent) {
|
|
onSelectChange (record, selected, selectedRows, nativeEvent) {
|
|
const _this = this
|
|
const _this = this
|
|
- if (selected) { // 选择
|
|
|
|
- this.selectedRows.push(record)
|
|
|
|
- } else { // 取消
|
|
|
|
- this.selectedRows.map((item, index) => {
|
|
|
|
- if (item.productSn == record.productSn) {
|
|
|
|
- _this.selectedRows.splice(index, 1)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (this.type != 'supplier') { // 供应商增加产品
|
|
|
|
+ if (selected) { // 选择
|
|
|
|
+ this.selectedRows.push(record)
|
|
|
|
+ } else { // 取消
|
|
|
|
+ this.selectedRows.map((item, index) => {
|
|
|
|
+ if (item.productSn == record.productSn) {
|
|
|
|
+ _this.selectedRows.splice(index, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 本页全选/取消全选
|
|
// 本页全选/取消全选
|
|
onSelectAllChange (selected, selectedRows, changeRows) {
|
|
onSelectAllChange (selected, selectedRows, changeRows) {
|
|
const _this = this
|
|
const _this = this
|
|
- if (selected) { // 选择
|
|
|
|
- this.selectedRows = [...this.selectedRows, ...changeRows]
|
|
|
|
- } else { // 取消
|
|
|
|
- this.selectedRows.map((item, index) => {
|
|
|
|
- this.selectedRows.map((subItem, ind) => {
|
|
|
|
- if (item.productSn == subItem.productSn) {
|
|
|
|
- _this.selectedRows.splice(index, 1)
|
|
|
|
- }
|
|
|
|
|
|
+ if (this.type != 'supplier') { // 供应商增加产品
|
|
|
|
+ if (selected) { // 选择
|
|
|
|
+ this.selectedRows = [...this.selectedRows, ...changeRows]
|
|
|
|
+ } else { // 取消
|
|
|
|
+ this.selectedRows.map((item, index) => {
|
|
|
|
+ this.selectedRows.map((subItem, ind) => {
|
|
|
|
+ if (item.productSn == subItem.productSn) {
|
|
|
|
+ _this.selectedRows.splice(index, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
})
|
|
})
|
|
- })
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 产品列表
|
|
// 产品列表
|
|
@@ -281,7 +304,11 @@ export default {
|
|
pageSize: this.pageSize
|
|
pageSize: this.pageSize
|
|
}
|
|
}
|
|
this.loading = true
|
|
this.loading = true
|
|
- productPricedList(Object.assign(params, this.queryParam)).then(res => {
|
|
|
|
|
|
+ let url = productPricedList // 获取定过价的产品
|
|
|
|
+ if (this.type == 'supplier') { // 供应商增加产品
|
|
|
|
+ url = productList // 获取全部产品(包含定过价和未定过价的所有)
|
|
|
|
+ }
|
|
|
|
+ url(Object.assign(params, this.queryParam)).then(res => {
|
|
this.loading = false
|
|
this.loading = false
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
const data = res.data
|
|
const data = res.data
|
|
@@ -356,11 +383,16 @@ export default {
|
|
this.disabled = false
|
|
this.disabled = false
|
|
this.resetData()
|
|
this.resetData()
|
|
} else {
|
|
} else {
|
|
- this.selectedRows = this.chooseData
|
|
|
|
- this.selectedRowKeys = []
|
|
|
|
- this.chooseData.map(item => {
|
|
|
|
- this.selectedRowKeys.push(item.goodsSn)
|
|
|
|
- })
|
|
|
|
|
|
+ if (this.type == 'supplier') { // 供应商增加产品
|
|
|
|
+ this.selectedRows = []
|
|
|
|
+ this.selectedRowKeys = this.chooseData
|
|
|
|
+ } else {
|
|
|
|
+ this.selectedRows = this.chooseData
|
|
|
|
+ this.selectedRowKeys = []
|
|
|
|
+ this.chooseData.map(item => {
|
|
|
|
+ this.selectedRowKeys.push(item.goodsSn)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
if (this.productBrandList.length == 0) {
|
|
if (this.productBrandList.length == 0) {
|
|
this.getProductBrand()
|
|
this.getProductBrand()
|
|
}
|
|
}
|