新增提成查询

This commit is contained in:
huangdeliang
2020-09-24 00:27:46 +08:00
parent 3deb40bac9
commit cf70d53d7f
12 changed files with 909 additions and 3 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询业务提成比例列表
export function listCommision(query) {
return request({
url: '/custom/commision/list',
method: 'get',
params: query
})
}
// 查询业务提成比例详细
export function getCommision(ruleId) {
return request({
url: '/custom/commision/' + ruleId,
method: 'get'
})
}
// 新增业务提成比例
export function addCommision(data) {
return request({
url: '/custom/commision',
method: 'post',
data: data
})
}
// 修改业务提成比例
export function updateCommision(data) {
return request({
url: '/custom/commision',
method: 'put',
data: data
})
}
// 删除业务提成比例
export function delCommision(ruleId) {
return request({
url: '/custom/commision/' + ruleId,
method: 'delete'
})
}
// 导出业务提成比例
export function exportCommision(query) {
return request({
url: '/custom/commision/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,326 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
<el-option
v-for="dict in userIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="金额" prop="amount">
<el-input
v-model="queryParams.amount"
placeholder="请输入金额"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="分成比例" prop="rate">
<el-input
v-model="queryParams.rate"
placeholder="请输入分成比例"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:commision:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:commision:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:commision:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:commision:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commisionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="ruleId" />
<el-table-column label="业务员" align="center" prop="nickName" />
<el-table-column label="金额" align="center" prop="amount" />
<el-table-column label="分成比例" align="center" prop="rate" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:commision:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:commision:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改业务提成比例对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="业务员" prop="userId">
<el-select v-model="form.userId" placeholder="请选择业务员">
<el-option
v-for="dict in userIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="业务员" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入业务员" />
</el-form-item>
<el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item>
<el-form-item label="分成比例" prop="rate">
<el-input v-model="form.rate" placeholder="请输入分成比例" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCommision, getCommision, delCommision, addCommision, updateCommision, exportCommision } from "@/api/custom/commision";
export default {
name: "Commision",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 业务提成比例表格数据
commisionList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 业务员字典
userIdOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
amount: null,
rate: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
userId: [
{ required: true, message: "业务员不能为空", trigger: "change" }
],
amount: [
{ required: true, message: "金额不能为空", trigger: "blur" }
],
rate: [
{ required: true, message: "分成比例不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getDicts("sys_saller").then(response => {
this.userIdOptions = response.data;
});
},
methods: {
/** 查询业务提成比例列表 */
getList() {
this.loading = true;
listCommision(this.queryParams).then(response => {
this.commisionList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 业务员字典翻译
userIdFormat(row, column) {
return this.selectDictLabel(this.userIdOptions, row.userId);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
ruleId: null,
userId: null,
nickName: null,
amount: null,
rate: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.ruleId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加业务提成比例";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const ruleId = row.ruleId || this.ids
getCommision(ruleId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改业务提成比例";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.ruleId != null) {
updateCommision(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addCommision(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ruleIds = row.ruleId || this.ids;
this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delCommision(ruleIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportCommision(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}
}
};
</script>

View File

@ -34,7 +34,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.110.150:8090`,
target: `http://localhost:8091`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''