wanghairong 5 місяців тому
батько
коміт
4582765443
2 змінених файлів з 63 додано та 40 видалено
  1. 17 1
      src/views/tariffManagement/config.js
  2. 46 39
      src/views/tariffManagement/index.vue

+ 17 - 1
src/views/tariffManagement/config.js

@@ -1,4 +1,4 @@
-export const columns = [
+export let columns = [
     { title: window.$t('tariffManagement.id'), dataIndex: 'id', align: 'center', width: 200 },
     { title: window.$t('tariffManagement.feeCode'), dataIndex: 'feeCode', align: 'center', width: 200 },
     { title: window.$t('tariffManagement.label'), dataIndex: 'label', align: 'center', width: 200 },
@@ -21,6 +21,22 @@ export const columns = [
     }
 ]
 
+export const columnsCustomer = [
+    { title: window.$t('tariffManagement.id'), dataIndex: 'id', align: 'center', width: 200 },
+    { 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.trafficType'), dataIndex: 'trafficTypeName', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.billingType'), dataIndex: 'billingTypeName', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.billingCycle'), dataIndex: 'billingCycleName', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.bagSize'), dataIndex: 'bag_size', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.pricing'), dataIndex: 'pricing', align: 'center', width: 200 },
+    // { title: window.$t('tariffManagement.billingMethod'), dataIndex: 'billing_method', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.settlementCycleLabel'), dataIndex: 'settlement_cycle', align: 'center', width: 200 },
+    { title: window.$t('tariffManagement.feeStatus'), dataIndex: 'status', align: 'center', width: 200 },
+]
+
+
 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 },

+ 46 - 39
src/views/tariffManagement/index.vue

@@ -24,7 +24,7 @@
         </div>
 
         <div class="audit-btn">
-            <a-button type="text" @click="dictShowModel(1, null)">
+            <a-button type="text" @click="dictShowModel(1, null)" v-if="role.getRole == 1">
                 <template #icon>
                     <icon-plus-circle />
                 </template>
@@ -32,8 +32,8 @@
             </a-button>
         </div>
 
-        <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination"
-            :row-selection="rowSelection" v-model:selectedKeys="selectedKeys" :scroll="{ x: 'auto' }">
+        <a-table row-key="id" :data="dataSource" :columns="role.getRole == 1 ? columns : columnsCustomer"
+            :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)">{{
@@ -54,13 +54,21 @@
             @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-select v-model="formState.sim_data_plan_id">
-                        <a-option v-for=" item in planList" :key="item.superior_id" :value="item.id"> 流量包{{ item.id
+                <a-form-item :label="$t('tariffManagement.source')" field="source">
+                    <a-select v-model="formState.source">
+                        <a-option v-for=" item in sourceList" :key="item.id" :value="item.value">{{ item.label
                             }}</a-option>
                     </a-select>
                 </a-form-item>
+                <template v-if="formState.source">
+                    <a-form-item :label="$t('tariffManagement.simDataPlanId')" field="sim_data_plan_id">
+                        <a-select v-model="formState.sim_data_plan_id">
+                            <a-option v-for=" item in planList" :key="item.superior_id" :value="item.id"> 流量包{{ item.id
+                                }}</a-option>
+                        </a-select>
+                    </a-form-item>
+                </template>
+
                 <a-form-item :label="$t('tariffManagement.feeCode')" field="feeCode" required="">
                     <a-input v-model="formState.feeCode" />
                 </a-form-item>
@@ -73,12 +81,6 @@
                             }}</a-option>
                     </a-select>
                 </a-form-item>
-                <a-form-item :label="$t('tariffManagement.source')" field="source">
-                    <a-select v-model="formState.source">
-                        <a-option v-for=" item in sourceList" :key="item.id" :value="item.value">{{ item.label
-                            }}</a-option>
-                    </a-select>
-                </a-form-item>
                 <a-form-item :label="$t('tariffManagement.trafficType')" field="traffic_type">
                     <a-select v-model="formState.traffic_type">
                         <a-option v-for=" item in trafficList" :key="item.id" :value="item.value">{{ item.label
@@ -215,16 +217,17 @@
 </template>
 
 <script setup>
-import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
+import { onMounted, ref, reactive, getCurrentInstance, nextTick, watch } from "vue";
 import { useRoute } from "vue-router";
-import { columns, planColumns } from "./config";
+import { columns, columnsCustomer, 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 { getDataPlanList } from "@/api/path/lotCard.api"
 import { userList } from '@/api/path/system.api'
 
 import { enum_dict } from "@/hooks/enum";
 import { useSystemStore } from '@/store/modules/systemStore'
+const role = useSystemStore()
 
 
 const { proxy } = getCurrentInstance()
@@ -296,7 +299,10 @@ const handleDel = async (id) => {
     }
 };
 
-//
+const evChangePage = (page) => {
+    pagination.value.current = page
+    intData()
+}
 
 const handleSearch = () => {
     intData()
@@ -458,18 +464,26 @@ const dictShowModel = (type, data) => {
     })
 }
 
+// 获取id数组
 const handleModelId = async () => {
     const param = {
         current: 1,
         size: 999,
     }
-    dataPlanList(param).then(res => {
-        planList.value = res.data.records || []
-    })
     userList(param).then(res => {
         userIdList.value = (res.data.records || []).filter((item) => item.user_type == '2')
     })
 }
+const handleDataPlan = async () => {
+    const param = {
+        current: 1,
+        size: 999,
+        source: formState.value.source
+    }
+    getDataPlanList(param).then(res => {
+        planList.value = res.data.records || []
+    })
+}
 // 取消
 const resetForm = () => {
     visible.value = false;
@@ -489,26 +503,7 @@ const rowSelectionPlan = reactive({
     onlyCurrent: false,
 });
 
-const handlePlan = async () => {
-    planVisible.value = true
-    const param = {
-        current: 1,
-        size: 10,
-        ...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"
-        }
-    })
 
-}
 const resetSearchPlan = () => {
 
 }
@@ -525,6 +520,18 @@ const handleSubmitPlan = () => {
     }
 
 }
+
+watch(
+    () => formState.value.source,
+    (newValue, oldValue) => {
+
+        if (newValue != oldValue) {
+            handleDataPlan()
+        }
+    },
+    { immediate: true }
+);
+
 // -------------------------------------------------------
 // 获取字典
 const handleDictValue = () => {