app/views/educode_sales/businesses/edit.html.erb in educode_sales-1.10.8 vs app/views/educode_sales/businesses/edit.html.erb in educode_sales-1.10.9

- old
+ new

@@ -66,38 +66,42 @@ request = layui.request, xmSelect = layui.xmSelect, $ = layui.$; selectInput = layui.selectInput; - var levels_select = xmSelect.render({ - el: '#levels', - name: 'level_ids', - data: gon.levels, - on: function(data) { - var is_secret = false; - data.arr.forEach(function(i) { - if (i.name == '战略型' || i.name == '保密型') { - is_secret = true; + if ($("#levels").length > 0) { + var levels_select = xmSelect.render({ + el: '#levels', + name: 'level_ids', + data: gon.levels, + on: function(data) { + var is_secret = false; + data.arr.forEach(function(i) { + if (i.name == '战略型' || i.name == '保密型') { + is_secret = true; + } + }) + if (is_secret) { + $("#watch_ids_wraper").removeClass('layui-hide') + } else { + $("#watch_ids_wraper").addClass('layui-hide') } - }) - if (is_secret) { - $("#watch_ids_wraper").removeClass('layui-hide') - } else { - $("#watch_ids_wraper").addClass('layui-hide') } + }) + } + if ($("#watch_ids").length > 0) { + var watch_id_select = xmSelect.render({ + el: '#watch_ids', + name: 'watch_ids', + data: gon.watche_ids, + filterable: true, + }) + if (gon.is_secret) { + $("#watch_ids_wraper").removeClass("layui-hide") } - }) - - var watch_id_select = xmSelect.render({ - el: '#watch_ids', - name: 'watch_ids', - data: gon.watche_ids, - filterable: true, - }) - if (gon.is_secret) { - $("#watch_ids_wraper").removeClass("layui-hide") } + var source_way = gon.source_way; form.on('select(source_id)', function(data){ source_way = data.value; setSourceWay(data.value); $("#" + customer_select._input)[0].value = ""; @@ -160,23 +164,25 @@ return cb(res) }) } }); - - var merge_business_select = xmSelect.render({ - el: '#merge_business', - filterable: true, - name: 'merge_business_ids', - remoteSearch: true, - remoteMethod: function(val, cb, show){ - request.get('missions/businesses/search?id=' + parent.id + "&q=" + val, {}, - function(res) { - cb(res.data) - }) - }, - data: [] - }) + if ($("#merge_business").length > 0) { + var merge_business_select = xmSelect.render({ + el: '#merge_business', + filterable: true, + name: 'merge_business_ids', + remoteSearch: true, + remoteMethod: function(val, cb, show){ + request.get('missions/businesses/search?id=' + parent.id + "&q=" + val, {}, + function(res) { + cb(res.data) + }) + }, + data: [] + }) + } + var sourcable_id = gon.sourcable_id; var customer_select = selectInput.render({ elem: '#customer_id', \ No newline at end of file