Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

qymljy 5 месяцев назад
Родитель
Сommit
9cb195e0f5

+ 2 - 1
pages/tabbar/home/index.json

@@ -1,6 +1,7 @@
 {
     "usingComponents": {
-        "van-notice-bar": "@vant/weapp/notice-bar/index"
+        "van-notice-bar": "@vant/weapp/notice-bar/index",
+        "waitToBeDone":"./waitToBeDone"
     },
     "navigationStyle": "custom"
 }

+ 1 - 0
pages/tabbar/home/index.wxml

@@ -35,4 +35,5 @@
         </view>
     </block>
 </view>
+<waitToBeDone />
 <view style="height: 160rpx;" />

+ 42 - 0
pages/tabbar/home/waitToBeDone/index.js

@@ -0,0 +1,42 @@
+Component({
+    properties: {
+
+    },
+    data: {
+        tasks: [{
+                id: 1,
+                title: '参加扬州大学附属医院产品推介会',
+                date: '2025-12-15'
+            },
+            {
+                id: 2,
+                title: '跟台上海天伦医院手术3场',
+                date: '2025-12-15'
+            }
+        ],
+        records: [{
+                id: 1,
+                title: '参加扬州大学附属医院产品推介会',
+                date: '2025-12-15'
+            },
+            {
+                id: 2,
+                title: '跟台上海天伦医院手术3场',
+                date: '2025-12-15'
+            }
+        ],
+    },
+    methods: {
+        handleCalendarLoad(e) {
+            console.log("加载", e)
+            // 1. 拿到今日日期 把年月记录到data中
+            // 2. 获取当月数据给日期打标记
+            // 3. 获取当日数据
+        },
+        handleCalendarDateChange(e) {
+            console.log("切换日期", e)
+            // 1. 获取当日数据
+            // 2. 判断选中日的年月是否与data中的相同;不相同获取当月数据打标记
+        }
+    }
+})

+ 6 - 0
pages/tabbar/home/waitToBeDone/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "calendar": "/components/wx-calendar/index"
+    }
+}

+ 33 - 0
pages/tabbar/home/waitToBeDone/index.scss

@@ -0,0 +1,33 @@
+.section {
+	margin: 20rpx;
+	background-color: white;
+	border-radius: 10rpx;
+	padding: 20rpx;
+	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
+
+	.section-title {
+		font-size: 32rpx;
+		color: #333;
+		margin-bottom: 10rpx;
+	}
+
+	.section-date {
+		font-size: 28rpx;
+		color: #999;
+		margin-bottom: 10rpx;
+	}
+}
+
+.task-item,
+.record-item {
+	margin-bottom: 15rpx;
+	padding: 15rpx;
+	border-left: 5rpx solid #ff3b30;
+	background-color: #fff8f8;
+	border-radius: 6rpx;
+}
+
+.record-item {
+	border-left-color: #007AFF;
+	background-color: #f0f8ff;
+}

+ 22 - 0
pages/tabbar/home/waitToBeDone/index.wxml

@@ -0,0 +1,22 @@
+<view class="">
+	<calendar id="calendar" _vibrate='{{false}}' view='week' bindload="handleCalendarLoad" binddatechange="handleCalendarDateChange">
+		<!-- 任务列表 -->
+		<view class="section">
+			<view class="section-title">任务</view>
+			<view class="section-date">{{ selectedDate }}</view>
+			<view wx:for="{{ tasks }}" wx:key="id" class="task-item">
+				<text class="task-text">{{ item.title }}</text>
+			</view>
+		</view>
+
+		<!-- 跟进记录 -->
+		<view class="section">
+			<view class="section-title">跟进记录</view>
+			<view class="section-date">{{ selectedDate }}</view>
+			<view wx:for="{{ records }}" wx:key="id" class="record-item">
+				<text class="record-text">{{ item.title }}</text>
+			</view>
+		</view>
+
+	</calendar>
+</view>

+ 10 - 3
project.private.config.json

@@ -6,16 +6,23 @@
         "compileHotReLoad": true,
         "bigPackageSizeSupport": false
     },
-    "libVersion": "3.11.2",
+    "libVersion": "3.13.0",
     "condition": {
         "miniprogram": {
             "list": [
+                {
+                    "name": "首页",
+                    "pathName": "pages/tabbar/home/index",
+                    "query": "",
+                    "scene": null,
+                    "launchMode": "default"
+                },
                 {
                     "name": "prsx/select/docter/index",
                     "pathName": "prsx/select/docter/index",
                     "query": "params=%7B%22content%22%3A%7B%22sa_customersid%22%3A6737%2C%22pageNumber%22%3A1%2C%22pageSize%22%3A20%2C%22where%22%3A%7B%22condition%22%3A%22%22%7D%7D%2C%22id%22%3A2025102310134602%7D&radio=true&result=%5B%22%22%5D&value=%5B%22%22%2C%5B%22%22%5D%5D",
-                    "scene": null,
-                    "launchMode": "default"
+                    "launchMode": "default",
+                    "scene": null
                 },
                 {
                     "name": "prsx/dealer/Salesperson/insert",

+ 40 - 25
utils/queryPermissions.js

@@ -1,30 +1,45 @@
-/* 
-    list = 查询的数组
-    tier = 层级
-    need = 需要查询的数据
-*/
-let getObjectKey = (object, value) => {
-    return Object.keys(object).find(key => object[key] == value);
-};
-
-let name = ['modules', 'apps'];
+/**
+ * 优化后的查询函数
+ * @param {Array|Object} list - 查询的数据源
+ * @param {Array} tier - 路径层级数组 (例如: ['systemA', 'moduleB'])
+ * @param {Array} need - 需要匹配的 systemmodulename 集合
+ */
+const nameKeys = ['modules', 'apps'];
 
 function query(list, tier, need) {
-    if (!list.some(v => v.systemname == tier[0])) return [];
-    // if (!list) return;
-    if (list.length == 0) return;
-    //排除不是数组 在深入查找一级
-    if (list.constructor !== Array) return query(list[Object.keys(list).filter((key) => name.includes(key))], tier, need);
-    //拿到当前层的数组 如果不是最后一层 继续查找
-    let arr = list.find(v => getObjectKey(v, tier[0]));
-    if (tier.length > 1) return query(arr, tier.splice(1, 1), need);
-    // 到达最后一层查询需要查询的权限
-    if (arr.constructor !== Array) arr = arr[Object.keys(arr).filter((key) => name.includes(key))]
-    let perArr = [];
-    for (let i = 0; i < arr.length; i++) {
-        if (need.includes(arr[i].systemmodulename)) perArr.push(arr[i])
+    // 1. 边界检查
+    if (!list || (Array.isArray(list) && list.length === 0)) return [];
+    
+    // 2. 统一处理:如果是对象,则提取出 modules 或 apps 对应的数组
+    if (!Array.isArray(list)) {
+        const key = Object.keys(list).find(k => nameKeys.includes(k));
+        return key ? query(list[key], tier, need) : [];
+    }
+
+    const [currentLevel, ...restLevels] = tier;
+
+    // 3. 在当前层级寻找匹配 systemname 的节点
+    const target = list.find(item => item.systemname === currentLevel);
+    if (!target) return [];
+
+    // 4. 判断是否到达路径最后一层
+    if (restLevels.length > 0) {
+        // 还没到最后一层,递归进入下一级
+        return query(target, restLevels, need);
+    }
+
+    // 5. 到达最后一层,执行筛选逻辑
+    // 先获取最后一层实际的数据数组(考虑嵌套在 modules/apps 里的情况)
+    let finalArr = target;
+    if (!Array.isArray(finalArr)) {
+        const key = Object.keys(finalArr).find(k => nameKeys.includes(k));
+        finalArr = key ? finalArr[key] : [];
     }
-    return perArr;
-};
+
+    // 确保 finalArr 是数组后进行过滤
+    return Array.isArray(finalArr) 
+        ? finalArr.filter(item => need.includes(item.systemmodulename))
+        : [];
+}
 
 module.exports.query = query;

+ 7 - 35
utils/work/apps.js

@@ -56,7 +56,7 @@ function getcrm() {
     path: "/prsx/calendar/index",
     icon: "work-shichanghuodong",
     objectname: ""
-  },{
+  }, {
     name: "市场活动",
     path: "/prsx/activity/index",
     icon: "work-shichanghuodong",
@@ -107,8 +107,13 @@ function getcrm() {
     icon: "work-xiaochengxu_xiaoshoumubiao",
     objectname: "sa_salestarget"
   }];
-  let crm = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['CRM'], ['业务管理', '销售管理', '营销目标']),
+  let crm = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['CRM'], ['业务管理', '销售管理', '营销目标', '行事历']),
     list = [];
+  try {
+    crm.push(getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['行事历'], ['行事历'])[0])
+  } catch (error) {
+
+  }
   crm.forEach(v => {
     v.apps.forEach(s => {
       authList[s.name] = {
@@ -131,38 +136,6 @@ function getcrm() {
   });
   return dye(list.sort((a, b) => a.index - b.index))
 };
-//行事历
-function getxsl() {
-  const paths = [{
-    name: "行事历",
-    path: "/prsx/calendar/index",
-    icon: "work-shichanghuodong",
-    objectname: ""
-  }];
-  let xsl = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['行事历'], ['行事历']),
-    list = [];
-  xsl.forEach(v => {
-    v.apps.forEach(s => {
-      authList[s.name] = {
-        options: s.meta.auth.map(a => a.option),
-        optionnames: s.meta.auth.map(a => a.optionname),
-        istask: s.istask == 1,
-        isdatafollowup: s.isdatafollowup == 1,
-        isdatatag: s.isdatatag == 1,
-        isdatateam: s.isdatateam == 1,
-      }
-      if (authList[s.name].options.some(s => s == "read")) {
-        let i = paths.findIndex(k => k.name == s.meta.title);
-        if (i != -1) {
-          paths[i].index = i;
-          paths[i].appName = s.name;
-          list.push(paths[i])
-        }
-      }
-    })
-  });
-  return dye(list.sort((a, b) => a.index - b.index))
-};
 //染色
 function dye(list) {
   let colorList = [{
@@ -227,6 +200,5 @@ function dye(list) {
 module.exports = {
   getapps,
   getcrm,
-  getxsl,
   authList
 };

+ 2 - 7
utils/work/work.js

@@ -6,13 +6,8 @@ async function initWorkbench(that) {
         icon: "work-tongyong",
         appid: "wx197f219a82a89d7b",
         list: apps.getapps()
-    }, {
-      label: "行事历",
-      appid: "wx197f219a82a89d7b",
-      icon: "work-CRM",
-      list: apps.getxsl()
-  },{
-        label: "CRM",
+    },{
+        label: "应用",
         appid: "wx197f219a82a89d7b",
         icon: "work-CRM",
         list: apps.getcrm()