app-cfg.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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">系统logo:</label>
  43. <img :src="m.logoUrl" class="logo-img" v-if="sa.isNull(m.logoUrl) == false" @click="sa.showImage(m.logoUrl, '400px', '400px')">
  44. <el-link type="primary" @click="sa.uploadImage(src => {m.logoUrl = src; sa.ok2('上传成功');})">选择上传</el-link>
  45. </div>
  46. <div class="c-item br">
  47. <label class="c-label">系统名称:</label>
  48. <el-input v-model="m.appName"></el-input>
  49. </div>
  50. <div class="c-item br">
  51. <label class="c-label">版本编号:</label>
  52. <el-input v-model="m.appVersionNo"></el-input>
  53. </div>
  54. <div class="c-item br">
  55. <label class="c-label">更新描述:</label>
  56. <el-input v-model="m.appVersionLog"></el-input>
  57. </div>
  58. </el-tab-pane>
  59. <!-- ---------------------------------- 其它配置 ---------------------------------- -->
  60. <el-tab-pane label="其它配置" name="tab2">
  61. <br>
  62. <span>其它配置</span>
  63. </el-tab-pane>
  64. </el-tabs>
  65. <!-- 确定按钮 -->
  66. <div style="position: absolute; bottom: 0px; width: calc(100% - 3em); line-height: 80px; background-color: #FFF;">
  67. <hr style="height: 2px;">
  68. <div class="c-item">
  69. <label class="c-label"></label>
  70. <el-button type="primary" icon="el-icon-check" @click="ok">保存修改</el-button>
  71. <el-button type="primary" icon="el-icon-refresh-right" @click="f5">重置</el-button>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <script type="text/javascript">
  77. // 创建一个默认的配置对象
  78. function create_m() {
  79. return {
  80. logoUrl: '', // 系统logo地址
  81. appName: 'sa-plus快速开发框架' ,// 系统名称
  82. appVersionNo: 'v1.0.0', // 系统版本
  83. appVersionLog: '更新于2099-10-1', // 更新日志
  84. }
  85. }
  86. </script>
  87. <script>
  88. var app = new Vue({
  89. el: '.vue-box',
  90. data: {
  91. sa: sa, // 超级对象
  92. m: null, //
  93. activeTab: 'tab1', // 当前显示的tab
  94. textareaCfg: { minRows: 3, maxRows: 14} // 文本域的默认配置
  95. },
  96. methods: {
  97. // 初始化配置
  98. init: function(str) {
  99. // 获取
  100. var cfg = sa.JSONParse(str, {}); // 用户配置
  101. var default_cfg = create_m(); // 默认配置
  102. // 遍历
  103. for(var key in default_cfg) {
  104. if(cfg[key] !== undefined && cfg[key] !== null) {
  105. default_cfg[key] = cfg[key];
  106. }
  107. }
  108. // 赋值
  109. this.m = default_cfg;
  110. },
  111. // 刷新
  112. f5: function(){
  113. sa.ajax('/SpCfg/getCfg', {cfgName: 'app_cfg'}, function(res){
  114. this.init(res.data);
  115. }.bind(this));
  116. },
  117. // 提交
  118. ok: function(){
  119. sa.ajax('/SpCfg/updateCfg', {cfgName: 'app_cfg', cfgValue: JSON.stringify(this.m)}, function(res){
  120. sa.ok2('保存成功');
  121. }.bind(this));
  122. },
  123. },
  124. created: function(){
  125. this.f5();
  126. }
  127. })
  128. </script>
  129. </body>
  130. </html>