lsw 9 月之前
父節點
當前提交
9d79537734

+ 1 - 0
.gitignore

@@ -50,3 +50,4 @@ nbdist/
 /app/dist/
 /website-red/node_modules/
 /website-red/h5/
+/app/.hbuilderx/

+ 16 - 0
app/.hbuilderx/launch.json

@@ -0,0 +1,16 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"mp-weixin" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 38 - 0
app/common/common.scss

@@ -59,3 +59,41 @@
 	padding: 5px;
 	margin-top: 15px;
 }
+.msilde {
+	.top {
+		padding: 10px;
+		text-align: center;
+		font-size: 15px;
+		color: #535353;
+		.icon {
+			padding-left: 5px;
+		}
+	}
+	.left {
+		position: fixed;
+		width: 25%;
+		overflow-y: auto;
+		z-index: 2;
+		height: 95%;
+		.item {
+			padding: 13px 8px 13px 8px;
+			font-size: 14px;
+			&.active {
+				background-color: white;
+				color: $main-color;
+			}
+		}
+	}
+	.right {
+		position: fixed;
+		height: 100%;
+		width: 80%;
+		overflow-y: auto;
+		left: 25%;
+		z-index: 1;
+		background-color: white;
+		.list {
+			padding: 10px 10px 85px 10px;
+		}
+	}
+}

+ 2 - 6
app/manifest.json

@@ -98,18 +98,14 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "wxf07c98cd41e54b21",
+        "appid" : "wx25d3f9356f5fdf80",
         "setting" : {
             "urlCheck" : false,
             "minified" : true
         },
         "usingComponents" : true,
         "requiredPrivateInfos" : [ "chooseLocation", "getLocation" ],
-        "permission" : {
-            "scope.userLocation" : {
-                "desc" : "你的位置信息将用于获取工作地址与你的位置距离"
-            }
-        }
+        "permission" : {}
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 23 - 55
app/pages/knowledge/index.vue

@@ -1,16 +1,19 @@
 <template>
-	<view>
-		<view class="tab">
-			<u-tabs :list="tab" keyName="dictLabel" @click="click"></u-tabs>
+	<view class="msilde">
+		<view class="top">
+			<u-search placeholder="搜索标题" bgColor="white" :showAction="false"></u-search>
 		</view>
-		<view class="list">
-			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
-				<view class="title omit">
-					<text class="icon" v-if="item.top === 1">&#xe61f;</text>
-					<text>{{ item.title }}</text>
-				</view>
-				<view class="desc">
-					<text>发布于 {{ item.createTime }}</text>
+		<view class="left">
+			<view class="item" :class="{ active: index == current }" v-for="(item, index) in type_list" :key="index" @click="selected(item, index)">{{ item.dictLabel }}</view>
+		</view>
+		<view class="right">
+			<view class="list">
+				<view class="u_item" v-for="(item, index) in list" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
+					<view class="con">
+						<view class="name">{{ item.name }}</view>
+						<view class="labels omit">{{ item.labels }}</view>
+						<view class="labels">{{ item.columnName }}</view>
+					</view>
 				</view>
 			</view>
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
@@ -23,23 +26,18 @@
 export default {
 	data() {
 		return {
-			tab: [],
+			type_list: [],
+			current: 0,
 			list: [],
-			param: { pageNum: 1, pageSize: 10},
+			param: { pageNum: 1, pageSize: 10 },
 			loadMore: true
 		};
 	},
 	onLoad(e) {
-		this.param.type = e.type || '新闻资讯';
 		this.getType();
 		this.getData();
 	},
 	methods: {
-		click(e) {
-			this.current = e.index;
-			this.param.type = e.dictValue;
-			this.refresh();
-		},
 		getData() {
 			this.http.request({
 				url: '/app/knowledge/list',
@@ -57,25 +55,21 @@ export default {
 		getType() {
 			this.http.request({
 				url: '/app/common/type/knowledge_type',
-				loading: 'false',
 				success: (res) => {
-					this.tab = res.data.data;
-					let obj = this.tab.filter((item) => item.dictLabel == this.param.type);
-					if (obj.length > 0) {
-						this.current = this.tab.indexOf(obj[0]);
-					}
+					this.type_list = res.data.data;
+					this.type_list.unshift({ dictLabel: '全部类型', dictValue: '' });
 				}
 			});
 		},
-		go(url) {
-			uni.navigateTo({ url: url });
-		},
 		//刷新数据
 		refresh() {
 			this.loadMore = true;
 			this.param.pageNum = 1;
 			this.list = [];
 			this.getData();
+		},
+		go(url) {
+			uni.navigateTo({ url: url });
 		}
 	},
 	//下拉刷新
@@ -95,30 +89,4 @@ export default {
 };
 </script>
 
-<style lang="scss">
-.list {
-	padding: 12px;
-	.item {
-		border-radius: 5px;
-		padding: 15px 12px 15px 12px;
-		margin-bottom: 10px;
-		overflow: hidden;
-		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-		.title {
-			font-size: 15px;
-			font-weight: bold;
-			.icon {
-				color: orangered;
-				padding-right: 3px;
-			}
-		}
-		.desc {
-			font-size: 14px;
-			padding-top: 10px;
-			text {
-				padding-right: 30px;
-			}
-		}
-	}
-}
-</style>
+<style lang="scss"></style>

+ 45 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_CommonController.java

@@ -0,0 +1,45 @@
+package com.ruoyi.web.work.api;
+
+import com.google.code.kaptcha.Producer;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysDictTypeService;
+import com.ruoyi.web.work.api.config.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/app/common")
+public class Api_CommonController extends BaseController {
+
+    @Autowired
+    private RedisCache redisCache;
+
+    @Resource(name = "captchaProducerMath")
+    private Producer captchaProducerMath;
+
+    @Autowired
+    private ISysDictTypeService dictTypeService;
+
+    /**
+     * 根据字典类型查询字典数据信息
+     */
+    @GetMapping(value = "/type/{dictType}")
+    public AjaxResult dictType(@PathVariable String dictType) {
+        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
+        if (StringUtils.isNull(data)) {
+            data = new ArrayList<>();
+        }
+        return AjaxResult.success(data);
+    }
+}
+

+ 40 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_KnowledgeController.java

@@ -0,0 +1,40 @@
+package com.ruoyi.web.work.api;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.web.work.domain.Knowledge;
+import com.ruoyi.web.work.service.IKnowledgeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 知识库管理
+ *
+ * @author lsw
+ * @date 2024-07-10
+ */
+@RestController
+@RequestMapping("/app/knowledge")
+public class Api_KnowledgeController extends BaseController {
+    @Autowired
+    private IKnowledgeService knowledgeService;
+
+    @GetMapping("/list")
+    public TableDataInfo list(Knowledge knowledge) {
+        startPage();
+        List<Knowledge> list = knowledgeService.selectList(knowledge);
+        return getDataTable(list);
+    }
+
+    @GetMapping(value = "/detail/{id}")
+    public AjaxResult detail(@PathVariable("id") Long id) {
+        return AjaxResult.success(knowledgeService.getById(id));
+    }
+
+}

+ 4 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/Knowledge.java

@@ -22,9 +22,6 @@ public class Knowledge extends BaseData {
 
     private Long id;
 
-    @ApiModelProperty(value = "关联账号")
-    private Long userId;
-
     @ApiModelProperty(value = "分类")
     private String type;
 
@@ -51,6 +48,10 @@ public class Knowledge extends BaseData {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+    @ApiModelProperty(value = "关联账号")
+    @TableField(fill = FieldFill.INSERT)
+    private Long userId;
+
     @TableField(fill = FieldFill.INSERT)
     private Long deptId;
 

+ 20 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/base/BaseData.java

@@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author lsw
  * @date 2024-04-16
@@ -14,6 +17,10 @@ import lombok.experimental.Accessors;
 public class BaseData {
     private static final long serialVersionUID = 1L;
 
+    //部门名称
+    @TableField(exist = false)
+    private String deptName;
+
     //开始日期
     @TableField(exist = false)
     @JsonIgnore
@@ -24,8 +31,18 @@ public class BaseData {
     @JsonIgnore
     private String dateEnd;
 
-    //结算单审核人
     @TableField(exist = false)
-    @JsonIgnore
-    private boolean auditors;
+    private Map<String, Object> params;
+
+    public Map<String, Object> getParams() {
+        if (params == null) {
+            params = new HashMap<>();
+            params.put("common", "(p.dept_id = #{deptId} OR p.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))");
+        }
+        return params;
+    }
+
+    public void setParams(Map<String, Object> params) {
+        this.params = params;
+    }
 }

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -97,8 +97,8 @@ qiniu:
   bucketname: xiaoshushu
 # 微信小程序/公众号配置
 wx:
-  appid: wx017aa52f25410857
-  appSecret: 9e0dcfbfd286181c75a8609d719fc34f
+  appid: wx25d3f9356f5fdf80
+  appSecret: dc584fd3c332b3f597321b3f5f33d6a0
 # 阿里云存储
 oss:
   callback: http://39.96.28.235/api/oss/callback

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusMetaObjectHandler.java

@@ -16,6 +16,7 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
             if (SecurityUtils.getLoginUser().getDeptId() != null) {
                 this.setFieldValByName("deptId", SecurityUtils.getLoginUser().getDeptId(), metaObject);
             }
+            this.setFieldValByName("userId", SecurityUtils.getLoginUser().getUserId(), metaObject);
             this.setFieldValByName("createBy", SecurityUtils.getLoginUser().getUsername(), metaObject);
         }
     }