This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
.steps .step.active {
font-weight: bold;
}
/*# sourceMappingURL=create.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["create.less"],"names":[],"mappings":"AAAA,MACC,MAAK;EACJ,iBAAA","file":"create.css"}

View File

@@ -0,0 +1,300 @@
{$layout}
{$template "../menu"}
<div class="ui steps small fluid">
<div class="ui step" :class="{active: step == STEP_TEMPLATE}">
<div class="content">设置数据格式</div>
</div>
<div class="ui step" :class="{active: step == STEP_UPLOAD}">
<div class="content">上传文件</div>
</div>
<div class="ui step" :class="{active: step == STEP_COUNTRY}">
<div class="content">处理国家/地区</div>
</div>
<div class="ui step" :class="{active: step == STEP_PROVINCE}">
<div class="content">处理省份/州</div>
</div>
<div class="ui step" :class="{active: step == STEP_CITY}">
<div class="content">处理城市/市</div>
</div>
<div class="ui step" :class="{active: step == STEP_TOWN}">
<div class="content">处理县/区</div>
</div>
<div class="ui step" :class="{active: step == STEP_PROVIDER}">
<div class="content">处理ISP运营商</div>
</div>
<div class="ui step" :class="{active: step == STEP_FINISH}">
<div class="content">完成</div>
</div>
</div>
<!-- 设置件格式 -->
<div v-show="step == STEP_TEMPLATE">
<form class="ui form">
<table class="ui table selectable definition">
<tr>
<td>IP库名称 *</td>
<td>
<input type="text" name="" v-model="libraryName" ref="libraryName" maxlength="50" v-show="libraryFileId == 0"/>
<span v-if="libraryFileId > 0">{{libraryName}}</span>
<p class="comment">给当前IP库起一个容易识别的名称。</p>
</td>
</tr>
<tr>
<td class="title">数据格式模板 *</td>
<td>
<input type="text" name="" v-model="rowTemplate" ref="rowTemplate" v-show="libraryFileId == 0"/>
<span v-if="libraryFileId > 0">{{rowTemplate}}</span>
<p class="comment">只支持纯文本(比如.txt的数据内容每行数据的格式其中<code-label>${ipFrom}</code-label>表示开始IPIPv4和IPv6均支持<code-label>${ipTo}</code-label>表示结束IP<code-label>${country}</code-label>表示国家/地区,<code-label>${province}</code-label>表示省份/州,<code-label>${city}</code-label>表示城市/市级单位,<code-label>${town}</code-label>表示区县(暂时不处理),<code-label>${provider}</code-label>表示ISP运营商<code-label>${any}</code-label>表示不需要识别的内容。<a href="" @click.prevent="formatIP2Region()">[IP2Region示例]</a> &nbsp;<a href="" @click.prevent="formatIP138()">[IP138示例]</a> </p>
</td>
</tr>
<tr v-show="rowTemplate.length > 0 && libraryFileId == 0">
<td>数据格式分析测试</td>
<td>
<input type="text" name="" v-model="formatTestText" placeholder="单行测试数据" @input="changeFormatTestText" @keyup.enter="testFormat()" @keypress.enter.prevent="1"/>
<p class="comment"><a href="" @click.prevent="testFormat">[执行测试]</a>
<span v-if="formatTestResult.length > 0" class="green">&nbsp; &nbsp; 测试成功:{{formatTestResult}}</span>
</p>
</td>
</tr>
<tr>
<td>空值列表</td>
<td>
<values-box ref="emptyValues" :v-values="emptyValues" v-show="libraryFileId == 0"></values-box>
<span v-for="emptyValue in emptyValues" class="ui label basic small" v-show="libraryFileId > 0">{{emptyValue}}</span>
<p class="comment">内容中如果有这些值,表示没有填写;比如如果空值是<code-label>0</code-label>,那么<code-label>字段1|0|字段2|0</code-label>中只有<code-label>字段1</code-label><code-label>字段2</code-label>两个信息是有效的。</p>
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input type="password" maxlength="32" name="password" v-model="password"/>
</td>
</tr>
</table>
<button class="ui button primary" type="button" @click.prevent="templateGoNext">下一步</button>
</form>
</div>
<!-- 上传文件 -->
<div v-show="step == STEP_UPLOAD">
<form class="ui form">
<table class="ui table definition selectable">
<tr>
<td class="title">选择数据文件 *</td>
<td>
<input type="file" accept="text/plain, .txt" ref="dataFile"/>
<p class="comment">只支持纯文本(比如.txt的数据内容每行数据的格式需要和上一步设置的数据格式模板一致。</p>
</td>
</tr>
</table>
<button class="ui button primary" type="button" @click.prevent="upload" v-if="!isUploading">开始分析</button>
<button class="ui button disabled" type="button" v-if="isUploading">正在上传并分析中...</button>
&nbsp; &nbsp;
<a href="" @click.prevent="goStep(STEP_TEMPLATE)" v-if="!isUploading">上一步</a>
</form>
</div>
<!-- 处理国家/地区 -->
<div v-show="step == STEP_COUNTRY">
<div v-if="missingCountries.length == 0 && missingCountriesLoaded">
<div class="margin"></div>
暂时没有需要处理的国家/地区。
<div class="margin"></div>
</div>
<div v-if="missingCountries.length > 0 && missingCountriesLoaded">
<p class="comment">以下如无任何可以进行的操作,请直接进入下一步。</p>
<table class="ui table selectable celled">
<thead>
<tr>
<th class="three wide">国家/地区</th>
<th>问题</th>
</tr>
</thead>
<tr v-for="missingCountry in missingCountries">
<td>{{missingCountry.countryName}}</td>
<td><strong>"{{missingCountry.countryName}}"</strong>没有录入数据库
<div v-if="missingCountry.similarCountries.length > 0">
<div class="ui divider"></div>
我们发现了以下类似国家/地区,如果有相同的国家/地区,请选择:
<div style="margin-top: 0.5em">
<a href="" v-for="country in missingCountry.similarCountries" class="ui label basic small" @click.prevent="addCountryCustomCode(country, missingCountry.countryName)">{{country.displayName}}</a>
</div>
</div>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<button class="ui button primary" type="button" @click.prevent="goStep(STEP_PROVINCE)">下一步</button>
&nbsp; &nbsp; <a href="" @click.prevent="reloadCountries">刷新</a>
</div>
<!-- 处理省份/州 -->
<div v-show="step == STEP_PROVINCE">
<div v-if="missingProvinces.length == 0 && missingProvincesLoaded">
<div class="margin"></div>
暂时没有需要处理的省份/州。
<div class="margin"></div>
</div>
<div v-if="missingProvinces.length > 0 && missingProvincesLoaded">
<p class="comment">以下如无任何可以进行的操作,请直接进入下一步。</p>
<table class="ui table selectable celled">
<thead>
<tr>
<th class="three wide">国家/地区</th>
<th class="three wide">省份/州</th>
<th>问题</th>
</tr>
</thead>
<tr v-for="missingProvince in missingProvinces">
<td>{{missingProvince.countryName}}</td>
<td>{{missingProvince.provinceName}}</td>
<td><strong>"{{missingProvince.countryName}} - {{missingProvince.provinceName}}"</strong>没有录入数据库
<div v-if="missingProvince.similarProvinces.length > 0">
<div class="ui divider"></div>
我们发现了以下类似省份/州,如果有相同的省份/州,请选择:
<div style="margin-top: 0.5em">
<a href="" v-for="province in missingProvince.similarProvinces" class="ui label basic small" @click.prevent="addProvinceCustomCode(province, missingProvince.provinceName)">{{province.displayName}}</a>
</div>
</div>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<button class="ui button primary" type="button" @click.prevent="goStep(STEP_CITY)">下一步</button>
&nbsp; &nbsp; <a href="" @click.prevent="reloadProvinces">刷新</a> &nbsp; <span class="disabled">|</span> &nbsp; <a href="" @click.prevent="goStep(STEP_COUNTRY)">上一步</a>
</div>
<!-- 处理城市/市 -->
<div v-show="step == STEP_CITY">
<div v-if="missingCities.length == 0 && missingCitiesLoaded">
<div class="margin"></div>
暂时没有需要处理的城市/市。
<div class="margin"></div>
</div>
<div v-if="missingCities.length > 0 && missingCitiesLoaded">
<p class="comment">以下如无任何可以进行的操作,请直接进入下一步。每次最多显示{{sizePerPage}}条。</p>
<table class="ui table selectable celled">
<thead>
<tr>
<th class="three wide">国家/地区</th>
<th class="three wide">省份/州</th>
<th class="three wide">城市/市</th>
<th>问题</th>
</tr>
</thead>
<tr v-for="missingCity in missingCities">
<td>{{missingCity.countryName}}</td>
<td>{{missingCity.provinceName}}</td>
<td>{{missingCity.cityName}}</td>
<td><strong>"{{missingCity.countryName}} - {{missingCity.provinceName}} - {{missingCity.cityName}}"</strong>没有录入数据库
<div v-if="missingCity.similarCities.length > 0">
<div class="ui divider"></div>
我们发现了以下类似城市/市,如果有相同的城市/市,请选择:
<div style="margin-top: 0.5em">
<a href="" v-for="city in missingCity.similarCities" class="ui label basic small" @click.prevent="addCityCustomCode(city, missingCity.cityName)">{{city.displayName}}</a>
</div>
</div>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<button class="ui button primary" type="button" @click.prevent="goStep(STEP_TOWN)">下一步</button>
&nbsp; &nbsp; <a href="" @click.prevent="reloadCities">刷新</a> &nbsp; <span class="disabled">|</span> &nbsp; <a href="" @click.prevent="goStep(STEP_PROVINCE)">上一步</a>
</div>
<!-- 处理城市/市 -->
<div v-show="step == STEP_TOWN">
<div v-if="missingTowns.length == 0 && missingTownsLoaded">
<div class="margin"></div>
暂时没有需要处理的区/县。
<div class="margin"></div>
</div>
<div v-if="missingTowns.length > 0 && missingTownsLoaded">
<p class="comment">以下如无任何可以进行的操作,请直接进入下一步。每次最多显示{{sizePerPage}}条。</p>
<table class="ui table selectable celled">
<thead>
<tr>
<th class="three wide">国家/地区</th>
<th class="three wide">省份/州</th>
<th class="three wide">城市/市</th>
<th class="three wide">区/县</th>
<th>问题</th>
</tr>
</thead>
<tr v-for="missingTown in missingTowns">
<td>{{missingTown.countryName}}</td>
<td>{{missingTown.provinceName}}</td>
<td>{{missingTown.cityName}}</td>
<td>{{missingTown.townName}}</td>
<td><strong>"{{missingTown.countryName}} - {{missingTown.provinceName}} - {{missingTown.cityName}} - {{missingTown.townName}}"</strong>没有录入数据库
<div v-if="missingTown.similarTowns.length > 0">
<div class="ui divider"></div>
我们发现了以下类似区/县,如果有相同的区/县,请选择:
<div style="margin-top: 0.5em">
<a href="" v-for="town in missingTown.similarTowns" class="ui label basic small" @click.prevent="addTownCustomCode(town, missingTown.townName)">{{town.displayName}}</a>
</div>
</div>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<button class="ui button primary" type="button" @click.prevent="goStep(STEP_PROVIDER)">下一步</button>
&nbsp; &nbsp; <a href="" @click.prevent="reloadTowns">刷新</a> &nbsp; <span class="disabled">|</span> &nbsp; <a href="" @click.prevent="goStep(STEP_CITY)">上一步</a>
</div>
<!-- 处理ISP运营商 -->
<div v-show="step == STEP_PROVIDER">
<div v-if="missingProviders.length == 0 && missingProvidersLoaded">
<div class="margin"></div>
暂时没有需要处理的ISP运营商。
<div class="margin"></div>
</div>
<div v-if="missingProviders.length > 0 && missingProvidersLoaded">
<p class="comment">以下如无任何可以进行的操作,请直接进入下一步。</p>
<table class="ui table selectable celled">
<thead>
<tr>
<th class="three wide">ISP运营商</th>
<th>问题</th>
</tr>
</thead>
<tr v-for="missingProvider in missingProviders">
<td>{{missingProvider.providerName}}</td>
<td><strong>"{{missingProvider.providerName}}"</strong>没有录入数据库
<div v-if="missingProvider.similarProviders.length > 0">
<div class="ui divider"></div>
我们发现了以下类似ISP运营商如果有相同的ISP运营商请选择
<div style="margin-top: 0.5em">
<a href="" v-for="provider in missingProvider.similarProviders" class="ui label basic small" @click.prevent="addProviderCustomCode(provider, missingProvider.providerName)">{{provider.displayName}}</a>
</div>
</div>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<button class="ui button primary" type="button" @click.prevent="goStep(STEP_FINISH)">下一步</button>
&nbsp; &nbsp; <a href="" @click.prevent="reloadProviders">刷新</a> &nbsp; <span class="disabled">|</span> &nbsp; <a href="" @click.prevent="goStep(STEP_TOWN)">上一步</a>
</div>
<!-- 完成 -->
<div v-show="step == STEP_FINISH">
<p>现在可以确认完成当前IP库的上传了后期仍然可以修改国家/地区、省份/州、城市/市、区/县、ISP运营商等信息。</p>
<button class="ui button primary" type="button" @click.prevent="finish" v-if="!isFinishing">确认完成</button>
<button class="ui button disabled" type="button" v-if="isFinishing">正在完成最后操作...</button>
</div>

View File

@@ -0,0 +1,386 @@
Tea.context(function () {
this.STEP_TEMPLATE = "template"
this.STEP_UPLOAD = "upload"
this.STEP_COUNTRY = "country"
this.STEP_PROVINCE = "province"
this.STEP_CITY = "city"
this.STEP_TOWN = "town"
this.STEP_PROVIDER = "provider"
this.STEP_FINISH = "finish"
this.step = this.STEP_TEMPLATE
this.goStep = function (step) {
this.step = step
switch (step) {
case this.STEP_UPLOAD:
if (this.libraryFileId > 0) {
this.goStep(this.STEP_COUNTRY)
}
break
case this.STEP_COUNTRY:
this.reloadCountries()
break
case this.STEP_PROVINCE:
this.reloadProvinces()
break
case this.STEP_CITY:
this.reloadCities()
break
case this.STEP_TOWN:
this.reloadTowns()
break
case this.STEP_PROVIDER:
this.reloadProviders()
break
}
}
this.$delay(function () {
switch (this.step) {
case this.STEP_TEMPLATE:
this.$refs.libraryName.focus()
break
case this.STEP_COUNTRY:
this.reloadCountries()
break
case this.STEP_PROVINCE:
this.reloadProvinces()
break
case this.STEP_CITY:
this.reloadCities()
break
case this.STEP_TOWN:
this.reloadTowns()
break
case this.STEP_PROVIDER:
this.reloadProviders()
break
}
})
/**
* 数据格式
*/
this.rowTemplate = ""
this.formatTestText = ""
this.formatTestResult = ""
this.password = ""
this.libraryName = ""
this.emptyValues = []
this.libraryFileId = 0
if (this.updatingLibraryFile != null) {
this.libraryFileId = this.updatingLibraryFile.id
this.rowTemplate = this.updatingLibraryFile.template
this.libraryName = this.updatingLibraryFile.name
if (this.updatingLibraryFile.emptyValues != null) {
this.emptyValues = this.updatingLibraryFile.emptyValues
}
}
this.formatIP2Region = function () {
this.rowTemplate = "${ipFrom}|${ipTo}|${country}|${any}|${province}|${city}|${provider}"
}
this.formatIP138 = function () {
this.rowTemplate = "${any},${any},${ipFrom},${ipTo},${country},${province},${city},${town},${provider},${any},${any},${any}"
}
this.testFormat = function () {
this.$post("/settings/ip-library/creating/testFormat")
.params({
template: this.rowTemplate,
text: this.formatTestText
})
.success(function (resp) {
let values = resp.data.values
let pieces = []
if (values["country"] != null && values["country"].length > 0) {
pieces.push("国家/地区:" + values["country"])
}
if (values["province"] != null && values["province"].length > 0) {
pieces.push("省份/州:" + values["province"])
}
if (values["city"] != null && values["city"].length > 0) {
pieces.push("城市/市:" + values["city"])
}
if (values["town"] != null && values["town"].length > 0) {
pieces.push("区县:" + values["town"])
}
if (values["provider"] != null && values["provider"].length > 0) {
pieces.push("ISP运营商" + values["provider"])
}
this.formatTestResult = pieces.join("")
})
}
this.changeFormatTestText = function () {
this.formatTestResult = ""
}
this.templateGoNext = function () {
if (this.libraryName.length == 0) {
let that = this
teaweb.warn("请输入IP库名字", function () {
that.$refs.libraryName.focus()
})
return
}
if (this.rowTemplate.length == 0) {
let that = this
teaweb.warn("请先输入数据格式模板", function () {
that.$refs.rowTemplate.focus()
})
return
}
this.goStep(this.STEP_UPLOAD)
}
/**
* 上传
*/
this.isUploading = false
this.upload = function () {
let dataFile = this.$refs.dataFile
if (dataFile.files.length == 0) {
teaweb.warn("请先上传文件")
return
}
this.isUploading = true
let emptyValues = this.$refs.emptyValues.allValues()
this.$post("/settings/ip-library/creating/upload")
.timeout(300)
.params({
name: this.libraryName,
template: this.rowTemplate,
file: dataFile.files[0],
emptyValues: emptyValues,
password: this.password
})
.success(function (resp) {
this.libraryFileId = resp.data.libraryFileId
let that = this
teaweb.success("上传成功", function () {
that.step = that.STEP_COUNTRY
that.reloadCountries()
})
})
.error(function () {
teaweb.warn("操作超时,可能是网络太慢")
})
.done(function () {
this.isUploading = false
})
}
/**
* 国家
*/
this.missingCountries = []
this.missingCountriesLoaded = false
this.reloadCountries = function () {
this.missingCountriesLoaded = false
this.$post("/settings/ip-library/creating/countries")
.params({
"libraryFileId": this.libraryFileId
})
.success(function (resp) {
this.missingCountries = resp.data.missingCountries
})
.done(function () {
this.missingCountriesLoaded = true
})
}
this.addCountryCustomCode = function (country, code) {
let that = this
teaweb.confirm("html:确定要将 \"<strong>" + teaweb.encodeHTML(code) + "</strong>\" 加入到 \"<strong>" + teaweb.encodeHTML(country.displayName) + "</strong>\" 别名中吗?<br/>请再三确认无误后,才进行确定操作!", function () {
that.$post("/settings/ip-library/creating/addCountryCustomCode")
.params({
countryId: country.id,
code: code
})
.success(function () {
teaweb.success("操作成功", function () {
that.reloadCountries()
})
})
})
}
/**
* 省
*/
this.missingProvinces = []
this.missingProvincesLoaded = false
this.reloadProvinces = function () {
this.missingProvincesLoaded = false
this.$post("/settings/ip-library/creating/provinces")
.params({
"libraryFileId": this.libraryFileId
})
.success(function (resp) {
this.missingProvinces = resp.data.missingProvinces
})
.done(function () {
this.missingProvincesLoaded = true
})
}
this.addProvinceCustomCode = function (province, code) {
let that = this
teaweb.confirm("html:确定要将 \"<strong>" + teaweb.encodeHTML(code) + "</strong>\" 加入到 \"<strong>" + teaweb.encodeHTML(province.displayName) + "</strong>\" 别名中吗?<br/>请再三确认无误后,才进行确定操作!", function () {
that.$post("/settings/ip-library/creating/addProvinceCustomCode")
.params({
provinceId: province.id,
code: code
})
.success(function () {
teaweb.success("操作成功", function () {
that.reloadProvinces()
})
})
})
}
/**
* 市
*/
this.missingCities = []
this.missingCitiesLoaded = false
this.sizePerPage = 100
this.reloadCities = function () {
this.missingCitiesLoaded = false
this.$post("/settings/ip-library/creating/cities")
.params({
libraryFileId: this.libraryFileId,
size: this.sizePerPage
})
.success(function (resp) {
this.missingCities = resp.data.missingCities
})
.done(function () {
this.missingCitiesLoaded = true
})
}
this.addCityCustomCode = function (city, code) {
let that = this
teaweb.confirm("html:确定要将 \"<strong>" + teaweb.encodeHTML(code) + "</strong>\" 加入到 \"<strong>" + teaweb.encodeHTML(city.displayName) + "</strong>\" 别名中吗?<br/>请再三确认无误后,才进行确定操作!", function () {
that.$post("/settings/ip-library/creating/addCityCustomCode")
.params({
cityId: city.id,
code: code
})
.success(function () {
teaweb.success("操作成功", function () {
that.reloadCities()
})
})
})
}
/**
* 县
*/
this.missingTowns = []
this.missingTownsLoaded = false
this.reloadTowns = function () {
this.missingTownsLoaded = false
this.$post("/settings/ip-library/creating/towns")
.params({
"libraryFileId": this.libraryFileId
})
.success(function (resp) {
this.missingTowns = resp.data.missingTowns
})
.done(function () {
this.missingTownsLoaded = true
})
}
this.addTownCustomCode = function (town, code) {
let that = this
teaweb.confirm("html:确定要将 \"<strong>" + teaweb.encodeHTML(code) + "</strong>\" 加入到 \"<strong>" + teaweb.encodeHTML(town.displayName) + "</strong>\" 别名中吗?<br/>请再三确认无误后,才进行确定操作!", function () {
that.$post("/settings/ip-library/creating/addTownCustomCode")
.params({
townId: town.id,
code: code
})
.success(function () {
teaweb.success("操作成功", function () {
that.reloadTowns()
})
})
})
}
/**
* ISP
*/
this.missingProviders = []
this.missingProvidersLoaded = false
this.reloadProviders = function () {
this.missingProvidersLoaded = false
this.$post("/settings/ip-library/creating/providers")
.params({
"libraryFileId": this.libraryFileId
})
.success(function (resp) {
this.missingProviders = resp.data.missingProviders
})
.done(function () {
this.missingProvidersLoaded = true
})
}
this.addProviderCustomCode = function (provider, code) {
let that = this
teaweb.confirm("html:确定要将 \"<strong>" + teaweb.encodeHTML(code) + "</strong>\" 加入到 \"<strong>" + teaweb.encodeHTML(provider.displayName) + "</strong>\" 别名中吗?<br/>请再三确认无误后,才进行确定操作!", function () {
that.$post("/settings/ip-library/creating/addProviderCustomCode")
.params({
providerId: provider.id,
code: code
})
.success(function () {
teaweb.success("操作成功", function () {
that.reloadProviders()
})
})
})
}
/**
* 完成
*/
this.isFinishing = false
this.finish = function () {
let that = this
teaweb.confirm("html:确定标记当前IP库已完成<br/>后期仍然可以修改国家/地区、省份/州、城市/市、区/县、ISP运营商等信息。", function () {
that.isFinishing = true
that.$post("/settings/ip-library/creating/finish")
.params({
libraryFileId: this.libraryFileId
})
.timeout(300)
.success(function () {
teaweb.success("保存成功", function () {
window.location = "/settings/ip-library"
})
})
.done(function () {
that.isFinishing = false
})
})
}
})

View File

@@ -0,0 +1,5 @@
.steps {
.step.active {
font-weight: bold;
}
}

View File

@@ -0,0 +1,32 @@
{$layout}
{$template "../menu"}
<not-found-box v-if="libraries.length == 0">暂时还没有已完成的IP库。</not-found-box>
<p class="ui message blue" v-if="isGenerating">正在生成IP库文件请耐心等待...</p>
<table class="ui table selectable celled" v-if="libraries.length > 0">
<thead>
<tr>
<th class="three wide">IP库名称</th>
<th>库文件生成时间</th>
<th style="width: 13em">操作</th>
</tr>
</thead>
<tr v-for="library in libraries">
<td>{{library.name}}</td>
<td>
<span v-if="library.generatedFileId > 0">{{library.generatedTime}}
&nbsp; <a :href="'/settings/ip-library/library/download?libraryFileId=' + library.id" title="下载"><i class="icon download small"></i></a>
</span>
<span v-else class="disabled">尚未生成</span>
</td>
<td>
<a href="" @click.prevent="generateLibrary(library.id)" :class="{disabled: isGenerating}">重新生成</a> &nbsp;
<span class="disabled">|</span> &nbsp;
<a :href="'/settings/ip-library/libraries/create?libraryFileId=' + library.id" :class="{disabled: isGenerating}">修改</a> &nbsp;
<span class="disabled">|</span> &nbsp;
<a href="" @click.prevent="deleteLibrary(library.id)" :class="{disabled: isGenerating}">删除</a>
</td>
</tr>
</table>

View File

@@ -0,0 +1,34 @@
Tea.context(function () {
this.isGenerating = false
this.generateLibrary = function (libraryFileId) {
let that = this
teaweb.confirm("确定要重新生成库文件吗?", function () {
that.isGenerating = true
that.$post("/settings/ip-library/creating/generate")
.params({
libraryFileId: libraryFileId
})
.timeout(300)
.success(function () {
teaweb.successRefresh("生成成功")
})
.done(function () {
that.isGenerating = false
})
})
}
this.deleteLibrary = function (libraryFileId) {
let that = this
teaweb.confirm("html:确定要删除此库文件吗?", function () {
that.$post("/settings/ip-library/delete")
.params({
libraryFileId: libraryFileId
})
.success(function () {
teaweb.successRefresh("删除成功")
})
})
}
})