configurationLedger.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <basic-container>
  3. <avue-crud :data="data" :option="option" :page.sync="page" @on-load="onLoad" @row-del="rowDel" @row-save="rowSave"
  4. @row-update="rowUpdate" @search-change="searchChange" @refresh-change="refreshChange" v-model="form">
  5. <template slot-scope="{type,disabled}" slot="isEnableForm">
  6. <el-switch v-model="form.isEnable" :active-value="1" :inactive-value="0" />
  7. </template>
  8. </avue-crud>
  9. </basic-container>
  10. </template>
  11. <script>
  12. import { customerList, jdmoduleDelete, jdmoduleSave, jdmoduleUpdate } from "@/api/system/configurationLedger";
  13. export default {
  14. name: "configurationLedger",
  15. data() {
  16. return {
  17. data: [],
  18. form: {},
  19. page: {
  20. size: 10,
  21. current: 1
  22. },
  23. option: {
  24. index: true,
  25. searchMenuPosition: "right",
  26. searchMenuSpan: 12,
  27. align: 'center',
  28. menuAlign: 'center',
  29. column: [
  30. {
  31. label: "所属租户",
  32. prop: "tenantId",
  33. type: "tree",
  34. dicUrl: "/api/blade-system/tenant/select",
  35. props: {
  36. label: "tenantName",
  37. value: "tenantId"
  38. },
  39. search: true,
  40. rules: [{
  41. required: true,
  42. message: " ",
  43. trigger: "click"
  44. }]
  45. }, {
  46. label: '账户名称',
  47. prop: 'accountName',
  48. search: true
  49. }, {
  50. label: '客户ID',
  51. prop: 'clientId'
  52. }, {
  53. label: '客户密钥',
  54. prop: 'clientSecret'
  55. }, {
  56. label: '客户帐号',
  57. prop: 'username'
  58. }, {
  59. label: '帐号密码',
  60. prop: 'password'
  61. }, {
  62. label: '是否启用',
  63. prop: 'isEnable',
  64. formatter: (val, value, label) => {
  65. console.log(val, value, label)
  66. if (value == '1') {
  67. return '是'
  68. } else {
  69. return '否'
  70. }
  71. }
  72. }
  73. ]
  74. }
  75. }
  76. },
  77. methods: {
  78. //列表查询
  79. onLoad(page, params) {
  80. customerList({ ...params, size: page.size, current: page.current }).then(res => {
  81. this.data = res.data.data.records
  82. this.page.total = res.data.data.total
  83. })
  84. },
  85. //刷新按钮触发
  86. refreshChange() {
  87. this.onLoad(this.page);
  88. },
  89. //表单搜索按钮触发
  90. searchChange(params, done) {
  91. this.page.currentPage = 1;
  92. this.onLoad(this.page, params);
  93. done()
  94. },
  95. //新增
  96. rowSave(row, done, loading) {
  97. jdmoduleSave(row).then(() => {
  98. this.$message.success('新增成功');
  99. this.onLoad(this.page);
  100. loading()
  101. done()
  102. })
  103. },
  104. //编辑
  105. rowUpdate(row, index, done, loading) {
  106. jdmoduleUpdate(row).then(() => {
  107. this.$message.success('修改成功');
  108. this.onLoad(this.page);
  109. loading()
  110. done()
  111. })
  112. },
  113. //删除
  114. rowDel(row, index, done) {
  115. jdmoduleDelete(row.id).then(() => {
  116. this.$message.success('删除成功');
  117. done()
  118. })
  119. }
  120. }
  121. }
  122. </script>
  123. <style scoped>
  124. </style>