记得上下班打卡 | git大法好,push需谨慎

Commit 95e0f7df authored by dongchun's avatar dongchun

修改创建分类下拉显示问题

parent c61721f6
...@@ -121,7 +121,17 @@ ...@@ -121,7 +121,17 @@
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div> </div>
<div id="addClassify"> <div id="addClassify">
<div class="selectClassify">
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
var rmvFlg = [[${@permission.hasPermi('goblin:category:rmv')}]];
var prefix = ctx + "goblin/category";
let rowId = '';
let modalDom = `<div class="selectClassify">
<span>分类选择:</span> <span>分类选择:</span>
<label> <label>
<input type="radio" checked value="1" id="optionsRadios1" name="optionsRadios"><span>一级</span></label> <input type="radio" checked value="1" id="optionsRadios1" name="optionsRadios"><span>一级</span></label>
...@@ -135,6 +145,7 @@ ...@@ -135,6 +145,7 @@
<span>一级分类:</span> <span>一级分类:</span>
<input class="form-control" id="firstTypeIpt" type="text"> <input class="form-control" id="firstTypeIpt" type="text">
<select class="form-control" name="tagType" id="firstTypeSelect" style="display: none;"> <select class="form-control" name="tagType" id="firstTypeSelect" style="display: none;">
<option value="">全部</option>
</select> </select>
</div> </div>
<div class="selectClassifyOne selectClassifyOne2" style="display: none;"> <div class="selectClassifyOne selectClassifyOne2" style="display: none;">
...@@ -161,16 +172,7 @@ ...@@ -161,16 +172,7 @@
<div class="bottomBtn"> <div class="bottomBtn">
<a src="javascript:;" class="layui-layer-btn0 paddings" onclick="yes(1,2)">确定</a> <a src="javascript:;" class="layui-layer-btn0 paddings" onclick="yes(1,2)">确定</a>
<a class="layui-layer-btn1 layui-layer-btn1" onclick="closeModal()">取消</a> <a class="layui-layer-btn1 layui-layer-btn1" onclick="closeModal()">取消</a>
</div> </div>`
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
var rmvFlg = [[${@permission.hasPermi('goblin:category:rmv')}]];
var prefix = ctx + "goblin/category";
let rowId = '';
$(function () { $(function () {
$("#fileinput").fileinput({ $("#fileinput").fileinput({
'theme': 'explorer-fas', 'theme': 'explorer-fas',
...@@ -225,6 +227,65 @@ ...@@ -225,6 +227,65 @@
$.table.init(options); $.table.init(options);
}); });
$("#button-open-10").click(function(){ $("#button-open-10").click(function(){
$('#addClassify').append(modalDom)
$("#fileinput").fileinput({
'theme': 'explorer-fas',
'uploadUrl': 'https://devplatform.zhengzai.tv/platform/basicServices/alOss/upload',
"uploadExtraData": {
"pathName" : "banner",
"buckType" : 1
},
autoReplace: true,
showCaption: false,
showPreview: false,
showRemove: false,
showUpload: false,
showCancel: false,
showClose: false,
autoReplace: true,
dropZoneTitle: "请上传文件",
maxFileCount: 1
}).on("filebatchselected", function (event, files) { //默认上传
$(this).fileinput("upload");
})
.on("fileuploaded", function (event, data) { //上传回调事件
showPicture = 'https://img.zhengzai.tv/' + data.response.data.ossPath;
$("#viewImg").attr('src', showPicture)
})
$("input[name=optionsRadios]").on('change', function (e) {
console.log(e.target.value)
let num = e.target.value;
$("#typeValue").val(num);
if (num == 1) {
$(".selectClassifyOne2").hide();
$(".selectClassifyOne3").hide();
$(".selectClassifyOne").show();
$("#firstTypeSelect").hide();
$("#firstTypeIpt").show();
} else if (num == 2) {
$(".selectClassifyOne2").show();
$("#secondTypeSelect").hide();
$("#secondTypeIpt").show();
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne3").hide();
filterSelect ('', 2)
} else {
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne2").show();
$("#secondTypeSelect").show();
$("#secondTypeIpt").hide();
$(".selectClassifyOne3").show();
filterSelect ('', 2)
}
})
$("#firstTypeSelect").on('change', function (e) {
console.log(e)
filterSelect (e.target.value, 3)
})
layer.open({ layer.open({
type: 1, type: 1,
shade: true, shade: true,
...@@ -237,10 +298,7 @@ ...@@ -237,10 +298,7 @@
} }
}); });
}) })
$("#firstTypeSelect").on('change', function (e) {
console.log(e)
filterSelect (e.target.value, 3)
})
// function onCheck (row, $element) { // function onCheck (row, $element) {
// console.log(row, $element) // console.log(row, $element)
// rowId = row.fcateId; // rowId = row.fcateId;
...@@ -272,46 +330,28 @@ ...@@ -272,46 +330,28 @@
success: function (res) { success: function (res) {
console.log(res, 'res') console.log(res, 'res')
$("pull-right button[type=refresh]").click(); $("pull-right button[type=refresh]").click();
closeModal () closeModal ();
} }
}) })
} }
function closeModal () { function closeModal () {
$("#addClassify").empty() $("#addClassify").empty()
// $("#firstTypeIpt").val('');
// $("#secondTypeIpt").val('');
// $("#threeIpt").val('');
// $("#threeIpt").attr('src', '');
// $("#firstTypeSelect").empty().append('<option value="">全部</option>')
// $("#secondTypeSelect").empty().append('<option value="">全部</option>')
// $("input[name=optionsRadios value=1]").attr('checked')
$(".layui-layer-close1").click(); $(".layui-layer-close1").click();
} }
$("input[name=optionsRadios]").on('change', function (e) {
console.log(e.target.value) // $("input[name=optionsRadios]").on('change', function (e) {
let num = e.target.value;
$("#typeValue").val(num); // })
if (num == 1) {
$(".selectClassifyOne2").hide();
$(".selectClassifyOne3").hide();
$(".selectClassifyOne").show();
$("#firstTypeSelect").hide();
$("#firstTypeIpt").show();
} else if (num == 2) {
$(".selectClassifyOne2").show();
$("#secondTypeSelect").hide();
$("#secondTypeIpt").show();
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne3").hide();
filterSelect ('', 2)
} else {
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne2").show();
$("#secondTypeSelect").show();
$("#secondTypeIpt").hide();
$(".selectClassifyOne3").show();
filterSelect ('', 2)
}
})
function filterSelect (parentsId, num) { function filterSelect (parentsId, num) {
console.log('这个没触发')
let data = { let data = {
cateId: parentsId, cateId: parentsId,
grade: num - 1 grade: num - 1
...@@ -329,9 +369,11 @@ ...@@ -329,9 +369,11 @@
str += `<option value="${item.cateId}">${item.name}</option>` str += `<option value="${item.cateId}">${item.name}</option>`
}) })
if (!parentsId) { if (!parentsId) {
$("#firstTypeSelect").html(str); $("#firstTypeSelect").empty().append('<option value="">全部</option>');
$("#firstTypeSelect").append(str);
} else { } else {
$("#secondTypeSelect").html(str); $("#secondTypeSelect").empty().append('<option value="">全部</option>');
$("#secondTypeSelect").append(str);
} }
} }
}) })
......
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 to comment