Commit f38ee04e by cwq0219

数据恢复

1 parent c37b9679
...@@ -179,8 +179,7 @@ ...@@ -179,8 +179,7 @@
<label class="layui-form-label"></label> <label class="layui-form-label"></label>
<div> <div>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input class="layui-input business-scope-cust" name="businessScopeCustomize" <input id="scopeCus" class="layui-input business-scope-cust" placeholder="请自定义营业范围,建议不超过10个">
placeholder="请自定义营业范围,建议不超过10个">
</div> </div>
<div class="layui-input-inline"> <div class="layui-input-inline">
<button type="button" class="layui-btn layui-btn-primary btn-no-border" data-type="handleAddScope"> <button type="button" class="layui-btn layui-btn-primary btn-no-border" data-type="handleAddScope">
...@@ -281,7 +280,6 @@ ...@@ -281,7 +280,6 @@
var $ = layui.$ var $ = layui.$
var helper = layui.helper var helper = layui.helper
var editData = {} var editData = {}
var scopeIdx = 1
var treeObj = null var treeObj = null
var all_nodes = [] var all_nodes = []
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
...@@ -433,7 +431,7 @@ ...@@ -433,7 +431,7 @@
} else { } else {
params.status = 1 params.status = 1
} }
// console.log(merchantForm) console.log(editLevel)
console.log(params) console.log(params)
request(params, function (res) { request(params, function (res) {
console.log(res) console.log(res)
...@@ -495,14 +493,13 @@ ...@@ -495,14 +493,13 @@
}) })
}, },
// 添加范围 // 添加范围
handleAddScope() { handleAddScope(txt) {
scopeIdx = scopeIdx + 1
var parent = $('#custom-scope') var parent = $('#custom-scope')
var subParent = $('<div class="layui-form-item"><label class="layui-form-label"></label></div>') var subParent = $('<div class="layui-form-item"><label class="layui-form-label"></label></div>')
var child1 = $( var child1 = $(
'<div class="layui-input-inline"><input class="layui-input business-scope-cust" name="businessScopeCustomize' + '<div class="layui-input-inline"></div>'
scopeIdx + '" placeholder="请自定义营业范围,建议不超过10个"></div>'
) )
var inputEl = $('<input class="layui-input business-scope-cust" placeholder="请自定义营业范围,建议不超过10个">')
var child2 = $( var child2 = $(
'<div class="layui-input-inline"></div>' '<div class="layui-input-inline"></div>'
) )
...@@ -513,6 +510,9 @@ ...@@ -513,6 +510,9 @@
var deleteBtn = $( var deleteBtn = $(
'<button type="button" class="layui-btn layui-btn-primary btn-no-border"><i class="layui-icon layui-icon-reduce-circle"></i></button>' '<button type="button" class="layui-btn layui-btn-primary btn-no-border"><i class="layui-icon layui-icon-reduce-circle"></i></button>'
) )
if (txt) {
inputEl.val(txt)
}
addBtn.bind('click', function (e) { addBtn.bind('click', function (e) {
btnHandle.handleAddScope() btnHandle.handleAddScope()
}) })
...@@ -520,6 +520,7 @@ ...@@ -520,6 +520,7 @@
var el = $(this).parent().parent() var el = $(this).parent().parent()
el.remove() el.remove()
}) })
child1.append(inputEl)
child2.append(addBtn) child2.append(addBtn)
child2.append(deleteBtn) child2.append(deleteBtn)
subParent.append(child1) subParent.append(child1)
...@@ -588,18 +589,20 @@ ...@@ -588,18 +589,20 @@
getPeriod() getPeriod()
bindEvent() bindEvent()
} }
function bindEvent(){
$('#brand').on('input',helper.debounce(function(){ function bindEvent() {
$('#brand').on('input', helper.debounce(function () {
var txt = $(this).val() var txt = $(this).val()
if(!txt){ if (!txt) {
treeObj.showNodes(all_nodes) treeObj.showNodes(all_nodes)
}else{ } else {
var show_nodes = treeObj.getNodesByParamFuzzy('label',txt) var show_nodes = treeObj.getNodesByParamFuzzy('label', txt)
treeObj.hideNodes(all_nodes) treeObj.hideNodes(all_nodes)
treeObj.showNodes(show_nodes) treeObj.showNodes(show_nodes)
} }
},500)) }, 500))
} }
function setCheckbox(checkedStr, attr) { function setCheckbox(checkedStr, attr) {
if (!checkedStr || !checkedStr.length) { if (!checkedStr || !checkedStr.length) {
return false return false
...@@ -610,7 +613,7 @@ ...@@ -610,7 +613,7 @@
} else { } else {
list = checkedStr.split(',') list = checkedStr.split(',')
} }
console.log(list) // console.log(list)
$.each(list, function (index, item) { $.each(list, function (index, item) {
$('input[class=' + attr + ']').attr("checked", true) $('input[class=' + attr + ']').attr("checked", true)
}) })
...@@ -628,6 +631,8 @@ ...@@ -628,6 +631,8 @@
getBusiScope() getBusiScope()
getCarBrandTree() getCarBrandTree()
getAccountType() getAccountType()
recoveryBusiScopeCus()
recoveryFile()
}) })
} }
...@@ -644,24 +649,17 @@ ...@@ -644,24 +649,17 @@
request({ request({
method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree' method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}, function (res) { }, function (res) {
// console.log(res.data)
baseData.carBrandTreeList = res.data baseData.carBrandTreeList = res.data
treeObj = tree.create('carBrandTree', res.data)
all_nodes = treeObj.getNodes()
var checkedList = [] var checkedList = []
if (editLevel == 3) { if (editLevel == 3 && merchantForm.merchantBrand) {
checkedList = merchantForm.merchantBrand.split(',') checkedList = merchantForm.merchantBrand.split(',')
$.each(checkedList, function (index, item) {
checkedList[index] = parseInt(item)
})
} }
treeObj = tree.create('carBrandTree', res.data, { treeObj = tree.create('carBrandTree', res.data, {
checkedList: checkedList checkedList: checkedList
}) })
// 修改-回显
// if (editLevel == 3) {
// checkedList = merchantForm.merchantBrand.split(',')
// for (var i = 0; i <= checkedList.length; i++) {
// treeObj.checkNode(treeObj.getNodeByParam("id", checkedList[i]), true)
// }
// }
}) })
} }
// 获取字典数据 // 获取字典数据
...@@ -709,7 +707,7 @@ ...@@ -709,7 +707,7 @@
getDictData('business_scope', function (res) { getDictData('business_scope', function (res) {
baseData.busiScopeList = res.data baseData.busiScopeList = res.data
var checkedList = [] var checkedList = []
if (editLevel == 3) { if (editLevel == 3 && merchantForm.businessScope) {
checkedList = merchantForm.businessScope.split(',') checkedList = merchantForm.businessScope.split(',')
} }
var el = $('#busiScopeEl') var el = $('#busiScopeEl')
...@@ -732,13 +730,48 @@ ...@@ -732,13 +730,48 @@
}) })
} }
// 恢复自定义营业范围
function recoveryBusiScopeCus() {
// console.log(merchantForm.businessScopeCustomize)
if (merchantForm.businessScopeCustomize) {
var scopeCusList = merchantForm.businessScopeCustomize.split(',')
$.each(scopeCusList, function (index, item) {
if (index != 0) {
btnHandle.handleAddScope(item)
} else {
$('#scopeCus').val(item)
}
})
}
}
// 恢复图片
function recoveryFile() {
console.log(merchantForm.merchantFileResponses)
merchantForm.merchantFiles = []
$.each(merchantForm.merchantFileResponses, function (index, item) {
var imgEl = $('#img' + index)
var el = $('#upload' + index)
var addEl = $('.img-add' + index)
merchantForm.merchantFiles[index] = {
fileUrl: item.fileUrl,
fileName: item.fileName
}
imgEl.attr('src', item.fileUrl)
imgEl.removeClass('hide')
imgEl.addClass('show')
addEl.removeClass('show')
addEl.addClass('hide')
})
}
// 账户类型 // 账户类型
function getAccountType() { function getAccountType() {
getDictData('account_type', function (res) { getDictData('account_type', function (res) {
// console.log(res.data) // console.log(res.data)
baseData.accountTypeList = res.data baseData.accountTypeList = res.data
var checkedList = [] var checkedList = []
if (editLevel == 3) { if (editLevel == 3 && merchantForm.accountType) {
checkedList = merchantForm.accountType.split(',') checkedList = merchantForm.accountType.split(',')
} }
var el = $('#accountTypeEl') var el = $('#accountTypeEl')
......
...@@ -436,8 +436,7 @@ ...@@ -436,8 +436,7 @@
function init() { function init() {
// 运营系统 // 运营系统
// if (!isDxternal) { if (!isDxternal) {
if (isDxternal) {
getChannel() getChannel()
getAccountLevel() getAccountLevel()
getAccountType() getAccountType()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!