Commit c5696e0a by 无尘

fix: 修改接口

parent 37e30d9c
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.bdc198bb2ce580f23d08c68412d0ce29.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.a9a0375f6e2c9d70d8f4.js></script><script type=text/javascript src=./static/js/vendor.bb8c036d7dd62f4cb37a.js></script><script type=text/javascript src=./static/js/app.434c40aceca40251eccb.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.92f53a4eb692e4084d7153f9a99f8f9f.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.bb93792668af13e155e2.js></script><script type=text/javascript src=./static/js/vendor.bb8c036d7dd62f4cb37a.js></script><script type=text/javascript src=./static/js/app.434c40aceca40251eccb.js></script></body></html>
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,o,a){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,a);b.length;)b.shift()();if(a)for(u=0;u<a.length;u++)i=c(c.s=a[u]);return i};var r={},t={21:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,c.nc&&a.setAttribute("nonce",c.nc),a.src=c.p+"static/js/"+e+"."+{0:"8d33a005548cc91f2535",1:"0ebe3ead93207dc78a78",2:"d75808c8197409d32076",3:"0fafedd06098c7848d2a",4:"dbac6029f8f49f9aed96",5:"e704f35bae2785ada05b",6:"03233da003452ba92dd2",7:"4cb82e13df0c0c5b4b13",8:"b7ed0abeb26ad276c2a5",9:"56e39a7db187d5965631",10:"638039a7b39908980436",11:"80fde13c3f372ead3f07",12:"3b9c756b15cf547445f5",13:"8c010f219d94d60ce267",14:"9825bb69e60b8030c230",15:"cb7b875c24b40e9cb6e0",16:"59c1113679bef2e96538",17:"d9a00e33c7fd8f7bc66c",18:"37321ffca9347a60b988"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,o.appendChild(a),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,o,a){for(var f,b,d,i=0,u=[];i<r.length;i++)b=r[i],t[b]&&u.push(t[b][0]),t[b]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,a);u.length;)u.shift()();if(a)for(i=0;i<a.length;i++)d=c(c.s=a[i]);return d};var r={},t={21:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,c.nc&&a.setAttribute("nonce",c.nc),a.src=c.p+"static/js/"+e+"."+{0:"8d33a005548cc91f2535",1:"0ebe3ead93207dc78a78",2:"b46f34082aea8f61eff8",3:"eeb169652ee44d9892d0",4:"24c2de0ee30b9b2c69df",5:"e704f35bae2785ada05b",6:"03233da003452ba92dd2",7:"4cb82e13df0c0c5b4b13",8:"b7ed0abeb26ad276c2a5",9:"bd4ba95c34a584a7dc76",10:"638039a7b39908980436",11:"80fde13c3f372ead3f07",12:"3b9c756b15cf547445f5",13:"369e10e7c7f25760058c",14:"9825bb69e60b8030c230",15:"cb7b875c24b40e9cb6e0",16:"59c1113679bef2e96538",17:"d9a00e33c7fd8f7bc66c",18:"37321ffca9347a60b988"}[e]+".js";var f=setTimeout(b,12e4);function b(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=b,o.appendChild(a),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
......@@ -199,6 +199,7 @@ export default {
let resData = res.data;
if (resData.code == '0000') {
showMsg.showmsg('回滚成功', 'success');
that.getData();
return;
}
errMsg.errorMsg(resData);
......
......@@ -91,7 +91,6 @@ export default {
},
mounted() {
const that = this;
// console.log(that.itemData);
that.trData = JSON.parse(JSON.stringify(that.itemData));
}
};
......
......@@ -37,7 +37,7 @@ import backInfoShow from '@/components/api/back-info-show.vue';
</el-form-item>
<el-form-item label="错误码:">
<el-table :data="apiInfoData.errCode" style="width: 100%">
<el-table-column prop="orig_error_code" label="错误码"> </el-table-column>
<el-table-column prop="orig_error_code" label="原始错误码"> </el-table-column>
<el-table-column prop="error_code" label="映射错误码"> </el-table-column>
<el-table-column prop="error_info" label="错误信息"> </el-table-column>
</el-table>
......
......@@ -78,7 +78,7 @@ export default {
// createTime: 1564455643252
// }
],
pageSize: 20,
pageSize: 8,
currentPage: 1,
totalCount: 0
};
......@@ -105,9 +105,6 @@ export default {
const that = this;
that.customDialog = false;
that.$emit('hideHistoryDialog');
/* that.$nextTick(() => {
that.formData.classifyName = '';
}); */
},
/**
......@@ -174,7 +171,7 @@ export default {
*/
handleShow(index, row) {
const that = this;
that.$router.push('/apiListManageShow');
that.$router.push(`/apiListManageShow?interfaceId=${row.interfaceId}&interfaceName=${row.interfaceName}&interfaceVersionId=${row.interfaceVersionId}`);
},
/**
* 获取数据
......@@ -187,10 +184,10 @@ export default {
sceneCode: that.apiData.sceneCode,
interfaceId: that.apiData.interfaceId
};
getRequest('/gateway-manage/page-api-publish-record', para)
getRequest('/gateway-manage/page-api-version-record', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
if (resData.code == '0000') {
that.tableData = resData.result.result || [];
that.totalCount = resData.result.totalCount;
return;
......@@ -214,6 +211,7 @@ export default {
historyShow: function(newData, oldData) {
const that = this;
that.customDialog = newData;
that.getData();
}
},
......
......@@ -153,9 +153,6 @@ export default {
setData(list) {
const that = this;
that.$emit('hidePublishDialog', true);
/* that.$nextTick(() => {
that.formData.classifyName = '';
}); */
}
},
watch: {
......
......@@ -114,9 +114,6 @@ export default {
const that = this;
that.customDialog = false;
that.$emit('hideRecordDialog');
/* that.$nextTick(() => {
that.formData.classifyName = '';
}); */
},
/**
......
......@@ -158,9 +158,6 @@ export default {
setData(list) {
const that = this;
that.$emit('hideSyncDialog');
/* that.$nextTick(() => {
that.formData.classifyName = '';
}); */
},
/**
* 获取环境列表
......
......@@ -169,6 +169,8 @@ export default {
let resData = res.data;
if (resData.code == '0000') {
showMsg.showmsg('设置成功', 'success');
that.currentPage = 1;
that.getData();
return;
}
errMsg.errorMsg(resData);
......
......@@ -31,13 +31,13 @@ import backConstant from '@/components/createApi/back-constant.vue';
</div>
<div class="el-table__body-wrapper is-scrolling-none">
<div class="table-content">
<template v-for="(itemValue, itemName, index) in trData.properties">
<template v-for="(itemValue, itemName, index) in itemData.properties">
<table cellspacing="0" cellpadding="0" border="0" class="el-table__body" style="width: 100%; table-layout: fixed;" :key="index + itemName + 121">
<tbody>
<tr class="el-table__row">
<td rowspan="1" colspan="1" class="el-table_1_column_1">
<div class="cell">
<el-input v-model="itemValue.currentKey" placeholder="请输入参数名"></el-input>
<el-input v-model="itemValue.currentKey" placeholder="请输入参数名" @blur="blurKey(itemValue, itemName)"></el-input>
</div>
</td>
<td v-if="interfaceType == '0'" rowspan="1" colspan="1" class="el-table_1_column_2">
......@@ -103,6 +103,7 @@ export default {
name: {
backendOriginType: 'query', //来源类型 query,body,header
type: 'string',
constFlag: true,
currentKey: 'name',
isBackendField: 0, //是否后端字段
defaultVal: 'val', //默认值
......@@ -128,28 +129,25 @@ export default {
that.$set(that.itemData.properties, obj.currentKey, obj);
that.$delete(that.itemData.properties, oldKey);
}
// console.log(obj, that.itemData);
},
/**
* 删除
*/
handleDel(obj, itemKey, index) {
const that = this;
// that.$emit('input', that.trData);
that.$delete(that.trData.properties, itemKey);
that.$delete(that.itemData.properties, itemKey);
},
/**
* 添加
*/
toAddItem() {
const that = this;
// console.log(that.trData.properties);
let length = that.keyLength++;
// console.log(Object.keys(that.trData.properties), length, that.trData.properties);
that.$set(that.trData.properties, 'field' + length, {
that.$set(that.itemData.properties, 'field' + length, {
backendOriginType: 'query', //来源类型 query,body,header
type: 'string',
currentKey: 'field' + length,
constFlag: true,
isBackendField: 0, //是否后端字段
defaultVal: 'val', //默认值
isRootKey: 0, //是否是后端参数字段
......@@ -173,7 +171,6 @@ export default {
},
mounted() {
const that = this;
// console.log(that.itemData);
that.trData = JSON.parse(JSON.stringify(that.itemData));
}
};
......
......@@ -87,7 +87,6 @@ export default {
that.$set(that.itemData.properties, obj.rootKey, obj);
that.$delete(that.itemData.properties, oldKey);
}
// console.log(obj, that.itemData);
},
/**
* 改变checkbox
......
......@@ -97,25 +97,17 @@ export default {
*/
handleDel(parentKey, itemKey, index, level) {
const that = this;
/* console.log('handleDel:', that.$parent);
console.log('handleDel:', parentKey, itemKey, index, level);
console.log('handleDel:', that.trData, that.itemData); */
that.handleDelData(that.itemData, parentKey, itemKey);
},
handleDelData(itemData, pkey, itemKey) {
const that = this;
// console.log(itemData, pkey, itemKey);
that.handleObjData(itemData, pkey, itemKey);
},
handleObjData(itemData, pkey, itemKey) {
const that = this;
for (let i in itemData) {
// console.log(itemData[i]);
if (itemData[i] == pkey) {
// console.log(itemData.properties);
that.$delete(itemData.properties, itemKey);
} else {
// that.handleObjData(itemData.properties, pkey, itemKey);
}
}
},
......@@ -124,10 +116,7 @@ export default {
*/
changeType(type, obj, itemKey, level) {
const that = this;
// console.log('changeType:', type, obj, itemKey);
// that.$set(obj, 'type', obj.type);
if (type == 'string' || type == 'boolean' || type == 'number' || type == 'object') {
// console.log(type);
obj.properties = {};
if (obj.hasOwnProperty('items')) {
that.$delete(obj, 'items');
......@@ -151,7 +140,6 @@ export default {
properties: {}
});
}
// that.$emit('refreshData', that.trData);
that.$forceUpdate();
},
/**
......@@ -162,8 +150,6 @@ export default {
*/
handleAdd(obj, itemKey, index, level) {
const that = this;
// console.log('parent:', that.$parent);
// console.log('handleAdd:', obj, itemKey, index, level);
let length = that.keyLength++;
if (obj.type == 'array') {
that.$set(obj.items.properties, 'field' + length, {
......@@ -205,30 +191,19 @@ export default {
check: true,
properties: {}
});
// console.log(that.trData);
// that.$emit('refreshData', that.trData);
that.$forceUpdate();
}
},
watch: {
itemData: function(newData, oldData) {
const that = this;
// console.log('itemData:', newData);
if (newData) {
that.trData = JSON.parse(JSON.stringify(newData));
}
}
/* trData: {
handler(newName, oldName) {
console.log('trData:', newName);
},
immediate: true,
deep: true
} */
},
mounted() {
const that = this;
// console.log('that.itemData:', that.itemData);
that.trData = JSON.parse(JSON.stringify(that.itemData));
}
};
......
......@@ -273,7 +273,6 @@ export default {
that.apiInfoData.backBodyJsonData = that.backBodyJsonData;
that.apiInfoData.backBodyFormData = that.backBodyFormData;
that.apiInfoData.constData = that.constData;
// console.log(that.apiInfoData);
that.$emit('submitNext', that.apiInfoData);
that.$store.dispatch('saveBackInfo', that.apiInfoData);
},
......@@ -322,7 +321,6 @@ export default {
}
that.backHeaderData = JSON.parse(JSON.stringify(frontInfo.headerData));
that.frontHeaderData = JSON.parse(JSON.stringify(frontInfo.headerData));
// console.log(frontInfo.headerData);
}
// query 数据
if (Object.keys(frontInfo.queryData).length) {
......@@ -336,7 +334,6 @@ export default {
}
that.backQueryData = JSON.parse(JSON.stringify(frontInfo.queryData));
that.frontQueryData = JSON.parse(JSON.stringify(frontInfo.queryData));
// console.log(frontInfo.queryData);
}
// body form 数据
if (Object.keys(frontInfo.bodyFormData).length) {
......@@ -350,7 +347,6 @@ export default {
}
that.backBodyFormData = JSON.parse(JSON.stringify(frontInfo.bodyFormData));
that.frontBodyFormData = JSON.parse(JSON.stringify(frontInfo.bodyFormData));
// console.log(frontInfo.bodyFormData);
}
// body json 数据
if (Object.keys(frontInfo.bodyJsonData).length) {
......@@ -364,23 +360,21 @@ export default {
}
that.backBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
that.frontBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
// console.log(frontInfo.bodyJsonData);
}
that.$forceUpdate();
},
handleStoreData() {
const that = this;
that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.backInfo));
that.constData = that.apiInfoData.constData;
}
},
mounted() {
const that = this;
/* eslint-disable */
// console.log(that.$store);
that.getEnvSetData();
that.handleFrontData();
if (Object.keys(that.$store.state.backInfo).length) {
that.handleStoreData()
that.handleStoreData();
}
}
};
......@@ -422,5 +416,4 @@ export default {
text-overflow: hidden;
}
}
</style>
......@@ -220,7 +220,7 @@ export default {
sucReturn: allData.sucReturn, // 成功返回示例
errReturn: allData.errReturn, // 失败返回示例
// 错误码
errCode: allData.errCode.map(item => item.errorCode) || []
errCode: allData.errCode
};
that.$store.dispatch('saveResultInfo', result);
},
......
......@@ -212,7 +212,6 @@ export default {
methods: {
refreshData(data) {
const that = this;
// console.log('refreshData:', data);
that.frontData = data;
},
/**
......@@ -228,11 +227,6 @@ export default {
*/
submitForm(formName) {
const that = this;
/* console.log('frontData:', that.frontData);*/
// console.log('frontHeaderTable:', that.headerData, that.$refs.frontHeaderTable.trData);
// console.log('frontQueryTable:', that.queryData, that.$refs.frontQueryTable.trData);
// console.log('frontbodyJsonTable:', that.bodyJsonData, that.$refs.frontBodyJsonTable.trData);
// console.log('frontbodyFormTable:', that.bodyFormData, that.$refs.frontBodyFormTable.trData);
that.$refs[formName].validate(valid => {
if (valid) {
that.handleData();
......@@ -301,10 +295,8 @@ export default {
},
mounted() {
const that = this;
/* eslint-disable */
console.log(that.$store);
if (Object.keys(that.$store.state.frontInfo).length) {
that.handleStoreData()
that.handleStoreData();
}
}
};
......
......@@ -40,10 +40,7 @@ import createResult from '@/components/api/create-result.vue';
</div>
</el-form-item>
<el-form-item label="错误码映射:" prop="errCode">
<el-select multiple v-model="errCode" placeholder="请选择映射错误码" @change="changeErr">
<el-option v-for="item in errOptions" :key="item.errorCode" :label="item.errorCode" :value="item.errorCode"> </el-option>
</el-select>
<!-- <el-table :data="apiInfoData.errCode" style="width: 100%">
<el-table :data="apiInfoData.errCode" style="width: 100%">
<el-table-column label="原始错误码">
<template slot-scope="scope">
<div class="cell">
......@@ -54,7 +51,7 @@ import createResult from '@/components/api/create-result.vue';
<el-table-column label="错误码映射">
<template slot-scope="scope">
<div class="cell">
<el-select v-model="scope.row.error_code" filterable remote reserve-keyword placeholder="请输入映射错误码" :remote-method="remoteMethod" :loading="loading">
<el-select v-model="scope.row.error_code" placeholder="请选择映射错误码" @change="changeErr($event, scope.$index, scope.row)">
<el-option v-for="item in errOptions" :key="item.errorCode" :label="item.errorCode" :value="item.errorCode"> </el-option>
</el-select>
</div>
......@@ -75,7 +72,7 @@ import createResult from '@/components/api/create-result.vue';
</template>
</el-table-column>
</el-table>
<div class="add-line add-err-line text-center" @click="addErrCodeItem"><i class="el-icon-circle-plus-outline color-5584FF"></i><span class="color-5584FF font-14 p-l-4">添加错误码配置</span></div> -->
<div class="add-line add-err-line text-center" @click="addErrCodeItem"><i class="el-icon-circle-plus-outline color-5584FF"></i><span class="color-5584FF font-14 p-l-4">添加错误码配置</span></div>
</el-form-item>
<el-form-item label="成功返回示例:" prop="sucReturn">
<el-input class="w-389" type="textarea" :rows="3" placeholder="请输入内容" v-model="apiInfoData.sucReturn"> </el-input>
......@@ -135,7 +132,6 @@ export default {
}
},
rules: {
errCode: [{ type: 'array', required: true, message: '请选择错误码', trigger: 'change' }],
sucReturn: [{ required: true, message: '请输入成功返回示例', trigger: 'blur' }],
errReturn: [{ required: true, message: '请输入失败返回示例', trigger: 'blur' }]
},
......@@ -154,18 +150,14 @@ export default {
/**
* 选择错误码
*/
changeErr() {
changeErr($event, index, row) {
const that = this;
if (that.errCode.length) {
let codeData = [];
codeData = that.errOptions.filter(ele => {
if (that.errCode.includes(ele.errorCode)) {
return ele;
} else {
return;
if ($event) {
that.errOptions.forEach(ele => {
if ($event == ele.errorCode) {
row.error_info = ele.errorInfo;
}
});
that.apiInfoData.errCode = codeData || [];
}
},
/**
......@@ -173,9 +165,7 @@ export default {
*/
toAddItem() {
const that = this;
// console.log(that.trData.properties);
let length = that.keyLength++;
// console.log(Object.keys(that.trData.properties), length, that.trData.properties);
that.$set(that.resultParams.properties, 'field' + length, {
level: 2,
parentKey: '', // 新增父级的 key
......@@ -217,8 +207,6 @@ export default {
*/
submitForm: _debounce(function(formName) {
const that = this;
// console.log('resultBodyTable:', that.resultBodyTable);
// console.log('resultBodyTable:', that.$refs.resultBodyTable.trData);
that.$refs[formName].validate(valid => {
if (valid) {
that.handleFrontBackData();
......@@ -354,11 +342,9 @@ export default {
},
mounted() {
const that = this;
/* eslint-disable */
console.log(that.$store);
that.getErrcodeData();
if (that.$route.query.interfaceId) {
that.handleStoreData()
that.handleStoreData();
}
}
};
......
......@@ -138,21 +138,17 @@ export default {
that.$set(that.itemData.properties, obj.currentKey, obj);
that.$delete(that.itemData.properties, oldKey);
}
// console.log(obj, that.itemData);
},
/**
* 删除
*/
handleDel(obj, itemKey, index) {
const that = this;
// that.$emit('input', that.trData);
that.$delete(that.itemData.properties, itemKey);
},
toAddItem() {
const that = this;
// console.log(that.trData.properties);
let length = that.keyLength++;
// console.log(Object.keys(that.trData.properties), length, that.trData.properties);
that.$set(that.itemData.properties, 'field' + length, {
frontOriginType: that.frontOriginType, //来源类型 query,body,header
backendOriginType: that.frontOriginType,
......@@ -172,13 +168,11 @@ export default {
watch: {
itemData: function(newData, oldData) {
const that = this;
// console.log(newData);
that.trData = JSON.parse(JSON.stringify(newData));
}
},
mounted() {
const that = this;
// console.log(that.itemData);
that.trData = JSON.parse(JSON.stringify(that.itemData));
}
};
......
......@@ -71,7 +71,6 @@ export default {
that.$set(that.itemData.properties, obj.currentKey, obj);
that.$delete(that.itemData.properties, oldKey);
}
// console.log(obj, that.itemData);
},
/**
* 更新参数名字段
......@@ -90,17 +89,12 @@ export default {
that.updateKey(itemData[key].items.properties);
}
}
// console.log(that.itemData);
},
/**
* 删除一项
*/
async handleDel(parentKey, itemKey, index, level) {
const that = this;
// console.log('handleDel:', parentKey, itemKey, index, level, that.itemData);
/* console.log('handleDel:', that.$parent);
console.log('handleDel:', parentKey, itemKey, index, level);
console.log('handleDel:', that.trData, that.itemData); */
await that.updateKey(that.itemData.properties);
if (!parentKey) {
that.$delete(that.itemData.properties, itemKey);
......@@ -110,18 +104,13 @@ export default {
},
handleDelData(itemData, pkey, itemKey) {
const that = this;
// console.log(itemData, pkey, itemKey);
that.handleObjData(itemData, pkey, itemKey);
},
handleObjData(itemData, pkey, itemKey) {
const that = this;
for (let i in itemData) {
// console.log(itemData[i]);
if (itemData[i] == pkey) {
// console.log(itemData.properties);
that.$delete(itemData.properties, itemKey);
} else {
// that.handleObjData(itemData.properties, pkey, itemKey);
}
}
},
......@@ -130,10 +119,7 @@ export default {
*/
changeType(type, obj, itemKey, level) {
const that = this;
// console.log('changeType:', type, obj, itemKey);
// that.$set(obj, 'type', obj.type);
if (type == 'string' || type == 'boolean' || type == 'number' || type == 'object') {
// console.log(type);
obj.properties = {};
if (obj.hasOwnProperty('items')) {
that.$delete(obj, 'items');
......@@ -150,7 +136,6 @@ export default {
properties: {}
});
}
// that.$emit('refreshData', that.trData);
that.$forceUpdate();
},
/**
......@@ -161,8 +146,6 @@ export default {
*/
handleAdd(obj, itemKey, index, level) {
const that = this;
// console.log('parent:', that.$parent);
// console.log('handleAdd:', obj, itemKey, index, level);
let length = that.keyLength++;
if (obj.type == 'array') {
that.$set(obj.items.properties, 'field' + length, {
......@@ -190,30 +173,19 @@ export default {
example: '示例',
properties: {}
});
// console.log(that.trData);
// that.$emit('refreshData', that.trData);
that.$forceUpdate();
}
},
watch: {
itemData: function(newData, oldData) {
const that = this;
// console.log('itemData:', newData);
if (newData) {
that.trData = JSON.parse(JSON.stringify(newData));
}
}
/* trData: {
handler(newName, oldName) {
console.log('trData:', newName);
},
immediate: true,
deep: true
} */
},
mounted() {
const that = this;
// console.log('that.itemData:', that.itemData);
that.trData = JSON.parse(JSON.stringify(that.itemData));
}
};
......
......@@ -113,10 +113,6 @@ export default {
that.showDialog = false;
return false;
}
/* if (that.editRow.interfaceGroupId) {
that.tableData[that.editIndex].groupName = obj.groupName;
that.tableData[that.editIndex].remark = obj.remark;
} else { */
that.currentPage = 1;
that.getData();
// }
......
......@@ -32,7 +32,7 @@
<el-table-column label="操作" show-overflow-tooltip>
<template slot-scope="scope">
<el-button @click="handleEdit(scope.$index, scope.row)" type="text">编辑</el-button>
<el-button @click="handleDel(scope.$index, scope.row)" type="text">删除</el-button>
<!-- <el-button @click="handleDel(scope.$index, scope.row)" type="text">删除</el-button> -->
</template>
</el-table-column>
</el-table>
......@@ -124,6 +124,13 @@ export default {
},
hideDialog(obj) {
const that = this;
if (!obj) {
that.editIndex = '';
that.editRow = {};
that.showDialog = false;
return false;
}
that.currentPage == 1;
that.getData();
that.editIndex = '';
that.editRow = {};
......
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