list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="p-4">
  3. <BasicTable @register="registerTable">
  4. <template #toolbar> </template>
  5. <template #feedType="{ record }">
  6. {{ renderFeedbackType(record.feedType) }}
  7. </template>
  8. <template #addTime="{ record }">
  9. <Time :value="record.addTime" mode="datetime" />
  10. </template>
  11. <template #action="{ record }">
  12. <TableAction
  13. :actions="[
  14. {
  15. icon: 'mdi:information-outline',
  16. label: '详情',
  17. onClick: () => {
  18. go(`/order/list/detail/${record.orderNo}`);
  19. },
  20. },
  21. {
  22. icon: 'mdi:printer-outline',
  23. label: '打印',
  24. color: 'error',
  25. onClick: () => {
  26. createMessage.info(`暂未接入`);
  27. },
  28. },
  29. ]"
  30. />
  31. </template>
  32. </BasicTable>
  33. </div>
  34. </template>
  35. <script lang="ts">
  36. import { defineComponent } from 'vue';
  37. import { BasicTable, useTable, BasicColumn, FormProps, TableAction } from '/@/components/Table';
  38. import { useMessage } from '/@/hooks/web/useMessage';
  39. import { uploadApi } from '/@/api/sys/upload';
  40. // import { Switch } from 'ant-design-vue';
  41. // import { h } from 'vue';
  42. import { ListApi } from '/@/api/feedback/list';
  43. import { useI18n } from '/@/hooks/web/useI18n';
  44. // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
  45. import { useGo } from '/@/hooks/web/usePage';
  46. import { Time } from '/@/components/Time';
  47. export default defineComponent({
  48. components: { BasicTable, TableAction, Time },
  49. setup() {
  50. const { createMessage } = useMessage();
  51. const go = useGo();
  52. const { t } = useI18n();
  53. const columns: BasicColumn[] = [
  54. // {
  55. // title: 'ID',
  56. // dataIndex: 'userId',
  57. // fixed: 'left',
  58. // width: 60,
  59. // },
  60. {
  61. title: '会员名称',
  62. dataIndex: 'userName',
  63. width: 160,
  64. },
  65. {
  66. title: '会员昵称',
  67. dataIndex: 'nickName',
  68. width: 80,
  69. },
  70. {
  71. title: '手机',
  72. dataIndex: 'mobile',
  73. width: 80,
  74. },
  75. {
  76. title: '反馈类型',
  77. dataIndex: 'feedType',
  78. slots: { customRender: 'feedType' },
  79. sorter: true,
  80. width: 80,
  81. },
  82. {
  83. title: '详细内容',
  84. dataIndex: 'content',
  85. width: 250,
  86. },
  87. {
  88. title: '反馈时间',
  89. dataIndex: 'addTime',
  90. slots: { customRender: 'addTime' },
  91. width: 130,
  92. },
  93. // {
  94. // title: '操作',
  95. // dataIndex: '',
  96. // slots: { customRender: 'action' },
  97. // fixed: 'right',
  98. // width: 140,
  99. // },
  100. ];
  101. const searchForm: Partial<FormProps> = {
  102. labelWidth: 100,
  103. schemas: [
  104. {
  105. field: 'name',
  106. label: '会员名称',
  107. component: 'Input',
  108. colProps: {
  109. xl: 5,
  110. xxl: 5,
  111. },
  112. componentProps: {
  113. maxLength: 100,
  114. },
  115. },
  116. ],
  117. };
  118. const [registerTable] = useTable({
  119. title: '反馈列表',
  120. api: ListApi,
  121. columns: columns,
  122. useSearchForm: true,
  123. formConfig: searchForm,
  124. showTableSetting: true,
  125. tableSetting: { fullScreen: true },
  126. showIndexColumn: false,
  127. // rowKey: 'userId',
  128. pagination: { pageSize: 20 },
  129. bordered: true,
  130. sortFn: (sortInfo) => {
  131. let order = sortInfo.order && sortInfo.order.replace('end', '');
  132. return { ...sortInfo, sidx: sortInfo.field, order: order };
  133. },
  134. fetchSetting: {
  135. pageField: 'page',
  136. sizeField: 'limit',
  137. listField: 'list',
  138. totalField: 'totalCount',
  139. },
  140. });
  141. function renderFeedbackType(type: number): string {
  142. switch (type) {
  143. case 0:
  144. return '商口相关';
  145. case 1:
  146. return '物流状况';
  147. case 2:
  148. return '客户服务';
  149. case 3:
  150. return '产品建议';
  151. case 4:
  152. return '其他';
  153. default:
  154. return '';
  155. }
  156. }
  157. return {
  158. registerTable,
  159. createMessage,
  160. t,
  161. go,
  162. renderFeedbackType,
  163. uploadApi: uploadApi as any,
  164. };
  165. },
  166. });
  167. </script>