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 \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-11-08 10:23:20 * @Date: 2022-11-08 10:23:20
* @LastEditors: huyue * @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 // The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
...@@ -25,7 +25,7 @@ Vue.use(ElementUI) ...@@ -25,7 +25,7 @@ Vue.use(ElementUI)
var mixin = { var mixin = {
data() { data() {
return { return {
eventBus: new Vue(), eventBus: new Vue()
} }
}, },
mounted() { mounted() {
...@@ -41,8 +41,8 @@ var mixin = { ...@@ -41,8 +41,8 @@ var mixin = {
}, },
translate(params) { translate(params) {
_this.eventBus.$emit('params', params) _this.eventBus.$emit('params', params)
}, }
}, }
}) })
connection.promise.then((parent) => { connection.promise.then((parent) => {
const cfg = _this.$get_session_config() const cfg = _this.$get_session_config()
...@@ -75,12 +75,29 @@ var mixin = { ...@@ -75,12 +75,29 @@ var mixin = {
}, },
close(title) { close(title) {
this.$$parent.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 = const URL =
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config' '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) => { return new Promise((resolve, reject) => {
request({ url }).then((res) => { request({ url }).then((res) => {
if (res.status === 'success') { if (res.status === 'success') {
...@@ -96,7 +113,7 @@ const render = (App) => { ...@@ -96,7 +113,7 @@ const render = (App) => {
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
mixins: [mixin], mixins: [mixin],
render: (h) => h(App), render: (h) => h(App)
}) })
} }
export default { render, getConfig }
\ No newline at end of file \ No newline at end of file
export default { render, getConfig }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<div class="d2-table"> <div class="d2-table">
<el-table <el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'" :ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'"
:data="getListApi ? data : tableData" :data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''" :row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading" v-loading="loading"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
width="60px" width="60px"
label="序号" label="序号"
type='index' 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>
<el-table-column <el-table-column
v-for="(item, index) in tableParams.tableColumns" v-for="(item, index) in tableParams.tableColumns"
...@@ -93,16 +93,15 @@ ...@@ -93,16 +93,15 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="page.currentPage" :current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="page.pageSize" :page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal" :total="getListApi ? total : tableTotal"
:layout="layout" :layout="layout"
> >
</el-pagination> </el-pagination>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'd2-table', name: 'd2-table',
...@@ -111,10 +110,7 @@ export default { ...@@ -111,10 +110,7 @@ export default {
loading: false, loading: false,
data: [], data: [],
// 页码 // 页码
page: { page: {},
pageSize: 10,
currentPage: 1
},
total: 10, total: 10,
// 排序 // 排序
sortColum: '', sortColum: '',
...@@ -123,19 +119,22 @@ export default { ...@@ -123,19 +119,22 @@ export default {
mutiSelectArr: {} mutiSelectArr: {}
} }
}, },
props: { props: {
// 搜索条件 // 搜索条件
searchForm: { searchForm: {
type: Object, type: Object,
default: () => [] default: () => {}
}, },
// 表格数据-外部传入 // 表格数据-外部传入
tableData: { tableData: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
tableTotal: { // tableTotal: {
// type: Number,
// default: 0
// },
tableScore: {
type: Number, type: Number,
default: 0 default: 0
}, },
...@@ -158,6 +157,14 @@ export default { ...@@ -158,6 +157,14 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
pageConf: {
type: Object,
default: () => ({
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'totalCount'
})
},
// 分页组件配置 // 分页组件配置
layout: { layout: {
type: String, type: String,
...@@ -211,46 +218,42 @@ export default { ...@@ -211,46 +218,42 @@ export default {
} }
} }
}, },
mounted() { mounted() {
this.page = {}
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageNum] = 1
const btn = document.getElementById(this.tableParams.btnId) const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit) btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable() this.getListApi && this.refreshTable()
}, },
methods: { methods: {
// 排序 // 排序
sortChange({ column, prop, order }) { sortChange({ column, prop, order }) {
this.sortColum = order ? prop : '' this.sortColum = order ? prop : ''
this.sort = order this.sort = order
this.refreshTable() this.refreshTable()
}, },
// 多选 // 多选
handleSelect(val) { handleSelect(val) {
console.log(val)
this.mutiSelectArr[this.tableParams.mutiSelectName] = val this.mutiSelectArr[this.tableParams.mutiSelectName] = val
}, },
// 清空多选 // 清空多选
clearMutiSelect() { clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = [] this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection() this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
}, },
// 发布事件,以期查询条件改变后,页面图表需要刷新 // 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() { refreshEmit() {
this.$emit('searchChange') this.$emit('searchChange')
this.refreshTable(true, true) this.refreshTable(true, true)
}, },
refreshTable(clearMuti = true, resetPageNum = false) {
refreshTable(clearMuti = true, resetCurrentPage = false) {
this.beforeSearchFn().then(res => { this.beforeSearchFn().then(res => {
// console.log(res)
// 清空多选 // 清空多选
clearMuti && this.clearMutiSelect() clearMuti && this.clearMutiSelect()
this.loading = true this.loading = true
resetCurrentPage && (this.page.currentPage = 1) resetPageNum && (this.page.pageNum = 1)
var params = { var params = {
...this.page, ...this.page,
...this.searchForm ...this.searchForm
...@@ -259,35 +262,50 @@ export default { ...@@ -259,35 +262,50 @@ export default {
params.sortColum = this.sortColum params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0 params.sort = this.sort === 'descending' ? 1 : 0
} }
this.getListApi(params).then(res => { this.getListApi(params)
this.data = res[this.tableParams.listName] .then(res => {
this.total = res.pagination.totalCount this.data = this.findVal(res, this.tableParams.listName)
this.loading = false this.total = this.findVal(res, this.pageConf.totalCount)
}).catch(() => { this.$emit('sendAlldata', res.data)
this.loading = false 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) { handleSizeChange(value) {
this.page.pageSize = value this.page[this.pageConf.pageSize] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page) this.getListApi
? this.refreshTable(false)
: this.$emit('refreshTable', this.page)
}, },
// 页码 // 页码
handleCurrentChange(value) { handleCurrentChange(value) {
this.page.currentPage = value this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page) this.getListApi
? this.refreshTable(false)
: this.$emit('refreshTable', this.page)
} }
} }
} }
</script> </script>
<style> <style>
.a-click { .a-click {
cursor: pointer; cursor: pointer;
} }
.el-table {
margin-bottom: 16px;
}
.el-table .cell { .el-table .cell {
line-height: 14px; line-height: 14px;
} }
......
<!-- <!--
* @Description: * @Description: 操作记录
* @Author: huyue * @Author: huyue
* @Date: 2022-11-08 10:38:40 * @Date: 2022-11-08 10:38:40
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-11-09 11:06:32 * @LastEditTime: 2022-11-09 16:43:50
--> -->
<template> <template>
<div> <div class="table-box">
<d2-table <d2-table
ref="taskTable" ref="taskTable"
:getListApi="getListApi" :getListApi="getListApi"
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
> >
</d2-table> </d2-table>
</div> </div>
</template> </template>
<script> <script>
import { getLogList } from '../../../api/operations'
export default { export default {
data() { data() {
return { return {
getListApi: '', getListApi: getLogList.req,
pageConf: { pageConf: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageNum: 'pageNum', pageNum: 'pageNum',
totalCount: 'data.count' totalCount: 'data.total'
}, },
tableParams: { tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000), listName: 'data.list',
listName: 'data.data', tableOption: false,
tableOption: true,
tableColumns: [ tableColumns: [
{ {
label: '业务场景', label: '登录账户',
prop: 'businessScene', prop: 'username'
addHtml: 'businessScene',
width: 150
}, },
{ {
label: '商户', label: '登录IP',
prop: 'merchantName', prop: 'clientIp'
width: 150
}, },
{ {
label: '活动/产品', label: '修改内容',
prop: 'activityName', prop: 'logContext'
width: 200
}, },
{ {
label: '任务数', label: '操作人',
prop: 'missionCount' prop: 'realName'
}, },
{ {
label: '创建人', label: '操作时间',
prop: 'createdBy' prop: 'createTime',
}, formatter: cellValue => {
{ if (cellValue.createTime) {
label: '创建时间', return new Date(cellValue.createTime).format(
prop: 'createdTime', 'yyyy-MM-dd hh:mm:ss'
width: 150 )
}, }
{ }
label: '状态',
prop: 'activityStatus',
addHtml: 'activityStatus'
} }
] ]
} }
...@@ -73,4 +66,7 @@ export default { ...@@ -73,4 +66,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
.table-box {
padding: 20px;
}
</style> </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!