You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
546 lines
12 KiB
546 lines
12 KiB
@@master_page.html |
|
<link |
|
href="css/page_table_list.css" |
|
rel="stylesheet" |
|
/> |
|
<div |
|
id="apibox" |
|
class="card" |
|
> |
|
<div class="search-bar"> |
|
<form |
|
id="frmSearach" |
|
action="lyear_forms_elements.html" |
|
method="post" |
|
onsubmit="return false;" |
|
> |
|
<div class="form-group"> |
|
<div class="row"> |
|
<div class="col-md-2"> |
|
<input |
|
class="form-control" |
|
type="text" |
|
id="txtSearch" |
|
name="example-text-input" |
|
placeholder="方法名称" |
|
/> |
|
</div> |
|
<div class="col-md-3"> |
|
<button |
|
@click="onSearch()" |
|
id="btnSearch" |
|
class="btn btn-secondary" |
|
> |
|
<i class="mdi mdi-magnify"></i>搜索 |
|
</button> |
|
<button |
|
onclick="frmSearach.reset()" |
|
class="btn btn-close m-l-15" |
|
type="submit" |
|
> |
|
清空 |
|
</button> |
|
</div> |
|
<div class="col-md-4"></div> |
|
</div> |
|
</div> |
|
</form> |
|
<div class="toolbar-btn-action"> |
|
<button |
|
@click="openAddDiv()" |
|
class="btn btn-primary m-l-15" |
|
data-toggle="modal" |
|
data-target="#gridSystemModal" |
|
> |
|
<i class="mdi mdi-plus"></i> 新增 |
|
</button> |
|
</div> |
|
</div> |
|
<div class="card-body"> |
|
<h5></h5> |
|
<div class="table-responsive"> |
|
<table class="table table-bordered"> |
|
<thead> |
|
<tr |
|
v-if="data && data.Columns && data.Columns.length > 0" |
|
> |
|
<th |
|
class="mi-w-100" |
|
v-for="column in data.Columns" |
|
> |
|
{{column.ColumnDescription}} |
|
</th> |
|
<th>操作</th> |
|
</tr> |
|
</thead> |
|
<tbody v-if="data &&data.Data"> |
|
<tr |
|
v-if="data.Columns && data.Columns.length > 0" |
|
v-for="item in data.Data" |
|
> |
|
<td v-for="column in data.Columns"> |
|
{{ item[column.PropertyName] }} |
|
</td> |
|
|
|
<td class="table_opt"> |
|
<button |
|
data-toggle="modal" |
|
@click="openEditDiv(item)" |
|
data-target="#gridSystemModal" |
|
class="btn btn-link" |
|
type="button" |
|
> |
|
<i class="mdi mdi-lead-pencil"></i> 修改 |
|
</button> |
|
<button |
|
data-toggle="modal" |
|
@click="deleteAndConfirm(item)" |
|
data-target="#divDelBox" |
|
class="btn btn-link" |
|
type="button" |
|
> |
|
<i class="mdi mdi-do-not-disturb"></i> 删除 |
|
</button> |
|
</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
@@page_control.html |
|
<div |
|
class="modal fade" |
|
tabindex="-1" |
|
role="dialog" |
|
aria-labelledby="gridSystemModalLabel" |
|
id="gridSystemModal" |
|
style="display: none" |
|
> |
|
<div |
|
class="modal-dialog" |
|
role="document" |
|
> |
|
<div class="modal-content"> |
|
<div class="modal-header"> |
|
<button |
|
type="button" |
|
class="close" |
|
data-dismiss="modal" |
|
aria-label="Close" |
|
> |
|
<span aria-hidden="true">×</span> |
|
</button> |
|
<h4 |
|
class="modal-title" |
|
id="exampleModalLabel" |
|
> |
|
{{title}} |
|
</h4> |
|
</div> |
|
<div class="modal-body"> |
|
<form id="frmEdit"> |
|
<input |
|
type="hidden" |
|
v-model="formData.ID" |
|
name="ID" |
|
/> |
|
<div class="form-group"> |
|
<label |
|
for="recipient-name" |
|
class="control-label" |
|
>属性路径:</label |
|
> |
|
<input |
|
type="text" |
|
v-model="formData.OBJECT_PATH" |
|
name="OBJECT_PATH" |
|
class="form-control" |
|
id="recipient-name" |
|
/> |
|
</div> |
|
<div class="form-group"> |
|
<label |
|
for="message-text" |
|
class="control-label" |
|
>实体表名: |
|
</label> |
|
<div class="input-group"> |
|
<input |
|
v-model="formData.MAPPING_TABLE" |
|
type="text" |
|
name="MAPPING_TABLE" |
|
class="form-control" |
|
/> |
|
<span class="input-group-btn"> |
|
<button |
|
@click="openImportEntity(item)" |
|
class="btn btn-default" |
|
type="button" |
|
> |
|
选择表 |
|
</button> |
|
</span> |
|
</div> |
|
</div> |
|
<div class="form-group"> |
|
<label |
|
for="message-text" |
|
class="control-label" |
|
>实体归属:</label |
|
> |
|
<input |
|
type="radio" |
|
id="contactChoice2" |
|
name="ASSEMBLY_TYPE" |
|
value="0" |
|
v-model="formData.ASSEMBLY_TYPE" |
|
checked |
|
/> |
|
<label for="contactChoice2">系统</label> |
|
<input |
|
type="radio" |
|
id="contactChoice1" |
|
name="ASSEMBLY_TYPE" |
|
value="1" |
|
v-model="formData.ASSEMBLY_TYPE" |
|
/> |
|
<label for="contactChoice1">三方</label> |
|
</div> |
|
<div class="form-group"> |
|
<label |
|
for="message-text" |
|
class="control-label" |
|
>实体类型:</label |
|
> |
|
<input |
|
type="radio" |
|
id="contactChoice2" |
|
name="OBJECT_TYPE" |
|
value="0" |
|
v-model="formData.OBJECT_TYPE" |
|
checked |
|
/> |
|
<label for="contactChoice2">对象</label> |
|
<input |
|
type="radio" |
|
id="contactChoice1" |
|
name="OBJECT_TYPE" |
|
value="1" |
|
v-model="formData.OBJECT_TYPE" |
|
/> |
|
<label for="contactChoice1">列表</label> |
|
</div> |
|
<div class="form-group"> |
|
<label |
|
for="message-text" |
|
class="control-label" |
|
>参数类型:</label |
|
> |
|
<input |
|
type="radio" |
|
id="contactChoice2" |
|
name="PARAMETR_TYPE" |
|
value="0" |
|
v-model="formData.PARAMETR_TYPE" |
|
checked |
|
/> |
|
<label for="contactChoice2">入参</label> |
|
<input |
|
type="radio" |
|
id="contactChoice1" |
|
name="PARAMETR_TYPE" |
|
value="1" |
|
v-model="formData.PARAMETR_TYPE" |
|
/> |
|
<label for="contactChoice1">出参</label> |
|
</div> |
|
</form> |
|
</div> |
|
<div class="modal-footer"> |
|
<button |
|
type="button" |
|
id="btnCloseEdit" |
|
class="btn btn-default" |
|
data-dismiss="modal" |
|
> |
|
关闭 |
|
</button> |
|
<button |
|
type="button" |
|
@click="addOrUpdate()" |
|
class="btn btn-primary" |
|
> |
|
保存 |
|
</button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div |
|
id="divImportEntity" |
|
class="modal fade bs-example-modal-lg" |
|
tabindex="-1" |
|
role="dialog" |
|
aria-labelledby="myLargeModalLabel" |
|
style="display: none" |
|
> |
|
<button |
|
id="btnImportEntity" |
|
type="button" |
|
class="btn btn-primary hidden" |
|
data-toggle="modal" |
|
data-target="#divImportEntity" |
|
></button> |
|
<div |
|
class="modal-dialog modal-lg border3CCC" |
|
role="document" |
|
> |
|
<div class="modal-content"> |
|
<div class="modal-header"> |
|
<button |
|
type="button" |
|
class="close" |
|
data-dismiss="modal" |
|
aria-label="Close" |
|
> |
|
<span aria-hidden="true">×</span> |
|
</button> |
|
<h4 |
|
class="modal-title" |
|
id="myLargeModalLabel" |
|
> |
|
选择表 |
|
</h4> |
|
</div> |
|
<div class="modal-body"> |
|
<div class="input-group width250 m-b-10"> |
|
<input |
|
id="txtTableName" |
|
type="text" |
|
class="form-control" |
|
/> |
|
<span class="input-group-btn"> |
|
<button |
|
type="button" |
|
@click="bindImportTables()" |
|
class="btn btn-default" |
|
> |
|
<i class="mdi mdi-magnify"></i>搜索 |
|
</button> |
|
<button |
|
type="button" |
|
onclick="txtTableName.value=''" |
|
class="btn btn-default" |
|
> |
|
<i class="mdi mdi-refresh"></i>清空 |
|
</button> |
|
</span> |
|
</div> |
|
<div class="master-table-container"> |
|
<table class="table table-bordered"> |
|
<thead> |
|
<tr> |
|
<th>表名</th> |
|
<th>描述</th> |
|
</tr> |
|
</thead> |
|
<tbody v-if="tables.length>0"> |
|
<tr |
|
v-for="item in tables" |
|
@click="selectTable(item)" |
|
:style="{ |
|
'background-color':item.Id ==isSelectTable.Id? '#f5f5f5': '' |
|
}" |
|
> |
|
<td>{{ item.Name }}</td> |
|
<td>{{ item.Description }}</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<div class="modal-footer"> |
|
<button |
|
type="button" |
|
id="btnImportEntityClose" |
|
class="btn btn-default" |
|
data-dismiss="modal" |
|
> |
|
关闭 |
|
</button> |
|
<button |
|
type="button" |
|
@click="importEntitySubmit()" |
|
class="btn btn-primary" |
|
> |
|
确定 |
|
</button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<script> |
|
var vueObj = new Vue({ |
|
el: '#apibox', |
|
data: { |
|
data: null, |
|
error: null, |
|
addTitle: '添加动态接口分类', |
|
editTitle: '修改态接口分类', |
|
title: '', |
|
formData: {}, |
|
methodId: '', |
|
databaseId: 1, |
|
database: [], |
|
tables: [], |
|
isSelectTable: {}, |
|
}, |
|
mounted() { |
|
var url = window.location.href |
|
if (url.includes('?')) { |
|
var methodId = url.substring( |
|
url.lastIndexOf('?') + 1 |
|
) |
|
this.methodId = methodId |
|
} |
|
this.fetchData('') |
|
}, |
|
methods: { |
|
fetchData(append) { |
|
var url = |
|
`/std_entity/list?${ |
|
this.methodId ? 'methodID=' + this.methodId : '' |
|
}` + append |
|
axios |
|
.get(url, jwHeader) |
|
.then(response => { |
|
this.data = response.data |
|
this.error = null |
|
}) |
|
.catch(error => { |
|
this.error = error.message |
|
this.data = null |
|
}) |
|
}, |
|
onSearch: function (page) { |
|
var urlParameters = |
|
'&' + |
|
tools.objectToQueryString({ |
|
title: txtSearch.value, |
|
__pageNumber: page, |
|
__pageSize: tools.getValue('selPageSize'), |
|
}) |
|
this.fetchData(urlParameters) |
|
}, |
|
deleteAndConfirm: function (item) { |
|
if (item == null) { |
|
if (localStorage.delId == 200100) { |
|
tools.alert('初始化分类不能删除') |
|
btnDelClose.click() |
|
return |
|
} |
|
var url = |
|
'/PrivateReZeroRoute/100003/DeleteDynamicInterfaceCategory?IsDeleted=true&Id=' + |
|
localStorage.delId |
|
axios |
|
.get(url, jwHeader) |
|
.then(response => { |
|
this.data = response.data |
|
this.error = null |
|
this.onSearch() |
|
btnDelClose.click() |
|
}) |
|
.catch(error => { |
|
this.error = error.message |
|
this.data = null |
|
}) |
|
} else { |
|
localStorage.delId = item.Id |
|
} |
|
}, |
|
openEditDiv: function (item) { |
|
console.log(item) |
|
var urlById = '/std_entity/get?id=' + item.ID |
|
if (item.ID) { |
|
this.title = this.editTitle |
|
axios |
|
.get(urlById, jwHeader) |
|
.then(response => { |
|
this.formData = response.data |
|
}) |
|
.catch(error => { |
|
this.error = error.message |
|
this.data = null |
|
}) |
|
} |
|
}, |
|
openAddDiv: function (item) { |
|
this.title = this.addTitle |
|
this.formData = { |
|
OBJECT_TYPE: 0, |
|
PARAMETR_TYPE: 0, |
|
ASSEMBLY_TYPE: 0, |
|
METHOD_REF: this.methodId, |
|
MAPPING_TABLE: '', |
|
} |
|
}, |
|
addOrUpdate: function () { |
|
var th = this |
|
var frmId = 'frmEdit' |
|
var json = this.formData |
|
var url = json.METHOD_ID |
|
? '/std_entity/update' |
|
: '/std_entity/create' |
|
this.addOrUpdateSubmit(url, json) |
|
}, |
|
addOrUpdateSubmit: function (url, json) { |
|
var th = this |
|
axios |
|
.post(url, json, jwHeader) |
|
.then(response => { |
|
this.error = null |
|
this.onSearch() |
|
if (response.data == true) { |
|
frmEdit.reset() |
|
btnCloseEdit.click() |
|
} else { |
|
tools.highlightErrorFields(response.data) |
|
} |
|
}) |
|
.catch(error => { |
|
this.error = error.message |
|
this.data = null |
|
}) |
|
}, |
|
openImportEntity: function () { |
|
btnImportEntity.click() |
|
this.bindImportTables() |
|
}, |
|
bindImportTables: function () { |
|
var url = |
|
'/PrivateReZeroRoute/100004/GetAllTables?databaseId=' + |
|
this.databaseId + |
|
'&tableName=' + |
|
txtTableName.value |
|
axios |
|
.get(url, jwHeader) |
|
.then(response => { |
|
this.tables = response.data |
|
this.error = null |
|
}) |
|
.catch(error => { |
|
this.error = error.message |
|
}) |
|
}, |
|
selectTable(item) { |
|
this.isSelectTable = item |
|
}, |
|
importEntitySubmit: function () { |
|
this.formData.MAPPING_TABLE = |
|
this.isSelectTable.Name |
|
btnImportEntityClose.click() |
|
}, |
|
}, |
|
}) |
|
</script>
|
|
|