| | |
| | | }); |
| | | |
| | | /* 表格搜索 */ |
| | | form.on('submit(docTypeTable)', function (data) { |
| | | insTb.reload({where: data.field}); |
| | | form.on('submit(docTypeTableSearch)', function (data) { |
| | | insTb.reload({where: {doc_name: data.field.docName}}); |
| | | return false; |
| | | }); |
| | | |
| | |
| | | admin.open({ |
| | | type: 1, |
| | | title: (mData ? '修改' : '添加') + '字典', |
| | | content: $('#dictEditDialog').html(), |
| | | content: $('#docTypeEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显表单数据 |
| | | form.val('dictEditForm', mData); |
| | | form.val('docTypeEditForm', mData); |
| | | // 表单提交事件 |
| | | form.on('submit(dictEditSubmit)', function (data) { |
| | | form.on('submit(docTypeEditSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | if (obj) { |
| | | obj.update(data.field); |
| | | } else { |
| | | $.ajax({ |
| | | url: baseUrl+"/docType/"+(mData?'update':'add')+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | return false; |
| | | }); |
| | | } |
| | |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.get('../../json/ok.json', { |
| | | id: obj.data.dictId, |
| | | }, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | obj.del(); |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | $.ajax({ |
| | | url: baseUrl+"/docType/delete/one/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {param: JSON.stringify(obj.data)}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.closeAll(); |
| | | insTb.reload(); |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | }); |
| | | } |
| | | |