Commit d01f1100 authored by Your Name's avatar Your Name

页面新增

parent fc40ee63
Pipeline #53 failed with stages
This diff is collapsed.
...@@ -11,6 +11,33 @@ export const asyncRouterMap = [ ...@@ -11,6 +11,33 @@ export const asyncRouterMap = [
meta: { title: '首页' }, meta: { title: '首页' },
redirect: '/dashboard/workplace', redirect: '/dashboard/workplace',
children: [ children: [
{
path: '/userstaff',
redirect: '/userstaff/employeeim',
component: PageView,
meta: { title: '用户&员工', icon: 'table', permission: [ 'table' ] },
children: [
{
path: '/userstaff/eminforman',
name: 'Eminforman',
component: () => import('@/views/userstaff/Eminforman'),
meta: { title: '员工信息管理', keepAlive: true, permission: [ 'table' ] }
},
{
path: '/userstaff/departmentim',
name: 'Departmentim',
component: () => import('@/views/userstaff/Departmentim'),
meta: { title: '部门信息管理', keepAlive: true, permission: [ 'table' ] }
},
{
path: '/userstaff/userlist',
name: 'Userlist',
component: () => import('@/views/userstaff/Userlist'),
meta: { title: '用户留言列表', keepAlive: true, permission: [ 'table' ] }
}
]
},
// dashboard // dashboard
{ {
path: '/dashboard', path: '/dashboard',
......
<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="8" :sm="24">
<a-form-item label="部门编号">
<a-input v-model="queryParam.id" placeholder=""/>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="部门名称">
<a-select v-model="queryParam.status" placeholder="请选择" default-value="0">
<a-select-option value="0">全部</a-select-option>
<a-select-option value="1">关闭</a-select-option>
<a-select-option value="2">运行中</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="!advanced && 8 || 24" :sm="24">
<span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
<!-- <a @click="toggleAdvanced" style="margin-left: 8px">
{{ advanced ? '收起' : '展开' }}
<a-icon :type="advanced ? 'up' : 'down'"/>
</a> -->
</span>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!-- <a-button type="primary" icon="plus" @click="$refs.createModal.add()">新建</a-button> -->
<a-button type="dashed" @click="tableOption">{{ optionAlertShow && '关闭' || '开启' }} alert</a-button>
<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1"><a-icon type="delete" />删除</a-menu-item>
<!-- lock | unlock -->
<a-menu-item key="2"><a-icon type="lock" />锁定</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px">
批量操作 <a-icon type="down" />
</a-button>
</a-dropdown>
</div>
<s-table
ref="table"
size="default"
rowKey="key"
:columns="columns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
showPagination="auto"
>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="status" slot-scope="text">
<a-badge :status="text | statusTypeFilter" :text="text | statusFilter" />
</span>
<span slot="description" slot-scope="text">
<ellipsis :length="4" tooltip>{{ text }}</ellipsis>
</span>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record)">配置</a>
<a-divider type="vertical" />
<a @click="handleSub(record)">订阅报警</a>
</template>
</span>
</s-table>
<!-- <create-form ref="createModal" @ok="handleOk" />
<step-by-step-modal ref="modal" @ok="handleOk"/> -->
</a-card>
</template>
<script>
import moment from 'moment'
import { STable, Ellipsis } from '@/components'
// import StepByStepModal from './modules/StepByStepModal'
// import CreateForm from './modules/CreateForm'
import { getRoleList, getServiceList } from '@/api/manage'
const statusMap = {
0: {
status: 'default',
text: '关闭'
},
1: {
status: 'processing',
text: '运行中'
},
2: {
status: 'success',
text: '已上线'
},
3: {
status: 'error',
text: '异常'
}
}
export default {
name: 'TableList',
components: {
STable,
Ellipsis,
// CreateForm,
// StepByStepModal
},
data () {
return {
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
columns: [
{
title: '#',
scopedSlots: { customRender: 'serial' }
},
{
title: '部门编号',
dataIndex: 'no'
},
{
title: '部门名称',
dataIndex: 'description',
scopedSlots: { customRender: 'description' }
},
{
title: '所属公司',
dataIndex: 'callNo',
sorter: true,
needTotal: true,
customRender: (text) => text + ' 次'
},
{
title: '所属分公司',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '更新时间',
dataIndex: 'updatedAt',
sorter: true
},
// {
// title: '操作',
// dataIndex: 'action',
// width: '150px',
// scopedSlots: { customRender: 'action' }
// }
],
// 加载数据方法 必须为 Promise 对象
loadData: parameter => {
console.log('loadData.parameter', parameter)
return getServiceList(Object.assign(parameter, this.queryParam))
.then(res => {
return res.result
})
},
selectedRowKeys: [],
selectedRows: [],
// custom table alert & rowSelection
options: {
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
rowSelection: {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange
}
},
optionAlertShow: false
}
},
filters: {
statusFilter (type) {
return statusMap[type].text
},
statusTypeFilter (type) {
return statusMap[type].status
}
},
created () {
this.tableOption()
getRoleList({ t: new Date() })
},
methods: {
tableOption () {
if (!this.optionAlertShow) {
this.options = {
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
rowSelection: {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange,
getCheckboxProps: record => ({
props: {
disabled: record.no === 'No 2', // Column configuration not to be checked
name: record.no
}
})
}
}
this.optionAlertShow = true
} else {
this.options = {
alert: false,
rowSelection: null
}
this.optionAlertShow = false
}
},
handleEdit (record) {
console.log(record)
this.$refs.modal.edit(record)
},
handleSub (record) {
if (record.status !== 0) {
this.$message.info(`${record.no} 订阅成功`)
} else {
this.$message.error(`${record.no} 订阅失败,规则已关闭`)
}
},
// handleOk () {
// console.log(123)
// this.$refs.table.refresh()
// },
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
},
// toggleAdvanced () {
// this.advanced = !this.advanced
// },
resetSearchForm () {
this.queryParam = {
date: moment(new Date())
}
}
}
}
</script>
This diff is collapsed.
<template>
<a-card :bordered="false">
<s-table
ref="table"
size="default"
rowKey="key"
:columns="columns"
:data="loadData"
:rowSelection="options.rowSelection"
showPagination="auto"
>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="status" slot-scope="text">
<a-badge :status="text | statusTypeFilter" :text="text | statusFilter" />
</span>
<span slot="description" slot-scope="text">
<ellipsis :length="4" tooltip>{{ text }}</ellipsis>
</span>
<!-- <span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record)">配置</a>
<a-divider type="vertical" />
<a @click="handleSub(record)">订阅报警</a>
</template>
</span> -->
</s-table>
<!-- <create-form ref="createModal" @ok="handleOk" />
<step-by-step-modal ref="modal" @ok="handleOk"/> -->
</a-card>
</template>
<script>
import moment from 'moment'
import { STable, Ellipsis } from '@/components'
// import StepByStepModal from './modules/StepByStepModal'
// import CreateForm from './modules/CreateForm'
import { getRoleList, getServiceList } from '@/api/manage'
const statusMap = {
0: {
status: 'default',
text: '关闭'
},
1: {
status: 'processing',
text: '运行中'
},
2: {
status: 'success',
text: '已上线'
},
3: {
status: 'error',
text: '异常'
}
}
export default {
name: 'TableList',
components: {
STable,
Ellipsis,
// CreateForm,
// StepByStepModal
},
data () {
return {
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
columns: [
{
title: '#',
scopedSlots: { customRender: 'serial' }
},
{
title: '用户名',
dataIndex: 'no'
},
{
title: '用户电话或工号',
dataIndex: 'description',
scopedSlots: { customRender: 'description' }
},
{
title: '手机号',
dataIndex: 'callNo',
sorter: true,
needTotal: true,
customRender: (text) => text + ' 次'
},
{
title: '留言时间',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '留言类型',
dataIndex: 'updatedAt',
sorter: true
},
{
title: '留言内容',
dataIndex: 'action',
width: '150px',
scopedSlots: { customRender: 'action' }
}
],
// 加载数据方法 必须为 Promise 对象
loadData: parameter => {
console.log('loadData.parameter', parameter)
return getServiceList(Object.assign(parameter, this.queryParam))
.then(res => {
return res.result
})
},
selectedRowKeys: [],
selectedRows: [],
// custom table alert & rowSelection
options: {
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
rowSelection: {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange
}
},
optionAlertShow: false
}
},
filters: {
statusFilter (type) {
return statusMap[type].text
},
statusTypeFilter (type) {
return statusMap[type].status
}
},
created () {
this.tableOption()
getRoleList({ t: new Date() })
},
methods: {
tableOption () {
if (!this.optionAlertShow) {
this.options = {
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
rowSelection: {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange,
getCheckboxProps: record => ({
props: {
disabled: record.no === 'No 2', // Column configuration not to be checked
name: record.no
}
})
}
}
this.optionAlertShow = true
} else {
this.options = {
alert: false,
rowSelection: null
}
this.optionAlertShow = false
}
},
// handleEdit (record) {
// console.log(record)
// this.$refs.modal.edit(record)
// },
handleSub (record) {
if (record.status !== 0) {
this.$message.info(`${record.no} 订阅成功`)
} else {
this.$message.error(`${record.no} 订阅失败,规则已关闭`)
}
},
handleOk () {
this.$refs.table.refresh()
},
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
},
toggleAdvanced () {
this.advanced = !this.advanced
},
resetSearchForm () {
this.queryParam = {
date: moment(new Date())
}
}
}
}
</script>
<template>
<page-view :avatar="avatar" :title="false">
<div slot="headerContent">
<div class="title">{{ timeFix }}{{ user.name }}<span class="welcome-text">{{ welcome }}</span></div>
<div>前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div>
</div>
<div slot="extra">
<a-row class="more-info">
<a-col :span="8">
<head-info title="项目" content="56" :center="false" :bordered="false"/>
</a-col>
<a-col :span="8">
<head-info title="团队排名" content="8/24" :center="false" :bordered="false"/>
</a-col>
<a-col :span="8">
<head-info title="项目数" content="2,223" :center="false" />
</a-col>
</a-row>
</div>
<div>
<a-row :gutter="24">
<a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24">
<a-card
class="project-list"
:loading="loading"
style="margin-bottom: 24px;"
:bordered="false"
title="进行中的项目"
:body-style="{ padding: 0 }">
<a slot="extra">全部项目</a>
<div>
<a-card-grid class="project-card-grid" :key="i" v-for="(item, i) in projects">
<a-card :bordered="false" :body-style="{ padding: 0 }">
<a-card-meta>
<div slot="title" class="card-title">
<a-avatar size="small" :src="item.cover"/>
<a>{{ item.title }}</a>
</div>
<div slot="description" class="card-description">
{{ item.description }}
</div>
</a-card-meta>
<div class="project-item">
<a href="/#/">科学搬砖组</a>
<span class="datetime">9小时前</span>
</div>
</a-card>
</a-card-grid>
</div>
</a-card>
<a-card :loading="loading" title="动态" :bordered="false">
<a-list>
<a-list-item :key="index" v-for="(item, index) in activities">
<a-list-item-meta>
<a-avatar slot="avatar" :src="item.user.avatar" />
<div slot="title">
<span>{{ item.user.nickname }}</span>&nbsp;
&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp;
<span>{{ item.project.action }}</span>&nbsp;
<a href="#">{{ item.project.event }}</a>
</div>
<div slot="description">{{ item.time }}</div>
</a-list-item-meta>
</a-list-item>
</a-list>
</a-card>
</a-col>
<a-col
style="padding: 0 12px"
:xl="8"
:lg="24"
:md="24"
:sm="24"
:xs="24">
<a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px" :bordered="false" :body-style="{padding: 0}">
<div class="item-group">
<a>操作一</a>
<a>操作二</a>
<a>操作三</a>
<a>操作四</a>
<a>操作五</a>
<a>操作六</a>
<a-button size="small" type="primary" ghost icon="plus">添加</a-button>
</div>
</a-card>
<a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }">
<div style="min-height: 400px;">
<!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" -->
<radar :data="radarData" />
</div>
</a-card>
<a-card :loading="loading" title="团队" :bordered="false">
<div class="members">
<a-row>
<a-col :span="12" v-for="(item, index) in teams" :key="index">
<a>
<a-avatar size="small" :src="item.avatar" />
<span class="member">{{ item.name }}</span>
</a>
</a-col>
</a-row>
</div>
</a-card>
</a-col>
</a-row>
</div>
</page-view>
</template>
<script>
import { timeFix } from '@/utils/util'
import { mapState } from 'vuex'
import { PageView } from '@/layouts'
import HeadInfo from '@/components/tools/HeadInfo'
import { Radar } from '@/components'
import { getRoleList, getServiceList } from '@/api/manage'
const DataSet = require('@antv/data-set')
export default {
name: 'Workplace',
components: {
PageView,
HeadInfo,
Radar
},
data () {
return {
timeFix: timeFix(),
avatar: '',
user: {},
projects: [],
loading: true,
radarLoading: true,
activities: [],
teams: [],
// data
axis1Opts: {
dataKey: 'item',
line: null,
tickLine: null,
grid: {
lineStyle: {
lineDash: null
},
hideFirstLine: false
}
},
axis2Opts: {
dataKey: 'score',
line: null,
tickLine: null,
grid: {
type: 'polygon',
lineStyle: {
lineDash: null
}
}
},
scale: [{
dataKey: 'score',
min: 0,
max: 80
}],
axisData: [
{ item: '引用', a: 70, b: 30, c: 40 },
{ item: '口碑', a: 60, b: 70, c: 40 },
{ item: '产量', a: 50, b: 60, c: 40 },
{ item: '贡献', a: 40, b: 50, c: 40 },
{ item: '热度', a: 60, b: 70, c: 40 },
{ item: '引用', a: 70, b: 50, c: 40 }
],
radarData: []
}
},
computed: {
...mapState({
nickname: (state) => state.user.nickname,
welcome: (state) => state.user.welcome
}),
userInfo () {
return this.$store.getters.userInfo
}
},
created () {
this.user = this.userInfo
this.avatar = this.userInfo.avatar
getRoleList().then(res => {
// console.log('workplace -> call getRoleList()', res)
})
getServiceList().then(res => {
// console.log('workplace -> call getServiceList()', res)
})
},
mounted () {
this.getProjects()
this.getActivity()
this.getTeams()
this.initRadar()
},
methods: {
getProjects () {
this.$http.get('/list/search/projects')
.then(res => {
this.projects = res.result && res.result.data
this.loading = false
})
},
getActivity () {
this.$http.get('/workplace/activity')
.then(res => {
this.activities = res.result
})
},
getTeams () {
this.$http.get('/workplace/teams')
.then(res => {
this.teams = res.result
})
},
initRadar () {
this.radarLoading = true
this.$http.get('/workplace/radar')
.then(res => {
const dv = new DataSet.View().source(res.result)
dv.transform({
type: 'fold',
fields: ['个人', '团队', '部门'],
key: 'user',
value: 'score'
})
this.radarData = dv.rows
this.radarLoading = false
})
}
}
}
</script>
<style lang="less" scoped>
.project-list {
.card-title {
font-size: 0;
a {
color: rgba(0, 0, 0, 0.85);
margin-left: 12px;
line-height: 24px;
height: 24px;
display: inline-block;
vertical-align: top;
font-size: 14px;
&:hover {
color: #1890ff;
}
}
}
.card-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
.project-item {
display: flex;
margin-top: 8px;
overflow: hidden;
font-size: 12px;
height: 20px;
line-height: 20px;
a {
color: rgba(0, 0, 0, 0.45);
display: inline-block;
flex: 1 1 0;
&:hover {
color: #1890ff;
}
}
.datetime {
color: rgba(0, 0, 0, 0.25);
flex: 0 0 auto;
float: right;
}
}
.ant-card-meta-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
}
.item-group {
padding: 20px 0 8px 24px;
font-size: 0;
a {
color: rgba(0, 0, 0, 0.65);
display: inline-block;
font-size: 14px;
margin-bottom: 13px;
width: 25%;
}
}
.members {
a {
display: block;
margin: 12px 0;
line-height: 24px;
height: 24px;
.member {
font-size: 14px;
color: rgba(0, 0, 0, .65);
line-height: 24px;
max-width: 100px;
vertical-align: top;
margin-left: 12px;
transition: all 0.3s;
display: inline-block;
}
&:hover {
span {
color: #1890ff;
}
}
}
}
.mobile {
.project-list {
.project-card-grid {
width: 100%;
}
}
.more-info {
border: 0;
padding-top: 16px;
margin: 16px 0 16px;
}
.headerContent .title .welcome-text {
display: none;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment