Compare commits

..

No commits in common. "master" and "main" have entirely different histories.
master ... main

21 changed files with 367 additions and 416 deletions

9
src/api/table.js Normal file
View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
export function getList(params) {
return request({
url: '/vue-admin-template/table/list',
method: 'get',
params
})
}

View File

@ -1,5 +1,5 @@
import request from '@/utils/request'
// 登录
export function login(data) {
return request({
url: '/vue-admin-template/user/login',
@ -7,7 +7,7 @@ export function login(data) {
data
})
}
// 用户信息
export function getInfo(token) {
return request({
url: '/vue-admin-template/user/info',
@ -15,42 +15,10 @@ export function getInfo(token) {
params: { token }
})
}
// 登出
export function logout() {
return request({
url: '/vue-admin-template/user/logout',
method: 'post'
})
}
// 推广人注册
export function register(data) {
return request({
url: '/api/promoter/register',
method: 'post',
data
})
}
// 图片上传
export function upload(data) {
return request({
url: '/api/public/upload',
method: 'post',
data
})
}
// 所在地区
export function getArea(data) {
return request({
url: '/api/public/areas',
method: 'post',
data
})
}
// 进件列表
export function getApplyList(data) {
return request({
url: '/api/promoter/account_list',
method: 'post',
data
})
}

View File

@ -29,12 +29,12 @@ export default {
methods: {
getBreadcrumb() {
// only show routes with meta.title
const matched = this.$route.matched.filter(item => item.meta && item.meta.title)
// const first = matched[0]
let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0]
// if (!this.isDashboard(first)) {
// matched = [{ path: '/dashboard', meta: { title: '广' }}].concat(matched)
// }
if (!this.isDashboard(first)) {
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
}
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
},

View File

@ -7,10 +7,21 @@
<div class="right-menu">
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
<img class="user-avatar" :src="'https://pics0.baidu.com/feed/38dbb6fd5266d0162e9568c498ca300937fa35b9.jpeg?token=7a95a445d85460e466d9063cbc0597e3'" alt="">
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
<el-dropdown-item>
Home
</el-dropdown-item>
</router-link>
<a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
<el-dropdown-item>Github</el-dropdown-item>
</a>
<a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
<el-dropdown-item>Docs</el-dropdown-item>
</a>
<el-dropdown-item divided @click.native="logout">
<span style="display:block;">Log Out</span>
</el-dropdown-item>
@ -42,7 +53,7 @@ export default {
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push({ name: 'login' })
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
}
}
}

View File

@ -29,9 +29,9 @@ if (process.env.NODE_ENV === 'production') {
}
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui按如下方式声明
Vue.use(ElementUI)
// Vue.use(ElementUI)
Vue.config.productionTip = false

View File

@ -32,7 +32,7 @@ router.beforeEach(async(to, from, next) => {
} else {
try {
// get user info
// await store.dispatch('user/getInfo')
await store.dispatch('user/getInfo')
next()
} catch (error) {

View File

@ -51,19 +51,28 @@ export const constantRoutes = [
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '推广人列表', icon: 'dashboard' }
meta: { title: 'Dashboard', icon: 'dashboard' }
}]
},
{
path: '/example',
component: Layout,
redirect: '/example/table',
name: 'Example',
meta: { title: 'Example', icon: 'el-icon-s-help' },
children: [
{
path: 'table',
name: 'Table',
component: () => import('@/views/table/index'),
meta: { title: '进件审核', icon: 'table' }
meta: { title: 'Table', icon: 'table' }
},
{
path: 'tree',
name: 'Tree',
component: () => import('@/views/tree/index'),
meta: { title: 'Tree', icon: 'tree' }
}
]
},
@ -76,7 +85,77 @@ export const constantRoutes = [
path: 'index',
name: 'Form',
component: () => import('@/views/form/index'),
meta: { title: '新增推广人', icon: 'form' }
meta: { title: 'Form', icon: 'form' }
}
]
},
{
path: '/nested',
component: Layout,
redirect: '/nested/menu1',
name: 'Nested',
meta: {
title: 'Nested',
icon: 'nested'
},
children: [
{
path: 'menu1',
component: () => import('@/views/nested/menu1/index'), // Parent router-view
name: 'Menu1',
meta: { title: 'Menu1' },
children: [
{
path: 'menu1-1',
component: () => import('@/views/nested/menu1/menu1-1'),
name: 'Menu1-1',
meta: { title: 'Menu1-1' }
},
{
path: 'menu1-2',
component: () => import('@/views/nested/menu1/menu1-2'),
name: 'Menu1-2',
meta: { title: 'Menu1-2' },
children: [
{
path: 'menu1-2-1',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
name: 'Menu1-2-1',
meta: { title: 'Menu1-2-1' }
},
{
path: 'menu1-2-2',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
name: 'Menu1-2-2',
meta: { title: 'Menu1-2-2' }
}
]
},
{
path: 'menu1-3',
component: () => import('@/views/nested/menu1/menu1-3'),
name: 'Menu1-3',
meta: { title: 'Menu1-3' }
}
]
},
{
path: 'menu2',
component: () => import('@/views/nested/menu2/index'),
name: 'Menu2',
meta: { title: 'menu2' }
}
]
},
{
path: 'external-link',
component: Layout,
children: [
{
path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
meta: { title: 'External Link', icon: 'link' }
}
]
},

View File

@ -30,50 +30,51 @@ const mutations = {
const actions = {
// user login
login({ commit }, userInfo) {
// const { username, password } = userInfo
const { username, password } = userInfo
return new Promise((resolve, reject) => {
// login({ username: username.trim(), password: password }).then(response => {
commit('SET_TOKEN', 'admin-token')
setToken('admin-token')
resolve()
// }).catch(error => {
// reject(error)
// })
login({ username: username.trim(), password: password }).then(response => {
const { data } = response
commit('SET_TOKEN', data.token)
setToken(data.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// get user info
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
// getInfo(state.token).then(response => {
// const { data } = response
getInfo(state.token).then(response => {
const { data } = response
// if (!data) {
// return reject('Verification failed, please Login again.')
// }
if (!data) {
return reject('Verification failed, please Login again.')
}
// const { name, avatar } = data
const { name, avatar } = data
// commit('SET_NAME', name)
// commit('SET_AVATAR', avatar)
// resolve(data)
// }).catch(error => {
// reject(error)
// })
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}).catch(error => {
reject(error)
})
})
},
// user logout
logout({ commit, state }) {
return new Promise((resolve, reject) => {
// logout(state.token).then(() => {
removeToken() // must remove token first
resetRouter()
commit('RESET_STATE')
resolve()
// }).catch(error => {
// reject(error)
// })
logout(state.token).then(() => {
removeToken() // must remove token first
resetRouter()
commit('RESET_STATE')
resolve()
}).catch(error => {
reject(error)
})
})
},

View File

@ -5,9 +5,8 @@ import { getToken } from '@/utils/auth'
// create an axios instance
const service = axios.create({
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
baseURL: 'http://192.168.0.155:7301',
timeout: 5000 // request timeout
})
@ -47,12 +46,26 @@ service.interceptors.response.use(
const res = response.data
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 200) {
if (res.code !== 20000) {
Message({
message: res.message || 'Error',
type: 'error',
duration: 5 * 1000
})
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// to re-login
MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
confirmButtonText: 'Re-Login',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
store.dispatch('user/resetToken').then(() => {
location.reload()
})
})
}
return Promise.reject(new Error(res.message || 'Error'))
} else {
return res

View File

@ -1,46 +1,6 @@
<template>
<div class="dashboard-container">
<div class="dashboard-text">
<el-table
:data="tableData"
height="800"
border
style="width: 100%"
>
<el-table-column
prop="date"
label="编号"
/>
<el-table-column
prop="name"
label="姓名"
/>
<el-table-column
prop="address"
label="手机号"
/>
<el-table-column
prop="name"
label="推广总数"
/>
<el-table-column
prop="name"
label="审核通过完成数"
/>
<el-table-column
prop="name"
label="入驻时间"
/>
<el-table-column
prop="name"
label="推广人编号"
/>
<el-table-column
prop="name"
label="所在地区"
/>
</el-table>
</div>
<div class="dashboard-text">name: {{ name }}</div>
</div>
</template>
@ -49,39 +9,6 @@ import { mapGetters } from 'vuex'
export default {
name: 'Dashboard',
data() {
return {
tableData: [{
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-08',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-06',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-07',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}]
}
},
computed: {
...mapGetters([
'name'

View File

@ -1,160 +1,77 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="120px" :rules="rules">
<el-form-item label="名字" prop="name">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" />
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="所属地区" prop="area">
<el-cascader
ref="cascaderRef"
:props="props"
@change="handleChange"
/>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%;" />
</el-col>
<el-col :span="2" class="line">-</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" type="fixed-time" placeholder="Pick a time" style="width: 100%;" />
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch v-model="form.delivery" />
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox label="Online activities" name="type" />
<el-checkbox label="Promotion activities" name="type" />
<el-checkbox label="Offline activities" name="type" />
<el-checkbox label="Simple brand exposure" name="type" />
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio label="Sponsor" />
<el-radio label="Venue" />
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input v-model="form.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">添加</el-button>
<el-button type="primary" @click="onSubmit">Create</el-button>
<el-button @click="onCancel">Cancel</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { register, getArea } from '@/api/user'
export default {
data() {
return {
form: {
name: '',
phone: '',
area: {}
},
rules: {
name: [
{ required: true, message: '请输入名字', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入手机号', trigger: 'change' },
{ min: 11, max: 11, message: '长度为11位', trigger: 'blur' }
],
area: [
{ required: true, message: '请选择地区', trigger: 'change' }
]
},
proviceID: '',
cityID: '',
provice_name: '',
city_name: '',
area_name: '',
props: {
lazy: true,
lazyLoad(node, resolve) {
var nodes = []
const { level } = node
// 1
const type = level === 0 ? '1' : node.value
const child = []
const child2 = []
if (node.level === 0) {
getArea({ area_level: type }).then(res => {
if (res && res.data) {
//
res.data.map(item => {
const obj = {
value: item.cityCd,
label: item.cityNm,
leaf: level >= 2
}
nodes.push(obj)
this.options = nodes
})
return resolve(nodes)
}
})
} else if (node.level === 1) { //
nodes = this.options
getArea({ parent_city_cd: node.data.value, area_level: '2' }).then(res => {
nodes.map(item => {
if (item.value === node.data.value) {
item.children = []
res.data.map(item2 => {
const obj = {
value: item2.cityCd,
label: item2.cityNm,
leaf: level >= 3
}
item.children.push(obj)
child.push(obj)
})
}
})
this.options = nodes
this.proviceID = node.data.value
this.provice_name = node.data.label
return resolve(child)
})
} else if (node.level === 2) { //
nodes = this.options
this.cityID = node.data.value
this.city_name = node.data.label
getArea({ parent_city_cd: node.data.value, area_level: '3' }).then(res => {
this.options.map(item => {
if (item.value === this.proviceID) {
item.children.map(item2 => {
if (item2.value === this.cityID) {
item2.children = []
res.data.map(item3 => {
const obj = {
value: item3.cityCd,
label: item3.cityNm,
leaf: true
}
item2.children.push(obj)
child2.push(obj)
})
}
})
}
})
return resolve(child2)
})
}
}
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
}
}
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
register({ name: this.form.name, phone: this.form.phone,
area: {
provice_name: this.form.area.provice_name,
city_name: this.form.area.city_name,
area_name: this.form.area.area_name
}}
).then(res => {
if (res && res.code === 200) {
this.$message('添加成功!')
this.resetForm(formName)
} else {
this.$message(res.msg)
}
})
}
onSubmit() {
this.$message('submit!')
},
onCancel() {
this.$message({
message: 'cancel!',
type: 'warning'
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
},
handleChange(value) {
this.form.area = {
provice_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[0],
city_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[1],
area_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[2]
}
}
}
}

View File

@ -3,7 +3,7 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
<div class="title-container">
<h3 class="title">登录</h3>
<h3 class="title">Login Form</h3>
</div>
<el-form-item prop="username">
@ -41,7 +41,7 @@
</span>
</el-form-item>
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button>
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
<div class="tips">
<span style="margin-right:20px;">username: admin</span>
@ -67,7 +67,7 @@ export default {
}
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error('密码不能少于6位数'))
callback(new Error('The password can not be less than 6 digits'))
} else {
callback()
}

View File

@ -0,0 +1,7 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1">
<router-view />
</el-alert>
</div>
</template>

View File

@ -0,0 +1,7 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-1" type="success">
<router-view />
</el-alert>
</div>
</template>

View File

@ -0,0 +1,7 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2" type="success">
<router-view />
</el-alert>
</div>
</template>

View File

@ -0,0 +1,5 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2-1" type="warning" />
</div>
</template>

View File

@ -0,0 +1,5 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2-2" type="warning" />
</div>
</template>

View File

@ -0,0 +1,5 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-3" type="success" />
</div>
</template>

View File

@ -0,0 +1,5 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 2" />
</div>
</template>

View File

@ -1,138 +1,66 @@
<template>
<div class="app-container">
<!-- -->
<el-table
element-loading-text="Loading"
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column align="center" label="商户名字">
<el-table-column align="center" label="ID" width="95">
<template slot-scope="scope">
{{ scope.row.shop_name }}
{{ scope.$index }}
</template>
</el-table-column>
<el-table-column label="进件时间" align="center">
<el-table-column label="Title">
<template slot-scope="scope">
<span>{{ scope.row.account_date }}</span>
{{ scope.row.title }}
</template>
</el-table-column>
<el-table-column label="所在地区" align="center">
<el-table-column label="Author" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.license_address }}
<span>{{ scope.row.author }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="费率" align="center">
<el-table-column label="Pageviews" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.rates }}
{{ scope.row.pageviews }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="商户手机号" align="center">
<el-table-column class-name="status-col" label="Status" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.phone }}
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="法人名字" align="center">
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="进件人" align="center">
<template slot-scope="scope">
{{ scope.row.manager }}
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="进件状态">
<template slot-scope="scope">
<span>{{ scope.row.state==1?'进件中': scope.row.state==2?'审核中':scope.row.state==3?'待签约':scope.row.state==4?'已驳回':'已完成' }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="详情" align="center">
<template slot-scope="scope">
<span style="color: #409EFF;" @click="checkInfo(scope.row)">查看</span>
<i class="el-icon-time" />
<span>{{ scope.row.display_time }}</span>
</template>
</el-table-column>
</el-table>
<el-dialog title="进件详情" :visible.sync="dialogFormVisible">
<el-form :model="form" :inline="true">
<el-form-item label="店铺名称" :label-width="formLabelWidth">
<el-input v-model="form.shop_name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="法人姓名" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="法人身份证号" :label-width="formLabelWidth">
<el-input v-model="form.id_number" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="手机号" :label-width="formLabelWidth">
<el-input v-model="form.phone" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="邮箱" :label-width="formLabelWidth">
<el-input v-model="form.email" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item
label="统一社会信用代
"
:label-width="formLabelWidth"
>
<el-input v-model="form.uscc" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="营业执照名称" :label-width="formLabelWidth">
<el-input v-model="form.license_name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="营业执照地址" :label-width="formLabelWidth">
<el-input v-model="form.license_address" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="结算银行卡号" :label-width="formLabelWidth">
<el-input v-model="form.bank_number" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="预留手机号" :label-width="formLabelWidth">
<el-input v-model="form.bank_phone" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="进件人" :label-width="formLabelWidth">
<el-input v-model="form.manager" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="费率" :label-width="formLabelWidth">
<el-input v-model="form.rates" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="进件状态" :label-width="formLabelWidth">
<el-input v-model="form.state==1?'进件中': form.state==2?'审核中':form.state==3?'待签约':form.state==4?'已驳回':'已完成'" autocomplete="off" :disabled="true" />
</el-form-item>
</el-form>
</el-dialog>
<!-- 分页 -->
<el-pagination
background
layout="prev, pager, next"
:total="total"
:page-size="size"
:current-page="page"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { getApplyList } from '@/api/user'
import { getList } from '@/api/table'
export default {
data() {
return {
list: [],
dialogFormVisible: false,
formLabelWidth: '120px',
form: {},
page: 1,
size: 20,
total: 0
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'gray',
deleted: 'danger'
}
return statusMap[status]
}
},
computed: {
currentList() {
const start = (this.page - 1) * this.size
return this.list.slice(start, start + this.size) //
data() {
return {
list: null,
listLoading: true
}
},
created() {
@ -140,33 +68,12 @@ export default {
},
methods: {
fetchData() {
getApplyList({ page: this.page, size: this.size }).then(res => {
this.total = res.data.total || 0
this.list = res.data.data || []
this.listLoading = true
getList().then(response => {
this.list = response.data.items
this.listLoading = false
})
},
handleSizeChange(val) {
this.size = val //
this.page = 1 //
this.fetchData()
},
handleCurrentChange(val) {
this.page = val //
this.fetchData() //
},
checkInfo(row) {
this.form = row
this.dialogFormVisible = true
}
}
}
</script>
<style scoped>
.el-pagination {
text-align: center;
margin-top: 20px;
}
.el-table th.status-col {
width: 120px;
}
</style>

78
src/views/tree/index.vue Normal file
View File

@ -0,0 +1,78 @@
<template>
<div class="app-container">
<el-input v-model="filterText" placeholder="Filter keyword" style="margin-bottom:30px;" />
<el-tree
ref="tree2"
:data="data2"
:props="defaultProps"
:filter-node-method="filterNode"
class="filter-tree"
default-expand-all
/>
</div>
</template>
<script>
export default {
data() {
return {
filterText: '',
data2: [{
id: 1,
label: 'Level one 1',
children: [{
id: 4,
label: 'Level two 1-1',
children: [{
id: 9,
label: 'Level three 1-1-1'
}, {
id: 10,
label: 'Level three 1-1-2'
}]
}]
}, {
id: 2,
label: 'Level one 2',
children: [{
id: 5,
label: 'Level two 2-1'
}, {
id: 6,
label: 'Level two 2-2'
}]
}, {
id: 3,
label: 'Level one 3',
children: [{
id: 7,
label: 'Level two 3-1'
}, {
id: 8,
label: 'Level two 3-2'
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
}
},
watch: {
filterText(val) {
this.$refs.tree2.filter(val)
}
},
methods: {
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
}
}
}
</script>