overallManager.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class='m-container'>
  3. <!-- <h2>参数设置</h2> -->
  4. <div class="m-core">
  5. <!-- 列表 -->
  6. <el-row>
  7. <el-col :span="12" v-for="(config, index) in configList" :key="config.id">
  8. {{ config.description[0] }}
  9. <el-input type="number" v-model="input[index]">
  10. <template slot="append" v-if="config.description[1]">{{ config.description[1] }}</template>
  11. </el-input>
  12. <el-button @click="onSave(config, index)" type="primary">保存</el-button>
  13. </el-col>
  14. </el-row>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import pagination from '@/components/Pagination/index'
  20. import store from '@/store'
  21. import { sysConfigList, sysConfigUpdate } from '@/api/generalSettings'
  22. export default {
  23. components: { pagination },
  24. name: 'musicalManager',
  25. data () {
  26. return {
  27. organId: store.getters.organ,
  28. configList: [],
  29. input: []
  30. }
  31. },
  32. mounted() {
  33. this.__init()
  34. },
  35. methods: {
  36. __init() {
  37. sysConfigList({ group: 'default' }).then(res => {
  38. if(res.code == 200 && res.data.length > 0) {
  39. res.data.forEach((item, index) => {
  40. this.input[index] = item.paranValue
  41. this.configList.push({
  42. id: item.id,
  43. paramName: item.paramName,
  44. paranValue: item.paranValue,
  45. description: item.description.split('{}')
  46. })
  47. })
  48. }
  49. })
  50. },
  51. onSave (row, index) {
  52. let params = {
  53. id: row.id,
  54. paranValue: this.input[index],
  55. paramName: row.paramName,
  56. description: row.description.join('{}')
  57. }
  58. sysConfigUpdate(params).then(res => {
  59. if(res.code == 200) {
  60. this.$message({
  61. message: '修改成功',
  62. type: 'success'
  63. })
  64. }
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. /deep/.el-input-group__append {
  72. background: #DCDFE6;
  73. border-color: #DCDFE6;
  74. &:hover, &:active, &:focus {
  75. background: #DCDFE6;
  76. border-color: #DCDFE6;
  77. color: #FFF;
  78. }
  79. }
  80. .el-button--primary {
  81. background: #14928a;
  82. border-color: #14928a;
  83. color: #fff;
  84. &:hover, &:active, &:focus {
  85. background: #14928a;
  86. border-color: #14928a;
  87. color: #FFF;
  88. }
  89. }
  90. .el-row {
  91. margin-top: 40px;
  92. }
  93. .el-col {
  94. display: flex;
  95. align-items: center;
  96. margin-bottom: 20px;
  97. justify-content: flex-end;
  98. margin-right: 50%;
  99. }
  100. .el-input-group, .el-input {
  101. width: 200px;
  102. margin: 0 20px;
  103. }
  104. </style>