change - 增添保养项目页面,保养部位页面新增或修改对话框绑定保养项目的前端复选框及接口

master
zangch 2 months ago committed by zch
parent b8344eadde
commit 3174142b61

@ -0,0 +1,127 @@
package com.hw.dms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.dms.domain.DmsBaseStationProject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.dms.domain.DmsBaseMaintProject;
import com.hw.dms.service.IDmsBaseMaintProjectService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author zangch
* @date 2024-09-23
*/
@RestController
@RequestMapping("/dmsBaseMaintProject")
public class DmsBaseMaintProjectController extends BaseController
{
@Autowired
private IDmsBaseMaintProjectService dmsBaseMaintProjectService;
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:list")
@GetMapping("/list")
public TableDataInfo list(DmsBaseMaintProject dmsBaseMaintProject)
{
startPage();
List<DmsBaseMaintProject> list = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:export")
@Log(title = "保养项目信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DmsBaseMaintProject dmsBaseMaintProject)
{
List<DmsBaseMaintProject> list = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject);
ExcelUtil<DmsBaseMaintProject> util = new ExcelUtil<DmsBaseMaintProject>(DmsBaseMaintProject.class);
util.exportExcel(response, list, "保养项目信息数据");
}
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:query")
@GetMapping(value = "/{maintProjectId}")
public AjaxResult getInfo(@PathVariable("maintProjectId") Long maintProjectId)
{
return success(dmsBaseMaintProjectService.selectDmsBaseMaintProjectByMaintProjectId(maintProjectId));
}
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:add")
@Log(title = "保养项目信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DmsBaseMaintProject dmsBaseMaintProject)
{
return toAjax(dmsBaseMaintProjectService.insertDmsBaseMaintProject(dmsBaseMaintProject));
}
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:edit")
@Log(title = "保养项目信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DmsBaseMaintProject dmsBaseMaintProject)
{
return toAjax(dmsBaseMaintProjectService.updateDmsBaseMaintProject(dmsBaseMaintProject));
}
/**
*
*/
@RequiresPermissions("dms:dmsBaseMaintProject:remove")
@Log(title = "保养项目信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{maintProjectIds}")
public AjaxResult remove(@PathVariable Long[] maintProjectIds)
{
return toAjax(dmsBaseMaintProjectService.deleteDmsBaseMaintProjectByMaintProjectIds(maintProjectIds));
}
@GetMapping("/projectMenu")
//TODO 未完成
public AjaxResult projectMenu(DmsBaseMaintProject dmsBaseMaintProject)
{
List<DmsBaseMaintProject> projectMenu = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject);
return success(projectMenu);
}
@GetMapping("/projectMenuByStaion/{maintStationId}")
public AjaxResult projectMenuByStaion(@PathVariable("maintStationId") Long maintStationId)
{
List<DmsBaseMaintProject> projectMenu = dmsBaseMaintProjectService.selectProjectMenuByStationId(maintStationId);
return success(projectMenu);
}
}

@ -0,0 +1,115 @@
package com.hw.dms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils;
import com.sun.xml.bind.v2.TODO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.dms.domain.DmsBaseStationProject;
import com.hw.dms.service.IDmsBaseStationProjectService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author zangch
* @date 2024-09-23
*/
@RestController
@RequestMapping("/baseStationProject")
public class DmsBaseStationProjectController extends BaseController
{
@Autowired
private IDmsBaseStationProjectService dmsBaseStationProjectService;
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:list")*/
@GetMapping("/list")
public TableDataInfo list(DmsBaseStationProject dmsBaseStationProject)
{
startPage();
List<DmsBaseStationProject> list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
return getDataTable(list);
}
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:export")*/
@Log(title = "保养部位关联项目信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DmsBaseStationProject dmsBaseStationProject)
{
List<DmsBaseStationProject> list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
ExcelUtil<DmsBaseStationProject> util = new ExcelUtil<DmsBaseStationProject>(DmsBaseStationProject.class);
util.exportExcel(response, list, "保养部位关联项目信息数据");
}
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:query")*/
@GetMapping(value = "/{maintStationId}")
public AjaxResult getInfo(@PathVariable("maintStationId") Long maintStationId)
{
return success(dmsBaseStationProjectService.selectDmsBaseStationProjectByMaintStationId(maintStationId));
}
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:add")*/
@Log(title = "保养部位关联项目信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DmsBaseStationProject dmsBaseStationProject)
{
return toAjax(dmsBaseStationProjectService.insertDmsBaseStationProject(dmsBaseStationProject));
}
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:edit")*/
@Log(title = "保养部位关联项目信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DmsBaseStationProject dmsBaseStationProject)
{
return toAjax(dmsBaseStationProjectService.updateDmsBaseStationProject(dmsBaseStationProject));
}
/**
*
*/
/* @RequiresPermissions("dms:baseStationProject:remove")*/
@Log(title = "保养部位关联项目信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{maintStationIds}")
public AjaxResult remove(@PathVariable Long[] maintStationIds)
{
return toAjax(dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds));
}
/* @GetMapping("/treeselect")
public AjaxResult stationProjectTreeselect(DmsBaseStationProject dmsBaseStationProject)
{
List<DmsBaseStationProject> dmsBaseStationProjects = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
return success(dmsBaseStationProjects);
}*/
}

@ -0,0 +1,81 @@
package com.hw.dms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* dms_base_maint_project
*
* @author zangch
* @date 2024-09-23
*/
public class DmsBaseMaintProject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long maintProjectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String maintProjectName;
/** 项目描述 */
@Excel(name = "项目描述")
private String maintProjectDesc;
private Long maintStationId;
public Long getMaintStationId() {
return maintStationId;
}
public void setMaintStationId(Long maintStationId) {
this.maintStationId = maintStationId;
}
public void setMaintProjectId(Long maintProjectId)
{
this.maintProjectId = maintProjectId;
}
public Long getMaintProjectId()
{
return maintProjectId;
}
public void setMaintProjectName(String maintProjectName)
{
this.maintProjectName = maintProjectName;
}
public String getMaintProjectName()
{
return maintProjectName;
}
public void setMaintProjectDesc(String maintProjectDesc)
{
this.maintProjectDesc = maintProjectDesc;
}
public String getMaintProjectDesc()
{
return maintProjectDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("maintProjectId", getMaintProjectId())
.append("maintProjectName", getMaintProjectName())
.append("maintProjectDesc", getMaintProjectDesc())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("maintStationId", getMaintStationId())
.toString();
}
}

@ -40,6 +40,11 @@ public class DmsBaseMaintStation extends BaseEntity
private String TypeName;
/** 绑定保养项目 */
private Long[] productIds;
public String getTypeName() {
return TypeName;
}
@ -103,6 +108,14 @@ public class DmsBaseMaintStation extends BaseEntity
return isFlag;
}
public Long[] getProductIds() {
return productIds;
}
public void setProductIds(Long[] productIds) {
this.productIds = productIds;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -116,6 +129,7 @@ public class DmsBaseMaintStation extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("productIds", getProductIds())
.toString();
}
}

@ -0,0 +1,99 @@
package com.hw.dms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* dms_base_station_project
*
* @author zangch
* @date 2024-09-23
*/
public class DmsBaseStationProject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 保养部位ID */
@Excel(name = "保养部位ID")
private Long maintStationId;
/** 保养项目ID */
@Excel(name = "保养项目ID")
private Long maintProjectId;
private String maintProjectName;
private String maintStationCode;
private String maintStationName;
/** 保养项目编号 */
private Long[] productIds;
public Long[] getProductIds() {
return productIds;
}
public void setProductIds(Long[] productIds) {
this.productIds = productIds;
}
public String getMaintProjectName() {
return maintProjectName;
}
public void setMaintProjectName(String maintProjectName) {
this.maintProjectName = maintProjectName;
}
public String getMaintStationCode() {
return maintStationCode;
}
public void setMaintStationCode(String maintStationCode) {
this.maintStationCode = maintStationCode;
}
public String getMaintStationName() {
return maintStationName;
}
public void setMaintStationName(String maintStationName) {
this.maintStationName = maintStationName;
}
public void setMaintStationId(Long maintStationId)
{
this.maintStationId = maintStationId;
}
public Long getMaintStationId()
{
return maintStationId;
}
public void setMaintProjectId(Long maintProjectId)
{
this.maintProjectId = maintProjectId;
}
public Long getMaintProjectId()
{
return maintProjectId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("maintStationId", getMaintStationId())
.append("maintProjectId", getMaintProjectId())
.append("maintProjectName",getMaintProjectName())
.append("maintStationCode",getMaintStationName())
.append("maintStationName",getMaintStationName())
.append("productIds",getProductIds())
.toString();
}
}

@ -0,0 +1,63 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsBaseMaintProject;
/**
* Mapper
*
* @author zangch
* @date 2024-09-23
*/
public interface DmsBaseMaintProjectMapper
{
/**
*
*
* @param maintProjectId
* @return
*/
public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public List<DmsBaseMaintProject> selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param maintProjectId
* @return
*/
public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId);
/**
*
*
* @param maintProjectIds
* @return
*/
public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds);
public List<DmsBaseMaintProject> selectProjectMenuByStationId(Long maintStationId);
}

@ -0,0 +1,66 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsBaseStationProject;
/**
* Mapper
*
* @author zangch
* @date 2024-09-23
*/
public interface DmsBaseStationProjectMapper
{
/**
*
*
* @param maintStationId
* @return
*/
public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public List<DmsBaseStationProject> selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param maintStationId
* @return
*/
public int deleteDmsBaseStationProjectByMaintStationId(Long maintStationId);
/**
*
*
* @param maintStationIds
* @return
*/
public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds);
public int batchUpdateDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList);
public int batchInsertDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList);
public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId);
}

@ -0,0 +1,63 @@
package com.hw.dms.service;
import java.util.List;
import com.hw.dms.domain.DmsBaseMaintProject;
/**
* Service
*
* @author zangch
* @date 2024-09-23
*/
public interface IDmsBaseMaintProjectService
{
/**
*
*
* @param maintProjectId
* @return
*/
public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public List<DmsBaseMaintProject> selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject);
/**
*
*
* @param maintProjectIds
* @return
*/
public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds);
/**
*
*
* @param maintProjectId
* @return
*/
public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId);
public List<DmsBaseMaintProject> selectProjectMenuByStationId(Long maintStationId);
}

@ -0,0 +1,67 @@
package com.hw.dms.service;
import java.util.List;
import com.hw.dms.domain.DmsBaseStationProject;
/**
* Service
*
* @author zangch
* @date 2024-09-23
*/
public interface IDmsBaseStationProjectService
{
/**
*
*
* @param maintStationId
* @return
*/
public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public List<DmsBaseStationProject> selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param dmsBaseStationProject
* @return
*/
public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject);
/**
*
*
* @param maintStationIds
* @return
*/
public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds);
/**
*
*
* @param maintStationId
* @return
*/
public int deleteDmsBaseStationProjectByMaintStationIds(Long maintStationId);
public int batchUpdateDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList);
public int batchInsertDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList);
public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId);
}

@ -0,0 +1,123 @@
package com.hw.dms.service.impl;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.dms.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.*;
import com.hw.dms.service.*;
/**
* Service
*
* @author zangch
* @date 2024-09-23
*/
@Service
public class DmsBaseMaintProjectServiceImpl implements IDmsBaseMaintProjectService
{
@Autowired
private DmsBaseMaintProjectMapper dmsBaseMaintProjectMapper;
@Autowired
private DmsBaseStationProjectServiceImpl dmsBaseStationProjectServiceImpl;
/**
*
*
* @param maintProjectId
* @return
*/
@Override
public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId)
{
return dmsBaseMaintProjectMapper.selectDmsBaseMaintProjectByMaintProjectId(maintProjectId);
}
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
@Override
public List<DmsBaseMaintProject> selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject)
{
return dmsBaseMaintProjectMapper.selectDmsBaseMaintProjectList(dmsBaseMaintProject);
}
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
@Override
public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject)
{
dmsBaseMaintProject.setCreateTime(DateUtils.getNowDate());
return dmsBaseMaintProjectMapper.insertDmsBaseMaintProject(dmsBaseMaintProject);
}
/**
*
*
* @param dmsBaseMaintProject
* @return
*/
@Override
public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject)
{
dmsBaseMaintProject.setUpdateTime(DateUtils.getNowDate());
return dmsBaseMaintProjectMapper.updateDmsBaseMaintProject(dmsBaseMaintProject);
}
/**
*
*
* @param maintProjectIds
* @return
*/
@Override
public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds)
{
//删除前先根据maintProjectId监测stationproject表中是否存在数据若存在就抛出异常不能删除
for(Long maintProjectId : maintProjectIds){
DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject();
dmsBaseStationProject.setMaintProjectId(maintProjectId);
List<DmsBaseStationProject> dmsBaseStationProjectList = dmsBaseStationProjectServiceImpl
.selectDmsBaseStationProjectList(dmsBaseStationProject);
if(dmsBaseStationProjectList.size() > 0){
throw new ServiceException("其中的保养项目信息已绑定到保养部位,不能删除");
}
}
return dmsBaseMaintProjectMapper.deleteDmsBaseMaintProjectByMaintProjectIds(maintProjectIds);
}
/**
*
*
* @param maintProjectId
* @return
*/
@Override
public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId)
{
//删除前先根据maintProjectId监测stationproject表中是否存在数据若存在就抛出异常不能删除
DmsBaseStationProject dmsBaseStationProject = dmsBaseStationProjectServiceImpl
.selectDmsBaseStationProjectBymaintProjectId(maintProjectId);
if(dmsBaseStationProject != null){
throw new ServiceException("该保养项目信息已绑定到保养部位,不能删除");
}
return dmsBaseMaintProjectMapper.deleteDmsBaseMaintProjectByMaintProjectId(maintProjectId);
}
public List<DmsBaseMaintProject> selectProjectMenuByStationId(Long maintStationId)
{
return dmsBaseMaintProjectMapper.selectProjectMenuByStationId(maintStationId);
}
}

@ -1,6 +1,8 @@
package com.hw.dms.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
@ -8,8 +10,9 @@ import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBaseMaintStationMapper;
import com.hw.dms.domain.DmsBaseMaintStation;
import com.hw.dms.service.IDmsBaseMaintStationService;
import com.hw.dms.domain.*;
import com.hw.dms.service.*;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -23,6 +26,9 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi
@Autowired
private DmsBaseMaintStationMapper dmsBaseMaintStationMapper;
@Autowired
private IDmsBaseStationProjectService dmsBaseStationProjectService;
/**
*
*
@ -54,18 +60,42 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi
* @return
*/
@Override
public int insertDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation)
{
@Transactional
public int insertDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) {
DmsBaseMaintStation MaintStation = new DmsBaseMaintStation();
MaintStation.setMaintStationCode(dmsBaseMaintStation.getMaintStationCode());
List<DmsBaseMaintStation> dmsBaseMaintStationlist = dmsBaseMaintStationMapper
.selectDmsBaseMaintStationList(MaintStation);
if (dmsBaseMaintStationlist.size() > 0){throw new ServiceException("保养部位信息编码已存在");}
if (dmsBaseMaintStationlist.size() > 0) {
throw new ServiceException("保养部位信息编码已存在");
}
LoginUser user = SecurityUtils.getLoginUser();
dmsBaseMaintStation.setIsFlag(1l);
dmsBaseMaintStation.setCreateBy(user.getUsername());
dmsBaseMaintStation.setCreateTime(DateUtils.getNowDate());
return dmsBaseMaintStationMapper.insertDmsBaseMaintStation(dmsBaseMaintStation);
/*MaintStationId
MaintStationIdMaintStationIddmsBaseMaintStation
@Transactional*/
//先新增保养部位
int i = dmsBaseMaintStationMapper.insertDmsBaseMaintStation(dmsBaseMaintStation);//先插入保养部位信息数据库自增主键maint_station_id
//查询出来MaintStationId再赋值给dmsBaseMaintStation
List<DmsBaseMaintStation> dmsBaseMaintStationsNew = dmsBaseMaintStationMapper.
selectDmsBaseMaintStationList(dmsBaseMaintStation);
dmsBaseMaintStation.setMaintStationId(dmsBaseMaintStationsNew.get(0).getMaintStationId());
//若Long[] ProductIds不为空则分批添加
if (dmsBaseMaintStation.getProductIds().length > 0) {
List<DmsBaseStationProject> dmsBaseStationProjectList = new ArrayList<>();
for (Long productId : dmsBaseMaintStation.getProductIds()) {
DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject();
dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId());
dmsBaseStationProject.setMaintProjectId(productId);
dmsBaseStationProjectList.add(dmsBaseStationProject);
}
dmsBaseStationProjectService.batchInsertDmsBaseStationProject(dmsBaseStationProjectList);
}
return i;
}
/**
@ -75,18 +105,54 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi
* @return
*/
@Override
public int updateDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation)
{
@Transactional
public int updateDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) {
DmsBaseMaintStation MaintStation = new DmsBaseMaintStation();
MaintStation.setMaintStationCode(dmsBaseMaintStation.getMaintStationCode());
List<DmsBaseMaintStation> dmsBaseMaintStationlist = dmsBaseMaintStationMapper
.selectDmsBaseMaintStationList(MaintStation);
if (dmsBaseMaintStationlist.size() > 0 && !dmsBaseMaintStationlist.get(0).getMaintStationId()
.equals(dmsBaseMaintStation.getMaintStationId())){
throw new ServiceException("保养部位信息编码已存在");}
.equals(dmsBaseMaintStation.getMaintStationId())) {
throw new ServiceException("保养部位信息编码已存在");
}
LoginUser user = SecurityUtils.getLoginUser();
dmsBaseMaintStation.setUpdateBy(user.getUsername());
dmsBaseMaintStation.setUpdateTime(DateUtils.getNowDate());
//若Long[] ProductIds不为空
if (dmsBaseMaintStation.getProductIds().length > 0) {
//根据部位id先去若StaionProject表中查询是否已有数据
DmsBaseStationProject dmsBaseStationProjectSearch = new DmsBaseStationProject();
dmsBaseStationProjectSearch.setMaintStationId(dmsBaseMaintStation.getMaintStationId());
List<DmsBaseStationProject> dmsBaseStationProjectSerchList = dmsBaseStationProjectService
.selectDmsBaseStationProjectList(dmsBaseStationProjectSearch);
//list存储每个实体
List<DmsBaseStationProject> dmsBaseStationProjectList = new ArrayList<>();
//若StaionProject表中有数据则更新先根据部位id删除再分批添加
if (dmsBaseStationProjectSerchList.size() > 0) {
//list存储每个实体每个实体设置属性
for (Long productId : dmsBaseMaintStation.getProductIds()) {
DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject();
dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId());
dmsBaseStationProject.setMaintProjectId(productId);
dmsBaseStationProjectList.add(dmsBaseStationProject);
}
dmsBaseStationProjectService.batchUpdateDmsBaseStationProject(dmsBaseStationProjectList);
} else {
//若StaionProject无数据则添加
for (Long productId : dmsBaseMaintStation.getProductIds()) {
DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject();
dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId());
dmsBaseStationProject.setMaintProjectId(productId);
dmsBaseStationProjectList.add(dmsBaseStationProject);
}
dmsBaseStationProjectService.batchInsertDmsBaseStationProject(dmsBaseStationProjectList);
}
} else {
//若ProductIds为空则根据maintStationId删除相关
dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(dmsBaseMaintStation.getMaintStationId());
}
return dmsBaseMaintStationMapper.updateDmsBaseMaintStation(dmsBaseMaintStation);
}
@ -97,8 +163,10 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi
* @return
*/
@Override
@Transactional
public int deleteDmsBaseMaintStationByMaintStationIds(Long[] maintStationIds)
{
dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds);
return dmsBaseMaintStationMapper.deleteDmsBaseMaintStationByMaintStationIds(maintStationIds);
}
@ -109,8 +177,10 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi
* @return
*/
@Override
@Transactional
public int deleteDmsBaseMaintStationByMaintStationId(Long maintStationId)
{
dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationId);
return dmsBaseMaintStationMapper.deleteDmsBaseMaintStationByMaintStationId(maintStationId);
}
}

@ -0,0 +1,131 @@
package com.hw.dms.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBaseStationProjectMapper;
import com.hw.dms.domain.DmsBaseStationProject;
import com.hw.dms.service.IDmsBaseStationProjectService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author zangch
* @date 2024-09-23
*/
@Service
public class DmsBaseStationProjectServiceImpl implements IDmsBaseStationProjectService
{
@Autowired
private DmsBaseStationProjectMapper dmsBaseStationProjectMapper;
/**
*
*
* @param maintStationId
* @return
*/
@Override
public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId)
{
return dmsBaseStationProjectMapper.selectDmsBaseStationProjectByMaintStationId(maintStationId);
}
/**
*
*
* @param dmsBaseStationProject
* @return
*/
@Override
public List<DmsBaseStationProject> selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject)
{
return dmsBaseStationProjectMapper.selectDmsBaseStationProjectList(dmsBaseStationProject);
}
/**
*
*
* @param dmsBaseStationProject
* @return
*/
@Override
public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject)
{
return dmsBaseStationProjectMapper.insertDmsBaseStationProject(dmsBaseStationProject);
}
/**
*
*
* @param dmsBaseStationProject
* @return
*/
@Override
public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject)
{
return dmsBaseStationProjectMapper.updateDmsBaseStationProject(dmsBaseStationProject);
}
/**
*
*
* @param maintStationIds
* @return
*/
@Override
public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds)
{
return dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds);
}
/**
*
*
* @param maintStationId
* @return
*/
@Override
public int deleteDmsBaseStationProjectByMaintStationIds(Long maintStationId)
{
return dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationId(maintStationId);
}
/**
*
*
* @param dmsBaseStationProjectList
* @return
*/
@Override
@Transactional
public int batchUpdateDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList){
//复选框先根据MaintStationId删除表中数据再批量添加
for( DmsBaseStationProject dmsBaseStationProject:dmsBaseStationProjectList){
dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationId(dmsBaseStationProject.getMaintStationId());
}
return dmsBaseStationProjectMapper.batchInsertDmsBaseStationProject(dmsBaseStationProjectList);
}
/**
*
*
* @param dmsBaseStationProjectList
* @return
*/
@Override
public int batchInsertDmsBaseStationProject(List<DmsBaseStationProject> dmsBaseStationProjectList){
return dmsBaseStationProjectMapper.batchInsertDmsBaseStationProject(dmsBaseStationProjectList);
}
/**
*
*
* @param maintProjectId
* @return
*/
public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId){
return dmsBaseStationProjectMapper.selectDmsBaseStationProjectBymaintProjectId(maintProjectId);
}
}

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.dms.mapper.DmsBaseMaintProjectMapper">
<resultMap type="DmsBaseMaintProject" id="DmsBaseMaintProjectResult">
<result property="maintProjectId" column="maint_project_id" />
<result property="maintProjectName" column="maint_project_name" />
<result property="maintProjectDesc" column="maint_project_desc" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDmsBaseMaintProjectVo">
select dbmp.maint_project_id,
dbmp.maint_project_name,
dbmp.maint_project_desc,
dbmp.remark, dbmp.create_by, dbmp.create_time, dbmp.update_by, dbmp.update_time
from dms_base_maint_project dbmp
</sql>
<sql id="selectDmsBaseMaintProjectMenuVo">
select dbmp.maint_project_id,
dbmp.maint_project_name,
dbmp.maint_project_desc,
dbmp.remark, dbmp.create_by, dbmp.create_time, dbmp.update_by, dbmp.update_time,
dbsp.maint_station_id
from dms_base_maint_project dbmp
left join dms_base_station_project dbsp on dbmp.maint_project_id = dbsp.maint_project_id
</sql>
<!-- public List<DmsBaseMaintProject> selectProjectMenuByStationId(Long maintStationId);
先根据maintStationId去dms_base_station_project中查maintStationId相关的maint_project_id再从dms_base_maint_project根据maint_project_id-->
<select id="selectProjectMenuByStationId" parameterType="Long" resultMap="DmsBaseMaintProjectResult">
<include refid="selectDmsBaseMaintProjectMenuVo"/>
where dbsp.maint_station_id = #{maintStationId}
</select>
<select id="selectDmsBaseMaintProjectList" parameterType="DmsBaseMaintProject" resultMap="DmsBaseMaintProjectResult">
<include refid="selectDmsBaseMaintProjectVo"/>
<where>
<if test="maintProjectName != null and maintProjectName != ''"> and dbmp.maint_project_name like concat('%', #{maintProjectName}, '%')</if>
<if test="maintProjectDesc != null and maintProjectDesc != ''"> and dbmp.maint_project_desc = #{maintProjectDesc}</if>
<!-- <if test="maint_station_id != null"> and dbsp.maint_station_id = #{maintStationId}</if>-->
<if test="maintProjectId != null"> and dbmp.maint_project_id = #{maintProjectId}</if>
</where>
</select>
<select id="selectDmsBaseMaintProjectByMaintProjectId" parameterType="Long" resultMap="DmsBaseMaintProjectResult">
<include refid="selectDmsBaseMaintProjectVo"/>
where dbmp.maint_project_id = #{maintProjectId}
</select>
<insert id="insertDmsBaseMaintProject" parameterType="DmsBaseMaintProject" useGeneratedKeys="true" keyProperty="maintProjectId">
insert into dms_base_maint_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maintProjectName != null and maintProjectName != ''">maint_project_name,</if>
<if test="maintProjectDesc != null">maint_project_desc,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maintProjectName != null and maintProjectName != ''">#{maintProjectName},</if>
<if test="maintProjectDesc != null">#{maintProjectDesc},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDmsBaseMaintProject" parameterType="DmsBaseMaintProject">
update dms_base_maint_project
<trim prefix="SET" suffixOverrides=",">
<if test="maintProjectName != null and maintProjectName != ''">maint_project_name = #{maintProjectName},</if>
<if test="maintProjectDesc != null">maint_project_desc = #{maintProjectDesc},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where maint_project_id = #{maintProjectId}
</update>
<delete id="deleteDmsBaseMaintProjectByMaintProjectId" parameterType="Long">
delete from dms_base_maint_project where maint_project_id = #{maintProjectId}
</delete>
<delete id="deleteDmsBaseMaintProjectByMaintProjectIds" parameterType="String">
delete from dms_base_maint_project where maint_project_id in
<foreach item="maintProjectId" collection="array" open="(" separator="," close=")">
#{maintProjectId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.dms.mapper.DmsBaseStationProjectMapper">
<resultMap type="DmsBaseStationProject" id="DmsBaseStationProjectResult">
<result property="maintStationId" column="maint_station_id" />
<result property="maintProjectId" column="maint_project_id" />
<result property="maintProjectName" column="maint_project_name" />
<result property="maintStationName" column="maint_station_name" />
<result property="maintStationCode" column="maint_station_code" />
</resultMap>
<sql id="selectDmsBaseStationProjectVo">
select dbsp.maint_station_id,
dbsp.maint_project_id,
dbmp.maint_project_name,
dbms.maint_station_name,
dbms.maint_station_code
from dms_base_station_project dbsp
left join dms_base_maint_project dbmp on dbsp.maint_project_id = dbmp.maint_project_id
left join dms_base_maint_station dbms on dbsp.maint_station_id = dbms.maint_station_id
</sql>
<select id="selectDmsBaseStationProjectList" parameterType="DmsBaseStationProject" resultMap="DmsBaseStationProjectResult">
<include refid="selectDmsBaseStationProjectVo"/>
<where>
<if test="maintStationId != null "> and dbsp.maint_station_id = #{maintStationId}</if>
<if test="maintProjectId != null "> and dbsp.maint_project_id = #{maintProjectId}</if>
<if test="maintProjectName != null and maintProjectName != ''"> and dbmp.maint_project_name like concat('%', #{maintProjectName}, '%')</if>
<if test="maintStationName != null and maintStationName != ''"> and dbms.maint_station_name like concat('%', #{maintStationName}, '%')</if>
<if test="maintStationCode != null and maintStationCode != ''"> and dbms.maint_station_code like concat('%', #{maintStationCode}, '%')</if>
</where>
</select>
<select id="selectDmsBaseStationProjectByMaintStationId" parameterType="Long" resultMap="DmsBaseStationProjectResult">
<include refid="selectDmsBaseStationProjectVo"/>
where dbsp.maint_station_id = #{maintStationId}
</select>
<select id="selectDmsBaseStationProjectBymaintProjectId" parameterType="Long" resultMap="DmsBaseStationProjectResult">
<include refid="selectDmsBaseStationProjectVo"/>
where dbsp.maint_project_id = #{maintProjectId}
</select>
<insert id="insertDmsBaseStationProject" parameterType="DmsBaseStationProject">
insert into dms_base_station_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maintStationId != null">maint_station_id,</if>
<if test="maintProjectId != null">maint_project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maintStationId != null">#{maintStationId},</if>
<if test="maintProjectId != null">#{maintProjectId},</if>
</trim>
</insert>
<update id="updateDmsBaseStationProject" parameterType="DmsBaseStationProject">
update dms_base_station_project
<trim prefix="SET" suffixOverrides=",">
<if test="maintProjectId != null">maint_project_id = #{maintProjectId},</if>
<if test="maintProjectName != null and maintProjectName != ''">maint_project_name = #{maintProjectName},</if>
</trim>
where maint_station_id = #{maintStationId}
</update>
<delete id="deleteDmsBaseStationProjectByMaintStationId" parameterType="Long">
delete from dms_base_station_project where maint_station_id = #{maintStationId}
</delete>
<delete id="deleteDmsBaseStationProjectByMaintStationIds" parameterType="String">
delete from dms_base_station_project where maint_station_id in
<foreach item="maintStationId" collection="array" open="(" separator="," close=")">
#{maintStationId}
</foreach>
</delete>
<update id="batchUpdateDmsBaseStationProject" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" close="" separator=",">
update dms_base_station_project
<set>
maint_project_id = #{item.maintProjectId}
</set>
where maint_station_id = #{item.maintStationId}
</foreach>
</update>
<insert id="batchInsertDmsBaseStationProject" parameterType="java.util.List">
insert into dms_base_station_project(maint_station_id,maint_project_id)
values
<foreach collection="list" item="item" index="index" open="" close="" separator=",">
(#{item.maintStationId},#{item.maintProjectId})
</foreach>
</insert>
</mapper>

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询保养部位关联项目信息列表
export function listBaseStationProject(query) {
return request({
url: '/dms/baseStationProject/list',
method: 'get',
params: query
})
}
// 查询保养部位关联项目信息详细
export function getBaseStationProject(maintStationId) {
return request({
url: '/dms/baseStationProject/' + maintStationId,
method: 'get'
})
}
// 新增保养部位关联项目信息
export function addBaseStationProject(data) {
return request({
url: '/dms/baseStationProject',
method: 'post',
data: data
})
}
// 修改保养部位关联项目信息
export function updateBaseStationProject(data) {
return request({
url: '/dms/baseStationProject',
method: 'put',
data: data
})
}
// 删除保养部位关联项目信息
export function delBaseStationProject(maintStationId) {
return request({
url: '/dms/baseStationProject/' + maintStationId,
method: 'delete'
})
}
/*// 查询菜单下拉树结构
export function stationProjectTreeselect(query) {
return request({
url: '/dms/baseStationProject/treeselect',
method: 'get'
})
}*/

@ -0,0 +1,61 @@
import request from '@/utils/request'
// 查询保养项目信息列表
export function listDmsBaseMaintProject(query) {
return request({
url: '/dms/dmsBaseMaintProject/list',
method: 'get',
params: query
})
}
// 查询保养项目信息详细
export function getDmsBaseMaintProject(maintProjectId) {
return request({
url: '/dms/dmsBaseMaintProject/' + maintProjectId,
method: 'get'
})
}
// 新增保养项目信息
export function addDmsBaseMaintProject(data) {
return request({
url: '/dms/dmsBaseMaintProject',
method: 'post',
data: data
})
}
// 修改保养项目信息
export function updateDmsBaseMaintProject(data) {
return request({
url: '/dms/dmsBaseMaintProject',
method: 'put',
data: data
})
}
// 删除保养项目信息
export function delDmsBaseMaintProject(maintProjectId) {
return request({
url: '/dms/dmsBaseMaintProject/' + maintProjectId,
method: 'delete'
})
}
// 查询菜单
export function projectMenu(query) {
return request({
url: '/dms/dmsBaseMaintProject/projectMenu',
method: 'get'
})
}
// 根据部位ID查询菜单结构
export function projectMenuByStaion(maintStationId) {
return request({
url:'/dms/dmsBaseMaintProject/projectMenuByStaion/'+ maintStationId,
method: 'get'
})
}

@ -0,0 +1,278 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名称" prop="maintProjectName">
<el-input
v-model="queryParams.maintProjectName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['dms:dmsBaseMaintProject:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['dms:dmsBaseMaintProject:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['dms:dmsBaseMaintProject:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['dms:dmsBaseMaintProject:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsBaseMaintProjectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="maintProjectId" />
<el-table-column label="项目名称" align="center" prop="maintProjectName" />
<el-table-column label="项目描述" align="center" prop="maintProjectDesc" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dms:dmsBaseMaintProject:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dms:dmsBaseMaintProject:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改保养项目信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名称" prop="maintProjectName">
<el-input v-model="form.maintProjectName" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="项目描述" prop="maintProjectDesc">
<el-input v-model="form.maintProjectDesc" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDmsBaseMaintProject, getDmsBaseMaintProject, delDmsBaseMaintProject, addDmsBaseMaintProject, updateDmsBaseMaintProject } from "@/api/dms/dmsBaseMaintProject";
export default {
name: "DmsBaseMaintProject",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dmsBaseMaintProjectList: [],
//
title: "",
//
open: false,
//
daterangeCreateTime: [],
//
daterangeUpdateTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
maintProjectName: null,
maintProjectDesc: null,
},
//
form: {},
//
rules: {
maintProjectName: [
{ required: true, message: "项目名称不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询保养项目信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
}
listDmsBaseMaintProject(this.queryParams).then(response => {
this.dmsBaseMaintProjectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
maintProjectId: null,
maintProjectName: null,
maintProjectDesc: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCreateTime = [];
this.daterangeUpdateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.maintProjectId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加保养项目信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const maintProjectId = row.maintProjectId || this.ids
getDmsBaseMaintProject(maintProjectId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改保养项目信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.maintProjectId != null) {
updateDmsBaseMaintProject(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDmsBaseMaintProject(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const maintProjectIds = row.maintProjectId || this.ids;
this.$modal.confirm('是否确认删除保养项目信息编号为"' + maintProjectIds + '"的数据项?').then(function() {
return delDmsBaseMaintProject(maintProjectIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('dms/dmsBaseMaintProject/export', {
...this.queryParams
}, `dmsBaseMaintProject_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -199,6 +199,20 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="保养项目">
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">/</el-checkbox>
<div class="scrollable-tree-container">
<el-tree
class="tree-border"
:data="baseStationProjectList"
show-checkbox
ref="menu"
node-key="maintProjectId"
empty-text="加载中,请稍候"
:props="{label:'maintProjectName'}"
></el-tree>
</div>
</el-form-item>
<!-- <el-form-item label="是否标识1-是2-否" prop="isFlag">-->
<!-- <el-input v-model="form.isFlag" placeholder="请输入是否标识1-是2-否" />-->
<!-- </el-form-item>-->
@ -218,6 +232,7 @@
import { listStation, getStation, delStation, addStation, updateStation } from "@/api/dms/station";
import { listDevicetype } from '@/api/dms/devicetype'
import {getMaintStandardlist} from '@/api/dms/standard'
import {projectMenu, projectMenuByStaion} from "@/api/dms/dmsBaseMaintProject";
export default {
name: "Station",
@ -266,13 +281,16 @@ export default {
// isFlag: [
// { required: true, message: "1-2-", trigger: "blur" }
// ],
}
},
menuNodeAll: false,
baseStationProjectList: [],
};
},
created() {
this.getList();
this.getDeviceTypeList();
this.getStandard();
/* this.getStaionProjetList();*/
},
methods: {
/** 查询保养标准信息列表 */
@ -305,6 +323,10 @@ export default {
},
//
reset() {
if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([]);
}
this.menuNodeAll = false,
this.form = {
maintStationId: null,
deviceTypeId: null,
@ -318,7 +340,8 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
baseStationProjectList: [],
};
this.resetForm("form");
},
@ -342,15 +365,29 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.getStaionProjetList() ;
this.title = "添加保养部位信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const maintStationId = row.maintStationId || this.ids
this.getStaionProjetList();
getStation(maintStationId).then(response => {
/* this.getStaionProjetList();*/
this.form = response.data;
this.open = true;
this.$nextTick(() => {
projectMenuByStaion(maintStationId).then(res => {
let checkedKeys = res.data
checkedKeys.forEach((v) => {
console.log('v',v)
this.$nextTick(()=>{
this.$refs.menu.setChecked(v.maintProjectId, true ,false);
})
})
});
});
this.title = "修改保养部位信息";
});
},
@ -359,12 +396,14 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.maintStationId != null) {
this.form.productIds = this.getMenuAllCheckedKeys();
updateStation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.productIds = this.getMenuAllCheckedKeys();
addStation(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -390,7 +429,56 @@ export default {
this.download('dms/station/export', {
...this.queryParams
}, `station_${new Date().getTime()}.xlsx`)
}
},
// /
handleCheckedTreeNodeAll(value, type) {
if (type == 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.baseStationProjectList: []);
}
},
/** 查询保养部位关联项目信息列表 */
getStaionProjetList() {
projectMenu({}).then(response => {
this.baseStationProjectList = response.data;
console.log(this.baseStationProjectList)
});
},
/** 根据部位id查询菜单 */
getStaionProjetListByStionId(maintStationId) {
return projectMenuByStaion(maintStationId).then(response => {
this.baseStationProjectList = response.data;
console.log(this.baseStationProjectList)
});
},
//
getMenuAllCheckedKeys() {
//
let checkedKeys = this.$refs.menu.getCheckedKeys();
return checkedKeys;
},
//
getDeptAllCheckedKeys() {
//
let checkedKeys = this.$refs.dept.getCheckedKeys();
//
let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys;
},
}
};
</script>
<!--添加或修改保养部位信息对话框中保养标准的容器以便于添加滚动条功能-->
<style scoped>
.scrollable-tree-container {
width: 100%;
height: 200px;
overflow: auto; /* 当内容超出设定高度时显示滚动条 */
border: 1px solid #dcdcdc; /* 可选:边框样式 */
padding: 5px; /* 可选:内部填充 */
}
</style>

Loading…
Cancel
Save