提交 e954f05a authored 作者: 王鹏飞's avatar 王鹏飞

对接列表接口

上级 01f6ed3e
......@@ -5,3 +5,23 @@ import httpRequest from '@/utils/axios'
export function getAdList(params) {
return httpRequest.get('/api/cms/api/v1/advertisements', { params })
}
/**
* 获取文章列表
* @param {string} type_id 类型id
* @param {number} id_title id或标题
* @param {string} project_id 项目id
*/
export function getArticleList(params) {
return httpRequest.get('/api/cms/api/v1/articles', { params })
}
/**
* 获取图文列表
* @param {string} type_id 类型id
* @param {number} id_title id或标题
* @param {string} project_id 项目id
*/
export function getImgTextList(params) {
return httpRequest.get('/api/cms/api/v1/img-texts', { params })
}
......@@ -35,8 +35,8 @@
<div class="table-list-hd-aside"><slot name="header-aside" /></div>
</div>
<slot></slot>
<div class="table-list-bd" :style="{height: bodyHeight}">
<el-table :data="dataList" size="mini" v-loading="loading" v-bind="$attrs" v-on="$listeners" height="calc(100% - 40px)">
<div class="table-list-bd">
<el-table :data="dataList" size="mini" v-loading="loading" v-bind="$attrs" v-on="$listeners" style="height: 100%">
<template v-for="item in columns">
<el-table-column v-bind="item" :key="item.prop">
<template v-slot:default="scope" v-if="item.slots">
......@@ -45,13 +45,14 @@
</el-table-column>
</template>
</el-table>
</div>
<div class="table-list-ft">
<el-pagination
class="table-list-pagination"
layout="total, prev, pager, next, sizes, jumper"
:page-sizes="[10, 20, 30, 50, 100]"
:page-size="page.size"
:total="page.total"
:hide-on-single-page="false"
@size-change="pageSizeChange"
@current-change="fetchList"
v-if="hasPagination"
......@@ -69,8 +70,6 @@ export default {
remote: { type: Object, default: () => ({}) },
// 筛选
filters: { type: Array, default: () => [] },
// 列表是否有多选
tableSelection: { type: Boolean, default: false },
// 列表项
columns: { type: Array, default: () => [] },
// 列表数据
......@@ -78,8 +77,7 @@ export default {
// 是否含有翻页
hasPagination: { type: Boolean, default: true },
// 每页多少条数据
limit: { type: Number, default: 20 },
bodyHeight: { type: String, default: '100%' }
limit: { type: Number, default: 20 }
},
data() {
return {
......@@ -133,7 +131,7 @@ export default {
this.loading = true
httpRequest(params)
.then(res => {
const { data, total } = res.data
const { data = [], total = 0 } = res.data || {}
this.page.total = total
this.dataList = callback ? callback(data) : data
})
......@@ -175,7 +173,10 @@ export default {
<style lang="scss">
.table-list {
padding: 10px;
height:calc(100% - 20px)
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.table-list-hd {
display: flex;
......@@ -183,9 +184,11 @@ export default {
.table-list-filter {
flex: 1;
}
// .table-list-bd {
// height:calc(100% - 50px)
// }
.table-list-bd {
flex: 1;
}
.table-list-ft {
}
.table-list-pagination {
padding: 10px 0;
text-align: right;
......
......@@ -50,6 +50,7 @@
import TableList from '@/components/TableList'
import DrawerForm from '../components/DrawerForm.vue'
import ReviewForm from '../components/ReviewForm.vue'
import { getAdList } from '@/api/contentManage'
export default {
components: { TableList, DrawerForm, ReviewForm },
data() {
......@@ -83,23 +84,24 @@ export default {
tableOptions() {
return {
remote: {
params: { id: '', type: '', project: '' },
httpRequest: getAdList,
params: { type_id: '', id_title: '', project_id: '' },
beforeRequest: this.beforeRequest
},
filters: [
{
type: 'select',
placeholder: '项目',
prop: 'project',
prop: 'project_id',
options: this.projectList,
labelKey: 'project_name',
valueKey: 'project_id'
},
{ type: 'input', placeholder: 'ID', prop: 'id' },
{ type: 'input', placeholder: 'ID', prop: 'id_title' },
{
type: 'select',
placeholder: '类型',
prop: 'type',
prop: 'type_id',
options: this.typeList,
labelKey: 'name',
valueKey: 'id'
......
......@@ -49,6 +49,7 @@
<script>
import DrawerForm from '../components/DrawerForm.vue'
import TableList from '@/components/TableList'
import { getArticleList } from '@/api/contentManage'
export default {
data() {
return {
......@@ -80,23 +81,24 @@ export default {
tableOptions() {
return {
remote: {
params: { id: '', type: '', project: '' },
httpRequest: getArticleList,
params: { type_id: '', id_title: '', project_id: '' },
beforeRequest: this.beforeRequest
},
filters: [
{
type: 'select',
placeholder: '项目',
prop: 'project',
prop: 'project_id',
options: this.projectList,
labelKey: 'project_name',
valueKey: 'project_id'
},
{ type: 'input', placeholder: 'ID', prop: 'id' },
{ type: 'input', placeholder: 'ID', prop: 'id_title' },
{
type: 'select',
placeholder: '类型',
prop: 'type',
prop: 'type_id',
options: this.typeList,
labelKey: 'name',
valueKey: 'id'
......
......@@ -49,6 +49,7 @@
<script>
import DrawerForm from '../components/DrawerForm.vue'
import TableList from '@/components/TableList'
import { getImgTextList } from '@/api/contentManage'
export default {
data() {
return {
......@@ -81,23 +82,24 @@ export default {
tableOptions() {
return {
remote: {
params: { id: '', type: '', project: '' },
httpRequest: getImgTextList,
params: { type_id: '', id_title: '', project_id: '' },
beforeRequest: this.beforeRequest
},
filters: [
{
type: 'select',
placeholder: '项目',
prop: 'project',
prop: 'project_id',
options: this.projectList,
labelKey: 'project_name',
valueKey: 'project_id'
},
{ type: 'input', placeholder: 'ID', prop: 'id' },
{ type: 'input', placeholder: 'ID', prop: 'id_title' },
{
type: 'select',
placeholder: '类型',
prop: 'type',
prop: 'type_id',
options: this.typeList,
labelKey: 'name',
valueKey: 'id'
......
......@@ -86,6 +86,7 @@
</template>
<script>
import TableList from '@/components/TableList'
import { getStaffList } from '@/api/settings'
import _ from 'lodash'
const MOBILE_REG = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
const EMAIL_REG = /^[A-Za-z0-9]+([_.][A-Za-z0-9]+)*@([A-Za-z0-9-]+\.)+[A-Za-z]{2,6}$/
......@@ -177,13 +178,14 @@ export default {
tableOptions() {
return {
remote: {
httpRequest: getStaffList,
params: {}
},
filters: [
{
type: 'select',
placeholder: '项目',
prop: 'project',
prop: 'project_id',
options: this.projectList,
labelKey: 'project_name',
valueKey: 'project_id'
......@@ -192,25 +194,23 @@ export default {
{
type: 'select',
placeholder: '角色',
prop: 'type',
prop: 'role_id',
options: this.roleList,
labelKey: 'name',
valueKey: 'id'
}
],
columns: [
{ prop: 'name', label: '姓名' },
{ prop: 'sso_user.real_name', label: '姓名' },
{ prop: 'role', label: '角色' },
{ prop: 'phone', label: '手机号' },
{ prop: 'email', label: '邮箱' },
{ prop: 'proejct_name', label: '项目' },
{ prop: 'sso_user.mobile', label: '手机号' },
{ prop: 'sso_user.email', label: '邮箱' },
{ prop: 'project_ids', label: '项目' },
{ prop: 'author', label: '创建人' },
{ prop: 'create_time', label: '创建时间' },
{ prop: 'created_at', label: '创建时间' },
{ prop: 'status', label: '状态', slots: 'status' },
{ prop: 'x', label: '操作', slots: 'tools' }
],
data: [{ name: 'a', role: '超级管理员', phone: '123812312321', email: 'dsfdsxxx' }],
bodyHeight: 'calc(100% - 50px)'
]
}
}
},
......
......@@ -139,13 +139,7 @@ export default {
return text
}
},
created() {
// this.fetchTypeList()
},
methods: {
// handleTabClick() {
// this.fetchTypeList()
// },
handleCreate() {
this.dialogType = 'create'
this.dialogVisible = true
......@@ -181,7 +175,6 @@ export default {
})
},
statusChange(val) {
// console.log(val)
this.fetchUpdateType({
type_id: val.id,
status: val.status
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论