e引入文件
<script type="text/javascript" src="{:PUBLICS}js/proTree/js/proTree.js"></script>
html
<div aria-hidden="true" role="dialog" tabindex="-1" id="model_tree" style="z-index: 1051;" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
<h4 class="modal-title">选择项目</h4>
</div>
<section class="panel">
<div class="innerUl ">
</div>
<!-- <div id="tree_content" class=""></div> -->
</section>
</div>
</div>
</div>
Js
_fieldTypes.treeModal= {
create: function(conf) {
conf._enabled = true;
var id = Editor.safeId(conf.id);
conf._input = $('<input id="' + id + '" style="cursor: pointer;" readonly="readonly" type="text" class="form-control" data-id=' + id + '>');
conf._input.click(function() {
$("#modal_tree").modal();
});
return conf._input;
},
get: function(conf) {
return conf._input.val();
},
set: function(conf, val) {
conf._input.val(val);
},
enable: function(conf) {
conf._enabled = true;
},
disable: function(conf) {
conf._enabled = false;
}
};
{
"label": "系列",
"name": "hqq_goods.category_id",
"type": "treeModal"
}
$(document).on('click', '.buttons-create,.buttons-edit', function() {
var category_length = $('.innerUl').html();
var texture_length = $('.Texture_content').html();
if (category_length.length == 29 && texture_length.length == 29) {
var arr;
//加载编辑框内的 分类以及材质
$.ajax({
url: "{:url('hqqGoods/getCategoryList')}",
method: "post",
success: function(e) {
category = e['category'];
texture = e['texture'];
$(".innerUl").ProTree({
arr: category,
close: true,
simIcon: "fa fa-file-o", //单个标题字体图标 不传默认glyphicon-file
mouIconOpen: "fa fa-folder-open-o", //含多个标题的打开字体图标 不传默认glyphicon-folder-open
mouIconClose: "fa fa-folder-o", //含多个标题的关闭的字体图标 不传默认glyphicon-folder-close
callback: function(id, name) {
$.ajax({
url: "{:url('hqqGoods/checkChooseLowest')}",
method: 'POST',
data: {
table: 'hqq_classify',
pid: id
},
success: function(e) {
if (e === 1) {
editor.field("hqq_goods.category_id").val(name);
$("#modal_jModal").modal("hide");
} else alert('点击小图标显示下一级');
}
})
}
})
}
});
}
$(document).on('click', '.enter_user_model', function() {
var value = $('.searchable-select-holder').html();
editor.field("hqq_goods.uid").val(value);
$("#model_User").modal("hide");
});