index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <BasicTable @register="registerTable">
  3. <template #toolbar>
  4. <a-button type="primary" v-if="getCheckPerm('app-add')" @click="()=>{openAddModal(true)}"> 新建</a-button>
  5. </template>
  6. <template #action="{ record }">
  7. <TableAction
  8. :actions="[
  9. {
  10. label: '删除',
  11. icon: 'ic:outline-delete-outline',
  12. ifShow: getCheckPerm('app-delete'),
  13. onClick: handleDelete.bind(null, record),
  14. },
  15. ]"
  16. />
  17. </template>
  18. </BasicTable>
  19. <AddModal @update="reload" @register="registerAddModal" />
  20. </template>
  21. <script lang="ts">
  22. import { defineComponent, h } from 'vue';
  23. import { BasicTable, useTable, TableAction, BasicColumn, TableImg, FormProps } from '/@/components/Table';
  24. import { PageWrapper } from '/@/components/Page';
  25. import { Time } from '/@/components/Time';
  26. import { Descriptions } from 'ant-design-vue';
  27. import { useI18n } from '/@/hooks/web/useI18n';
  28. import { useMessage } from '/@/hooks/web/useMessage';
  29. import { AppFileList,AppFileDelete } from '/@/api/product'
  30. import { useModal } from '/@/components/Modal';
  31. import AddModal from './AddModal.vue';
  32. import { usePermissionStore } from '/@/store/modules/permission';
  33. export default defineComponent({
  34. components: {
  35. BasicTable,
  36. TableAction,
  37. PageWrapper,
  38. AddModal,
  39. TableImg,
  40. [Descriptions.name]: Descriptions,
  41. [Descriptions.Item.name]: Descriptions.Item,
  42. },
  43. setup() {
  44. const { t } = useI18n();
  45. const permissionStore = usePermissionStore();
  46. const { getCheckPerm } = permissionStore;
  47. const { createMessage,createConfirm } = useMessage();
  48. const [registerAddModal, { openModal: openAddModal }] = useModal();
  49. const columns: BasicColumn[] = [
  50. {
  51. title: '上传服务器',
  52. dataIndex: 'fileServerType',
  53. ellipsis: false,
  54. width: 80,
  55. },
  56. {
  57. title: '代理商标识',
  58. dataIndex: 'agent',
  59. width: 80,
  60. },{
  61. title: 'APP类型',
  62. dataIndex: 'appType',
  63. ellipsis: false,
  64. width: 100,
  65. },
  66. {
  67. title: 'APP包',
  68. dataIndex: 'name',
  69. width: 150,
  70. },{
  71. title: 'MD5',
  72. dataIndex: 'md5',
  73. ellipsis: false,
  74. width: 250,
  75. },
  76. {
  77. title: '时间',
  78. dataIndex: 'createTime',
  79. width: 150,
  80. customRender: ({ record }) => {
  81. return (
  82. record.createTime &&
  83. h(Time, {
  84. value: record.createTime,
  85. mode: 'datetime',
  86. })
  87. );
  88. },
  89. },
  90. ];
  91. const searchForm: Partial<FormProps> = {
  92. labelWidth: 100,
  93. schemas: [
  94. {
  95. field: 'sceneName',
  96. label: '开票申请时间',
  97. component: 'RangePicker',
  98. componentProps: {
  99. maxLength: 100,
  100. },
  101. colProps: {
  102. xl: 7,
  103. xxl: 7,
  104. },
  105. },
  106. {
  107. field: 'sceneName',
  108. label: '支付时间',
  109. component: 'RangePicker',
  110. componentProps: {
  111. maxLength: 100,
  112. },
  113. colProps: {
  114. xl: 7,
  115. xxl: 7,
  116. },
  117. },{
  118. field: 'sceneName',
  119. label: '订单号',
  120. component: 'Input',
  121. componentProps: {
  122. maxLength: 100,
  123. },
  124. colProps: {
  125. xl: 6,
  126. xxl: 6,
  127. },
  128. }
  129. ],
  130. };
  131. const [registerTable,{reload}] = useTable({
  132. api: AppFileList,
  133. title: 'App列表',
  134. // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
  135. columns: columns,
  136. useSearchForm: true,
  137. formConfig: searchForm,
  138. showTableSetting: true,
  139. showIndexColumn:false,
  140. rowKey: 'id',
  141. fetchSetting: {
  142. pageField: 'pageNum',
  143. sizeField: 'pageSize',
  144. listField: 'list',
  145. totalField: 'total',
  146. },
  147. actionColumn: {
  148. width: 100,
  149. title: '操作',
  150. dataIndex: 'action',
  151. slots: { customRender: 'action' },
  152. },
  153. canResize: false,
  154. });
  155. function handleDelete(record: Recordable) {
  156. createConfirm({
  157. iconType: 'warning',
  158. title: () => h('span', '温馨提示'),
  159. content: () => h('span', '确定当删除当前记录?'),
  160. onOk: async () => {
  161. await AppFileDelete({ id: record.id });
  162. createMessage.success(t('common.optSuccess'));
  163. reload();
  164. },
  165. });
  166. }
  167. function handleOpen(record: Recordable) {
  168. console.log('点击了启用', record);
  169. }
  170. function exportExcel() {
  171. createConfirm({
  172. iconType: 'warning',
  173. title: () => h('span', '温馨提示'),
  174. content: () => h('span', '确定当前标签下的订单记录?'),
  175. onOk: async () => {
  176. await DownExport();
  177. },
  178. });
  179. }
  180. return {
  181. registerTable,
  182. handleDelete,
  183. handleOpen,
  184. registerAddModal,
  185. openAddModal,
  186. exportExcel,
  187. reload,
  188. getCheckPerm,
  189. };
  190. },
  191. });
  192. </script>