server-cfg.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>服务器私有配置</title>
  6. <!-- 所有的 css js 资源 -->
  7. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  8. <link rel="stylesheet" href="../../static/sa.css">
  9. <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
  10. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  11. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  12. <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
  13. <script src="../../static/sa.js"></script>
  14. <script src="../../static/kj/upload-util.js"></script>
  15. <style type="text/css">
  16. html,body,.vue-box{height: 100%; overflow: hidden;}
  17. /* .vue-box{padding: 0px;} */
  18. .c-panel{height: calc(100% - 4em); position: relative;}
  19. .c-panel .c-label{width: 10em;}
  20. .c-panel .el-input{width: 500px;}
  21. .c-panel .el-textarea{width: 500px;}
  22. .logo-img{
  23. width: 35px;
  24. height: 35px;
  25. border-radius: 2px;
  26. vertical-align: middle;
  27. margin-right: 0.5em;
  28. cursor: pointer;
  29. }
  30. .s-tab{height: 100%; }
  31. .el-tabs__content{height: calc(100% - 130px); overflow: auto;}
  32. </style>
  33. </head>
  34. <body>
  35. <div class="vue-box" style="display: none;" :style="'display: block;'">
  36. <div class="c-panel" v-if="m != null">
  37. <!-- tab卡片 -->
  38. <el-tabs class="s-tab" v-model="activeTab">
  39. <!-- ---------------------------------- 系统参数 ---------------------------------- -->
  40. <el-tab-pane label="系统参数" name="tab1">
  41. <!-- <div class="c-item br">
  42. <label class="c-label">预留信息:</label>
  43. <el-input v-model="m.reserve_info"></el-input>
  44. </div> -->
  45. <div class="c-item">
  46. <label class="c-label">抛出SQL:</label>
  47. <el-switch v-model="m.throwOutSql" :active-value="1" :inactive-value="2"></el-switch>
  48. <span class="c-remark" v-if="m.throwOutSql==1">开启</span>
  49. <span class="c-remark" v-else>关闭</span>
  50. <span class="c-remark" style="color: red;">( 抛出sql只为方便调试,建议只在开发环境下打开此选项,生产环境请务必关闭 )</span>
  51. </div>
  52. </el-tab-pane>
  53. </el-tabs>
  54. <!-- ---------------------------------- 其它配置 ---------------------------------- -->
  55. <el-tab-pane label="其它配置" name="tab2">
  56. <br>
  57. <span>其它配置</span>
  58. </el-tab-pane>
  59. <!-- 确定按钮 -->
  60. <div style="position: absolute; bottom: 0px; width: calc(100% - 3em); line-height: 80px; background-color: #FFF;">
  61. <hr style="height: 2px;">
  62. <div class="c-item">
  63. <label class="c-label"></label>
  64. <el-button type="primary" icon="el-icon-check" @click="ok">保存修改</el-button>
  65. <el-button type="primary" icon="el-icon-refresh-right" @click="f5">重置</el-button>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <script type="text/javascript">
  71. // 创建一个默认的配置对象
  72. function create_m() {
  73. return {
  74. reserve_info: '预留信息', // 预留信息
  75. throwOutSql: 2, // 是否隐藏sql,
  76. }
  77. }
  78. </script>
  79. <script>
  80. var app = new Vue({
  81. el: '.vue-box',
  82. data: {
  83. sa: sa, // 超级对象
  84. m: null, //
  85. activeTab: 'tab1'
  86. },
  87. methods: {
  88. // 初始化配置
  89. init: function(str) {
  90. // 获取
  91. var cfg = sa.JSONParse(str, {}); // 用户配置
  92. var default_cfg = create_m(); // 默认配置
  93. // 遍历
  94. for (var key in default_cfg) {
  95. if (cfg[key] !== undefined && cfg[key] !== null) {
  96. default_cfg[key] = cfg[key];
  97. }
  98. }
  99. // 赋值
  100. this.m = default_cfg;
  101. },
  102. // 刷新
  103. f5: function() {
  104. sa.ajax('/SpCfg/getCfg', {
  105. cfgName: 'server_cfg'
  106. }, function(res) {
  107. this.init(res.data);
  108. }.bind(this));
  109. },
  110. // 提交
  111. ok: function() {
  112. sa.ajax('/SpCfg/updateCfg', {
  113. cfgName: 'server_cfg',
  114. cfgValue: JSON.stringify(this.m)
  115. }, function(res) {
  116. sa.ok2('保存成功');
  117. }.bind(this));
  118. }
  119. },
  120. created: function() {
  121. this.f5();
  122. }
  123. })
  124. </script>
  125. </body>
  126. </html>