robot.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('用户头像管理')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="btn-group-sm" id="toolbar" role="group">
  10. <a class="btn btn-success" onclick="generate()" shiro:hasPermission="users:robot:generate">
  11. <i class="fa fa-audio-description"></i> 生成机器人
  12. </a>
  13. </div>
  14. <div class="col-sm-12 select-table table-striped" style="overflow:scroll;">
  15. <table id="bootstrap-table" data-mobile-responsive="false" style="min-width:1500px;"></table>
  16. </div>
  17. </div>
  18. </div>
  19. <th:block th:include="include :: footer" />
  20. <script th:inline="javascript">
  21. var isUseFlag = [[${@permission.hasPermi('users:robot:use')}]];
  22. var sexs = [[${@dict.getType('sys_user_sex')}]];
  23. var isUse = [[${@dict.getType('use_type')}]];
  24. var prefix = ctx + "users/robot";
  25. $(function() {
  26. var options = {
  27. url: prefix + "/list",
  28. modalName: "机器人列表",
  29. height: $(window).height()-120,
  30. columns: [
  31. {
  32. field: 'nick',
  33. title: '昵称',
  34. align : 'center'
  35. },
  36. {
  37. field: 'avatar',
  38. title: '头像',
  39. align : 'center',
  40. formatter:function (value,row,index) {
  41. return "<img src='" + value + "' width='70' height='60'>";
  42. }
  43. },
  44. {
  45. field: 'gender',
  46. title: '性别',
  47. align : 'center',
  48. formatter: function(value, row, index) {
  49. return $.table.selectDictLabel(sexs, value);
  50. }
  51. },
  52. {
  53. field: 'isUsed',
  54. title: '是否使用',
  55. align : 'center',
  56. formatter: function(value, row, index) {
  57. return $.table.selectDictLabel(isUse, value);
  58. }
  59. },
  60. {
  61. title: '操作',
  62. align: 'center',
  63. formatter: function(value, row, index) {
  64. var actions = [];
  65. actions.push('<a class="btn btn-success btn-xs ' + isUseFlag + '" href="javascript:void(0)" onclick="settings(\'' + row.nick + '\',\'' + row.isUsed + '\')"><i class="fa fa-gears"></i> 设置</a> ');
  66. return actions.join('');
  67. }
  68. }]
  69. };
  70. $.table.init(options);
  71. });
  72. /**
  73. * 设置
  74. */
  75. function settings(nick,isUsed) {
  76. if(isUsed == 0){
  77. $.modal.confirm("确认要设置使用该记录吗?", function() {
  78. $.operate.post(prefix + "/isUse?nick=" + nick);
  79. });
  80. }else{
  81. $.modal.confirm("确认要设置不使用该记录吗?", function() {
  82. $.operate.post(prefix + "/isUse?nick=" + nick);
  83. });
  84. }
  85. }
  86. /**
  87. * 生成机器人
  88. */
  89. function generate(){
  90. $.modal.confirm("确认要生成机器人吗?", function() {
  91. $.operate.post(prefix + "/generate");
  92. });
  93. }
  94. </script>
  95. </body>
  96. </html>