|
@@ -3,7 +3,7 @@
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<a-card size="small" :bordered="false" class="categorySet-cont">
|
|
<a-card size="small" :bordered="false" class="categorySet-cont">
|
|
<div class="table-operator" ref="categorySetAddBtn">
|
|
<div class="table-operator" ref="categorySetAddBtn">
|
|
- <a-button type="primary" class="button-error" @click="addCategory">+新增管辖品类</a-button>
|
|
|
|
|
|
+ <a-button type="primary" class="button-error" @click="addCategory" :disabled="disabled">+新增管辖品类</a-button>
|
|
</div>
|
|
</div>
|
|
<a-table
|
|
<a-table
|
|
bordered
|
|
bordered
|
|
@@ -15,10 +15,10 @@
|
|
:scroll="{ y: tableHeight }" -->
|
|
:scroll="{ y: tableHeight }" -->
|
|
<!-- 产品分类 -->
|
|
<!-- 产品分类 -->
|
|
<template slot="classify" slot-scope="text,record,index">
|
|
<template slot="classify" slot-scope="text,record,index">
|
|
- <a-row v-if="record.classifyList && record.classifyList.length>0">
|
|
|
|
|
|
+ <a-row v-if="record.productTypeList && record.productTypeList.length>0">
|
|
<a-col :span="20">
|
|
<a-col :span="20">
|
|
- <a-tag closable @close="delLabel(index,i,'classifyList')" v-for="(con,i) in record.classifyList" :key="i">
|
|
|
|
- {{ con }}
|
|
|
|
|
|
+ <a-tag closable @close.prevent="delLabel(record.bizUserScopeSn,con,'typeList')" v-for="(con,i) in record.productTypeList" :key="i">
|
|
|
|
+ {{ con.dataName }}
|
|
</a-tag>
|
|
</a-tag>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :span="4" style="text-align:right;">
|
|
<a-col :span="4" style="text-align:right;">
|
|
@@ -37,32 +37,32 @@
|
|
</template>
|
|
</template>
|
|
<!-- 产品品牌 -->
|
|
<!-- 产品品牌 -->
|
|
<template slot="brand" slot-scope="text,record,index">
|
|
<template slot="brand" slot-scope="text,record,index">
|
|
- <a-row v-if="record.brandList && record.brandList.length>0">
|
|
|
|
|
|
+ <a-row v-if="record.productBrandList && record.productBrandList.length>0">
|
|
<a-col :span="20">
|
|
<a-col :span="20">
|
|
- <a-tag closable @close="delLabel(index,j,'brandList')" v-for="(item,j) in record.brandList" :key="j">
|
|
|
|
- {{ item }}
|
|
|
|
|
|
+ <a-tag closable @close.prevent="delLabel(record.bizUserScopeSn,item,'brandList')" v-for="(item,j) in record.productBrandList" :key="j">
|
|
|
|
+ {{ item.dataName }}
|
|
</a-tag>
|
|
</a-tag>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :span="4" style="text-align:right;">
|
|
<a-col :span="4" style="text-align:right;">
|
|
- <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag" color="blue">
|
|
|
|
|
|
+ <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
|
|
<a-icon type="plus" /> 选择
|
|
<a-icon type="plus" /> 选择
|
|
</a-tag>
|
|
</a-tag>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
<a-row v-else>
|
|
<a-row v-else>
|
|
<a-col :span="24">
|
|
<a-col :span="24">
|
|
- <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag" color="blue">
|
|
|
|
|
|
+ <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
|
|
<a-icon type="plus" /> 选择
|
|
<a-icon type="plus" /> 选择
|
|
</a-tag>
|
|
</a-tag>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
</template>
|
|
</template>
|
|
- <span slot="action" slot-scope="text, record">
|
|
|
|
|
|
+ <span slot="action" slot-scope="text,record">
|
|
<a-button
|
|
<a-button
|
|
size="small"
|
|
size="small"
|
|
type="link"
|
|
type="link"
|
|
class="button-error"
|
|
class="button-error"
|
|
- @click="handleDel(text)"
|
|
|
|
|
|
+ @click="handleDel(record)"
|
|
>
|
|
>
|
|
删除
|
|
删除
|
|
</a-button>
|
|
</a-button>
|
|
@@ -70,21 +70,22 @@
|
|
</a-table>
|
|
</a-table>
|
|
</a-card>
|
|
</a-card>
|
|
</a-spin>
|
|
</a-spin>
|
|
- <!-- 选择分类 -->
|
|
|
|
- <chooseClassifyModal :openModal="showClassifyModal" @ok="handleClassifyModal" @close="showClassifyModal=false" ></chooseClassifyModal>
|
|
|
|
- <!-- 选择品牌 -->
|
|
|
|
- <chooseBrandModal :openModal="showBrandModal" @close="showBrandModal=false" ></chooseBrandModal>
|
|
|
|
|
|
+ <!-- 选择产品品牌 -->
|
|
|
|
+ <chooseBrandModal :openModal="openBrandModal" @close="openBrandModal=false" @ok="handleBrandOk" />
|
|
|
|
+ <!-- 选择产品分类 -->
|
|
|
|
+ <chooseTypeModal :openModal="openTypeModal" @close="openTypeModal=false" @ok="handleTypeOk" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
-import chooseBrandModal from './chooseBrandModal'
|
|
|
|
-import chooseClassifyModal from './chooseClassifyModal'
|
|
|
|
|
|
+import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
|
|
|
|
+import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
|
|
|
|
+import { getNewScopeSn, bizuserScopeQueryPage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
|
|
export default {
|
|
export default {
|
|
name: 'CategorySet',
|
|
name: 'CategorySet',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
- components: { chooseBrandModal, chooseClassifyModal },
|
|
|
|
|
|
+ components: { ChooseBrandModal, ChooseTypeModal },
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
spinning: false,
|
|
spinning: false,
|
|
@@ -103,9 +104,11 @@ export default {
|
|
openModal: false, // 新增编辑产品品牌 弹框
|
|
openModal: false, // 新增编辑产品品牌 弹框
|
|
itemSn: '', // 当前sn
|
|
itemSn: '', // 当前sn
|
|
nowData: null, // 当前记录数据
|
|
nowData: null, // 当前记录数据
|
|
- showClassifyModal: false,
|
|
|
|
- showBrandModal: false,
|
|
|
|
- ChooseClassifyPos: null
|
|
|
|
|
|
+ openBrandModal: false,
|
|
|
|
+ openTypeModal: false,
|
|
|
|
+ chooseBrand: null,
|
|
|
|
+ chooseType: null,
|
|
|
|
+ chooseObj: null// 选择品牌 内容
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -115,65 +118,133 @@ export default {
|
|
},
|
|
},
|
|
// 新增管辖品类
|
|
// 新增管辖品类
|
|
addCategory () {
|
|
addCategory () {
|
|
- const newData = {
|
|
|
|
- classifyList: [],
|
|
|
|
- brandList: []
|
|
|
|
- }
|
|
|
|
- this.dataSource.push(newData)
|
|
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ _this.disabled = true
|
|
|
|
+ getNewScopeSn({}).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ const newData = {
|
|
|
|
+ bizUserScopeSn: res.data,
|
|
|
|
+ productTypeList: [],
|
|
|
|
+ productBrandList: []
|
|
|
|
+ }
|
|
|
|
+ _this.dataSource.push(newData)
|
|
|
|
+ }
|
|
|
|
+ _this.spinning = false
|
|
|
|
+ _this.disabled = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 删除分类、品牌标签
|
|
// 删除分类、品牌标签
|
|
- delLabel (pos, i, name) {
|
|
|
|
- this.dataSource[pos][name].splice(i, 1)
|
|
|
|
|
|
+ delLabel (bigRow, row, type) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '删除后不可恢复,确定要删除吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ console.log('11111', bigRow)
|
|
|
|
+ const bigPos = _this.dataSource.findIndex(con => { return bigRow == con.bizUserScopeSn })
|
|
|
|
+ if (type == 'typeList') {
|
|
|
|
+ const typePos = _this.dataSource[bigPos].productTypeList.findIndex(item => { return item.id == item.id })
|
|
|
|
+ deleteProductType({ id: _this.dataSource[bigPos].productTypeList[typePos].id }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.dataSource[bigPos].productTypeList.splice(typePos, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ const brandPos = _this.dataSource[bigPos].productBrandList.findIndex(obj => { return obj.id == obj.id })
|
|
|
|
+ deleteProductBrand({ id: _this.dataSource[bigPos].productBrandList[brandPos].id }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.dataSource[bigPos].productBrandList.splice(brandPos, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 添加分类标签
|
|
// 添加分类标签
|
|
addClassifyTag (pos, row) {
|
|
addClassifyTag (pos, row) {
|
|
- this.ChooseClassifyPos = pos
|
|
|
|
- this.showClassifyModal = true
|
|
|
|
|
|
+ this.chooseObj = row
|
|
|
|
+ this.openTypeModal = true
|
|
},
|
|
},
|
|
handleClassifyModal (con) {
|
|
handleClassifyModal (con) {
|
|
const chooseList = con
|
|
const chooseList = con
|
|
- this.showClassifyModal = false
|
|
|
|
- this.dataSource[this.ChooseClassifyPos].classifyList = [...this.dataSource[this.ChooseClassifyPos].classifyList, ...chooseList]
|
|
|
|
|
|
+ this.openTypeModal = false
|
|
|
|
+ this.dataSource[this.ChooseClassifyPos].productTypeList = [...this.dataSource[this.ChooseClassifyPos].productTypeList, ...chooseList]
|
|
|
|
+ },
|
|
|
|
+ // 分类
|
|
|
|
+ handleTypeOk (obj) {
|
|
|
|
+ this.chooseType = obj
|
|
|
|
+ this.saveChangeData('CATEGORY')
|
|
},
|
|
},
|
|
// 添加品牌标签
|
|
// 添加品牌标签
|
|
addBrandTag (pos, row) {
|
|
addBrandTag (pos, row) {
|
|
- this.ChooseBrandPos = pos
|
|
|
|
- this.showBrandModal = true
|
|
|
|
|
|
+ this.chooseObj = row
|
|
|
|
+ this.openBrandModal = true
|
|
},
|
|
},
|
|
- // 保存
|
|
|
|
- save () {
|
|
|
|
-
|
|
|
|
|
|
+ // 品牌
|
|
|
|
+ handleBrandOk (obj) {
|
|
|
|
+ this.chooseBrand = obj
|
|
|
|
+ this.saveChangeData('BRAND')
|
|
},
|
|
},
|
|
- // 新增/编辑
|
|
|
|
- handleEdit (row) {
|
|
|
|
- if (row) {
|
|
|
|
- this.itemSn = row.warehouseLocationSn
|
|
|
|
- row.warehouseSn = this.$route.params.sn
|
|
|
|
- this.nowData = row
|
|
|
|
- } else {
|
|
|
|
- this.itemSn = null
|
|
|
|
- this.nowData = { warehouseSn: this.$route.params.sn }
|
|
|
|
|
|
+ saveChangeData (type) {
|
|
|
|
+ const _this = this
|
|
|
|
+ if (type == 'BRAND') { // 选择品牌
|
|
|
|
+ if (_this.chooseBrand.length > 0) {
|
|
|
|
+ const snList = []
|
|
|
|
+ _this.chooseBrand.map(item => {
|
|
|
|
+ const newObj = {}
|
|
|
|
+ newObj.dataSn = item.brandSn
|
|
|
|
+ snList.push(newObj)
|
|
|
|
+ })
|
|
|
|
+ this.save(snList, type)
|
|
|
|
+ }
|
|
|
|
+ } else if (type == 'CATEGORY') { // 选择分类
|
|
|
|
+ if (_this.chooseType.length > 0) {
|
|
|
|
+ const snList = []
|
|
|
|
+ _this.chooseType.map(item => {
|
|
|
|
+ const newObj = {}
|
|
|
|
+ newObj.dataSn = item.productTypeSn
|
|
|
|
+ snList.push(newObj)
|
|
|
|
+ })
|
|
|
|
+ this.save(snList, type)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- this.openModal = true
|
|
|
|
},
|
|
},
|
|
- // 新增/编辑 成功
|
|
|
|
- handleOk () {
|
|
|
|
- this.$refs.table.refresh(true)
|
|
|
|
- },
|
|
|
|
- // 关闭弹框
|
|
|
|
- closeModal () {
|
|
|
|
- this.itemSn = ''
|
|
|
|
- this.openModal = false
|
|
|
|
|
|
+ save (list, type) {
|
|
|
|
+ const ajaxdata = { userSn: this.$route.query.sn, bizUserScopeSn: this.chooseObj.bizUserScopeSn }
|
|
|
|
+ if (type == 'BRAND') {
|
|
|
|
+ ajaxdata.productBrandList = list
|
|
|
|
+ saveProductBrandList(ajaxdata).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.openBrandModal = false
|
|
|
|
+ this.getTableData()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else if (type == 'CATEGORY') {
|
|
|
|
+ ajaxdata.productTypeList = list
|
|
|
|
+ saveProductTypeList(ajaxdata).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.openTypeModal = false
|
|
|
|
+ this.getTableData()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- // 删除
|
|
|
|
- handleDel (pos) {
|
|
|
|
|
|
+ // 整行删除 删除
|
|
|
|
+ handleDel (row) {
|
|
const _this = this
|
|
const _this = this
|
|
this.$confirm({
|
|
this.$confirm({
|
|
title: '提示',
|
|
title: '提示',
|
|
content: '删除后不可恢复,确定要进行删除吗?',
|
|
content: '删除后不可恢复,确定要进行删除吗?',
|
|
centered: true,
|
|
centered: true,
|
|
onOk () {
|
|
onOk () {
|
|
- _this.dataSource.splice(pos, 1)
|
|
|
|
|
|
+ bizuserScopeDelete({ id: row.bizUserScopeSn }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ const pos = _this.dataSource.findIndex(item => { return item.bizUserScopeSn == row.bizUserScopeSn })
|
|
|
|
+ _this.dataSource.splice(pos, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -182,6 +253,24 @@ export default {
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|
|
_this.setTableH()
|
|
_this.setTableH()
|
|
})
|
|
})
|
|
|
|
+ this.getTableData()
|
|
|
|
+ },
|
|
|
|
+ // 获取列表数据
|
|
|
|
+ getTableData (params = {}) {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ bizuserScopeQueryPage({
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 20,
|
|
|
|
+ userSn: this.$route.query.sn,
|
|
|
|
+ hasDetail: 1,
|
|
|
|
+ ...params
|
|
|
|
+
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.dataSource = res.data.list
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
setTableH () {
|
|
setTableH () {
|
|
const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
|
|
const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
|
|
@@ -193,22 +282,6 @@ export default {
|
|
this.setTableH()
|
|
this.setTableH()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted () {
|
|
|
|
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
|
- this.pageInit()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- activated () {
|
|
|
|
- // 如果是新页签打开,则重置当前页面
|
|
|
|
- if (this.$store.state.app.isNewTab) {
|
|
|
|
- this.pageInit()
|
|
|
|
- }
|
|
|
|
- // 仅刷新列表,不重置页面
|
|
|
|
- if (this.$store.state.app.updateList) {
|
|
|
|
- this.pageInit()
|
|
|
|
- this.$refs.table.refresh()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
beforeRouteEnter (to, from, next) {
|
|
beforeRouteEnter (to, from, next) {
|
|
next(vm => {})
|
|
next(vm => {})
|
|
}
|
|
}
|