Commit 83fe8c6a by luyt

修改主营品牌

1 parent 075b4c28
......@@ -213,6 +213,12 @@
align-items: center;
justify-content: center;
}
.check-carbrand {
position: absolute;
left: 340px;
top: 0;
}
</style>
<title>商户编辑</title>
</head>
......@@ -387,8 +393,9 @@
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">主营品牌:</label>
<div class="layui-input-inline">
<div class="layui-input-inline" style="position: relative;">
<input class="layui-input" placeholder="车型品牌" id="brand" />
<button id="checkCarBrand" type="button" class="layui-btn btn-no-border check-carbrand">全选</button>
<div id="carBrandTree" class="wrapper-tree hide" style="height: 200px; overflow-y: scroll"></div>
<div id="noCarbrand" class="no-car hide">暂无数据</div>
</div>
......@@ -849,8 +856,28 @@
})
// merchantForm.businessScopeCustomize = tempList.join(',')
// params.businessScopeCustomize = tempList.join(',')
if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
// if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
// params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
if (treeObj) {
let getCheckedNodes = treeObj.getCheckedNodes(true)
const getCheckedKeys = treeObj.getCheckedNodes(true).map(item => item.id)
console.log(getCheckedKeys)
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
merchantForm.merchantBrandList = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
console.log(merchantForm.merchantBrandList)
params.merchantBrandListJson = JSON.stringify(merchantForm.merchantBrandList)
}
if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
......@@ -988,6 +1015,18 @@
return false
}
}
var checkAll = false
var checkCarBrand = $('#checkCarBrand')
// 主营品牌全选
checkCarBrand.on('click', function() {
checkAll = !checkAll
treeObj.checkAllNodes(checkAll)
if (checkAll) {
checkCarBrand.html('全不选')
} else {
checkCarBrand.html('全选')
}
})
$('.layui-btn').on('click', function () {
var type = $(this).data('type')
......@@ -1275,9 +1314,7 @@
// 品牌
function getCarBrandTree() {
var params = {
method: 'dj.api.get.car.brandList',
needCarSeries: true
// method: 'merchants.api.merchantCommon.getCarbrandTree'
method: 'merchants.api.merchantCommon.getCarbrandTree'
}
request(params, function (res) {
baseData.carBrandTreeList = res.data
......@@ -1285,7 +1322,8 @@
$('#carBrandTree').removeClass('hide')
var checkedList = []
if (editLevel == 3 && merchantForm.merchantBrandMain) {
checkedList = merchantForm.merchantBrandMain.split(',')
// checkedList = merchantForm.merchantBrandMain.split(',')
checkedList = merchantForm.merchantBrandMain.replaceAll(';',',').split(',')
$.each(checkedList, function (index, item) {
checkedList[index] = parseInt(item)
})
......@@ -1301,7 +1339,7 @@
} else {
$('#noCarbrand').removeClass('hide')
}
}, { isDjUrl: true })
})
}
// 获取字典数据
function getDictData(dictType, fn) {
......
......@@ -225,6 +225,12 @@
align-items: center;
justify-content: center;
}
.check-carbrand {
position: absolute;
left: 340px;
top: 0;
}
</style>
<title>商户编辑</title>
</head>
......@@ -372,8 +378,9 @@
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">主营品牌:</label>
<div class="layui-input-inline">
<div class="layui-input-inline" style="position: relative;">
<input class="layui-input" placeholder="车型品牌" id="brand" />
<button id="checkCarBrand" type="button" class="layui-btn btn-no-border check-carbrand">全选</button>
<div id="carBrandTree" class="hide" style="height: 200px; overflow-y: scroll"></div>
<div id="noCarbrand" class="no-car hide">暂无数据</div>
</div>
......@@ -528,7 +535,7 @@
<script src="/js/load.js"></script>
<script src="/js/validator.js"></script>
<script>
layui.use(['gtree', 'request', 'helper', 'layer', 'laydate', 'element', 'xmSelect', 'laytpl', 'validator'], function () {
layui.use(['gtree', 'request', 'helper', 'layer', 'laydate', 'element', 'xmSelect', 'laytpl', 'validator', 'util'], function () {
var tree = layui.gtree
var request = layui.request
var form = layui.form
......@@ -536,6 +543,7 @@
var $ = layui.$
var validator = layui.validator
var helper = layui.helper
var util = layui.util
var element = layui.element
var editData = {}
var treeObj = null
......@@ -855,8 +863,28 @@
})
// merchantForm.businessScopeCustomize = tempList.join(',')
// params.businessScopeCustomize = tempList.join(',')
if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
// if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
// params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
if (treeObj) {
let getCheckedNodes = treeObj.getCheckedNodes(true)
const getCheckedKeys = treeObj.getCheckedNodes(true).map(item => item.id)
console.log(getCheckedKeys)
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
merchantForm.merchantBrandList = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
console.log(merchantForm.merchantBrandList)
params.merchantBrandListJson = JSON.stringify(merchantForm.merchantBrandList)
}
if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
......@@ -997,6 +1025,19 @@
}
}
var checkAll = false
var checkCarBrand = $('#checkCarBrand')
// 主营品牌全选
checkCarBrand.on('click', function() {
checkAll = !checkAll
treeObj.checkAllNodes(checkAll)
if (checkAll) {
checkCarBrand.html('全不选')
} else {
checkCarBrand.html('全选')
}
})
$('.layui-btn').on('click', function () {
var type = $(this).data('type')
if (btnHandle[type]) {
......@@ -1284,9 +1325,7 @@
// 品牌
function getCarBrandTree() {
var params = {
// method: 'merchants.api.merchantCommon.getCarbrandTree'
method: 'dj.api.get.car.brandList',
needCarSeries: true
method: 'merchants.api.merchantCommon.getCarbrandTree'
}
request(params, function (res) {
baseData.carBrandTreeList = res.data
......@@ -1294,7 +1333,8 @@
$('#carBrandTree').removeClass('hide')
var checkedList = []
if (editLevel == 3 && merchantForm.merchantBrandMain) {
checkedList = merchantForm.merchantBrandMain.split(',')
// checkedList = merchantForm.merchantBrandMain.split(',')
checkedList = merchantForm.merchantBrandMain.replaceAll(';',',').split(',')
$.each(checkedList, function (index, item) {
checkedList[index] = parseInt(item)
})
......@@ -1310,7 +1350,7 @@
} else {
$('#noCarbrand').removeClass('hide')
}
}, { isDjUrl: true })
})
}
// 获取字典数据
function getDictData(dictType, fn) {
......
......@@ -217,6 +217,12 @@
align-items: center;
justify-content: center;
}
.check-carbrand {
position: absolute;
left: 340px;
top: 0;
}
</style>
<title>商户编辑</title>
</head>
......@@ -456,8 +462,9 @@
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">主营品牌:</label>
<div class="layui-input-inline">
<div class="layui-input-inline" style="position: relative;">
<input class="layui-input" placeholder="车型品牌" id="brand" />
<button id="checkCarBrand" type="button" class="layui-btn btn-no-border check-carbrand">全选</button>
<div id="carBrandTree" class="hide" style="height: 200px; overflow-y: scroll"></div>
<div id="noCarbrand" class="no-car hide">暂无数据</div>
</div>
......@@ -840,8 +847,28 @@
})
// merchantForm.businessScopeCustomize = tempList.join(',')
// params.businessScopeCustomize = tempList.join(',')
if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
// if (treeObj) merchantForm.merchantBrandMain = treeObj.getCheckedNodes(true)
// params.merchantBrandMain = findId(merchantForm.merchantBrandMain).join(',')
if (treeObj) {
let getCheckedNodes = treeObj.getCheckedNodes(true)
const getCheckedKeys = treeObj.getCheckedNodes(true).map(item => item.id)
console.log(getCheckedKeys)
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
merchantForm.merchantBrandList = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
console.log(merchantForm.merchantBrandList)
params.merchantBrandListJson = JSON.stringify(merchantForm.merchantBrandList)
}
if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
......@@ -956,6 +983,19 @@
}
}
var checkAll = false
var checkCarBrand = $('#checkCarBrand')
// 主营品牌全选
checkCarBrand.on('click', function() {
checkAll = !checkAll
treeObj.checkAllNodes(checkAll)
if (checkAll) {
checkCarBrand.html('全不选')
} else {
checkCarBrand.html('全选')
}
})
// tab 点击事件
$('#functional').on('click', function () {
$('#basic').attr('lay-id')
......@@ -1285,9 +1325,9 @@
// 品牌
function getCarBrandTree() {
var params = {
// method: 'merchants.api.merchantCommon.getCarbrandTree'
method: 'dj.api.get.car.brandList',
needCarSeries: true
method: 'merchants.api.merchantCommon.getCarbrandTree'
// method: 'dj.api.get.car.brandList',
// needCarSeries: true
}
request(params, function (res) {
baseData.carBrandTreeList = res.data
......@@ -1295,7 +1335,8 @@
$('#carBrandTree').removeClass('hide')
var checkedList = []
if (editLevel == 3 && merchantForm.merchantBrandMain) {
checkedList = merchantForm.merchantBrandMain.split(',')
// checkedList = merchantForm.merchantBrandMain.split(',')
checkedList = merchantForm.merchantBrandMain.replaceAll(';',',').split(',')
$.each(checkedList, function (index, item) {
checkedList[index] = parseInt(item)
})
......@@ -1311,7 +1352,7 @@
} else {
$('#noCarbrand').removeClass('hide')
}
}, { isDjUrl: true })
})
}
// 获取字典数据
function getDictData(dictType, fn) {
......
......@@ -38,7 +38,6 @@ function loadHeaderFooter() {
layui.use(['store'], function () {
var isExternal = isAppend()
var store = layui.store
console.log(qs('sessionId'))
if (isExternal) { //运营平台外部系统
append()
} else {//嵌入运营平台 或者是登录页面
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!