瀏覽代碼

封装公共方法及字典

wanghairong 5 月之前
父節點
當前提交
5ed26779b4

+ 1 - 0
package.json

@@ -13,6 +13,7 @@
     "axios": "^1.7.2",
     "crypto-js": "^4.2.0",
     "dayjs": "^1.11.11",
+    "echarts": "^5.5.1",
     "less": "^4.2.0",
     "less-loader": "^12.2.0",
     "lodash": "^4.17.21",

+ 18 - 6
src/App.vue

@@ -1,13 +1,11 @@
 <template>
-  <a-config-provider 
-    :locale="locale"
-  >
+  <a-config-provider :locale="locale">
     <div class="public_local_loading" :class="{ 'hidden-loading': !systemStore.getLocalLoading }">
       <div class="public_local_loading_bg">
         <a-spin class="public_local_loading_logo" dot />
       </div>
     </div>
-    <router-view  v-if="isRouterActive"/>
+    <router-view v-if="isRouterActive" />
   </a-config-provider>
 </template>
 
@@ -15,6 +13,7 @@
 import { ref, onMounted, nextTick, provide } from "vue"
 import { useDarkThemeHook, useLang } from '@/hooks'
 import { useSystemStore } from '@/store/modules/systemStore'
+import { dictionaryList } from "@/api/path/dict"
 
 const isRouterActive = ref(true)
 // 全局语言
@@ -32,19 +31,30 @@ provide('reloadRoutePage', () => {
 })
 
 
-onMounted(() => {
+onMounted(async () => {
   const getLoadingNode = document.getElementById('Loading')
   const { body } = document
   if (getLoadingNode) {
     body.removeChild(getLoadingNode)
   }
+
+  if (systemStore?.token) {
+    const { code, data } = await dictionaryList({
+      size: 99999,
+      current: 1,
+    })
+    if (code == 200) {
+      window.localStorage.setItem('dictList', JSON.stringify(data.records))
+    }
+  }
 })
 </script>
 
-<style  lang="less" >
+<style lang="less">
 body {
   overflow: hidden;
 }
+
 // 加载loading css
 .public_local_loading {
   position: fixed;
@@ -75,11 +85,13 @@ body {
     user-select: none;
   }
 }
+
 .hidden-loading.public_local_loading {
   opacity: 0;
   z-index: -10 !important;
   cursor: auto !important;
 }
+
 @keyframes r-loading {
   0% {
     transform: rotate(0deg);

+ 41 - 0
src/api/customer.js

@@ -0,0 +1,41 @@
+import service from './axios'
+
+export function getCustomerList(data) {
+    return service({
+        url: '/app/user/getCustomerList',
+        method: 'post',
+        data
+    })
+}
+
+export function addCustomer(data) {
+    return service({
+        url: '/app/user/addCustomer',
+        method: 'post',
+        data
+    })
+}
+
+export function updateCustomer(data) {
+    return service({
+        url: "/app/user/updateCustomer",
+        method: "post",
+        data,
+    });
+}
+
+export function deleteCustomer(data) {
+    return service({
+        url: '/customer/delete',
+        method: 'post',
+        data
+    })
+}
+
+export function getCustomer(data) {
+    return service({
+        url: "/app/user/getCustomer",
+        method: "post",
+        data,
+    });
+}

+ 8 - 0
src/hooks/enum.js

@@ -0,0 +1,8 @@
+// 字典类型枚举值
+export const enum_dict = {
+    TRAFFIC_PACKET_STATUS: "traffic_packet _status", // 流量包状态
+    SUBSCRIPTION_RELATIONSHIP_STATUS: "subscription _relationship_status", // 订阅关系状态
+    MAIN_CARD_STATUS: "main_card_status", // 主卡状态
+    PACKAGE_TRIFF_PLAN_STATUS: "package_tariff_plan_status", // 套餐资费计划判断状态
+    SUPPLIER_SOURCE: "supplier_source", // 来源(订单管理列表)
+};

+ 1 - 0
src/utils/index.js

@@ -1,5 +1,6 @@
 export * from '@/utils/crypto'
 export * from '@/utils/utils'
+export * from '@/utils/tools'
 export * from '@/utils/storage'
 export * from '@/utils/router'
 export * from '@/utils/components'

+ 10 - 0
src/utils/tools.js

@@ -0,0 +1,10 @@
+/**
+ * * 获取字典数据
+ * @param dictList 获取全部字典值
+ * @param typeKey 根据字典key获取数组
+ */
+// 根据typeKey获取dictlist中的选项
+export const getDictOptions = (dictList, typeKey) => {
+  const list = dictList.filter((item) => item.type_key == typeKey);
+  return list;
+};

+ 1 - 2
src/views/lotCard/cardList/config.js

@@ -1,11 +1,10 @@
 export const columns = [
   { title: window.$t('lotCard.iccid'), dataIndex: 'iccid', align: 'center', width: 200 },
-  { title: window.$t('lotCard.himsi'), dataIndex: 'hImsi', align: 'center', width: 200 },
   { title: window.$t('lotCard.status'), dataIndex: 'status', align: 'center', width: 100 },
   { title: window.$t('lotCard.created_at'), dataIndex: 'created_at', align: 'center', width: 200 },
   { title: window.$t('lotCard.deleted_at'), dataIndex: 'deleted_at', align: 'center', width: 200 },
   { title: window.$t('lotCard.updated_at'), dataIndex: 'updated_at', align: 'center', width: 200 },
-  { title: window.$t('lotCard.msisdn'), dataIndex: 'msisdn', align: 'center', width: 200 },
+  // { title: window.$t('lotCard.msisdn'), dataIndex: 'msisdn', align: 'center', width: 200 },
   { title: window.$t('lotCard.source'), dataIndex: 'source', align: 'center', width: 200 },
   { title: window.$t('lotCard.ExpireTime'), dataIndex: 'expire_time', align: 'center', width: 200 },
   { title: window.$t('lotCard.UserId'), dataIndex: 'user_id', align: 'center', width: 200 },

+ 1 - 6
src/views/lotCard/cardList/index.vue

@@ -14,13 +14,9 @@
     <!-- 搜索条件区 -->
     <div class="search-section">
       <a-form :model="searchForm" ref="formRef" layout="inline">
-        <a-form-item field="iccid" :label="$t('lotCard.iccid')" :validate-trigger="['change', 'input', 'blur']"
-          :rules="[{ required: true, message: $t('lotCard.please') + $t('lotCard.iccid') }]">
+        <a-form-item field="iccid" :label="$t('lotCard.iccid')">
           <a-input v-model="searchForm.iccid" :placeholder="$t('lotCard.please') + $t('lotCard.iccid')" allow-clear />
         </a-form-item>
-        <a-form-item field="hImsi" :label="$t('lotCard.himsi')">
-          <a-input v-model="searchForm.hImsi" :placeholder="$t('lotCard.please') + $t('lotCard.himsi')" allow-clear />
-        </a-form-item>
         <a-form-item>
           <a-space>
             <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
@@ -56,7 +52,6 @@ const { proxy } = getCurrentInstance()
 const formRef = ref()
 const searchForm = ref({
   "iccid": "",
-  "himsi": "",
 });
 
 const dataSource = ref([]);

+ 1 - 0
src/views/lotCard/orderMange/config.js

@@ -9,6 +9,7 @@ export const columns = [
   { title: window.$t('lotCard.orderID'), dataIndex: 'orderId', align: 'center', width: 200 },
   { title: window.$t('lotCard.price'), dataIndex: 'price', align: 'center', width: 200 },
   { title: window.$t('lotCard.quantity'), dataIndex: 'quantity', align: 'center', width: 200 },
+  { title: window.$t('lotCard.packageStatus'), dataIndex: 'status', align: 'center', width: 200 },
   { title: window.$t('lotCard.source'), dataIndex: 'source', align: 'center', width: 200 },
   { title: window.$t('lotCard.UserId'), dataIndex: 'user_id', align: 'center', width: 200 },
   {

+ 13 - 0
src/views/lotCard/orderMange/index.vue

@@ -62,6 +62,11 @@ import { useRoute } from "vue-router";
 import { columns } from "./config";
 import { Message, Notification } from '@arco-design/web-vue'
 import { orderList, setOrderDataPlan, orderCancel } from "@/api/path/lotCard.api"
+import { enum_dict } from "@/hooks/enum";
+import { getDictOptions } from "@/utils/tools";
+import { useSystemStore } from '@/store/modules/systemStore'
+
+const useSystem = useSystemStore()
 
 const { proxy } = getCurrentInstance()
 const formRef = ref()
@@ -110,6 +115,12 @@ const intData = async () => {
     pagination.value.total = data.total
 }
 
+// 获取字典值
+const getDictValue = async () => {
+    const dictList = JSON.parse(window.localStorage.getItem('dictList'))
+    const mainList = await getDictOptions(dictList, enum_dict.MAIN_CARD_STATUS)
+}
+
 
 
 // 订购生成订单
@@ -198,6 +209,7 @@ const handleUnsubscribeDialog = async (record) => {
     }
 };
 
+//
 
 const handleSearch = () => {
     formRef.value.validate((errors) => {
@@ -216,6 +228,7 @@ const resetSearch = () => {
 
 onMounted(() => {
     intData()
+    getDictValue()
 })
 </script>