Commit 182bd1c3 by Sendya

fix: innerEditList zhCN lang

parent 5077398a
<template> <template>
<page-layout :desc="description" :title="getTitle" :link-list="linkList"> <page-layout :desc="description" :title="getTitle" :link-list="linkList">
<div slot="extra" class="extra-img"> <div slot="extra" class="extra-img">
<img :src="extraImage"/> <img :src="extraImage"/>
</div> </div>
<!-- keep-alive --> <!-- keep-alive -->
<route-view ref="content"></route-view> <route-view ref="content"></route-view>
</page-layout> </page-layout>
</template> </template>
<script> <script>
import PageLayout from './PageLayout' import PageLayout from './PageLayout'
import RouteView from './RouteView' import RouteView from './RouteView'
export default { export default {
name: "PageContent", name: "PageContent",
components: { components: {
RouteView, RouteView,
PageLayout PageLayout
}, },
data () { data () {
return { return {
title: '', title: '',
description: '', description: '',
linkList: [], linkList: [],
extraImage: '' extraImage: ''
} }
}, },
mounted () { mounted () {
this.getPageHeaderInfo() this.getPageHeaderInfo()
}, },
updated () { updated () {
this.getPageHeaderInfo() this.getPageHeaderInfo()
}, },
computed: { computed: {
getTitle () { getTitle () {
return this.$route.meta.title return this.$route.meta.title
} }
}, },
methods: { methods: {
getPageHeaderInfo () { getPageHeaderInfo () {
// eslint-disable-next-line // eslint-disable-next-line
this.title = this.$route.meta.title this.title = this.$route.meta.title
// 因为套用了一层 route-view 所以要取 ref 对象下的子节点的第一个对象 // 因为套用了一层 route-view 所以要取 ref 对象下的子节点的第一个对象
const content = this.$refs.content.$children[0] const content = this.$refs.content && this.$refs.content.$children[0]
if (content) { if (content) {
this.description = content.description this.description = content.description
this.linkList = content.linkList this.linkList = content.linkList
this.extraImage = content.extraImage this.extraImage = content.extraImage
} }
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.extra-img{ .extra-img{
margin-top: -60px; margin-top: -60px;
text-align: center; text-align: center;
width: 195px; width: 195px;
img{ img{
width: 100%; width: 100%;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="exception"> <div class="exception">
<div class="img"> <div class="img">
<img :src="config[type].img"/> <img :src="config[type].img"/>
</div> </div>
<div class="content"> <div class="content">
<h1>{{ config[type].title }}</h1> <h1>{{ config[type].title }}</h1>
<div class="desc">{{ config[type].desc }}</div> <div class="desc">{{ config[type].desc }}</div>
<div class="action"> <div class="action">
<a-button type="primary" @click="handleToHome">返回首页</a-button> <a-button type="primary" @click="handleToHome">返回首页</a-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import types from './type' import types from './type'
export default { export default {
name: "Exception", name: "Exception",
props: { props: {
type: { type: {
type: Number, type: String,
default: 404 default: '404'
} }
}, },
data() { data() {
return { return {
config: types config: types
} }
}, },
methods: { methods: {
handleToHome () { handleToHome () {
this.$router.push({ name: 'dashboard' }) this.$router.push({ name: 'dashboard' })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.exception { .exception {
min-height: 500px; min-height: 500px;
height: 80%; height: 80%;
align-items: center; align-items: center;
text-align: center; text-align: center;
margin-top: 150px; margin-top: 150px;
.img { .img {
display: inline-block; display: inline-block;
padding-right: 52px; padding-right: 52px;
zoom: 1; zoom: 1;
img { img {
height: 360px; height: 360px;
max-width: 430px; max-width: 430px;
} }
} }
.content { .content {
display: inline-block; display: inline-block;
flex: auto; flex: auto;
h1 { h1 {
color: #434e59; color: #434e59;
font-size: 72px; font-size: 72px;
font-weight: 600; font-weight: 600;
line-height: 72px; line-height: 72px;
margin-bottom: 24px; margin-bottom: 24px;
} }
.desc { .desc {
color: rgba(0, 0, 0, .45); color: rgba(0, 0, 0, .45);
font-size: 20px; font-size: 20px;
line-height: 28px; line-height: 28px;
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<div :class="advanced ? 'search' : null"> <div :class="advanced ? 'search' : null">
<a-form layout="horizontal"> <a-form layout="horizontal">
<div :class="advanced ? null : 'fold'"> <div :class="advanced ? null : 'fold'">
<a-row :gutter="48"> <a-row :gutter="48">
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item <a-form-item
label="规则编号" label="规则编号"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}" :wrapperCol="{span: 18, offset: 1}"
> >
<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 <a-form-item
label="使用状态" label="使用状态"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}" :wrapperCol="{span: 18, offset: 1}"
> >
<a-select placeholder="请选择"> <a-select placeholder="请选择">
<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 <a-form-item
label="调用次数" label="调用次数"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}" :wrapperCol="{span: 18, offset: 1}"
> >
<a-input-number style="width: 100%" placeholder="请输入"/> <a-input-number style="width: 100%" placeholder="请输入"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="48" v-if="advanced"> <a-row :gutter="48" v-if="advanced">
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item <a-form-item
label="更新日期" label="更新日期"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}"> :wrapperCol="{span: 18, offset: 1}">
<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 <a-form-item
label="使用状态" label="使用状态"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}"> :wrapperCol="{span: 18, offset: 1}">
<a-select placeholder="请选择"> <a-select placeholder="请选择">
<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 <a-form-item
label="描述" label="描述"
:labelCol="{span: 5}" :labelCol="{span: 5}"
:wrapperCol="{span: 18, offset: 1}" :wrapperCol="{span: 18, offset: 1}"
> >
<a-input placeholder="请输入"/> <a-input placeholder="请输入"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
<span style="float: right; margin-top: 3px;"> <span style="float: right; margin-top: 3px;">
<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-form> </a-form>
</div> </div>
<s-table <s-table
ref="table" ref="table"
size="default" size="default"
:columns="columns" :columns="columns"
:data="loadData" :data="loadData"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onChange }" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: 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)" style="margin-right: 12px">Save</a> <a @click="() => save(record)">保存</a>
<a-popconfirm title='Sure to cancel?' @confirm="() => cancel(record)"> <a-divider type="vertical" />
<a>Cancel</a> <a-popconfirm title='真的放弃编辑吗?' @confirm="() => cancel(record)">
</a-popconfirm> <a>取消</a>
</span> </a-popconfirm>
<span v-else> </span>
<a @click="() => edit(record, index)">Edit</a> <span v-else>
</span> <a @click="() => edit(record, index)">修改</a>
</div> <a-divider type="vertical" />
</template> <a @click="() => delete(record, index)">删除</a>
</s-table> </span>
</div>
</a-card> </template>
</template> </s-table>
<script> </a-card>
import STable from '@/components/table/' </template>
export default { <script>
name: "TableList", import STable from '@/components/table/'
components: {
STable export default {
}, name: "TableList",
data () { components: {
return { STable
// 高级搜索 展开/关闭 },
advanced: false, data () {
// 查询参数 return {
queryParam: {}, // 高级搜索 展开/关闭
// 表头 advanced: false,
columns: [ // 查询参数
{ queryParam: {},
title: '规则编号', // 表头
dataIndex: 'no' columns: [
}, {
{ title: '规则编号',
title: '描述', dataIndex: 'no',
dataIndex: 'description', width: 90
scopedSlots: { customRender: 'description' }, },
}, {
{ title: '描述',
title: '服务调用次数', dataIndex: 'description',
dataIndex: 'callNo', scopedSlots: { customRender: 'description' },
sorter: true, },
needTotal: true, {
scopedSlots: { customRender: 'callNo' }, title: '服务调用次数',
// customRender: (text) => text + ' 次' dataIndex: 'callNo',
}, width: '150px',
{ sorter: true,
title: '状态', needTotal: true,
dataIndex: 'status', scopedSlots: { customRender: 'callNo' },
needTotal: true, // customRender: (text) => text + ' 次'
scopedSlots: { customRender: 'status' }, },
}, {
{ title: '状态',
title: '更新时间', dataIndex: 'status',
dataIndex: 'updatedAt', width: '120px',
sorter: true, needTotal: true,
scopedSlots: { customRender: 'updatedAt' }, scopedSlots: { customRender: 'status' },
}, },
{ {
table: '操作', title: '更新时间',
dataIndex: 'action', dataIndex: 'updatedAt',
width: '150px', width: '180px',
scopedSlots: { customRender: 'action' }, sorter: true,
} scopedSlots: { customRender: 'updatedAt' },
], },
// 加载数据方法 必须为 Promise 对象 {
loadData: parameter => { table: '操作',
return this.$http.get('/service', { dataIndex: 'action',
params: Object.assign(parameter, this.queryParam) width: '150px',
}).then(res => { scopedSlots: { customRender: 'action' },
return res.result }
}) ],
}, // 加载数据方法 必须为 Promise 对象
loadData: parameter => {
selectedRowKeys: [], return this.$http.get('/service', {
selectedRows: [] params: Object.assign(parameter, this.queryParam)
} }).then(res => {
}, return res.result
methods: { })
},
handleChange (value, key, column) {
console.log(value, key, column) selectedRowKeys: [],
}, selectedRows: []
edit (row) { }
row.editable = true },
row = Object.assign({}, row) methods: {
this.$refs.table.updateEdit()
}, handleChange (value, key, column) {
save (row) { console.log(value, key, column)
delete row.editable },
this.$refs.table.updateEdit() edit (row) {
}, row.editable = true
cancel (row) { row = Object.assign({}, row)
delete row.editable this.$refs.table.updateEdit()
this.$refs.table.updateEdit() },
}, save (row) {
delete row.editable
onChange (selectedRowKeys, selectedRows) { this.$refs.table.updateEdit()
this.selectedRowKeys = selectedRowKeys },
this.selectedRows = selectedRows cancel (row) {
}, delete row.editable
toggleAdvanced () { this.$refs.table.updateEdit()
this.advanced = !this.advanced },
},
}, onChange (selectedRowKeys, selectedRows) {
watch: { this.selectedRowKeys = selectedRowKeys
/* this.selectedRows = selectedRows
'selectedRows': function (selectedRows) { },
this.needTotalList = this.needTotalList.map(item => { toggleAdvanced () {
return { this.advanced = !this.advanced
...item, },
total: selectedRows.reduce( (sum, val) => { },
return sum + val[item.dataIndex] watch: {
}, 0) /*
} 'selectedRows': function (selectedRows) {
}) this.needTotalList = this.needTotalList.map(item => {
} return {
*/ ...item,
} total: selectedRows.reduce( (sum, val) => {
} return sum + val[item.dataIndex]
</script> }, 0)
}
<style lang="scss" scoped> })
.search { }
margin-bottom: 54px; */
} }
}
.fold { </script>
width: calc(100% - 216px);
display: inline-block <style lang="scss" scoped>
} .search {
margin-bottom: 54px;
.operator { }
margin-bottom: 18px;
} .fold {
width: calc(100% - 216px);
@media screen and (max-width: 900px) { display: inline-block
.fold { }
width: 100%;
} .operator {
} margin-bottom: 18px;
}
@media screen and (max-width: 900px) {
.fold {
width: 100%;
}
}
</style> </style>
\ No newline at end of file
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