vr-shopxo-source/public/static/admin/default/js/power.js

62 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-07-21 15:51:47 +00:00
$(function()
2018-12-28 10:58:37 +00:00
{
2019-07-21 15:51:47 +00:00
/**
* 展开/关闭
*/
2022-01-23 10:30:56 +00:00
$('.tree-list i.stretch').on('click', function()
2018-12-28 10:58:37 +00:00
{
2019-07-21 15:51:47 +00:00
if($(this).hasClass('am-icon-plus'))
{
$(this).removeClass('am-icon-plus');
$(this).addClass('am-icon-minus-square');
} else {
$(this).removeClass('am-icon-minus-square');
$(this).addClass('am-icon-plus');
}
2022-01-23 10:30:56 +00:00
$(this).parents('li').next('ul.list-find').toggle(100);
2019-07-21 15:51:47 +00:00
});
2018-12-28 10:58:37 +00:00
2019-07-21 15:51:47 +00:00
/**
* 添加
*/
$('.submit-add').on('click', function()
{
2022-01-23 10:30:56 +00:00
// 移除菜单禁止状态
$('form select[name="pid"]').removeAttr('disabled');
2018-12-28 10:58:37 +00:00
2019-07-21 15:51:47 +00:00
// 清空表单
FormDataFill({"id":"", "pid":0, "name":"", "control":"", "action":"", "icon":"", "sort":0, "is_show":1});
2018-12-28 10:58:37 +00:00
2019-07-21 15:51:47 +00:00
// 校验成功状态增加失去焦点
$('form').find('.am-field-valid').each(function()
{
$(this).blur();
});
2022-01-23 10:30:56 +00:00
// 更改窗口名称
var $popup = $('#power-save-win');
$title = $popup.find('.am-popup-title');
$title.text($title.data('add-title'));
$popup.modal('open');
2018-12-28 10:58:37 +00:00
});
2019-07-21 15:51:47 +00:00
/**
* 编辑
*/
$('.submit-edit').on('click', function()
2018-12-28 10:58:37 +00:00
{
2019-07-21 15:51:47 +00:00
// 更改窗口名称
2022-01-23 10:30:56 +00:00
var $popup = $('#power-save-win');
$title = $popup.find('.am-popup-title');
2019-07-21 15:51:47 +00:00
$title.text($title.data('edit-title'));
// 父级禁用菜单列表选择
if($(this).data('item') == 'ok')
{
$('form select[name="pid"]').attr('disabled', 'disabled');
} else {
$('form select[name="pid"]').removeAttr('disabled');
}
2022-01-23 10:30:56 +00:00
$popup.modal('open');
2019-07-21 15:51:47 +00:00
});
2018-12-28 10:58:37 +00:00
});