|
@@ -53,7 +53,7 @@
|
|
|
|
|
|
<el-table-column label="公司名称" align="center" prop="companyName" :show-overflow-tooltip="true" />
|
|
|
|
|
|
- <el-table-column label="流量余额(KB)" align="center" prop="balance" />
|
|
|
+ <el-table-column label="流量余额" align="center" prop="balance" :formatter="formatBalance"/>
|
|
|
|
|
|
<!-- <el-table-column label="操作人员" align="center" prop="createBy" />
|
|
|
|
|
@@ -68,7 +68,7 @@
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
- icon="el-icon-view"
|
|
|
+ icon="el-icon-money"
|
|
|
@click="handleRechargeCompany(scope.row)"
|
|
|
v-hasPermi="['company:traffic:charge']"
|
|
|
>充值</el-button>
|
|
@@ -89,7 +89,7 @@
|
|
|
<el-dialog :title="rechargeTitle" :visible.sync="rechargeOpen" width="500px" append-to-body :before-close="resetOption">
|
|
|
<el-form ref="rechargeForm" :model="rechargeForm" :rules="rechargeRules" label-width="100px">
|
|
|
|
|
|
- <el-form-item label="公司ID" prop="companyId">
|
|
|
+ <el-form-item label="公司ID" prop="companyId" v-show="!isCompanyRecharge">
|
|
|
<el-select
|
|
|
v-model="rechargeForm.companyId"
|
|
|
filterable
|
|
@@ -101,7 +101,6 @@
|
|
|
style="width: 220px"
|
|
|
clearable
|
|
|
size="small"
|
|
|
- :disabled="isCompanyRecharge"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in companyOptions"
|
|
@@ -124,7 +123,7 @@
|
|
|
v-model="rechargeForm.chargeAmount"
|
|
|
:min="1"
|
|
|
:max="999999999"
|
|
|
- placeholder="请输入充值金额(KB)"
|
|
|
+ placeholder="请输入充值金额(元)"
|
|
|
controls-position="right"
|
|
|
style="width: 100%"
|
|
|
/>
|
|
@@ -218,8 +217,9 @@ export default {
|
|
|
methods: {
|
|
|
resetForm,
|
|
|
resetOption(){
|
|
|
- this.companyOptions = [];
|
|
|
this.rechargeOpen = false;
|
|
|
+ this.companyOptions = [];
|
|
|
+ this.rechargeForm = {};
|
|
|
},
|
|
|
/** 查询流量记录列表 */
|
|
|
getList() {
|
|
@@ -256,9 +256,29 @@ export default {
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm");
|
|
|
+ this.rechargeForm = {};
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
|
|
|
+ formatBalance(row){
|
|
|
+ //对流量值进行判断,换算成GB或TB
|
|
|
+ if(!row.balance){
|
|
|
+ return "0KB";
|
|
|
+ }
|
|
|
+ if(row.balance < 1024){
|
|
|
+ return row.balance + "KB";
|
|
|
+ }
|
|
|
+ else if(row.balance < 1024 * 1024){
|
|
|
+ return (row.balance / 1024).toFixed(2) + "MB";
|
|
|
+ }
|
|
|
+ else if(row.balance < 1024 * 1024 * 1024){
|
|
|
+ return (row.balance / (1024 * 1024)).toFixed(2) + "GB";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return (row.balance / (1024 * 1024 * 1024)).toFixed(2) + "TB";
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/** 多选框选中数据 */
|
|
|
handleSelectionChange(selection) {
|
|
|
this.ids = selection.map(item => item.id)
|
|
@@ -270,6 +290,7 @@ export default {
|
|
|
handleRecharge() {
|
|
|
this.rechargeTitle = "流量充值";
|
|
|
this.resetForm("rechargeForm");
|
|
|
+ this.rechargeForm = {};
|
|
|
this.companyOptions = [];
|
|
|
this.isCompanyRecharge = false;
|
|
|
this.rechargeForm.operationType = 1; // 默认充值
|
|
@@ -278,6 +299,7 @@ export default {
|
|
|
handleRechargeCompany(row) {
|
|
|
this.rechargeTitle = "流量充值";
|
|
|
this.resetForm("rechargeForm");
|
|
|
+ this.rechargeForm = {};
|
|
|
this.companyOptions = [];
|
|
|
this.isCompanyRecharge = true;
|
|
|
this.rechargeForm.companyId = row.companyId;
|
|
@@ -314,6 +336,7 @@ export default {
|
|
|
cancelRecharge() {
|
|
|
this.rechargeOpen = false;
|
|
|
this.resetForm("rechargeForm");
|
|
|
+ this.rechargeForm = {};
|
|
|
}
|
|
|
}
|
|
|
};
|