From 1d915f1e1845d57d51313a5885496d8dea622269 Mon Sep 17 00:00:00 2001
From: hdm <hdm58@qq.com>
Date: Sun, 28 Nov 2021 17:56:29 +0800
Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=89=88=E6=9C=AC=E6=95=B4?=
 =?UTF-8?q?=E4=BD=93=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F=E7=BB=86=E8=8A=82?=
 =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/home/controller/Plan.php         |  2 +-
 app/home/view/index/main.html        | 46 ++++++++++++++++++++++------
 app/home/view/schedule/calendar.html |  6 ++--
 app/install/data/gouguoa.sql         |  6 ++++
 4 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/app/home/controller/Plan.php b/app/home/controller/Plan.php
index 9d8f908..ab53f93 100644
--- a/app/home/controller/Plan.php
+++ b/app/home/controller/Plan.php
@@ -85,7 +85,7 @@ class Plan extends BaseController
             ->field('id,title,type,start_time,end_time')
             ->select()->toArray();
             $events = [];
-            $color_array=['#393D49','#FF5722','#FFB800','#1E9FFF','#009688'];
+            $color_array=['#393D49','#FF5722','#FFB800','#1E9FFF','#12bb37'];
             foreach ($schedule as $k => $v) {
                 $v['backgroundColor'] = $color_array[$v['type']];
                 $v['borderColor'] = $color_array[$v['type']];
diff --git a/app/home/view/index/main.html b/app/home/view/index/main.html
index 2d66cf2..e8365ce 100644
--- a/app/home/view/index/main.html
+++ b/app/home/view/index/main.html
@@ -176,8 +176,9 @@
 <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.1.2/echarts.min.js"></script>
 <script>
 	function init(layui) {
-		var layer = layui.layer, table = layui.table;
-		get_logs();
+		var TAB = parent.layui.tab,
+			layer = layui.layer,
+			table = layui.table;
 
 		//公告
 		table.render({
@@ -185,9 +186,13 @@
 			, url: "{:url('home/api/get_note_list')}" //数据接口
 			, page: false //开启分页
 			, cols: [[ //表头
-				{ field: 'cate_title', title: '公告分类', align: 'center','width': 120 },
+				{ field: 'cate_title', title: '公告分类', align: 'center','width': 90 },
 				{ field: 'title', title: '公告标题'},
-				{ field: 'create_time', title: '发布时间', align: 'center','width': 150}
+				{ field: 'view', title: '操作','width': 60 , align: 'center', templet:function(d){
+					var html='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</button>';
+					return html;
+				}},
+				{ field: 'create_time', title: '发布时间', align: 'center','width': 136}
 			]]
 		});
 		//文章
@@ -196,13 +201,35 @@
 			, url: "{:url('home/api/get_article_list')}" //数据接口
 			, page: false //开启分页
 			, cols: [[ //表头
-				{ field: 'cate_title', title: '知识分类', align: 'center','width': 120 },
+				{ field: 'cate_title', title: '知识分类', align: 'center','width': 90 },
 				{ field: 'title', title: '知识标题'},
 				{ field: 'read', title: '访问量', align: 'center','width': 80 },
-				{ field: 'create_time', title: '发布时间', align: 'center','width': 150}
+				{ field: 'view', title: '操作','width': 60 , align: 'center', templet:function(d){
+					var html='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</button>';
+					return html;
+				}},
+				{ field: 'create_time', title: '发布时间', align: 'center','width': 136}
 			]]
 		});
 		
+		//监听行工具事件
+		table.on('tool(Note)', function (obj) {
+			var data = obj.data;			
+			if (obj.event === 'view') {
+				TAB.sonAdd('/home/note/view?id='+data.id,'公告详情');
+				return;
+			}
+		});
+		table.on('tool(Article)', function (obj) {
+			var data = obj.data;			
+			if (obj.event === 'view') {
+				TAB.sonAdd('/home/article/view?id='+data.id,'知识文章详情');
+				return;
+			}
+		});
+		
+		get_logs();
+		
 		get_view_data();
 	}
 
@@ -240,6 +267,7 @@
 		}
 		return str;
 	}
+	
 	var chartView = echarts.init(document.getElementById('chartView'));
 	function get_view_data() {
 		$.ajax({
@@ -268,7 +296,7 @@
 					var ops = {
 						title: {
 							top: '15px',
-							text: '今日与昨日访问统计',
+							text: '今日与昨日员工活跃度',
 							left: '12px',
 							textStyle: {
 								fontSize: '18',
@@ -355,7 +383,7 @@
 					let option = {
 						title: {
 							top: '15px',
-							text: '近一年访问统计',
+							text: '近一年员工活跃度',
 							left: '12px',
 							textStyle: {
 								fontSize: '18',
@@ -366,7 +394,7 @@
 							padding: 6,
 							formatter: function (obj) {
 								var value = obj.value;
-								return '<div style="font-size: 12px;">' + value[0] + ':' + value[1] + ' 个访客</div>';
+								return '<div style="font-size: 12px;">' + value[0] + '员工活跃度:' + value[1] + '</div>';
 							}
 						},
 						visualMap: {
diff --git a/app/home/view/schedule/calendar.html b/app/home/view/schedule/calendar.html
index 9e05f01..9a54d05 100644
--- a/app/home/view/schedule/calendar.html
+++ b/app/home/view/schedule/calendar.html
@@ -83,7 +83,7 @@
 		function addEvent(){
 			var detail={};
 			detail['id']=0;
-			detail['name']='';
+			detail['title']='';
 			detail['start_time']='';
 			detail['end_time']='';		
 			detail['start_time_1']='08:30';
@@ -104,7 +104,7 @@
 								</tr>\
 								<tr>\
 									<td class="layui-td-gray2">工作内容 <span style="color: red">*</span></td>\
-									<td colspan="3"><input name="name" class="layui-input" value="" lay-verify="required" lay-reqText="请完成工作内容"></td>\
+									<td colspan="3"><input name="title" class="layui-input" value="" lay-verify="required" lay-reqText="请完成工作内容"></td>\
 								</tr>\
 								<tr>\
 									<td class="layui-td-gray2">工作详细描述</td>\
@@ -205,7 +205,7 @@
 						layer.msg('请选择工作类型');
 						return;
 					}
-					if(detail.name==''){
+					if(detail.title==''){
 						layer.msg('请填写工作内容');
 						return;
 					}
diff --git a/app/install/data/gouguoa.sql b/app/install/data/gouguoa.sql
index aba81b4..c2b9d3a 100644
--- a/app/install/data/gouguoa.sql
+++ b/app/install/data/gouguoa.sql
@@ -403,6 +403,11 @@ CREATE TABLE `oa_article_keywords`  (
   INDEX `inid`(`keywords_id`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '知识文章关联表';
 
+-- ----------------------------
+-- Records of oa_article_keywords
+-- ----------------------------
+INSERT INTO `oa_article_keywords`(`id`, `aid`, `keywords_id`, `status`, `create_time`) VALUES (1, 1, 1, 1, 1638093082);
+
 -- ----------------------------
 -- Table structure for oa_config
 -- ----------------------------
@@ -556,6 +561,7 @@ CREATE TABLE `oa_expense_cate`  (
 -- ----------------------------
 INSERT INTO `oa_expense_cate`(`id`, `title`, `status`, `create_time`, `update_time`) VALUES (1, '交通费', 1, 1637987189, 0);
 INSERT INTO `oa_expense_cate`(`id`, `title`, `status`, `create_time`, `update_time`) VALUES (2, '住宿费', 1, 1637987199, 0);
+INSERT INTO `oa_expense_cate`(`id`, `title`, `status`, `create_time`, `update_time`) VALUES (3, '餐补费', 1, 1638088518, 0);
 
 -- ----------------------------
 -- Table structure for oa_expense_file_interfix