Commit 0108ab9e by 前端

Merge branch 'v3.1.1' into 'master'

V3.1.1

See merge request !2
2 parents cee75597 a4555d5b
/*
* @Description:
* @Author: huyue
* @Date: 2022-11-09 14:46:07
* @LastEditors: huyue
* @LastEditTime: 2022-11-09 14:50:37
*/
import { GlAxios } from 'glsx-vue-common'
const path = '/admin-operating-auth/log/'
const __sLogList = `${path}getLogList`
const getLogList = {
p: [__sLogList],
req: params => GlAxios.get(__sLogList, { params })
}
export {
getLogList
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-11-08 10:23:20
* @LastEditors: huyue
* @LastEditTime: 2022-11-08 10:42:34
* @LastEditTime: 2022-11-09 16:42:11
*/
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
......@@ -25,7 +25,7 @@ Vue.use(ElementUI)
var mixin = {
data() {
return {
eventBus: new Vue(),
eventBus: new Vue()
}
},
mounted() {
......@@ -41,8 +41,8 @@ var mixin = {
},
translate(params) {
_this.eventBus.$emit('params', params)
},
},
}
}
})
connection.promise.then((parent) => {
const cfg = _this.$get_session_config()
......@@ -75,12 +75,29 @@ var mixin = {
},
close(title) {
this.$$parent.close(title)
},
},
}
}
}
Date.prototype.format = function (fmt) {
let o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
//季度
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds() //毫秒
}
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
for (let k in o) {
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
}
return fmt
}
const URL =
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/task-config') => {
const getConfig = (url = URL + '/record-config') => {
return new Promise((resolve, reject) => {
request({ url }).then((res) => {
if (res.status === 'success') {
......@@ -96,7 +113,7 @@ const render = (App) => {
window.vm = new Vue({
el: '#app',
mixins: [mixin],
render: (h) => h(App),
render: (h) => h(App)
})
}
export default { render, getConfig }
\ No newline at end of file
export default { render, getConfig }
......@@ -2,7 +2,7 @@
<template>
<div class="d2-table">
<el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading"
......@@ -26,7 +26,7 @@
width="60px"
label="序号"
type='index'
:index="index=>index+(page.currentPage - 1) * page.pageSize + 1"
:index="index=>index+(page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableParams.tableColumns"
......@@ -93,16 +93,15 @@
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.currentPage"
:current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal"
:layout="layout"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'd2-table',
......@@ -111,10 +110,7 @@ export default {
loading: false,
data: [],
// 页码
page: {
pageSize: 10,
currentPage: 1
},
page: {},
total: 10,
// 排序
sortColum: '',
......@@ -123,19 +119,22 @@ export default {
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => []
default: () => {}
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
// tableTotal: {
// type: Number,
// default: 0
// },
tableScore: {
type: Number,
default: 0
},
......@@ -158,6 +157,14 @@ export default {
type: Boolean,
default: true
},
pageConf: {
type: Object,
default: () => ({
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'totalCount'
})
},
// 分页组件配置
layout: {
type: String,
......@@ -211,46 +218,42 @@ export default {
}
}
},
mounted() {
this.page = {}
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageNum] = 1
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
methods: {
// 排序
sortChange({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// 多选
handleSelect(val) {
console.log(val)
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
},
// 清空多选
clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() {
this.$emit('searchChange')
this.refreshTable(true, true)
},
refreshTable(clearMuti = true, resetCurrentPage = false) {
refreshTable(clearMuti = true, resetPageNum = false) {
this.beforeSearchFn().then(res => {
// console.log(res)
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
resetCurrentPage && (this.page.currentPage = 1)
resetPageNum && (this.page.pageNum = 1)
var params = {
...this.page,
...this.searchForm
......@@ -259,35 +262,50 @@ export default {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
this.data = res[this.tableParams.listName]
this.total = res.pagination.totalCount
this.loading = false
}).catch(() => {
this.loading = false
})
this.getListApi(params)
.then(res => {
this.data = this.findVal(res, this.tableParams.listName)
this.total = this.findVal(res, this.pageConf.totalCount)
this.$emit('sendAlldata', res.data)
this.loading = false
})
.catch(() => {
this.loading = false
})
})
},
// 找返回值
findVal(res, rankStr, attr) {
var rankList = rankStr.split('.')
if (!rankStr) {
return res
}
return this.findVal(res[rankList[0]], rankList.splice(1).join('.'), attr)
},
// 每页条数
handleSizeChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
this.page[this.pageConf.pageSize] = value
this.getListApi
? this.refreshTable(false)
: this.$emit('refreshTable', this.page)
},
// 页码
handleCurrentChange(value) {
this.page.currentPage = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
this.page[this.pageConf.pageNum] = value
this.getListApi
? this.refreshTable(false)
: this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.a-click {
cursor: pointer;
}
.el-table {
margin-bottom: 16px;
}
.el-table .cell {
line-height: 14px;
}
......
<!--
* @Description:
* @Description: 操作记录
* @Author: huyue
* @Date: 2022-11-08 10:38:40
* @LastEditors: huyue
* @LastEditTime: 2022-11-09 11:06:32
* @LastEditTime: 2022-11-09 16:43:50
-->
<template>
<div>
<div class="table-box">
<d2-table
ref="taskTable"
:getListApi="getListApi"
:tableParams="tableParams"
:pageConf="pageConf"
ref="taskTable"
:getListApi="getListApi"
:tableParams="tableParams"
:pageConf="pageConf"
>
</d2-table>
</div>
</template>
<script>
import { getLogList } from '../../../api/operations'
export default {
data() {
return {
getListApi: '',
getListApi: getLogList.req,
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count'
totalCount: 'data.total'
},
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableOption: true,
listName: 'data.list',
tableOption: false,
tableColumns: [
{
label: '业务场景',
prop: 'businessScene',
addHtml: 'businessScene',
width: 150
label: '登录账户',
prop: 'username'
},
{
label: '商户',
prop: 'merchantName',
width: 150
label: '登录IP',
prop: 'clientIp'
},
{
label: '活动/产品',
prop: 'activityName',
width: 200
label: '修改内容',
prop: 'logContext'
},
{
label: '任务数',
prop: 'missionCount'
label: '操作人',
prop: 'realName'
},
{
label: '创建人',
prop: 'createdBy'
},
{
label: '创建时间',
prop: 'createdTime',
width: 150
},
{
label: '状态',
prop: 'activityStatus',
addHtml: 'activityStatus'
label: '操作时间',
prop: 'createTime',
formatter: cellValue => {
if (cellValue.createTime) {
return new Date(cellValue.createTime).format(
'yyyy-MM-dd hh:mm:ss'
)
}
}
}
]
}
......@@ -73,4 +66,7 @@ export default {
}
</script>
<style scoped>
.table-box {
padding: 20px;
}
</style>
'use strict'
const titles = require('./title.js')
const glob = require('glob')
const pages = {}
// const mode = process.env.NODE_ENV || 'development'
glob.sync('./src/views/**/app.js').forEach(path => {
const chunk = path.split('./src/views/')[1].split('/app.js')[0]
pages[chunk] = {
entry: path,
template: 'public/index.html',
title: titles[chunk],
chunks: ['chunk-vendors', 'chunk-common', chunk]
}
})
module.exports = {
pages,
chainWebpack: config => config.plugins.delete('named-chunks'),
configureWebpack: (config) => {
// config.devtool = (mode === 'development') ? 'inline-source-map' : false
// config.mode = mode
},
devServer: {
port: 8085,
host: '192.168.1.68',
open: true,
proxy: {
'/api': {
target: 'http://sso.dev.glsx.com.cn',
changeOrigin: true,
pathRewrite: { '^/api': '' }
}
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!