app-cfg.html 4.5 KB

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