1、开发业务标识管理、业务脚本管理、业务下发管理 2、联调业务脚本管理 3、首页top5图表数据补齐

This commit is contained in:
康冉冉
2025-10-13 18:42:27 +08:00
parent d192a03f75
commit 59e0b5774e
12 changed files with 1089 additions and 26 deletions

View File

@@ -244,3 +244,99 @@ export function updateRecord(data) {
data: data
})
}
/** ------------------业务脚本管理------------------- */
// 查询列表
export function listBusScript(data) {
return request({
url: '/system/businessScript/list',
method: 'post',
data: data
})
}
// 查询详细
export function getBusScript(Id) {
return request({
url: '/system/businessScript/' + Id,
method: 'get'
})
}
// 新增
export function addBusScript(data) {
return request({
url: '/system/businessScript',
method: 'post',
data: data
})
}
// 修改
export function updateBusScript(data) {
return request({
url: '/system/businessScript',
method: 'put',
data: data
})
}
// 脚本名称
export function getAllBusScriptName(data) {
return request({
url: '/system/businessScript/getAllScriptName',
method: 'get'
})
}
// 删除
export function delBusScript(roleId) {
return request({
url: '/system/businessScript/' + roleId,
method: 'delete'
})
}
/** ------------------业务下发管理------------------- */
// 查询列表
export function listBusDeploy(data) {
return request({
url: '/system/businessDeploy/list',
method: 'post',
data: data
})
}
// 查询详细
export function getBusDeploy(Id) {
return request({
url: '/system/businessDeploy/' + Id,
method: 'get'
})
}
// 新增
export function addBusDeploy(data) {
return request({
url: '/system/businessDeploy',
method: 'post',
data: data
})
}
// 修改
export function updateBusDeploy(data) {
return request({
url: '/system/businessDeploy',
method: 'put',
data: data
})
}
// 删除
export function delBusDeploy(roleId) {
return request({
url: '/system/businessDeploy/' + roleId,
method: 'delete'
})
}

View File

@@ -62,7 +62,7 @@
</template>
<template v-else>
<!-- <el-tooltip v-if="item && item.content" :content="item.content" placement="top">-->
<el-button v-if="item && item.content" size="mini" link :type="item.type" :icon="item.icon" v-show="scope.row[item.showName] === item.showVal" @click="handleClick(item, scope.row)" :hasPermi="[item.hasPermi]">{{item.content}}</el-button>
<el-button v-if="item && item.content" size="mini" link :type="item.type" :icon="item.icon" v-show="item && item.showName ? item.showVal.includes(scope.row[item.showName]) : true" @click="handleClick(item, scope.row)" :hasPermi="[item.hasPermi]">{{item.content}}</el-button>
<!-- </el-tooltip>-->
</template>
</template>

View File

@@ -52,9 +52,9 @@ export default {
Notification.warning(content)
},
// 确认窗体
confirm(content) {
confirm(content, titles) {
return MessageBox.confirm(content, "系统提示", {
confirmButtonText: '确定',
confirmButtonText: titles && titles.submitTitle ? titles.submitTitle : '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: "warning",

View File

@@ -62,19 +62,19 @@ export const constantRoutes = [
component: () => import('@/views/error/401'),
hidden: true
},
{
path: '',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
component: () => import('@/views/index'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
},
// {
// path: '',
// component: Layout,
// redirect: 'index',
// children: [
// {
// path: 'index',
// component: () => import('@/views/index'),
// name: 'Index',
// meta: { title: '首页', icon: 'dashboard', affix: true }
// }
// ]
// },
{
path: '/user',
component: Layout,
@@ -98,6 +98,19 @@ export const constantRoutes = [
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: '/index',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
component: () => import('@/views/index'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
},
{
path: '/system/user-auth',
component: Layout,
@@ -212,6 +225,51 @@ export const dynamicRoutes = [
}
]
},
// 业务标识管理
{
path: '/earnManage/businessIdent/details',
component: Layout,
hidden: true,
permissions: ['earnManage:businessIdent:details'],
children: [
{
path: 'index',
component: () => import('@/views/earnManage/businessIdent/details'),
name: 'BusinessIdentDetails',
meta: { title: '业务标识信息', noCache: true ,activeMenu: '/earnManage/businessIdent' }
}
]
},
// 业务脚本管理
{
path: '/earnManage/businessScript/details',
component: Layout,
hidden: true,
permissions: ['earnManage:businessScript:details'],
children: [
{
path: ':id?',
component: () => import('@/views/earnManage/businessScript/details'),
name: 'BusinessScriptDetails',
meta: { title: '业务脚本信息', noCache: true ,activeMenu: '/earnManage/businessScript' }
}
]
},
// 业务下发管理
{
path: '/earnManage/businessIssued/details',
component: Layout,
hidden: true,
permissions: ['earnManage:businessIssued:details'],
children: [
{
path: ':id?',
component: () => import('@/views/earnManage/businessIssued/details'),
name: 'BusinessIssuedDetails',
meta: { title: '业务脚本信息', noCache: true ,activeMenu: '/earnManage/businessIssued' }
}
]
},
// 业务管理
{
path: '/earnManage/business/details',
@@ -253,7 +311,7 @@ export const dynamicRoutes = [
path: 'index/:id?',
component: () => import('@/views/resource/switchRegister/handle'),
name: 'SwitchRegisterEdit',
meta: { title: '交换机注册信息', activeMenu: '/resource/switchRegister' }
meta: { title: '交换机管理信息', activeMenu: '/resource/switchRegister' }
}
]
},

View File

@@ -0,0 +1,188 @@
<template>
<div class="app-container pageTopForm">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" size="small" label-width="68px" class="demo-ruleForm">
<el-col :span="6">
<el-form-item label="业务名称" prop="businessName">
<el-input
v-model="queryParams.businessName"
placeholder="请输入业务名称"
clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="lastBtnSty">
<el-button type="primary" size="mini" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempBusinessName="{ row, column }">
<div>
<!-- 非编辑状态显示文本 -->
<template v-if="!row.editStatus">
<span>{{ row.businessName }}</span>
<el-button icon="el-icon-edit" type="text" @click="rowDataChange(row)"></el-button>
</template>
<template v-else>
<!-- 编辑状态显示输入框 -->
<el-col :span="16">
<el-input
v-model="row.businessName"
size="mini"
@keyup.enter="callback({fnCode: 'edit'}, row)"
@blur="callback({fnCode: 'edit'}, row)"
></el-input>
</el-col>
<el-col :span="8">
<el-button size="mini" type="primary" @click="callback({fnCode: 'submit'}, row)">确定</el-button>
<el-button size="mini" @click="callback({fnCode: 'cancel'}, row)">取消</el-button>
</el-col>
</template>
</div>
</template>
</TableList>
</div>
</template>
<script setup>
import TableList from "@/components/table/index.vue"
import {listBusiness,updateBusiness,countBusinessName, delBusiness} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessIdent',
components: {TableList},
data() {
return {
editStatus: false,
loading: false,
showSearch: true,
roleList: [],
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
},
// 列显隐信息
columns: {
businessName: { label: `业务名称`, slotName: 'tempBusinessName', visible: true},
id: { label: `业务代码`, visible: true},
createTime: { label: `创建时间`, visible: true},
},
config: {
searcherForm: [
{label: '资源组名称', prop: 'groupName', type: 'input'}
],
tableButton: {
top: [
{content: '新增', fnCode: 'add', type: 'primary', icon: 'el-icon-plus', hasPermi: 'earnManage:businessIdent:add'},
// {content: '删除', fnCode: 'delete', type: 'danger', icon: 'el-icon-delete', hasPermi: 'disRevenue:earnManage:business:detele'},
{content: '导出', fnCode: 'export', type: 'warning', icon: 'el-icon-download', hasPermi: 'earnManage:businessIdent:export'},
],
// line: [
// {content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:earnManage:business:edit'},
// ]
}
}
}
},
created() {
this.getList();
},
activated() {
this.$nextTick(() => {
this.getList();
});
},
methods: {
rowDataChange(row) {
this.$set(row, 'editStatus', true);
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
this.showSearch = newValue;
// console.log('父组件拿到新值:', newValue);
},
/** 查询列表 */
getList() {
this.loading = true;
listBusiness(this.queryParams).then(response => {
this.roleList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryRef");
this.handleQuery();
},
callback(result, rowData, selectChange) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'add':
this.$router.push({
path:'/earnManage/businessIdent/details/index'});
break;
case 'submit':
if (this.loading) return;
this.loading = true;
countBusinessName(rowData).then(res => {
updateBusiness(rowData).then(response => {
this.$set(rowData, 'editStatus', false);
this.getList();
this.$modal.msgSuccess(response.msg);
this.loading = false;
}).catch(() => {
this.$modal.msgError("操作失败");
this.loading = false;
});
}).catch(error => {
// this.$modal.msgError("存在重复的业务名称,请重新输入!");
this.loading = false;
});
break;
case 'cancel':
this.$set(rowData, 'editStatus', false);
break;
case 'delete':
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delBusiness(selectChange)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功")
}).catch(() => {});
break;
case 'export':
// let dataList = [];
// Object.keys(this.columns).forEach(item => {
// if (item.visible) {
// dataList.push(item.prop);
// }
// });
// this.download("/system/Business/export", {properties: dataList,}, `业务管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/Business/export", paramsList, `业务管理_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}
}
}
}
}
</script>
<style scoped>
::v-deep .lastBtnSty .el-form-item__content{
margin-left: 10px!important;
}
</style>

View File

@@ -0,0 +1,77 @@
<template>
<div class="app-container">
<Form :formList="formList" :ruleFormData="ruleForm" @fnClick="callback"></Form>
</div>
</template>
<script setup>
import Form from '@/components/form/index.vue';
import {addBusiness, countBusinessName, getBusinessCode} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessIdentDetails',
components: {Form},
data() {
return {
loading: true,
ruleForm: {
id: '',
businessName: ''
},
formList: [],
}
},
created() {
this.fnBusinessCode();
this.fnFormList();
},
methods: {
// formList集合
fnFormList(objVal) {
this.formList = [{
config: {title: '基本信息'},
controls: {
businessName: {label: '业务名称', span: 12, type: 'input', rules: [{required: true, message: '请输入业务名称', trigger: 'blur'}]},
id: {label: '业务代码', span: 12, type: 'input', style: 'display: block', disabled: true},
}
}];
},
// 业务编码
fnBusinessCode() {
getBusinessCode().then(val => {
this.$set(this.ruleForm, 'id', val);
}).catch(() => {
this.$modal.msgError("操作失败")
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'submit':
this.loading = true;
countBusinessName(dataVal).then(response => {
addBusiness(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
this.$router.push("/earnManage/businessIdent");
this.loading = false;
}).catch(() => {
this.$modal.msgError("操作失败");
this.loading = false;
});
}).catch(error => {
// this.$modal.msgError("存在重复的业务名称,请重新输入!");
this.loading = false;
});
break;
case 'cancel':
this.$router.push("/earnManage/businessIdent");
break;
default:
}
}
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,196 @@
<template>
<div class="app-container pageTopForm">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" size="small" label-width="68px" class="demo-ruleForm">
<el-col :span="6">
<el-form-item label="任务名称" prop="taskName">
<el-input
v-model="queryParams.taskName"
placeholder="请输入任务名称"
clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="lastBtnSty">
<el-button type="primary" size="mini" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempStatus="{ row, column }">
<dict-tag :options="dict.type.eps_business_review_status" :value="row.reviewStatus"/>
</template>
</TableList>
</div>
</template>
<script setup>
import TableList from "@/components/table/index.vue"
import {listBusDeploy, delBusDeploy} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessIssued',
components: {TableList},
dicts: ['eps_business_review_status'],
data() {
return {
editStatus: false,
loading: false,
showSearch: true,
roleList: [],
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
},
// 列显隐信息
columns: {
id: {label: 'ID'},
taskName: { label: `任务名称`, minWidth: '120', visible: true},
businessName: { label: `业务名称`, minWidth: '120', visible: true},
scriptName: { label: `脚本名称`, minWidth: '120', visible: true},
scriptParams: { label: `脚本参数`, minWidth: '120',},
deployDevice: { label: `部署设备`, minWidth: '120',},
submitBy: { label: `提交人`, minWidth: '120',},
reviewStatus: { label: `审核状态`, minWidth: '120', slotName: 'tempStatus', visible: true},
reviewTime: { label: `审核时间`, minWidth: '160'},
reviewComment: { label: `审核意见`, minWidth: '160'},
createTime: { label: `创建时间`, minWidth: '160'},
updateTime: { label: `修改时间`, minWidth: '160'},
},
config: {
tableButton: {
top: [
{content: '新增', fnCode: 'add', type: 'primary', icon: 'el-icon-plus', hasPermi: 'earnManage:businessIssued:add'},
{content: '导出', fnCode: 'export', type: 'warning', icon: 'el-icon-download', hasPermi: 'earnManage:businessIssued:export'},
],
line: [
{content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:earnManage:businessIssued:edit'},
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'disRevenue:earnManage:businessIssued:details'},
{content: '删除', fnCode: 'delete', type: 'text', icon: 'el-icon-delete', hasPermi: 'disRevenue:earnManage:businessIssued:delete'},
{content: '审核', fnCode: 'audit', type: 'text', showName: 'reviewStatus', showVal: '1', icon: 'el-icon-document-add', hasPermi: 'disRevenue:earnManage:businessIssued:audit'},
{content: '提交审核', fnCode: 'upAudit', type: 'text', showName: 'reviewStatus', showVal: ['0', '1', '3'], icon: 'el-icon-document-checked', hasPermi: 'disRevenue:earnManage:businessIssued:upAudit'},
]
}
}
}
},
created() {
this.getList();
},
activated() {
this.$nextTick(() => {
this.getList();
});
},
methods: {
rowDataChange(row) {
this.$set(row, 'editStatus', true);
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
this.showSearch = newValue;
// console.log('父组件拿到新值:', newValue);
},
/** 查询列表 */
getList() {
this.loading = true;
listBusDeploy(this.queryParams).then(response => {
this.roleList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryRef");
this.handleQuery();
},
callback(result, rowData, selectChange) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'add':
this.$router.push({
path:'/earnManage/businessIssued/details'});
break;
case 'edit':
this.$router.push({
path:'/earnManage/businessIssued/details',
query: {
id: rowData.id
}
});
break;
case 'details':
this.$router.push({
path:'/earnManage/businessIssued/details',
query:{
id: rowData.id,
readonly: true
}
});
break;
case 'audit':
this.$router.push({
path:'/earnManage/businessIssued/details',
query:{
id: rowData.id,
audit: true
}
});
break;
case 'upAudit':
let content = '<p style="font-size: 1rem;font-weight: 600;">提交审核</p>' +
'<p style="height: 0px;margin:10px 0 50px;">提交审核后,相关的任务内容将不能修改</p>';
this.$modal.confirm(content, {submitTitle: '继续提交'}).then(() => {
// rowData['registrationStatus'] = '0';
// updateregisterType(rowData).then(res => {
// this.$modal.msgSuccess("取消注册成功!");
// this.getList();
// });
}).catch(() => {});
break;
case 'delete':
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delBusDeploy(rowData.id)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功")
}).catch(() => {});
break;
case 'export':
// let dataList = [];
// Object.keys(this.columns).forEach(item => {
// if (item.visible) {
// dataList.push(item.prop);
// }
// });
// this.download("/system/Business/export", {properties: dataList,}, `业务管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/businessDeploy/export", paramsList, `业务下发管理_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}
}
}
}
}
</script>
<style scoped>
::v-deep .lastBtnSty .el-form-item__content{
margin-left: 10px!important;
}
::v-deep .el-message-box__status {
top: 35%!important;
}
</style>

View File

@@ -0,0 +1,120 @@
<template>
<div class="app-container">
<Form :formList="formList" :ruleFormData="ruleForm" @fnClick="callback"></Form>
</div>
</template>
<script setup>
import Form from '@/components/form/index.vue';
import {addBusDeploy, getBusDeploy, updateBusDeploy, listAllBusinessList, getAllBusScriptName} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessIssuedDetails',
components: {Form},
dicts: ['eps_business_review_status'],
data() {
return {
loading: true,
ruleForm: {},
formList: [],
scriptList: {},
paramsData: {}
}
},
created() {
this.paramsData = this.$route && this.$route.query;
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
}
this.getBusinessNames();
this.getBusScriptNames();
this.fnFormList();
},
methods: {
// formList集合
fnFormList(objVal) {
this.formList = [{
config: {title: '基本信息', colSpan: this.paramsData && this.paramsData.readonly ? '' : 'disBlock', readonly: this.paramsData && this.paramsData.readonly},
controls: {
id: {label: 'ID',hidden: true},
taskName: {label: '任务名称', span: 12, type: 'input', required: true},
businessName: {label: '业务名称', span: 12, type: 'select', options: [], required: true},
scriptName: {label: '脚本名称', span: 12, type: 'select', options: [], eventName: 'change', required: true},
scriptPath: {label: '脚本文件地址', span: 12, type: 'input', required: true, disabled: true},
scriptParams: {label: '脚本参数', span: 12, type: 'input'},
submitBy: {label: '提交人', span: 12, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
reviewStatus: {label: '审核状态', span: 12, type: 'select', options: this.dict.type.eps_business_review_status, hidden: !(this.paramsData && this.paramsData.readonly)},
reviewBy: {label: '审核人', span: 12, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
reviewTime: {label: '审核时间', span: 12, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
reviewComment: {label: '审核意见', span: 12, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
createTime: {label: '创建时间', span: 12, type: 'date', hidden: !(this.paramsData && this.paramsData.readonly)},
updateTime: {label: '修改时间', span: 12, type: 'date', hidden: !(this.paramsData && this.paramsData.readonly)},
deployDevice: {label: '部署设备', span: 18, type: 'textarea', rows: 15, required: true},
}
}];
},
// 获取详情
getFormDataList(id) {
getBusDeploy(id).then(val => {
if (val && val.data) {
val.data['scriptName'] = Number(val.data['scriptName']);
this.ruleForm = val.data;
}
}).catch(() => {
// this.$modal.msgError("操作失败")
});
},
// 业务名称
getBusinessNames() {
listAllBusinessList().then(val => {
this.formList[0].controls.businessName['options'] = val && val.data.map(item => {
return Object.assign({label: item.businessName, value: item.id});
});
});
},
// 脚本名称
getBusScriptNames() {
getAllBusScriptName().then(val => {
this.formList[0].controls.scriptName['options'] = val && val.data.map(item => {
this.scriptList[item.id] = item;
return Object.assign({label: item.scriptName, value: item.id});
});
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'scriptName':
if (dataVal) {
let dataListVal = this.scriptList[dataVal];
this.$set(this.ruleForm, 'scriptPath', dataListVal['scriptPath']);
this.$set(this.ruleForm, 'scriptParams', dataListVal['defaultParams']);
}
break;
case 'submit':
this.loading = true;
let fnType = addBusDeploy;
if (dataVal && dataVal.id) {
fnType = updateBusDeploy;
}
fnType(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
this.$router.push("/earnManage/businessIssued");
this.loading = false;
}).catch(() => {
this.$modal.msgError("操作失败");
this.loading = false;
});
break;
case 'cancel':
this.$router.push("/earnManage/businessIssued");
break;
default:
}
}
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,160 @@
<template>
<div class="app-container pageTopForm">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" size="small" label-width="68px" class="demo-ruleForm">
<el-col :span="6">
<el-form-item label="脚本名称" prop="scriptName">
<el-input
v-model="queryParams.scriptName"
placeholder="请输入脚本名称"
clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="lastBtnSty">
<el-button type="primary" size="mini" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange"></TableList>
</div>
</template>
<script setup>
import TableList from "@/components/table/index.vue"
import {listBusScript, delBusScript} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessScript',
components: {TableList},
data() {
return {
editStatus: false,
loading: false,
showSearch: true,
roleList: [],
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
},
// 列显隐信息
columns: {
id: {label: 'ID'},
scriptName: { label: `脚本名称`, visible: true},
scriptPath: { label: `脚本文件地址`, visible: true},
defaultParams: { label: `脚本默认参数`, visible: true},
},
config: {
searcherForm: [
{label: '资源组名称', prop: 'groupName', type: 'input'}
],
tableButton: {
top: [
{content: '新增', fnCode: 'add', type: 'primary', icon: 'el-icon-plus', hasPermi: 'earnManage:businessScript:add'},
],
line: [
{content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:earnManage:businessScript:edit'},
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'disRevenue:earnManage:businessScript:details'},
{content: '删除', fnCode: 'delete', type: 'text', icon: 'el-icon-delete', hasPermi: 'disRevenue:earnManage:businessScript:delete'},
]
}
}
}
},
created() {
this.getList();
},
activated() {
this.$nextTick(() => {
this.getList();
});
},
methods: {
rowDataChange(row) {
this.$set(row, 'editStatus', true);
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
this.showSearch = newValue;
// console.log('父组件拿到新值:', newValue);
},
/** 查询列表 */
getList() {
this.loading = true;
listBusScript(this.queryParams).then(response => {
this.roleList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryRef");
this.handleQuery();
},
callback(result, rowData, selectChange) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'add':
this.$router.push({
path:'/earnManage/businessScript/details'});
break;
case 'edit':
this.$router.push({
path:'/earnManage/businessScript/details',
query: {
id: rowData.id
}
});
break;
case 'details':
this.$router.push({
path:'/earnManage/businessScript/details',
query:{
id: rowData.id,
readonly: true
}
});
break;
case 'delete':
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delBusScript(rowData.id)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功")
}).catch(() => {});
break;
case 'export':
// let dataList = [];
// Object.keys(this.columns).forEach(item => {
// if (item.visible) {
// dataList.push(item.prop);
// }
// });
// this.download("/system/Business/export", {properties: dataList,}, `业务管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/businessScript/export", paramsList, `业务脚本管理_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}
}
}
}
}
</script>
<style scoped>
::v-deep .lastBtnSty .el-form-item__content{
margin-left: 10px!important;
}
</style>

View File

@@ -0,0 +1,92 @@
<template>
<div class="app-container">
<Form :formList="formList" :ruleFormData="ruleForm" :config="config" @fnClick="callback"></Form>
</div>
</template>
<script setup>
import Form from '@/components/form/index.vue';
import {addBusScript, getBusScript, updateBusScript} from "@/api/disRevenue/earnManage"
export default {
name: 'BusinessScriptDetails',
components: {Form},
data() {
return {
loading: true,
ruleForm: {
id: '',
businessName: ''
},
formList: [],
config: {},
paramsData: {}
}
},
created() {
this.paramsData = this.$route && this.$route.query;
if (this.paramsData && this.paramsData.readonly) {
this.config = {
buttonGroup: [{title: '返回', fnCode: 'goBack'}]
};
}
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
}
this.fnFormList();
},
methods: {
// formList集合
fnFormList(objVal) {
this.formList = [{
config: {title: '基本信息', colSpan: this.paramsData && this.paramsData.readonly ? '' : 'disBlock', readonly: this.paramsData && this.paramsData.readonly},
controls: {
id: {label: 'ID',hidden: true},
scriptName: {label: '脚本名称', span: 12, type: 'input', required: true},
scriptPath: {label: '脚本文件地址', span: 12, type: 'input', required: true},
defaultParams: {label: '脚本默认参数', span: 12, type: 'input'},
createBy: {label: '创建人', span: 12, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
createTime: {label: '创建时间', span: 12, type: 'date', hidden: !(this.paramsData && this.paramsData.readonly)},
updateTime: {label: '修改时间', span: 12, type: 'date', hidden: !(this.paramsData && this.paramsData.readonly)},
}
}];
},
// 获取详情
getFormDataList(id) {
getBusScript(id).then(val => {
if (val && val.data) {
this.ruleForm = val.data;
}
}).catch(() => {
// this.$modal.msgError("操作失败")
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'submit':
let fnType = addBusScript;
if (dataVal && dataVal.id) {
fnType = updateBusScript;
}
fnType(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
this.$router.push("/earnManage/businessScript");
this.loading = false;
}).catch(() => {
this.$modal.msgError("操作失败");
this.loading = false;
});
break;
case 'cancel':
this.$router.push("/earnManage/businessScript");
break;
default:
}
}
}
}
}
</script>
<style>
</style>

View File

@@ -237,14 +237,88 @@ export default {
countDeviceNumTop5().then(res => {
let lineXData = [];
let dataList = [];
res && res.data.forEach(item => {
lineXData.push(item.businessName);
dataList.push(item.total);
});
this.lineDataParams['lineXData'] = lineXData;
this.lineDataParams['data'] = dataList;
if (res && res.data) {
let newArr = res.data;
if (res.data && res.data.length < 5) {
newArr = this.sortedNum(res.data);
}
newArr.forEach(item => {
lineXData.push(item.businessName);
dataList.push(item.total);
});
this.lineDataParams['lineXData'] = lineXData;
this.lineDataParams['data'] = dataList;
}
});
},
sortedNum(data){
// 提取value并转换为数字同时保存name映射
const valueMap = new Map(); // 存储 {value: name}
const values = [];
for (const item of data) {
const value = parseInt(item.total, 10);
// 校验value有效性
if (isNaN(value) || value <= 0) {
return "错误所有value必须是大于0的数字";
}
// 校验重复value
if (valueMap.has(value)) {
return "错误输入数组不能包含重复的value";
}
valueMap.set(value, item.businessName);
values.push(value);
}
// 对输入value排序降序
const sortedInputs = [...values].sort((a, b) => b - a);
// 生成目标value序列包含所有输入值的5个递减正数
let targetValues = [];
let start = sortedInputs[0];
while (true) {
const candidate = new Set();
// 先加入所有输入值
sortedInputs.forEach(v => candidate.add(v));
// 从start开始向下补充直到有5个值
let current = start;
while (candidate.size < 5) {
if (current <= 0) break;
candidate.add(current);
current--;
}
// 转换为数组并排序(降序)
const arr = [...candidate].sort((a, b) => b - a);
if (arr.length === 5 && arr.every(v => v > 0)) {
targetValues = arr;
break;
}
start++; // 若当前start无法生成有效序列增大start重试
}
// 生成每个value对应的name
const result = [];
for (const val of targetValues) {
if (valueMap.has(val)) {
// 已有value使用原name
result.push({ businessName: valueMap.get(val), total: val.toString() });
} else {
// 补充的value寻找对应的name前缀
// 找到小于当前val的最大输入value
const closestSmaller = sortedInputs.find(v => v < val);
if (closestSmaller !== undefined) {
const prefix = valueMap.get(closestSmaller);
result.push({ businessName: `${prefix}${val}`, total: val.toString() });
} else {
// 若所有输入值都大于当前val极端情况用最大输入值的name
const maxInput = sortedInputs[0];
const prefix = valueMap.get(maxInput);
result.push({ businessName: `${prefix}${val}`, total: val.toString() });
}
}
}
return result;
},
serverTableList() {
listBandWidth(this.serQueryParams).then(response => {
this.serTableList = response.rows;

View File

@@ -73,8 +73,8 @@ export default {
title: process.env.VUE_APP_TITLE,
codeUrl: "",
loginForm: {
username: "admin",
password: "admin456",
username: "",
password: "",
rememberMe: false,
code: "",
uuid: ""
@@ -142,7 +142,9 @@ export default {
Cookies.remove('rememberMe')
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{})
// 默认指向知识库页面
this.$router.push('/problemRecord').catch(()=>{})
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{})
}).catch(() => {
this.loading = false
if (this.captchaEnabled) {