miniappConfig.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeName">
  4. <el-tab-pane label="公司小程序配置" name="companyConfig">
  5. <el-form ref="sysConfig" :model="sysConfig" label-width="120px">
  6. <el-form-item label="主要小程序" prop="mainMiniAppId">
  7. <el-select
  8. v-model="queryParams.mainMiniAppId"
  9. placeholder="请选择主要小程序"
  10. clearable
  11. size="small"
  12. >
  13. <el-option
  14. v-for="item in companyMiniAppList"
  15. :key="item.id"
  16. :label="item.name"
  17. :value="item.appid"
  18. />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="备用小程序" prop="backupMiniAppId">
  22. <el-select
  23. v-model="queryParams.backupMiniAppId"
  24. placeholder="请选择备用小程序"
  25. clearable
  26. size="small"
  27. >
  28. <el-option
  29. v-for="item in companyMiniAppList"
  30. :key="item.id"
  31. :label="item.name"
  32. :value="item.appid"
  33. />
  34. </el-select>
  35. </el-form-item>
  36. <div class="line"></div>
  37. <div style="float: right; margin-right: 20px">
  38. <el-button type="primary" @click="onSubmit1">提交</el-button>
  39. </div>
  40. </el-form>
  41. </el-tab-pane>
  42. </el-tabs>
  43. </div>
  44. </template>
  45. <script>
  46. import {
  47. getCompanyMiniAppList,
  48. saveCompanyMiniApp
  49. } from "@/api/company/companyConfig";
  50. export default {
  51. name: "miniappConfig",
  52. data() {
  53. return {
  54. activeName: "companyConfig",
  55. queryParams:{
  56. mainMiniAppId:null,
  57. backupMiniAppId:null
  58. },
  59. companyMiniAppList:[],
  60. sysConfig:{}
  61. };
  62. },
  63. created() {
  64. this.initMimiAppList();
  65. },
  66. mounted() {},
  67. methods: {
  68. initMimiAppList(){
  69. getCompanyMiniAppList().then(res=>{
  70. console.log(res.data);
  71. this.companyMiniAppList = res.data;
  72. let current = res.current;
  73. if(!!current){
  74. this.queryParams.mainMiniAppId = current.mainMiniAppId;
  75. this.queryParams.backupMiniAppId = current.backupMiniAppId;
  76. }
  77. }).catch(res=>{
  78. console.log(res);
  79. })
  80. },
  81. //保存配置
  82. onSubmit1() {
  83. console.log(this.queryParams);
  84. saveCompanyMiniApp(this.queryParams).then(res=>{
  85. this.msgSuccess("修改成功");
  86. }).catch(res=>{
  87. })
  88. },
  89. },
  90. };
  91. </script>
  92. <style scoped lang="scss">
  93. .tip {
  94. color: indianred;
  95. }
  96. .line {
  97. margin: 10px 0;
  98. background-color: gainsboro;
  99. height: 1px;
  100. }
  101. .el-row {
  102. margin-bottom: 0px;
  103. &:last-child {
  104. margin-bottom: 0;
  105. }
  106. }
  107. </style>