index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table
  4. ref="crudRef"
  5. :options="options"
  6. :columns="columns"
  7. :searchForm="searchForm"
  8. >
  9. <!-- 搜索区 tableSearch -->
  10. <template #tableSearch>
  11. <a-col :sm="8" :xs="24">
  12. <a-form-item label="媒体id" field="id">
  13. <a-input
  14. v-model="searchForm.id"
  15. placeholder="请输入媒体id"
  16. allow-clear
  17. />
  18. </a-form-item>
  19. </a-col>
  20. <a-col :sm="8" :xs="24">
  21. <a-form-item label="媒体名称" field="name">
  22. <a-input
  23. v-model="searchForm.name"
  24. placeholder="请输入媒体名称"
  25. allow-clear
  26. />
  27. </a-form-item>
  28. </a-col>
  29. <a-col :sm="8" :xs="24">
  30. <a-form-item label="媒体渠道简称" field="channel_name">
  31. <a-input
  32. v-model="searchForm.channel_name"
  33. placeholder="请输入媒体渠道简称"
  34. allow-clear
  35. />
  36. </a-form-item>
  37. </a-col>
  38. </template>
  39. <!-- Table 自定义渲染 -->
  40. </sa-table>
  41. <!-- 编辑表单 -->
  42. <edit-form ref="editRef" @success="refresh" />
  43. </div>
  44. </template>
  45. <script setup>
  46. import { onMounted, ref, reactive } from "vue";
  47. import { Message } from "@arco-design/web-vue";
  48. import EditForm from "./edit.vue";
  49. import api from "../../api/advert/mediaList";
  50. // 引用定义
  51. const crudRef = ref();
  52. const editRef = ref();
  53. const viewRef = ref();
  54. // 搜索表单
  55. const searchForm = ref({
  56. id: "",
  57. name: "",
  58. channel_name: "",
  59. });
  60. // SaTable 基础配置
  61. const options = reactive({
  62. api: api.getPageList,
  63. rowSelection: { showCheckedAll: true },
  64. add: {
  65. show: true,
  66. auth: ["/v1/advert/MediaList/save"],
  67. func: async () => {
  68. editRef.value?.open();
  69. },
  70. },
  71. edit: {
  72. show: true,
  73. auth: ["/v1/advert/MediaList/update"],
  74. func: async (record) => {
  75. editRef.value?.open("edit");
  76. editRef.value?.setFormData(record);
  77. },
  78. },
  79. delete: {
  80. show: true,
  81. auth: ["/v1/advert/MediaList/destroy"],
  82. func: async (params) => {
  83. const resp = await api.destroy(params);
  84. if (resp.code === 200) {
  85. Message.success(`删除成功!`);
  86. crudRef.value?.refresh();
  87. }
  88. },
  89. },
  90. });
  91. // SaTable 列配置
  92. const columns = reactive([
  93. { title: "媒体id", dataIndex: "id", width: 180 },
  94. { title: "媒体名称", dataIndex: "name", width: 180 },
  95. { title: "媒体渠道简称", dataIndex: "channel_name", width: 180 },
  96. { title: "安卓监测链接", dataIndex: "andurl", width: 180 },
  97. { title: "ios监测链接", dataIndex: "iosurl", width: 180 },
  98. { title: "小游戏监测链接", dataIndex: "xyxurl", width: 180 },
  99. { title: "小游戏路径参数补充", dataIndex: "appleturl", width: 180 },
  100. {
  101. title: "状态",
  102. dataIndex: "status",
  103. type: "dict",
  104. dict: "nomal_or_stop",
  105. width: 120,
  106. },
  107. ]);
  108. // 页面数据初始化
  109. const initPage = async () => {};
  110. // SaTable 数据请求
  111. const refresh = async () => {
  112. crudRef.value?.refresh();
  113. };
  114. // 页面加载完成执行
  115. onMounted(async () => {
  116. initPage();
  117. refresh();
  118. });
  119. </script>