client.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. <div class="plg-tab-container">
  2. <div class="layui-carousel" id="res-carousel">
  3. <div carousel-item>
  4. <div id="client"></div>
  5. <div id="newForm">
  6. </div>
  7. </div>
  8. </div>
  9. </div>
  10. <script>
  11. (function () {
  12. window.global_fun.client={}
  13. var car = layui.carousel.render({
  14. elem: '#res-carousel',
  15. autoplay: false,
  16. index: 0,
  17. arrow: 'none',
  18. indicator: 'none',
  19. anim: "updown",
  20. width: '100%', //设置容器宽度
  21. height: '100%'
  22. });
  23. /* 此处切换页面 */
  24. function changePanel(tt = true, callback) {
  25. //点切切换时
  26. car.slide(tt);
  27. if (tt) {
  28. callback && setTimeout(function () {
  29. callback()
  30. }, 60);
  31. } else {
  32. res_inst.PlgGridInstance.reload();
  33. $("#newForm").empty()
  34. }
  35. tt = !tt;
  36. }
  37. var res_opts = {
  38. fixedLast: true,
  39. renderer: "client",
  40. url: APIS.client.getAuthmgr(),
  41. type: "get",
  42. };
  43. res_opts.pagebar = {
  44. buttons: [
  45. { text: PLG_BUTTON.value.delBtn(), className: "layui-btn-danger plg-btn-height-auto", name: "delBtn" }
  46. ]
  47. },
  48. res_opts.columns = [
  49. {
  50. name: "id",
  51. id: "id",
  52. hidden: true
  53. },
  54. {
  55. id: "clientId",
  56. name: "用户名称",
  57. align: "left",
  58. type: "ro",
  59. width: 170,
  60. render: function (v) {
  61. return `<b style="color:#2F4056">${v}</b>`
  62. }
  63. },
  64. {
  65. name: "状态",
  66. id: "status",
  67. align: "center",
  68. width: 70,
  69. type: "ro",
  70. render: function (v) {
  71. return getStatus(v)
  72. }
  73. },
  74. {
  75. name: "授权类型",
  76. id: "authorizedGrantTypes",
  77. align: "left",
  78. type: "ro",
  79. render: function (v) {
  80. var d = v.split(',');
  81. d = d.map(function (item) {
  82. return `<span style="color:#01AAED">${item}</span>`
  83. });
  84. return d.join(`<i style="color:#ddd;padding: 0 5px;">|</i>`)
  85. }
  86. },
  87. {
  88. name: "授权范围",
  89. id: "scopes",
  90. align: "center",
  91. width: 150,
  92. type: "ro"
  93. },
  94. {
  95. name: "接入过期时间",
  96. width: 120,
  97. id: "accessTokenValiditySeconds",
  98. align: "center",
  99. type: "ron",
  100. render: function (v) {
  101. return v + "秒"
  102. }
  103. },
  104. {
  105. name: " 刷新过期时间",
  106. width: 140,
  107. id: "refreshTokenValiditySeconds",
  108. align: "center",
  109. type: "ron",
  110. render: function (v) {
  111. return v + "秒"
  112. }
  113. },
  114. {
  115. name: "说明",
  116. id: "notes",
  117. align: "left",
  118. type: "ro",
  119. render: function (v) {
  120. return !v && `<span style="color:#999">暂无说明</span>`
  121. }
  122. },
  123. {
  124. id: "op",
  125. name: "操作",
  126. type: 'button',
  127. width: "180",
  128. align: "center",
  129. render: function (v, d) {
  130. return '授权^global_fun.client.accreditClick,详情^global_fun.client.detailsClick,删除^global_fun.client.deleteClick';
  131. }
  132. }
  133. ];
  134. function setMainPanel(callback) {
  135. var t = callback();
  136. var mainOpts = {
  137. renderr: "newForm",
  138. skin: 0,
  139. className: "flex_panel",
  140. header: {
  141. isShow: true,
  142. title: t.title,
  143. moreBtn: [
  144. {
  145. name: `返回 <i class="layui-icon layui-icon-right" style="color:#1E9FFF"></i>`,
  146. className: "",
  147. style: "margin-right: 10px;",
  148. onClick: function (e) {
  149. changePanel(false);
  150. return false
  151. }
  152. }
  153. ],
  154. }
  155. }
  156. var mainpanel = new PlgPanel(mainOpts);
  157. mainpanel.renderBefore(function () {
  158. this.appendPanelBody(t.html);
  159. });
  160. mainpanel.renderTo("newForm");
  161. mainpanel.getElement.find(".layui-card-body").addClass("plg-flex-column");
  162. return mainpanel
  163. }
  164. //授权页面
  165. window.global_fun.client.accreditClick = function (id) {
  166. window.global_fun.client.clientId = id;
  167. res_inst.PlgGridInstance.selectRowById(window.global_fun.client.clientId);
  168. changePanel(true, function () {
  169. window.global_fun.client.clientId = id;
  170. setMainPanel(function () {
  171. return {
  172. title: "用户授权",
  173. html: `<div class="tip cl">
  174. <span class="text"> <i class="layui-icon layui-icon-about" style="color:#bbb"></i> 重置客户端权限后,所有资源中心将重新请求授权中进行鉴权! </span>
  175. <a class="right layui-btn layui-btn-normal layui-btn-radius" onclick="window.global_fun.client.resetUser(this)" href="javascript:void(0)">
  176. <i class="layui-icon layui-icon-refresh" style="vertical-align: middle;"></i> 重置权限
  177. </a>
  178. </div>
  179. <div id="accreditListTabs" class="plg-flex-column"></div>
  180. `
  181. }
  182. });
  183. new PlgTabs({
  184. renderer: "accreditListTabs",
  185. indexActive: 0,
  186. className: "flex_tabs",
  187. content: [
  188. {
  189. title: "分配资源权限",
  190. url: "./pages/authorization/client.resource.html"
  191. },
  192. {
  193. title: "分配资源组权限",
  194. url: "./pages/authorization/client.resourceGroup.html"
  195. }
  196. ]
  197. })
  198. })
  199. };
  200. //状态显示
  201. function getStatus(status) {
  202. if (status === 1) {
  203. return `<span class="layui-badge-dot layui-bg-blue"></span> 正常 `
  204. } else if (status === 2) {
  205. return `<span class="layui-badge-dot"></span> 冻结`
  206. } else if (status === 0) {
  207. return `<span class="layui-badge-dot layui-bg-orange"></span> 未激活`
  208. }
  209. return
  210. }
  211. //通过状态显示不同的按扭
  212. function resultBtnStatus(dform, status) {
  213. var s = ["active", "freeze", "unfreeze"];
  214. //0 未激活-- 显示激活账号-active
  215. //1 正常-- 显示冻结账号-freeze
  216. //2 冻结-- 显示解冻账号-unfreeze
  217. s.forEach(function (item) {
  218. dform.disableItem(item);
  219. dform.hideItem(item);
  220. });
  221. dform.enableItem(s[status]);
  222. dform.showItem(s[status]);
  223. $("#statustemplate").html(getStatus(status))
  224. return dform
  225. }
  226. var statusBtn = {
  227. event: function (param, url, callback) {
  228. var close = Prolog.loading2();
  229. Prolog.ajax({
  230. type: "post",
  231. url: url,
  232. data: param,
  233. success: function (response) {
  234. if (response) {
  235. callback && callback(response);
  236. }
  237. PlgDialog.msg(response.message);
  238. },
  239. complete: function () {
  240. close()
  241. }
  242. });
  243. },
  244. };
  245. //详情
  246. window.global_fun.client.detailsClick = function (id, data) {
  247. window.global_fun.client.clientId = id;
  248. res_inst.PlgGridInstance.selectRowById(window.global_fun.client.clientId);
  249. changePanel(true, function () {
  250. setMainPanel(function () {
  251. return {
  252. title: "用户详情",
  253. html: `<div class="tip cl" style="border:0;padding: 16px 16px 8px;">
  254. <div id="client_details"></div>
  255. </div>
  256. <div class="plg-flex-column">
  257. <div id="detalisForm"></div>
  258. </div>
  259. `
  260. }
  261. });
  262. /**详情头部信息*****/
  263. var detailsToolbar = new PlgForm({
  264. renderer: "client_details",
  265. items: [{
  266. type: "row",
  267. list: [
  268. {
  269. type: "template",
  270. className: "layui-col-md12",
  271. format: function () {
  272. return `
  273. <div class="avatar bg-secondary">${data.clientId.substring(0, 1).toLocaleUpperCase()}</div>
  274. <div class="u-text" style="display: inline-block;padding-left: 0">
  275. <div class="text" style="padding-right:10px;font-size:20px">
  276. <b>${data.clientId}</b>
  277. </div>
  278. </div>`
  279. }
  280. },
  281. {
  282. label: "状态:",
  283. type: "template",
  284. className: "left f14 row_list",
  285. offsetLeft: 20,
  286. format: function (v) {
  287. return `<div id="statustemplate"></div>`
  288. }
  289. },
  290. {
  291. className: "layui-col-md4 ",
  292. type: "block",
  293. list: [
  294. {
  295. type: "button",
  296. value: "初始化密码",
  297. name: "resetpassword",
  298. className: " btn-radius"
  299. },
  300. {
  301. type: "newcolumn"
  302. },
  303. {
  304. type: "button",
  305. value: "修改密码",
  306. name: "updatepassword",
  307. className: " btn-radius"
  308. }
  309. ]
  310. },
  311. {
  312. type: "block",
  313. className: "layui-col-md4 right",
  314. list: [
  315. {
  316. type: "button",
  317. value: "冻结账号",
  318. className: "btn-danger btn-radius",
  319. name: "freeze",
  320. hidden: true,
  321. diasbled: true
  322. },
  323. {
  324. type: "button",
  325. value: "解冻账号",
  326. className: "btn-warm btn-radius",
  327. name: "unfreeze",
  328. hidden: true,
  329. diasbled: true
  330. },
  331. {
  332. type: "button",
  333. value: "激活账号",
  334. className: "btn-success btn-radius",
  335. name: "active",
  336. hidden: true,
  337. diasbled: true
  338. },
  339. ]
  340. },
  341. ]
  342. }]
  343. });
  344. //0 未激活-- 显示激活账号-active
  345. //1 正常-- 显示冻结账号-freeze
  346. //2 冻结-- 显示解冻账号-unfreeze
  347. statusBtn.active= function () {
  348. statusBtn.event({id:window.global_fun.client.clientId}, APIS.client.active(), function (data) {
  349. resultBtnStatus(detailsToolbar, 1);
  350. })
  351. };
  352. statusBtn.freeze= function () {
  353. statusBtn.event({id:window.global_fun.client.clientId}, APIS.client.freeze(), function (data) {
  354. resultBtnStatus(detailsToolbar, 2);
  355. })
  356. };
  357. statusBtn.unfreeze= function () {
  358. statusBtn.event({id:window.global_fun.client.clientId}, APIS.client.unfreeze(), function (data) {
  359. resultBtnStatus(detailsToolbar, 1);
  360. })
  361. };
  362. statusBtn.resetpassword= function () {
  363. statusBtn.event({id:window.global_fun.client.clientId}, APIS.client.resetpassword())
  364. };
  365. statusBtn.updatepassword= function () {
  366. var form1 = null;
  367. var winoptions = {
  368. id: "wnd_001",
  369. title: _t("修改用户密码"),
  370. type: 1,
  371. closeBtn: 1,
  372. resize: true,
  373. tipsMore: true,
  374. btnAlign: 'c',
  375. btn: [_t("保存"), _t("取消")],
  376. btn1: function (index, layero) {
  377. var b = form1.validate();
  378. if (!b) return false;
  379. var close = PlgDialog.loading2();
  380. var fd = form1.getFormData();
  381. if (fd.newPassword == fd.oldPassword) {
  382. PlgDialog.msg("新密码与旧密码相同", {
  383. type: 1
  384. });
  385. close()
  386. return;
  387. }
  388. if (fd.newPassword != fd.conwPwd) {
  389. PlgDialog.msg("两次输入的密码不相同", {
  390. type: 1
  391. });
  392. close()
  393. return;
  394. };
  395. statusBtn.event(fd , APIS.client.updatepassword(),function(){
  396. PlgDialog.close(index);
  397. });
  398. },
  399. btn2: function (index, layero) {
  400. PlgDialog.close(index);
  401. },
  402. area: ['400px', '300px'],
  403. content: '<div id="edit_password"></div>',
  404. success: function (layero, index) {
  405. var formcfg = {
  406. renderer: "edit_password",
  407. items: [
  408. {
  409. type: "row",
  410. className: "row_list layui-col-md12",
  411. list: [
  412. {
  413. type: "settings",
  414. labelAlign: "right",
  415. labelWidth: 80
  416. },
  417. {
  418. type: "hidden",
  419. name: "id",
  420. value:window.global_fun.client.clientId
  421. },
  422. {
  423. type: "password",
  424. name: "oldPassword",
  425. label: "旧密码:",
  426. validate: "NotEmpty",
  427. required: true
  428. },
  429. {
  430. type: "password",
  431. name: "newPassword",
  432. label: "新密码:",
  433. validate: "NotEmpty",
  434. required: true
  435. },
  436. {
  437. type: "password",
  438. name: "conwPwd",
  439. label: "确认密码:",
  440. validate: "NotEmpty",
  441. required: true
  442. },
  443. {
  444. type: "label",
  445. name: "msg",
  446. label: "温馨提示:密码为 8~20 位的字母和数字组成,区分大小写!",
  447. labelWidth: 350,
  448. }
  449. ]
  450. },
  451. ]
  452. };
  453. form1 = new PlgForm(formcfg);
  454. }
  455. };
  456. PlgDialog.open(winoptions);
  457. };
  458. resultBtnStatus(detailsToolbar, data.status);
  459. detailsToolbar.on("onButtonClick", function (name) {
  460. if (statusBtn[name]) {
  461. statusBtn[name]()
  462. }
  463. })
  464. //下面的详情表单
  465. var baseForm = new PlgForm({
  466. renderer: "detalisForm",
  467. items: [{
  468. type: "row",
  469. width: 500,
  470. className: "row_list",
  471. list: [
  472. {
  473. type: "settings",
  474. labelAlign: "right",
  475. labelWidth: 100,
  476. },
  477. {
  478. type: "hidden",
  479. name: "id",
  480. value:window.global_fun.client.clientId
  481. },
  482. {
  483. type: "multiselect",
  484. name: "authorizedGrantTypes",
  485. label: "授权类型",
  486. inputHeight:100,
  487. value:data.authorizedGrantTypes,
  488. required: true,
  489. options: [{
  490. value: "authorization_code",
  491. text: "authorization_code"
  492. },
  493. {
  494. value: "implicit",
  495. text: "implicit"
  496. }, {
  497. value: "password",
  498. text: "password"
  499. },
  500. {
  501. value: "client_credentials",
  502. text: "client_credentials",
  503. selected: true
  504. },
  505. {
  506. value: "refresh_token",
  507. text: "refresh_token"
  508. }
  509. ],
  510. },
  511. {
  512. className: "layui-col-md12",
  513. type: "input",
  514. name: "scopes",
  515. required: true,
  516. validate: "NotEmpty",
  517. label: "授权范围:",
  518. value: data.scopes,
  519. placeholder: _t("请输入授权范围"),
  520. },
  521. {
  522. className: "layui-col-md12",
  523. type: "input",
  524. name: "accessTokenValiditySeconds",
  525. label: "接入过期时间:",
  526. value: data.accessTokenValiditySeconds,
  527. required: true,
  528. validate: "NotEmpty,ValidNumeric",
  529. placeholder: _t("请输入过期时间秒"),
  530. numberFormat: ["0 秒", "."],
  531. },
  532. {
  533. className: "layui-col-md12",
  534. type: "input",
  535. name: "refreshTokenValiditySeconds",
  536. label: "刷新过期时间:",
  537. value: data.refreshTokenValiditySeconds,
  538. required: true,
  539. validate: "NotEmpty,ValidNumeric",
  540. placeholder: _t("请输入过期时间秒"),
  541. numberFormat: ["0 秒", "."]
  542. },
  543. {
  544. className: "layui-col-md12",
  545. type: "input",
  546. name: "notes",
  547. label: "说明:",
  548. rows: 3,
  549. labelTop: -20,
  550. value:data.notes
  551. },
  552. {
  553. offsetTop: 20,
  554. className: "btn-border-link btn-lx layui-col-md6 flex_item_right",
  555. type: "button",
  556. value: "返回",
  557. name: "back",
  558. width: 150
  559. },
  560. {
  561. offsetTop: 20,
  562. className: "btn-normal btn-lx layui-col-md6",
  563. type: "button",
  564. name: "save",
  565. value: "保存",
  566. width: 150
  567. }
  568. ]
  569. }
  570. ]
  571. });
  572. baseForm.on("onButtonClick", function (name) {
  573. if (name == "back") {
  574. changePanel(false);
  575. } else if (name == "save") {
  576. var dform=baseForm.getFormData();
  577. var d = dform.authorizedGrantTypes;
  578. if(d && d.length>0){
  579. dform.authorizedGrantTypes = d.join(",");
  580. }else{
  581. Prolog.message("授权类型不能为空")
  582. return;
  583. }
  584. statusBtn.event(dform, APIS.client.update(),function(data){
  585. changePanel(false);
  586. })
  587. }
  588. });
  589. })
  590. };
  591. window.global_fun.client.resetUser = function () {
  592. layer.confirm("是否重置权限?", function (index) {
  593. statusBtn.event({id:window.global_fun.client.clientId}, APIS.client.refreshauths())
  594. });
  595. };
  596. window.global_fun.client.deleteClick = function (id) {
  597. res_inst.PlgGridInstance.selectRowById(id);
  598. res_inst.delBtn({ id: id });
  599. };
  600. res_opts.toolbar = [{
  601. type: 'row',
  602. blockOffset: 0,
  603. className: "layui-col-md12",
  604. list: [
  605. {
  606. type: "row",
  607. className: "layui-col-md6",
  608. blockOffset: 0,
  609. list: [{
  610. className: "layui-col-md4",
  611. type: "input",
  612. name: "likeMap",
  613. label: "搜索",
  614. placeholder: "用户名/状态"
  615. },
  616. {
  617. type: "button",
  618. className: "left",
  619. name: "selectAllBtn",
  620. value: PLG_BUTTON.value.searchBtn()
  621. },
  622. {
  623. type: "button",
  624. name: "resetBtn",
  625. className: "left",
  626. value: PLG_BUTTON.value.resetBtn()
  627. },
  628. ]
  629. },
  630. {
  631. type: "block",
  632. className: "layui-col-md6 right",
  633. blockOffset: 0,
  634. list: [
  635. {
  636. type: "button",
  637. name: "addBtn",
  638. value: PLG_BUTTON.value.addBtn() + "用户"
  639. }
  640. ]
  641. }]
  642. }];
  643. res_opts.formData = [{
  644. type: "block",
  645. width: 680,
  646. list: [{
  647. type: "settings",
  648. labelWidth: 120,
  649. width:200,
  650. position: "label-left",
  651. labelAlign: "right"
  652. },
  653. {
  654. type: "hidden",
  655. name: "id",
  656. label: "id",
  657. value: 0,
  658. },
  659. {
  660. type: "input",
  661. name: "clientId",
  662. label: "用户名称",
  663. width:200,
  664. required: true,
  665. validate: 'NotEmpty',
  666. placeholder: _t("请输入用户名称")
  667. },
  668. {
  669. type: "password",
  670. name: "inPwd",
  671. label: "输入密码",
  672. width:200,
  673. required: true,
  674. validate: 'NotEmpty',
  675. placeholder: _t("请输入密码")
  676. },
  677. {
  678. type: "password",
  679. name: "clientSecret",
  680. width:200,
  681. label: "确认密码",
  682. required: true,
  683. validate: 'NotEmpty',
  684. placeholder: _t("请再次输入确认密码")
  685. },
  686. {
  687. type: "input",
  688. name: "accessTokenValiditySeconds",
  689. label: "接入过期时间",
  690. width:200,
  691. required: true,
  692. validate: "NotEmpty,ValidNumeric",
  693. value: 43200,
  694. placeholder: _t("请输入过期时间秒"),
  695. numberFormat: ["0 秒", "."],
  696. },
  697. {
  698. type: "input",
  699. name: "refreshTokenValiditySeconds",
  700. label: "刷新过期时间",
  701. width:200,
  702. required: true,
  703. validate: "NotEmpty,ValidNumeric",
  704. value: 2592000,
  705. placeholder: _t("请输入过期时间秒"),
  706. numberFormat: ["0 秒", "."],
  707. },
  708. {type: "newcolumn"},
  709. {
  710. type: "multiselect",
  711. name: "authorizedGrantTypes",
  712. label: "授权类型",
  713. inputHeight:100,
  714. width:200,
  715. required: true,
  716. options: [{
  717. value: "authorization_code",
  718. text: "authorization_code"
  719. },
  720. {
  721. value: "implicit",
  722. text: "implicit"
  723. }, {
  724. value: "password",
  725. text: "password"
  726. },
  727. {
  728. value: "client_credentials",
  729. text: "client_credentials",
  730. selected: true
  731. },
  732. {
  733. value: "refresh_token",
  734. text: "refresh_token"
  735. }
  736. ],
  737. },
  738. {
  739. type: "input",
  740. name: "scopes",
  741. label: "授权范围",
  742. required: true,
  743. width:200,
  744. validate: "NotEmpty",
  745. value: "all",
  746. placeholder: _t("授权范围,多个使用逗号分隔")
  747. },
  748. {
  749. type: "input",
  750. name: "notes",
  751. // validate: 'NotEmpty',
  752. // required: true,
  753. label: "说明:",
  754. width:200,
  755. rows: 3,
  756. labelTop: -20,
  757. placeholder: "请填写说明"
  758. }
  759. ]
  760. }
  761. ]
  762. var res_inst = new GridPlant({
  763. instance: new PlgGrid(setConfig(res_opts)).loadData(null, function () {
  764. window.global_fun.client.clientId && res_inst.PlgGridInstance.selectRowById(window.global_fun.client.clientId);
  765. }),
  766. addBtnUrl: APIS.client.addAuthmgr(),
  767. editBtnUrl: APIS.client.addAuthmgr(),
  768. delBtnUrl: APIS.client.deleteAuthmgr(),
  769. downBtnUrl: APIS.client.addAuthmgr(),
  770. importBtnUrl: APIS.client.addAuthmgr(),
  771. onRowDblClicked: false,
  772. }).init();
  773. res_inst.selectAllBtnAfter(function (obj) {
  774. var likeMap = res_inst.PlgGridInstance.getToolBarForm().getItemValue("likeMap");
  775. obj.clientId = likeMap
  776. obj.status = likeMap
  777. delete obj.likeMap
  778. })
  779. res_inst.PlgGridInstance.attachPageBarEvent(function (v) {
  780. res_inst.delBtn();
  781. });
  782. //删除方法
  783. res_inst.delBtn = function (paramsObj = null) {
  784. this.formatForm(3, "POST", _t("是否删除数据"), this.delBtnUrl, paramsObj)
  785. };
  786. //新加用户弹出框的回调
  787. res_inst.showDialogAfter(function (gridForm) {
  788. var DForm = gridForm.getDForm();
  789. DForm.setValidation("clientSecret",function(v){
  790. var is = (v === gridForm.getItemValue("inPwd"));
  791. setTimeout(function () {
  792. if (!is) {
  793. DForm.setNote("clientSecret", { text: "两组密码不一致,请重新输入", width: "auto" });
  794. DForm.getInput("clientSecret").parentNode.parentNode.classList.add("validate_error")
  795. } else {
  796. DForm.clearNote("clientSecret");
  797. DForm.getInput("clientSecret").parentNode.parentNode.classList.remove("validate_error")
  798. }
  799. }, 0)
  800. return is
  801. })
  802. gridForm.attachEvent("onBlur", function (name, value) {
  803. if (name === "clientSecret") {
  804. DForm.validateItem(name);
  805. }
  806. })
  807. return gridForm
  808. })
  809. res_inst.showDialogSaveBtn(function (gridForm, data) {
  810. // data.clientSecret=data.outPwd;
  811. delete data.inPwd
  812. })
  813. })()
  814. </script>