Browse Source

Fix 修复无法创建任务的问题,优化前端选择设备维修人员

Yue 2 weeks ago
parent
commit
42a2206512

+ 5 - 4
SERVER/ChickenFarmV3/.script/sql/new/init_y.sql

@@ -131,15 +131,16 @@ CREATE TABLE `d_device_task`  (
       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务ID',
       `task_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '保养任务名称',
       `task_desc` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '保养任务描述',
-      `task_type` tinyint NOT NULL COMMENT '任务类型(1:设备保养 2:设备清洁)',
+      `task_type` tinyint NOT NULL COMMENT '任务类型(1:设备保养 2:设备清洁 3:设备消毒)',
+      `clean_type` tinyint NULL COMMENT '清洁类型(1:清洁 2:消毒)',
       `device_id` bigint NOT NULL COMMENT '设备ID',
       `cycle` float NOT NULL default 0 COMMENT '保养周期(小时)',
       `executor_id` bigint NOT NULL COMMENT '执行责任人ID',
       `acceptor_id` bigint NOT NULL COMMENT '验收责任人ID',
       `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0:启用 1:停用)',
-      `startTime` datetime NULL DEFAULT NULL COMMENT '开始时间',
-      `endTime` datetime NULL DEFAULT NULL COMMENT '结束时间',
-      `lastCreateTime` datetime NULL DEFAULT NULL COMMENT '最后创建工单时间',
+      `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
+      `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
+      `last_create_time` datetime NULL DEFAULT NULL COMMENT '最后创建工单时间',
       `create_org` bigint NULL DEFAULT NULL COMMENT '创建组织',
       `create_by` bigint NULL DEFAULT NULL COMMENT '创建者',
       `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',

+ 7 - 7
SERVER/ChickenFarmV3/vb-admin/src/main/resources/application-dev.yml

@@ -24,12 +24,12 @@ spring:
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
           # url: jdbc:mysql://127.0.0.1:3326/ChickenFarmDB_DEV?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          url: jdbc:mysql://192.168.0.104:3316/ChickenFarmDB_DEV2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          #url: jdbc:mysql://192.168.0.81:3326/ChickenFarmDB_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          #          url: jdbc:mysql://192.168.0.104:3316/ChickenFarmDB_DEV2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          url: jdbc:mysql://192.168.0.81:3326/ChickenFarmDB_V2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
           username: root
           # password: root
-          password: 123456
-          #password: rootcf
+          #          password: 123456
+          password: rootcf
         #        # 从库数据源
         #        slave:
         #          lazy: true
@@ -39,9 +39,9 @@ spring:
         #          username:
         #          password:
         # 需要和sharding.yaml--->databaseName的值要一致,不然无法识别数据源
-#        sharding:
-#          driverClassName: org.apache.shardingsphere.driver.ShardingSphereDriver
-#          url: jdbc:shardingsphere:classpath:sharding-dev.yaml
+      #        sharding:
+      #          driverClassName: org.apache.shardingsphere.driver.ShardingSphereDriver
+      #          url: jdbc:shardingsphere:classpath:sharding-dev.yaml
       hikari:
         # 最大连接池数量
         maxPoolSize: 20

+ 2 - 1
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/controller/InspectionRuleController.java

@@ -1,6 +1,7 @@
 package cn.vber.device.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.dev33.satoken.annotation.SaMode;
 import cn.hutool.core.io.FileUtil;
 import cn.vber.common.core.domain.R;
 import cn.vber.common.core.utils.StringUtils;
@@ -71,7 +72,7 @@ public class InspectionRuleController extends BaseController {
      *
      * @param id 主键
      */
-    @SaCheckPermission("device:inspection:query")
+    @SaCheckPermission(value = {"device:inspection:query", "device:inspection:checkin"}, mode = SaMode.OR)
     @GetMapping("/{id}")
     public R<InspectionRuleVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
         return R.ok(inspectionRuleService.queryById(id));

+ 1 - 2
SERVER/ChickenFarmV3/vb-modules/vb-device/src/main/java/cn/vber/device/domain/bo/DeviceTaskBo.java

@@ -49,9 +49,8 @@ public class DeviceTaskBo extends BaseEntity {
     private Integer taskType;
 
     /**
-     * 清洁类型(1:清洁 2:消毒 3:定期清洁 4:定期消毒
+     * 清洁类型(1:清洁 2:消毒)
      */
-    @NotNull(message = "清洁类型(1:清洁 2:消毒 3:定期清洁 4:定期消毒)不能为空", groups = {AddGroup.class, EditGroup.class})
     private Integer cleanType;
 
     /**

+ 35 - 15
UI/VB.VUE/src/views/biosecurity/task/index.vue

@@ -2,6 +2,7 @@
 import apis from "@a"
 import dayjs from "dayjs"
 
+const deviceUsers = ref([])
 const tableRef = ref()
 const modalRef = ref()
 const deviceSelectRef = ref()
@@ -18,7 +19,7 @@ const opts = reactive({
 			tooltip: true
 		},
 		// {field: "taskType", name: "任务类型", visible: true, isSort: false, width: 100},
-		// {field: "cleanType", name: "清洁类型", visible: true, isSort: false, width: 100},
+		{ field: "cleanType", name: "清洁类型", visible: true, isSort: false, width: 100 },
 		{
 			field: "deviceName",
 			name: "设备名称",
@@ -241,29 +242,39 @@ const opts = reactive({
 			component: "I"
 		},
 		{
-			field: "executorName",
-			disabled: true,
+			field: "executorId",
 			label: "执行责任人",
 			class: "w-100",
 			required: true,
-			placeholder: "请输入执行责任人",
-			component: "I",
-			append: "icon",
-			appendClickFunc: () => {
-				handleOpenUserSelect("executor")
+			placeholder: "请选择执行责任人",
+			component: "VS",
+			data: () => {
+				return deviceUsers.value.map((v) => {
+					return { label: v.nickname + "(" + v.username + ")", value: v.userId }
+				})
+			},
+			props: {
+				placeholder: "请选择执行责任人",
+				type: "select",
+				valueIsNumber: 1
 			}
 		},
 		{
-			field: "acceptorName",
-			disabled: true,
+			field: "acceptorId",
 			label: "验收责任人",
 			class: "w-100",
 			required: true,
-			placeholder: "请输入验收责任人",
-			component: "I",
-			append: "icon",
-			appendClickFunc: () => {
-				handleOpenUserSelect("acceptor")
+			placeholder: "请选择验收责任人",
+			component: "VS",
+			data: () => {
+				return deviceUsers.value.map((v) => {
+					return { label: v.nickname + "(" + v.username + ")", value: v.userId }
+				})
+			},
+			props: {
+				placeholder: "请输入验收责任人",
+				type: "select",
+				valueIsNumber: 1
 			}
 		},
 		{
@@ -400,6 +411,15 @@ function onUserSelectConfirm(data) {
 		form.value.acceptorName = data[0].nickName
 	}
 }
+
+function init() {
+	apis.device.deviceOrderApi.getAssUsers().then((res: any) => {
+		deviceUsers.value = res.data
+	})
+}
+onMounted(() => {
+	init()
+})
 </script>
 <template>
 	<div class="app-container">

+ 35 - 28
UI/VB.VUE/src/views/device/deviceMaintenanceTask/index.vue

@@ -2,6 +2,7 @@
 import apis from "@a"
 import dayjs from "dayjs"
 
+const deviceUsers = ref([])
 const tableRef = ref()
 const modalRef = ref()
 const deviceSelectRef = ref()
@@ -67,7 +68,6 @@ const opts = reactive({
 	queryParams: {
 		taskName: undefined,
 		taskType: 1,
-		cleanType: undefined,
 		deviceId: undefined,
 		deviceName: undefined,
 		status: undefined
@@ -207,19 +207,7 @@ const opts = reactive({
 		// 		valueIsNumber: 1
 		// 	}
 		// },
-		// {
-		// 	field: "cleanType",
-		// 	label: "清洁类型",
-		// 	class: "w-100",
-		// 	required: true,
-		// 	component: "Dict",
-		// 	props: {
-		// 		placeholder: "请选择清洁类型",
-		// 		dictType: "device_clean_type",
-		// 		type: "select",
-		// 		valueIsNumber: 1
-		// 	}
-		// },
+
 		{
 			field: "deviceName",
 			disabled: true,
@@ -242,29 +230,39 @@ const opts = reactive({
 			component: "I"
 		},
 		{
-			field: "executorName",
-			disabled: true,
+			field: "executorId",
 			label: "执行责任人",
 			class: "w-100",
 			required: true,
-			placeholder: "请输入执行责任人",
-			component: "I",
-			append: "icon",
-			appendClickFunc: () => {
-				handleOpenUserSelect("executor")
+			placeholder: "请选择执行责任人",
+			component: "VS",
+			data: () => {
+				return deviceUsers.value.map((v) => {
+					return { label: v.nickname + "(" + v.username + ")", value: v.userId }
+				})
+			},
+			props: {
+				placeholder: "请选择执行责任人",
+				type: "select",
+				valueIsNumber: 1
 			}
 		},
 		{
-			field: "acceptorName",
-			disabled: true,
+			field: "acceptorId",
 			label: "验收责任人",
 			class: "w-100",
 			required: true,
-			placeholder: "请输入验收责任人",
-			component: "I",
-			append: "icon",
-			appendClickFunc: () => {
-				handleOpenUserSelect("acceptor")
+			placeholder: "请选择验收责任人",
+			component: "VS",
+			data: () => {
+				return deviceUsers.value.map((v) => {
+					return { label: v.nickname + "(" + v.username + ")", value: v.userId }
+				})
+			},
+			props: {
+				placeholder: "请输入验收责任人",
+				type: "select",
+				valueIsNumber: 1
 			}
 		},
 		{
@@ -401,6 +399,15 @@ function onUserSelectConfirm(data) {
 		form.value.acceptorName = data[0].nickName
 	}
 }
+
+function init() {
+	apis.device.deviceOrderApi.getAssUsers().then((res: any) => {
+		deviceUsers.value = res.data
+	})
+}
+onMounted(() => {
+	init()
+})
 </script>
 <template>
 	<div class="app-container">

+ 21 - 2
UI/VB.VUE/src/views/device/inspection/index.vue

@@ -4,6 +4,7 @@ import dayjs from "dayjs"
 import CheckinLog from "./_checkinLog.vue"
 import { Vue3NextQrcode } from "vue3-next-qrcode"
 
+const deviceUsers = ref([])
 const tableRef = ref()
 const modalRef = ref()
 const opts = reactive({
@@ -208,8 +209,18 @@ const opts = reactive({
 			label: "执行人",
 			class: "w-100",
 			required: false,
-			placeholder: "请输入执行人",
-			component: "I"
+			placeholder: "请选择执行人",
+			component: "VS",
+			data: () => {
+				return deviceUsers.value.map((v) => {
+					return { label: v.nickname + "(" + v.username + ")", value: v.userId }
+				})
+			},
+			props: {
+				placeholder: "请选择执行人",
+				type: "select",
+				valueIsNumber: 1
+			}
 		}
 	] as any,
 	resetForm: () => {
@@ -351,6 +362,14 @@ function handleLogs(row: any) {
 		logModalRef.value.show()
 	})
 }
+function init() {
+	apis.device.deviceOrderApi.getAssUsers().then((res: any) => {
+		deviceUsers.value = res.data
+	})
+}
+onMounted(() => {
+	init()
+})
 </script>
 <template>
 	<div class="app-container">