tOperatingLogList.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. var lib = new DirewolfLibrary()
  2. // 查询参数初始值,重置按钮将使用该值
  3. var defaultParams = JSON.stringify({
  4. operTime: '',
  5. operTimeRange: [], // ['2018-10-01', '2018-10-30']
  6. operPerAccount: '',
  7. operModule: '',
  8. operAction: '',
  9. operUrl: '',
  10. operContractCode: '',
  11. operPurchaseApplyCode: '',
  12. operOrderCode: '',
  13. limit: 5,
  14. offset: 0,
  15. order: '',
  16. sort: '',
  17. })
  18. // eslint-disable-next-line no-new
  19. new window.Vue({
  20. el: '#app',
  21. data: function () {
  22. return {
  23. /**
  24. * 微服务配置
  25. */
  26. msConfig: window.__CONTRACT_CONFIG__,
  27. /**
  28. * 页面加载状态
  29. */
  30. tOperatingLogPageLoading: true,
  31. /**
  32. * 查询参数,包含表格分页参数
  33. */
  34. searchParams: JSON.parse(defaultParams), // 拷贝初始值
  35. /**
  36. * 超过两行的查询条件是否可见
  37. */
  38. extraQueriesVisible: false, // 默认不可见
  39. /**
  40. * 页面编辑类型,为view时工具栏及操作列不出现
  41. */
  42. editType: lib.$$utils.getQueryString('editType'),
  43. /**
  44. * 日志信息表格分页数据
  45. */
  46. tOperatingLogTablePage: {},
  47. /**
  48. * 日志信息表格加载状态
  49. */
  50. tOperatingLogTableLoading: true,
  51. //testFF:''
  52. }
  53. },
  54. computed: {
  55. formBaseUrl: function () {
  56. return lib.$$utils.router.getRelativePath() + 'tOperatingLogForm.html'
  57. },
  58. requestPrefix: function () {
  59. return this.msConfig['gatewayRoute'] + this.msConfig['direwolfAdmin']
  60. },
  61. tOperatingLogPrefix: function () {
  62. return this.msConfig['gatewayRoute'] + this.msConfig['direwolfAdmin'] + '/contract/common/tOperatingLog'
  63. },
  64. },
  65. methods: {
  66. /**
  67. * 刷新表格,重新获取数据
  68. */
  69. refreshTable: function () {
  70. var vm = this
  71. if (!vm.msConfig.gatewayRoute) {
  72. return
  73. }
  74. vm.tOperatingLogTableLoading = true
  75. lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/getTOperatingLogList',
  76. '获取日志信息记录', 'GET', vm.searchParams)
  77. .then(function (result) {
  78. vm.tOperatingLogTablePage = result
  79. vm.tOperatingLogTableLoading = false
  80. })
  81. },
  82. /**
  83. * 重置按钮点击事件
  84. */
  85. resetSearchParam: function () {
  86. this.searchParams = JSON.parse(defaultParams)
  87. this.refreshTable()
  88. },
  89. /**
  90. * 切换超出两行的查询条件显示隐藏
  91. */
  92. toggleExtraQueries: function () {
  93. this.extraQueriesVisible = !this.extraQueriesVisible
  94. },
  95. /**
  96. * 表格行点击事件
  97. * @param row 行数据
  98. * @param event 原生事件
  99. * @param column 点击位置所属列
  100. */
  101. handleRowClick: function (row, event, column) {
  102. lib.$$utils.eleTableClickSelection(this.$refs.tOperatingLogTable, row, column)
  103. },
  104. /**
  105. * 分页大小切换事件
  106. * @param val 新值
  107. */
  108. handleTableSizeChange: function (val) {
  109. this.searchParams.limit = val
  110. this.refreshTable()
  111. },
  112. /**
  113. * 页码切换事件
  114. * @param val 新页码
  115. */
  116. handleTableCurrentChange: function (val) {
  117. this.searchParams.offset = this.searchParams.limit * (val - 1)
  118. this.refreshTable()
  119. },
  120. /**
  121. * 排序变更事件
  122. * @param scope 组件参数
  123. */
  124. handleSortChange: function (scope) {
  125. // 排序取消则使用初始参数
  126. if (scope.prop === null) {
  127. this.searchParams.sort = defaultParams.sort
  128. this.searchParams.order = defaultParams.order
  129. } else {
  130. this.searchParams.sort = scope.prop
  131. // 组件传递的order格式为'descending'/'ascending'
  132. this.searchParams.order = scope.order.split('ending')[0]
  133. }
  134. this.refreshTable()
  135. },
  136. /**
  137. * 打开表单对话框
  138. * @param props 表单参数
  139. */
  140. showTOperatingLogFormDialog: function (props) {
  141. var vm = this
  142. lib.$$utils.openLayerDialog({
  143. el: 'tOperatingLogForm',
  144. url: vm.formBaseUrl,
  145. showConfirmButton: props.editType && props.editType !== 'view',
  146. props: props,
  147. title: lib.$$utils.getEditTypeName(props.editType) + '日志信息',
  148. onConfirm: function (formVm, success) {
  149. if (props.editType !== 'view') {
  150. formVm.$parent.save(function () {
  151. vm.refreshTable()
  152. success()
  153. })
  154. } else {
  155. success()
  156. }
  157. },
  158. })
  159. },
  160. /**
  161. * 新增记录
  162. */
  163. addNewTOperatingLog: function () { // 新增记录
  164. this.showTOperatingLogFormDialog({ editType: 'add' })
  165. },
  166. /**
  167. * 删除选中记录
  168. */
  169. deleteSelectedTOperatingLog: function () {
  170. var vm = this
  171. var selections = vm.$refs.tOperatingLogTable.selection
  172. if (selections.length === 0) {
  173. lib.$$utils.direwolfCommonTips('warning', '请选择要删除的记录')
  174. return
  175. }
  176. lib.$$utils.direwolfCommonConfirm({
  177. title: '删除提醒',
  178. message: '数据删除后不可恢复,确定继续删除吗?',
  179. }, function () {
  180. var ids = []
  181. selections.forEach(function (select) {
  182. if (select.id) {
  183. ids.push(select.id)
  184. }
  185. })
  186. if (ids.length > 0) {
  187. var info = '批量删除日志信息'
  188. lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/deleteAll',
  189. info, 'POST', ids)
  190. .then(function (result) {
  191. vm.refreshTable()
  192. lib.$$utils.direwolfCommonTips('success', info + '成功')
  193. })
  194. }
  195. })
  196. },
  197. /**
  198. * 查看选中的记录
  199. */
  200. viewSelectedTOperatingLog: function () {
  201. var selections = this.$refs.tOperatingLogTable.selection
  202. if (selections.length !== 1) {
  203. lib.$$utils.direwolfCommonTips('warning', '仅能选择一条记录进行查看')
  204. return
  205. }
  206. this.showTOperatingLogFormDialog({ editType: 'view', id: selections[0].id })
  207. },
  208. /**
  209. * 修改当前行
  210. * @param scope 组件参数
  211. */
  212. tOperatingLogRecordEdit: function (scope) {
  213. this.showTOperatingLogFormDialog({ editType: 'edit', id: scope.row.id })
  214. },
  215. /**
  216. * 删除当前行
  217. * @param scope 组件参数
  218. */
  219. tOperatingLogRecordRemove: function (scope) {
  220. var vm = this
  221. lib.$$utils.direwolfCommonConfirm({
  222. title: '删除提醒',
  223. message: '数据删除后不可恢复,确定继续删除吗?',
  224. }, function () {
  225. var info = '删除日志信息'
  226. lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/delete',
  227. info, 'POST', { id: scope.row.id })
  228. .then(function (result) {
  229. vm.refreshTable()
  230. lib.$$utils.direwolfCommonTips('success', info + '成功')
  231. })
  232. })
  233. },
  234. /**
  235. * 主表当前行变更,刷新子表
  236. * @param selection 当前行
  237. */
  238. handleSelectionChange: function (selection) {
  239. },
  240. },
  241. created: function () {
  242. var vm = this
  243. lib.$$utils.permission.checkPagePermission(vm.tOperatingLogPrefix + '/checkTOperatingLogListPermission')
  244. .then(function (hasPermission) {
  245. vm.tOperatingLogPageLoading = false
  246. vm.refreshTable()
  247. })
  248. },
  249. })