Commit 90675607 by sendya

fix: display problem in mobile mode

parent 2ddf9e9d
<template> <template>
<a-locale-provider :locale="locale"> <a-locale-provider :locale="locale">
<div id="app"> <div id="app">
<router-view/> <router-view/>
</div> </div>
</a-locale-provider> </a-locale-provider>
</template> </template>
<script> <script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN' import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device' import enquireScreen from '@/utils/device'
export default { export default {
data () { data () {
return { return {
locale: zhCN, locale: zhCN,
} }
}, },
created () { created () {
let that = this let that = this
enquireScreen(deviceType => { enquireScreen(deviceType => {
// tablet // tablet
if (deviceType === 0) { if (deviceType === 0) {
that.$store.commit('TOGGLE_DEVICE', 'tablet') that.$store.commit('TOGGLE_DEVICE', 'tablet')
that.$store.commit('CLOSE_SIDEBAR', false) that.$store.dispatch('setSidebar', false)
} }
// mobile // mobile
else if (deviceType === 1) { else if (deviceType === 1) {
that.$store.commit('TOGGLE_DEVICE', 'mobile') that.$store.commit('TOGGLE_DEVICE', 'mobile')
that.$store.commit('CLOSE_SIDEBAR', false) that.$store.dispatch('setSidebar', false)
} }
else { else {
that.$store.commit('TOGGLE_DEVICE', 'desktop') that.$store.commit('TOGGLE_DEVICE', 'desktop')
that.$store.commit('SET_SIDEBAR_TYPE', true) that.$store.dispatch('setSidebar', true)
} }
}) })
} }
} }
</script> </script>
<style> <style>
#app { #app {
height: 100%; height: 100%;
} }
</style> </style>
\ No newline at end of file
...@@ -102,6 +102,12 @@ ...@@ -102,6 +102,12 @@
device: state => state.app.device, device: state => state.app.device,
}) })
}, },
watch: {
sidebarOpened(val) {
console.log('watch',val)
this.collapsed = !val
},
},
created() { created() {
this.menus = this.mainMenu.find((item) => item.path === '/').children this.menus = this.mainMenu.find((item) => item.path === '/').children
}, },
...@@ -144,10 +150,17 @@ ...@@ -144,10 +150,17 @@
} }
} }
/**
* ant-table-wrapper
* 覆盖的表格手机模式样式,如果想修改在手机上表格最低宽度,可以在这里改动
*/
.ant-table-wrapper { .ant-table-wrapper {
.ant-table-body { .ant-table-content {
overflow-y: auto; overflow-y: auto;
} }
.ant-table-body {
min-width: 800px;
}
} }
.sidemenu { .sidemenu {
.ant-header-fixedHeader { .ant-header-fixedHeader {
......
...@@ -13,7 +13,7 @@ export const asyncRouterMap = [ ...@@ -13,7 +13,7 @@ export const asyncRouterMap = [
{ {
path: '/dashboard', path: '/dashboard',
name: 'dashboard', name: 'dashboard',
redirect: '/dashboard/analysis', redirect: '/dashboard/workplace',
component: RouteView, component: RouteView,
meta: { title: '仪表盘', icon: 'dashboard', permission: [ 'dashboard' ] }, meta: { title: '仪表盘', icon: 'dashboard', permission: [ 'dashboard' ] },
children: [ children: [
......
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="规则编号"> <a-form-item label="规则编号">
<a-input placeholder=""/> <a-input placeholder=""/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="使用状态"> <a-form-item label="使用状态">
<a-select placeholder="请选择" default-value="0"> <a-select placeholder="请选择" default-value="0">
<a-select-option value="0">全部</a-select-option> <a-select-option value="0">全部</a-select-option>
<a-select-option value="1">关闭</a-select-option> <a-select-option value="1">关闭</a-select-option>
<a-select-option value="2">运行中</a-select-option> <a-select-option value="2">运行中</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<template v-if="advanced"> <template v-if="advanced">
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="调用次数"> <a-form-item label="调用次数">
<a-input-number style="width: 100%"/> <a-input-number style="width: 100%"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="更新日期"> <a-form-item label="更新日期">
<a-date-picker style="width: 100%" placeholder="请输入更新日期"/> <a-date-picker style="width: 100%" placeholder="请输入更新日期"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="使用状态"> <a-form-item label="使用状态">
<a-select placeholder="请选择" default-value="0"> <a-select placeholder="请选择" default-value="0">
<a-select-option value="0">全部</a-select-option> <a-select-option value="0">全部</a-select-option>
<a-select-option value="1">关闭</a-select-option> <a-select-option value="1">关闭</a-select-option>
<a-select-option value="2">运行中</a-select-option> <a-select-option value="2">运行中</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="使用状态"> <a-form-item label="使用状态">
<a-select placeholder="请选择" default-value="0"> <a-select placeholder="请选择" default-value="0">
<a-select-option value="0">全部</a-select-option> <a-select-option value="0">全部</a-select-option>
<a-select-option value="1">关闭</a-select-option> <a-select-option value="1">关闭</a-select-option>
<a-select-option value="2">运行中</a-select-option> <a-select-option value="2">运行中</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
</template> </template>
<a-col :md="!advanced && 8 || 24" :sm="24"> <a-col :md="!advanced && 8 || 24" :sm="24">
<span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} "> <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
<a-button type="primary">查询</a-button> <a-button type="primary">查询</a-button>
<a-button style="margin-left: 8px">重置</a-button> <a-button style="margin-left: 8px">重置</a-button>
<a @click="toggleAdvanced" style="margin-left: 8px"> <a @click="toggleAdvanced" style="margin-left: 8px">
{{ advanced ? '收起' : '展开' }} {{ advanced ? '收起' : '展开' }}
<a-icon :type="advanced ? 'up' : 'down'"/> <a-icon :type="advanced ? 'up' : 'down'"/>
</a> </a>
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<div class="table-operator"> <div class="table-operator">
<a-button type="primary" icon="plus" @click="() => $router.push({name: 'anime-add'})">新建</a-button> <a-button type="primary" icon="plus" @click="() => $router.push({name: 'anime-add'})">新建</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1"><a-icon type="delete" />删除</a-menu-item> <a-menu-item key="1"><a-icon type="delete" />删除</a-menu-item>
<!-- lock | unlock --> <!-- lock | unlock -->
<a-menu-item key="2"><a-icon type="lock" />锁定</a-menu-item> <a-menu-item key="2"><a-icon type="lock" />锁定</a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> <a-button style="margin-left: 8px">
批量操作 <a-icon type="down" /> 批量操作 <a-icon type="down" />
</a-button> </a-button>
</a-dropdown> </a-dropdown>
</div> </div>
<s-table <s-table
ref="table" ref="table"
size="default" size="default"
:columns="columns" :columns="columns"
:data="loadData" :data="loadData"
:showAlertInfo="true" :showAlertInfo="true"
@onSelect="onChange" @onSelect="onChange"
> >
<template v-for="(col, index) in columns" v-if="col.scopedSlots" :slot="col.dataIndex" slot-scope="text, record, index"> <template v-for="(col, index) in columns" v-if="col.scopedSlots" :slot="col.dataIndex" slot-scope="text, record, index">
<div :key="index"> <div :key="index">
<a-input <a-input
v-if="record.editable" v-if="record.editable"
style="margin: -5px 0" style="margin: -5px 0"
:value="text" :value="text"
@change="e => handleChange(e.target.value, record.key, col)" @change="e => handleChange(e.target.value, record.key, col)"
/> />
<template v-else>{{ text }}</template> <template v-else>{{ text }}</template>
</div> </div>
</template> </template>
<template slot="action" slot-scope="text, record, index"> <template slot="action" slot-scope="text, record, index">
<div class='editable-row-operations'> <div class='editable-row-operations'>
<span v-if="record.editable"> <span v-if="record.editable">
<a @click="() => save(record)">保存</a> <a @click="() => save(record)">保存</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm title='真的放弃编辑吗?' @confirm="() => cancel(record)"> <a-popconfirm title='真的放弃编辑吗?' @confirm="() => cancel(record)">
<a>取消</a> <a>取消</a>
</a-popconfirm> </a-popconfirm>
</span> </span>
<span v-else> <span v-else>
<a class="edit" @click="() => edit(record)">修改</a> <a class="edit" @click="() => edit(record)">修改</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a class="delete" @click="() => del(record)">删除</a> <a class="delete" @click="() => del(record)">删除</a>
</span> </span>
</div> </div>
</template> </template>
</s-table> </s-table>
</a-card> </a-card>
</template> </template>
<script> <script>
import STable from '@/components/table/' import STable from '@/components/table/'
export default { export default {
name: "TableList", name: "TableList",
components: { components: {
STable STable
}, },
data () { data () {
return { return {
// 高级搜索 展开/关闭 // 高级搜索 展开/关闭
advanced: false, advanced: false,
// 查询参数 // 查询参数
queryParam: {}, queryParam: {},
// 表头 // 表头
columns: [ columns: [
{ {
title: '规则编号', title: '规则编号',
dataIndex: 'no', dataIndex: 'no',
width: 90 width: 90
}, },
{ {
title: '描述', title: '描述',
dataIndex: 'description', dataIndex: 'description',
scopedSlots: { customRender: 'description' }, scopedSlots: { customRender: 'description' },
}, },
{ {
title: '服务调用次数', title: '服务调用次数',
dataIndex: 'callNo', dataIndex: 'callNo',
width: '150px', width: '150px',
sorter: true, sorter: true,
needTotal: true, needTotal: true,
scopedSlots: { customRender: 'callNo' }, scopedSlots: { customRender: 'callNo' },
// customRender: (text) => text + ' 次' // customRender: (text) => text + ' 次'
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
width: '120px', width: '100px',
needTotal: true, needTotal: true,
scopedSlots: { customRender: 'status' }, scopedSlots: { customRender: 'status' },
}, },
{ {
title: '更新时间', title: '更新时间',
dataIndex: 'updatedAt', dataIndex: 'updatedAt',
width: '180px', width: '150px',
sorter: true, sorter: true,
scopedSlots: { customRender: 'updatedAt' }, scopedSlots: { customRender: 'updatedAt' },
}, },
{ {
table: '操作', table: '操作',
dataIndex: 'action', dataIndex: 'action',
width: '150px', width: '120px',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
} }
], ],
// 加载数据方法 必须为 Promise 对象 // 加载数据方法 必须为 Promise 对象
loadData: parameter => { loadData: parameter => {
return this.$http.get('/service', { return this.$http.get('/service', {
params: Object.assign(parameter, this.queryParam) params: Object.assign(parameter, this.queryParam)
}).then(res => { }).then(res => {
return res.result return res.result
}) })
}, },
selectedRowKeys: [], selectedRowKeys: [],
selectedRows: [] selectedRows: []
} }
}, },
methods: { methods: {
handleChange (value, key, column) { handleChange (value, key, column) {
console.log(value, key, column) console.log(value, key, column)
}, },
edit (row) { edit (row) {
row.editable = true row.editable = true
// row = Object.assign({}, row) // row = Object.assign({}, row)
this.$refs.table.updateEdit() this.$refs.table.updateEdit()
}, },
// eslint-disable-next-line // eslint-disable-next-line
del (row) { del (row) {
this.$confirm({ this.$confirm({
title: '警告', title: '警告',
content: '真的要删除吗?', content: '真的要删除吗?',
okText: '删除', okText: '删除',
okType: 'danger', okType: 'danger',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
console.log('OK'); console.log('OK');
// 在这里调用删除接口 // 在这里调用删除接口
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(Math.random() > 0.5 ? resolve : reject, 1000); setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
}).catch(() => console.log('Oops errors!')); }).catch(() => console.log('Oops errors!'));
}, },
onCancel() { onCancel() {
console.log('Cancel'); console.log('Cancel');
}, },
}); });
}, },
save (row) { save (row) {
delete row.editable delete row.editable
this.$refs.table.updateEdit() this.$refs.table.updateEdit()
}, },
cancel (row) { cancel (row) {
delete row.editable delete row.editable
this.$refs.table.updateEdit() this.$refs.table.updateEdit()
}, },
onChange (row) { onChange (row) {
this.selectedRowKeys = row.selectedRowKeys this.selectedRowKeys = row.selectedRowKeys
this.selectedRows = row.selectedRows this.selectedRows = row.selectedRows
}, },
toggleAdvanced () { toggleAdvanced () {
this.advanced = !this.advanced this.advanced = !this.advanced
}, },
}, },
watch: { watch: {
/* /*
'selectedRows': function (selectedRows) { 'selectedRows': function (selectedRows) {
this.needTotalList = this.needTotalList.map(item => { this.needTotalList = this.needTotalList.map(item => {
return { return {
...item, ...item,
total: selectedRows.reduce( (sum, val) => { total: selectedRows.reduce( (sum, val) => {
return sum + val[item.dataIndex] return sum + val[item.dataIndex]
}, 0) }, 0)
} }
}) })
} }
*/ */
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search { .search {
margin-bottom: 54px; margin-bottom: 54px;
} }
.fold { .fold {
width: calc(100% - 216px); width: calc(100% - 216px);
display: inline-block display: inline-block
} }
.operator { .operator {
margin-bottom: 18px; margin-bottom: 18px;
} }
@media screen and (max-width: 900px) { @media screen and (max-width: 900px) {
.fold { .fold {
width: 100%; width: 100%;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
:gutter="24" :gutter="24"
:style="{ marginBottom: '12px' }"> :style="{ marginBottom: '12px' }">
<a-col :span="12" v-for="(role, index) in record.permissions" :key="index" :style="{ marginBottom: '12px' }"> <a-col :span="12" v-for="(role, index) in record.permissions" :key="index" :style="{ marginBottom: '12px' }">
<a-col :span="4"> <a-col :lg="4" :md="24">
<span>{{ role.permissionName }}</span> <span>{{ role.permissionName }}</span>
</a-col> </a-col>
<a-col :span="20" v-if="role.actionEntitySet.length > 0"> <a-col :lg="20" :md="24" v-if="role.actionEntitySet.length > 0">
<a-tag color="cyan" v-for="(action, k) in role.actionEntitySet" :key="k">{{ action.describe }}</a-tag> <a-tag color="cyan" v-for="(action, k) in role.actionEntitySet" :key="k">{{ action.describe }}</a-tag>
</a-col> </a-col>
<a-col :span="20" v-else>-</a-col> <a-col :span="20" v-else>-</a-col>
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
loginBtn: false, loginBtn: false,
// login type: 0 email, 1 username, 2 telephone // login type: 0 email, 1 username, 2 telephone
loginType: 0, loginType: 0,
requiredTwoStepCaptcha: true, requiredTwoStepCaptcha: false,
stepCaptchaVisible: false, stepCaptchaVisible: false,
form: null, form: null,
state: { state: {
......
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