index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div class="desc-wrap-BasicTable">
  3. <BasicTable @register="registerTable"> </BasicTable>
  4. </div>
  5. </template>
  6. <script lang="ts">
  7. import { defineComponent, onMounted } from 'vue';
  8. import {
  9. BasicTable,
  10. useTable,
  11. TableAction,
  12. BasicColumn,
  13. TableImg,
  14. FormProps,
  15. } from '/@/components/Table';
  16. import { useI18n } from '/@/hooks/web/useI18n';
  17. import { usePermissionStore } from '/@/store/modules/permission';
  18. import { dincrementList, cameraIncrementLog } from '/@/api/equity';
  19. export default defineComponent({
  20. components: {
  21. BasicTable,
  22. TableAction,
  23. TableImg,
  24. },
  25. setup() {
  26. const { t } = useI18n();
  27. const permissionStore = usePermissionStore();
  28. const { getCheckPerm } = permissionStore;
  29. onMounted(() => {
  30. // console.log(router.currentRoute.value.params.id);
  31. });
  32. const columns: BasicColumn[] = [
  33. {
  34. title: t('routes.equity.operationType'),
  35. dataIndex: 'operationType',
  36. width: 80,
  37. customRender: ({ record }) => {
  38. return record.operationType?t('routes.equity.operation.1'):t('routes.equity.operation.0');
  39. },
  40. },{
  41. title: t('routes.device.snCode'),
  42. dataIndex: 'snCode',
  43. width: 100,
  44. },
  45. {
  46. title: t('routes.equity.operationUserName'),
  47. dataIndex: 'operationUserName',
  48. ellipsis: false,
  49. width: 120,
  50. customRender: ({ record }) => {
  51. return record.operationUserName || t('routes.equity.platform');
  52. },
  53. },
  54. {
  55. title: t('routes.equity.operationTime'),
  56. dataIndex: 'createTime',
  57. width: 180,
  58. },
  59. {
  60. title: t('routes.equity.Type'),
  61. dataIndex: 'validTimeType',
  62. width: 180,
  63. customRender({ record }) {
  64. return record.validTimeType==0 ?t('routes.equity.equityType.0'):record.validTimeType==1? t('routes.equity.equityType.3') : t('routes.device.NoBind');
  65. },
  66. },
  67. {
  68. title: t('routes.equity.incrementId'),
  69. dataIndex: 'incrementId',
  70. width: 180,
  71. // customRender({ record }) {
  72. // return record.userName ? record.userName : '-';
  73. // },
  74. },
  75. ];
  76. const searchForm: Partial<FormProps> = {
  77. labelWidth: 120,
  78. autoAdvancedLine: 1,
  79. actionColOptions: {
  80. span: 24,
  81. },
  82. schemas: [
  83. {
  84. field: 'snCode',
  85. component: 'Input',
  86. label: t('routes.device.snCode'),
  87. colProps: {
  88. xl: 7,
  89. xxl: 7,
  90. },
  91. },
  92. {
  93. field: 'operationType',
  94. component: 'Select',
  95. label: t('routes.equity.operationType'),
  96. colProps: {
  97. xl: 7,
  98. xxl: 7,
  99. },
  100. componentProps: {
  101. options: [
  102. {
  103. label: t('routes.equity.operation.0'),
  104. value: 0,
  105. key: '0',
  106. },{
  107. label: t('routes.equity.operation.1'),
  108. value: 1,
  109. key: '1',
  110. }
  111. ],
  112. },
  113. },
  114. {
  115. field: 'incrementTypeId',
  116. component: 'ApiSelect',
  117. label: t('routes.equity.Type'),
  118. componentProps: {
  119. maxLength: 50,
  120. api: async function () {
  121. const list = await dincrementList();
  122. return list.map((ele) => {
  123. return { name: t(`routes.finance.equityType.${ele.validTimeType}`), value: ele.id };
  124. });
  125. },
  126. numberToString: true,
  127. labelField: 'name',
  128. valueField: 'value',
  129. immediate: true,
  130. },
  131. colProps: {
  132. xl: 7,
  133. xxl: 7,
  134. },
  135. },
  136. {
  137. field: 'operationUserName',
  138. component: 'Input',
  139. label: t('routes.equity.operationUserName'),
  140. colProps: {
  141. xl: 7,
  142. xxl: 7,
  143. },
  144. },
  145. {
  146. field: 'timeList',
  147. label: t('routes.equity.operationTime'),
  148. component: 'RangePicker',
  149. componentProps: {
  150. maxLength: 100,
  151. format: 'YYYY-MM-DD',
  152. valueFormat: 'YYYY-MM-DD',
  153. showTime: true,
  154. },
  155. colProps: {
  156. xl: 7,
  157. xxl: 7,
  158. },
  159. },
  160. ],
  161. };
  162. const [registerTable, { reload }] = useTable({
  163. api: cameraIncrementLog,
  164. columns: columns,
  165. useSearchForm: true,
  166. formConfig: searchForm,
  167. showTableSetting: true,
  168. showIndexColumn: false,
  169. rowKey: 'id',
  170. beforeFetch: (T) => {
  171. if (T.ctivated) {
  172. T.activatedStartTime = T.ctivated[0];
  173. T.activatedEndTime = T.ctivated[1];
  174. }
  175. return T;
  176. },
  177. fetchSetting: {
  178. pageField: 'pageNum',
  179. sizeField: 'pageSize',
  180. listField: 'list',
  181. totalField: 'total',
  182. },
  183. canResize: false,
  184. });
  185. return {
  186. registerTable,
  187. reload,
  188. getCheckPerm,
  189. };
  190. },
  191. });
  192. </script>
  193. <style lang="less" scoped>
  194. .desc-wrap-BasicTable {
  195. background-color: #f0f2f5;
  196. .vben-basic-table-form-container {
  197. padding: 0;
  198. }
  199. }
  200. </style>