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

对接列表接口

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