From 10f78f85875f539590a757f7c17992c6c0ae0773 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Thu, 03 Jun 2021 23:36:39 +0800
Subject: [PATCH] 业绩规则2
---
/dev/null | 250 -------------------------------
zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html | 168 +++++++++++++-------
zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java | 13 -
3 files changed, 111 insertions(+), 320 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java
index 0bd78af..8d3d386 100644
--- a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java
@@ -15,7 +15,6 @@
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveRule;
import com.matrix.system.hive.dao.AchieveRuleDao;
-import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hiveErp.pojo.AchieveRuleItem;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
@@ -46,11 +45,8 @@
@PostMapping("/add")
public AjaxResult add(@RequestBody @Validated AchieveRule achieveRule) {
- WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L));
- if(CollectionUtils.isEmpty(achieveRule.getRuleItemList())){
- return AjaxResult.buildFailInstance("规则设置不能为空");
- }
+
String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList());
achieveRule.setRules(rules);
@@ -72,14 +68,11 @@
*/
@PostMapping("/update")
public AjaxResult update(@RequestBody @Validated AchieveRule achieveRule) {
- WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L));
+
if (achieveRule.getId() == null) {
return AjaxResult.buildFailInstance("id不能为空");
}
- if(CollectionUtils.isEmpty(achieveRule.getRuleItemList())){
- return AjaxResult.buildFailInstance("规则设置不能为空");
- }
String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList());
achieveRule.setRules(rules);
@@ -111,7 +104,7 @@
*/
@PostMapping("/selectList")
public AjaxResult selectList(@RequestBody BasePageQueryDto pageDto) {
- WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L));
+
SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
Page<AchieveRule> page = new Page<>(pageDto.getPageNum(), pageDto.getPageSize());
LambdaQueryWrapper<AchieveRule> lambdaQueryWrapper = new LambdaQueryWrapper<AchieveRule>()
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html
index 5edbdea..1c379bf 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html
@@ -15,21 +15,24 @@
<link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
<title></title>
<style>
- .panel-body{
+ .panel-body {
overflow: hidden;
}
- .buttonPanel{
+
+ .buttonPanel {
background: #ffffff;
- padding: 10px 10px ;
+ padding: 10px 10px;
margin: 0px 0px 10px 0px;
}
- .rowPanel{
+
+ .rowPanel {
background: #ffffff;
- padding: 0px 10px ;
+ padding: 0px 10px;
padding-top: 10px;
margin: 0px 0px 10px 0px;
}
- .paginationStyle{
+
+ .paginationStyle {
background: #ffffff;
padding: 10px 10px;
margin: 0px 0px 10px 0px;
@@ -41,22 +44,22 @@
<div class="panel-body" id="app">
<el-row class="buttonPanel">
- <el-button @click="dialogVisible = true" type="primary" >新增</el-button>
+ <el-button @click="openAdd" type="primary">新增</el-button>
</el-row>
- <el-row class="rowPanel" >
- <el-form ref="form" :model="form" inline >
+ <el-row class="rowPanel">
+ <el-form ref="form" :model="form" inline>
<el-form-item label="规则名称" prop="queryKey">
<el-input v-model="form.keyword" placeholder="请输入规则名称"></el-input>
</el-form-item>
- <el-button type="primary" @click="search" >搜索</el-button>
+ <el-button type="primary" @click="search">搜索</el-button>
<el-button @click="resetForm('form')">重置</el-button>
</el-form>
</el-row>
- <el-row class="table-style" >
+ <el-row class="table-style">
- <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange">
+ <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange">
<el-table-column
prop="name"
label="规则名称"
@@ -88,12 +91,13 @@
<el-table-column label="操作">
<template slot-scope="scope">
+ <el-button type="text" @click="openModify(scope.$index, scope.row)" size="small">修改</el-button>
<el-button type="text" @click="remove(scope.$index, scope.row)" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
- <el-row class="paginationStyle" >
+ <el-row class="paginationStyle">
<el-pagination background
@size-change="changePageSize"
@current-change="changeCurrentPage"
@@ -106,9 +110,9 @@
</el-row>
<el-dialog
- title="提示"
+ title="title"
:visible.sync="dialogVisible"
- width="30%"
+ width="60%"
:before-close="handleClose">
<span>这是一段信息</span>
<span slot="footer" class="dialog-footer">
@@ -132,29 +136,51 @@
var vue = new Vue({
el: '#app',
data: {
- table:{
- rows:[],
- total:0,
- pageSize:10,
- currentPage:1,
+ table: {
+ rows: [],
+ total: 0,
+ pageSize: 10,
+ currentPage: 1,
},
- form:{
- name:null,
- datetimeArr:'',
- payMethod:'',
- flowType:'',
- orderNo:'',
- oprationMan:'',
- queryKey:'',
- order:'',
- sort:''
+ form: {
+ queryKey: null,
},
- height:'calc(100vh - 240px)',
- dialogVisible:false,
+ height: 'calc(100vh - 240px)',
+ dialogVisible: false,
+ title: '',
+ formData: {
+ name: '',
+ ruleItemList: [this.defaultRuleItem]
+ },
+ defaultRuleItem: {
+ achieveType: 1,
+ calculationType: 1,
+ Lower: '',
+ upper: '',
+ achieve: '',
+ },
+ type: '',
+ achieveTypeList: [{
+ label: '本金消耗',
+ value: 1
+ }
+ , {
+ label: '赠送消耗',
+ value: 2
+ }],
+ calculationTypeList: [
+ {
+ label: '固定值',
+ value: 1
+ }
+ , {
+ label: '百分比',
+ value: 2
+ }]
},
created: function () {
- this.loadData();
+ this.loadData();
window.addEventListener("keydown", this.keydown);
},
methods: {
@@ -169,50 +195,50 @@
resetForm(formName) {
this.$refs[formName].resetFields();
},
- sortChange:function (column){
- if(column.order){
- if(column.order.indexOf("desc")){
- this.form.order="desc";
- }else{
- this.form.order="asc";
+ sortChange: function (column) {
+ if (column.order) {
+ if (column.order.indexOf("desc")) {
+ this.form.order = "desc";
+ } else {
+ this.form.order = "asc";
}
- this.form.sort=column.prop;
+ this.form.sort = column.prop;
this.loadData();
}
},
- loadData:function(){
+ loadData: function () {
let _this = this;
- let data=_this.getRequestParam();
- data.pageSize=_this.table.pageSize;
- data.pageNum=_this.table.currentPage;
+ let data = _this.getRequestParam();
+ data.pageSize = _this.table.pageSize;
+ data.pageNum = _this.table.currentPage;
AjaxProxy.requst({
app: _this,
- data:data,
+ data: data,
url: basePath + '/admin/achieveRule/selectList',
callback: function (data) {
_this.table.rows = data.rows;
- _this.table.total=data.total;
+ _this.table.total = data.total;
}
});
},
- getRequestParam(){
+ getRequestParam() {
let _this = this;
- return {
- name:_this.form.name,
+ return {
+ queryKey: _this.form.queryKey,
}
},
- search:function(){
- this.table.currentPage=1;
+ search: function () {
+ this.table.currentPage = 1;
this.loadData();
},
- keydown(evt){
- if(evt.keyCode==13) {
+ keydown(evt) {
+ if (evt.keyCode == 13) {
this.search();
}
},
- del(index,row){
- let _this=this;
+ remove(index, row) {
+ let _this = this;
this.$confirm('确认删除该规则吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -220,12 +246,14 @@
}).then(() => {
AjaxProxy.requst({
app: _this,
- url: basePath + "/admin/achieveRule/removeById/"+row.id,
+ type: 'GET',
+ url: basePath + "/admin/achieveRule/removeById/" + row.id,
callback: function (data) {
_this.$message({
type: 'success',
- message: '删除成功!'
+ message: data.info,
});
+ debugger
_this.loadData();
}
});
@@ -236,12 +264,32 @@
});
});
},
- //导出
- add(){
+ //开启表单弹窗
+ openForm(type, data) {
- }
+ if (type == 'add') {
+ this.title = '新增规则';
+ this.$refs['formName'].resetFields();
+ } else {
+ this.title = '修改规则';
+ this.formData = data;
+ }
+ this.type = type;
+ this.dialogVisible = true;
+ },
+ //提交表单
+ submit() {
+ let url = basePath + "/admin/achieveRule/add";
+ if (this.type == 'modify') {
+ url = basePath + "/admin/achieveRule/update";
+ }
+
+
+ },
+
}
+
});
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/achieverule-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/achieverule-list.html
deleted file mode 100644
index 5edbdea..0000000
--- a/zq-erp/src/main/resources/templates/views/admin/hive/products/achieverule-list.html
+++ /dev/null
@@ -1,250 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
-<head>
- <meta charset="utf-8">
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <meta name="renderer" content="webkit|ie-comp|ie-stand">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
- <meta http-equiv="Cache-Control" content="no-siteapp"/>
- <LINK rel="Bookmark" href="../images/favicon.ico">
- <!-- 本框架基本脚本和样式 -->
- <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
- <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
- <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
- <title></title>
- <style>
- .panel-body{
- overflow: hidden;
- }
- .buttonPanel{
- background: #ffffff;
- padding: 10px 10px ;
- margin: 0px 0px 10px 0px;
- }
- .rowPanel{
- background: #ffffff;
- padding: 0px 10px ;
- padding-top: 10px;
- margin: 0px 0px 10px 0px;
- }
- .paginationStyle{
- background: #ffffff;
- padding: 10px 10px;
- margin: 0px 0px 10px 0px;
- text-align: right;
- }
- </style>
-</head>
-<body>
-<div class="panel-body" id="app">
-
- <el-row class="buttonPanel">
- <el-button @click="dialogVisible = true" type="primary" >新增</el-button>
- </el-row>
-
- <el-row class="rowPanel" >
- <el-form ref="form" :model="form" inline >
- <el-form-item label="规则名称" prop="queryKey">
- <el-input v-model="form.keyword" placeholder="请输入规则名称"></el-input>
- </el-form-item>
- <el-button type="primary" @click="search" >搜索</el-button>
- <el-button @click="resetForm('form')">重置</el-button>
- </el-form>
- </el-row>
-
- <el-row class="table-style" >
-
- <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange">
- <el-table-column
- prop="name"
- label="规则名称"
- width="180">
- </el-table-column>
- <el-table-column
- prop="updateTime"
- sortable="custom"
- label="修改时间"
- show-overflow-tooltip
- width="180">
- </el-table-column>
- <el-table-column
- prop="updateBy"
- label="修改人">
- </el-table-column>
-
- <el-table-column
- prop="createTime"
- sortable="custom"
- label="创建时间"
- show-overflow-tooltip
- width="180">
- </el-table-column>
- <el-table-column
- prop="createBy"
- label="创建人">
- </el-table-column>
-
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button type="text" @click="remove(scope.$index, scope.row)" size="small">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- <el-row class="paginationStyle" >
- <el-pagination background
- @size-change="changePageSize"
- @current-change="changeCurrentPage"
- :current-page="table.currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="table.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="table.total">
- </el-pagination>
- </el-row>
-
- <el-dialog
- title="提示"
- :visible.sync="dialogVisible"
- width="30%"
- :before-close="handleClose">
- <span>这是一段信息</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
-
-
-</div>
-</body>
-<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
-<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
-<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
-<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
-<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
-<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
-<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
-<script type="text/javascript" th:inline="javascript">
-
- var vue = new Vue({
- el: '#app',
- data: {
- table:{
- rows:[],
- total:0,
- pageSize:10,
- currentPage:1,
- },
- form:{
- name:null,
- datetimeArr:'',
- payMethod:'',
- flowType:'',
- orderNo:'',
- oprationMan:'',
- queryKey:'',
- order:'',
- sort:''
- },
- height:'calc(100vh - 240px)',
- dialogVisible:false,
-
- },
- created: function () {
- this.loadData();
- window.addEventListener("keydown", this.keydown);
- },
- methods: {
- changePageSize(val) {
- this.table.pageSize = val;
- this.loadData();
- },
- changeCurrentPage(val) {
- this.table.currentPage = val;
- this.loadData();
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- sortChange:function (column){
- if(column.order){
- if(column.order.indexOf("desc")){
- this.form.order="desc";
- }else{
- this.form.order="asc";
- }
- this.form.sort=column.prop;
- this.loadData();
- }
- },
- loadData:function(){
- let _this = this;
- let data=_this.getRequestParam();
- data.pageSize=_this.table.pageSize;
- data.pageNum=_this.table.currentPage;
- AjaxProxy.requst({
- app: _this,
- data:data,
- url: basePath + '/admin/achieveRule/selectList',
- callback: function (data) {
- _this.table.rows = data.rows;
- _this.table.total=data.total;
- }
- });
- },
- getRequestParam(){
- let _this = this;
- return {
- name:_this.form.name,
- }
- },
- search:function(){
- this.table.currentPage=1;
- this.loadData();
- },
- keydown(evt){
- if(evt.keyCode==13) {
- this.search();
- }
- },
-
- del(index,row){
- let _this=this;
- this.$confirm('确认删除该规则吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- AjaxProxy.requst({
- app: _this,
- url: basePath + "/admin/achieveRule/removeById/"+row.id,
- callback: function (data) {
- _this.$message({
- type: 'success',
- message: '删除成功!'
- });
- _this.loadData();
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- //导出
- add(){
-
- }
-
- }
- });
-
-
-</script>
-</body>
-</html>
\ No newline at end of file
--
Gitblit v1.9.1