<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>接口详情</title>
|
|
<script type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [
|
{
|
id: "css1",
|
type: "css",
|
url: "//at.alicdn.com/t/font_2374495_13ltsxm2eor.css"
|
},
|
{
|
id: "css1",
|
type: "css",
|
url: "//at.alicdn.com/t/font_2760480_udlo32lprt.css"
|
},
|
];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new FormVue({
|
el: "#vbody",
|
data: {
|
form_dataname: "agreementRecord",
|
table_dataname: "receiptDetail",
|
title: "接口详情",
|
newRowDefault: {
|
//id: uuid_short(),
|
isreconciliation: "F",
|
code: createCode("BA"),
|
//statecode: "input",
|
create_time: createDatetime(),
|
status: "input",
|
receivedate: createDate(),
|
docdate: createDate(),
|
// creator: window.top.userinfo.user.name
|
},
|
|
role: RootRole,
|
notdisabled: true,
|
|
formAttr: {
|
istitle: false,
|
columnnumber: 2,
|
labelwidth: "100px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
|
formAttr1: {
|
istitle: false,
|
title: "",
|
columnnumber: 1,
|
labelwidth: "110px",
|
labelposition: "top",
|
size: "medium",
|
binvoice: "0px solid #c6c6c600"
|
},
|
formFields: [
|
{isshow: "T", field: "field1", name: "分组", type: "input", notvalunit: true, optionsgroup: "datarouting"},
|
{isshow: "T", field: "field2", name: "接口名称", type: "input", notvalunit: true, optionsgroup: "datarouting"},
|
{isshow: "T", field: "datarouting", name: "调用方式", type: "select", notvalunit: true, optionsgroup: "datarouting"},
|
{isshow: "T", field: "classify", name: "分类", type: "select", notvalunit: true, optionsgroup: "classify"},
|
{isshow: "T", field: "type", name: "远端源", type: "input", notvalunit: true, optionsgroup: "interface_type"},
|
// {isshow: "T", field: "name", name: "接口名称", type: "input", notvalunit: true},
|
{isshow: "T", field: "field4", name: "远端表名", type: "input", notvalunit: true},
|
{isshow: "T", field: "field3", name: "接口对应的dataname", labelwidth: 150, type: "input", notvalunit: true, colspan: 2},
|
{isshow: "T", field: "url", name: "接口地址", type: "input", notvalunit: true, colspan: 2},
|
{isshow: "T", field: "isactive", name: "是否激活", type: "select", notvalunit: true, optionsgroup: "isactive"},
|
{isshow: "T", field: "field5", name: "是否打印出接口调用返回内容", labelwidth: 180, type: "select", notvalunit: true, optionsgroup: "isactive"},
|
|
],
|
tableFields: [],
|
tableFields_invoice: [],
|
|
tableData_old: [],
|
tableData_new: [],
|
tableData2: [],
|
tableDataChange: {},
|
tableData: [],
|
selectrow: {},
|
|
newTableData: {
|
create_time: createDatetime(),
|
// creator_name: window.top.vue.userinfo.name,
|
},
|
|
tableHeight2: 280,
|
urlImg2: "./img/wushuju.png",
|
isedit: false,
|
isrefuseedit: false,
|
// isWithinEditTableData:false,
|
formData: {},
|
|
isRefresh: true,
|
selectFormField: {},
|
popupByFieldsDialog: false,
|
|
selectionList: [],
|
|
filterAttr: {
|
columnnumber: 3,
|
labelwidth: "100px",
|
labelposition: "right",
|
size: "medium",
|
binvoice: "3px solid #c6c6c600"
|
},
|
|
filterFields:[],
|
filterFieldsObj: {},
|
filterObj: {},
|
filterList:[],
|
isCommit: false,
|
|
activeNames: "1",
|
tableFields1: [
|
{isshow: "T", field: "name", name: "用户名", type: "input"},
|
{isshow: "T", field: "password", name: "密码", type: "password"},
|
],
|
tableFields2: [
|
{isshow: "T", field: "head_key", name: "key", type: "input"},
|
{isshow: "T", field: "head_value", name: "value", type: "input"},
|
{isshow: "T", field: "description", name: "描述", type: "input"},
|
],
|
tableFields3: [
|
{isshow: "T", field: "content", name: "",type: "textarea"},
|
],
|
auth: {},
|
formData2: {},
|
body: {},
|
radio: 'T',
|
},
|
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "browse") {
|
this.formAttr.disabled = true;
|
this.formAttr1.disabled = true;
|
this.notdisabled = false;
|
this.Approval = false;
|
}
|
|
else if (this.popupParames.sceneCode == "add") {
|
if (this.newRowDefault) {
|
let formData_ = clone(this.formData);
|
|
for (var k in this.newRowDefault) {
|
formData_[k] = this.newRowDefault[k];
|
}
|
this.formData = formData_;
|
}
|
this.isedit = true;
|
}
|
|
else if (this.popupParames.sceneCode == "draw") {
|
this.formAttr.disabled = true;
|
// this.isWithinEditTableData = false;
|
this.notdisabled = false;
|
this.Approval = false;
|
}
|
|
else if (this.popupParames.sceneCode == "edit") {
|
this.isedit = true;
|
}
|
}
|
},
|
|
mounted() {
|
// this.initFields();
|
// this.initData();
|
if (this.popupParames.sceneCode != "add") {
|
this.initData();
|
}
|
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
//let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let w_ = "900px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
// initFields() {
|
// let me = this;
|
// me.formFields = dataRootFields.formFields.interface_;
|
// },
|
initData() {
|
var me = this;
|
|
let param = {
|
dataName : "sys_interface",
|
id: this.formData.id,
|
attachMeta: false,
|
}
|
|
Server.call("root/data/getEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
var data_all = result.data;
|
|
if(data_all.sys_interface_auth[0]){
|
me.auth = data_all.sys_interface_auth[0];
|
console.log(me.auth);
|
}
|
|
if(data_all.sys_interface_header[0]){
|
me.tableData = data_all.sys_interface_header[0];
|
console.log(me.tableData);
|
}
|
|
if(data_all.sys_interface_body[0]){
|
me.body = data_all.sys_interface_body[0];
|
|
if(me.body.istext){
|
me.radio = me.body.istext;
|
}
|
|
if(me.body.content){
|
me.body.content = me.body.content.replaceAll("^", "\"");
|
}
|
else {
|
me.body.content = "";
|
}
|
|
console.log(me.body);
|
}
|
}
|
});
|
},
|
|
closeDialog() {
|
var me = this;
|
if (me.popupParames.totab){
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, false);
|
}
|
else {
|
Root.hidePopup();
|
}
|
},
|
|
saveAfter() {//调回调的关闭
|
var me = this;
|
if(this.popupParames.callback) {
|
let obj = {
|
//row: this.formData
|
}
|
this.popupParames.callback(obj, function() {
|
me.closeDialog();
|
});
|
}
|
else {
|
me.closeDialog();
|
}
|
},
|
|
submitRowTable() {
|
this.isCommit = true;
|
this.saveRowTable();
|
},
|
|
saveRowTable() {
|
var me = this;
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) {
|
entity[r] = entity_[r];
|
}
|
}
|
|
let transBody = clone(me.body);
|
transBody.content = "";
|
if(me.body.content){
|
transBody.content = me.body.content.replace(/\r|\n/ig,"").replaceAll("\"","^");
|
}
|
transBody.istext = me.radio;
|
transBody.isjson = (me.radio == "T")?"F":"T";
|
|
// let all_Body = {
|
// istext: me.radio,
|
// isjson: (me.radio == "T")?"F":"T",
|
// content: transBody.content || {},
|
// }
|
// console.log(all_Body);
|
|
let param = {
|
dataName: "sys_interface",
|
operator: "save",
|
data: {
|
"sys_interface":entity,
|
"sys_interface_auth":[me.auth],
|
"sys_interface_header":me.tableData || [],
|
"sys_interface_body":[transBody],
|
}
|
}
|
|
console.log(param);
|
console.log(me.auth);
|
console.log(me.tableData);
|
|
Server.call("root/data/saveEntity", param, function(result) {
|
console.log(result);
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter();
|
}
|
});
|
},
|
|
addTableData() {
|
var table_row = clone(this.newTableData);
|
this.rowChange(table_row, "add");
|
},
|
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除数据【' + row.product_code + row.product_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.rowChange(row, "del", me.table_dataname);
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
rowChange(row, type, tablename) {
|
var me = this;
|
if (type == "add") {
|
this.tableData.unshift(row);
|
}
|
else if (type == "del") {
|
if (row.id) {
|
let param = {
|
dataname: tablename,
|
id: row.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.tableData.remove(row);
|
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
else {
|
this.tableData.remove(row);
|
}
|
}
|
else {
|
|
}
|
},
|
|
handleChange() {
|
|
},
|
text() {
|
/* this.tableFields3 = [
|
{isshow: "T", field: "istext", name: "",type: "textarea"},
|
]; */
|
},
|
json() {
|
/* this.tableFields3 = [
|
{isshow: "T", field: "isjson", name: "",type: "textarea"},
|
]; */
|
},
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
|
.el-dialog__body {
|
overflow-y: hidden;
|
}
|
.el-textarea__inner {
|
height: 150px;
|
margin-top: 10px;
|
}
|
</style>
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding:0 20px;">
|
<div class="popup_el-dialog__header">
|
<div class="dialog-title">
|
<!-- <i class="iconfont icon-customermanagement"></i> -->
|
<span> {{title}}</span>
|
</div>
|
</div>
|
<div style="height: 350px; overflow-y: auto;">
|
<div class="el-dialog__body">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData">
|
</h-form>
|
|
<!-- <div class="h_dialog__body">
|
<el-tabs v-model="activeNames" @tab-click="handleChange">
|
<el-tab-pane label="Authorization" name="1">
|
<div>
|
<h-form
|
ref="form1"
|
:form-attr="formAttr1"
|
:table-fields="tableFields1"
|
:form-data="auth">
|
</h-form>
|
</div>
|
</el-tab-pane>
|
|
<el-tab-pane label="Headers" name="2">
|
|
|
<div style=" overflow: auto;">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields2"
|
:table-data="tableData"
|
:is-edit-table-data="isedit || isrefuseedit"
|
:is-within-edit-table-data="isedit || isrefuseedit"
|
:table-height="tableHeight2"
|
:is-pagination="false"
|
:edit-table-button="editTableButton"
|
:table-field-click="tablefieldClick"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData">
|
>
|
</h-table>
|
</div>
|
</el-tab-pane>
|
|
<el-tab-pane label="Body" name="3">
|
<div style=" overflow: auto;">
|
<div style="margin-top: 10px;">
|
<el-radio v-model="radio" label="T" @change = "text">Text</el-radio>
|
<el-radio v-model="radio" label="F" @change = "json">Json</el-radio>
|
</div>
|
<h-form
|
ref="form3"
|
:form-attr="formAttr1"
|
:table-fields="tableFields3"
|
:form-data="body">
|
</h-form>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
</div> -->
|
</div>
|
</div>
|
|
<div class="el-dialog__footer">
|
<el-button type="default" @click="closeDialog">取 消</el-button>
|
<el-button v-if="isedit || isrefuseedit" type="primary" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</body>
|
</html>
|