diff --git a/docsql/2026/04/多考勤系统.md b/docsql/2026/04/多考勤系统.md
index cfd03e48..27b06c54 100644
--- a/docsql/2026/04/多考勤系统.md
+++ b/docsql/2026/04/多考勤系统.md
@@ -30,3 +30,38 @@ AND enabled = 1
LIMIT 1
)
WHERE a.cfg_id IS NULL;
+
+
+### 3.性能优化
+
+
+-- 主表复合索引
+CREATE INDEX idx_pro_mobile_attendance_project_att ON pro_mobile_attendance_data(project_id, att_date DESC, id DESC);
+
+-- 用户表索引
+CREATE INDEX idx_pro_project_users_id ON pro_project_info_subdepts_users(user_id);
+
+-- 字典表索引
+CREATE INDEX idx_sys_dict_type_value ON sys_dict_data(dict_type, dict_value);
+
+### 4.给attendance_cfg表中增加cfg_name varchar(100) 用于保存配置名称,前端是必填
+
+更新历史数据
+
+update attendance_cfg set cfg_name='默认配置'
+
+### 5.attendance_ubi_device表增加cfg_id int 配置编号
+
+更新历史数据
+
+UPDATE attendance_ubi_device ud
+SET cfg_id = (
+SELECT id
+FROM attendance_cfg
+WHERE project_id = ud.project_id
+AND com_id = ud.com_id
+AND is_default = 1
+AND enabled = 1
+LIMIT 1
+)
+WHERE ud.cfg_id IS NULL;
diff --git a/docsql/update_ubi_device_cfg_id.sql b/docsql/update_ubi_device_cfg_id.sql
new file mode 100644
index 00000000..76d11713
--- /dev/null
+++ b/docsql/update_ubi_device_cfg_id.sql
@@ -0,0 +1,12 @@
+-- 更新attendance_ubi_device表的cfg_id,根据project_id和com_id从attendance_cfg中找到默认配置ID
+UPDATE attendance_ubi_device ud
+SET cfg_id = (
+ SELECT id
+ FROM attendance_cfg
+ WHERE project_id = ud.project_id
+ AND com_id = ud.com_id
+ AND is_default = 1
+ AND enabled = 1
+ LIMIT 1
+)
+WHERE ud.cfg_id IS NULL;
\ No newline at end of file
diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceCfg.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceCfg.java
index dc6fbea4..aa7e92f6 100644
--- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceCfg.java
+++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceCfg.java
@@ -25,6 +25,10 @@ public class AttendanceCfg extends BaseEntity
@Excel(name = "分包单位")
private Long projectId;
+ /** 配置名称 */
+ @Excel(name = "配置名称")
+ private String cfgName;
+
/** 厂商编号(参考字典attendance_vendors) */
@Excel(name = " 厂商编号(参考字典attendance_vendors)")
private String vendorsCode;
@@ -95,6 +99,15 @@ public class AttendanceCfg extends BaseEntity
{
return projectId;
}
+ public void setCfgName(String cfgName)
+ {
+ this.cfgName = cfgName;
+ }
+
+ public String getCfgName()
+ {
+ return cfgName;
+ }
public void setVendorsCode(String vendorsCode)
{
this.vendorsCode = vendorsCode;
diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceUbiDevice.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceUbiDevice.java
index 2489d2b1..4d81e598 100644
--- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceUbiDevice.java
+++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/AttendanceUbiDevice.java
@@ -47,6 +47,10 @@ public class AttendanceUbiDevice extends BaseEntity
@Excel(name = "设备序列号")
private String deviceNo;
+ /** 配置编号 */
+ @Excel(name = "配置编号")
+ private Long cfgId;
+
/** 扩展字段(uface 设备(recType 设备的识别方式, 默认为 1) */
@Excel(name = "扩展字段", readConverterExp = "u=face,设=备(recType,设=备的识别方式,,默=认为,1=")
private String addition;
@@ -225,6 +229,15 @@ public class AttendanceUbiDevice extends BaseEntity
{
return deviceNo;
}
+ public void setCfgId(Long cfgId)
+ {
+ this.cfgId = cfgId;
+ }
+
+ public Long getCfgId()
+ {
+ return cfgId;
+ }
public void setAddition(String addition)
{
this.addition = addition;
diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/AttendanceCfgMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/AttendanceCfgMapper.java
index 044a8600..a272155d 100644
--- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/AttendanceCfgMapper.java
+++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/AttendanceCfgMapper.java
@@ -70,8 +70,4 @@ public interface AttendanceCfgMapper
*/
AttendanceCfg selectDefaultCfgByProjectAndCom(@Param("projectId") Long projectId, @Param("comId") Long comId);
- /**
- * 根据设备编号查询默认配置
- */
- AttendanceCfg selectDefaultCfgByDeviceNo(@Param("deviceNo") String deviceNo);
}
diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceCfgMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceCfgMapper.xml
index 313e7057..ece941ad 100644
--- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceCfgMapper.xml
+++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceCfgMapper.xml
@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- SELECT ac.id, ac.com_id, ac.project_id, ac.vendors_code, ac.vendors_parameter, ac.enabled, ac.is_default, ac.state, ac.remark, ac.is_del, ac.create_by, ac.create_time, ac.update_by
+ SELECT ac.id, ac.com_id, ac.project_id, ac.cfg_name, ac.vendors_code, ac.vendors_parameter, ac.enabled, ac.is_default, ac.state, ac.remark, ac.is_del, ac.create_by, ac.create_time, ac.update_by
, ac.update_time,dp.`dept_name` comp_name,pp.`project_name`,dic.`dict_label` vendors_name,sd.sub_dept_name dept_name,ac.dept_id
FROM attendance_cfg ac
LEFT JOIN sys_dept dp ON ac.`com_id`=dp.`dept_id`
@@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ac.enabled = #{enabled}
and ac.state = #{state}
and ac.is_del = #{isDel}
+ and ac.cfg_name = #{cfgName}
@@ -64,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
vendors_parameter,
enabled,
is_default,
+ cfg_name,
state,
remark,
is_del,
@@ -80,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{vendorsParameter},
#{enabled},
#{isDefault},
+ #{cfgName},
#{state},
#{remark},
#{isDel},
@@ -100,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
vendors_parameter = #{vendorsParameter},
enabled = #{enabled},
is_default = #{isDefault},
+ cfg_name = #{cfgName},
state = #{state},
remark = #{remark},
is_del = #{isDel},
@@ -130,16 +135,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ac.project_id = #{projectId} and ac.com_id = #{comId} and ac.is_default = 1 and ac.enabled = 1
limit 1
-
-
\ No newline at end of file
diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceUbiDeviceMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceUbiDeviceMapper.xml
index ecd9b0b8..38a2351c 100644
--- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceUbiDeviceMapper.xml
+++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/AttendanceUbiDeviceMapper.xml
@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
@@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- select ud.id, ud.com_id, ud.project_id, ud.name, ud.tag, ud.scene_guid, ud.source, ud.device_no, ud.addition, ud.bind_default_scene, ud.force_empty_device,
+ select ud.id, ud.com_id, ud.project_id, ud.name, ud.tag, ud.scene_guid, ud.source, ud.device_no, ud.cfg_id, ud.addition, ud.bind_default_scene, ud.force_empty_device,
ud.direction,ud.channel,
ud.work_area_id,
ud.device_model, ud.device_state, ud.rec_type, ud.online_state, ud.version_no, ud.last_active_time, ud.has_register, ud.state, ud.remark, ud.is_del,
@@ -75,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ud.has_register = #{hasRegister}
and ud.state = #{state}
and ud.is_del = #{isDel}
+ and ud.cfg_id = #{cfgId}
@@ -93,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
id,
com_id,
project_id,
+ cfg_id,
name,
tag,
scene_guid,
@@ -124,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id},
#{comId},
#{projectId},
+ #{cfgId},
#{name},
#{tag},
#{sceneGuid},
@@ -158,11 +162,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
com_id = #{comId},
project_id = #{projectId},
+ cfg_id = #{cfgId},
name = #{name},
tag = #{tag},
scene_guid = #{sceneGuid},
source = #{source},
device_no = #{deviceNo},
+ cfg_id = #{cfgId},
addition = #{addition},
bind_default_scene = #{bindDefaultScene},
force_empty_device = #{forceEmptyDevice},
diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java
index 3a2c236c..b5d181d0 100644
--- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java
+++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java
@@ -127,9 +127,8 @@ public class UniCallBackController {
if(device==null){
return AjaxResult.error("没有查询到设备No");
}
-
- AttendanceCfg cfg = attendanceCfgService.selectDefaultCfgByDeviceNo(deviceNo);
- Long cfgId = (cfg != null && cfg.getId() != null) ? cfg.getId() : 0L;
+
+ Long cfgId =device.getCfgId();
ProMobileAttendanceData attendanceData=new ProMobileAttendanceData();
attendanceData.setCfgId(cfgId);
if(list.size()==0){
diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IAttendanceCfgService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IAttendanceCfgService.java
index a646322b..bf53829f 100644
--- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IAttendanceCfgService.java
+++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IAttendanceCfgService.java
@@ -74,8 +74,4 @@ public interface IAttendanceCfgService
*/
AttendanceCfg getDefaultAttendanceCfg(Long projectId, Long comId);
- /**
- * 根据设备编号查询默认配置
- */
- AttendanceCfg selectDefaultCfgByDeviceNo(String deviceNo);
}
diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/AttendanceCfgServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/AttendanceCfgServiceImpl.java
index 7afecf32..77aaf43f 100644
--- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/AttendanceCfgServiceImpl.java
+++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/AttendanceCfgServiceImpl.java
@@ -56,15 +56,18 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
@Override
public int insertAttendanceCfg(AttendanceCfg attendanceCfg)
{
+ // 检查配置名称在同一项目下是否唯一
AttendanceCfg query = new AttendanceCfg();
query.setProjectId(attendanceCfg.getProjectId());
+ query.setComId(attendanceCfg.getComId());
+ query.setCfgName(attendanceCfg.getCfgName());
List cfgs = attendanceCfgMapper.selectAttendanceCfgList(query);
if(cfgs.size()>0){
- throw new ServiceException("当前项目已配置考勤信息...");
+ throw new ServiceException("当前项目下已存在相同名称的配置...");
}
- if(attendanceCfg.getEnabled() != null || attendanceCfg.getEnabled() == 0L){
+ if(attendanceCfg.getEnabled() != null && attendanceCfg.getEnabled() == 0L){
attendanceCfg.setIsDefault(0L);
} else if(attendanceCfg.getIsDefault() == null){
attendanceCfg.setIsDefault(1L);
@@ -84,8 +87,23 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
@Override
public int updateAttendanceCfg(AttendanceCfg attendanceCfg)
{
+ // 检查配置名称在同一项目下是否唯一(排除当前配置)
+ AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
+ if(currentCfg != null && !currentCfg.getCfgName().equals(attendanceCfg.getCfgName())){
+ AttendanceCfg query = new AttendanceCfg();
+ query.setProjectId(currentCfg.getProjectId());
+ query.setComId(currentCfg.getComId());
+ query.setCfgName(attendanceCfg.getCfgName());
+ List cfgs = attendanceCfgMapper.selectAttendanceCfgList(query);
+
+ for(AttendanceCfg cfg : cfgs){
+ if(!cfg.getId().equals(attendanceCfg.getId())){
+ throw new ServiceException("当前项目下已存在相同名称的配置...");
+ }
+ }
+ }
+
if(attendanceCfg.getIsDefault() != null && attendanceCfg.getIsDefault() == 1L){
- AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
if(currentCfg != null && currentCfg.getProjectId() != null){
AttendanceCfg query = new AttendanceCfg();
query.setProjectId(currentCfg.getProjectId());
@@ -99,8 +117,9 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
}
}
- AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
- if(currentCfg != null && currentCfg.getIsDefault() != null && currentCfg.getIsDefault() == 1L && attendanceCfg.getIsDefault() != null){
+ // 已在方法开头获取过currentCfg,无需重复获取
+ // AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
+ if(currentCfg != null && currentCfg.getIsDefault() != null && currentCfg.getIsDefault() == 1L && attendanceCfg.getIsDefault() != null && attendanceCfg.getIsDefault() == 0L){
throw new ServiceException("不能修改唯一默认配置为非默认");
}
@@ -185,11 +204,4 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
return attendanceCfgMapper.selectDefaultCfgByProjectAndCom(projectId, comId);
}
- /**
- * 根据设备编号查询默认配置
- */
- @Override
- public AttendanceCfg selectDefaultCfgByDeviceNo(String deviceNo) {
- return attendanceCfgMapper.selectDefaultCfgByDeviceNo(deviceNo);
- }
}
diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/UniUtils.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/UniUtils.java
index b43e4d0c..fc7aea9f 100644
--- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/UniUtils.java
+++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/UniUtils.java
@@ -7,6 +7,7 @@ import okhttp3.*;
import java.io.IOException;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
public class UniUtils {
public static final String UNIBASE="http://wo-api.uni-ubi.com/";
@@ -26,6 +27,12 @@ public class UniUtils {
public static final String AUTHDEVICE=UNIBASE+"v2/auth/device";
public static final String AUTHDEVICEUPDATE=UNIBASE+"v2/auth/device/update";
public static final String AUTHDEVICEREVOKE=UNIBASE+"v2/auth/device/revoke";
+
+ private static final OkHttpClient client = new OkHttpClient.Builder()
+ .connectTimeout(30, TimeUnit.SECONDS)
+ .readTimeout(60, TimeUnit.SECONDS)
+ .writeTimeout(60, TimeUnit.SECONDS)
+ .build();
public static String getAuthUrl(String projectGuid){
return UNIBASE+ "/v1/"+projectGuid+"/auth";
}
@@ -47,7 +54,6 @@ public class UniUtils {
}
public static String getResult(Request request) {
- OkHttpClient client = new OkHttpClient();
Response response;
try {
response = client.newCall(request).execute();
diff --git a/yanzhu-ui-vue3/src/views/manage/attendance_cfg/index.vue b/yanzhu-ui-vue3/src/views/manage/attendance_cfg/index.vue
index 9e6e4d88..ad11967b 100644
--- a/yanzhu-ui-vue3/src/views/manage/attendance_cfg/index.vue
+++ b/yanzhu-ui-vue3/src/views/manage/attendance_cfg/index.vue
@@ -5,13 +5,17 @@
-
-
+
+
-
-
+
+
@@ -28,7 +32,8 @@
- 新增
+ 新增
-
+
+
+
+
-
-
+
+
+
-
-
+
+
@@ -118,7 +139,7 @@
-
+
@@ -137,7 +158,7 @@
-
+
@@ -211,6 +232,7 @@ const data = reactive({
})
let rules = reactive({
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
+ cfgName: [{ required: true, trigger: ['blur', 'change'], message: '请输入配置名称' }],
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
@@ -223,6 +245,7 @@ function vendorsCodeChange() {
if (form.value.vendorsCode == 'uni') {
rules = {
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
+ cfgName: [{ required: true, trigger: ['blur', 'change'], message: '请输入配置名称' }],
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
@@ -231,6 +254,7 @@ function vendorsCodeChange() {
} else if (form.value.vendorsCode == 'jgw') {
rules = {
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
+ cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
@@ -241,6 +265,7 @@ function vendorsCodeChange() {
} else if (form.value.vendorsCode == 'szj') {
rules = {
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
+ cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
@@ -249,6 +274,7 @@ function vendorsCodeChange() {
} else if (form.value.vendorsCode == 'gld') {
rules = {
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
+ cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
@@ -258,6 +284,7 @@ function vendorsCodeChange() {
} else {
rules = {
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
+ cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
@@ -440,7 +467,7 @@ function handleDelete(row) {
getList()
proxy.$modal.msgSuccess('删除成功')
})
- .catch(() => {})
+ .catch(() => { })
}
/** 导出按钮操作 */
diff --git a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/index.vue b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/index.vue
index 6f805702..9366cdbe 100644
--- a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/index.vue
+++ b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/index.vue
@@ -8,6 +8,12 @@
:value="prj.id">
+
+
+
+
+
@@ -132,6 +138,12 @@
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id"
placeholder="请选择工区" clearable style="width:300px;" />
+
+
+
+
+
@@ -155,6 +167,7 @@ import {
updateAttendance_ubi_device,
authAttendance_ubi_device,
} from '@/api/manage/attendanceubidevice'
+import { listAttendance_cfg } from '@/api/manage/attendancecfg'
import useUserStore from '@/store/modules/user'
import { findMyProjectList } from '@/api/publics'
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
@@ -181,6 +194,7 @@ const data = reactive({
projectId: null,
name: null,
tag: null,
+ cfgId: null,
sceneGuid: null,
source: null,
deviceNo: null,
@@ -204,12 +218,14 @@ const data = reactive({
source: [{ required: true, trigger: ['blur', 'change'], message: '请选择设备来源' }],
deviceNo: [{ required: true, trigger: ['blur', 'change'], message: '请输入设备序列号' }],
workAreaId: [{ required: false, trigger: 'blur', message: '请选择所属工区' }],
+ cfgId: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤配置' }],
},
projects: [],
currentPrjId: '',
mode: '',
workAreaOptions: [],
submitLoading: false,
+ cfgOptions: [],
})
const { queryParams, form, rules } = toRefs(data)
@@ -279,6 +295,7 @@ function reset() {
remark: null,
isDel: null,
workAreaId: null,
+ cfgId: null,
createBy: null,
createTime: null,
updateBy: null,
@@ -316,6 +333,7 @@ function handleAdd() {
form.value.projectId = userStore.currentPrjId
form.value.projectName = userStore.currentProName
form.value.source = ubi_device_source.value[0].value
+ getCfgList()
open.value = true
title.value = '添加宇泛的设备信息'
}
@@ -330,6 +348,7 @@ function handleUpdate(row) {
const _id = row.id || ids.value
getAttendance_ubi_device(_id).then((response) => {
form.value = response.data
+ getCfgList()
open.value = true
title.value = '修改宇泛的设备信息'
})
@@ -395,8 +414,18 @@ function getWorkAreaTree() {
});
}
+/** 查询配置项列表 */
+function getCfgList() {
+ listAttendance_cfg({ projectId: userStore.currentPrjId, pageNum: 1, pageSize: 100 }).then(response => {
+ data.cfgOptions = response.rows || []
+ queryParams.value.cfgId = data.cfgOptions[0]?.id || null
+ getList()
+ });
+}
+
+
-getList()
getProjectList()
getWorkAreaTree()
+getCfgList()
diff --git a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue
index 351f867b..2c954b82 100644
--- a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue
+++ b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue
@@ -14,7 +14,7 @@
{{ scope.row.deviceNo
- }}
+ }}
@@ -110,7 +110,8 @@
-
+
@@ -122,8 +123,8 @@
@@ -144,6 +145,7 @@ const workAreaList = ref([]);
const workAreaOptions = ref([]);
const open = ref(false);
const loading = ref(true);
+const submitLoading = ref(false);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
@@ -191,6 +193,8 @@ function handleAuth(row) {
/** 查询宇泛的设备信息列表 */
function getList() {
+
+ queryParams.value.cfgId = data.row.id;
queryParams.value.projectId = data.row.projectId
loading.value = true;
listAttendance_ubi_device(queryParams.value).then(response => {
@@ -288,19 +292,27 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["attendance_ubi_deviceRef"].validate(valid => {
if (valid) {
+ submitLoading.value = true;
form.value.comId = data.row.comId;
form.value.name = form.value.deviceNo;
+ form.value.cfgId = data.row.id;
if (form.value.id != null) {
updateAttendance_ubi_device(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
+ submitLoading.value = false;
getList();
+ }).catch(() => {
+ submitLoading.value = false;
});
} else {
addAttendance_ubi_device(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
+ submitLoading.value = false;
getList();
+ }).catch(() => {
+ submitLoading.value = false;
});
}
}