Commit f38ee04e by cwq0219

数据恢复

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