|
|
|
@ -6,16 +6,24 @@
|
|
|
|
|
<div slot="content" class="table-page-search-wrapper">
|
|
|
|
|
<a-form layout="inline" :form="form">
|
|
|
|
|
<a-row :gutter="48">
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<a-form-item label="接口代码">
|
|
|
|
|
<a-col :md="6" :sm="24" :style="{ paddingRight: 0 }">
|
|
|
|
|
<a-form-item
|
|
|
|
|
label="接口代码"
|
|
|
|
|
:labelCol="labelCol"
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
>
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入接口代码"
|
|
|
|
|
v-decorator="['ApiCode', { rules: [{ required: false, message: '请输入接口代码' }] }]"
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<a-form-item label="接口名称">
|
|
|
|
|
<a-col :md="6" :sm="24" :style="{ paddingRight: 0 }">
|
|
|
|
|
<a-form-item
|
|
|
|
|
label="接口名称"
|
|
|
|
|
:labelCol="labelCol"
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
>
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入接口名称"
|
|
|
|
|
v-decorator="[
|
|
|
|
@ -25,13 +33,12 @@
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<a-form-item label="是否禁用">
|
|
|
|
|
<a-switch v-decorator="['IsDisable']"/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<a-form-item label="租户名称">
|
|
|
|
|
<a-col :md="6" :sm="24" :style="{ paddingRight: 0 }">
|
|
|
|
|
<a-form-item
|
|
|
|
|
label="租户名称"
|
|
|
|
|
:labelCol="labelCol"
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
>
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入租户名称"
|
|
|
|
|
v-decorator="[
|
|
|
|
@ -41,8 +48,12 @@
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<a-form-item label="用户姓名">
|
|
|
|
|
<a-col :md="6" :sm="24">
|
|
|
|
|
<a-form-item
|
|
|
|
|
label="用户姓名"
|
|
|
|
|
:labelCol="labelCol"
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
>
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入用户姓名"
|
|
|
|
|
v-decorator="[
|
|
|
|
@ -52,18 +63,26 @@
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<!-- <a-col :md="6" :sm="24">
|
|
|
|
|
<a-form-item label="搜索值">
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入搜索值"
|
|
|
|
|
v-decorator="[
|
|
|
|
|
'SearchValue',
|
|
|
|
|
{ rules: [{ required: false, message: '请输入搜索值' }] },
|
|
|
|
|
]"
|
|
|
|
|
/>
|
|
|
|
|
<a-col :md="12" :sm="24" :style="{ paddingRight: 0 }">
|
|
|
|
|
<a-form-item
|
|
|
|
|
label="是否禁用"
|
|
|
|
|
:labelCol="labelCol"
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
>
|
|
|
|
|
<a-radio-group class="disable-radio" v-decorator="['IsDisable']">
|
|
|
|
|
<a-radio :value="0">
|
|
|
|
|
启用
|
|
|
|
|
</a-radio>
|
|
|
|
|
<a-radio :value="1">
|
|
|
|
|
禁用
|
|
|
|
|
</a-radio>
|
|
|
|
|
<a-radio :value="2">
|
|
|
|
|
全部
|
|
|
|
|
</a-radio>
|
|
|
|
|
</a-radio-group>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col> -->
|
|
|
|
|
<a-col :md="4" :sm="24" :labelCol="{ span: 2, offset: 12 }">
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="12" :sm="24" :labelCol="{ span: 2, offset: 12 }">
|
|
|
|
|
<span class="table-page-search-submitButtons" style="text-align: right">
|
|
|
|
|
<a-button type="primary" @click="tableRefresh">查询</a-button>
|
|
|
|
|
<a-button style="margin-left: 8px" @click="tableReset">重置</a-button>
|
|
|
|
@ -75,9 +94,9 @@
|
|
|
|
|
</x-card>
|
|
|
|
|
<x-card class="content-table">
|
|
|
|
|
<div slot="content" class="table-page-search-wrapper" :style="{ marginTop: '-8px' }">
|
|
|
|
|
<!-- <vxe-toolbar>
|
|
|
|
|
<vxe-toolbar>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<a-button type="primary" icon="edit" @click="addProject">新增品名分类</a-button>
|
|
|
|
|
<a-button type="primary" icon="edit" @click="addProject">新增接口授权</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #tools>
|
|
|
|
|
<div class="right">
|
|
|
|
@ -86,7 +105,7 @@
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar> -->
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
<vxe-grid
|
|
|
|
|
ref="xGrid"
|
|
|
|
|
v-bind="gridOptions"
|
|
|
|
@ -94,28 +113,39 @@
|
|
|
|
|
@page-change="handlePageChange"
|
|
|
|
|
style="margin-top: 6px"
|
|
|
|
|
>
|
|
|
|
|
<template #isDisable="{ row }">
|
|
|
|
|
<span v-if="row.isDisable">禁用</span>
|
|
|
|
|
<span v-else>启用</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #operate="{ row }">
|
|
|
|
|
<vxe-button type="text" icon="vxe-icon-edit" @click="editColumns(row)"></vxe-button>
|
|
|
|
|
<vxe-button type="text" icon="vxe-icon-delete" @click="removeColumns(row)"></vxe-button>
|
|
|
|
|
<vxe-button type="text" class="disable-btn" @click="editColumns(row)">编辑</vxe-button>
|
|
|
|
|
<vxe-button type="text" class="disable-btn active" @click="removeColumns(row)">删除</vxe-button>
|
|
|
|
|
<span v-if="row.isDisable" class="disable-btn" @click="setDisableFun(row)">启用</span>
|
|
|
|
|
<span v-else class="disable-btn active" @click="setDisableFun(row)">禁用</span>
|
|
|
|
|
<a-popconfirm title="确认删除?" ok-text="是" cancel-text="否" @confirm="secretResetFun(row)" @cancel="cancel">
|
|
|
|
|
<vxe-button class="disable-btn active" type="text">重置秘钥</vxe-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-grid>
|
|
|
|
|
</div>
|
|
|
|
|
</x-card>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
<add-form ref="addForm" :fromData="addFromData" :type="addFromType" @ok="handleOk" />
|
|
|
|
|
<add-form ref="addForm" :formData="addFormData" :type="addFormType" @ok="handleOk" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { XCard } from '@/components'
|
|
|
|
|
import initData from './modules/initData'
|
|
|
|
|
import columnSetting from '@/components/tableColumnSetting'
|
|
|
|
|
import addForm from './modules/addFrom'
|
|
|
|
|
import addForm from './modules/addForm'
|
|
|
|
|
import {
|
|
|
|
|
GetApiPage,
|
|
|
|
|
SaveApi,
|
|
|
|
|
DeleteApi,
|
|
|
|
|
GetApiDetail,
|
|
|
|
|
DisableApi,
|
|
|
|
|
ResetApi
|
|
|
|
|
} from '@/api/modular/main/DjyApiAuth'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
@ -130,6 +160,16 @@ export default {
|
|
|
|
|
form: this.$form.createForm(this),
|
|
|
|
|
setVisible: false,
|
|
|
|
|
// showColumns: null,
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 8 },
|
|
|
|
|
md: { span: 9 }
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 16 },
|
|
|
|
|
md: { span: 15 }
|
|
|
|
|
},
|
|
|
|
|
gridOptions: {
|
|
|
|
|
border: false,
|
|
|
|
|
resizable: true,
|
|
|
|
@ -150,12 +190,11 @@ export default {
|
|
|
|
|
columns: JSON.parse(JSON.stringify(initData.columns)),
|
|
|
|
|
data: [],
|
|
|
|
|
},
|
|
|
|
|
addFromData: {},
|
|
|
|
|
addFromType: 'add',
|
|
|
|
|
addFormData: {},
|
|
|
|
|
addFormType: 'add'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
// this.showColumns = JSON.parse(JSON.stringify(initData.columns))
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
@ -177,22 +216,6 @@ export default {
|
|
|
|
|
} = this
|
|
|
|
|
validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
if (values.createdTime) {
|
|
|
|
|
const time = values.createdTime.map((item, index) => {
|
|
|
|
|
const str = this.dateFtt('YYYY-MM-DD', item._d)
|
|
|
|
|
return str
|
|
|
|
|
})
|
|
|
|
|
console.log(time)
|
|
|
|
|
values.createdTime = time
|
|
|
|
|
}
|
|
|
|
|
if (values.updataTime) {
|
|
|
|
|
const _time = values.updataTime.map((item, index) => {
|
|
|
|
|
const str = this.dateFtt('YYYY-MM-DD', item._d)
|
|
|
|
|
return str
|
|
|
|
|
})
|
|
|
|
|
console.log(_time)
|
|
|
|
|
values.updataTime = _time
|
|
|
|
|
}
|
|
|
|
|
this.gridOptions.pagerConfig.currentPage = currentPage
|
|
|
|
|
this.gridOptions.pagerConfig.pageSize = pageSize
|
|
|
|
|
this.getList(values)
|
|
|
|
@ -200,19 +223,23 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getList(queryParam = {}) {
|
|
|
|
|
debugger
|
|
|
|
|
const { currentPage, pageSize } = this.gridOptions.pagerConfig
|
|
|
|
|
console.log('查询内容', queryParam)
|
|
|
|
|
let IsDisable = null
|
|
|
|
|
if (Object.keys(queryParam).length > 0 && queryParam.IsDisable !== 2) {
|
|
|
|
|
IsDisable = Boolean(queryParam.IsDisable)
|
|
|
|
|
}
|
|
|
|
|
console.log('IsDisable = ', IsDisable)
|
|
|
|
|
GetApiPage({
|
|
|
|
|
ApiCode: queryParam.ApiCode,
|
|
|
|
|
ApiName: queryParam.ApiName,
|
|
|
|
|
IsDisable: queryParam.IsDisable,
|
|
|
|
|
IsDisable: IsDisable,
|
|
|
|
|
TenantName: queryParam.TenantName,
|
|
|
|
|
UserName: queryParam.UserName,
|
|
|
|
|
pageNo: currentPage,
|
|
|
|
|
pageSize: pageSize
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
debugger
|
|
|
|
|
const _data = res.data.rows.map((item, index) => {
|
|
|
|
|
item.row_id = (currentPage - 1) * pageSize + index
|
|
|
|
|
return item
|
|
|
|
@ -227,14 +254,14 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
editColumns(data) {
|
|
|
|
|
this.addFromType = 'edit'
|
|
|
|
|
this.addFromId = data.id
|
|
|
|
|
this.addFormType = 'edit'
|
|
|
|
|
this.addFormId = data.id
|
|
|
|
|
GetApiDetail({
|
|
|
|
|
id: this.addFromId,
|
|
|
|
|
id: this.addFormId,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.addFromData = res.data
|
|
|
|
|
console.log(this.addFromData)
|
|
|
|
|
this.addFormData = res.data
|
|
|
|
|
console.log(this.addFormData)
|
|
|
|
|
this.$refs.addForm.add()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
@ -242,7 +269,9 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
removeColumns(data) {
|
|
|
|
|
DeleteApi(data.id).then((res) => {
|
|
|
|
|
DeleteApi({
|
|
|
|
|
id: data.id
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.$message.success('删除成功')
|
|
|
|
|
const {
|
|
|
|
@ -259,9 +288,9 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
addProject() {
|
|
|
|
|
this.addFromData = {}
|
|
|
|
|
this.addFromType = 'add'
|
|
|
|
|
this.addFromId = ''
|
|
|
|
|
this.addFormData = {}
|
|
|
|
|
this.addFormType = 'add'
|
|
|
|
|
this.addFormId = ''
|
|
|
|
|
this.$refs.addForm.add()
|
|
|
|
|
},
|
|
|
|
|
columnChange(data) {
|
|
|
|
@ -305,20 +334,8 @@ export default {
|
|
|
|
|
console.log(e)
|
|
|
|
|
this.$message.error('取消操作')
|
|
|
|
|
},
|
|
|
|
|
handleOk() {
|
|
|
|
|
const form = this.$refs.addForm.form
|
|
|
|
|
form.validateFields((errors, values) => {
|
|
|
|
|
if (!errors) {
|
|
|
|
|
console.log('values', values)
|
|
|
|
|
SaveApi({
|
|
|
|
|
id: this.addFromId,
|
|
|
|
|
goodsCode: values.goodsCode,
|
|
|
|
|
goodsNameCN: values.goodsNameCN,
|
|
|
|
|
goodsNameEN: values.goodsNameEN,
|
|
|
|
|
goodsDesp: values.goodsDesp,
|
|
|
|
|
goodsCategory: values.goodsCategory,
|
|
|
|
|
goodsCategoryName: values.goodsCategoryName,
|
|
|
|
|
})
|
|
|
|
|
handleOk(data) {
|
|
|
|
|
SaveApi(data)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.$refs.addForm.$data.confirmLoading = false
|
|
|
|
|
if (res.success) {
|
|
|
|
@ -332,8 +349,6 @@ export default {
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
tableRefresh() {
|
|
|
|
|
const {
|
|
|
|
@ -350,7 +365,59 @@ export default {
|
|
|
|
|
this.init()
|
|
|
|
|
},
|
|
|
|
|
tableHeaderEdit() {},
|
|
|
|
|
setDisableFun(data) {
|
|
|
|
|
console.log('是否禁用: ', data.id, data.isDisable, data)
|
|
|
|
|
DisableApi({
|
|
|
|
|
id: data.id,
|
|
|
|
|
disable: !data.isDisable
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
const tip = !data.isDisable ? '已禁用' : '已启用'
|
|
|
|
|
this.$message.success(tip)
|
|
|
|
|
this.gridOptions.data[data.row_id].isDisable = !data.isDisable
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
secretResetFun (data) {
|
|
|
|
|
ResetApi({
|
|
|
|
|
id: data.id
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.$message.success('秘钥已重置')
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
cancel() {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.disable-btn{
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: @primary-color;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&.active{
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.disable-radio{
|
|
|
|
|
display:flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-top: 7px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|