index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. valueFormat:'YYYY-MM-DD',
  101. format: 'YYYY-MM-DD',
  102. },
  103. colProps: {
  104. xl: 7,
  105. xxl: 7,
  106. },
  107. },
  108. {
  109. field: 'sceneName',
  110. label: '支付时间',
  111. component: 'RangePicker',
  112. componentProps: {
  113. valueFormat:'YYYY-MM-DD',
  114. format: 'YYYY-MM-DD',
  115. maxLength: 100,
  116. },
  117. colProps: {
  118. xl: 7,
  119. xxl: 7,
  120. },
  121. },{
  122. field: 'sceneName',
  123. label: '订单号',
  124. component: 'Input',
  125. componentProps: {
  126. maxLength: 100,
  127. },
  128. colProps: {
  129. xl: 6,
  130. xxl: 6,
  131. },
  132. }
  133. ],
  134. };
  135. const [registerTable,{reload}] = useTable({
  136. api: AppFileList,
  137. title: 'App列表',
  138. // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
  139. columns: columns,
  140. useSearchForm: true,
  141. formConfig: searchForm,
  142. showTableSetting: true,
  143. showIndexColumn:false,
  144. rowKey: 'id',
  145. fetchSetting: {
  146. pageField: 'pageNum',
  147. sizeField: 'pageSize',
  148. listField: 'list',
  149. totalField: 'total',
  150. },
  151. actionColumn: {
  152. width: 100,
  153. title: '操作',
  154. dataIndex: 'action',
  155. slots: { customRender: 'action' },
  156. },
  157. canResize: false,
  158. });
  159. function handleDelete(record: Recordable) {
  160. createConfirm({
  161. iconType: 'warning',
  162. title: () => h('span', '温馨提示'),
  163. content: () => h('span', '确定当删除当前记录?'),
  164. onOk: async () => {
  165. await AppFileDelete({ id: record.id });
  166. createMessage.success(t('common.optSuccess'));
  167. reload();
  168. },
  169. });
  170. }
  171. function handleOpen(record: Recordable) {
  172. console.log('点击了启用', record);
  173. }
  174. function exportExcel() {
  175. createConfirm({
  176. iconType: 'warning',
  177. title: () => h('span', '温馨提示'),
  178. content: () => h('span', '确定当前标签下的订单记录?'),
  179. onOk: async () => {
  180. await DownExport();
  181. },
  182. });
  183. }
  184. return {
  185. registerTable,
  186. handleDelete,
  187. handleOpen,
  188. registerAddModal,
  189. openAddModal,
  190. exportExcel,
  191. reload,
  192. getCheckPerm,
  193. };
  194. },
  195. });
  196. </script>