Commit ff3f97df authored by Yulun Yao's avatar Yulun Yao 🇨🇳

123

parent 03158127
...@@ -53,6 +53,16 @@ const appRoutes = [ ...@@ -53,6 +53,16 @@ const appRoutes = [
}, },
] ]
}, },
{
path: '/iftttRules', name: 'iftttRules', component: resolve => require(['@/components/Layout/content-wrapper'], resolve), //ContentWrapper,
meta: { title: '规则', menuPath: true, menuIcon: 'profile', authCode: '0000', hideInBread: true },
children: [
{
path: '/iftttRules/iftttRulesList', name: 'iftttRulesList', component: resolve => require(['@/views/iftttRules/iftttRulesList.vue'], resolve), //basicInfo,
meta: { title: '规则列表', menuPath: true, hideInBread: false, },
},
]
},
], ],
}, },
{ {
......
...@@ -101,16 +101,16 @@ const errorHandler = (err) => { ...@@ -101,16 +101,16 @@ const errorHandler = (err) => {
} }
} }
// Axios.interceptors.request.use(config => { Axios.interceptors.request.use(config => {
// const token = Cookie.get('token') || Store.state.token const token = Cookie.get('token') || Store.state.token
// console.log(token) console.log(token)
// if (token) { if (token) {
// config.headers.Authorization = token config.headers.Authorization = token
// } }
// return config return config
// }, error => { }, error => {
// return Promise.reject(error) return Promise.reject(error)
// }) })
Axios.interceptors.response.use( Axios.interceptors.response.use(
response => { response => {
......
...@@ -45,7 +45,7 @@ default: // 默认环境下(开发环境) ...@@ -45,7 +45,7 @@ default: // 默认环境下(开发环境)
// WBX_URL = 'https://wbx-uat.omniview.pro/pc' // WBX_URL = 'https://wbx-uat.omniview.pro/pc'
// BASE_URL = '/api' // BASE_URL = '/api'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2' // BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
BASE_URL = 'https://yapi.omniview.pro/mock/161' BASE_URL = 'http://www.962121.net/hmfmstest/ifttt/api/'
// BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2' // BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2' // BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://211.136.105.193/apiv2' // BASE_URL = 'http://211.136.105.193/apiv2'
...@@ -145,7 +145,7 @@ export default { ...@@ -145,7 +145,7 @@ export default {
// 首页统计列表 // 首页统计列表
GET_RESOURE_LIST: '/service-basicdatasync-ddd/resource/count', GET_RESOURE_LIST: '/service-basicdatasync-ddd/resource/count',
// 首页统计列表 // 首页统计列表
POST_LOGIN: '/public/login', POST_LOGIN: '/uaa/oauth/token',
// 居委会列表 // 居委会列表
GET_NEI_LIST: '/service-basicdatasync-ddd/residentsCommittees', GET_NEI_LIST: '/service-basicdatasync-ddd/residentsCommittees',
...@@ -238,6 +238,24 @@ export default { ...@@ -238,6 +238,24 @@ export default {
GET_RESERVATION_LIST: '/service-documents/repair/reservations', GET_RESERVATION_LIST: '/service-documents/repair/reservations',
GET_IFTTT_RULES_LIST: '/api/ifttt-center/executor/logs/query', GET_IFTTT_RULES_LIST: '/api/ifttt-center/executor/logs/query',
// 业务系统
GET_BUSINESS_LIST: '/api/ifttt-center/business/system/query', GET_BUSINESS_LIST: '/api/ifttt-center/business/system/query',
POST_ADD_BUSINESS_RECORD: '/api/ifttt-center/business/system' POST_ADD_BUSINESS_RECORD: '/api/ifttt-center/business/system',
DELETE_BUSINESS_RECORD: '/api/ifttt-center/busines/ssystem/delete/{id}',
// trigger
GET_TRIGGER_LIST: '/api/ifttt-center/trigger/query',
POST_ADD_TRIGGER_RECORD: '/api/ifttt-center/trigger',
DELETE_TRIGGER_RECORD: '/api/ifttt-center/trigger/delete/{id}',
// action
GET_ACTION_LIST: '/api/ifttt-center/action/query',
POST_ADD_ACTION_RECORD: '/api/ifttt-center/action',
DELETE_ACTION_RECORD: '/api/ifttt-center/action/delete/{id}',
// rules
GET_RULES_LIST: '/api/ifttt-center/iftttrule/query',
POST_ADD_RULE_RECORD: '/api/ifttt-center/iftttrule',
DELETE_RULE_RECORD: '/api/ifttt-center/iftttrule/delete/{id}'
} }
<template> <template>
<div class="routerWapper"> <div class="routerWapper">
<div class="portalDetailTitle" v-if="$route.name == 'actionList'"> <div class="portalDetailTitle" v-if="$route.name == 'actionList'">
<a-tabs default-active-key="1"> <a-tabs default-active-key="1" @change="handleLoad">
<a-tab-pane key="1" tab="触发Action"> <a-tab-pane key="1" tab="触发">
<div class="layoutMargin"> <Trigger />
<a-row> </a-tab-pane>
<a-col span="24"> <a-tab-pane key="2" tab="执行">
<a-button icon="plus" type="primary" @click="onCreate">新建</a-button> <Actions />
</a-col>
</a-row>
<div class="itemMargin">
<a-alert type="info" show-icon>
<p slot="description">
已选择: {{selectedRowKeys.length}}
</p>
</a-alert>
</div>
<a-table class="elevator-table portalTable" :dataSource="list" :columns="columns" size="small" :pagination="pagination" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<span slot="operation" slot-scope="text, record">
<span class="actionBtn" @click="edit(record)">编辑</span>
<span class="actionBtn" @click="more(record)">更多</span>
</span>
<span slot="no" slot-scope="text, record, index">
{{index+1}}
</span>
</a-table>
<a-modal title="系统注册" v-model="isShow" width='900px' style="padding: 20px">
<a-steps :current="current" style="margin-bottom: 20px">
<a-step v-for="item in steps" :key="item.title" :title="item.title" />
</a-steps>
<div class="steps-content">
<!-- {{ steps[current].content }} -->
<a-form :form='form'>
<div v-show="current == 0">
<a-form-item label="所属系统" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择授权类型" v-decorator="['ssxt', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]">
<a-select-option value="物业App">物业App</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="服务编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['fwbm', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
<a-form-item label="服务名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['fwmc', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</div>
<div v-show="current == 1">
<a-row v-for="(item, index) in rowLoop" :key="index">
<a-col :span='6' offset='1'>
<a-form-item>
<a-input v-decorator="['first'+index, {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</a-col>
<a-col :span='6' offset='1'>
<a-form-item>
<a-select v-decorator="['second' + index, {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]">
<a-select-option value="String">String</a-select-option>
<a-select-option value="Integer">Integer</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span='6' offset='1'>
<a-form-item>
<a-input v-decorator="['third' + index, {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</a-col>
<a-col :span='2' offset='1'>
<a-button v-if="index+1 == rowLoop.length" icon='minus' @click="deleteRow()"></a-button>
<a-button v-if="index+1 == rowLoop.length" icon='plus' @click="addRow()"></a-button>
</a-col>
</a-row>
</div>
<div v-show="current == 2">
<a-form-item label="回调地址" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['hddz', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</div>
</a-form>
</div>
<template slot="footer">
<a-button key="back" @click="isShow = !isShow">
取消
</a-button>
<a-button v-if="current >= 1" type="primary" @click="handlePrevStep()">
上一步
</a-button>
<a-button v-if="current < 2" type="primary" @click="handleNextStep()">
下一步
</a-button>
<a-button v-if="current == 2" type="primary" @click="handleRegisterOk()">
完成
</a-button>
</template>
</a-modal>
</div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="执行Action"></a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Trigger from '@/views/action/actionListTrigger'
import Actions from '@/views/action/actionListAction'
export default { export default {
components: {
Trigger,
Actions
},
data() { data() {
return { return {
form: this.$form.createForm(this), timer: '',
current: 0,
steps: [
{
title: '基本信息'
},
{
title: '输出参数'
},
{
title: '回调设置'
},
],
isShow: false,
selectedRowKeys: [],
list: [
{
ssxt: 'wuyeapp',
fwbm: '物业APP',
fwmc: 'http://www.962121.net',
fwdz: '服务地址示例'
}
],
columns: [
{
title: '#',
dataIndex: 'no',
align: 'center',
key: 'no',
scopedSlots: {
customRender: 'no',
},
},
{
title: '所属系统',
dataIndex: 'ssxt',
align: 'center',
key: 'ssxt'
},
{
title: '服务编码',
dataIndex: 'fwbm',
align: 'center',
key: 'fwbm'
},
{
title: '服务名称',
dataIndex: 'fwmc',
align: 'center',
key: 'fwmc'
},
{
title: '服务地址',
dataIndex: 'fwdz',
align: 'center',
key: 'fwdz'
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
width: '120px',
scopedSlots: {
customRender: 'operation',
},
}
],
pagination: {//分页
pageNo: 1,
pageSize: 10,
total: 10,
current: 1,
defaultCurrent: 1,
showQuickJumper: true,
onChange: this.pageChange
},
formStoreList: [],
rowLoop: [{
first: '',
second: '',
third: ''
}]
} }
}, },
methods: { methods: {
pageChange(val) { handleLoad () {
this.pagination.pageNo = val this.timer = new Date().getTime()
this.pagination.current = val
// this.getCompanyList()
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onCreate() {
this.current = 0
this.form.resetFields()
this.isShow = !this.isShow
},
handlePrevStep() {
if(this.current >= 1) {
this.current -= 1
} }
},
handleNextStep() {
this.current += 1
},
handleRegisterOk() {
this.form.validateFields((err, values) => {
if (!err) {
console.log(this.form.getFieldsValue())
} else {
this.$message.info('请填写表单所有项目!')
}
})
},
addRow() {
this.rowLoop.push({
first: '',
second: '',
third: ''
})
},
deleteRow() {}
} }
} }
</script> </script>
......
<template>
<div class="layoutMargin">
<a-row>
<a-col span="24">
<a-button icon="plus" type="primary" @click="onCreate">新建</a-button>
</a-col>
</a-row>
<div class="itemMargin">
<a-alert type="info" show-icon>
<p slot="description">已选择: {{ selectedRowKeys.length }}</p>
</a-alert>
</div>
<a-table
class="elevator-table portalTable"
:dataSource="list"
:columns="columns"
size="small"
:pagination="pagination"
rowKey="id"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
>
<span slot="operation" slot-scope="text, record">
<span class="actionBtn" @click="onEdit(record)">编辑</span>
<span class="actionBtn" @click="onDelete(record.id)">删除</span>
</span>
<span slot="no" slot-scope="text, record, index">
{{ index + 1 }}
</span>
</a-table>
<a-modal
title="服务注册"
v-model="isShow"
width="900px"
style="padding: 20px"
>
<template slot="footer">
<a-button key="back" @click="isShow = !isShow">
取消
</a-button>
<a-button
type="primary"
@click="handleRegisterOk()"
>
提交
</a-button>
</template>
<a-form :form="form">
<a-form-item
label="所属系统"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-select
placeholder="请选择授权类型"
v-decorator="[
'systemId',
{
validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }],
},
]"
>
<a-select-option
v-for="item in businessOptionsList"
:key="item.value"
>{{ item.key }}</a-select-option
>
</a-select>
</a-form-item>
<a-form-item
label="服务编码"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-input
v-decorator="[
'code',
{
validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }]
}
]"
/>
</a-form-item>
<a-form-item
label="服务名称"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-input
v-decorator="[
'name',
{
validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }]
}
]"
/>
</a-form-item>
<a-form-item
label="服务路径"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-input
v-decorator="[
'path',
{
validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }]
}
]"
/>
</a-form-item>
<a-form-item label="授权方法" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择授权方法" v-decorator="['method', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]">
<a-select-option value="POST">POST</a-select-option>
<a-select-option value="GET">GET</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="输入参数" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-textarea
v-decorator="[
'args',
{
validateTrigger: 'blur',
rules: [
{ required: true, message: '请填写此项!' },
{validator: confirmJson}
]
}
]"
/>
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script>
export default {
data() {
return {
form: this.$form.createForm(this),
current: 0,
steps: [
{
title: '基本信息',
},
{
title: '输出参数',
},
{
title: '回调设置',
},
],
isShow: false,
selectedRowKeys: [],
list: [],
columns: [
{
title: '#',
dataIndex: 'no',
align: 'center',
key: 'no',
scopedSlots: {
customRender: 'no',
},
},
{
title: '所属系统',
dataIndex: 'systemId',
align: 'center',
key: 'systemId',
},
{
title: '服务编码',
dataIndex: 'code',
align: 'center',
key: 'code',
},
{
title: '服务名称',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '服务地址',
dataIndex: 'callBackPath',
align: 'center',
key: 'callBackPath',
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
width: '120px',
scopedSlots: {
customRender: 'operation',
},
},
],
pagination: {
//分页
pageNo: 1,
pageSize: 10,
total: 10,
current: 1,
defaultCurrent: 1,
showQuickJumper: true,
onChange: this.pageChange,
},
formStoreList: [],
rowLoop: [
{
first: '',
second: '',
third: '',
},
],
businessOptionsList: [],
}
},
mounted() {
this.getList()
this.getBusinessOptions()
},
methods: {
confirmJson(rule, value, callback) {
if (!value || value == undefined) {
callback('不能为空!')
} else if(typeof value == 'string') {
try {
let obj=JSON.parse(value)
if(typeof obj == 'object' && obj ){
callback()
} else {
callback('不是有效的JSON格式')
}
} catch(e) {
callback('不是有效的JSON格式')
}
}
},
onDelete(id) {
this.$ajax
.delete({
url: this.$api.DELETE_ACTION_RECORD.replace('{id}', id),
})
.then((res) => {
if (res.code == '200') {
this.$message.success('删除成功!')
this.getList()
}
})
},
getBusinessOptions() {
this.$ajax
.post({
url: this.$api.GET_BUSINESS_LIST, // page信息需要拼接在地址栏
})
.then((res) => {
if (res.code === '200') {
let result = this.$com.confirm(res, 'data.content', [])
for (let i = 0; i < result.length; i++) {
this.businessOptionsList.push({
key: result[i].name,
value: result[i].id,
})
}
}
})
},
getList() {
this.$ajax
.post({
url: this.$api.GET_ACTION_LIST,
})
.then((res) => {
this.list = this.$com.confirm(res, 'data.content', [])
})
},
pageChange(val) {
this.pagination.pageNo = val
this.pagination.current = val
// this.getCompanyList()
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onCreate() {
this.current = 0
this.form.resetFields()
this.isShow = !this.isShow
},
handlePrevStep() {
if (this.current >= 1) {
this.current -= 1
}
},
handleNextStep() {
this.current += 1
},
handleRegisterOk() {
this.form.validateFields((err, values) => {
if (!err) {
let formContent = this.form.getFieldsValue()
this.$ajax.post({
url: this.$api.POST_ADD_ACTION_RECORD,
params: formContent
}).then(res => {
if(res.code == '200') {
this.$message.success('新增成功!')
this.isShow = !this.isShow
this.form.resetFields()
this.getList()
}
})
} else {
this.$message.info('请填写表单所有项目!')
}
})
},
addRow() {
this.rowLoop.push({
key: '',
type: '',
name: '',
})
},
deleteRow() {},
},
}
</script>
<style scoped>
.itemMargin {
margin-top: 14px;
margin-bottom: 14px;
}
</style>
This diff is collapsed.
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
</div> </div>
<a-table class="elevator-table portalTable" :dataSource="list" :columns="columns" size="small" :pagination="pagination" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"> <a-table class="elevator-table portalTable" :dataSource="list" :columns="columns" size="small" :pagination="pagination" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<span slot="operation" slot-scope="text, record"> <span slot="operation" slot-scope="text, record">
<span class="actionBtn" @click="edit(record)">编辑</span> <span class="actionBtn" @click="onEdit(record)">编辑</span>
<span class="actionBtn" @click="more(record)">更多</span> <span class="actionBtn" @click="onDelete(record.id)">删除</span>
</span> </span>
<span slot="no" slot-scope="text, record, index"> <span slot="no" slot-scope="text, record, index">
{{index+1}} {{index+1}}
...@@ -33,50 +33,77 @@ ...@@ -33,50 +33,77 @@
<a-form :form='form'> <a-form :form='form'>
<div v-show="current == 0"> <div v-show="current == 0">
<a-form-item label="系统编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="系统编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['xtbm', { validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['code', { validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="系统名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="系统名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['xtmc', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['name', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="系统地址" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="系统地址" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['xtdz', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['url', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
</div> </div>
<div v-show="current == 1"> <div v-show="current == 1">
<a-form-item label="授权类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="授权类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择授权类型" v-decorator="['sqlx', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]"> <a-select placeholder="请选择授权类型" v-decorator="['authType', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]">
<a-select-option value="oauth2">oauth2</a-select-option> <a-select-option value="oauth2">oauth2</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="授权路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="授权路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['sqlj', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authPath', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="授权方法" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="授权方法" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择授权方法" v-decorator="['sqff', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]"> <a-select placeholder="请选择授权方法" v-decorator="['method', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]">
<a-select-option value="POST">POST</a-select-option> <a-select-option value="POST">POST</a-select-option>
<a-select-option value="GET">GET</a-select-option> <a-select-option value="GET">GET</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-row>
<a-col :span='5' style="text-align: right; color: black">授权参数:</a-col>
<a-col :span='19'>
<a-row v-for="(item, index) in rowLoop" :key="index">
<a-col :span='6'>
<a-form-item>
<a-input v-decorator="['key'+index, {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</a-col>
<a-col :span='6' :offset='1'>
<a-form-item>
<a-input v-decorator="['value'+index, {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item>
</a-col>
<a-col :span='1' :offset='1'>
<a-button icon='minus' @click="deleteRow(index)" />
</a-col>
</a-row>
</a-col>
</a-row>
<a-row style="text-align: center">
<a-button icon='plus' type="dashed" style="padding: 0px 100px" @click="addRow()">添加参数</a-button>
</a-row>
</div> </div>
<div v-show="current == 2"> <div v-show="current == 2">
<a-form-item label="Token Key" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="Token Key" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['tokenKey', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authTokenKey', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="Token Header Name" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="Token Header Name" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['tokenHeaderName', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authTokenHeaderName', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="Token Prefix" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="Token Prefix" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['tokenPrefix', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authTokenPrefix', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="Token Expires Time Key" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="Token Expires Time Key" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['tokenExpiresTimeKey', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authTokenTimeKey', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" />
</a-form-item> </a-form-item>
</div> </div>
</a-form> </a-form>
...@@ -105,6 +132,10 @@ ...@@ -105,6 +132,10 @@
export default { export default {
data() { data() {
return { return {
rowLoop: [{
name: '',
key: ''
}],
form: this.$form.createForm(this), form: this.$form.createForm(this),
current: 0, current: 0,
steps: [ steps: [
...@@ -174,13 +205,31 @@ export default { ...@@ -174,13 +205,31 @@ export default {
showQuickJumper: true, showQuickJumper: true,
onChange: this.pageChange onChange: this.pageChange
}, },
formStoreList: [] formStoreList: [],
businessOptionsList: []
} }
}, },
mounted() { mounted() {
this.getList() this.getList()
}, },
methods: { methods: {
onDelete(id) {
this.$ajax.delete({
url: this.$api.DELETE_BUSINESS_RECORD.replace('{id}', id)
}).then(res => {
if(res.code == '200') {
this.$message.success('删除成功!')
this.getList()
}
})
},
addRow() {
this.rowLoop.push({
name: '',
key: ''
})
},
deleteRow() {},
getList() { getList() {
this.$ajax.post({ this.$ajax.post({
url: this.$api.GET_BUSINESS_LIST url: this.$api.GET_BUSINESS_LIST
...@@ -210,18 +259,50 @@ export default { ...@@ -210,18 +259,50 @@ export default {
this.current += 1 this.current += 1
}, },
handleRegisterOk() { handleRegisterOk() {
let addForm = {} this.form.validateFields((err, values) => {
// this.form.validateFields((err, values) => { if (!err) {
// if (!err) {
addForm.code = this.form.getFieldValue('xtbm') let formContent = this.form.getFieldsValue()
addForm.name = this.form.getFieldValue('xtmc') let paramsJson = []
addForm.url = this.form.getFieldValue('xtdz') let finalParse = {}
// 遍历有多少行授权参数
console.log(addForm) for (let i = 0; i < this.rowLoop.length; i++) {
// } else { paramsJson.push({
// this.$message.info('请填写表单所有项目!') key: formContent['key' + i],
// } value: formContent['value' + i],
// }) })
}
finalParse = {
code: this.form.getFieldValue('code'),
name: this.form.getFieldValue('name'),
url: this.form.getFieldValue('url'),
method: this.form.getFieldValue('method'),
data: paramsJson,
authType: this.form.getFieldValue('authType'),
authPath: this.form.getFieldValue('authPath'),
authTokenKey: this.form.getFieldValue('authTokenKey'),
authTokenHeaderName: this.form.getFieldValue('authTokenHeaderName'),
authTokenPrefix: this.form.getFieldValue('authTokenPrefix'),
authTokenTimeKey: this.form.getFieldValue('authTokenTimeKey')
}
this.$ajax.post({
url: this.$api.POST_ADD_BUSINESS_RECORD,
params: finalParse
}).then(res => {
if(res.code == '200') {
this.$message.success('新增成功!')
this.isShow = !this.isShow
this.form.resetFields()
this.getList()
}
})
} else {
this.$message.info('请填写表单所有项目!')
}
})
} }
} }
} }
......
<template>
<div class="routerWapper">
<div class="portalDetailTitle" v-if="$route.name == 'iftttRulesList'">
<span class="title">规则列表</span>
<div class="layoutMargin layoutPadding">
<a-row>
<a-col span="24">
<a-button icon="plus" type="primary" @click="onRegister">新建规则</a-button>
</a-col>
</a-row>
<div class="itemMargin">
<a-alert type="info" show-icon>
<p slot="description">
已选择: {{selectedRowKeys.length}}
</p>
</a-alert>
</div>
<a-table class="elevator-table portalTable" :dataSource="list" :columns="columns" size="small" :pagination="pagination" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<span slot="operation" slot-scope="text, record">
<span class="actionBtn" @click="onEdit(record)">编辑</span>
<span class="actionBtn" @click="onDelete(record.id)">删除</span>
</span>
<span slot="no" slot-scope="text, record, index">
{{index+1}}
</span>
<span slot="trigger" slot-scope="text, record, index">
{{record.trigger.name}}
</span>
<span slot="action" slot-scope="text, record, index">
{{record.action.name}}
</span>
<span slot="rules" slot-scope="text, record, index">
<a-tag v-for="(item, index) in record.rules" :key="index">{{`{` + record.rules[index].key + `: `+ record.rules[index].value + `}`}}</a-tag>
</span>
</a-table>
<a-modal title="新建规则" v-model="isShow" width='900px' style="padding: 20px">
<a-form :form='form'>
<a-form-item label="触发服务" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择触发服务" v-decorator="['trigger', {validateTrigger:'blur', rules: [{required: true, message: '请选择此项!'}]}]">
<a-select-option v-for="(item) in triggerOptions" :key="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="执行服务" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-select placeholder="请选择执行服务" v-decorator="['action', {validateTrigger:'blur', rules: [{required: true, message: '请选择此项!'}]}]">
<a-select-option v-for="(item) in actionOptions" :key="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="规则字段定义" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-textarea
v-decorator="[
'rules',
{
validateTrigger: 'blur',
rules: [
{ required: true, message: '请填写此项!' },
{validator: confirmJson}
]
}
]"
/>
</a-form-item>
</a-form>
<template slot="footer">
<a-button key="back" @click="isShow = !isShow">
取消
</a-button>
<a-button type="primary" @click="handleRegisterOk()">
完成
</a-button>
</template>
</a-modal>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
rowLoop: [{
name: '',
key: ''
}],
form: this.$form.createForm(this),
current: 0,
steps: [
{
title: '基本信息'
},
{
title: '授权认证信息'
},
{
title: '授权结果映射'
},
],
isShow: false,
selectedRowKeys: [],
list: [],
columns: [
{
title: '#',
dataIndex: 'no',
align: 'center',
key: 'no',
scopedSlots: {
customRender: 'no',
},
},
{
title: '触发服务',
dataIndex: 'trigger',
align: 'center',
key: 'trigger',
width: '100px',
scopedSlots: {
customRender: 'trigger',
},
},
{
title: '执行服务',
dataIndex: 'action',
align: 'center',
key: 'action',
width: '100px',
scopedSlots: {
customRender: 'action',
},
},
{
title: '规则字段定义',
dataIndex: 'rules',
align: 'center',
key: 'rules',
scopedSlots: {
customRender: 'rules',
},
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
width: '120px',
scopedSlots: {
customRender: 'operation',
},
}
],
pagination: {//分页
pageNo: 1,
pageSize: 10,
total: 10,
current: 1,
defaultCurrent: 1,
showQuickJumper: true,
onChange: this.pageChange
},
formStoreList: [],
triggerOptions: [],
actionOptions: []
}
},
mounted() {
this.getList()
this.getTriggerServiceOption()
this.getActionServiceOption()
},
methods: {
getTriggerServiceOption() {
this.$ajax.post({
url: this.$api.GET_TRIGGER_LIST,
}).then(res => {
if(res.code == '200') {
let result = this.$com.confirm(res, 'data.content', [])
for (let i = 0; i < result.length; i++) {
this.triggerOptions.push(result[i])
}
}
})
},
getActionServiceOption() {
this.$ajax.post({
url: this.$api.GET_ACTION_LIST,
}).then(res => {
if(res.code == '200') {
let result = this.$com.confirm(res, 'data.content', [])
for (let i = 0; i < result.length; i++) {
this.actionOptions.push(result[i])
}
}
})
},
confirmJson(rule, value, callback) {
if (!value || value == undefined) {
callback('不能为空!')
} else if(typeof value == 'string') {
try {
let obj=JSON.parse(value)
if(typeof obj == 'object' && obj ){
callback()
} else {
callback('不是有效的JSON格式')
}
} catch(e) {
callback('不是有效的JSON格式')
}
}
},
onDelete(id) {
this.$ajax.delete({
url: this.$api.DELETE_RULE_RECORD.replace('{id}', id)
}).then(res => {
if(res.code == '200') {
this.$message.success('删除成功!')
this.getList()
}
})
},
addRow() {
this.rowLoop.push({
name: '',
key: ''
})
},
deleteRow() {},
getList() {
this.$ajax.post({
url: this.$api.GET_RULES_LIST
}).then(res => {
this.list = this.$com.confirm(res, 'data.content', [])
})
},
pageChange(val) {
this.pagination.pageNo = val
this.pagination.current = val
// this.getCompanyList()
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onRegister() {
this.current = 0
this.form.resetFields()
this.isShow = !this.isShow
},
handlePrevStep() {
if(this.current >= 1) {
this.current -= 1
}
},
handleNextStep() {
this.current += 1
},
handleRegisterOk() {
this.form.validateFields((err, values) => {
if (!err) {
let formContent = this.form.getFieldsValue()
this.$ajax.post({
url: this.$api.POST_ADD_RULE_RECORD,
params: formContent
}).then(res => {
if(res.code == '200') {
this.$message.success('新增成功!')
this.isShow = !this.isShow
this.form.resetFields()
this.getList()
}
})
} else {
this.$message.info('请填写表单所有项目!')
}
})
}
}
}
</script>
<style scoped>
.itemMargin {
margin-top: 14px;
margin-bottom: 14px
}
</style>
...@@ -78,23 +78,23 @@ export default { ...@@ -78,23 +78,23 @@ export default {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
const params = { const params = {
'username': this.form.getFieldValue('username'), 'client_id': this.form.getFieldValue('username'),
'pwd': encryptDes(this.form.getFieldValue('pwd')) 'client_secret': this.form.getFieldValue('pwd'),
'grant_type': 'client_credentials'
} }
this.$ajax.post({ this.$ajax.post({
url: this.$api.POST_LOGIN, url: this.$api.POST_LOGIN + '?client_id=' + this.form.getFieldValue('username') + '&client_secret=' + this.form.getFieldValue('pwd') + '&grant_type=client_credentials'
params,
}).then(res => { }).then(res => {
const store = JSON.parse(sessionStorage.getItem('VuexStore')) const store = JSON.parse(sessionStorage.getItem('VuexStore'))
if (store) store.content = '' if (store) store.content = ''
sessionStorage.setItem('VuexStore', JSON.stringify(store)) sessionStorage.setItem('VuexStore', JSON.stringify(store))
// 当前登录的账号密码的返回值 // 当前登录的账号密码的返回值
if (res.code == 200) { if (!!res.access_token) {
res.token = this.$com.confirm(res, 'data.content', []) res.token = this.$com.confirm(res, 'data.content', [])
// console.log(res.token) // console.log(res.token)
this.$cookie.set('token', 'bearer ' + res.token.access_token) this.$cookie.set('token', 'bearer ' + res.access_token)
this.$cookie.set('userName', res.name) // 存储当前账号的用户名 // this.$cookie.set('userName', res.name) // 存储当前账号的用户名
this.$router.push({ this.$router.push({
path: '/businessSystem/businessSystemList' path: '/businessSystem/businessSystemList'
}) })
......
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