123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- var lib = new DirewolfLibrary()
- // 查询参数初始值,重置按钮将使用该值
- var defaultParams = JSON.stringify({
- operTime: '',
- operTimeRange: [], // ['2018-10-01', '2018-10-30']
- operPerAccount: '',
- operModule: '',
- operAction: '',
- operUrl: '',
- operContractCode: '',
- operPurchaseApplyCode: '',
- operOrderCode: '',
- limit: 5,
- offset: 0,
- order: '',
- sort: '',
- })
- // eslint-disable-next-line no-new
- new window.Vue({
- el: '#app',
- data: function () {
- return {
- /**
- * 微服务配置
- */
- msConfig: window.__CONTRACT_CONFIG__,
- /**
- * 页面加载状态
- */
- tOperatingLogPageLoading: true,
- /**
- * 查询参数,包含表格分页参数
- */
- searchParams: JSON.parse(defaultParams), // 拷贝初始值
- /**
- * 超过两行的查询条件是否可见
- */
- extraQueriesVisible: false, // 默认不可见
- /**
- * 页面编辑类型,为view时工具栏及操作列不出现
- */
- editType: lib.$$utils.getQueryString('editType'),
- /**
- * 日志信息表格分页数据
- */
- tOperatingLogTablePage: {},
- /**
- * 日志信息表格加载状态
- */
- tOperatingLogTableLoading: true,
- //testFF:''
- }
- },
- computed: {
- formBaseUrl: function () {
- return lib.$$utils.router.getRelativePath() + 'tOperatingLogForm.html'
- },
- requestPrefix: function () {
- return this.msConfig['gatewayRoute'] + this.msConfig['direwolfAdmin']
- },
- tOperatingLogPrefix: function () {
- return this.msConfig['gatewayRoute'] + this.msConfig['direwolfAdmin'] + '/contract/common/tOperatingLog'
- },
- },
- methods: {
- /**
- * 刷新表格,重新获取数据
- */
- refreshTable: function () {
- var vm = this
- if (!vm.msConfig.gatewayRoute) {
- return
- }
- vm.tOperatingLogTableLoading = true
- lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/getTOperatingLogList',
- '获取日志信息记录', 'GET', vm.searchParams)
- .then(function (result) {
- vm.tOperatingLogTablePage = result
- vm.tOperatingLogTableLoading = false
- })
- },
- /**
- * 重置按钮点击事件
- */
- resetSearchParam: function () {
- this.searchParams = JSON.parse(defaultParams)
- this.refreshTable()
- },
- /**
- * 切换超出两行的查询条件显示隐藏
- */
- toggleExtraQueries: function () {
- this.extraQueriesVisible = !this.extraQueriesVisible
- },
- /**
- * 表格行点击事件
- * @param row 行数据
- * @param event 原生事件
- * @param column 点击位置所属列
- */
- handleRowClick: function (row, event, column) {
- lib.$$utils.eleTableClickSelection(this.$refs.tOperatingLogTable, row, column)
- },
- /**
- * 分页大小切换事件
- * @param val 新值
- */
- handleTableSizeChange: function (val) {
- this.searchParams.limit = val
- this.refreshTable()
- },
- /**
- * 页码切换事件
- * @param val 新页码
- */
- handleTableCurrentChange: function (val) {
- this.searchParams.offset = this.searchParams.limit * (val - 1)
- this.refreshTable()
- },
- /**
- * 排序变更事件
- * @param scope 组件参数
- */
- handleSortChange: function (scope) {
- // 排序取消则使用初始参数
- if (scope.prop === null) {
- this.searchParams.sort = defaultParams.sort
- this.searchParams.order = defaultParams.order
- } else {
- this.searchParams.sort = scope.prop
- // 组件传递的order格式为'descending'/'ascending'
- this.searchParams.order = scope.order.split('ending')[0]
- }
- this.refreshTable()
- },
- /**
- * 打开表单对话框
- * @param props 表单参数
- */
- showTOperatingLogFormDialog: function (props) {
- var vm = this
- lib.$$utils.openLayerDialog({
- el: 'tOperatingLogForm',
- url: vm.formBaseUrl,
- showConfirmButton: props.editType && props.editType !== 'view',
- props: props,
- title: lib.$$utils.getEditTypeName(props.editType) + '日志信息',
- onConfirm: function (formVm, success) {
- if (props.editType !== 'view') {
- formVm.$parent.save(function () {
- vm.refreshTable()
- success()
- })
- } else {
- success()
- }
- },
- })
- },
- /**
- * 新增记录
- */
- addNewTOperatingLog: function () { // 新增记录
- this.showTOperatingLogFormDialog({ editType: 'add' })
- },
- /**
- * 删除选中记录
- */
- deleteSelectedTOperatingLog: function () {
- var vm = this
- var selections = vm.$refs.tOperatingLogTable.selection
- if (selections.length === 0) {
- lib.$$utils.direwolfCommonTips('warning', '请选择要删除的记录')
- return
- }
- lib.$$utils.direwolfCommonConfirm({
- title: '删除提醒',
- message: '数据删除后不可恢复,确定继续删除吗?',
- }, function () {
- var ids = []
- selections.forEach(function (select) {
- if (select.id) {
- ids.push(select.id)
- }
- })
- if (ids.length > 0) {
- var info = '批量删除日志信息'
- lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/deleteAll',
- info, 'POST', ids)
- .then(function (result) {
- vm.refreshTable()
- lib.$$utils.direwolfCommonTips('success', info + '成功')
- })
- }
- })
- },
- /**
- * 查看选中的记录
- */
- viewSelectedTOperatingLog: function () {
- var selections = this.$refs.tOperatingLogTable.selection
- if (selections.length !== 1) {
- lib.$$utils.direwolfCommonTips('warning', '仅能选择一条记录进行查看')
- return
- }
- this.showTOperatingLogFormDialog({ editType: 'view', id: selections[0].id })
- },
- /**
- * 修改当前行
- * @param scope 组件参数
- */
- tOperatingLogRecordEdit: function (scope) {
- this.showTOperatingLogFormDialog({ editType: 'edit', id: scope.row.id })
- },
- /**
- * 删除当前行
- * @param scope 组件参数
- */
- tOperatingLogRecordRemove: function (scope) {
- var vm = this
- lib.$$utils.direwolfCommonConfirm({
- title: '删除提醒',
- message: '数据删除后不可恢复,确定继续删除吗?',
- }, function () {
- var info = '删除日志信息'
- lib.$$utils.axiosRequest(vm.tOperatingLogPrefix + '/delete',
- info, 'POST', { id: scope.row.id })
- .then(function (result) {
- vm.refreshTable()
- lib.$$utils.direwolfCommonTips('success', info + '成功')
- })
- })
- },
- /**
- * 主表当前行变更,刷新子表
- * @param selection 当前行
- */
- handleSelectionChange: function (selection) {
- },
- },
- created: function () {
- var vm = this
- lib.$$utils.permission.checkPagePermission(vm.tOperatingLogPrefix + '/checkTOperatingLogListPermission')
- .then(function (hasPermission) {
- vm.tOperatingLogPageLoading = false
- vm.refreshTable()
- })
- },
- })
|