考勤设备表修改
parent
e2c98b0c3a
commit
4c0425a73c
|
|
@ -30,3 +30,38 @@ AND enabled = 1
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
)
|
)
|
||||||
WHERE a.cfg_id IS NULL;
|
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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -25,6 +25,10 @@ public class AttendanceCfg extends BaseEntity
|
||||||
@Excel(name = "分包单位")
|
@Excel(name = "分包单位")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/** 配置名称 */
|
||||||
|
@Excel(name = "配置名称")
|
||||||
|
private String cfgName;
|
||||||
|
|
||||||
/** 厂商编号(参考字典attendance_vendors) */
|
/** 厂商编号(参考字典attendance_vendors) */
|
||||||
@Excel(name = " 厂商编号(参考字典attendance_vendors)")
|
@Excel(name = " 厂商编号(参考字典attendance_vendors)")
|
||||||
private String vendorsCode;
|
private String vendorsCode;
|
||||||
|
|
@ -95,6 +99,15 @@ public class AttendanceCfg extends BaseEntity
|
||||||
{
|
{
|
||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
|
public void setCfgName(String cfgName)
|
||||||
|
{
|
||||||
|
this.cfgName = cfgName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCfgName()
|
||||||
|
{
|
||||||
|
return cfgName;
|
||||||
|
}
|
||||||
public void setVendorsCode(String vendorsCode)
|
public void setVendorsCode(String vendorsCode)
|
||||||
{
|
{
|
||||||
this.vendorsCode = vendorsCode;
|
this.vendorsCode = vendorsCode;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ public class AttendanceUbiDevice extends BaseEntity
|
||||||
@Excel(name = "设备序列号")
|
@Excel(name = "设备序列号")
|
||||||
private String deviceNo;
|
private String deviceNo;
|
||||||
|
|
||||||
|
/** 配置编号 */
|
||||||
|
@Excel(name = "配置编号")
|
||||||
|
private Long cfgId;
|
||||||
|
|
||||||
/** 扩展字段(uface 设备(recType 设备的识别方式, 默认为 1) */
|
/** 扩展字段(uface 设备(recType 设备的识别方式, 默认为 1) */
|
||||||
@Excel(name = "扩展字段", readConverterExp = "u=face,设=备(recType,设=备的识别方式,,默=认为,1=")
|
@Excel(name = "扩展字段", readConverterExp = "u=face,设=备(recType,设=备的识别方式,,默=认为,1=")
|
||||||
private String addition;
|
private String addition;
|
||||||
|
|
@ -225,6 +229,15 @@ public class AttendanceUbiDevice extends BaseEntity
|
||||||
{
|
{
|
||||||
return deviceNo;
|
return deviceNo;
|
||||||
}
|
}
|
||||||
|
public void setCfgId(Long cfgId)
|
||||||
|
{
|
||||||
|
this.cfgId = cfgId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCfgId()
|
||||||
|
{
|
||||||
|
return cfgId;
|
||||||
|
}
|
||||||
public void setAddition(String addition)
|
public void setAddition(String addition)
|
||||||
{
|
{
|
||||||
this.addition = addition;
|
this.addition = addition;
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,4 @@ public interface AttendanceCfgMapper
|
||||||
*/
|
*/
|
||||||
AttendanceCfg selectDefaultCfgByProjectAndCom(@Param("projectId") Long projectId, @Param("comId") Long comId);
|
AttendanceCfg selectDefaultCfgByProjectAndCom(@Param("projectId") Long projectId, @Param("comId") Long comId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询默认配置
|
|
||||||
*/
|
|
||||||
AttendanceCfg selectDefaultCfgByDeviceNo(@Param("deviceNo") String deviceNo);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="comId" column="com_id" />
|
<result property="comId" column="com_id" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="projectId" column="project_id" />
|
<result property="projectId" column="project_id" />
|
||||||
|
<result property="cfgName" column="cfg_name" />
|
||||||
<result property="vendorsCode" column="vendors_code" />
|
<result property="vendorsCode" column="vendors_code" />
|
||||||
<result property="vendorsParameter" column="vendors_parameter" />
|
<result property="vendorsParameter" column="vendors_parameter" />
|
||||||
<result property="enabled" column="enabled" />
|
<result property="enabled" column="enabled" />
|
||||||
|
|
@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAttendanceCfgVo">
|
<sql id="selectAttendanceCfgVo">
|
||||||
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
|
, 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
|
FROM attendance_cfg ac
|
||||||
LEFT JOIN sys_dept dp ON ac.`com_id`=dp.`dept_id`
|
LEFT JOIN sys_dept dp ON ac.`com_id`=dp.`dept_id`
|
||||||
|
|
@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="enabled != null "> and ac.enabled = #{enabled}</if>
|
<if test="enabled != null "> and ac.enabled = #{enabled}</if>
|
||||||
<if test="state != null "> and ac.state = #{state}</if>
|
<if test="state != null "> and ac.state = #{state}</if>
|
||||||
<if test="isDel != null "> and ac.is_del = #{isDel}</if>
|
<if test="isDel != null "> and ac.is_del = #{isDel}</if>
|
||||||
|
<if test="cfgName != null and cfgName != ''"> and ac.cfg_name = #{cfgName}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -64,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="vendorsParameter != null">vendors_parameter,</if>
|
<if test="vendorsParameter != null">vendors_parameter,</if>
|
||||||
<if test="enabled != null">enabled,</if>
|
<if test="enabled != null">enabled,</if>
|
||||||
<if test="isDefault != null">is_default,</if>
|
<if test="isDefault != null">is_default,</if>
|
||||||
|
<if test="cfgName != null">cfg_name,</if>
|
||||||
<if test="state != null">state,</if>
|
<if test="state != null">state,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="isDel != null">is_del,</if>
|
<if test="isDel != null">is_del,</if>
|
||||||
|
|
@ -80,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="vendorsParameter != null">#{vendorsParameter},</if>
|
<if test="vendorsParameter != null">#{vendorsParameter},</if>
|
||||||
<if test="enabled != null">#{enabled},</if>
|
<if test="enabled != null">#{enabled},</if>
|
||||||
<if test="isDefault != null">#{isDefault},</if>
|
<if test="isDefault != null">#{isDefault},</if>
|
||||||
|
<if test="cfgName != null">#{cfgName},</if>
|
||||||
<if test="state != null">#{state},</if>
|
<if test="state != null">#{state},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="isDel != null">#{isDel},</if>
|
<if test="isDel != null">#{isDel},</if>
|
||||||
|
|
@ -100,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="vendorsParameter != null">vendors_parameter = #{vendorsParameter},</if>
|
<if test="vendorsParameter != null">vendors_parameter = #{vendorsParameter},</if>
|
||||||
<if test="enabled != null">enabled = #{enabled},</if>
|
<if test="enabled != null">enabled = #{enabled},</if>
|
||||||
<if test="isDefault != null">is_default = #{isDefault},</if>
|
<if test="isDefault != null">is_default = #{isDefault},</if>
|
||||||
|
<if test="cfgName != null">cfg_name = #{cfgName},</if>
|
||||||
<if test="state != null">state = #{state},</if>
|
<if test="state != null">state = #{state},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="isDel != null">is_del = #{isDel},</if>
|
<if test="isDel != null">is_del = #{isDel},</if>
|
||||||
|
|
@ -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
|
where ac.project_id = #{projectId} and ac.com_id = #{comId} and ac.is_default = 1 and ac.enabled = 1
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDefaultCfgByDeviceNo" resultMap="AttendanceCfgResult">
|
|
||||||
<include refid="selectAttendanceCfgVo"/>
|
|
||||||
where exists (
|
|
||||||
select 1 from attendance_ubi_device ad
|
|
||||||
where ad.device_no = #{deviceNo}
|
|
||||||
and ad.project_id = ac.project_id
|
|
||||||
and ad.com_id = ac.com_id
|
|
||||||
)
|
|
||||||
and ac.is_default = 1 and ac.enabled = 1
|
|
||||||
limit 1
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="sceneGuid" column="scene_guid" />
|
<result property="sceneGuid" column="scene_guid" />
|
||||||
<result property="source" column="source" />
|
<result property="source" column="source" />
|
||||||
<result property="deviceNo" column="device_no" />
|
<result property="deviceNo" column="device_no" />
|
||||||
|
<result property="cfgId" column="cfg_id" />
|
||||||
<result property="addition" column="addition" />
|
<result property="addition" column="addition" />
|
||||||
<result property="bindDefaultScene" column="bind_default_scene" />
|
<result property="bindDefaultScene" column="bind_default_scene" />
|
||||||
<result property="forceEmptyDevice" column="force_empty_device" />
|
<result property="forceEmptyDevice" column="force_empty_device" />
|
||||||
|
|
@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAttendanceUbiDeviceVo">
|
<sql id="selectAttendanceUbiDeviceVo">
|
||||||
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.direction,ud.channel,
|
||||||
ud.work_area_id,
|
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,
|
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"
|
||||||
<if test="hasRegister != null "> and ud.has_register = #{hasRegister}</if>
|
<if test="hasRegister != null "> and ud.has_register = #{hasRegister}</if>
|
||||||
<if test="state != null "> and ud.state = #{state}</if>
|
<if test="state != null "> and ud.state = #{state}</if>
|
||||||
<if test="isDel != null "> and ud.is_del = #{isDel}</if>
|
<if test="isDel != null "> and ud.is_del = #{isDel}</if>
|
||||||
|
<if test="cfgId != null "> and ud.cfg_id = #{cfgId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -93,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="id != null">id,</if>
|
<if test="id != null">id,</if>
|
||||||
<if test="comId != null">com_id,</if>
|
<if test="comId != null">com_id,</if>
|
||||||
<if test="projectId != null">project_id,</if>
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="cfgId != null">cfg_id,</if>
|
||||||
<if test="name != null">name,</if>
|
<if test="name != null">name,</if>
|
||||||
<if test="tag != null">tag,</if>
|
<if test="tag != null">tag,</if>
|
||||||
<if test="sceneGuid != null">scene_guid,</if>
|
<if test="sceneGuid != null">scene_guid,</if>
|
||||||
|
|
@ -124,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="comId != null">#{comId},</if>
|
<if test="comId != null">#{comId},</if>
|
||||||
<if test="projectId != null">#{projectId},</if>
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="cfgId != null">#{cfgId},</if>
|
||||||
<if test="name != null">#{name},</if>
|
<if test="name != null">#{name},</if>
|
||||||
<if test="tag != null">#{tag},</if>
|
<if test="tag != null">#{tag},</if>
|
||||||
<if test="sceneGuid != null">#{sceneGuid},</if>
|
<if test="sceneGuid != null">#{sceneGuid},</if>
|
||||||
|
|
@ -158,11 +162,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="comId != null">com_id = #{comId},</if>
|
<if test="comId != null">com_id = #{comId},</if>
|
||||||
<if test="projectId != null">project_id = #{projectId},</if>
|
<if test="projectId != null">project_id = #{projectId},</if>
|
||||||
|
<if test="cfgId != null">cfg_id = #{cfgId},</if>
|
||||||
<if test="name != null">name = #{name},</if>
|
<if test="name != null">name = #{name},</if>
|
||||||
<if test="tag != null">tag = #{tag},</if>
|
<if test="tag != null">tag = #{tag},</if>
|
||||||
<if test="sceneGuid != null">scene_guid = #{sceneGuid},</if>
|
<if test="sceneGuid != null">scene_guid = #{sceneGuid},</if>
|
||||||
<if test="source != null">source = #{source},</if>
|
<if test="source != null">source = #{source},</if>
|
||||||
<if test="deviceNo != null">device_no = #{deviceNo},</if>
|
<if test="deviceNo != null">device_no = #{deviceNo},</if>
|
||||||
|
<if test="cfgId != null">cfg_id = #{cfgId},</if>
|
||||||
<if test="addition != null">addition = #{addition},</if>
|
<if test="addition != null">addition = #{addition},</if>
|
||||||
<if test="bindDefaultScene != null">bind_default_scene = #{bindDefaultScene},</if>
|
<if test="bindDefaultScene != null">bind_default_scene = #{bindDefaultScene},</if>
|
||||||
<if test="forceEmptyDevice != null">force_empty_device = #{forceEmptyDevice},</if>
|
<if test="forceEmptyDevice != null">force_empty_device = #{forceEmptyDevice},</if>
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,7 @@ public class UniCallBackController {
|
||||||
return AjaxResult.error("没有查询到设备No");
|
return AjaxResult.error("没有查询到设备No");
|
||||||
}
|
}
|
||||||
|
|
||||||
AttendanceCfg cfg = attendanceCfgService.selectDefaultCfgByDeviceNo(deviceNo);
|
Long cfgId =device.getCfgId();
|
||||||
Long cfgId = (cfg != null && cfg.getId() != null) ? cfg.getId() : 0L;
|
|
||||||
ProMobileAttendanceData attendanceData=new ProMobileAttendanceData();
|
ProMobileAttendanceData attendanceData=new ProMobileAttendanceData();
|
||||||
attendanceData.setCfgId(cfgId);
|
attendanceData.setCfgId(cfgId);
|
||||||
if(list.size()==0){
|
if(list.size()==0){
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,4 @@ public interface IAttendanceCfgService
|
||||||
*/
|
*/
|
||||||
AttendanceCfg getDefaultAttendanceCfg(Long projectId, Long comId);
|
AttendanceCfg getDefaultAttendanceCfg(Long projectId, Long comId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询默认配置
|
|
||||||
*/
|
|
||||||
AttendanceCfg selectDefaultCfgByDeviceNo(String deviceNo);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,15 +56,18 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
|
||||||
@Override
|
@Override
|
||||||
public int insertAttendanceCfg(AttendanceCfg attendanceCfg)
|
public int insertAttendanceCfg(AttendanceCfg attendanceCfg)
|
||||||
{
|
{
|
||||||
|
// 检查配置名称在同一项目下是否唯一
|
||||||
AttendanceCfg query = new AttendanceCfg();
|
AttendanceCfg query = new AttendanceCfg();
|
||||||
query.setProjectId(attendanceCfg.getProjectId());
|
query.setProjectId(attendanceCfg.getProjectId());
|
||||||
|
query.setComId(attendanceCfg.getComId());
|
||||||
|
query.setCfgName(attendanceCfg.getCfgName());
|
||||||
List<AttendanceCfg> cfgs = attendanceCfgMapper.selectAttendanceCfgList(query);
|
List<AttendanceCfg> cfgs = attendanceCfgMapper.selectAttendanceCfgList(query);
|
||||||
|
|
||||||
if(cfgs.size()>0){
|
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);
|
attendanceCfg.setIsDefault(0L);
|
||||||
} else if(attendanceCfg.getIsDefault() == null){
|
} else if(attendanceCfg.getIsDefault() == null){
|
||||||
attendanceCfg.setIsDefault(1L);
|
attendanceCfg.setIsDefault(1L);
|
||||||
|
|
@ -84,8 +87,23 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
|
||||||
@Override
|
@Override
|
||||||
public int updateAttendanceCfg(AttendanceCfg attendanceCfg)
|
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<AttendanceCfg> cfgs = attendanceCfgMapper.selectAttendanceCfgList(query);
|
||||||
|
|
||||||
|
for(AttendanceCfg cfg : cfgs){
|
||||||
|
if(!cfg.getId().equals(attendanceCfg.getId())){
|
||||||
|
throw new ServiceException("当前项目下已存在相同名称的配置...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(attendanceCfg.getIsDefault() != null && attendanceCfg.getIsDefault() == 1L){
|
if(attendanceCfg.getIsDefault() != null && attendanceCfg.getIsDefault() == 1L){
|
||||||
AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
|
|
||||||
if(currentCfg != null && currentCfg.getProjectId() != null){
|
if(currentCfg != null && currentCfg.getProjectId() != null){
|
||||||
AttendanceCfg query = new AttendanceCfg();
|
AttendanceCfg query = new AttendanceCfg();
|
||||||
query.setProjectId(currentCfg.getProjectId());
|
query.setProjectId(currentCfg.getProjectId());
|
||||||
|
|
@ -99,8 +117,9 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
|
// 已在方法开头获取过currentCfg,无需重复获取
|
||||||
if(currentCfg != null && currentCfg.getIsDefault() != null && currentCfg.getIsDefault() == 1L && attendanceCfg.getIsDefault() != null){
|
// AttendanceCfg currentCfg = attendanceCfgMapper.selectAttendanceCfgById(attendanceCfg.getId());
|
||||||
|
if(currentCfg != null && currentCfg.getIsDefault() != null && currentCfg.getIsDefault() == 1L && attendanceCfg.getIsDefault() != null && attendanceCfg.getIsDefault() == 0L){
|
||||||
throw new ServiceException("不能修改唯一默认配置为非默认");
|
throw new ServiceException("不能修改唯一默认配置为非默认");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,11 +204,4 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
|
||||||
return attendanceCfgMapper.selectDefaultCfgByProjectAndCom(projectId, comId);
|
return attendanceCfgMapper.selectDefaultCfgByProjectAndCom(projectId, comId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询默认配置
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public AttendanceCfg selectDefaultCfgByDeviceNo(String deviceNo) {
|
|
||||||
return attendanceCfgMapper.selectDefaultCfgByDeviceNo(deviceNo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import okhttp3.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class UniUtils {
|
public class UniUtils {
|
||||||
public static final String UNIBASE="http://wo-api.uni-ubi.com/";
|
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 AUTHDEVICE=UNIBASE+"v2/auth/device";
|
||||||
public static final String AUTHDEVICEUPDATE=UNIBASE+"v2/auth/device/update";
|
public static final String AUTHDEVICEUPDATE=UNIBASE+"v2/auth/device/update";
|
||||||
public static final String AUTHDEVICEREVOKE=UNIBASE+"v2/auth/device/revoke";
|
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){
|
public static String getAuthUrl(String projectGuid){
|
||||||
return UNIBASE+ "/v1/"+projectGuid+"/auth";
|
return UNIBASE+ "/v1/"+projectGuid+"/auth";
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +54,6 @@ public class UniUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getResult(Request request) {
|
public static String getResult(Request request) {
|
||||||
OkHttpClient client = new OkHttpClient();
|
|
||||||
Response response;
|
Response response;
|
||||||
try {
|
try {
|
||||||
response = client.newCall(request).execute();
|
response = client.newCall(request).execute();
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,17 @@
|
||||||
<el-input v-model="queryParams.comId" placeholder="请输入所属公司" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.comId" placeholder="请输入所属公司" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属项目" prop="projectId">
|
<el-form-item label="所属项目" prop="projectId">
|
||||||
<el-select :disabled="data.currentPrjId != ''" v-model="queryParams.projectId" placeholder="请选择所属项目" clearable style="width:192px;" @change="handleQuery">
|
<el-select :disabled="data.currentPrjId != ''" v-model="queryParams.projectId" placeholder="请选择所属项目"
|
||||||
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id"></el-option>
|
clearable style="width:192px;" @change="handleQuery">
|
||||||
|
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName"
|
||||||
|
:value="prj.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考勤厂商" prop="vendorsCode">
|
<el-form-item label="考勤厂商" prop="vendorsCode">
|
||||||
<el-select v-model="queryParams.vendorsCode" placeholder="请选择厂商" clearable @change="handleQuery" style="width:192px;">
|
<el-select v-model="queryParams.vendorsCode" placeholder="请选择厂商" clearable @change="handleQuery"
|
||||||
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
style="width:192px;">
|
||||||
|
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="启停状态" prop="enabled">
|
<el-form-item label="启停状态" prop="enabled">
|
||||||
|
|
@ -28,7 +32,8 @@
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['manage:attendance_cfg:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['manage:attendance_cfg:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--
|
<!--
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
|
@ -51,23 +56,25 @@
|
||||||
<el-table-column label="NO." align="center" prop="id" />
|
<el-table-column label="NO." align="center" prop="id" />
|
||||||
<el-table-column label="所属公司" align="center" prop="compName" />
|
<el-table-column label="所属公司" align="center" prop="compName" />
|
||||||
<el-table-column label="所属项目" align="center" prop="projectName" />
|
<el-table-column label="所属项目" align="center" prop="projectName" />
|
||||||
|
<el-table-column label="配置名称" align="center" prop="cfgName" />
|
||||||
<el-table-column label="考勤厂商" align="center" prop="vendorsName">
|
<el-table-column label="考勤厂商" align="center" prop="vendorsName">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span style="color: var(--el-color-warning);">{{scope.row.vendorsName }}</span>
|
<span style="color: var(--el-color-warning);">{{ scope.row.vendorsName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="实名制项目ID" align="center" prop="info.projectGuid">
|
<el-table-column label="实名制项目ID" align="center" prop="info.projectGuid">
|
||||||
<template #default="scope">{{ scope.row.info.projectGuid||scope.row.info.appProjectId}}</template>
|
<template #default="scope">{{ scope.row.info.projectGuid || scope.row.info.appProjectId }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="应用KEY" align="center" prop="info.AppKey">
|
<el-table-column label="应用KEY" align="center" prop="info.AppKey">
|
||||||
<template #default="scope">{{ scope.row.info.AppKey||scope.row.info.appId}}</template>
|
<template #default="scope">{{ scope.row.info.AppKey || scope.row.info.appId }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="应用Secret" align="center" prop="info.AppSecret">
|
<el-table-column label="应用Secret" align="center" prop="info.AppSecret">
|
||||||
<template #default="scope">{{ scope.row.info.AppSecret||scope.row.info.secret}}</template>
|
<template #default="scope">{{ scope.row.info.AppSecret || scope.row.info.secret }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否启用" align="center" prop="enabled">
|
<el-table-column label="是否启用" align="center" prop="enabled">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch v-model="scope.row.enabled" :active-value="1" @change="doUpdateRow(scope.row)" :inactive-value="0"></el-switch>
|
<el-switch v-model="scope.row.enabled" :active-value="1" @change="doUpdateRow(scope.row)"
|
||||||
|
:inactive-value="0"></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否默认" align="center" prop="isDefault">
|
<el-table-column label="是否默认" align="center" prop="isDefault">
|
||||||
|
|
@ -85,26 +92,40 @@
|
||||||
<el-table-column label="添加用户" align="center" prop="createBy" />
|
<el-table-column label="添加用户" align="center" prop="createBy" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="240">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="240">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" v-if="scope.row.vendorsCode=='uni'" icon="Football" @click="handleDeviceList(scope.row)" v-hasPermi="['manage:attendance_cfg:edit']">设备列表</el-button>
|
<el-button link type="primary" v-if="scope.row.vendorsCode == 'uni'" icon="Football"
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:attendance_cfg:edit']">修改</el-button>
|
@click="handleDeviceList(scope.row)"
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:attendance_cfg:remove']">删除</el-button>
|
v-hasPermi="['manage:attendance_cfg:edit']">设备列表</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['manage:attendance_cfg:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['manage:attendance_cfg:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改考勤配置对话框 -->
|
<!-- 添加或修改考勤配置对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
|
<el-dialog :title="title" v-model="open" width="800px" append-to-body :close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false">
|
||||||
<el-form ref="attendance_cfgRef" :model="form" :rules="rules" label-width="120px" :key="data.formKey">
|
<el-form ref="attendance_cfgRef" :model="form" :rules="rules" label-width="120px" :key="data.formKey">
|
||||||
|
<el-form-item label="配置名称" prop="cfgName" required>
|
||||||
|
<el-input v-model="form.cfgName" placeholder="请输入配置名称" style="width:300px;" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="所属项目" prop="projectId">
|
<el-form-item label="所属项目" prop="projectId">
|
||||||
<el-select :disabled="data.currentPrjId != ''||data.mode=='edit'" v-model="form.projectId" placeholder="请选择项目" style="width:300px;">
|
<el-select :disabled="data.currentPrjId != '' || data.mode == 'edit'" v-model="form.projectId"
|
||||||
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id"></el-option>
|
placeholder="请选择项目" style="width:300px;">
|
||||||
|
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName"
|
||||||
|
:value="prj.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="考勤厂商" prop="vendorsCode">
|
<el-form-item label="考勤厂商" prop="vendorsCode">
|
||||||
<el-select v-model="form.vendorsCode" placeholder="请选择厂商" @change="vendorsCodeChange" :disabled="data.mode=='edit'">
|
<el-select v-model="form.vendorsCode" placeholder="请选择厂商" @change="vendorsCodeChange"
|
||||||
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
:disabled="data.mode == 'edit'">
|
||||||
|
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="form.vendorsCode == 'uni'">
|
<template v-if="form.vendorsCode == 'uni'">
|
||||||
|
|
@ -118,7 +139,7 @@
|
||||||
<el-input v-model="form.projectGuid" placeholder="请输入项目ID" />
|
<el-input v-model="form.projectGuid" placeholder="请输入项目ID" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="form.vendorsCode=='gld' || form.vendorsCode=='jgw'">
|
<template v-if="form.vendorsCode == 'gld' || form.vendorsCode == 'jgw'">
|
||||||
<el-form-item label="APPID" prop="appId">
|
<el-form-item label="APPID" prop="appId">
|
||||||
<el-input v-model="form.appId" placeholder="请输AppId" clearable />
|
<el-input v-model="form.appId" placeholder="请输AppId" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -137,7 +158,7 @@
|
||||||
<el-input v-model="form.secret" placeholder="请输Secret" clearable />
|
<el-input v-model="form.secret" placeholder="请输Secret" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="form.vendorsCode=='jgw'">
|
<template v-if="form.vendorsCode == 'jgw'">
|
||||||
<el-form-item label="项目经理手机" prop="phone">
|
<el-form-item label="项目经理手机" prop="phone">
|
||||||
<el-input v-model="form.phone" placeholder="项目经理手机" clearable />
|
<el-input v-model="form.phone" placeholder="项目经理手机" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -211,6 +232,7 @@ const data = reactive({
|
||||||
})
|
})
|
||||||
let rules = reactive({
|
let rules = reactive({
|
||||||
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
||||||
|
cfgName: [{ required: true, trigger: ['blur', 'change'], message: '请输入配置名称' }],
|
||||||
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
||||||
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
||||||
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
||||||
|
|
@ -223,6 +245,7 @@ function vendorsCodeChange() {
|
||||||
if (form.value.vendorsCode == 'uni') {
|
if (form.value.vendorsCode == 'uni') {
|
||||||
rules = {
|
rules = {
|
||||||
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
||||||
|
cfgName: [{ required: true, trigger: ['blur', 'change'], message: '请输入配置名称' }],
|
||||||
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
||||||
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
||||||
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
||||||
|
|
@ -231,6 +254,7 @@ function vendorsCodeChange() {
|
||||||
} else if (form.value.vendorsCode == 'jgw') {
|
} else if (form.value.vendorsCode == 'jgw') {
|
||||||
rules = {
|
rules = {
|
||||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
|
||||||
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
|
@ -241,6 +265,7 @@ function vendorsCodeChange() {
|
||||||
} else if (form.value.vendorsCode == 'szj') {
|
} else if (form.value.vendorsCode == 'szj') {
|
||||||
rules = {
|
rules = {
|
||||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
|
||||||
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
|
@ -249,6 +274,7 @@ function vendorsCodeChange() {
|
||||||
} else if (form.value.vendorsCode == 'gld') {
|
} else if (form.value.vendorsCode == 'gld') {
|
||||||
rules = {
|
rules = {
|
||||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
|
||||||
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
|
@ -258,6 +284,7 @@ function vendorsCodeChange() {
|
||||||
} else {
|
} else {
|
||||||
rules = {
|
rules = {
|
||||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
cfgName: [{ required: true, trigger: 'blur', message: '请输入配置名称' }],
|
||||||
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
|
@ -440,7 +467,7 @@ function handleDelete(row) {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess('删除成功')
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@
|
||||||
:value="prj.id"></el-option>
|
:value="prj.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="考勤配置" prop="cfgId" v-if="data.cfgOptions.length > 0">
|
||||||
|
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" clearable style="width: 300px;">
|
||||||
|
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName"
|
||||||
|
:value="cfg.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="设备名称" prop="name">
|
<el-form-item label="设备名称" prop="name">
|
||||||
<el-input v-model="queryParams.name" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.name" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -132,6 +138,12 @@
|
||||||
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id"
|
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id"
|
||||||
placeholder="请选择工区" clearable style="width:300px;" />
|
placeholder="请选择工区" clearable style="width:300px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="考勤配置" prop="cfgId" v-if="data.cfgOptions.length > 0">
|
||||||
|
<el-select v-model="form.cfgId" placeholder="请选择考勤配置" clearable style="width: 300px;">
|
||||||
|
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName"
|
||||||
|
:value="cfg.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -155,6 +167,7 @@ import {
|
||||||
updateAttendance_ubi_device,
|
updateAttendance_ubi_device,
|
||||||
authAttendance_ubi_device,
|
authAttendance_ubi_device,
|
||||||
} from '@/api/manage/attendanceubidevice'
|
} from '@/api/manage/attendanceubidevice'
|
||||||
|
import { listAttendance_cfg } from '@/api/manage/attendancecfg'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { findMyProjectList } from '@/api/publics'
|
import { findMyProjectList } from '@/api/publics'
|
||||||
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
|
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
|
||||||
|
|
@ -181,6 +194,7 @@ const data = reactive({
|
||||||
projectId: null,
|
projectId: null,
|
||||||
name: null,
|
name: null,
|
||||||
tag: null,
|
tag: null,
|
||||||
|
cfgId: null,
|
||||||
sceneGuid: null,
|
sceneGuid: null,
|
||||||
source: null,
|
source: null,
|
||||||
deviceNo: null,
|
deviceNo: null,
|
||||||
|
|
@ -204,12 +218,14 @@ const data = reactive({
|
||||||
source: [{ required: true, trigger: ['blur', 'change'], message: '请选择设备来源' }],
|
source: [{ required: true, trigger: ['blur', 'change'], message: '请选择设备来源' }],
|
||||||
deviceNo: [{ required: true, trigger: ['blur', 'change'], message: '请输入设备序列号' }],
|
deviceNo: [{ required: true, trigger: ['blur', 'change'], message: '请输入设备序列号' }],
|
||||||
workAreaId: [{ required: false, trigger: 'blur', message: '请选择所属工区' }],
|
workAreaId: [{ required: false, trigger: 'blur', message: '请选择所属工区' }],
|
||||||
|
cfgId: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤配置' }],
|
||||||
},
|
},
|
||||||
projects: [],
|
projects: [],
|
||||||
currentPrjId: '',
|
currentPrjId: '',
|
||||||
mode: '',
|
mode: '',
|
||||||
workAreaOptions: [],
|
workAreaOptions: [],
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
|
cfgOptions: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
@ -279,6 +295,7 @@ function reset() {
|
||||||
remark: null,
|
remark: null,
|
||||||
isDel: null,
|
isDel: null,
|
||||||
workAreaId: null,
|
workAreaId: null,
|
||||||
|
cfgId: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
|
|
@ -316,6 +333,7 @@ function handleAdd() {
|
||||||
form.value.projectId = userStore.currentPrjId
|
form.value.projectId = userStore.currentPrjId
|
||||||
form.value.projectName = userStore.currentProName
|
form.value.projectName = userStore.currentProName
|
||||||
form.value.source = ubi_device_source.value[0].value
|
form.value.source = ubi_device_source.value[0].value
|
||||||
|
getCfgList()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = '添加宇泛的设备信息'
|
title.value = '添加宇泛的设备信息'
|
||||||
}
|
}
|
||||||
|
|
@ -330,6 +348,7 @@ function handleUpdate(row) {
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getAttendance_ubi_device(_id).then((response) => {
|
getAttendance_ubi_device(_id).then((response) => {
|
||||||
form.value = response.data
|
form.value = response.data
|
||||||
|
getCfgList()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = '修改宇泛的设备信息'
|
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()
|
getProjectList()
|
||||||
getWorkAreaTree()
|
getWorkAreaTree()
|
||||||
|
getCfgList()
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<el-table-column label="所属工区" align="center" prop="workAreaName" />
|
<el-table-column label="所属工区" align="center" prop="workAreaName" />
|
||||||
<el-table-column label="设备序列号" align="center" prop="deviceNo">
|
<el-table-column label="设备序列号" align="center" prop="deviceNo">
|
||||||
<template #default="scope"><span style="color: var(--el-color-warning);">{{ scope.row.deviceNo
|
<template #default="scope"><span style="color: var(--el-color-warning);">{{ scope.row.deviceNo
|
||||||
}}</span></template>
|
}}</span></template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="通道编号" align="center" prop="channel" />
|
<el-table-column label="通道编号" align="center" prop="channel" />
|
||||||
<el-table-column label="方向" align="center" prop="direction">
|
<el-table-column label="方向" align="center" prop="direction">
|
||||||
|
|
@ -110,7 +110,8 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="所属工区" prop="workAreaId" v-if="data.workAreaOptions && data.workAreaOptions.length > 0">
|
<el-form-item label="所属工区" prop="workAreaId"
|
||||||
|
v-if="data.workAreaOptions && data.workAreaOptions.length > 0">
|
||||||
<el-tree-select v-model="form.workAreaId" :data="data.workAreaOptions"
|
<el-tree-select v-model="form.workAreaId" :data="data.workAreaOptions"
|
||||||
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id"
|
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id"
|
||||||
placeholder="请选择工区" clearable style="width:300px;" />
|
placeholder="请选择工区" clearable style="width:300px;" />
|
||||||
|
|
@ -122,8 +123,8 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :loading="submitLoading">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel" :disabled="submitLoading">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -144,6 +145,7 @@ const workAreaList = ref([]);
|
||||||
const workAreaOptions = ref([]);
|
const workAreaOptions = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
const submitLoading = ref(false);
|
||||||
const ids = ref([]);
|
const ids = ref([]);
|
||||||
const single = ref(true);
|
const single = ref(true);
|
||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
|
|
@ -191,6 +193,8 @@ function handleAuth(row) {
|
||||||
|
|
||||||
/** 查询宇泛的设备信息列表 */
|
/** 查询宇泛的设备信息列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
|
|
||||||
|
queryParams.value.cfgId = data.row.id;
|
||||||
queryParams.value.projectId = data.row.projectId
|
queryParams.value.projectId = data.row.projectId
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listAttendance_ubi_device(queryParams.value).then(response => {
|
listAttendance_ubi_device(queryParams.value).then(response => {
|
||||||
|
|
@ -288,19 +292,27 @@ function handleUpdate(row) {
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["attendance_ubi_deviceRef"].validate(valid => {
|
proxy.$refs["attendance_ubi_deviceRef"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
submitLoading.value = true;
|
||||||
form.value.comId = data.row.comId;
|
form.value.comId = data.row.comId;
|
||||||
form.value.name = form.value.deviceNo;
|
form.value.name = form.value.deviceNo;
|
||||||
|
form.value.cfgId = data.row.id;
|
||||||
if (form.value.id != null) {
|
if (form.value.id != null) {
|
||||||
updateAttendance_ubi_device(form.value).then(response => {
|
updateAttendance_ubi_device(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
|
submitLoading.value = false;
|
||||||
getList();
|
getList();
|
||||||
|
}).catch(() => {
|
||||||
|
submitLoading.value = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addAttendance_ubi_device(form.value).then(response => {
|
addAttendance_ubi_device(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
|
submitLoading.value = false;
|
||||||
getList();
|
getList();
|
||||||
|
}).catch(() => {
|
||||||
|
submitLoading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue