Commit 6205aa66 authored by suntao's avatar suntao

表单验证

parent 38ab533b
......@@ -68,10 +68,9 @@ export default {
get() {
return this.page
},
// set(val) {
// console.log("update:page=="+val)
// this.$emit('update:page', val)
// }
set(val) {
this.$emit('update:page', val)
}
},
},
methods: {
......@@ -83,7 +82,6 @@ export default {
}
},
handleCurrentChange(val) {
this.$emit('update:page', val)
this.$emit('pagination')
if (this.autoScroll) {
scrollTo(0, 800)
......
......@@ -19,15 +19,20 @@
<div class="home-section-wrap page-center-wrap-bottom">
<div class="home-section-env">
<div class="filter-container" style="padding-bottom:20px">
<el-input v-model="listQuery.channelName" placeholder="渠道名称" clearable style="width: 200px;"
<el-input v-model="listQuery.channelName" placeholder="渠道名称" clearable
style="width: 200px;"
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-input v-model="listQuery.channelId" placeholder="渠道号" clearable style="width: 200px;"
<el-input v-model="listQuery.channelId" placeholder="渠道号" clearable
style="width: 200px;"
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-input v-model="listQuery.channelCode" placeholder="channel_code" clearable style="width: 200px;"
<el-input v-model="listQuery.channelCode" placeholder="channel_code" clearable
style="width: 200px;"
class="filter-item" @keyup.enter.native="handleGetChannels"/>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="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"
<el-button :disabled="!true" class="filter-item" style="margin-left: 10px;"
type="primary"
icon="el-icon-edit" @click="handleCreate">添加
</el-button>
</div>
......@@ -49,15 +54,19 @@
<el-table-column label="创建时间" prop="createTime" align="center"/>
<el-table-column label="更新时间" prop="updateTime" align="center"/>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="180"
class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="primary" size="mini" @click="handleQurey(scope.row)">查看</el-button>
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑
</el-button>
<el-button type="primary" size="mini" @click="handleQuery(scope.row)">查看
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="count>0" :total="count" :page.sync="page" :limit.sync="listQuery.pageSize"
<pagination v-show="count>0" :total="count" :page.sync="page"
:limit.sync="listQuery.pageSize"
@pagination="handleGetChannels"/>
</div>
</div>
......@@ -72,26 +81,32 @@
<div slot="header">
<span>基础配置</span>
</div>
<el-form :inline="true" size="medium">
<el-form-item class="base_block" label="渠道名称" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelName" :disabled="!isEdit"/>
<el-form :model="channel.baseConfDetail" ref="baseConfForm" :rules="baseConfRules"
:inline="true" size="medium">
<el-form-item class="base_block" label="渠道名称" prop="channelName" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelName"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="渠道号" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelId" :disabled="!isEdit"/>
<el-form-item class="base_block" label="渠道号" prop="channelId" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelId"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="channel_code" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelCode" :disabled="!isEdit"/>
<el-form-item class="base_block" label="channel_code" prop="channelCode" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.channelCode"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="产品id" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.productId" :disabled="!isEdit"/>
<el-form-item class="base_block" label="产品id" prop="productId" label-width="40%">
<el-input class="el_input_box" v-model="channel.baseConfDetail.productId"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="aesKey" label-width="40%">
<el-form-item class="base_block" label="aesKey" prop="aesKey" label-width="40%">
<el-input v-model="channel.baseConfDetail.aesKey" :disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="md5Key" label-width="40%">
<el-form-item class="base_block" label="md5Key" prop="md5Key" label-width="40%">
<el-input v-model="channel.baseConfDetail.md5Key" :disabled="!isEdit"/>
</el-form-item>
<el-form-item class="base_block" label="是否标准API渠道" label-width="40%">
<el-form-item class="base_block" label="是否标准API渠道" prop="isStandardChannel"
label-width="40%">
<el-input v-model="channel.baseConfDetail.isStandardChannel" :disabled="!isEdit"/>
</el-form-item>
</el-form>
......@@ -110,10 +125,13 @@
<div slot="header">
<span>进件校验项配置</span>
</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" @change="checkedItemsSelected">
<el-option v-for="item in staticData.importCheckPointInit" :key="item.value" :label="item.name" :value="item.value"/>
<el-form :model="checkedItemsResultVO" ref="checkedItemsForm" :rules="checkedItemsRules"
:inline="true" size="medium">
<el-form-item style="width:25%" label="校验节点" prop="point" label-width="30%">
<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%">
......@@ -141,7 +159,8 @@
<el-form :inline="true" size="medium">
<el-form-item style="width:30%" label="进件接口权限:" label-width="40%">
<el-checkbox-group v-model="channel.applyPrivilege.privilege">
<el-checkbox v-for="item in staticData.applyPrivilegeItems" :key="item.value" :label="item.value"
<el-checkbox v-for="item in staticData.applyPrivilegeItems" :key="item.value"
:label="item.value"
:disabled="!isEdit">{{item.name}}
</el-checkbox>
</el-checkbox-group>
......@@ -205,13 +224,16 @@
</div>
<el-form size="medium" style="width:92%">
<el-form-item label="渠道Rsa公钥" label-width="12%">
<el-input type="textarea" :rows="4" v-model="channel.rsa.channelPubRsa" :disabled="!isEdit"/>
<el-input type="textarea" :rows="4" v-model="channel.rsa.channelPubRsa"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item label="量化派Rsa私钥" label-width="12%">
<el-input type="textarea" :rows="5" v-model="channel.rsa.lhpPriRsa" :disabled="!isEdit"/>
<el-input type="textarea" :rows="5" v-model="channel.rsa.lhpPriRsa"
:disabled="!isEdit"/>
</el-form-item>
<el-form-item label="量化派Rsa共钥" label-width="12%">
<el-input type="textarea" :rows="4" v-model="channel.rsa.lhpPubRsa" :disabled="!isEdit"/>
<el-input type="textarea" :rows="4" v-model="channel.rsa.lhpPubRsa"
:disabled="!isEdit"/>
</el-form-item>
</el-form>
<el-button v-show="isEdit" class="filter-item" style="margin-left: 80%;" type="primary"
......@@ -246,18 +268,39 @@
<script>
import Pagination from '@/components/Pagination'
import {getChannels, getChannelDetail, saveChannelBaseConf, getStaticElement, saveApplyCheckConf, saveApplyPrivilegeConf ,
saveCallbackConf, saveRsaConf, refreshCache} from '../../apis/channel'
import {
getChannels,
getChannelDetail,
saveChannelBaseConf,
getStaticElement,
saveApplyCheckConf,
saveApplyPrivilegeConf,
saveCallbackConf,
saveRsaConf,
refreshCache
} from '../../apis/channel'
export default {
components: { Pagination },
components: {Pagination},
data() {
return {
listQuery: {
pageNumber: 0,
pageSize: 10
},
baseConfRules: {
channelName: [{required: true, message: '请输入渠道名称', trigger: 'blur'}],
channelId: [{required: true, message: '请输入渠道id', trigger: 'blur'}],
channelCode: [{required: true, message: '请输入渠道code', trigger: 'blur'}],
productId: [{required: true, message: '请输入产品id', trigger: 'blur'}],
aesKey: [{required: true, message: '请输入aesKey', trigger: 'blur'}],
md5Key: [{required: true, message: '请输入md5Key', trigger: 'blur'}],
isStandardChannel: [{required: true, message: '请输入是否标准API', trigger: 'blur'}],
},
checkedItemsRules: {
point: [{required: true, message: '请选择节点', trigger: 'change'}],
},
channels: [],
staticData: {
// 数据从后台加载
......@@ -278,12 +321,10 @@
},
count: 1,
page: 1,
psize:10,
roles: undefined,
isCreate: false,
isEdit: true,
checkedItemsResultVO: { point : [], value:[]},
baseConfLabelWidth: '25%',
activeName: 'queryPage'
checkedItemsResultVO: {point: '', value: ''},
activeName: 'queryPage',
}
},
created() {
......@@ -334,6 +375,7 @@
})
},
handleCreate() {
this.isCreate = true
this.isEdit = true
this.$options.methods.showTabAll(this, "刷新缓存")
this.channel = {
......@@ -351,17 +393,19 @@
this.checkedItemsResultVO.value = []
},
handleUpdate(data) {
this.isCreate = false
this.isEdit = true
this.$options.methods.showTabAll(this, "")
this.$options.methods.getChannelDetail(this, data)
},
handleQurey(data) {
handleQuery(data) {
this.isCreate = false
this.isEdit = false
this.$options.methods.showTabAll(this, "刷新缓存")
this.$options.methods.getChannelDetail(this, data)
},
checkedItemsSelected(selected) {
if(this.channel.importCheckInfo.checkedItemsResult.length > 0) {
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]
......@@ -395,6 +439,8 @@
})
},
handleSaveBaseConf() {
this.$refs['baseConfForm'].validate(valid => {
if (valid) {
// 保存基本配置信息
saveChannelBaseConf(this.channel.baseConfDetail).then(rep => {
this.$notify({
......@@ -404,11 +450,30 @@
duration: 1500
})
})
} else {
return false
}
})
},
handleSaveApplyCheckConf() {
this.$refs['checkedItemsForm'].validate(valid => {
if (valid) {
if (this.isCreate) {
if (!this.channel.baseConfDetail.channelId) {
this.$notify({
title: '失败',
message: '请先新增保存基本信息',
type: 'error',
duration: 2000
})
return
} else {
this.channel.importCheckInfo.channelId = this.channel.baseConfDetail.channelId
}
}
// 保存进件项配置
if (this.checkedItemsResultVO) {
if(this.channel.importCheckInfo.checkedItemsResult) {
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) {
......@@ -428,8 +493,26 @@
duration: 1500
})
})
} else {
return false
}
})
},
handleSaveApplyPrivilegeConf() {
if (this.isCreate) {
if (!this.channel.baseConfDetail.channelId) {
this.$notify({
title: '失败',
message: '请先新增保存基本信息',
type: 'error',
duration: 2000
})
return
} else {
this.channel.applyPrivilege.channelId = this.channel.baseConfDetail.channelId
}
}
// 保存进件项配置
saveApplyPrivilegeConf(this.channel.applyPrivilege).then(rep => {
this.$notify({
......@@ -441,6 +524,19 @@
})
},
handleSaveCallbackConf() {
if (this.isCreate) {
if (!this.channel.baseConfDetail.channelId) {
this.$notify({
title: '失败',
message: '请先新增保存基本信息',
type: 'error',
duration: 2000
})
return
} else {
this.channel.callbackInfo.channelId = this.channel.baseConfDetail.channelId
}
}
// 保存进件项配置
saveCallbackConf(this.channel.callbackInfo).then(rep => {
this.$notify({
......@@ -452,6 +548,19 @@
})
},
handleSaveRsaConf() {
if (this.isCreate) {
if (!this.channel.baseConfDetail.channelId) {
this.$notify({
title: '失败',
message: '请先新增保存基本信息',
type: 'error',
duration: 2000
})
return
} else {
this.channel.rsa.channelId = this.channel.baseConfDetail.channelId
}
}
// 保存进件项配置
saveRsaConf(this.channel.rsa).then(rep => {
this.$notify({
......@@ -497,9 +606,7 @@
}
},
},
actions:{
}
actions: {}
}
function f() {
......
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