123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <div id="authUser" class="plg-tab-container">
- <div id="authUser-grid-1" class="grid-container-full"></div>
- </div>
- <script type="text/javascript">
- (function () {
- // cSpell:ignore layui api authmgr augrid microservice multiselect newcolumn prologui fdata cindex layero
- var BASE_URL = '/api/service-authorization/';
- var opts = {
- skin: "terrace",
- columns: [{
- id: "id",
- name: "id",
- type: 'txt',
- width: "50",
- hidden: true
- },
- {
- id: "clientId",
- name: "客户端",
- type: 'txt',
- width: "200"
- },
- // {
- // id: "clientSecret",
- // name: "密码",
- // type: 'txt',
- // width: "200"
- // },
- {
- id: "resourceIds",
- name: "资源",
- type: 'txt',
- width: "*"
- }
- ],
- multiselect: true,
- toolbar: [{
- type: "button",
- name: "deleteBtn",
- className: "danger plg-toolbar-right",
- value: "<i class='layui-icon layui-icon-delete'></i>删除"
- }, {
- type: "newcolumn"
- },
- {
- type: "button",
- name: "updateBtn",
- className: "normal plg-toolbar-right",
- value: "<i class='layui-icon layui-icon-edit'></i>修改"
- }, {
- type: "newcolumn"
- },
- {
- type: "button",
- name: "addBtn",
- className: "plg-toolbar-right",
- value: "<i class='layui-icon layui-icon-add-1'></i>添加"
- }, {
- type: "newcolumn"
- },
- {
- type: "input",
- name: 'clientId',
- label: '客户端:',
- width:300,
- placeholder:"请输入客户端名称"
- },
- /*{
- type: "newcolumn"
- },
- {
- type: "input",
- name: "authorities",
- label: "权限:",
- offsetLeft: 10
- },*/
- {
- type: "newcolumn"
- },
- {
- type: "button",
- name: "searchBtn",
- className: "",
- value: "查询"
- },
- {
- type: "newcolumn"
- },
- {
- type: "button",
- name: "all",
- className: "normal",
- value: "所有"
- },
- {
- type: "newcolumn"
- }
- ],
- formData: [{
- type: "settings",
- inputWidth: 280,
- width: 400,
- labelWidth: 100,
- position: "label-left",
- labelAlign: "left"
- },
- {
- type: "hidden",
- name: 'id'
- },
- {
- type: "input",
- name: 'clientId',
- label: '客户端',
- required:true,
- validate:"NotEmpty",
- placeholder:"请输入客户端名称"
- },
- {
- type: "password",
- name: "clientSecret",
- label: "密码",
- required:true,
- validate:"NotEmpty",
- placeholder:"请输入密码"
- },
- {
- type: "hidden",
- name: "authorizedGrantTypes",
- label: "授权类型",
- value:''
- },
- {
- type: "input",
- name: "scopes",
- label: "作用域",
- placeholder:"请输入作用域",
- value: 'all'
- },
- {
- type: "input",
- name: "resourceIds",
- label: "资源(使用','分割)",
- rows: 3,
- value:'',
- note: {text:"可为空"}
- },
- {
- type: "hidden",
- name: "authorities",
- value:'',
- label: "权限(格式:服务名:权限编号,使用','分割)",
- rows: 3
- },
- {
- type: "hidden",
- name: "authorityGroups",
- value:'',
- label: "权限组(资源组名称,使用','分割)",
- rows: 3
- },
- ],
- url: BASE_URL + 'authmgr/like', //数据接口
- type: "get", //数据提交方式,默认为get
- params: {}, //查询提交参数,分页参数默认为pageNum,pageSize
- page: true, //是否启用分页
- pageNum: "pageNo",
- totalCount: "totalCount" //总记录数字段,默认totalCount
- };
- var augrid = new PlgGrid(opts);
- augrid.renderTo("authUser-grid-1");
- augrid.loadData();
- // 被迫使用这种无赖的选择,万恶的使用js操作DOM
- // //console.log("$('#form_container .dhxform_base_nested')::" + $('#form_container .dhxform_base_nested'));
- // $('#form_container .cus-class').append($('#form_container .dhxform_base_nested'));
- // $('#form_container .cus-class').find('.topmost').eq(0).css({float: 'left'});
- // $('#form_container .dhxform_base_nested').css({display: 'inline-block'});
- augrid.attachToolBarEvent("onButtonClick", function (name) {
- var operationGroup = {
- searchBtn: function () {
- var fdata = augrid.getToolBarForm().getFormData();
- augrid.setParams(fdata);
- augrid.reload();
- },
- all: function () {
-
- augrid.setParams({});
- augrid.reload();
- },
- addBtn: function () {
- augrid.showDialog(0, "添加", 800, 600, {
- url: BASE_URL + 'authmgr/add',
- type: "post"
- });
- },
- updateBtn: function () {
- augrid.showDialog(1, "编辑", 430, 350, {
- url: BASE_URL + 'authmgr/update',
- type: "post"
- });
- },
- deleteBtn: function () {
- var ids = augrid.getCheckedIds();
- ids = (ids == null || ids == "") ? augrid.getSelectedRowData("id") : ids;
- // debugger;
- if (ids == null) {
- PlgDialog.msg("请选择行!");
- return;
- }
- var loading = layer.load(0, {
- shade: false
- }); //0代表加载的风格,支持0-2
- Prolog.ajax({
- url: BASE_URL + 'authmgr/delete',
- type: 'POST',
- data: {id: ids},
- dataType: 'json',
- success: function (data) {
- layer.close(loading);
- if (data.success) {
- augrid.reload();
- } else {
- layer.msg(data.message);
- }
- }
- });
- },
- }
- if(name && operationGroup.hasOwnProperty(name)){
- operationGroup[name]();
- }
- });
- }())
-
- </script>
|