linqilong 1 mesiac pred
rodič
commit
9882cb9ed5

+ 1 - 0
package.json

@@ -13,6 +13,7 @@
     "@ionic/vue-router": "^8.5.3",
     "axios": "^1.8.4",
     "core-js": "^3.8.3",
+    "pinia": "^3.0.2",
     "vant": "^4.9.19",
     "vue": "^3.2.13",
     "vue-loader": "^17.4.2",

+ 2 - 1
src/api/inspect.js

@@ -16,7 +16,8 @@ export function getCurrGroup(pid) {
  * 获取历史稽察年份数据
  * @param {*} pid 督察类型
  */
-export function getCurrGroup(pid) {
+export function getInspBaseByPersid(pid) {
+    const ownApp = '2'
     return request({
         url: '/dc/insp/base/getByPersid',
         method: 'GET',

BIN
src/assets/logo.png


+ 20 - 0
src/assets/styles/filter.scss

@@ -0,0 +1,20 @@
+.filter-wrapper {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    margin: 0 8px 8px 8px;
+  
+    .filter-item {
+      width: auto;
+      padding: 0 10px;
+      background-color: #fff;
+      border-radius: 10px;
+  
+      .filter-btn {
+        padding: 3px 1px;
+      }
+  
+    }
+  
+  }
+  

+ 2 - 1
src/main.js

@@ -1,4 +1,5 @@
 import { createApp } from 'vue';
+import {createPinia} from 'pinia';
 import Vant from 'vant';
 import App from './App.vue';
 import router from './router';
@@ -6,7 +7,7 @@ import router from './router';
 import 'vant/lib/index.css';
 import '@/assets/styles/index.scss';
 
-const app = createApp(App).use(Vant).use(router);
+const app = createApp(App).use(Vant).use(createPinia()).use(router);
 
 // Lazyload 指令需要单独进行注册
 app.use(Vant.Lazyload);

+ 7 - 0
src/stores/app.js

@@ -0,0 +1,7 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+export const useAppStore = defineStore('app', () => {
+  const currentOrgId = ref('034')
+  return {currentOrgId}
+})

+ 8 - 0
src/stores/user.js

@@ -0,0 +1,8 @@
+import {ref} from 'vue'
+import {defineStore} from 'pinia'
+
+export const useUserStore = defineStore('user', () => {
+  const userId = ref('414244bd0324447ba1b640b3ffa6fb8e')
+
+  return {userId}
+})

+ 6 - 5
src/utils/request.js

@@ -2,12 +2,13 @@ import axios from "axios";
 import { getToken } from "@/utils/auth";
 import { getErrorMessage } from "@/utils/errorCode";
 import { validURL } from "@/utils/validate";
+import {useAppStore} from '@/stores/app';
+import {useUserStore} from '@/stores/user';
 
 axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 
-let userid = localStorage.getItem('userid') ? localStorage.getItem('userid') : ''
-let orgId = localStorage.getItem('currentOrgId') ? localStorage.getItem('currentOrgId') : ''
-let accessToken = localStorage.getItem('accessToken') ? localStorage.getItem('accessToken') : ''
+const appStore = useAppStore()
+const userStore = useUserStore()
 
 // 创建axios实例
 const service = axios.create({
@@ -25,8 +26,8 @@ service.interceptors.request.use(
         // 是否需要设置 token
         const isToken = (config.headers || {}).isToken === false;
         if (getToken() && !isToken) {
-            config.headers["Orgid"] = '034'
-            config.headers["Persid"] = '414244bd0324447ba1b640b3ffa6fb8e'
+            config.headers["Orgid"] = appStore.currentOrgId || '034'
+            config.headers["Persid"] = userStore.userId
             config.headers["Accesstoken"] = getToken(); // 让每个请求携带自定义token
         }
         // get请求映射params参数

+ 49 - 3
src/views/Inspect/current.vue

@@ -1,7 +1,53 @@
 <template>
-
+    <div class="content-wrapper">
+        <div class="filter-wrapper">
+            <div class="filter-item">
+                <div class="filter-btn" @click="showPicker = true">
+                    {{ getTypeName(fieldValue) }}
+                    <van-icon name="arrow-down" color="#ebecf0" size="1rem" />
+                </div>
+            </div>
+        </div>
+        <van-popup v-model:show="showPicker" round position="bottom">
+            <van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
+        </van-popup>
+        <list01 class="ducha-group-wrapper" :type="fieldValue"></list01>
+    </div>
 </template>
 <script setup>
-import { onMounted } from "vue";
+import { onMounted, ref } from "vue";
+import CurrentComponent from "./current.vue";
+import List01 from "@/components/list01.vue";
+import { showToast } from 'vant';
+
+const columns = [
+    { text: '稽查工作', value: '008' },
+];
+const fieldValue = ref('008');
+const showPicker = ref(false);
+
+const onConfirm = ({ selectedOptions }) => {
+    showPicker.value = false;
+    fieldValue.value = selectedOptions[0].value;
+};
+
+function getTypeName(code) {
+    if (!code) return '';
+    return columns.find(item => item.value === code)?.text;
+}
 </script>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+@import '@/assets/styles/filter.scss';
+
+.content-wrapper {
+    padding-top: 8px;
+    height: 100%;
+    overflow: auto;
+
+    .ducha-group-wrapper {
+        height: calc(100% - 35px);
+        overflow: auto;
+    }
+
+}
+</style>

+ 3 - 71
src/views/Inspect/index.vue

@@ -1,93 +1,25 @@
 <template>
   <van-tabs v-model="active" @click-tab="onClickTab">
     <van-tab title="当前">
-      <div class="content-wrapper">
-        <div class="filter-wrapper">
-          <div class="filter-item">
-            <div class="filter-btn" @click="showPicker = true"> 
-              {{ getTypeName(fieldValue) }}
-              <van-icon name="arrow-down" color="#ebecf0" size="1rem" />
-            </div>
-          </div>
-        </div>
-        <van-popup v-model:show="showPicker" round position="bottom">
-          <van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
-        </van-popup>
-        <list01 class="ducha-group-wrapper" :type="fieldValue"></list01>
-      </div>
-
+      <current-component></current-component>
     </van-tab>
     <van-tab title="历史">
-      <current-component></current-component>
     </van-tab>
   </van-tabs>
 </template>
 <script setup>
 import { onMounted, ref } from "vue";
 import CurrentComponent from "./current.vue";
-import List01 from "@/components/list01.vue";
 import { showToast } from 'vant';
 
-const columns = [
-  { text: '稽查工作', value: '008' },
-];
-const fieldValue = ref('008');
-const showPicker = ref(false);
-
-const onConfirm = ({ selectedOptions }) => {
-  showPicker.value = false;
-  fieldValue.value = selectedOptions[0].text;
-};
-
 const active = ref('当前');
 const onClickTab = ({ title }) => showToast(title);
-
-function getTypeName(code) {
-  if (!code) return '';
-  return columns.find(item => item.value === code)?.text;
-}
-
-onMounted(() => {
-})
 </script>
-<style lang="scss" scoped>
-.content-wrapper {
-  padding-top: 8px;
-  height: 100%;
-  overflow: auto;
-
-  .ducha-group-wrapper {
-    height: calc(100% - 35px);
-    overflow: auto;
-  }
-
-}
-
-.filter-wrapper {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  margin: 0 8px 8px 8px;
-
-  .filter-item {
-    width: auto;
-    padding: 0 10px;
-    background-color: #fff;
-    border-radius: 10px;
-
-    .filter-btn {
-      padding: 3px 1px;
-    }
-
-  }
-
-}
-
+<style lang="scss">
 .van-tabs {
   height: 100%;
 }
-</style>
-<style lang="scss">
+
 .van-tabs__content {
   height: calc(100% - 44px);