diff --git a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js index 808df50..d92272e 100644 --- a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js +++ b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js @@ -283,6 +283,15 @@ export const JeecgListMixin = { this.$refs.modalForm.title = "复制"; this.$refs.modalForm.disableSubmit = false; }, + fuzhi1: function(record){ + record.id='' + record.rule_no='' + record.rule_code='' + this.$refs.modalForm.edit(record); + this.$refs.modalForm.title = "复制"; + this.$refs.modalForm.disableSubmit = false; + }, + handleAdd: function () { this.$refs.modalForm.add(); this.$refs.modalForm.title = "新增"; diff --git a/ant-design-vue-jeecg/src/views/rulex/RulexList.vue b/ant-design-vue-jeecg/src/views/rulex/RulexList.vue index 9a41f9d..01e1ff2 100644 --- a/ant-design-vue-jeecg/src/views/rulex/RulexList.vue +++ b/ant-design-vue-jeecg/src/views/rulex/RulexList.vue @@ -4,6 +4,28 @@
+ + + + + + + + + + + + + + + + + + + 查询 + 重置 + +
@@ -17,13 +39,14 @@ 导入 - - - - 删除 - - 批量操作 - + + + + + + + + 返回 @@ -67,23 +90,24 @@ - + + 详情 + + + 复制 + + DEBUG + 编辑 - - 更多 - - + 详情 - - + 删除 - - - + @@ -99,7 +123,9 @@ import { mixinDevice } from '@/utils/mixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin' import RulexModal from './modules/RulexModal' - + import {getAction} from "@api/manage"; + import {filterObj} from "@/utils/util"; + import store from '@/store' export default { name: 'RulexList', mixins:[JeecgListMixin, mixinDevice], @@ -122,14 +148,14 @@ } }, { - title:'对应模块id', + title:'对应模块', align:"center", - dataIndex: 'moduleId' + dataIndex: 'moduleId_dictText' }, { - title:'对应功能id', + title:'对应功能', align:"center", - dataIndex: 'functionId' + dataIndex: 'functionId_dictText' }, { title:'规则序号', @@ -153,7 +179,7 @@ scopedSlots: {customRender: 'imgSlot'} }, { - title:'对应实体id', + title:'对应实体', align:"center", dataIndex: 'tableId_dictText' }, @@ -162,11 +188,6 @@ align:"center", dataIndex: 'fieldId_dictText' }, - { - title:'责任人', - align:"center", - dataIndex: 'managerUsers' - }, { title:'任务等级', align:"center", @@ -197,21 +218,6 @@ align:"center", dataIndex: 'realDuration' }, - { - title:'规则状态', - align:"center", - dataIndex: 'status' - }, - { - title:'版本状态', - align:"center", - dataIndex: 'verisonStatus' - }, - { - title:'版本号', - align:"center", - dataIndex: 'verison' - }, { title: '操作', dataIndex: 'action', @@ -227,13 +233,25 @@ deleteBatch: "/rulex/rulex/deleteBatch", exportXlsUrl: "/rulex/rulex/exportXls", importExcelUrl: "rulex/rulex/importExcel", - + loginrole:'functionx/functionx/loginrole', + }, dictOptions:{}, superFieldList:[], + loadRouteType:false, + queryParam:{}, + moduleid:'', + role:'', + table:'', + field:'fieldx,field_name,id', } }, created() { + + let usercode = store.getters.userInfo.id + this.loginrole(usercode) + this.moduleid=this.$route.query.moduleid + this.table="tablex,table_name,id,module_id="+this.$route.query.moduleid this.getSuperFieldList(); }, computed: { @@ -242,6 +260,27 @@ }, }, methods: { + ziduan(){ + this.field="fieldx,field_name,id,table_id="+this.model.tableId; + }, + loginrole(id){ + getAction(this.url.loginrole,{id:id}).then((res)=>{ + if (res.success) { + //重新计算分页问题 + this.role=res.result; + + } + }) + }, + fanhui(){ + this.$router.push({ + /*返回产品*/ + path: '/src/views/functionx/FunctionxList',/*在引号中填写返回vue*/ + query:{ + moduleid:this.moduleid + } + }); + }, initDictConfig(){ }, getSuperFieldList(){ @@ -265,7 +304,63 @@ fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) fieldList.push({type:'string',value:'verison',text:'版本号',dictCode:''}) this.superFieldList = fieldList - } + }, + + loadParameter() { + if (this.loadRouteType === false) { + // this.id = this.$route.query.moduleid; + // console.log("***********想看看") + this.loadRouteType = true; + } + }, + loadData(arg) { + if (!this.url.list) { + this.$message.error("请设置url.list属性!"); + return + } + //加载数据 若传入参数1则加载第一页的内容 + if (arg === 1) { + this.ipagination.current = 1; + } + this.loadParameter(); + var params = this.getQueryParams();//查询条件 + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ + this.dataSource = res.result.records || res.result; + if (res.result.total) { + this.ipagination.total = res.result.total; + } else { + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + }, + getQueryParams() { + //获取查询条件 + let sqp = {} + if (this.superQueryParams) { + sqp['superQueryParams'] = encodeURI(this.superQueryParams) + sqp['superQueryMatchType'] = this.superQueryMatchType + } + var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters); + param.field = this.getQueryField(); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + //param.id=this.id; + param.functionId = this.$route.query.functionid; + return filterObj(param); + }, + searchReset() { + this.queryParam='' + this.loadData(); + }, } } diff --git a/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue index 500fef2..9778458 100644 --- a/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue +++ b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue @@ -15,7 +15,7 @@ - + @@ -23,74 +23,50 @@ + + - - - - - - - - - - - - + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - + + @@ -119,6 +95,8 @@ data () { return { model:{ + ruleNo:'', + ruleCode:'' }, labelCol: { xs: { span: 24 }, @@ -145,9 +123,9 @@ tableId: [ { required: true, message: '请输入对应实体id!'}, ], - fieldId: [ - { required: true, message: '请输入对应字段!'}, - ], + // fieldId: [ + // { required: true, message: '请输入对应字段!'}, + // ], workLevel: [ { required: true, message: '请输入任务等级!'}, ], @@ -170,8 +148,11 @@ url: { add: "/rulex/rulex/add", edit: "/rulex/rulex/edit", - queryById: "/rulex/rulex/queryById" - } + queryById: "/rulex/rulex/queryById", + sort:'/rulex/rulex/sort' + }, + table:'', + field:'fieldx,field_name,id', } }, computed: { @@ -182,10 +163,23 @@ created () { //备份model原始值 this.model.moduleId=this.$route.query.moduleid + this.table="tablex,table_name,id,module_id="+this.model.moduleId this.model.functionId=this.$route.query.functionid + this.sort() this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + sort(){ + getAction(this.url.sort,{id:this.model.functionId}).then((res)=>{ + console.log(res) + this.model.ruleNo=res.result.substring(0,3); + this.model.ruleCode=res.result.substring(3)+this.model.ruleNo; + console.log(this.model.ruleNo) + }) + }, + ziduan(){ + this.field="fieldx,field_name,id,table_id="+this.model.tableId; + }, add () { this.edit(this.modelDefault); }, diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java index d32d9f9..3d6088e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java @@ -12,6 +12,8 @@ import javax.servlet.http.HttpServletResponse; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper; import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.service.IRulexService; @@ -49,8 +51,11 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class RulexController extends JeecgController { @Autowired private IRulexService rulexService; - - /** + @Autowired + FunctionxMapper functionxMapper; + + + /** * 分页列表查询 * * @param rulex @@ -66,12 +71,24 @@ public class RulexController extends JeecgController { @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(rulex, req.getParameterMap()); +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(rulex, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("function_id",rulex.getFunctionId()); + queryWrapper.orderByDesc("work_level"); + if(rulex.getRuleCode()!=null){ + queryWrapper.eq("rule_code",rulex.getRuleCode()); + } + if(rulex.getTableId()!=null){ + queryWrapper.eq("table_id",rulex.getTableId()); + } + if(rulex.getFieldId()!=null){ + queryWrapper.eq("field_id",rulex.getFieldId()); + } Page page = new Page(pageNo, pageSize); IPage pageList = rulexService.page(page, queryWrapper); return Result.OK(pageList); } - + /** * 添加 * @@ -82,10 +99,16 @@ public class RulexController extends JeecgController { @ApiOperation(value="规则管理-添加", notes="规则管理-添加") @PostMapping(value = "/add") public Result add(@RequestBody Rulex rulex) { + if(rulex.getFunctionId()==null){ + return Result.error("功能点错误!!!"); + } + Functionx functionx = functionxMapper.selectById(rulex.getFunctionId()); + rulex.setManagerUsers(functionx.getManagerUsers()); + rulex.setWorkStatus(functionx.getWorkStatus()); rulexService.save(rulex); return Result.OK("添加成功!"); } - + /** * 编辑 * @@ -99,7 +122,7 @@ public class RulexController extends JeecgController { rulexService.updateById(rulex); return Result.OK("编辑成功!"); } - + /** * 通过id删除 * @@ -113,7 +136,7 @@ public class RulexController extends JeecgController { rulexService.removeById(id); return Result.OK("删除成功!"); } - + /** * 批量删除 * @@ -127,7 +150,7 @@ public class RulexController extends JeecgController { this.rulexService.removeByIds(Arrays.asList(ids.split(","))); return Result.OK("批量删除成功!"); } - + /** * 通过id查询 * @@ -168,4 +191,9 @@ public class RulexController extends JeecgController { return super.importExcel(request, response, Rulex.class); } -} + @GetMapping(value = "/sort") + public Result sort(@RequestParam(name="id",required=true) String id) { + return rulexService.sort(id); + } + + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/mapper/RulexMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/mapper/RulexMapper.java index cba71e6..eb0df0a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/mapper/RulexMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/mapper/RulexMapper.java @@ -3,6 +3,7 @@ package org.jeecg.modules.demo.rulex.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.jeecg.modules.demo.rulex.entity.Rulex; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -14,4 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface RulexMapper extends BaseMapper { + @Select("select rule_no from rulex where function_id=#{id} order by rule_no desc limit 0,1") + String sort(String id); + + @Select("select function_code from functionx where id=#{id}") + String find(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java index 71a977f..8b7bd3f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java @@ -1,5 +1,6 @@ package org.jeecg.modules.demo.rulex.service; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.rulex.entity.Rulex; import com.baomidou.mybatisplus.extension.service.IService; @@ -11,4 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IRulexService extends IService { + Result sort(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java index 0ad2443..d50138b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java @@ -1,8 +1,10 @@ package org.jeecg.modules.demo.rulex.service.impl; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.mapper.RulexMapper; import org.jeecg.modules.demo.rulex.service.IRulexService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,4 +18,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class RulexServiceImpl extends ServiceImpl implements IRulexService { + @Autowired + RulexMapper rulexMapper; + @Override + public Result sort(String id) { + String sort=rulexMapper.sort(id); + String functioncode=rulexMapper.find(id); + if(sort==null){ + return Result.OK("001"+functioncode); + }else{ + int i = Integer.parseInt(sort); + i++; + String s = Integer.toString(i); + while(s.length()<3){ + s="0"+s; + } + return Result.OK(s+functioncode); + } + } }