| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>API开放平台 - 上报接口管理</title> |
| | | <link rel="stylesheet" href="../static/css/element.css"> |
| | | <link rel="stylesheet" href="../static/css/common.css"> |
| | | <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../static/js/vue.min.js"></script> |
| | | <script type="text/javascript" src="../static/js/showdown.min.js"></script> |
| | | <script type="text/javascript" src="../static/js/common.js"></script> |
| | | <script type="text/javascript" src="../static/js/element.js"></script> |
| | | </head> |
| | | <body> |
| | | <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;"> |
| | | <div style="width: 80%;"> |
| | | <el-card class="box-card"> |
| | | <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline"> |
| | | <el-form-item label=""> |
| | | <el-input v-model="tableSearchParam.url" placeholder="URL"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-select v-model="tableSearchParam.type" placeholder="请选择上报类型"> |
| | | <el-option label="订单完成" value="order_complete"></el-option> |
| | | <el-option label="订单取消" value="order_cancel"></el-option> |
| | | <el-option label="库存上报" value="report_stock"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-select v-model="tableSearchParam.status" placeholder="请选择是否开启"> |
| | | <el-option label="开启" value="1"></el-option> |
| | | <el-option label="关闭" value="0"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-select v-model="tableSearchParam.hostId" placeholder="请选择选择仓库"> |
| | | <el-option v-for="item in hostList" :label="item.name" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData">查询</el-button> |
| | | <el-button type="primary" @click="resetParam">重置</el-button> |
| | | <el-button type="success" @click="showAddApi()">添加接口</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;"> |
| | | <el-table-column property="url" label="URL"> |
| | | </el-table-column> |
| | | <el-table-column property="type$" label="上报类型"> |
| | | </el-table-column> |
| | | <el-table-column property="status$" label="是否开启"> |
| | | </el-table-column> |
| | | <el-table-column property="hostId$" label="仓库"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="操作" |
| | | width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="showAddApi(scope.row)" type="text" size="small">编辑</el-button> |
| | | <el-button @click="deleteApi(scope.row)" type="text" size="small">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div style="margin-top: 10px;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" :total="pageTotal"> |
| | | </el-pagination> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | |
| | | <div class="slider"> |
| | | <div><el-button type="text" @click="switchPage('index.html')">简介</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('default.html')">规范说明</el-button></div> |
| | | <el-divider></el-divider> |
| | | <div><el-button type="text" @click="switchPage('reportCompleted.html')">订单完成上报</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('reportCancel.html')">订单取消上报</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('reportStock.html')">库存上报</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('reportApiManage.html')">上报API管理</el-button></div> |
| | | <el-divider></el-divider> |
| | | <div><el-button type="text" @click="switchPage('getOrderType.html')">获取订单类型</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('getOrderStatus.html')">获取订单状态列表</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('getOrderList.html')">获取订单列表</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('generateOrderPakIn.html')">生成入库订单</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('generateOrderPakOut.html')">生成出库订单</el-button></div> |
| | | <div><el-button type="text" @click="switchPage('createMat.html')">添加物料信息</el-button></div> |
| | | <!-- <el-divider></el-divider>--> |
| | | <!-- <div><el-button type="text" @click="keyList()">密钥管理</el-button></div>--> |
| | | </div> |
| | | |
| | | <el-dialog title="接口管理" :visible.sync="formVisible"> |
| | | <el-form ref="form" :model="formData" label-width="80px"> |
| | | <el-form-item label="URL"> |
| | | <el-input v-model="formData.url" placeholder="请输入上报URL"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="上报类型"> |
| | | <el-select v-model="formData.type" placeholder="请选择上报类型"> |
| | | <el-option label="订单完成" value="order_complete"></el-option> |
| | | <el-option label="订单取消" value="order_cancel"></el-option> |
| | | <el-option label="库存上报" value="report_stock"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="是否开启"> |
| | | <el-select v-model="formData.status" placeholder="请选择是否开启"> |
| | | <el-option label="开启" value="1"></el-option> |
| | | <el-option label="关闭" value="0"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="选择仓库"> |
| | | <el-select v-model="formData.hostId" placeholder="请选择选择仓库"> |
| | | <el-option v-for="item in hostList" :label="item.name" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button v-if="formData.id == null" type="success" @click="addApi()">添加</el-button> |
| | | <el-button v-else type="primary" @click="updateApi()">更新</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | |
| | | <script> |
| | | var app = new Vue({ |
| | | el: '#app', |
| | | data: { |
| | | tableData: [], |
| | | currentPage: 1, |
| | | pageSizes: [16, 30, 50, 100, 150, 200], |
| | | pageSize: 16, |
| | | pageTotal: 0, |
| | | tableSearchParam: { |
| | | url: "", |
| | | type: "", |
| | | status: "", |
| | | hostId: "" |
| | | }, |
| | | tableData: [], |
| | | formVisible: false, |
| | | formData: { |
| | | id: null, |
| | | url: "", |
| | | type: "", |
| | | status: "", |
| | | hostId: "" |
| | | }, |
| | | hostList: [] |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | methods: { |
| | | init() { |
| | | this.getTableData() |
| | | this.getHostList() |
| | | }, |
| | | getTableData() { |
| | | let that = this; |
| | | let data = this.tableSearchParam |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | $.ajax({ |
| | | url: baseUrl + "/apiList/page/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: data, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.tableData = res.data.records |
| | | that.pageTotal = res.data.total |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.pageSize = val |
| | | this.getTableData() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.currentPage = val |
| | | this.getTableData() |
| | | }, |
| | | resetParam() { |
| | | this.tableSearchParam = { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | switchPage(url) { |
| | | location.href = url |
| | | }, |
| | | showAddApi(data) { |
| | | this.formVisible = true; |
| | | if (data != null) { |
| | | this.formData = { |
| | | id: data.id, |
| | | url: data.url, |
| | | type: data.type, |
| | | status: "" + data.status, |
| | | hostId: data.hostId |
| | | } |
| | | }else { |
| | | this.formData = { |
| | | id: null, |
| | | url: "", |
| | | type: "", |
| | | status: "", |
| | | hostId: "" |
| | | } |
| | | } |
| | | }, |
| | | addApi() { |
| | | let that = this; |
| | | if(this.formData.url == '' || this.formData.type == '' || this.formData.status == '' || this.formData.hostId == ''){ |
| | | this.$message({ |
| | | message: '参数不能为空', |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/apiList/add/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: this.formData, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.formVisible = false; |
| | | that.formData = { |
| | | id: null, |
| | | url: "", |
| | | type: "", |
| | | status: "", |
| | | hostId: "" |
| | | } |
| | | that.getTableData() |
| | | that.$message({ |
| | | message: '添加成功', |
| | | type: 'success' |
| | | }); |
| | | }else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | updateApi() { |
| | | let that = this; |
| | | if(this.formData.id == null || this.formData.url == '' || this.formData.type == '' || this.formData.status == '' || this.formData.hostId == ''){ |
| | | this.$message({ |
| | | message: '参数不能为空', |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/apiList/update/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: this.formData, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.formVisible = false; |
| | | that.formData = { |
| | | id: null, |
| | | url: "", |
| | | type: "", |
| | | status: "", |
| | | hostId: "" |
| | | } |
| | | that.getTableData() |
| | | that.$message({ |
| | | message: '更新成功', |
| | | type: 'success' |
| | | }); |
| | | }else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | deleteApi(data) { |
| | | let that = this; |
| | | $.ajax({ |
| | | url: baseUrl + "/apiList/delete/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | ids: [data.id] |
| | | }, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.getTableData() |
| | | that.$message({ |
| | | message: '删除成功', |
| | | type: 'success' |
| | | }); |
| | | }else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | getHostList() { |
| | | let that = this; |
| | | $.ajax({ |
| | | url: baseUrl + "/host/list", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | that.hostList = res.data |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | </body> |
| | | <!DOCTYPE html>
|
| | | <html lang="en">
|
| | | <head>
|
| | | <meta charset="UTF-8">
|
| | | <title>API开放平台 - 上报接口管理</title>
|
| | | <link rel="stylesheet" href="../static/css/element.css">
|
| | | <link rel="stylesheet" href="../static/css/common.css">
|
| | | <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
|
| | | <script type="text/javascript" src="../static/js/vue.min.js"></script>
|
| | | <script type="text/javascript" src="../static/js/showdown.min.js"></script>
|
| | | <script type="text/javascript" src="../static/js/common.js"></script>
|
| | | <script type="text/javascript" src="../static/js/element.js"></script>
|
| | | </head>
|
| | | <body>
|
| | | <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;">
|
| | | <div style="width: 80%;">
|
| | | <el-card class="box-card">
|
| | | <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline">
|
| | | <el-form-item label="">
|
| | | <el-input v-model="tableSearchParam.url" placeholder="URL"></el-input>
|
| | | </el-form-item>
|
| | | <el-form-item label="">
|
| | | <el-select v-model="tableSearchParam.type" placeholder="请选择上报类型">
|
| | | <el-option label="订单完成" value="order_complete"></el-option>
|
| | | <el-option label="订单取消" value="order_cancel"></el-option>
|
| | | <el-option label="库存上报" value="report_stock"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-select v-model="tableSearchParam.status" placeholder="请选择是否开启">
|
| | | <el-option label="开启" value="1"></el-option>
|
| | | <el-option label="关闭" value="0"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="">
|
| | | <el-select v-model="tableSearchParam.hostId" placeholder="请选择选择仓库">
|
| | | <el-option v-for="item in hostList" :label="item.name" :value="item.id"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" @click="getTableData">查询</el-button>
|
| | | <el-button type="primary" @click="resetParam">重置</el-button>
|
| | | <el-button type="success" @click="showAddApi()">添加接口</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;">
|
| | | <el-table-column property="url" label="URL">
|
| | | </el-table-column>
|
| | | <el-table-column property="type$" label="上报类型">
|
| | | </el-table-column>
|
| | | <el-table-column property="status$" label="是否开启">
|
| | | </el-table-column>
|
| | | <el-table-column property="hostId$" label="仓库">
|
| | | </el-table-column>
|
| | | <el-table-column
|
| | | fixed="right"
|
| | | label="操作"
|
| | | width="100">
|
| | | <template slot-scope="scope">
|
| | | <el-button @click="showAddApi(scope.row)" type="text" size="small">编辑</el-button>
|
| | | <el-button @click="deleteApi(scope.row)" type="text" size="small">删除</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
|
| | | <div style="margin-top: 10px;">
|
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
| | | :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize"
|
| | | layout="total, sizes, prev, pager, next, jumper" :total="pageTotal">
|
| | | </el-pagination>
|
| | | </div>
|
| | | </el-card>
|
| | | </div>
|
| | |
|
| | | <div class="slider">
|
| | | <div><el-button type="text" @click="switchPage('index.html')">简介</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('default.html')">规范说明</el-button></div>
|
| | | <el-divider></el-divider>
|
| | | <div><el-button type="text" @click="switchPage('reportCompleted.html')">订单完成上报</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('reportCancel.html')">订单取消上报</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('reportStock.html')">库存上报</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('reportApiManage.html')">上报API管理</el-button></div>
|
| | | <el-divider></el-divider>
|
| | | <div><el-button type="text" @click="switchPage('getOrderType.html')">获取订单类型</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('getOrderStatus.html')">获取订单状态列表</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('getOrderList.html')">获取订单列表</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('generateOrderPakIn.html')">生成入库订单</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('generateOrderPakOut.html')">生成出库订单</el-button></div>
|
| | | <div><el-button type="text" @click="switchPage('createMat.html')">添加物料信息</el-button></div>
|
| | | <!-- <el-divider></el-divider>-->
|
| | | <!-- <div><el-button type="text" @click="keyList()">密钥管理</el-button></div>-->
|
| | | </div>
|
| | |
|
| | | <el-dialog title="接口管理" :visible.sync="formVisible">
|
| | | <el-form ref="form" :model="formData" label-width="80px">
|
| | | <el-form-item label="URL">
|
| | | <el-input v-model="formData.url" placeholder="请输入上报URL"></el-input>
|
| | | </el-form-item>
|
| | | <el-form-item label="上报类型">
|
| | | <el-select v-model="formData.type" placeholder="请选择上报类型">
|
| | | <el-option label="订单完成" value="order_complete"></el-option>
|
| | | <el-option label="订单取消" value="order_cancel"></el-option>
|
| | | <el-option label="库存上报" value="report_stock"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="是否开启">
|
| | | <el-select v-model="formData.status" placeholder="请选择是否开启">
|
| | | <el-option label="开启" value="1"></el-option>
|
| | | <el-option label="关闭" value="0"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="选择仓库">
|
| | | <el-select v-model="formData.hostId" placeholder="请选择选择仓库">
|
| | | <el-option v-for="item in hostList" :label="item.name" :value="item.id"></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button v-if="formData.id == null" type="success" @click="addApi()">添加</el-button>
|
| | | <el-button v-else type="primary" @click="updateApi()">更新</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | </el-dialog>
|
| | | </div>
|
| | |
|
| | | <script>
|
| | | var app = new Vue({
|
| | | el: '#app',
|
| | | data: {
|
| | | tableData: [],
|
| | | currentPage: 1,
|
| | | pageSizes: [16, 30, 50, 100, 150, 200],
|
| | | pageSize: 16,
|
| | | pageTotal: 0,
|
| | | tableSearchParam: {
|
| | | url: "",
|
| | | type: "",
|
| | | status: "",
|
| | | hostId: ""
|
| | | },
|
| | | tableData: [],
|
| | | formVisible: false,
|
| | | formData: {
|
| | | id: null,
|
| | | url: "",
|
| | | type: "",
|
| | | status: "",
|
| | | hostId: ""
|
| | | },
|
| | | hostList: []
|
| | | },
|
| | | created() {
|
| | | this.init()
|
| | | },
|
| | | methods: {
|
| | | init() {
|
| | | this.getTableData()
|
| | | this.getHostList()
|
| | | },
|
| | | getTableData() {
|
| | | let that = this;
|
| | | let data = this.tableSearchParam
|
| | | data.curr = this.currentPage
|
| | | data.limit = this.pageSize
|
| | | $.ajax({
|
| | | url: baseUrl + "/apiList/page/auth",
|
| | | headers: {
|
| | | 'token': localStorage.getItem('token')
|
| | | },
|
| | | data: data,
|
| | | dataType: 'json',
|
| | | contentType: 'application/json;charset=UTF-8',
|
| | | method: 'GET',
|
| | | success: function(res) {
|
| | | if (res.code == 200) {
|
| | | that.tableData = res.data.records
|
| | | that.pageTotal = res.data.total
|
| | | } else {
|
| | | that.$message({
|
| | | message: res.msg,
|
| | | type: 'error'
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | },
|
| | | handleSizeChange(val) {
|
| | | console.log(`每页 ${val} 条`);
|
| | | this.pageSize = val
|
| | | this.getTableData()
|
| | | },
|
| | | handleCurrentChange(val) {
|
| | | console.log(`当前页: ${val}`);
|
| | | this.currentPage = val
|
| | | this.getTableData()
|
| | | },
|
| | | resetParam() {
|
| | | this.tableSearchParam = {
|
| | | task_no: null,
|
| | | status: null,
|
| | | wrk_no: null
|
| | | }
|
| | | this.getTableData()
|
| | | },
|
| | | switchPage(url) {
|
| | | location.href = url
|
| | | },
|
| | | showAddApi(data) {
|
| | | this.formVisible = true;
|
| | | if (data != null) {
|
| | | this.formData = {
|
| | | id: data.id,
|
| | | url: data.url,
|
| | | type: data.type,
|
| | | status: "" + data.status,
|
| | | hostId: data.hostId
|
| | | }
|
| | | }else {
|
| | | this.formData = {
|
| | | id: null,
|
| | | url: "",
|
| | | type: "",
|
| | | status: "",
|
| | | hostId: ""
|
| | | }
|
| | | }
|
| | | },
|
| | | addApi() {
|
| | | let that = this;
|
| | | if(this.formData.url == '' || this.formData.type == '' || this.formData.status == '' || this.formData.hostId == ''){
|
| | | this.$message({
|
| | | message: '参数不能为空',
|
| | | type: 'error'
|
| | | });
|
| | | return;
|
| | | }
|
| | | $.ajax({
|
| | | url: baseUrl + "/apiList/add/auth",
|
| | | headers: {
|
| | | 'token': localStorage.getItem('token')
|
| | | },
|
| | | data: this.formData,
|
| | | dataType: 'json',
|
| | | contentType: 'application/json;charset=UTF-8',
|
| | | method: 'GET',
|
| | | success: function(res) {
|
| | | if (res.code == 200) {
|
| | | that.formVisible = false;
|
| | | that.formData = {
|
| | | id: null,
|
| | | url: "",
|
| | | type: "",
|
| | | status: "",
|
| | | hostId: ""
|
| | | }
|
| | | that.getTableData()
|
| | | that.$message({
|
| | | message: '添加成功',
|
| | | type: 'success'
|
| | | });
|
| | | }else {
|
| | | that.$message({
|
| | | message: res.msg,
|
| | | type: 'error'
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | },
|
| | | updateApi() {
|
| | | let that = this;
|
| | | if(this.formData.id == null || this.formData.url == '' || this.formData.type == '' || this.formData.status == '' || this.formData.hostId == ''){
|
| | | this.$message({
|
| | | message: '参数不能为空',
|
| | | type: 'error'
|
| | | });
|
| | | return;
|
| | | }
|
| | | $.ajax({
|
| | | url: baseUrl + "/apiList/update/auth",
|
| | | headers: {
|
| | | 'token': localStorage.getItem('token')
|
| | | },
|
| | | data: this.formData,
|
| | | dataType: 'json',
|
| | | contentType: 'application/json;charset=UTF-8',
|
| | | method: 'GET',
|
| | | success: function(res) {
|
| | | if (res.code == 200) {
|
| | | that.formVisible = false;
|
| | | that.formData = {
|
| | | id: null,
|
| | | url: "",
|
| | | type: "",
|
| | | status: "",
|
| | | hostId: ""
|
| | | }
|
| | | that.getTableData()
|
| | | that.$message({
|
| | | message: '更新成功',
|
| | | type: 'success'
|
| | | });
|
| | | }else {
|
| | | that.$message({
|
| | | message: res.msg,
|
| | | type: 'error'
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | },
|
| | | deleteApi(data) {
|
| | | let that = this;
|
| | | $.ajax({
|
| | | url: baseUrl + "/apiList/delete/auth",
|
| | | headers: {
|
| | | 'token': localStorage.getItem('token')
|
| | | },
|
| | | data: {
|
| | | ids: [data.id]
|
| | | },
|
| | | dataType: 'json',
|
| | | contentType: 'application/json;charset=UTF-8',
|
| | | method: 'GET',
|
| | | success: function(res) {
|
| | | if (res.code == 200) {
|
| | | that.getTableData()
|
| | | that.$message({
|
| | | message: '删除成功',
|
| | | type: 'success'
|
| | | });
|
| | | }else {
|
| | | that.$message({
|
| | | message: res.msg,
|
| | | type: 'error'
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | },
|
| | | getHostList() {
|
| | | let that = this;
|
| | | $.ajax({
|
| | | url: baseUrl + "/host/list",
|
| | | headers: {
|
| | | 'token': localStorage.getItem('token')
|
| | | },
|
| | | dataType: 'json',
|
| | | contentType: 'application/json;charset=UTF-8',
|
| | | method: 'GET',
|
| | | success: function(res) {
|
| | | that.hostList = res.data
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | })
|
| | | </script>
|
| | | </body>
|
| | | </html> |