index.vue 5.1 KB

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