Commit 844b936d authored by suntao's avatar suntao

渠道页 保存

parent 4417ab39
![](https://github.com/rootsli/vue2admin/blob/master/doc/img/logo.png)
ka-manager - A scaffolding base Vue2.js
========================================================
[![Vuejs](https://img.shields.io/badge/%20Powered%20by-Vuejs%202.1.x%20-brightgreen.svg)](https://github.com/vuejs/vue) [![Build Status](https://travis-ci.org/rootsli/vue2admin.svg?branch=master)](https://travis-ci.org/rootsli/vue2admin) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
> 基于vue2 + vue-router + vuex + fetch + PostCSS + [element-ui](http://element.eleme.io/)(也可以使用其他UI,例如[iView](https://www.iviewui.com/)) + webpack2 实现的一个后台管理系统基础框架。
#### 框架能力:
- 完全的基于组件化的架构
- 基于组件的CSS命名空间独立,不相互污染
- 登录功能(利用vuex与cookie的持久化方案进行登录认证缓存)
- 多级路由支持
- 基于vuex2的状态管理(开发时建议安装chrome插件vue.js devtools跟踪状态)
- vuex2与cookie的持久化支持(支持对指定vuex状态进行持久化,并能指定cookie的过期时间)。具体示例请见项目源码:src\store\index.js
- PostCSS支持:支持自动拼装前缀(autoprefixer插件),支持最新css语法(postcss-cssnext插件),支持@import方式引入css。具体示例请见项目源码:src\modules\page1\index.vue
- 基于fetch的网络服务(源码路径:src\utils\request.js)
- 支持mock数据服务(mock示例路径:src\apis\mock)
- 基于webpack2的开发构建编译:支持开发阶段的HRM,支持模块依赖,静态资源优化,模块打包和Hash指纹等编译功能,一个命令,即可完成整个项目的构建编译
- 提供了一个webpack大项目打包方案(On demand code-splitting)的示例,请见目录:src\modules\code-splitting-demo
```
说明:项目框架已经集成了大部分前端项目必须的插件服务和项目逻辑架构,可以拿来即用。让框架尽量简单,逻辑尽量清晰,编译构建过程完全可定制,也是本框架追求的目标之一。
```
## Build Setup
......
import request from '../utils/request'
export function getChannels(data) {
return request({
url: '/channel/page',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
params: data
})
return request({
url: '/channel/page',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
params: data
})
}
export function getStaticElement() {
return request({
url: '/channel/static/element',
method: 'get'
})
return request({
url: '/channel/static/element',
method: 'get'
})
}
export function getChannelDetail(query) {
return request({
url: '/channel/get/info',
method: 'get',
params: query
})
}
export function saveChannelBaseConf(data) {
return request({
url: '/channel/update/baseConf',
method: 'post',
data
})
return request({
url: '/channel/update/baseConf',
method: 'post',
data
})
}
export function getChannelDetail(query) {
return request({
url: '/channel/get/info',
method: 'get',
params: query
})
export function saveApplyCheckConf(data) {
return request({
url: '/channel/saveApplyCheckConf',
method: 'post',
data
})
}
export function saveApplyPrivilegeConf(data) {
return request({
url: '/channel/saveApplyPrivilegeConf',
method: 'post',
data
})
}
export function saveCallbackConf(data) {
return request({
url: '/channel/saveCallbackConf',
method: 'post',
data
})
}
export function saveRsaConf(data) {
return request({
url: '/channel/saveRsaConf',
method: 'post',
data
})
}
export function refreshCache() {
return request({
url: '/channel/refreshCache',
method: 'get'
})
}
......@@ -24,7 +24,7 @@
</style>
<template>
<div>
<el-tabs ref="myTab" v-model="activeName" type="card" @tab-click="handleClick">
<el-tabs ref="myTab" v-model="activeName" type="card" @tab-click="handleClickTab">
<el-tab-pane label="查询结果" name="queryPage">
<div class="content-page">
<div class="home-page-center single-page-center base">
......@@ -32,17 +32,12 @@
<div class="home-section-env">
<div class="filter-container" style="padding-bottom:20px">
<el-input v-model="listQuery.channelName" placeholder="渠道名称" clearable style="width: 200px;"
class="filter-item" @keyup.enter.native="getChannels"/>
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-input v-model="listQuery.channelId" placeholder="渠道号" clearable style="width: 200px;"
class="filter-item" @keyup.enter.native="getChannels"/>
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-input v-model="listQuery.channelCode" placeholder="channel_code" clearable style="width: 200px;"
class="filter-item" @keyup.enter.native="getChannels"/>
<!-- <el-select v-model="listQuery.channelId" placeholder="渠道" clearable style="width: 200px"-->
<!-- class="filter-item">-->
<!-- <el-option v-for="item in channels" :key="item.channelId" :label="item.channelName"-->
<!-- :value="item.channelId"/>-->
<!-- </el-select>-->
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="getChannels">查询
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleGetChannels">查询
</el-button>
<el-button :disabled="!true" class="filter-item" style="margin-left: 10px;" type="primary"
icon="el-icon-edit" @click="handleCreate">添加
......@@ -75,7 +70,7 @@
</el-table>
<pagination v-show="count>0" :total="count" :page.sync="page" :limit.sync="listQuery.pageSize"
@pagination="getChannels"/>
@pagination="handleGetChannels"/>
</div>
</div>
</div>
......@@ -114,7 +109,7 @@
</el-form>
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
icon="el-icon-search"
@click="saveBaseConf">基础配置保存
@click="handleSaveBaseConf">基础配置保存
</el-button>
</el-card>
</div>
......@@ -129,10 +124,8 @@
</div>
<el-form :inline="true" size="medium">
<el-form-item style="width:25%" label="校验节点" label-width="30%">
<el-select v-model="checkedItemsResultVO.point" placeholder="请选择" clearable class="filter-item"
style="width:100px" :disabled="!isEdit">
<el-option v-for="item in staticData.importCheckPointInit" :key="item.value" :label="item.name"
:value="item.value"/>
<el-select v-model="checkedItemsResultVO.point" placeholder="请选择" clearable class="filter-item" style="width:100px" @change="checkedItemsSelected">
<el-option v-for="item in staticData.importCheckPointInit" :key="item.value" :label="item.name" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item style="width:70%" label="进件校验项:" label-width="15%">
......@@ -146,7 +139,7 @@
</el-form>
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
icon="el-icon-search"
@click="saveApplyConf">进件校验项保存
@click="handleSaveApplyCheckConf">进件校验项保存
</el-button>
</el-card>
</div>
......@@ -173,7 +166,7 @@
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
icon="el-icon-search"
@click="saveApplyConf">保存
@click="handleSaveApplyPrivilegeConf">保存
</el-button>
</el-card>
</div>
......@@ -200,14 +193,17 @@
<el-form-item label="订单状态回调地址" label-width="15%">
<el-input v-model="channel.callbackInfo.statusUrl" :disabled="!isEdit"/>
</el-form-item>
<el-form-item label="还款状态回调地址" label-width="15%">
<el-input v-model="channel.callbackInfo.repaymentStatusUrl" :disabled="!isEdit"/>
</el-form-item>
<el-form-item label="还款计划回调地址" label-width="15%">
<el-input v-model="channel.callbackInfo.repaymentUrl" :disabled="!isEdit"/>
<el-input v-model="channel.callbackInfo.repaymentPlanUrl" :disabled="!isEdit"/>
</el-form-item>
</el-form>
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
icon="el-icon-search"
@click="getChannels">回调配置保存
@click="handleSaveCallbackConf">回调配置保存
</el-button>
</el-card>
</div>
......@@ -233,7 +229,7 @@
</el-form>
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
icon="el-icon-search"
@click="getChannels">Rsa配置保存
@click="handleSaveRsaConf">Rsa配置保存
</el-button>
</el-card>
</div>
......@@ -247,7 +243,7 @@
<span>刷新缓存</span>
</div>
<el-button class="filter-item" style="margin-left: 80%;" type="primary" icon="el-icon-search"
@click="getChannels">刷新内存缓存
@click="handleRefreshCache">刷新内存缓存
</el-button>
</el-card>
</div>
......@@ -264,7 +260,8 @@
<script>
// import {getChannels, getChannelDetail, saveChannelBaseConf} from '@/apis/channel'
import Pagination from '@/components/Pagination'
import {getChannels, getChannelDetail, saveChannelBaseConf, getStaticElement} from '../../apis/channel'
import {getChannels, getChannelDetail, saveChannelBaseConf, getStaticElement, saveApplyCheckConf, saveApplyPrivilegeConf ,
saveCallbackConf, saveRsaConf, refreshCache} from '../../apis/channel'
export default {
......@@ -306,8 +303,8 @@
//this.roles = store.getters.roles
},
mounted() {
this.getChannels()
this.getStaticElement()
this.handleGetChannels()
this.handleGetStaticElement()
this.$nextTick(function () {
// 初始化 之后隐藏tab
let tabs = this.$refs.myTab.$children[0].$refs.tabs
......@@ -317,7 +314,7 @@
})
},
methods: {
getStaticElement() {
handleGetStaticElement() {
getStaticElement().then(res => {
if (res.data) {
if (res.data.applyPrivilegeItems) {
......@@ -333,7 +330,7 @@
}).catch(() => {
})
},
getChannels() {
handleGetChannels() {
for (const prop in this.listQuery) {
if (this.listQuery[prop] === '') {
delete this.listQuery[prop]
......@@ -352,12 +349,18 @@
handleCreate() {
this.isEdit = true
this.$options.methods.showTabAll(this, "刷新缓存")
// this.channel = {
// baseConfDetail: {},
// importCheckItem: {"point": 1, "checkedItems": []},
// applyPrivilege: [],
// callbackInfo: {}
// }
this.channel = {
baseConfDetail: {},
importCheckInfo: {
checkedItemsResult: [],
},
applyPrivilege: {
privilege: []
},
callbackInfo: {},
rsa: {}
}
this.checkedItemsResultVO.value = []
},
handleUpdate(data) {
this.isEdit = true
......@@ -369,11 +372,31 @@
this.$options.methods.showTabAll(this, "刷新缓存")
this.$options.methods.getChannelDetail(this, data)
},
checkedItemsSelected(selected) {
if(this.channel.importCheckInfo.checkedItemsResult.length > 0) {
let isCleanData = true;
for (let index in this.channel.importCheckInfo.checkedItemsResult) {
let item = this.channel.importCheckInfo.checkedItemsResult[index]
if (item.point === selected) {
this.checkedItemsResultVO.value = item.checkedItems
isCleanData = false
break
}
}
if (isCleanData) {
// 说明 下拉选择的 该用户没有配置,清除
this.checkedItemsResultVO.value = []
}
} else {
this.checkedItemsResultVO.value = []
}
},
getChannelDetail(that, data) {
getChannelDetail(data).then(rep => {
if (rep.data) {
that.channel = rep.data
if (rep.data && rep.data.importCheckInfo && rep.data.importCheckInfo.checkedItemsResult.length > 0) {
that.channel.importCheckInfo.checkedItemsResult = rep.data.importCheckInfo.checkedItemsResult;
// 说明有数据
let def = rep.data.importCheckInfo.checkedItemsResult[0];
that.checkedItemsResultVO.point = def.point
......@@ -382,7 +405,7 @@
}
})
},
saveBaseConf() {
handleSaveBaseConf() {
// 保存基本配置信息
saveChannelBaseConf(this.channel.baseConfDetail).then(rep => {
this.$notify({
......@@ -393,12 +416,76 @@
})
})
},
saveApplyConf() {
handleSaveApplyCheckConf() {
console.log("saveApplyCheckConf")
// 保存进件项配置
if (this.checkedItemsResultVO) {
if(this.channel.importCheckInfo.checkedItemsResult) {
for (let index in this.channel.importCheckInfo.checkedItemsResult) {
let item = this.channel.importCheckInfo.checkedItemsResult[index]
if (item.point === this.checkedItemsResultVO.point) {
item.checkedItems = this.checkedItemsResultVO.value
}
}
} else {
this.channel.importCheckInfo.checkedItemsResult.point = this.checkedItemsResultVO.point
this.channel.importCheckInfo.checkedItemsResult.checkedItems = this.checkedItemsResultVO.value
}
}
saveApplyCheckConf(this.channel.importCheckInfo).then(rep => {
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 1500
})
})
},
handleSaveApplyPrivilegeConf() {
// 保存进件项配置
console.log(this.channel.importCheckInfo)
console.log(this.channel.applyPrivilege)
saveApplyPrivilegeConf(this.channel.applyPrivilege).then(rep => {
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 1500
})
})
},
handleSaveCallbackConf() {
// 保存进件项配置
saveCallbackConf(this.channel.callbackInfo).then(rep => {
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 1500
})
})
},
handleSaveRsaConf() {
// 保存进件项配置
saveRsaConf(this.channel.rsa).then(rep => {
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 1500
})
})
},
handleRefreshCache() {
// 保存进件项配置
refreshCache().then(rep => {
this.$notify({
title: '成功',
message: '刷新成功',
type: 'success',
duration: 1500
})
})
},
handleClick(tab) {
handleClickTab(tab) {
// 如果点击查询页 那么隐藏tab
if ('queryPage' === tab.name) {
this.$options.methods.hiddenTabAll(this)
......
<style>
.frm{
width: 99%;
height: 100%;
}
</style>
<template>
<div class="height100">
<div class="home-section-wrap">
<div class="home-section-env">
<p>内容段1</p>
</div>
</div>
<div class="home-section-wrap home-section-wrap-bottom">
<div class="home-section-env">
<p>内容段2</p>
</div>
</div>
</div>
<iframe class="frm" ref="iframe" src='http://metabase.quantgroups.com/public/dashboard/059dd6d4-7be3-4ea1-9c91-27d62312c18b'> </iframe>
</template>
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