|
@@ -58,15 +58,47 @@
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
|
|
+ <el-table-column prop="deptName" label="pad数量" v-if="deptLimit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p style="text-align: center" v-if="scope.row.parentId != 0">
|
|
|
+ {{scope.row.deptConfig && scope.row.deptConfig.padNum !== null ? scope.row.deptConfig.padNum : '未配置'}}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="deptName" label="pad已用数量" v-if="deptLimit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p style="text-align: center" v-if="scope.row.parentId != 0">
|
|
|
+ {{scope.row.deptConfig && scope.row.deptConfig.padNumSub !== null ? scope.row.deptConfig.padNumSub : '未配置'}}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="deptName" label="到期时间" v-if="deptLimit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p style="text-align: center" v-if="scope.row.parentId != 0">
|
|
|
+ {{scope.row.deptConfig && scope.row.deptConfig.padTime ? scope.row.deptConfig.padTime : '未配置'}}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="deptName" label="红包金额" v-if="deptLimit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p style="text-align: center" v-if="scope.row.parentId != 0">
|
|
|
+ {{scope.row.deptConfig && scope.row.deptConfig.redPackage !== null ? scope.row.deptConfig.redPackage : '未配置'}}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="deptName" label="剩余流量" v-if="deptLimit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <p style="text-align: center" v-if="scope.row.parentId != 0">
|
|
|
+ {{scope.row.deptConfig && scope.row.deptConfig.flowNum !== null ? formatBalance(scope.row.deptConfig.flowNum) : '未配置'}}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
|
|
<el-table-column prop="status" label="状态" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="red" label="红包配额" width="200" v-if="this.isResource"></el-table-column>
|
|
|
- <el-table-column prop="traffic" label="流量配额" width="200" v-if="this.isResource"></el-table-column>
|
|
|
- <el-table-column prop="pad" label="坐席配额" width="200" v-if="this.isResource"></el-table-column>
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
@@ -84,11 +116,21 @@
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdateResource(scope.row)"
|
|
|
- v-hasPermi="['system:dept:resource']"
|
|
|
- v-if="scope.row.deptId !== 1"
|
|
|
- >资源配置</el-button>
|
|
|
+ @click="handleUpdatePad(scope.row)"
|
|
|
+ v-if="scope.row.deptId !== 1 && deptLimit"
|
|
|
+ >配置pad</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleUpdateFlow(scope.row)"
|
|
|
+ v-if="scope.row.deptId !== 1 && deptLimit"
|
|
|
+ >充值流量</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleUpdateRedPackage(scope.row)"
|
|
|
+ v-if="scope.row.deptId !== 1 && deptLimit"
|
|
|
+ >充值红包</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
@@ -110,81 +152,27 @@
|
|
|
<!-- 资源配置对话框 -->
|
|
|
<el-dialog title="部门资源配置" :visible.sync="openResource" width="600px" append-to-body>
|
|
|
<el-form ref="resourceForm" :model="resourceForm" :rules="resourceRules" label-width="80px">
|
|
|
- <el-form-item label="部门名称">
|
|
|
- <el-input v-model="this.targetDeptName" disabled/>
|
|
|
+ <el-form-item label="pad数量" prop="pad" v-if="resourceForm.type == 0">
|
|
|
+ <el-input type="number" v-model="resourceForm.num" :min=0>
|
|
|
+ <template slot="append">台</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 有效时间 时间选择器-->
|
|
|
+ <el-form-item label="PAD有效期" prop="padTime" v-if="resourceForm.type == 0">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="resourceForm.padTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="充值金额" prop="pad" v-if="resourceForm.type != 0">
|
|
|
+ <el-input type="number" v-model="resourceForm.money" :min=0>
|
|
|
+ <template slot="append">元</template>
|
|
|
+ </el-input>
|
|
|
+ <span style="color: #fb1c1c;display: inline-block" v-if="resourceForm.type == 2">{{flowPrice}}元 / GB</span>
|
|
|
</el-form-item>
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="红包配额" prop="red" >
|
|
|
- <el-input-number v-model="resourceForm.red" controls-position="right" disabled/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="充值配额" prop="pad" >
|
|
|
- <el-input-number v-model="resourceForm.redCharge" controls-position="right" :min=0 />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <!-- 有效时间 时间选择器-->
|
|
|
- <el-form-item label="有效时间" prop="redEffectiveTime" >
|
|
|
- <el-date-picker
|
|
|
- v-model="resourceForm.redEffectiveTime"
|
|
|
- type="date"
|
|
|
- placeholder="选择日期"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="流量配额" prop="traffic" >
|
|
|
- <el-input-number v-model="resourceForm.traffic" controls-position="right" disabled/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="充值配额" prop="trafficCharge" >
|
|
|
- <el-input-number v-model="resourceForm.trafficCharge" controls-position="right" :min=0 />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <!-- 有效时间 时间选择器-->
|
|
|
- <el-form-item label="有效时间" prop="trafficEffectiveTime" >
|
|
|
- <el-date-picker
|
|
|
- v-model="resourceForm.trafficEffectiveTime"
|
|
|
- type="date"
|
|
|
- placeholder="选择日期"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="坐席配额" prop="pad" >
|
|
|
- <el-input-number v-model="resourceForm.pad" controls-position="right" disabled/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="充值配额" prop="padCharge" >
|
|
|
- <el-input-number v-model="resourceForm.padCharge" controls-position="right" :min=0 />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <!-- 有效时间 时间选择器-->
|
|
|
- <el-form-item label="有效时间" prop="padEffectiveTime" >
|
|
|
- <el-date-picker
|
|
|
- v-model="resourceForm.padEffectiveTime"
|
|
|
- type="date"
|
|
|
- placeholder="选择日期"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitResourceForm">确 定</el-button>
|
|
@@ -248,7 +236,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
|
|
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild, updatePadNum, addRedMoney, addFlowNum } from "@/api/system/dept";
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import { addOrEditDeptResource, getDeptResource } from '@/api/system/resourceManagement'
|
|
@@ -270,6 +258,7 @@ export default {
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
+ deptLimit: false,
|
|
|
// 是否显示资源弹出层
|
|
|
openResource: false,
|
|
|
// 操作的部门名称
|
|
@@ -280,6 +269,7 @@ export default {
|
|
|
refreshTable: true,
|
|
|
// 是否展开
|
|
|
expand: false,
|
|
|
+ flowPrice: 0,
|
|
|
// 状态数据字典
|
|
|
statusOptions: [],
|
|
|
// 查询参数
|
|
@@ -319,20 +309,21 @@ export default {
|
|
|
},
|
|
|
// 资源表单参数
|
|
|
resourceRules: {
|
|
|
- red: [
|
|
|
- { required: true, message: "红包配额不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- traffic: [
|
|
|
- { required: true, message: "流量配额不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- pad: [
|
|
|
- { required: true, message: "坐席配额不能为空", trigger: "blur" }
|
|
|
- ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
+ this.getConfigKey("statis.config").then(response => {
|
|
|
+ let data = JSON.parse(response.msg)
|
|
|
+ this.flowPrice = data.trafficPrice;
|
|
|
+ });
|
|
|
+ this.getConfigKey("course.config").then(response => {
|
|
|
+ let data = JSON.parse(response.msg)
|
|
|
+ if(data && data.deptLimit){
|
|
|
+ this.deptLimit = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
this.getDicts("sys_normal_disable").then(response => {
|
|
|
this.statusOptions = response.data;
|
|
|
});
|
|
@@ -370,7 +361,6 @@ export default {
|
|
|
// 资源配置取消按钮
|
|
|
cancelResource() {
|
|
|
this.openResource = false;
|
|
|
- this.resetResource();
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
@@ -386,22 +376,6 @@ export default {
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
- // 表单重置
|
|
|
- resetResource() {
|
|
|
- this.resourceForm = {
|
|
|
- id: undefined,
|
|
|
- red: undefined,
|
|
|
- redCharge: undefined,
|
|
|
- redEffectiveTime: undefined,
|
|
|
- pad: undefined,
|
|
|
- padCharge: undefined,
|
|
|
- padEffectiveTime: undefined,
|
|
|
- traffic: undefined,
|
|
|
- trafficCharge: undefined,
|
|
|
- trafficEffectiveTime: undefined
|
|
|
- };
|
|
|
- this.resetForm("resourceForm");
|
|
|
- },
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
this.getList();
|
|
@@ -444,12 +418,49 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
- handleUpdateResource(row) {
|
|
|
- this.resetResource();
|
|
|
- getDeptResource(row.deptId).then(response => {
|
|
|
- this.resourceForm = response.data;
|
|
|
- this.openResource = true;
|
|
|
- });
|
|
|
+ handleUpdatePad(row) {
|
|
|
+ this.openResource = true;
|
|
|
+ this.resourceForm = {
|
|
|
+ type: 0,
|
|
|
+ deptId: row.deptId,
|
|
|
+ num: row?.deptConfig?.padNum || 0,
|
|
|
+ padTime: row?.deptConfig?.padTime || null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleUpdateRedPackage(row) {
|
|
|
+ this.openResource = true;
|
|
|
+ this.resourceForm = {
|
|
|
+ type: 1,
|
|
|
+ deptId: row.deptId,
|
|
|
+ money: 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleUpdateFlow(row) {
|
|
|
+ this.openResource = true;
|
|
|
+ this.resourceForm = {
|
|
|
+ type: 2,
|
|
|
+ deptId: row.deptId,
|
|
|
+ money: 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ formatBalance(flow){
|
|
|
+ //对流量值进行判断,换算成GB或TB
|
|
|
+ if(!flow){
|
|
|
+ return "0 KB";
|
|
|
+ }
|
|
|
+ const absBalance = Math.abs(flow); // 获取绝对值
|
|
|
+ if(absBalance < 1024){
|
|
|
+ return flow + " KB";
|
|
|
+ }
|
|
|
+ else if(absBalance < 1024 * 1024){
|
|
|
+ return (flow / 1024).toFixed(2) + " MB";
|
|
|
+ }
|
|
|
+ else if(absBalance < 1024 * 1024 * 1024){
|
|
|
+ return (flow / (1024 * 1024)).toFixed(2) + " GB";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return (flow / (1024 * 1024 * 1024)).toFixed(2) + " TB";
|
|
|
+ }
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function() {
|
|
@@ -473,19 +484,39 @@ export default {
|
|
|
},
|
|
|
/** 资源配置提交*/
|
|
|
submitResourceForm: function() {
|
|
|
- this.$refs["resourceForm"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- addOrEditDeptResource(this.resourceForm).then(response => {
|
|
|
- if(response.code === 200 && response.data === true){
|
|
|
- this.msgSuccess("修改成功");
|
|
|
- this.openResource = false;
|
|
|
- this.getList();
|
|
|
- }else{
|
|
|
- this.msgError(response.msg);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ if(this.resourceForm.type == 0){
|
|
|
+ updatePadNum(this.resourceForm).then(response => {
|
|
|
+ if(response.code === 200){
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.openResource = false;
|
|
|
+ this.getList();
|
|
|
+ }else{
|
|
|
+ this.msgError(response.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(this.resourceForm.type == 1){
|
|
|
+ addRedMoney(this.resourceForm).then(response => {
|
|
|
+ if(response.code === 200){
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.openResource = false;
|
|
|
+ this.getList();
|
|
|
+ }else{
|
|
|
+ this.msgError(response.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(this.resourceForm.type == 2){
|
|
|
+ addFlowNum(this.resourceForm).then(response => {
|
|
|
+ if(response.code === 200){
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.openResource = false;
|
|
|
+ this.getList();
|
|
|
+ }else{
|
|
|
+ this.msgError(response.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|