项目能力管理删除

Gitea 3 days ago
parent 20efae8fc7
commit 739cae529f
  1. 265
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java
  2. 71
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/entity/Compskill.java
  3. 53
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/entity/Compskillvo.java
  4. 17
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/mapper/CompskillMapper.java
  5. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/mapper/xml/CompskillMapper.xml
  6. 14
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/service/ICompskillService.java
  7. 19
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/service/impl/CompskillServiceImpl.java
  8. 68
      jeecgboot-vue3-master/src/views/compskill/Compskill.api.ts
  9. 109
      jeecgboot-vue3-master/src/views/compskill/Compskill.data.ts
  10. 167
      jeecgboot-vue3-master/src/views/compskill/CompskillList.vue
  11. 70
      jeecgboot-vue3-master/src/views/compskill/components/CompskillForm.vue
  12. 67
      jeecgboot-vue3-master/src/views/compskill/components/CompskillModal.vue

@ -1,265 +0,0 @@
package org.jeecg.modules.demo.compskill.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.demo.annual.entity.Annual;
import org.jeecg.modules.demo.annual.service.IAnnualService;
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint;
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService;
import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.entity.Compskillvo;
import org.jeecg.modules.demo.compskill.service.ICompskillService;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Api(tags = "项目能力设置")
@RestController
@RequestMapping("/compskill/compskill")
@Slf4j
public class CompskillController extends JeecgController<Compskill, ICompskillService> {
@Autowired
private ICompskillService compskillService;
@Autowired
private IAnnualCompPointService annualCompPointService;
@Autowired
private IBasicsskillService basicsskillService;
@Autowired
private IAnnualService annualService;
@Autowired
private IAnnualCompService annualCompService;
@Autowired
private ICompService iCompService;
@Autowired
private ISysUserRoleService iSysUserRoleService;
/**
* 分页列表查询
*
* @param compskill
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "项目能力设置-分页列表查询")
@ApiOperation(value = "项目能力设置-分页列表查询", notes = "项目能力设置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<Compskillvo>> queryPageList(Compskill compskill,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal();
List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId());
Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
//角色编码 管理员&组委会&学校管理员 可以看到所有,其它用户可见到所属自己数据
Map<String, String> efficientRoleMap = new LinkedHashMap<>();
efficientRoleMap.put("admin", "admin");
efficientRoleMap.put("committee", "committee");
efficientRoleMap.put("superAdmin", "superAdmin");
LambdaQueryWrapper<Compskill> queryWrapper = new LambdaQueryWrapper<>();
// 查询所属当前登录用户数据
if (efficientRoleMap.containsValue(roleMap.get("admin"))
|| efficientRoleMap.containsValue(roleMap.get("committee"))
|| efficientRoleMap.containsValue(roleMap.get("superAdmin"))) {
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
if (!ObjectUtils.isEmpty(compList)) {
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds));
if (!ObjectUtils.isEmpty(annualCompList)) {
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
if (!ObjectUtils.isEmpty(annualCompPointList)) {
Set<String> annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds);
}
}
}
}
Page<Compskill> page = new Page<Compskill>(pageNo, pageSize);
Page<Compskillvo> page1 = new Page<>();
compskillService.page(page, queryWrapper);
BeanUtils.copyProperties(page, page1, "records");
List<Compskillvo> list = page.getRecords().stream().map((item) -> {
Compskillvo compskill1 = new Compskillvo();
BeanUtils.copyProperties(item, compskill1);
AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", compskill1.getAnnucompid()).one();
AnnualComp annualComp = null;
Annual annual = null;
if (annualCompPoint != null) {
annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one();
}
if (annualComp != null) {
annual = annualService.query().eq("id", annualComp.getAnnualid()).one();
}
List<Basicsskill> basicsskillList= basicsskillService.query().eq("id", compskill1.getCapacityid()).list();
Basicsskill basicsskill=null;
if(basicsskillList.size()>0)
{
basicsskill=basicsskillList.get(0);
}
if (annualCompPoint != null && basicsskill != null && annualComp != null && annual != null) {
compskill1.setAnnucompid(annualCompPoint.getObjName());
compskill1.setCapacityid(basicsskill.getName());
compskill1.setComp(annualComp.getName());
compskill1.setAnnual(annual.getAnnualName());
}
return compskill1;
}).collect(Collectors.toList());
page1.setRecords(list);
return Result.OK(page1);
}
/**
* 添加
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-添加")
@ApiOperation(value = "项目能力设置-添加", notes = "项目能力设置-添加")
//@RequiresPermissions("compskill:compskill:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody Compskill compskill) {
/* if (compskill != null) {
AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("obj_name", compskill.getAnnucompid()).one();
Basicsskill basicsskill = basicsskillService.query().eq("name", compskill.getCapacityid()).one();
if (annualCompPoint != null && basicsskill != null) {
compskill.setAnnucompid(annualCompPoint.getId());
compskill.setCapacityid(basicsskill.getId());
}
}*/
compskillService.save(compskill);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-编辑")
@ApiOperation(value = "项目能力设置-编辑", notes = "项目能力设置-编辑")
//@RequiresPermissions("compskill:compskill:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody Compskill compskill) {
compskillService.updateById(compskill);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "项目能力设置-通过id删除")
@ApiOperation(value = "项目能力设置-通过id删除", notes = "项目能力设置-通过id删除")
//@RequiresPermissions("compskill:compskill:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
compskillService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "项目能力设置-批量删除")
@ApiOperation(value = "项目能力设置-批量删除", notes = "项目能力设置-批量删除")
//@RequiresPermissions("compskill:compskill:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.compskillService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "项目能力设置-通过id查询")
@ApiOperation(value = "项目能力设置-通过id查询", notes = "项目能力设置-通过id查询")
@GetMapping(value = "/queryById")
public Result<Compskill> queryById(@RequestParam(name = "id", required = true) String id) {
Compskill compskill = compskillService.getById(id);
if (compskill == null) {
return Result.error("未找到对应数据");
}
return Result.OK(compskill);
}
/**
* 导出excel
*
* @param request
* @param compskill
*/
// @RequiresPermissions("compskill:compskill:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Compskill compskill) {
return super.exportXls(request, compskill, Compskill.class, "项目能力设置");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("compskill:compskill:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, Compskill.class);
}
}

@ -1,71 +0,0 @@
package org.jeecg.modules.demo.compskill.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Data
@TableName("compskill")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="compskill对象", description="项目能力设置")
public class Compskill implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**年度比赛项目id*/
@Excel(name = "年度比赛项目id", width = 15)
@ApiModelProperty(value = "年度比赛项目id")
private String annucompid;
/**能力id*/
@Excel(name = "能力id", width = 15)
@ApiModelProperty(value = "能力id")
private String capacityid;
/**权值*/
@Excel(name = "权值", width = 15)
@ApiModelProperty(value = "权值")
private Integer weight;
}

@ -1,53 +0,0 @@
package org.jeecg.modules.demo.compskill.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class Compskillvo {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**年度比赛项目id*/
@Excel(name = "年度比赛项目id", width = 15)
@ApiModelProperty(value = "年度比赛项目id")
private String annucompid;
/**能力id*/
@Excel(name = "能力id", width = 15)
@ApiModelProperty(value = "能力id")
private String capacityid;
/**权值*/
@Excel(name = "权值", width = 15)
@ApiModelProperty(value = "权值")
private Integer weight;
private String annual;
private String comp;
}

@ -1,17 +0,0 @@
package org.jeecg.modules.demo.compskill.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface CompskillMapper extends BaseMapper<Compskill> {
}

@ -1,5 +0,0 @@
<?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="org.jeecg.modules.demo.compskill.mapper.CompskillMapper">
</mapper>

@ -1,14 +0,0 @@
package org.jeecg.modules.demo.compskill.service;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface ICompskillService extends IService<Compskill> {
}

@ -1,19 +0,0 @@
package org.jeecg.modules.demo.compskill.service.impl;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.mapper.CompskillMapper;
import org.jeecg.modules.demo.compskill.service.ICompskillService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Service
public class CompskillServiceImpl extends ServiceImpl<CompskillMapper, Compskill> implements ICompskillService {
}

@ -1,68 +0,0 @@
import {defHttp} from '/@/utils/http/axios';
import {useMessage} from "/@/hooks/web/useMessage";
const {createConfirm} = useMessage();
enum Api {
list = '/compskill/compskill/list',
save = '/compskill/compskill/add',
edit = '/compskill/compskill/edit',
deleteOne = '/compskill/compskill/delete',
deleteBatch = '/compskill/compskill/deleteBatch',
importExcel = '/compskill/compskill/importExcel',
exportXls = '/compskill/compskill/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({
url: Api.deleteBatch,
data: params
}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

@ -1,109 +0,0 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '年度',
align: 'center',
dataIndex: 'annual',
},
{
title: '年度比赛',
align: 'center',
dataIndex: 'comp',
},
{
title: '年度比赛项目名称',
align: 'center',
dataIndex: 'annucompid',
},
{
title: '能力名称',
align: 'center',
dataIndex: 'capacityid',
},
{
title: '权值',
align: 'center',
dataIndex: 'weight',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
/* {
label: '年度比赛项目项目',
field: 'annucompid',
component: 'JPopup',
componentProps: ({ formActionType }) => {
const { setFieldsValue } = formActionType;
return {
setFieldsValue: setFieldsValue,
code: 'bsxm',
fieldConfig: [{ source: 'obj_name', target: 'annucompid' }],
multi: true,
};
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入年度比赛项目id!' }];
},
},*/
{
label: '',
field: 'annucompid',
component: 'Input',
show: false,
},
{
label: '能力名称',
field: 'capacityname',
component: 'JPopup',
componentProps: ({ formActionType }) => {
const { setFieldsValue } = formActionType;
return {
setFieldsValue: setFieldsValue,
code: 'jcnlmc',
fieldConfig: [{ source: 'name', target: 'capacityname' },{ source: 'id', target: 'capacityid' }],
multi: true,
};
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择能力!' }];
},
},
{
label: '',
field: 'capacityid',
component: 'Input',
show: false,
},
{
label: '权值',
field: 'weight',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入权值!' }];
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

@ -1,167 +0,0 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<!--字段回显插槽-->
<template #htmlSlot="{ text }">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{ text }">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{ text }">
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CompskillModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="compskill-compskill" setup>
import {ref, computed, unref, onMounted} from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CompskillModal from './components/CompskillModal.vue';
import { columns, searchFormSchema } from './Compskill.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Compskill.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import {useRoute} from "vue-router";
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '项目能力设置',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right',
},
},
exportConfig: {
name: '项目能力设置',
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
/**
* 新增事件
*/
const route = useRoute();
const annucompid = ref((''))
onMounted(() => {
annucompid.value = route.query.id
console.log(annucompid.value,'annucompid')
// handleAdd()
})
function handleAdd() {
openModal(true, {
record:{annucompid: annucompid.value},
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
onClick: handleDelete.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
</script>
<style scoped></style>

@ -1,70 +0,0 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm>
<div style="width: 100%;text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import {BasicForm, useForm} from '/@/components/Form/index';
import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import {getBpmFormSchema} from '../Compskill.data';
import {saveOrUpdate} from '../Compskill.api';
export default defineComponent({
name: "CompskillForm",
components:{
BasicForm
},
props:{
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props){
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
});
const formDisabled = computed(()=>{
if(props.formData.disabled === false){
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/compskill/compskill/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
formData = {...data}
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params)
await saveOrUpdate(params, true)
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
}
}
});
</script>

@ -1,67 +0,0 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../Compskill.data';
import {saveOrUpdate} from '../Compskill.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: 24}
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
console.log("data.record=="+data.record.annucompid);
// if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
// }
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number){
width: 100%
}
:deep(.ant-calendar-picker){
width: 100%
}
</style>
Loading…
Cancel
Save