|
@@ -3,7 +3,7 @@
|
|
|
<div class="container">
|
|
|
<!-- 搜索条件区 -->
|
|
|
<div class="search-section">
|
|
|
- <Search :SearchForm="trafficSearchFrom" @query="intData" @reset="reset" />
|
|
|
+ <Search :SearchForm="trafficSearchFrom" @query="initData" @reset="reset" />
|
|
|
</div>
|
|
|
<div class="audit-btn">
|
|
|
<a-button type="text" @click="dictShowModel(1, false)" v-if="role.getRole == 1">
|
|
@@ -13,14 +13,15 @@
|
|
|
<template #default>{{ $t('form.Add') }}</template>
|
|
|
</a-button>
|
|
|
</div>
|
|
|
- <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
|
|
|
+ <a-table row-key="id" :data="tableData" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
|
|
|
@page-change="evChangePage">
|
|
|
<template #id="{ record }">
|
|
|
<!-- 修改 -->
|
|
|
<a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
|
|
|
v-if="role.getRole == 1">编辑</a>
|
|
|
- <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="meal(record)" v-if="role.getRole == 1">{{
|
|
|
- $t('tariffManagement.SetMeal') }}</a>
|
|
|
+ <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="meal(record)"
|
|
|
+ v-if="role.getRole == 1">{{
|
|
|
+ $t('tariffManagement.SetMeal') }}</a>
|
|
|
<!-- 删除 -->
|
|
|
<a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')" :cancel-text="$t('form.Cancel')"
|
|
|
@ok="handleDel(record.id)">
|
|
@@ -56,8 +57,8 @@
|
|
|
</a-modal>
|
|
|
|
|
|
|
|
|
- <Meal v-model:model-value="modealShow" :traffIds="ids" @submit="intData()" />
|
|
|
- <Add v-model:model-value="visible" :type-index="typeCurrent" ref="addDetaile" @submit="intData()"></Add>
|
|
|
+ <Meal v-model:model-value="modealShow" :traffIds="ids" @submit="initData()" />
|
|
|
+ <Add v-model:model-value="visible" :type-index="typeCurrent" ref="addDetaile" @submit="initData()"></Add>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -65,8 +66,8 @@
|
|
|
import { onMounted, ref, toRefs, getCurrentInstance } from "vue";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import { columns, planColumns, trafficSearchFrom } from "./config";
|
|
|
-import { deleteTariff, tariffList ,UpdateTariffName} from "@/api/path/tariffManagement.api"
|
|
|
-import { Getdictionary } from '@/mixins/index.js'
|
|
|
+import { deleteTariff, tariffList, UpdateTariffName } from "@/api/path/tariffManagement.api"
|
|
|
+import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
|
|
|
import { useSystemStore } from '@/store/modules/systemStore'
|
|
|
import Meal from './Management/meal.vue'
|
|
|
import Add from './Management/add.vue'
|
|
@@ -78,9 +79,7 @@ const role = useSystemStore()
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
const route = useRoute();
|
|
|
const state = ref({
|
|
|
- searchForm: {},
|
|
|
currency: [],
|
|
|
- dataSource: [],
|
|
|
pagination: {
|
|
|
total: 0,
|
|
|
pageSize: 10,
|
|
@@ -108,9 +107,7 @@ const state = ref({
|
|
|
}
|
|
|
})
|
|
|
const {
|
|
|
- searchForm,
|
|
|
currency,
|
|
|
- dataSource,
|
|
|
pagination,
|
|
|
planList,
|
|
|
visible,
|
|
@@ -129,54 +126,29 @@ const {
|
|
|
|
|
|
const addDetaile = ref(null)
|
|
|
|
|
|
-
|
|
|
-const intData = async (item) => {
|
|
|
- if (item) {
|
|
|
- searchForm.value = item
|
|
|
- }
|
|
|
- const param = {
|
|
|
- current: pagination.value.current,
|
|
|
- size: pagination.value.pageSize,
|
|
|
- ...searchForm.value,
|
|
|
- }
|
|
|
- const { data } = await tariffList(param)
|
|
|
-
|
|
|
- dataSource.value = (data.records || []).map((item, index) => {
|
|
|
- const sourceName = sourceList.value.find(val => val.value == item.source)?.label
|
|
|
- const billingCycleName = cycleist.value.find(val => val.value == item.billingCycle)?.label
|
|
|
- const Activated = item.trafficBilling + item.trafficBillingType
|
|
|
- const bagSize = item.pricing + '/' + item.mrcAmount + '/' + item.networkAccessFee
|
|
|
- const billingMethodName = methodList.value.find(val => val.value == item.billingMethod)?.label
|
|
|
+const processData = (data) => {
|
|
|
+ return (data.records || []).map((item, index) => {
|
|
|
+ const sourceName = filterDict(sourceList.value, item.source)
|
|
|
+ const billingCycleName = filterDict(cycleist.value, item.billingCycle)
|
|
|
+ const billingMethodName = filterDict(methodList.value, item.billingMethod)
|
|
|
delete item.children
|
|
|
- let pricingName;
|
|
|
-
|
|
|
- if (item.billingMethod == 1) {
|
|
|
- pricingName = item.trafficBillingAmount + '/' + item.currency
|
|
|
- } else if (item.billingMethod == 2) {
|
|
|
- pricingName = item.pricing + '/' + item.currency
|
|
|
- }
|
|
|
return {
|
|
|
...item,
|
|
|
sourceName,
|
|
|
- pricingName,
|
|
|
+ pricingName: item.billingMethod == 1 ? item.trafficBillingAmount + '/' + item.currency : item.pricing + '/' + item.currency,
|
|
|
billingCycleName,
|
|
|
- Activated: Activated,
|
|
|
+ Activated: item.trafficBilling + item.trafficBillingType,
|
|
|
status: "正常",
|
|
|
- bagSize,
|
|
|
+ bagSize: item.pricing + '/' + item.mrcAmount + '/' + item.networkAccessFee,
|
|
|
billingMethodName,
|
|
|
Number: index + 1
|
|
|
}
|
|
|
})
|
|
|
- pagination.value.total = data.total
|
|
|
}
|
|
|
|
|
|
-const reset = (item) => {
|
|
|
- searchForm.value = item
|
|
|
- pagination.value.current = 1
|
|
|
- intData()
|
|
|
-}
|
|
|
+const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, tariffList, processData)
|
|
|
|
|
|
-const handleCancelTarriName = ()=>{
|
|
|
+const handleCancelTarriName = () => {
|
|
|
putLabel.value = false
|
|
|
Form.value.id = ''
|
|
|
Form.value.name = ''
|
|
@@ -190,15 +162,10 @@ const handleDel = async (id) => {
|
|
|
content: t('setting.deleteSuccess'),
|
|
|
duration: 2000,
|
|
|
})
|
|
|
- intData()
|
|
|
+ initData()
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const evChangePage = (page) => {
|
|
|
- pagination.value.current = page
|
|
|
- intData()
|
|
|
-}
|
|
|
-
|
|
|
// 弹框
|
|
|
const dictShowModel = (type, data) => {
|
|
|
addDetaile.value.detaile(data)
|
|
@@ -223,10 +190,11 @@ const handleSubmitPlan = () => {
|
|
|
|
|
|
|
|
|
const handleDictValue = async () => {
|
|
|
- sourceList.value = await Getdictionary('source')
|
|
|
- cycleist.value = await Getdictionary('Billingcycle')
|
|
|
- currency.value = await Getdictionary('currencyType')
|
|
|
- methodList.value = await Getdictionary('billingMethod')
|
|
|
+ let dict = await Getdictionary(['source', 'Billingcycle', 'currencyType', 'billingMethod'])
|
|
|
+ sourceList.value = dict[0]
|
|
|
+ cycleist.value = dict[1]
|
|
|
+ currency.value = dict[2]
|
|
|
+ methodList.value = dict[3]
|
|
|
}
|
|
|
|
|
|
const meal = (data) => {
|
|
@@ -237,7 +205,7 @@ const meal = (data) => {
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await handleDictValue()
|
|
|
- await intData()
|
|
|
+ await initData()
|
|
|
})
|
|
|
|
|
|
|