Commit 26db6e8a by 李洋

消息模板分类

parent 9438ddbd
......@@ -16,8 +16,7 @@ class AppServiceProvider extends ServiceProvider
{
//
//sql调试
$sql_debug = config('database.sql_debug');
if ($sql_debug) {
if (config('database.sql_debug')) {
DB::listen(function ($sql) {
foreach ($sql->bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
......@@ -30,7 +29,7 @@ class AppServiceProvider extends ServiceProvider
}
$query = str_replace(array('%', '?'), array('%%', '%s'), $sql->sql);
$query = vsprintf($query, $sql->bindings);
print_r($query);
dd($query);
echo '<br />';
});
}
......
......@@ -6,31 +6,19 @@ layui.use('form', function(){
showOrHide(data.value);
});
// form.on('select(sel_add_classify)', function (data) {
// console.log(data.value);
// });
// form.on('select(sel_edit_classify)', function (data) {
// console.log(data.value);
// });
// form.on('select(sel_edit_sub_classify)', function (data) {
// console.log(data.value);
// });
//监听模板分类选择 并刷新二级分类数据
form.on('select(sel_edit_classify_2nd)', function(data){
var sel_msg_tpl_cls = data.value;
form.on('select(sel_edit_classify)', function(data){
var sel_edit_cls = data.value;
$.ajax({
url: "/msgapi/getSubTplCls",
dataType: 'json',
data: {
sel_msg_tpl_cls: sel_msg_tpl_cls
sel_edit_cls: sel_edit_cls
},
success: function (result) {
var optionstring = '';
$.each(result.data, function(i,item){
optionstring += "<option value=" + item.sub_cls_id + ">" + item.sub_cls_name + "</option>";
optionstring += "<option value=" + item.cls_id + ">" + item.name + "</option>";
});
$("#sel_edit_sub_classify").html('<option value=""></option>' + optionstring);
form.render('select');
......@@ -49,14 +37,10 @@ layui.use('form', function(){
function showOrHide(type){
if ('1'===type){
$('#add_classify_div').show();
$('#add_sub_classify_div').show();
$('#edit_classify_div').hide();
$('#edit_sub_classify_div').hide();
}else{
$('#add_classify_div').hide();
$('#add_sub_classify_div').hide();
$('#edit_classify_div').show();
$('#edit_sub_classify_div').show();
}
}
......
......@@ -5,20 +5,20 @@ layui.use(['jquery','element', 'layer', 'form'], function(){
var form = layui.form;
//监听模板分类选择 并刷新二级分类数据
form.on('select(msg_tpl_cls)', function(data){
var sel_msg_tpl_cls = data.value;
form.on('select(msg_cls)', function(data){
var sel_edit_cls = data.value;
$.ajax({
url: "/msgapi/getSubTplCls",
dataType: 'json',
data: {
sel_msg_tpl_cls: sel_msg_tpl_cls
sel_edit_cls: sel_edit_cls
},
success: function (result) {
var optionstring = "";
$.each(result.data, function(i,item){
optionstring += "<option value=" + item.sub_cls_id + ">" + item.sub_cls_name + "</option>";
optionstring += "<option value=" + item.cls_id + ">" + item.name + "</option>";
});
$("#msg_tpl_sub_cls").html('<option value=""></option>' + optionstring);
$("#msg_sub_cls").html('<option value=""></option>' + optionstring);
form.render('select');
}
});
......@@ -142,8 +142,8 @@ function addTemplate()
tpl_id:$('#tpl-id').val(),
channels:getChosenMsgChannels(),
msg_type:$('#inner-tpl-type option:selected').val(),
cls_id:$('#msg_tpl_cls option:selected').val(),
sub_cls_id:$('#msg_tpl_sub_cls option:selected').val(),
// cls_id:$('#msg_cls option:selected').val(),
sub_cls_id:$('#msg_sub_cls option:selected').val(),
source_type:1,
creater:$('#creater').val(),
tpl_key:$('#msg-tpl-desc1').val(),
......
......@@ -53,20 +53,20 @@ layui.use(['laydate','form','table'], function(){
});
//监听模板分类选择 并刷新二级分类数据
form.on('select(msg_tpl_cls)', function(data){
var sel_msg_tpl_cls = data.value;
form.on('select(msg_cls)', function(data){
var sel_edit_cls = data.value;
$.ajax({
url: "/msgapi/getSubTplCls",
dataType: 'json',
data: {
sel_msg_tpl_cls: sel_msg_tpl_cls
sel_edit_cls: sel_edit_cls
},
success: function (result) {
var optionstring = "";
$.each(result.data, function(i,item){
optionstring += "<option value=" + item.sub_cls_id + ">" + item.sub_cls_name + "</option>";
optionstring += "<option value=" + item.cls_id + ">" + item.name + "</option>";
});
$("#msg_tpl_sub_cls").html('<option value=""></option>' + optionstring);
$("#msg_sub_cls").html('<option value=""></option>' + optionstring);
form.render('select');
}
});
......
......@@ -6,20 +6,20 @@ layui.use(['jquery','element', 'layer', 'form','table','laypage','laydate'], fun
var table = layui.table;
//监听模板分类选择 并刷新二级分类数据
form.on('select(msg_tpl_cls)', function(data){
var sel_msg_tpl_cls = data.value;
form.on('select(msg_cls)', function(data){
var sel_edit_cls = data.value;
$.ajax({
url: "/msgapi/getSubTplCls",
dataType: 'json',
data: {
sel_msg_tpl_cls: sel_msg_tpl_cls
sel_edit_cls: sel_edit_cls
},
success: function (result) {
var optionstring = "";
$.each(result.data, function(i,item){
optionstring += "<option value=" + item.sub_cls_id + ">" + item.sub_cls_name + "</option>";
optionstring += "<option value=" + item.cls_id + ">" + item.name + "</option>";
});
$("#msg_tpl_sub_cls").html('<option value=""></option>' + optionstring);
$("#msg_sub_cls").html('<option value=""></option>' + optionstring);
form.render('select');
}
});
......
......@@ -2,9 +2,6 @@
label{
box-sizing:content-box;
}
.number-input{
width:60px;
}
.top-20{
margin-top: 30px;
}
......@@ -22,14 +19,6 @@
<div class="layui-form-item top-20" id="add_classify_div">
<label class="layui-form-label" >添加分类:</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="add_classify" id="add_classify" placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item top-20" id="add_sub_classify_div">
<label class="layui-form-label" >添加子分类:</label>
<div class="layui-input-inline" style="width: 150px">
<select name="sel_add_classify" lay-filter="sel_add_classify" id="sel_add_classify" >
<option value="">请选择一级分类</option>
......@@ -42,36 +31,15 @@
</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="add_sub_classify" id="add_sub_classify" placeholder="请输入子分类名称" autocomplete="off" class="layui-input">
<input type="text" name="add_classify" id="add_classify" placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item top-20" id="edit_classify_div" hidden>
<label class="layui-form-label" >编辑分类:</label>
<div class="layui-input-inline" style="width: 150px">
<select name="sel_edit_classify_1st" lay-filter="sel_edit_classify_1st" id="sel_edit_classify_1st" >
<option value="">请选择一级分类</option>
@if(!empty($info))
@foreach($info as $k=>$v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
@endif
</select>
</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="edit_classify" id="edit_classify" placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item top-20" id="edit_sub_classify_div" hidden>
<label class="layui-form-label" >编辑子分类:</label>
<div class="layui-input-inline" style="width: 150px">
<select name="sel_edit_classify_2nd" lay-filter="sel_edit_classify_2nd" id="sel_edit_classify_2nd" >
<select name="sel_edit_classify" lay-filter="sel_edit_classify" id="sel_edit_classify" >
<option value="">请选择一级分类</option>
@if(!empty($info))
@foreach($info as $k=>$v)
......@@ -88,7 +56,7 @@
</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="edit_sub_classify" id="edit_sub_classify" placeholder="请输入子分类名称" autocomplete="off" class="layui-input">
<input type="text" name="edit_classify" id="edit_classify" placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
......
......@@ -117,10 +117,10 @@
<div class="layui-form-item" style="margin-top: 30px;">
<label class="layui-form-label title-width">消息模板分类:</label>
<div class="layui-input-inline" style="width: 200px;">
<select name="msg_tpl_cls" lay-filter="msg_tpl_cls" id="msg_tpl_cls">
<select name="msg_cls" lay-filter="msg_cls" id="msg_cls">
<option value="" selected="">请选择</option>
@foreach($msg_tpl_clses as $key=>$value)
<option value="{{$key}}" @if(!empty($info->cls_id) && $key==$info->cls_id) selected @endif>{{$value}}</option>
<option value="{{$key}}" @if(!empty($info->parent_id) && $key==$info->parent_id) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
......@@ -129,10 +129,10 @@
<div class="layui-form-item" style="margin-top: 30px;">
<label class="layui-form-label title-width">消息模板二级分类:</label>
<div class="layui-input-inline" style="width: 200px;">
<select name="msg_tpl_sub_cls" lay-filter="msg_tpl_sub_cls" id="msg_tpl_sub_cls">
<select name="msg_sub_cls" lay-filter="msg_sub_cls" id="msg_sub_cls">
<option value="" selected="">请选择</option>
@foreach($msg_tpl_sub_clses as $key=>$value)
<option value="{{$key}}" @if(!empty($info->sub_cls_id) && $key==$info->sub_cls_id) selected @endif>{{$value}}</option>
<option value="{{$key}}" @if(!empty($info->cls_id) && $key==$info->cls_id) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
......
......@@ -72,7 +72,7 @@
<label class="layui-form-label filter-label-left first-label">消息模板分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_cls" lay-filter="msg_tpl_cls" id="msg_tpl_cls">
<select name="msg_cls" lay-filter="msg_cls" id="msg_cls">
<option value="">请选择</option>
@foreach($clses as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
......@@ -82,7 +82,7 @@
<label class="layui-form-label filter-label-left first-label">消息模板二级分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_sub_cls" lay-filter="msg_tpl_sub_cls" id="msg_tpl_sub_cls">
<select name="msg_sub_cls" lay-filter="msg_sub_cls" id="msg_sub_cls">
<option value="">请选择</option>
</select>
</div>
......
......@@ -40,7 +40,7 @@
<label class="layui-form-label filter-label-left">消息模板分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_cls" lay-filter="msg_tpl_cls" id="msg_tpl_cls">
<select name="msg_cls" lay-filter="msg_cls" id="msg_cls">
<option value="">请选择</option>
@foreach($clses as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
......@@ -50,7 +50,7 @@
<label class="layui-form-label filter-label-left">消息模板二级分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_sub_cls" lay-filter="msg_tpl_sub_cls" id="msg_tpl_sub_cls">
<select name="msg_sub_cls" lay-filter="msg_sub_cls" id="msg_sub_cls">
<option value="">请选择</option>
</select>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment