four.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="m-container">
  3. <div>
  4. <!-- <el-button type="primary">添加规则</el-button> -->
  5. <el-form :inline="true" :model="form" ref="form">
  6. <el-alert
  7. style="margin: 20px 0 40px"
  8. title="商品销售收款账户设置"
  9. :closable="false"
  10. type="info"
  11. >
  12. </el-alert>
  13. <el-row>
  14. 商品销售收款账户:
  15. <el-form-item
  16. prop="231"
  17. :rules="[
  18. {
  19. required: true,
  20. message: '请输入收款账户',
  21. },
  22. ]"
  23. >
  24. <el-input v-model="form['231']" placeholder="请输入收款账户">
  25. </el-input>
  26. </el-form-item>
  27. <el-button
  28. type="primary"
  29. @click="save"
  30. v-permission="'sysConfig/batchUpdate_dayaTeamRules'"
  31. >保存</el-button
  32. >
  33. </el-row>
  34. </el-form>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import {
  40. getSysTenantConfig,
  41. setSysTenantConfig,
  42. } from "@/views/courseRulersManager/api";
  43. import { sysConfigList, sysConfigUpdate } from "@/api/generalSettings"; // 平台的修改和查
  44. export default {
  45. props: ["isPlatform"],
  46. data() {
  47. return {
  48. form: {},
  49. questionList: [],
  50. rulesVisiable: false,
  51. };
  52. },
  53. async mounted() {
  54. this.getRules();
  55. },
  56. methods: {
  57. getRules() {
  58. if (this.isPlatform) {
  59. this.getPlatformRules();
  60. } else {
  61. this.getInstitutionRules();
  62. }
  63. },
  64. async getPlatformRules() {
  65. try {
  66. const res = await sysConfigList({ group: "COLLECTION" });
  67. res.data.forEach((item) => {
  68. // this.form[item.paramName] = item.paranValue
  69. this.$set(this.form, item.id, item.paranValue);
  70. });
  71. // this.$forceUpdate()
  72. // console.log(this.form);
  73. } catch (e) {
  74. console.log(e);
  75. }
  76. },
  77. async getInstitutionRules() {
  78. try {
  79. const res = await getSysTenantConfig({ group: "COLLECTION" });
  80. res.data.forEach((item) => {
  81. // this.form[item.paramName] = item.paranValue
  82. this.$set(this.form, item.id, item.paranValue);
  83. });
  84. // this.$forceUpdate()
  85. // console.log(this.form);
  86. } catch (e) {
  87. console.log(e);
  88. }
  89. },
  90. savePlatform() {
  91. this.$refs.form.validate(async (valid) => {
  92. if (valid) {
  93. let param = [];
  94. for (let i in this.form) {
  95. param.push({
  96. id: i,
  97. paranValue: this.form[i],
  98. });
  99. }
  100. try {
  101. const res = await sysConfigUpdate(param);
  102. this.$message.success("保存成功");
  103. this.getRules();
  104. } catch (e) {
  105. console.log(e);
  106. }
  107. }
  108. });
  109. },
  110. saveInstitution() {
  111. this.$refs.form.validate(async (valid) => {
  112. if (valid) {
  113. let param = [];
  114. for (let i in this.form) {
  115. param.push({
  116. id: i,
  117. paranValue: this.form[i],
  118. });
  119. }
  120. try {
  121. const res = await setSysTenantConfig(param);
  122. this.$message.success("保存成功");
  123. this.getRules();
  124. } catch (e) {
  125. console.log(e);
  126. }
  127. }
  128. });
  129. },
  130. save() {
  131. if (this.isPlatform) {
  132. this.savePlatform();
  133. } else {
  134. this.saveInstitution();
  135. }
  136. },
  137. },
  138. };
  139. </script>
  140. <style lang="scss" scoped>
  141. @import "~@scss/views/courseRulersManager/index.scss";
  142. </style>