| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /**
- * 添加修改按钮
- * */
- $(function() {
- autosize($('textarea'));
- var fid = helper.request.queryString("fid");
- var moduleid = helper.request.queryString("moduleid");
- if(fid) {
- getBtnsInfo(fid);
- }
- //添加或编辑保存按钮点击
- $('#save_btns').on('click', saveAccount);
- });
- //获取按钮
- function getBtnsInfo(fid) {
- $.getJSON(huayi.config.callcenter_url + "configurationapi/api/modulebuttoninfo/getmodule", {
- mid: fid,
- }, function(data) {
- //debugger;
- if(data.state == "success") {
- var res = data.data;
- $('#btnTitle').val(res.name);
- $('#btnNum').val(res.code);
- //$('#btnEvent').val(res.jsevent);
- //$('#btnIcon').val(res.icon);
- $('#btnUrl').val(res.url);
- $('#btnOrder').val(res.sort);
- $('#btnDecription').val(res.remark);
- $('#btnEnabled').find("input[type='radio'][value= " + res.flag + "]").attr("checked", true);
- }
- });
- }
- //保存按钮
- function saveAccount() {
- var fid = helper.request.queryString("fid");
- var moduleid = helper.request.queryString("moduleid");
- // if(!regexs.proTitle.test($.trim($('#proTitle').val()))) {
- // layer.confirm('请输入有效的标题2-30位(只能输入中文 英文 数字 空格 ,()-+)', {
- // icon: 2,
- // btn: ['确定'] //按钮
- // });
- // return;
- // }
- var wUrl;
- if(fid){
- wUrl = "configurationapi/api/modulebuttoninfo/editmodule";//修改
- }else{
- wUrl = "configurationapi/api/modulebuttoninfo/addModule";//添加
- }
- $.post(huayi.config.callcenter_url + wUrl, {
- id: fid,//为空或null表示需要添加,有数值表示需要更新
- moduleid: moduleid,//菜单id
- name: $('#btnTitle').val(),//
- code: $('#btnNum').val(),//string 编码
- //jsevent: $('#btnEvent').val(),//事件
- url: $('#btnUrl').val(),//后端使用的配置项
- //icon: $('#btnIcon').val(),//图标
- sort: $('#btnOrder').val(),//排序字段默认为1
- flag: $('#btnEnabled').find("input[type='radio']:checked").val(), //表示是否有效 无效0 有效1 删除2
- remark: $('#btnDecription').val(),//备注信息
- }, function(data) {
- var data = JSON.parse(data);
- if(data.state == "success") {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- parent.initTable();
- parent.layer.msg("保存成功");
- }
- });
- }
|