فهرست منبع

资费管理选择流量id

wanghairong 5 ماه پیش
والد
کامیت
efddce0995
2فایلهای تغییر یافته به همراه93 افزوده شده و 5 حذف شده
  1. 7 0
      src/views/tariffManagement/config.js
  2. 86 5
      src/views/tariffManagement/index.vue

+ 7 - 0
src/views/tariffManagement/config.js

@@ -21,6 +21,13 @@ export const columns = [
     }
 ]
 
+export const planColumns = [
+    { title: window.$t('tariffManagement.feeCode'), dataIndex: 'feeCode', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.label'), dataIndex: 'label', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.source'), dataIndex: 'sourceName', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.bagSize'), dataIndex: 'bag_size', align: 'center', width: 200 },
+]
+
 
 
 

+ 86 - 5
src/views/tariffManagement/index.vue

@@ -49,13 +49,17 @@
         </a-table>
 
 
-        <!-- 弹框 -->
+        <!--资费 弹框 -->
         <a-modal :title="typeCurrent == 1 ? $t('form.Add') : $t('form.Edit')" v-model:visible="visible"
             @onCancel="resetForm" centered :maskClosable="false" :footer="null">
             <a-form ref="formRef" :rules="rules" :model="formState" @submit="handleSubmit">
                 <div class="formTitle">基本信息</div>
                 <a-form-item :label="$t('tariffManagement.simDataPlanId')" field="sim_data_plan_id">
-                    <a-input v-model="formState.sim_data_plan_id" />
+                    <a-input v-model="formState.sim_data_plan_id">
+                        <template #append>
+                            <a-button class="m-r-10" @click="handlePlan()">选择流量包</a-button>
+                        </template>
+                    </a-input>
                 </a-form-item>
                 <a-form-item :label="$t('tariffManagement.feeCode')" field="feeCode" required="">
                     <a-input v-model="formState.feeCode" />
@@ -179,15 +183,41 @@
                 </a-form-item>
             </a-form>
         </a-modal>
+
+
+
+        <a-modal width="70%" :visible="planVisible" title="选择流量包" @ok="handleSubmitPlan" @cancel="handleCancel">
+            <!-- 搜索条件区 -->
+            <div class="search-section">
+                <a-form :model="formData" layout="inline">
+                    <a-form-item field="label" :label="$t('tariffManagement.label')">
+                        <a-input v-model="formData.label"
+                            :placeholder="$t('lotCard.please') + $t('tariffManagement.label')" allow-clear />
+                    </a-form-item>
+                    <a-form-item>
+                        <a-space>
+                            <a-button type="primary" @click="handleSearchPlan">{{ $t('form.Search') }}</a-button>
+                            <a-button @click="resetSearchPlan">{{ $t('form.Reset') }}</a-button>
+                        </a-space>
+                    </a-form-item>
+                </a-form>
+            </div>
+            <a-table row-key="id" :data="planList" :columns="planColumns" :scroll="{ x: 'auto' }"
+                :row-selection="rowSelectionPlan" v-model:selectedKeys="selectedKeysPlan">
+
+            </a-table>
+
+        </a-modal>
     </div>
 </template>
 
 <script setup>
 import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
 import { useRoute } from "vue-router";
-import { columns } from "./config";
+import { columns, planColumns } from "./config";
 import { Message, Notification } from '@arco-design/web-vue'
 import { deleteTariff, updateTariff, addTariff, tariffList } from "@/api/path/tariffManagement.api"
+import { dataPlanList } from "@/api/path/lotCard.api"
 import { enum_dict } from "@/hooks/enum";
 import { useSystemStore } from '@/store/modules/systemStore'
 
@@ -289,9 +319,9 @@ const formState = ref({
     // 资费名称(必填)
     "label": "",
     // 流量包ID(必填)
-    "sim_data_plan_id": "",
+    "sim_data_plan_id": null,
     // 用户ID(必填)
-    "user_id": 0,
+    "user_id": null,
     // 来源(必填)
     "source": "",
     // 流量类型(必填)
@@ -344,6 +374,7 @@ const handleSubmit = ({ values, errors }) => {
     formRef.value.validate(async (errors) => {
         if (!errors) {
             values.user_id = Number(values.user_id)
+            values.currency = '1'
             if (values.settlementCycleMap.starTime && values.settlementCycleMap.starTime) {
                 values.settlement_cycle = values.settlementCycleMap.starTime + '~' + values.settlementCycleMap.endTime
             } else {
@@ -416,6 +447,56 @@ const resetForm = () => {
 }
 
 // --------------------------------------------------------
+
+// 资费弹窗------------------------------------------------
+const planVisible = ref(false)
+const formData = ref({})
+const planList = ref([])
+const selectedKeysPlan = ref([])
+const rowSelectionPlan = reactive({
+    type: 'radio',
+    showCheckedAll: true,
+    onlyCurrent: false,
+});
+
+const handlePlan = async () => {
+    planVisible.value = true
+    const param = {
+        current: pagination.value.current,
+        size: pagination.value.pageSize,
+        ...formData.value,
+    }
+    const { data } = await dataPlanList(param)
+    planList.value = (data.records || []).map((item, index) => {
+        const sourceName = sourceList.value.find(val => val.value == item.source)?.label
+        return {
+            ...item,
+            sourceName,
+            label: "资费" + (index + 1),
+            feeCode: "NR0" + (index + 1),
+            bag_size: "2.0MB"
+        }
+    })
+    pagination.value.total = data.total
+
+}
+const resetSearchPlan = () => {
+
+}
+const handleSearchPlan = () => {
+
+}
+const handleCancel = () => {
+    planVisible.value = false
+}
+const handleSubmitPlan = () => {
+    if (selectedKeysPlan.value.length > 0) {
+        formState.value.sim_data_plan_id = String(selectedKeysPlan.value[0])
+        planVisible.value = false
+    }
+
+}
+// -------------------------------------------------------
 // 获取字典
 const handleDictValue = () => {
     const dictList = JSON.parse(window.localStorage.getItem('dictList')) ?? []