1、个人总积分功能开发

main
zhc077 1 year ago
parent 590e6a1528
commit c989748ec5
  1. 152
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompTotalScoreController.java
  2. 75
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompTotalScore.java
  3. 17
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompTotalScoreMapper.java
  4. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompTotalScoreMapper.xml
  5. 14
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompTotalScoreService.java
  6. 19
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java
  7. 145
      jeecgboot-vue3-master/src/views/annualScore/PersonalCompScore.data.ts
  8. 0
      jeecgboot-vue3-master/src/views/annualScore/persoanlCompScore/PersonalCompScore.api.ts
  9. 156
      jeecgboot-vue3-master/src/views/annualScore/persoanlCompScore/PersonalCompScore.data.ts
  10. 0
      jeecgboot-vue3-master/src/views/annualScore/persoanlCompScore/PersonalCompScoreList.vue
  11. 2
      jeecgboot-vue3-master/src/views/annualScore/persoanlCompScore/components/PersonalCompScoreForm.vue
  12. 2
      jeecgboot-vue3-master/src/views/annualScore/persoanlCompScore/components/PersonalCompScoreModal.vue
  13. 64
      jeecgboot-vue3-master/src/views/annualScore/personalCompTotalScore/PersonalCompTotalScore.api.ts
  14. 104
      jeecgboot-vue3-master/src/views/annualScore/personalCompTotalScore/PersonalCompTotalScore.data.ts
  15. 196
      jeecgboot-vue3-master/src/views/annualScore/personalCompTotalScore/PersonalCompTotalScoreList.vue
  16. 70
      jeecgboot-vue3-master/src/views/annualScore/personalCompTotalScore/components/PersonalCompTotalScoreForm.vue
  17. 66
      jeecgboot-vue3-master/src/views/annualScore/personalCompTotalScore/components/PersonalCompTotalScoreModal.vue

@ -0,0 +1,152 @@
package org.jeecg.modules.demo.annualScore.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.authz.annotation.RequiresPermissions;
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.query.QueryGenerator;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService;
import org.springframework.beans.factory.annotation.Autowired;
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.Arrays;
/**
* @Description: 个人总积分
* @Author: jeecg-boot
* @Date: 2023-11-01
* @Version: V1.0
*/
@Api(tags = "个人总积分")
@RestController
@RequestMapping("/annualScore/personalCompTotalScore")
@Slf4j
public class PersonalCompTotalScoreController extends JeecgController<PersonalCompTotalScore, IPersonalCompTotalScoreService> {
@Autowired
private IPersonalCompTotalScoreService personalCompTotalScoreService;
/**
* 分页列表查询
*
* @param personalCompTotalScore
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "个人总积分-分页列表查询")
@ApiOperation(value = "个人总积分-分页列表查询", notes = "个人总积分-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<PersonalCompTotalScore>> queryPageList(PersonalCompTotalScore personalCompTotalScore,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<PersonalCompTotalScore> queryWrapper = QueryGenerator.initQueryWrapper(personalCompTotalScore, req.getParameterMap());
Page<PersonalCompTotalScore> page = new Page<PersonalCompTotalScore>(pageNo, pageSize);
IPage<PersonalCompTotalScore> pageList = personalCompTotalScoreService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param personalCompTotalScore
* @return
*/
@ApiOperation(value = "个人总积分-添加", notes = "个人总积分-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody PersonalCompTotalScore personalCompTotalScore) {
personalCompTotalScoreService.save(personalCompTotalScore);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param personalCompTotalScore
* @return
*/
@ApiOperation(value = "个人总积分-编辑", notes = "个人总积分-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody PersonalCompTotalScore personalCompTotalScore) {
personalCompTotalScoreService.updateById(personalCompTotalScore);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "个人总积分-通过id删除", notes = "个人总积分-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
personalCompTotalScoreService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "个人总积分-批量删除", notes = "个人总积分-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.personalCompTotalScoreService.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<PersonalCompTotalScore> queryById(@RequestParam(name = "id", required = true) String id) {
PersonalCompTotalScore personalCompTotalScore = personalCompTotalScoreService.getById(id);
if (personalCompTotalScore == null) {
return Result.error("未找到对应数据");
}
return Result.OK(personalCompTotalScore);
}
/**
* 导出excel
*
* @param request
* @param personalCompTotalScore
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PersonalCompTotalScore personalCompTotalScore) {
return super.exportXls(request, personalCompTotalScore, PersonalCompTotalScore.class, "个人总积分");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, PersonalCompTotalScore.class);
}
}

@ -0,0 +1,75 @@
package org.jeecg.modules.demo.annualScore.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-11-01
* @Version: V1.0
*/
@Data
@TableName("personal_comp_total_score")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="personal_comp_total_score对象", description="个人总积分")
public class PersonalCompTotalScore 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;
/**院系*/
@Excel(name = "院系", width = 15)
@ApiModelProperty(value = "院系")
private String depet;
/**学号*/
@Excel(name = "学号", width = 15)
@ApiModelProperty(value = "学号")
private String workOn;
/**姓名*/
@Excel(name = "姓名", width = 15)
@ApiModelProperty(value = "姓名")
private String name;
/**总积分*/
@Excel(name = "总积分", width = 15)
@ApiModelProperty(value = "总积分")
private Double score;
/**描述*/
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private String remark;
}

@ -0,0 +1,17 @@
package org.jeecg.modules.demo.annualScore.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 个人总积分
* @Author: jeecg-boot
* @Date: 2023-11-01
* @Version: V1.0
*/
public interface PersonalCompTotalScoreMapper extends BaseMapper<PersonalCompTotalScore> {
}

@ -0,0 +1,5 @@
<?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.annualScore.mapper.PersonalCompTotalScoreMapper">
</mapper>

@ -0,0 +1,14 @@
package org.jeecg.modules.demo.annualScore.service;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 个人总积分
* @Author: jeecg-boot
* @Date: 2023-11-01
* @Version: V1.0
*/
public interface IPersonalCompTotalScoreService extends IService<PersonalCompTotalScore> {
}

@ -0,0 +1,19 @@
package org.jeecg.modules.demo.annualScore.service.impl;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore;
import org.jeecg.modules.demo.annualScore.mapper.PersonalCompTotalScoreMapper;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 个人总积分
* @Author: jeecg-boot
* @Date: 2023-11-01
* @Version: V1.0
*/
@Service
public class PersonalCompTotalScoreServiceImpl extends ServiceImpl<PersonalCompTotalScoreMapper, PersonalCompTotalScore> implements IPersonalCompTotalScoreService {
}

@ -1,145 +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: 'depet_dictText'
},
{
title: '学号',
align:"center",
dataIndex: 'workOn'
},
{
title: '姓名',
align:"center",
dataIndex: 'name'
},
{
title: '年度',
align:"center",
dataIndex: 'annualId_dictText'
},
{
title: '年度比赛',
align:"center",
dataIndex: 'annualCompId_dictText'
},
{
title: '年度比赛项目',
align:"center",
dataIndex: 'annualCompP_dictText'
},
{
title: '个人积分',
align: "center",
dataIndex: 'score',
},
// {
// title: '备注',
// align:"center",
// dataIndex: 'remark'
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "所属院系",
field: 'depet',
component: 'Input',
colProps: {span: 6},
},
{
label: "学号",
field: 'workOn',
component: 'Input',
colProps: {span: 6},
},
{
label: "姓名",
field: 'name',
component: 'Input',
colProps: {span: 6},
},
{
label: "年度",
field: 'annualId',
component: 'Input',
colProps: {span: 6},
},
{
label: "年度比赛",
field: 'annualCompId',
component: 'Input',
colProps: {span: 6},
},
{
label: "年度比赛项目",
field: 'annualCompP',
component: 'Input',
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '学号',
field: 'workOn',
component: 'Input',
// readonly:true
},
{
label: '姓名',
field: 'name',
component: 'Input',
},
{
label: '年度',
field: 'annualId',
component: 'Input',
},
{
label: '年度比赛',
field: 'annualCompId',
component: 'Input',
},
{
label: '年度比赛项目',
field: 'annualCompP',
component: 'Input',
// componentProps: { readOnly: true },
},
{
label: '个人积分',
field: 'score',
component: 'InputNumber',
// isFieldEditable: false,
},
{
label: '备注',
field: 'remark',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

@ -0,0 +1,156 @@
import {BasicColumn, FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
{
title: '所属院系',
align: "center",
dataIndex: 'depet_dictText'
},
{
title: '年度',
align: "center",
dataIndex: 'annualId_dictText'
},
{
title: '年度比赛',
align: "center",
dataIndex: 'annualCompId_dictText'
},
{
title: '年度比赛项目',
align: "center",
dataIndex: 'annualCompP_dictText'
},
{
title: '学号',
align: "center",
dataIndex: 'workOn'
},
{
title: '姓名',
align: "center",
dataIndex: 'name'
},
{
title: '个人积分',
align: "center",
dataIndex: 'score',
},
// {
// title: '备注',
// align:"center",
// dataIndex: 'remark'
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "院系",
field: 'depet',
component: 'JDictSelectTag',
componentProps: {
dictCode: "sys_depart,depart_name,id"
},
colProps: {span: 6},
},
{
label: "学号",
field: 'workOn',
component: 'JDictSelectTag',
componentProps: {
dictCode: "sys_user,work_no,work_no"
},
colProps: {span: 6},
},
{
label: "姓名",
field: 'name',
component: 'Input',
colProps: {span: 6},
},
{
label: "年度",
field: 'annualId',
component: 'JDictSelectTag',
componentProps: {
dictCode: "annual,annual_name,id"
},
colProps: {span: 6},
},
// {
// label: "年度比赛",
// field: 'annualCompId',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: "annual_comp,name,id"
// },
// colProps: {span: 6},
// },
{
label: "年度比赛项目",
field: 'annualCompP',
component: 'JDictSelectTag',
componentProps: {
dictCode: "annual_comp_point,obj_name,id"
},
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '学号',
field: 'workOn',
component: 'Input',
// readonly:true
},
{
label: '姓名',
field: 'name',
component: 'Input',
},
{
label: '年度',
field: 'annualId',
component: 'Input',
},
{
label: '年度比赛',
field: 'annualCompId',
component: 'Input',
},
{
label: '年度比赛项目',
field: 'annualCompP',
component: 'Input',
// componentProps: { readOnly: true },
},
{
label: '个人积分',
field: 'score',
component: 'InputNumber',
// isFieldEditable: false,
},
{
label: '备注',
field: 'remark',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

@ -8,7 +8,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {BasicForm, useForm} from '/@/components/Form/index'; import {BasicForm, useForm} from '/@/components/Form';
import {computed, defineComponent} from 'vue'; import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios'; import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';

@ -7,7 +7,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import {ref, computed, unref} from 'vue'; import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal'; import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index'; import {BasicForm, useForm} from '/@/components/Form';
import {formSchema} from '../PersonalCompScore.data'; import {formSchema} from '../PersonalCompScore.data';
import {saveOrUpdate} from '../PersonalCompScore.api'; import {saveOrUpdate} from '../PersonalCompScore.api';
// Emits // Emits

@ -0,0 +1,64 @@
import {defHttp} from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/annualScore/personalCompTotalScore/list',
save='/annualScore/personalCompTotalScore/add',
edit='/annualScore/personalCompTotalScore/edit',
deleteOne = '/annualScore/personalCompTotalScore/delete',
deleteBatch = '/annualScore/personalCompTotalScore/deleteBatch',
importExcel = '/annualScore/personalCompTotalScore/importExcel',
exportXls = '/annualScore/personalCompTotalScore/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});
}

@ -0,0 +1,104 @@
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: 'depet'
},
{
title: '学号',
align:"center",
dataIndex: 'workOn'
},
{
title: '姓名',
align:"center",
dataIndex: 'name'
},
{
title: '总积分',
align:"center",
dataIndex: 'score'
},
// {
// title: '描述',
// align:"center",
// dataIndex: 'remark'
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "院系",
field: 'depet',
component: 'JDictSelectTag',
componentProps:{
dictCode:"sys_depart,depart_name,id"
},
colProps: {span: 6},
},
{
label: "学号",
field: 'workOn',
// component: 'Input',
component: 'JDictSelectTag',
componentProps:{
dictCode:"sys_user,work_no,work_no"
},
colProps: {span: 6},
},
{
label: "姓名",
field: 'name',
component: 'Input',
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '学号',
field: 'workOn',
component: 'Input',
dynamicDisabled:true
},
{
label: '姓名',
field: 'name',
component: 'Input',
dynamicDisabled:true
},
{
label: '总积分',
field: 'score',
component: 'InputNumber',
dynamicDisabled:true
},
{
label: '描述',
field: 'remark',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

@ -0,0 +1,196 @@
<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"></Icon>-->
<!-- 删除-->
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </template>-->
<!-- <a-button>批量操作-->
<!-- <Icon icon="mdi:chevron-down"></Icon>-->
<!-- </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>
<!-- 表单区域 -->
<PersonalCompTotalScoreModal @register="registerModal"
@success="handleSuccess"></PersonalCompTotalScoreModal>
</div>
</template>
<script lang="ts" name="annualScore-personalCompTotalScore" setup>
import {ref} from 'vue';
import {BasicTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import {useListPage} from '/@/hooks/system/useListPage'
import PersonalCompTotalScoreModal from './components/PersonalCompTotalScoreModal.vue'
import {columns, searchFormSchema} from './PersonalCompTotalScore.data';
import {
batchDelete,
deleteOne,
getExportUrl,
getImportUrl,
list
} from './PersonalCompTotalScore.api';
import {downloadFile} from '/@/utils/common/renderUtils';
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
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
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: handleDetail.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

@ -0,0 +1,70 @@
<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 '../PersonalCompTotalScore.data';
import {saveOrUpdate} from '../PersonalCompTotalScore.api';
export default defineComponent({
name: "PersonalCompTotalScoreForm",
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 = '/annualScore/personalCompTotalScore/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>

@ -0,0 +1,66 @@
<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 '../PersonalCompTotalScore.data';
import {saveOrUpdate} from '../PersonalCompTotalScore.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;
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