server-cfg.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
  11. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  12. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  13. <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
  14. <script src="../../static/sa.js"></script>
  15. <script src="../../static/kj/upload-util.js"></script>
  16. <style type="text/css">
  17. html,
  18. body,
  19. .vue-box {
  20. height: 100%;
  21. overflow: hidden;
  22. }
  23. /* .vue-box{padding: 0px;} */
  24. .c-panel {
  25. height: calc(100% - 4em);
  26. position: relative;
  27. }
  28. .c-panel .c-label {
  29. width: 10em;
  30. }
  31. .c-panel .el-input {
  32. width: 500px;
  33. }
  34. .c-panel .el-textarea {
  35. width: 500px;
  36. }
  37. .logo-img {
  38. width: 35px;
  39. height: 35px;
  40. border-radius: 2px;
  41. vertical-align: middle;
  42. margin-right: 0.5em;
  43. cursor: pointer;
  44. }
  45. .s-tab {
  46. height: 100%;
  47. }
  48. .el-tabs__content {
  49. height: calc(100% - 130px);
  50. overflow: auto;
  51. }
  52. /* 让头像样式小一点 */
  53. .c-item-mline {
  54. width: 600px;
  55. }
  56. .c-item-mline .image-box-2 {
  57. width: 60px;
  58. height: 100px;
  59. }
  60. .c-item-mline .image-box-2 img {
  61. width: 60px;
  62. height: 60px;
  63. }
  64. .c-item-mline .image-box-2.up_img {
  65. height: 60px;
  66. }
  67. .c-item-mline .image-box-2.up_img img {
  68. margin: 15px;
  69. width: 30px;
  70. height: 30px;
  71. }
  72. .item-num .el-input__inner {
  73. width: 130px;
  74. }
  75. </style>
  76. </head>
  77. <body>
  78. <div class="vue-box" style="display: none;" :style="'display: block;'">
  79. <div class="c-panel" v-if="m != null">
  80. <el-tabs class="s-tab" v-model="activeTab">
  81. <!-- ---------------------------------- 系统参数 ---------------------------------- -->
  82. <el-tab-pane label="参数设置" name="tab1">
  83. <sa-item type="enum" name="备案审核" v-model="m.fillingJudge" :jv="{1: '人工审核', 2: '自动审核'}" jtype="1"
  84. br>
  85. </sa-item>
  86. <div class="c-item">
  87. <label class="c-label">
  88. 体温阈值(℃):</label>
  89. <el-input-number class="item-num" v-model="m.minTemperature" :min="1" size="mini">
  90. </el-input-number>
  91. <span style="margin-left: 10px;">大于此阈值会触发报警</span>
  92. </div>
  93. <sa-item type="enum" name="是否发送预警通知" v-model="m.sendAlarm" :jv="{1: '发送', 0: '不发送'}" jtype="1"
  94. br>
  95. </sa-item>
  96. </el-tab-pane>
  97. </el-tabs>
  98. <div
  99. style="position: absolute; bottom: 0px; width: calc(100% - 3em); line-height: 80px; background-color: #FFF;">
  100. <hr style="height: 2px;">
  101. <div class="c-item">
  102. <label class="c-label"></label>
  103. <el-button type="primary" icon="el-icon-check" @click="ok">保存修改</el-button>
  104. <el-button type="primary" icon="el-icon-refresh-right" @click="f5">重置</el-button>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <script type="text/javascript">
  110. // 创建一个默认的配置对象
  111. function create_m() {
  112. return {
  113. fillingJudge: 1, // 预留信息
  114. minTemperature: 37.0,
  115. sendAlarm: 1, // 新用户默认头像
  116. }
  117. }
  118. </script>
  119. <script>
  120. var app = new Vue({
  121. components: {
  122. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  123. },
  124. el: '.vue-box',
  125. data: {
  126. sa: sa, // 超级对象
  127. m: null, //
  128. activeTab: 'tab1'
  129. },
  130. methods: {
  131. // 初始化配置
  132. init: function(str) {
  133. // 获取
  134. var cfg = sa.JSONParse(str, {}); // 用户配置
  135. var default_cfg = create_m(); // 默认配置
  136. // 遍历
  137. for (var key in default_cfg) {
  138. if (cfg[key] !== undefined && cfg[key] !== null) {
  139. default_cfg[key] = cfg[key];
  140. }
  141. }
  142. // 赋值
  143. this.m = default_cfg;
  144. },
  145. // 刷新
  146. f5: function() {
  147. sa.ajax('/SpCfg/getCfg', {
  148. cfgName: 'server_cfg'
  149. }, function(res) {
  150. this.init(res.data);
  151. }.bind(this));
  152. },
  153. // 提交
  154. ok: function() {
  155. sa.ajax('/SpCfg/updateCfg', {
  156. cfgName: 'server_cfg',
  157. cfgValue: JSON.stringify(this.m)
  158. }, function(res) {
  159. sa.ok2('保存成功');
  160. }.bind(this));
  161. }
  162. },
  163. created: function() {
  164. this.f5();
  165. }
  166. })
  167. </script>
  168. </body>
  169. </html>