浏览代码

1.大中型下单指派部门
2.修复pinia缓存设置顺序导致的子组件访问时为null的问题

GouGengquan 3 周之前
父节点
当前提交
c2ae6dfb68

+ 6 - 1
src/api/department.js

@@ -5,7 +5,12 @@ export function simpleAll(params) {
     return request.get(`department/simpleAll`, { params: params })
 }
 
- // 分单部门下拉列表
+// 分单部门下拉列表
 export function allot(params) {
     return request.get(`department/allot/${params}`)
+}
+
+// 获取大中型接单部门
+export function majorDepartment() {
+    return request.get(`department/allot/major`)
 }

+ 1 - 1
src/utils/request.js

@@ -45,7 +45,7 @@ service.interceptors.response.use(
         );
         $router.push('/index/login');
         removeToken();
-      } else if(res.code === 10033) {
+      } else if(res.code === 10033) { // code 10033 流程节点任务未完成处理
         showNotify(
           {
             type: 'danger',

+ 7 - 5
src/views/home/components/NavBar.vue

@@ -93,11 +93,13 @@ export default {
     // 获取未读消息
     getNotRead() {
       notRead().then((res) => {
-        this.messages = res.data;
-        if (this.messages.length > 0) {
-          this.hasNotReadMes = true;
-        } else {
-          this.hasNotReadMes = false;
+        if (res.data) {
+          this.messages = res.data;
+          if (this.messages.length > 0) {
+            this.hasNotReadMes = true;
+          } else {
+            this.hasNotReadMes = false;
+          }
         }
       });
     },

+ 4 - 15
src/views/home/home.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bottom-layer">
-    <div class="card" v-if="meunNames.includes('个贷业务')">
+    <div class="card" v-if="menuStore.menuInfo.map((item) => item.name).includes('个贷业务')">
       <div class="businessTitle">个贷业务</div>
       <div class="icon-area" @click="goBench('/index/personal/pendingOrder')">
         <svg t="1713838252300" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5893" width="42" height="42">
@@ -50,7 +50,7 @@
         <div class="icon-word">我的订单</div>
       </div>
     </div>
-    <div class="card" v-if="meunNames.includes('大中型业务')">
+    <div class="card" v-if="menuStore.menuInfo.map((item) => item.name).includes('大中型业务')">
       <div class="businessTitle">大中型业务</div>
       <div class="icon-area" @click="goBench('/index/major/pendingOrder')">
         <svg t="1713838139679" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5142" width="42" height="42">
@@ -95,7 +95,7 @@
         <div class="icon-word">我的订单</div>
       </div>
     </div>
-    <div class="card" v-if="meunNames.includes('资产业务')">
+    <div class="card" v-if="menuStore.menuInfo.map((item) => item.name).includes('资产业务')">
       <div class="businessTitle">资产业务</div>
       <div class="icon-area" @click="goBench('/index/assets/pendingOrder')">
         <svg t="1713838525654" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6320" width="42" height="42">
@@ -160,7 +160,7 @@
         <div class="icon-word">我的订单</div>
       </div>
     </div>
-    <div class="card" v-if="meunNames.includes('土地规划市场')">
+    <div class="card" v-if="menuStore.menuInfo.map((item) => item.name).includes('土地规划市场')">
       <div class="businessTitle">土地规划业务</div>
       <div class="icon-area" @click="goBench('/index/land/pendingOrder')">
         <svg t="1713920171367" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1903" width="42" height="42">
@@ -213,19 +213,8 @@ import { mapStores } from 'pinia';
 import { menuStore } from '@/stores/menuStore';
 
 export default {
-  props: {
-    parentLoaded: Boolean,
-  },
-  watch: {
-    parentLoaded(newVal) {
-      if (newVal) {
-        this.meunNames = this.menuStore.menuInfo.map((item) => item.name); // 父组件加载完成后执行
-      }
-    },
-  },
   data() {
     return {
-      meunNames: [],
     };
   },
   computed: {

+ 1 - 14
src/views/home/index.vue

@@ -4,7 +4,7 @@
       <router-view v-slot="{ Component }">
       <transition>
         <keep-alive>
-          <component :is="Component" :parent-loaded="parentLoaded" />
+          <component :is="Component" />
         </keep-alive>
       </transition>
     </router-view>
@@ -24,8 +24,6 @@ import { Tabbar, NavBar } from './components';
 export default {
   data() {
     return {
-      // 父组件加载状态
-      parentLoaded: false
     };
   },
   components: {
@@ -40,19 +38,8 @@ export default {
     ...mapStores(menuStore),
   },
   created() {
-    this.getUserInfo();
   },
   methods: {
-    getUserInfo() {
-      userInfo().then((res) => { // 获取用户信息
-        this.userStore.setUserInfo(res.data);
-        userMenus().then((res) => { // 获取菜单权限
-          this.menuStore.setMenuInfo(res.data);
-          // 方法执行完成后传递父组件状态
-          this.parentLoaded = true;
-        });
-      });
-    },
     goBench(route) {
       this.$router.push(route);
     },

文件差异内容过多而无法显示
+ 45 - 13
src/views/login/index.vue


+ 29 - 10
src/views/major/placeOrder.vue

@@ -25,6 +25,17 @@
             :rules="[{ required: true, message: '请选择派单方式' }]"
             :required="true"
           />
+          <VanSinglePicker
+            label="接单部门"
+            v-model="major.departmentId"
+            v-bind:columns="allotDepartmentColumns"
+            name="departmentId"
+            placeholder="请选择接单部门"
+            clearable
+            :rules="[{ required: true, message: '请选择接单部门' }]"
+            :required="true"
+            v-if="major.allotType === '指派'"
+          />
           <van-field label="订单名称" v-model="major.name" name="name" type="textarea" placeholder="请输入订单名称" :rules="[{ required: true, message: '请输入订单名称' }]" required />
           <VanSinglePicker
             label="对象类型"
@@ -37,15 +48,7 @@
             :rules="[{ required: true, message: '请选择对象类型' }]"
             :required="true"
           />
-          <VanSinglePicker
-            label="特殊类型"
-            v-model="major.specialType"
-            v-bind:columns="specialTypeColumns"
-            name="specialType"
-            placeholder="请选择特殊类型"
-            clearable
-            v-if="major.businessObjectType === '房地产'"
-          />
+          <VanSinglePicker label="特殊类型" v-model="major.specialType" v-bind:columns="specialTypeColumns" name="specialType" placeholder="请选择特殊类型" clearable v-if="major.businessObjectType === '房地产'" />
           <VanSinglePicker
             label="业务类型"
             v-model="major.businessGener"
@@ -166,6 +169,7 @@ import { add } from '@/api/major';
 import { customerLinkmanDrop } from '@/api/customerLinkman';
 import { customerCompanyDrop } from '@/api/customerCompany';
 import { commit } from '@/api/workflow';
+import { majorDepartment } from '@/api/department';
 
 export default {
   components: {
@@ -286,6 +290,8 @@ export default {
         refinance: 'false',
         loanExpire: 'false',
       },
+      // 接单部门
+      allotDepartmentColumns: [],
     };
   },
   computed: {
@@ -295,6 +301,7 @@ export default {
     this.major.clientManagerId = this.userStore.userInfo.id;
     this.major.clientManager = this.userStore.userInfo.name;
     this.changeCustomerType();
+    this.getAllotDepartment();
   },
   methods: {
     // 清空项目类型
@@ -398,7 +405,19 @@ export default {
           }
           history.back();
         } else {
-          showNotify({ type: 'danger', message: '下单失败, 请稍后再试' });
+          showNotify({ type: 'danger', message: res.msg });
+        }
+      });
+    },
+    // 获取大中型接单部门
+    getAllotDepartment() {
+      majorDepartment().then((res) => {
+        if (res.code === 200) {
+          // 使用 map 方法提取 id 和 name 属性
+          this.allotDepartmentColumns = res.data.map((item) => ({
+            value: String(item.id),
+            text: String(item.name),
+          }));
         }
       });
     },