index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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 t(`routes.equity.operation.${record.operationType || 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: 'operationType',
  85. component: 'Select',
  86. label: t('routes.equity.operationType'),
  87. colProps: {
  88. xl: 7,
  89. xxl: 7,
  90. },
  91. componentProps: {
  92. options: [
  93. {
  94. label: t('routes.equity.operation.0'),
  95. value: 0,
  96. key: '0',
  97. },{
  98. label: t('routes.equity.operation.1'),
  99. value: 1,
  100. key: '1',
  101. },{
  102. label: t('routes.equity.operation.2'),
  103. value: 2,
  104. key: '2',
  105. },{
  106. label: t('routes.equity.operation.3'),
  107. value: 3,
  108. key: '3',
  109. }
  110. ],
  111. },
  112. },{
  113. field: 'snCode',
  114. component: 'Input',
  115. label: t('routes.device.snCode'),
  116. colProps: {
  117. xl: 7,
  118. xxl: 7,
  119. },
  120. },
  121. {
  122. field: 'incrementTypeId',
  123. component: 'ApiSelect',
  124. label: t('routes.equity.Type'),
  125. componentProps: {
  126. maxLength: 50,
  127. api: async function () {
  128. const list = await dincrementList();
  129. return list.map((ele) => {
  130. return { name: t(`routes.finance.equityType.${ele.validTimeType}`), value: ele.id };
  131. });
  132. },
  133. numberToString: true,
  134. labelField: 'name',
  135. valueField: 'value',
  136. immediate: true,
  137. },
  138. colProps: {
  139. xl: 7,
  140. xxl: 7,
  141. },
  142. },
  143. {
  144. field: 'operationUserName',
  145. component: 'Input',
  146. label: t('routes.equity.operationUserName'),
  147. colProps: {
  148. xl: 7,
  149. xxl: 7,
  150. },
  151. },
  152. {
  153. field: 'timeList',
  154. label: t('routes.equity.operationTime'),
  155. component: 'RangePicker',
  156. componentProps: {
  157. maxLength: 100,
  158. format: 'YYYY-MM-DD',
  159. valueFormat: 'YYYY-MM-DD',
  160. showTime: true,
  161. },
  162. colProps: {
  163. xl: 7,
  164. xxl: 7,
  165. },
  166. },
  167. ],
  168. };
  169. const [registerTable, { reload }] = useTable({
  170. api: cameraIncrementLog,
  171. columns: columns,
  172. useSearchForm: true,
  173. formConfig: searchForm,
  174. showTableSetting: true,
  175. showIndexColumn: false,
  176. rowKey: 'id',
  177. beforeFetch: (T) => {
  178. if (T.ctivated) {
  179. T.activatedStartTime = T.ctivated[0];
  180. T.activatedEndTime = T.ctivated[1];
  181. }
  182. return T;
  183. },
  184. fetchSetting: {
  185. pageField: 'pageNum',
  186. sizeField: 'pageSize',
  187. listField: 'list',
  188. totalField: 'total',
  189. },
  190. canResize: false,
  191. });
  192. return {
  193. registerTable,
  194. reload,
  195. getCheckPerm,
  196. };
  197. },
  198. });
  199. </script>
  200. <style lang="less" scoped>
  201. .desc-wrap-BasicTable {
  202. background-color: #f0f2f5;
  203. .vben-basic-table-form-container {
  204. padding: 0;
  205. }
  206. }
  207. </style>