新版IP库管理阶段性提交(未完成)

This commit is contained in:
GoEdgeLab
2022-08-13 23:55:35 +08:00
parent 621191660e
commit 91fe32a9f5
6 changed files with 28 additions and 19 deletions

View File

@@ -316,6 +316,10 @@ func (this *RPCClient) IPLibraryRPC() pb.IPLibraryServiceClient {
return pb.NewIPLibraryServiceClient(this.pickConn())
}
func (this *RPCClient) IPLibraryFileRPC() pb.IPLibraryFileServiceClient {
return pb.NewIPLibraryFileServiceClient(this.pickConn())
}
func (this *RPCClient) IPListRPC() pb.IPListServiceClient {
return pb.NewIPListServiceClient(this.pickConn())
}

View File

@@ -42,7 +42,7 @@ func (this *ProvincesAction) RunGet(params struct {
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
}
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{
RegionCountryId: int64(ChinaCountryId),
})
if err != nil {

View File

@@ -46,7 +46,7 @@ func (this *ProvincesAction) RunGet(params struct {
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
}
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{
RegionCountryId: int64(ChinaCountryId),
})
if err != nil {

View File

@@ -13,7 +13,7 @@ type ProvinceOptionsAction struct {
}
func (this *ProvinceOptionsAction) RunPost(params struct{}) {
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{RegionCountryId: ChinaCountryId})
if err != nil {
this.ErrorPage(err)
return

View File

@@ -24,7 +24,7 @@ func (this *SelectProvincesPopupAction) RunGet(params struct {
}) {
var selectedProvinceIds = utils.SplitNumbers(params.ProvinceIds)
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{RegionCountryId: ChinaCountryId})
if err != nil {
this.ErrorPage(err)
return

View File

@@ -1,12 +1,17 @@
Vue.component("values-box", {
props: ["values", "size", "maxlength", "name", "placeholder"],
props: ["values", "v-values", "size", "maxlength", "name", "placeholder"],
data: function () {
let values = this.values;
if (values == null) {
values = [];
}
if (this.vValues != null && typeof this.vValues == "object") {
values = this.vValues
}
return {
"vValues": values,
"realValues": values,
"isUpdating": false,
"isAdding": false,
"index": 0,
@@ -26,7 +31,7 @@ Vue.component("values-box", {
this.cancel()
this.isUpdating = true;
this.index = index;
this.value = this.vValues[index];
this.value = this.realValues[index];
var that = this;
setTimeout(function () {
that.$refs.value.focus();
@@ -38,16 +43,16 @@ Vue.component("values-box", {
}
if (this.isUpdating) {
Vue.set(this.vValues, this.index, this.value);
Vue.set(this.realValues, this.index, this.value);
} else {
this.vValues.push(this.value);
this.realValues.push(this.value);
}
this.cancel()
this.$emit("change", this.vValues)
this.$emit("change", this.realValues)
},
remove: function (index) {
this.vValues.$remove(index)
this.$emit("change", this.vValues)
this.realValues.$remove(index)
this.$emit("change", this.realValues)
},
cancel: function () {
this.isUpdating = false;
@@ -55,10 +60,10 @@ Vue.component("values-box", {
this.value = "";
},
updateAll: function (values) {
this.vValeus = values
this.realValues = values
},
addValue: function (v) {
this.vValues.push(v)
this.realValues.push(v)
},
startEditing: function () {
@@ -66,13 +71,13 @@ Vue.component("values-box", {
}
},
template: `<div>
<div v-show="!isEditing && vValues.length > 0">
<div class="ui label tiny basic" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}</div>
<div v-show="!isEditing && realValues.length > 0">
<div class="ui label tiny basic" v-for="(value, index) in realValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}</div>
<a href="" @click.prevent="startEditing" style="font-size: 0.8em; margin-left: 0.2em">[修改]</a>
</div>
<div v-show="isEditing || vValues.length == 0">
<div style="margin-bottom: 1em" v-if="vValues.length > 0">
<div class="ui label tiny basic" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}
<div v-show="isEditing || realValues.length == 0">
<div style="margin-bottom: 1em" v-if="realValues.length > 0">
<div class="ui label tiny basic" v-for="(value, index) in realValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}
<input type="hidden" :name="name" :value="value"/>
&nbsp; <a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a>
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>