overallManager.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.paramName !== 'default_password'">{{ 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().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. .el-button--primary {
  72. background: #14928a;
  73. border-color: #14928a;
  74. color: #fff;
  75. &:hover, &:active, &:focus {
  76. background: #14928a;
  77. border-color: #14928a;
  78. color: #FFF;
  79. }
  80. }
  81. .el-row {
  82. margin-top: 40px;
  83. }
  84. .el-col {
  85. display: flex;
  86. align-items: center;
  87. margin-bottom: 20px;
  88. justify-content: flex-end;
  89. margin-right: 50%;
  90. }
  91. .el-input-group, .el-input {
  92. width: 200px;
  93. margin: 0 20px;
  94. }
  95. </style>