收样管理

This commit is contained in:
hayu 2024-07-24 10:46:46 +08:00
parent 159afd7b08
commit fe60257b9c
7 changed files with 54 additions and 30 deletions

View File

@ -138,5 +138,10 @@ public class SamplesManageDto extends PageEntity {
*/
private Integer createBy;
/**
* 试验项内容数量
*/
private Integer experItemNum;
}

View File

@ -80,4 +80,11 @@ public interface RoleDao {
* @return
*/
int updateEnableState(RoleDto data);
/**
* 查询角色编码是否存在
* @param roleCode
* @return
*/
Role getRoleCode(String roleCode);
}

View File

@ -43,10 +43,18 @@ public class RoleServiceImpl implements RoleService {
}
private ServerResponse saveRole(Role role, List<Long> permissionIds) {
//查询角色名称是否存在
Role r = roleDao.getRole(role.getName());
if (r != null) {
return ServerResponse.createErroe(role.getName() + "已存在");
}
//查询角色编码是否存在
if (role.getRoleCode() != null) {
Role r1 = roleDao.getRoleCode(role.getRoleCode());
if (r1 != null) {
return ServerResponse.createErroe(role.getRoleCode() + "已存在");
}
}
roleDao.save(role);
if (!CollectionUtils.isEmpty(permissionIds)) {
roleDao.saveRolePermission(role.getId(), permissionIds);
@ -56,11 +64,18 @@ public class RoleServiceImpl implements RoleService {
@Transactional(rollbackFor = Exception.class)
ServerResponse updateRole(Role role, List<Long> permissionIds) {
//查询角色名称是否存在
Role r = roleDao.getRole(role.getName());
if (r != null && !Objects.equals(r.getId(), role.getId())) {
return ServerResponse.createErroe(role.getName() + "已存在");
}
//查询角色编码是否存在
if (role.getRoleCode() != null) {
Role r1 = roleDao.getRoleCode(role.getRoleCode());
if (r1 != null && !Objects.equals(r1.getId(), role.getId())) {
return ServerResponse.createErroe(role.getRoleCode() + "已存在");
}
}
roleDao.update(role);
roleDao.deleteRolePermission(role.getId());
if (!CollectionUtils.isEmpty(permissionIds)) {

View File

@ -56,6 +56,14 @@
<select id="getUserNumByRole" resultType="java.lang.Integer">
SELECT COUNT(*) FROM sys_user WHERE del_flag = 0 AND role_id = #{id}
</select>
<select id="getRoleCode" resultType="com.bonus.aqgqj.model.Role">
select t.role_id as id,
t.role_name as name,
t.role_code as roleCode,
t.remarks
from sys_role t
where t.role_code = #{roleCode} and t.del_flag = 0
</select>
<insert id="saveRolePermission">
insert into sys_role_menu(role_id, menu_id) values

View File

@ -92,8 +92,7 @@ function initTable(dataList, limit, page) {
{field: "customerCode", title: "设备编码", unresize: true, align: "center"},
{field: "devModule", title: "规格型号", unresize: true, align: "center"},
{field: "sampleDepartment", title: "送检部门", unresize: true, align: "center"},
{field: "experCycle", title: "试验周期", unresize: true, align: "center"},
{field: "experPrice", title: "试验单价(元)", unresize: true, align: "center"},
// {field: "experItemNum", title: "试验项内容数量", unresize: true, align: "center"},
{
field: "view1", title: "收样标签", unresize: true, align: "center",
templet: function (d) {

View File

@ -39,10 +39,8 @@ function pages(pageNum, pageSize, typeNum) {
}, function (result) {
console.log("result.data:",result.data);
if (result.code === 200) {
if (result.data) {
initTable(result.data, result.limit, result.curr)
laypages(result.count, result.curr, result.limit)
}
initTable(result.data, result.limit, result.curr)
laypages(result.count, result.curr, result.limit)
} else if (result.code === 500) {
layer.alert(result.msg, {icon: 2})
}
@ -88,15 +86,11 @@ function initTable(dataList, limit, page) {
limit: limit,
cols: [
[
{type: 'checkbox', fixed: 'left', align: "center", templet: function(d) {
console.log("d.teamName:",d.teamName)
if (d.teamName != null) {
console.log("1223455")
return `<input type="checkbox" name="id" value="${d.id}" lay-skin="primary" lay-filter="test" disabled>`;
} else {
return `<input type="checkbox" name="id" value="${d.id}" lay-skin="primary" lay-filter="test">`;
}
}},
{
type: 'checkbox',
fixed: 'left',
align: "center"
},
//表头
{title: "序号", width: 80, unresize: true, align: "center",
templet: function (d) {
@ -141,16 +135,14 @@ function initTable(dataList, limit, page) {
table.resize("table_data");
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
// 处理复选框禁用
let checkboxes = this.elem.next(".layui-table-view").find("input[type='checkbox']");
dataList.forEach((item, index) => {
console.log("item.teamName:",item.teamName)
if (item.teamName) {
// 禁用该行的复选框
checkboxes.eq(index).prop('disabled', true);
var suborders_data_arr=res.data;
for (let suborders_key in suborders_data_arr) {
if (suborders_data_arr[suborders_key]['teamName']!=null&&suborders_data_arr[suborders_key]['teamName']!="") {
let index = suborders_data_arr[suborders_key]['LAY_TABLE_INDEX'];
$('tr[data-index=' + index + '] input[type="checkbox"]').prop('disabled', true).attr("name","layTableCheckboxDisabled"); // 禁止部分选择
}
});
};
form.render('checkbox');
},
});
}
@ -161,15 +153,12 @@ function initTable(dataList, limit, page) {
function getCheckedValues() {
let data = table.checkStatus("table_data").data;
let ids = [];
if (data.length === 0) {
return '';
}
for (let i = 0; i < data.length; i++) {
ids.push(data[i].id);
}
// 将 ids 数组用逗号分隔成字符串
return ids.join(',');
}

View File

@ -24,9 +24,10 @@
</div>
</div>
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label">角色编码</label>
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>角色编码</label>
<div class="layui-input-inline">
<input class="layui-input" placeholder="角色编码" type="text" name="roleCode" id="roleCode" maxlength="25">
<input class="layui-input" placeholder="角色编码" type="text" name="roleCode" id="roleCode" autocomplete="off" maxlength="25"
lay-verify="required">
</div>
</div>
<div class="layui-form-item" style="margin-top: 2%;">