Commit a7c31d9a by 前端

Merge branch 'yangm_dev_v2.0.0' into 'v2.0.0'

Yangm dev v2.0.0

See merge request !13
2 parents ec219301 3a11b89f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http_config,http_car } from '@/main' import { http_config,http } from '@/main'
const getMerchantTree = params => { const getMerchantTree = params => {
params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list' params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list'
return http_config({ return http_config({
...@@ -44,9 +44,9 @@ const merchantInfo = params => { ...@@ -44,9 +44,9 @@ const merchantInfo = params => {
}) })
} }
const brandList = params => { const brandList = params => {
params.method = 'dj.api.get.car.brandList' params.method = 'merchants.api.merchantCommon.getCarbrandTree'
return http_car({ return http({
url: '/rop-dj-car-boutique/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
......
...@@ -299,9 +299,8 @@ export default { ...@@ -299,9 +299,8 @@ export default {
if (params.businessType) { if (params.businessType) {
params.businessType = params.businessType.join(',') params.businessType = params.businessType.join(',')
} }
const getCheckedArr = this.$refs.baseInfoForm.$refs.brandListTree.getCheckedArr const merchantBrandList = this.$refs.baseInfoForm.$refs.brandListTree.getMerchantBrandList()
const merchantBrandMain = getCheckedArr.map(item => item.id) params.merchantBrandListJson = JSON.stringify(merchantBrandList)
params.merchantBrandMain = merchantBrandMain.join(',')
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0) params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0)
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel params.merchantAccountLevel = this.accountDetail.merchantAccountLevel
params.status = 1 params.status = 1
......
...@@ -200,13 +200,14 @@ export default { ...@@ -200,13 +200,14 @@ export default {
} }
}, },
methods: { methods: {
checkBrandList(merchantBrandMain) { checkBrandList(chant) {
let merchantBrandMain = chant.filter(item=>item)
this.$set(this.accountAddForm, 'merchantBrandMain', merchantBrandMain) this.$set(this.accountAddForm, 'merchantBrandMain', merchantBrandMain)
console.log(this.accountAddForm.merchantBrandMain)
if (!this.accountAddForm.merchantBrandMain) { if (!this.accountAddForm.merchantBrandMain) {
this.accountAddForm.merchantBrandMain = [] this.accountAddForm.merchantBrandMain = []
} else {
this.accountAddForm.merchantBrandMain = this.accountAddForm.merchantBrandMain.split(',')
} }
console.log(this.accountAddForm.merchantBrandMain)
this.$refs.brandListTree.getCheckList(this.accountAddForm.merchantBrandMain) this.$refs.brandListTree.getCheckList(this.accountAddForm.merchantBrandMain)
}, },
checkBusinessType(type) { checkBusinessType(type) {
...@@ -224,11 +225,12 @@ export default { ...@@ -224,11 +225,12 @@ export default {
async brandList() { async brandList() {
this.$refs.brandListTree.loading = true this.$refs.brandListTree.loading = true
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' }) this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
const brandListTree = await this.$apis.baseInfo.brandList({ needCarSeries: true }) const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => { brandListTree.forEach(item => {
let child = item.childs let child = item.children
if(!child) return
child.forEach(k => { child.forEach(k => {
delete k.childs delete k.children
}) })
}) })
this.brandListTree = brandListTree this.brandListTree = brandListTree
......
...@@ -314,9 +314,8 @@ export default { ...@@ -314,9 +314,8 @@ export default {
let businessScopeCustomize = this.businessScopeCustomize.map(item => item.name) let businessScopeCustomize = this.businessScopeCustomize.map(item => item.name)
params.businessScopeCustomize = businessScopeCustomize.join(',') params.businessScopeCustomize = businessScopeCustomize.join(',')
params.merchantFiles = JSON.stringify(params.merchantFiles) params.merchantFiles = JSON.stringify(params.merchantFiles)
const getCheckedArr = this.$refs.baseInfoForm.$refs.brandListTree.getCheckedArr const merchantBrandList = this.$refs.baseInfoForm.$refs.brandListTree.getMerchantBrandList()
const merchantBrandMain = getCheckedArr.map(item => item.id) params.merchantBrandListJson = JSON.stringify(merchantBrandList)
params.merchantBrandMain = merchantBrandMain.join(',')
Promise.all([pm1, pm2]).then(() => { Promise.all([pm1, pm2]).then(() => {
this.$apis.store.updateMerchant(params).then(res => { this.$apis.store.updateMerchant(params).then(res => {
if (res) { if (res) {
...@@ -424,6 +423,7 @@ export default { ...@@ -424,6 +423,7 @@ export default {
accounttypeId: accountType, accounttypeId: accountType,
merchantBrandMain merchantBrandMain
}) })
merchantBrandMain = merchantBrandMain.replaceAll(';', ',').split(',')
this.$refs.baseInfoForm.checkBrandList(merchantBrandMain) this.$refs.baseInfoForm.checkBrandList(merchantBrandMain)
this.$refs.baseInfoForm.checkBusinessType(businessType) this.$refs.baseInfoForm.checkBusinessType(businessType)
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -95,11 +95,13 @@ export default { ...@@ -95,11 +95,13 @@ export default {
console.log(this.infoForm.businessType) console.log(this.infoForm.businessType)
} }
console.log(this.infoForm.businessType) console.log(this.infoForm.businessType)
const brandListTree = await this.$apis.baseInfo.brandList({ needCarSeries: true }) const brandListTree = await this.$apis.baseInfo.brandList({})
console.log(brandListTree)
brandListTree.forEach(item => { brandListTree.forEach(item => {
let child = item.childs let child = item.children
if(!child) return
child.forEach(k => { child.forEach(k => {
delete k.childs delete k.children
}) })
}) })
this.brandListTree = brandListTree this.brandListTree = brandListTree
...@@ -107,7 +109,7 @@ export default { ...@@ -107,7 +109,7 @@ export default {
if (!this.infoForm.merchantBrandMain) { if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = [] this.infoForm.merchantBrandMain = []
} else { } else {
this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.split(',') this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.replaceAll(';',',').split(',')
} }
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain) this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain)
this.$nextTick(() => { this.$nextTick(() => {
...@@ -147,9 +149,8 @@ export default { ...@@ -147,9 +149,8 @@ export default {
delete params.stores delete params.stores
params.businessType = params.businessType.join(',') params.businessType = params.businessType.join(',')
//merchantBrandMain 品牌id //merchantBrandMain 品牌id
const getCheckedArr = this.$refs.brandListTree.getCheckedArr const merchantBrandList = this.$refs.brandListTree.getMerchantBrandList()
const merchantBrandMain = getCheckedArr.map(item => item.id) params.merchantBrandListJson = JSON.stringify(merchantBrandList)
params.merchantBrandMain = merchantBrandMain.join(',')
this.$apis.store.updateMerchant(params).then(res => { this.$apis.store.updateMerchant(params).then(res => {
if (res) { if (res) {
this.$router.push({ path: '/baseInfo/index' }) this.$router.push({ path: '/baseInfo/index' })
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
<div class="select-input-box"> <div class="select-input-box">
<template v-for="(item, idx) in getCheckedArr"> <template v-for="(item, idx) in getCheckedArr">
<el-tag effect="plain" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)" v-if="idx < 3"> <el-tag effect="plain" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)" v-if="idx < 3">
{{ item.name }} {{ item.label }}
</el-tag> </el-tag>
</template> </template>
<el-popover placement="top" width="600" trigger="hover" class="select-popover"> <el-popover placement="top" width="600" trigger="hover" class="select-popover">
<div class="select-popover-box"> <div class="select-popover-box">
<el-tag effect="plain" class="popover-item" v-for="(item, idx) in getCheckedArr" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)"> <el-tag effect="plain" class="popover-item" v-for="(item, idx) in getCheckedArr" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)">
{{ item.name }} {{ item.label }}
</el-tag> </el-tag>
</div> </div>
<el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag> <el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag>
...@@ -47,8 +47,8 @@ export default { ...@@ -47,8 +47,8 @@ export default {
treeArr: [], treeArr: [],
getCheckedArr: [], getCheckedArr: [],
defaultProps: { defaultProps: {
children: 'childs', children: 'children',
label: 'name' label: 'label'
} }
} }
}, },
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
handler() { handler() {
const getCheckedNodes = this.$refs.tree.getCheckedNodes() const getCheckedNodes = this.$refs.tree.getCheckedNodes()
this.getCheckedArr = getCheckedNodes.reduce((prev, cur) => { this.getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs') && cur.childs.length > 0) { if (Object.keys(cur).includes('children') && cur.children.length > 0) {
return prev return prev
} }
return prev.concat(cur) return prev.concat(cur)
...@@ -75,6 +75,37 @@ export default { ...@@ -75,6 +75,37 @@ export default {
} }
}, },
methods: { methods: {
getMerchantBrandList() {
let getCheckedNodes = this.$refs.tree.getCheckedNodes()
const getCheckedKeys = this.$refs.tree.getCheckedKeys()
const getHalfCheckedNodes = this.$refs.tree.getHalfCheckedNodes()
let merchantBrandList = getHalfCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
let merchantBrandList2 = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
return merchantBrandList.concat(merchantBrandList2)
},
//勾选 //勾选
handleCheck() { handleCheck() {
this.treeArr = this.getTreeArray() this.treeArr = this.getTreeArray()
...@@ -86,6 +117,8 @@ export default { ...@@ -86,6 +117,8 @@ export default {
} }
}, },
getCheckList(checkArr = []) { getCheckList(checkArr = []) {
checkArr.forEach(item=>item = parseInt(item));
console.log(checkArr)
this.$refs.tree.setCheckedKeys(checkArr) this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => { this.$nextTick(() => {
this.handleCheck() this.handleCheck()
...@@ -95,7 +128,7 @@ export default { ...@@ -95,7 +128,7 @@ export default {
getTreeArray() { getTreeArray() {
let tree_arr = [] let tree_arr = []
this.brandListTree.forEach(k => { this.brandListTree.forEach(k => {
let child = k.childs let child = k.children
if (child && child.length > 0) { if (child && child.length > 0) {
child.forEach(j => { child.forEach(j => {
tree_arr.push(j.id) tree_arr.push(j.id)
...@@ -133,7 +166,7 @@ export default { ...@@ -133,7 +166,7 @@ export default {
this.getCheckedArr.splice(index, 1) this.getCheckedArr.splice(index, 1)
const getCheckedNodes = this.$refs.tree.getCheckedNodes() const getCheckedNodes = this.$refs.tree.getCheckedNodes()
let getCheckedArr = getCheckedNodes.reduce((prev, cur) => { let getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs')) { if (Object.keys(cur).includes('children')) {
return prev return prev
} }
return prev.concat(cur) return prev.concat(cur)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!