data.config.ts 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. import type { VbenFormProps, VxeGridProps } from '#/adapter';
  2. import { LogApi } from '#/api';
  3. export const searchFormOptions: VbenFormProps = {
  4. schema: [
  5. {
  6. component: 'RangePicker',
  7. fieldName: '__date',
  8. label: '日期',
  9. componentProps: {
  10. format: 'YYYY-MM-DD HH:mm:ss',
  11. placeholder: ['开始时间', '结束时间'],
  12. showTime: { format: 'HH:mm:ss' },
  13. },
  14. },
  15. ],
  16. };
  17. export const gridOptions: VxeGridProps<LogApi.RecordItem> = {
  18. toolbarConfig: {
  19. refresh: true,
  20. print: false,
  21. export: false,
  22. zoom: true,
  23. custom: true,
  24. },
  25. columns: [
  26. { title: '序号', type: 'seq', width: 50 },
  27. { align: 'left', field: 'tableName', title: '表名', width: 120 },
  28. { align: 'left', field: 'columnName', title: '列名', width: 120 },
  29. { align: 'left', field: 'newValue', title: '新值', width: 100 },
  30. { align: 'left', field: 'oldValue', title: '旧值', width: 100 },
  31. { align: 'left', field: 'operate', title: '操作方式', width: 80 },
  32. { align: 'left', field: 'auditTime', title: '审计时间', width: 150 },
  33. { align: 'left', field: 'account', title: '账号', width: 100 },
  34. { align: 'left', field: 'realName', title: '姓名' },
  35. {
  36. field: 'action',
  37. fixed: 'right',
  38. slots: { default: 'action' },
  39. title: '操作',
  40. width: 100,
  41. },
  42. ],
  43. height: 'auto',
  44. keepSource: true,
  45. proxyConfig: {
  46. ajax: {
  47. query: async ({ page }, formValues) => {
  48. const postData = { ...formValues };
  49. if (postData.__date) {
  50. postData.startTime = postData.__date[0];
  51. postData.endTime = postData.__date[1];
  52. delete postData.__date;
  53. }
  54. return await LogApi.getAuditPage({
  55. pageIndex: page.currentPage,
  56. pageSize: page.pageSize,
  57. ...postData,
  58. });
  59. },
  60. },
  61. },
  62. };
  63. export const gridDifferenceOptions: VxeGridProps<LogApi.RecordItem> = {
  64. toolbarConfig: {
  65. refresh: true,
  66. print: false,
  67. export: false,
  68. zoom: true,
  69. custom: true,
  70. },
  71. columns: [
  72. { title: '序号', type: 'seq', width: 50 },
  73. {
  74. align: 'left',
  75. field: 'beforeData',
  76. title: '操作前记录',
  77. width: 150,
  78. showOverflow: true,
  79. },
  80. {
  81. align: 'left',
  82. field: 'afterData',
  83. title: '操作后记录',
  84. width: 150,
  85. showOverflow: true,
  86. },
  87. {
  88. align: 'left',
  89. field: 'sql',
  90. title: 'SQL',
  91. width: 100,
  92. showOverflow: true,
  93. },
  94. {
  95. align: 'left',
  96. field: 'parameters',
  97. title: '参数',
  98. showOverflow: true,
  99. },
  100. {
  101. align: 'left',
  102. field: 'businessData',
  103. title: '业务对象',
  104. width: 100,
  105. showOverflow: true,
  106. },
  107. {
  108. align: 'left',
  109. field: 'diffType',
  110. title: '差异操作',
  111. width: 80,
  112. },
  113. {
  114. align: 'left',
  115. field: 'elapsed',
  116. title: '耗时',
  117. width: 80,
  118. },
  119. ],
  120. height: 'auto',
  121. keepSource: true,
  122. proxyConfig: {
  123. ajax: {
  124. query: async ({ page }, formValues) => {
  125. const postData = { ...formValues };
  126. if (postData.__date) {
  127. postData.startTime = postData.__date[0];
  128. postData.endTime = postData.__date[1];
  129. delete postData.__date;
  130. }
  131. return await LogApi.getDifferencePage({
  132. pageIndex: page.currentPage,
  133. pageSize: page.pageSize,
  134. ...postData,
  135. });
  136. },
  137. },
  138. },
  139. };
  140. export const gridExceptionOptions: VxeGridProps<LogApi.RecordItem> = {
  141. toolbarConfig: {
  142. refresh: true,
  143. print: false,
  144. export: false,
  145. zoom: true,
  146. custom: true,
  147. },
  148. columns: [
  149. { title: '序号', type: 'seq', width: 50 },
  150. {
  151. align: 'left',
  152. field: 'httpMethod',
  153. title: '请求方式',
  154. width: 80,
  155. },
  156. {
  157. align: 'left',
  158. field: 'requestUrl',
  159. title: '请求地址',
  160. width: 250,
  161. showOverflow: true,
  162. },
  163. {
  164. align: 'left',
  165. field: 'requestParam',
  166. title: '请求参数',
  167. width: 100,
  168. showOverflow: true,
  169. },
  170. {
  171. align: 'left',
  172. field: 'returnResult',
  173. title: '返回结果',
  174. showOverflow: true,
  175. width: 200,
  176. },
  177. {
  178. align: 'left',
  179. field: 'exception',
  180. title: '异常信息',
  181. width: 150,
  182. showOverflow: true,
  183. },
  184. {
  185. align: 'left',
  186. field: 'message',
  187. title: '日志消息',
  188. showOverflow: true,
  189. },
  190. ],
  191. height: 'auto',
  192. keepSource: true,
  193. proxyConfig: {
  194. ajax: {
  195. query: async ({ page }, formValues) => {
  196. const postData = { ...formValues };
  197. if (postData.__date) {
  198. postData.startTime = postData.__date[0];
  199. postData.endTime = postData.__date[1];
  200. delete postData.__date;
  201. }
  202. return await LogApi.getExceptionPage({
  203. pageIndex: page.currentPage,
  204. pageSize: page.pageSize,
  205. ...postData,
  206. });
  207. },
  208. },
  209. },
  210. };
  211. export const gridOperateOptions: VxeGridProps<LogApi.RecordItem> = {
  212. toolbarConfig: {
  213. refresh: true,
  214. print: false,
  215. export: false,
  216. zoom: true,
  217. custom: true,
  218. },
  219. columns: [
  220. { title: '序号', type: 'seq', width: 50 },
  221. {
  222. align: 'left',
  223. field: 'httpMethod',
  224. title: '请求方式',
  225. width: 80,
  226. },
  227. {
  228. align: 'left',
  229. field: 'requestUrl',
  230. title: '请求地址',
  231. width: 250,
  232. showOverflow: true,
  233. },
  234. {
  235. align: 'left',
  236. field: 'requestParam',
  237. title: '请求参数',
  238. width: 100,
  239. showOverflow: true,
  240. },
  241. {
  242. align: 'left',
  243. field: 'returnResult',
  244. title: '返回结果',
  245. showOverflow: true,
  246. width: 200,
  247. },
  248. {
  249. align: 'left',
  250. field: 'exception',
  251. title: '异常信息',
  252. width: 150,
  253. showOverflow: true,
  254. },
  255. {
  256. align: 'left',
  257. field: 'message',
  258. title: '日志消息',
  259. showOverflow: true,
  260. },
  261. ],
  262. height: 'auto',
  263. keepSource: true,
  264. proxyConfig: {
  265. ajax: {
  266. query: async ({ page }, formValues) => {
  267. const postData = { ...formValues };
  268. if (postData.__date) {
  269. postData.startTime = postData.__date[0];
  270. postData.endTime = postData.__date[1];
  271. delete postData.__date;
  272. }
  273. return await LogApi.getOperatePage({
  274. pageIndex: page.currentPage,
  275. pageSize: page.pageSize,
  276. ...postData,
  277. });
  278. },
  279. },
  280. },
  281. };
  282. export const gridVisitOptions: VxeGridProps<LogApi.RecordItem> = {
  283. toolbarConfig: {
  284. refresh: true,
  285. print: false,
  286. export: false,
  287. zoom: true,
  288. custom: true,
  289. },
  290. columns: [
  291. { title: '序号', type: 'seq', width: 50 },
  292. {
  293. align: 'left',
  294. field: 'controllerName',
  295. title: '模块名称',
  296. width: 120,
  297. showOverflow: true,
  298. },
  299. {
  300. align: 'left',
  301. field: 'actionName',
  302. title: '方法名称',
  303. width: 120,
  304. showOverflow: true,
  305. },
  306. {
  307. align: 'left',
  308. field: 'displayTitle',
  309. title: '显示名称',
  310. width: 100,
  311. showOverflow: true,
  312. },
  313. {
  314. align: 'left',
  315. field: 'status',
  316. title: '执行状态',
  317. showOverflow: true,
  318. width: 80,
  319. },
  320. {
  321. align: 'left',
  322. field: 'remoteIp',
  323. title: 'IP地址',
  324. width: 80,
  325. showOverflow: true,
  326. },
  327. {
  328. align: 'left',
  329. field: 'location',
  330. title: '登录地点',
  331. width: 100,
  332. showOverflow: true,
  333. },
  334. {
  335. align: 'left',
  336. field: 'browser',
  337. title: '浏览器',
  338. showOverflow: true,
  339. width: 100,
  340. },
  341. {
  342. align: 'left',
  343. field: 'elapsed',
  344. title: '操作用时',
  345. width: 80,
  346. showOverflow: true,
  347. },
  348. {
  349. align: 'left',
  350. field: 'logDateTime',
  351. title: '日志时间',
  352. width: 120,
  353. showOverflow: true,
  354. },
  355. {
  356. align: 'left',
  357. field: 'account',
  358. title: '账号',
  359. width: 120,
  360. showOverflow: true,
  361. },
  362. {
  363. align: 'left',
  364. field: 'realName',
  365. title: '姓名',
  366. width: 120,
  367. },
  368. ],
  369. height: 'auto',
  370. keepSource: true,
  371. proxyConfig: {
  372. ajax: {
  373. query: async ({ page }, formValues) => {
  374. const postData = { ...formValues };
  375. if (postData.__date) {
  376. postData.startTime = postData.__date[0];
  377. postData.endTime = postData.__date[1];
  378. delete postData.__date;
  379. }
  380. return await LogApi.getVisitPage({
  381. pageIndex: page.currentPage,
  382. pageSize: page.pageSize,
  383. ...postData,
  384. });
  385. },
  386. },
  387. },
  388. };