dnc程序修改

This commit is contained in:
xusd 2024-09-05 09:12:57 +08:00
parent d798142638
commit 161e94603d
7 changed files with 85 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoPageReqVO;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoRespVO;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoSaveReqVO;
import com.inspur.module.system.controller.dnc.vo.UpdateStatusVO;
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
import com.inspur.module.system.dal.dataobject.dnc.DncProgramInfoDO;
import com.inspur.module.system.service.dnc.DncProgramInfoService;
@ -121,4 +122,11 @@ public class DncProgramInfoController {
ExcelUtils.write(response, "DNC程序信息.xls", "数据", DncProgramInfoRespVO.class, voList);
}
@PostMapping("/updateStatus")
@Operation(summary = "修改DNC程序信息状态")
@PreAuthorize("@ss.hasPermission('imt:dnc-program-info:update')")
public Boolean updateStatus(@RequestBody UpdateStatusVO vo){
return dncProgramInfoService.updateStatus(vo);
}
}

View File

@ -0,0 +1,19 @@
package com.inspur.module.system.controller.dnc.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @Author xusd
* @Date 2024/9/4 17:13
**/
@Data
public class UpdateStatusVO {
@Schema(description = "dnc程序id")
private String dncProgramId;
@Schema(description = "状态")
private Integer status;
}

View File

@ -3,6 +3,7 @@ package com.inspur.module.system.service.dnc;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoPageReqVO;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoSaveReqVO;
import com.inspur.module.system.controller.dnc.vo.UpdateStatusVO;
import com.inspur.module.system.dal.dataobject.dnc.DncProgramInfoDO;
import javax.validation.*;
@ -52,4 +53,13 @@ public interface DncProgramInfoService {
*/
PageResult<DncProgramInfoDO> getDncProgramInfoPage(DncProgramInfoPageReqVO pageReqVO);
/**
* 修改DNC程序信息状态
*
* @Author xusd
* @Date 17:31 2024/9/4
* @param vo
* @return java.lang.Boolean
*/
Boolean updateStatus(UpdateStatusVO vo);
}

View File

@ -1,8 +1,10 @@
package com.inspur.module.system.service.dnc;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoPageReqVO;
import com.inspur.module.system.controller.dnc.vo.DncProgramInfoSaveReqVO;
import com.inspur.module.system.controller.dnc.vo.UpdateStatusVO;
import com.inspur.module.system.dal.dataobject.dnc.DncProgramInfoDO;
import com.inspur.module.system.dal.mysql.dnc.DncProgramInfoMapper;
import org.springframework.stereotype.Service;
@ -29,6 +31,7 @@ public class DncProgramInfoServiceImpl implements DncProgramInfoService {
public String createDncProgramInfo(DncProgramInfoSaveReqVO createReqVO) {
// 插入
DncProgramInfoDO dncProgramInfo = BeanUtils.toBean(createReqVO, DncProgramInfoDO.class);
dncProgramInfo.setStatus(1);
dncProgramInfoMapper.insert(dncProgramInfo);
// 返回
return dncProgramInfo.getDncProgramId();
@ -67,4 +70,11 @@ public class DncProgramInfoServiceImpl implements DncProgramInfoService {
return dncProgramInfoMapper.selectPage(pageReqVO);
}
@Override
public Boolean updateStatus(UpdateStatusVO vo) {
LambdaUpdateWrapper<DncProgramInfoDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(DncProgramInfoDO::getStatus, vo.getStatus());
updateWrapper.eq(DncProgramInfoDO::getDncProgramId, vo.getDncProgramId());
return dncProgramInfoMapper.update(updateWrapper) > 0;
}
}

View File

@ -51,3 +51,12 @@ export function exportDncProgramInfoExcel(params) {
responseType: 'blob'
})
}
// 修改DNC程序信息状态
export function updateStatus(data) {
return request({
url: '/dnc/dncProgramInfo/updateStatus',
method: 'post',
data: data
})
}

View File

@ -17,17 +17,11 @@
<el-form-item label="版本号" prop="version">
<el-input v-model="formData.version" placeholder="请输入版本号"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="formData.status" placeholder="请选择状态">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<el-form-item label="文件下载路径">
<FileUpload v-model="formData.filePath" limit="1"/>
<FileUpload v-model="formData.filePath" :limit="1"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -125,12 +119,12 @@ export default {
const res = await DncProgramInfoApi.getDncProgramInfo(id);
this.formData = res.data;
this.cascaderValue = this.changeDetSelect(this.formData.equipId,this.equipCascader);
this.title = "修改DNC程序信息";
this.dialogTitle = "修改DNC程序信息";
} finally {
this.formLoading = false;
}
}
this.title = "新增DNC程序信息";
this.dialogTitle = "新增DNC程序信息";
},
/** 提交按钮 */
async submitForm() {

View File

@ -48,7 +48,15 @@
<el-table-column label="版本号" align="center" prop="version"/>
<el-table-column label="状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
<el-switch
v-model="scope.row.status"
active-color="#13ce66"
inactive-color="#ff4949"
:active-value="0"
:inactive-value="1"
active-text="开"
inactive-text="关"
@change="updateStatus(scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
@ -60,6 +68,9 @@
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['imt:dnc-program-info:delete']">删除
</el-button>
<el-button size="mini" type="text" icon="el-icon-download" @click="handleDownload(scope.row)"
v-hasPermi="['imt:dnc-program-info:query']">下载文件
</el-button>
</template>
</el-table-column>
</el-table>
@ -75,6 +86,8 @@
import * as DncProgramInfoApi from '@/api/system/dnc/dncProgramInfo';
import DncProgramInfoForm from './DncProgramInfoForm.vue';
import {getEquipCascader} from "@/api/system/equip/equipInfo";
import item from "@/layout/components/Sidebar/Item.vue";
import {updateStatus} from "@/api/system/dnc/dncProgramInfo";
export default {
name: "DncProgramInfo",
@ -118,6 +131,14 @@ export default {
})
},
methods: {
handleDownload(row){
window.open(row.filePath)
},
updateStatus(value){
updateStatus(value).then(res=>{
this.getList();
})
},
cascaderChange(value){
if (value.length > 0){
this.queryParams.equipId = value[1];
@ -131,6 +152,10 @@ export default {
this.loading = true;
const res = await DncProgramInfoApi.getDncProgramInfoPage(this.queryParams);
this.list = res.data.list;
this.list.forEach(item=>{
item.statusBoolean = item.status === 0;
})
console.log(this.list)
this.total = res.data.total;
} finally {
this.loading = false;