first commit
This commit is contained in:
62
h5-enginex-manager/src/App.vue
Executable file
62
h5-enginex-manager/src/App.vue
Executable file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
|
||||
<!-- <keep-alive include="history"> -->
|
||||
<router-view></router-view>
|
||||
<!-- </keep-alive> -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getV
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
name: 'App',
|
||||
created() {
|
||||
// getV().then(res=>{
|
||||
|
||||
// console.log(String(res))
|
||||
// })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@import "./assets/css/main.css";
|
||||
@import "./assets/css/color-dark.css";
|
||||
|
||||
/*深色主题*/
|
||||
/*@import "./assets/css/theme-green/color-green.css"; 浅绿色主题*/
|
||||
.setting-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.setting-wrapper .line {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.call-mode-wrapper,
|
||||
.setting-wrapper {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.conditions-wrapper {
|
||||
/* display: flex; */
|
||||
margin: 15px 0;
|
||||
/* align-items: center; */
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.type3_submit_home {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 80%;
|
||||
margin-top: 30px;
|
||||
top: 74.5vh;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
531
h5-enginex-manager/src/api/index.js
Executable file
531
h5-enginex-manager/src/api/index.js
Executable file
@@ -0,0 +1,531 @@
|
||||
import request from '../utils/request';
|
||||
// console.log(request)
|
||||
|
||||
export const getV = (params) => request.get(`${window.location.origin}/index.html?time=${new Date().getTime()}`)
|
||||
|
||||
|
||||
|
||||
export const fetchData = (params) => request.get('./table.json',{params})
|
||||
// 登录接口
|
||||
export const getLogin = (params) => request.post('Riskmanage/v2/login/login',params)
|
||||
// 登出接口
|
||||
export const getLogout = (params) => request.post('Riskmanage/v2/login/logout',params)
|
||||
// 查询菜单权限接口
|
||||
export const getMenus = (params) => request.post('Riskmanage/v2/sysMenu/getMenus',params)
|
||||
// 查询首页统计信息
|
||||
export const getIndexInfo = (params) => request.post('Riskmanage/v2/engine/getIndexInfo',params)
|
||||
// 查询模型列表信息
|
||||
export const getModelsList = (params) => request.post('Riskmanage/models/getModelsList',params)
|
||||
// 获取组织下全量指标信息
|
||||
export const getAllFields = (params) => request.post('Riskmanage/models/getAllFields',params)
|
||||
// 添加模型
|
||||
export const saveModel = (params) => request.post('Riskmanage/models/save',params)
|
||||
// 删除模型
|
||||
export const deleteModel = (id) => request.delete('Riskmanage/models/delete/' + id)
|
||||
// 修改模型
|
||||
export const updateModel = (id, params) => request.put('Riskmanage/models/update/' + id, params)
|
||||
// 获取模型详细信息
|
||||
export const getModelDetailInfo = (id) => request.get('Riskmanage/models/getDetailInfo/' + id)
|
||||
|
||||
// 查询引擎列表
|
||||
export const getEngineList = (params) => request.get('Riskmanage/v2/engine/getEngineList',{params})
|
||||
// 获取UUID
|
||||
export const getEngineUUID = () => request.get('Riskmanage/v2/engine/getUUID')
|
||||
// 引擎信息回显
|
||||
export const engineInitupdate = (id) => request.get('Riskmanage/v2/engine/initupdate/' + id)
|
||||
// 保存引擎信息
|
||||
export const updateEngine = (params) => request.put('Riskmanage/v2/engine/update',params)
|
||||
|
||||
|
||||
|
||||
// 数据源 数据库列表
|
||||
export const getDataSourcelist = (params) => request.post('/Riskmanage/datasource/getDataSourceList',params)
|
||||
// 数据源 修改以及创建数据库
|
||||
export const setDataSource = (params) => request.post('/Riskmanage/datasource/save',params)
|
||||
// 数据源 删除
|
||||
export const deleteDataSource = (id) => request.delete('/Riskmanage/datasource/'+id)
|
||||
// 数据源 修改数据源
|
||||
export const updataDataSource = (params) => request.post('/Riskmanage/datasource/update',params)
|
||||
|
||||
|
||||
// 指标管理 listTree 获取
|
||||
export const getfieldListTree = (params) => request.post('/Riskmanage/v2/datamanage/field/newListTree',params)
|
||||
|
||||
// 指标管理 指标列表 获取
|
||||
export const getfieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/list',params)
|
||||
|
||||
// 指标管理 指标列表 获取
|
||||
export const addfieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/addTree',params)
|
||||
// 指标管理 更新类型 名称
|
||||
export const updatafieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/updateTree',params)
|
||||
// 指标管理 更新类型 名称
|
||||
export const getFieldUser = (params) => request.post('/Riskmanage/v2/datamanage/field/findFieldByUser',params)
|
||||
|
||||
// 保存 增加属性
|
||||
export const getfieldsave = (params) => request.post('/Riskmanage/v2/datamanage/field/save',params)
|
||||
// 编辑保存
|
||||
export const updatafield = (params) => request.post('/Riskmanage/v2/datamanage/field/update',params)
|
||||
// 启用等
|
||||
export const fieldusing = (params) => request.post('/Riskmanage/v2/datamanage/field/updateStatus',params)
|
||||
// 指标导入模板下载
|
||||
export const fielddownTemplate = (params) => request.post('/Riskmanage/v2/datamanage/field/downTemplate',params)
|
||||
// 指标批量模板上传
|
||||
export const fieldupdata = (params) => request.post('/Riskmanage/v2/datamanage/field/upload',params)
|
||||
// 获取指标管理
|
||||
export const getfieldInfo = (id,params) => request.post('/Riskmanage/v2/datamanage/field/getFieldInfo/'+id,{params})
|
||||
|
||||
// 指标文件夹移动
|
||||
export const updateFieldFolder = (params) => request.post('/Riskmanage/v2/datamanage/field/updateFieldFolder',params)
|
||||
|
||||
// ========================================规则管理==========================
|
||||
|
||||
|
||||
|
||||
// // groovy管理 list获取
|
||||
// export const getRulesList = (params) => request.post('/Riskmanage/v3/rule/getRuleList',params)
|
||||
// // groovy管理 删启停
|
||||
// export const Rulesusing = (params) => request.post('/Riskmanage/v3/rule/updateRuleStatus',params)
|
||||
|
||||
// // groovy管理 保存
|
||||
// export const getrulesave = (params) => request.post('/Riskmanage/v3/rule/addRule',params)
|
||||
// groovy管理 具体元素内容获取
|
||||
export const getScriptRuleInfo = (params) => request.post('/Riskmanage/v3/rule/getScriptRule/'+params)
|
||||
// // groovy管理 修改保存
|
||||
// export const getRuleUpdata = (params) => request.post('/Riskmanage/v3/rule/updateRule',params)
|
||||
// groovy管理 获取规则主体
|
||||
export const getRuleScriptVersionInfo = (id) => request.post('/Riskmanage/v3/ruleScriptVersion/getRuleScriptVersion/'+id.id)
|
||||
// groovy管理 添加规则版本
|
||||
export const addRuleScriptVersion = (params) => request.post('/Riskmanage/v3/ruleScriptVersion/addRuleScriptVersion',params)
|
||||
// groovy管理 更新规则版本状态
|
||||
export const updateRuleScriptVersionStatus = (params) => request.post('/Riskmanage/v3/ruleScriptVersion/updateRuleScriptVersionStatus ',params)
|
||||
// groovy管理 复制规则版本
|
||||
export const copyRuleScriptVersion = (params) => request.post('/Riskmanage/v3/ruleScriptVersion/copyRuleScriptVersion',params)
|
||||
// groovy管理 规则版本重命名
|
||||
export const updateRuleScriptVersion = (params) => request.post('/Riskmanage/v3/ruleScriptVersion/updateRuleScriptVersion',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 规则管理 listTree 获取
|
||||
export const getRulesListTree = (params) => request.post('/Riskmanage/v2/knowledge/tree/list',params)
|
||||
// 规则管理 list获取
|
||||
export const getRulesList = (params) => request.post('/Riskmanage/v3/rule/getRuleList',params)
|
||||
// 规则管理 删启停
|
||||
export const Rulesusing = (params) => request.post('/Riskmanage/v3/rule/updateRuleStatus',params)
|
||||
// 规则管理 文件夹新增
|
||||
export const addListRules = (params) => request.post('/Riskmanage/v2/knowledge/tree/save',params)
|
||||
// 规则管理 文件夹删除 修改
|
||||
export const updataListRules = (params) => request.post('/Riskmanage/v2/knowledge/tree/update',params)
|
||||
// 规则管理 保存
|
||||
export const getrulesave = (params) => request.post('/Riskmanage/v3/rule/addRule',params)
|
||||
// 规则管理 具体元素内容获取
|
||||
export const getRuleInfo = (id) => request.post('/Riskmanage/v3/rule/getRuleInfo/'+id)
|
||||
// 规则管理 修改保存
|
||||
export const getRuleUpdata = (params) => request.post('/Riskmanage/v3/rule/updateRule',params)
|
||||
// 规则管理 获取规则主体
|
||||
export const getRuleVersionInfo = (params) => request.post('/Riskmanage/v3/ruleVersion/getRuleVersionInfo/'+params.id)
|
||||
// 规则管理 添加规则版本
|
||||
export const addRuleVersion = (params) => request.post('/Riskmanage/v3/ruleVersion/addRuleVersion',params)
|
||||
// 规则管理 更新规则版本状态
|
||||
export const updateRuleVersionStatus = (params) => request.post('/Riskmanage/v3/ruleVersion/updateRuleVersionStatus',params)
|
||||
// 规则管理 复制规则版本
|
||||
export const copyRuleVersion = (params) => request.post('/Riskmanage/v3/ruleVersion/copyRuleVersion',params)
|
||||
// 规则管理 规则版本重命名
|
||||
export const updateRuleVersion = (params) => request.post('/Riskmanage/v3/ruleVersion/updateRuleVersion',params)
|
||||
|
||||
|
||||
|
||||
// 简单规则管理 保存
|
||||
export const getEasyRulesave = (params) => request.post('/Riskmanage/v3/rule/addRule',params)
|
||||
// 简单规则管理 修改保存
|
||||
export const getEasyRuleUpdata = (params) => request.post('/Riskmanage/v3/rule/updateRule',params)
|
||||
// 简单规则管理 具体元素内容获取
|
||||
export const getEasyRuleInfo = (params) => request.post('/Riskmanage/v3/rule/getSimpleRule/'+params.id)
|
||||
// 简单规则管理 批量上传
|
||||
export const ruleupdata = (params) => request.post('/Riskmanage/v3/rule/upload',params)
|
||||
// 规则文件夹移动
|
||||
export const updateRuleParent = (params) => request.post('/Riskmanage/v3/rule/updateRuleParent',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===============================================评分卡管理===============================
|
||||
// 评分卡 list 获取
|
||||
// export const getSCOList = (params) => request.post('/Riskmanage/v2/knowledge/scorecard/list',params)
|
||||
export const getSCOList = (params) => request.post('/Riskmanage/v3/scorecard/list',params)
|
||||
// 评分卡 list 删启停
|
||||
export const updataListSCO = (params) => request.post('/Riskmanage/v3/scorecard/updateStatus',params)
|
||||
// 评分卡 检测区间是否闭环
|
||||
export const validateSection = (params) => request.post('/Riskmanage/v3/scorecard/section',params)
|
||||
// 评分卡 新增列表
|
||||
export const addSCO = (params) => request.post('/Riskmanage/v3/scorecard/add',params)
|
||||
// 评分卡 获取评分卡版本
|
||||
export const getSCOVersion = (params) => request.post('/Riskmanage/v3/scorecard/getScorecardInfo/'+params.id)
|
||||
// 评分卡 添加评分卡版本
|
||||
export const addScorecardVersion = (params) => request.post('/Riskmanage/v3/scorecardVersion/addScorecardVersion',params)
|
||||
// 评分卡 更新版本状态
|
||||
export const updateScorecardVersionStatus = (params) => request.post('/Riskmanage/v3/scorecardVersion/updateScorecardVersionStatus',params)
|
||||
// 评分卡 复制版本
|
||||
export const copyScorecardVersion = (params) => request.post('/Riskmanage/v3/scorecardVersion/copyScorecardVersion',params)
|
||||
// 评分卡 版本重命名
|
||||
export const updateScorecardVersion = (params) => request.post('/Riskmanage/v3/scorecardVersion/updateScorecardVersion',params)
|
||||
// 评分卡 获取评分卡主体
|
||||
export const getSCOInfo = (params) => request.post('/Riskmanage/v3/scorecardVersion/getScorecardVersionInfo/'+params.id)
|
||||
// 评分卡 修改列表提交
|
||||
export const getSCOUpdata = (params) => request.post('/Riskmanage/v3/scorecard/update',params)
|
||||
|
||||
|
||||
|
||||
|
||||
//======================================黑名单=======================================
|
||||
|
||||
// 黑白名单库管理 首次进来获取名单列表
|
||||
export const getBlackWhiteList = (params) => request.post('/Riskmanage/v2/datamanage/listmanage/list',params)
|
||||
// 黑白名单库管理 添加名单库
|
||||
export const saveBlackWhiteList = (params) => request.post('/Riskmanage/v2/datamanage/listmanage/save',params)
|
||||
// 黑白名单库管理 编辑名单库
|
||||
export const updateBlackWhiteList = (params) => request.post('/Riskmanage/v2/datamanage/listmanage/update',params)
|
||||
// 黑白名单库管理 获取详情
|
||||
export const getListDbInfo = (id,params) => request.post('/Riskmanage/v2/datamanage/listmanage/getListDbInfo/'+id,params)
|
||||
// /
|
||||
export const updateStatus = (params) => request.post('/Riskmanage/v2/datamanage/listmanage/updateStatus',params)
|
||||
// 导入
|
||||
export const listmanageUpload = (id,params) => request.post('/Riskmanage/v2/datamanage/listmanage/upload/'+id,params)
|
||||
//下载模板
|
||||
export const listmanageDownTemplate = () => request.post('/Riskmanage/v2/datamanage/listmanage/downTemplate')
|
||||
// v2/datamanage/listmanage/getListDbData
|
||||
export const getListDbData = (params) => request.post('/Riskmanage/v2/datamanage/listmanage/getListDbData',params)
|
||||
|
||||
// ================================== 系统管理 ===================================
|
||||
// ---------------------用户管理
|
||||
// 获取用户列表
|
||||
export const getUserList = (params) => request.post('/Riskmanage/v2/sysUser/getUserList',params)
|
||||
// 创建用户
|
||||
export const saveUser = (params) => request.post('/Riskmanage/v2/sysUser/save',params)
|
||||
// 编辑修改
|
||||
export const updateUser = (params) => request.post('/Riskmanage/v2/sysUser/update',params)
|
||||
// 启用、停用、删除
|
||||
export const userUpdateStatus = (params) => request.post('/Riskmanage/v2/sysUser/updateStatus',params)
|
||||
// 获取组织列表
|
||||
export const getOrganList = (params) => request.post('/Riskmanage/v2/sysOrganization/getOrganList',params)
|
||||
// 获取已启用的组织列表
|
||||
export const getAllValidOrgan = (params) => request.post('/Riskmanage/v2/sysOrganization/getAllValidOrgan',params)
|
||||
// 获取角色
|
||||
export const getAllValidRole = (params) => request.post('/Riskmanage/v2/sysRole/getAllValidRole',params)
|
||||
// 修改密码
|
||||
export const updateUserPassword = (params) => request.post('/Riskmanage/v2/sysUser/updatePassword',params)
|
||||
|
||||
//----------------------- 角色管理
|
||||
// 获取角色列表
|
||||
export const getRoleList = (params) => request.post('/Riskmanage/v2/sysRole/getRoleList',params)
|
||||
// 修改批量操作
|
||||
export const roleUpdateStatus = (params) => request.post('/Riskmanage/v2/sysRole/updateStatus',params)
|
||||
// 创建角色
|
||||
export const saveRole = (params) => request.post('/Riskmanage/v2/sysRole/save',params)
|
||||
// 修改角色
|
||||
export const updateRole = (params) => request.post('/Riskmanage/v2/sysRole/update',params)
|
||||
// 获取资源树
|
||||
export const getFindTreeList = (params) => request.post('/Riskmanage/v2/sysMenu/findTreeList',params)
|
||||
// 获取引擎树
|
||||
export const getEngineTree = (params) => request.post('/Riskmanage/v2/sysMenu/getEngineTree',params)
|
||||
// 权限分配资源树保存
|
||||
export const insertRoleMenu = (params) => request.post('/Riskmanage/v2/sysMenu/insertRoleMenu',params)
|
||||
// 权限分配引擎树保存
|
||||
export const insertRoleEngine = (params) => request.post('/Riskmanage/v2/sysMenu/insertRoleEngine',params)
|
||||
// -----------------------资源管理
|
||||
// 获取资源列表
|
||||
export const getRsourceMenuList = (params) => request.post('/Riskmanage/v2/sysMenu/getMenuList',params)
|
||||
// 删除资源
|
||||
export const resourceUpdateStatus = (params) => request.post('/Riskmanage/v2/sysMenu/updateStatus',params)
|
||||
// 新增/修改资源获取的父节点树
|
||||
export const getResourceTreeMenu = (params) => request.post('/Riskmanage/v2/sysMenu/getTreeMenu',params)
|
||||
// 编辑资源
|
||||
export const resourceUpdate = (params) => request.post('/Riskmanage/v2/sysMenu/update',params)
|
||||
// 新增资源
|
||||
export const resourceSave = (params) => request.post('/Riskmanage/v2/sysMenu/save',params)
|
||||
// -----------------------组织管理
|
||||
// 创建组织
|
||||
export const saveOrgan = (params) => request.post('/Riskmanage/v2/sysOrganization/save',params)
|
||||
// 修改组织
|
||||
export const updateOrgan = (params) => request.post('/Riskmanage/v2/sysOrganization/update',params)
|
||||
// 更新状态
|
||||
export const updateStatusOrgan = (params) => request.post('/Riskmanage/v2/sysOrganization/updateStatus',params)
|
||||
// -----------------------日志管理
|
||||
// 列表
|
||||
export const getLogList = (params) => request.post('/Riskmanage/v2/sysLog/getLogList',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==========================================决策流==============================
|
||||
|
||||
// 决策流 获取版本信息
|
||||
export const getversion = (id) => request.post('/Riskmanage/v2/engine/version/'+id)
|
||||
// 决策流 获取节点
|
||||
export const getNodeList = (id) => request.post('/Riskmanage/v2/decision_flow/getNodeList/'+id)
|
||||
// 决策流 新增
|
||||
export const setAddNode = (params) => request.post('/Riskmanage/v2/decision_flow/save',params)
|
||||
// 决策流 新增黑白
|
||||
export const setAddNodeHB = (params) => request.post('/Riskmanage/v2/bwListNode/create',params)
|
||||
// 决策流 移动节点
|
||||
export const setmoveNode = (params) => request.post('/Riskmanage/v2/decision_flow/updatePropertyForMove',params)
|
||||
// 决策流 删除节点
|
||||
export const setdelectNode = (params) => request.post('/Riskmanage/v2/decision_flow/removeNode',params)
|
||||
// 决策流 删除节点
|
||||
export const setdelectNodeList = (params) => request.post('/Riskmanage/v2/decision_flow/removeNodeList',params)
|
||||
// 决策流 连线
|
||||
export const setupdateProperty = (params) => request.post('/Riskmanage/v2/decision_flow/updateProperty',params)
|
||||
// 决策流 断线
|
||||
export const setremoveLink = (params) => request.post('/Riskmanage/v2/decision_flow/removeLink',params)
|
||||
// 决策流 部署引擎
|
||||
// export const getVersionDeploy = (id) => request.post('/Riskmanage/v2/engineVersion/deploy/'+id)
|
||||
// 决策流 部署引擎V2
|
||||
export const getVersionDeploy = (id) => request.post('/Riskmanage/v2/engineVersion/applyDeploy/'+id)
|
||||
// 决策流 取消部署引擎
|
||||
export const getVersionUnDeploy = (id) => request.post('/Riskmanage/v2/engineVersion/undeploy/'+id)
|
||||
// 决策流 复制版本
|
||||
export const getCopyVer = (id) => request.post('/Riskmanage/v2/decision_flow/saveVersion/'+id)
|
||||
// 决策流 复制节点
|
||||
export const getCopyNode = (params) => request.post('/Riskmanage/v2/decision_flow/copy',params)
|
||||
// 决策流 清空节点
|
||||
export const getClearNode = (id) => request.post('/Riskmanage/v2/engineVersion/clear/'+id)
|
||||
// 决策流 删除版本
|
||||
export const delectVer = (id) => request.post('/Riskmanage/v2/engineVersion/delete/'+id)
|
||||
// 决策流 新建版本
|
||||
export const getAddVer = (id,Vid) => request.post('/Riskmanage/v2/engineVersion/add/'+id+'/'+Vid)
|
||||
// 决策流 重命名
|
||||
export const setRenameNode = (params) => request.post('/Riskmanage/v2/decision_flow/renameNode',params)
|
||||
// 决策流 批量测试模板下载
|
||||
// export const createSampleData = (params) => request.post('/Riskmanage/v2/engine/createSampleData',params)
|
||||
// 决策流 json下载
|
||||
export const getDownloadJsonField = (params) => request.post('/Riskmanage/v2/engine/downloadJsonField',params)
|
||||
// 批量测试
|
||||
export const batchTest = (params) => request.post('/Riskmanage/v2/engine/batchTest',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===========================================type N ==================================
|
||||
//==========type2 规则集
|
||||
|
||||
// 规则集 获取规则集 一级树
|
||||
export const getType2 = (params) => request.post('/Riskmanage/v2/ruleNode/getFolderList',params)
|
||||
// 规则集 获取规则集 二级树
|
||||
export const getType2tree = (params) => request.post('/Riskmanage/v2/ruleNode/getRuleDataForEngine',params)
|
||||
// 规则集 提交规则集
|
||||
// export const setType2 = (params) => request.post('/Riskmanage/v2/decision_flow/update',params)
|
||||
|
||||
|
||||
//==========type4 评分卡
|
||||
// 评分卡 获取评分卡
|
||||
export const getType4 = (params) => request.post('/Riskmanage/v2/cardNode/cardList',params)
|
||||
|
||||
|
||||
|
||||
|
||||
//==========type5-6 黑白名单
|
||||
// 黑白名单 获取黑白名单
|
||||
export const getType56 = (params) => request.post('/Riskmanage/v2/bwListNode/findBwList',params)
|
||||
// 黑白名单 提交黑白名单
|
||||
export const setType56 = (params) => request.post('/Riskmanage/v2/bwListNode/update',params)
|
||||
|
||||
|
||||
//==========type 7 决策结果
|
||||
// 决策结果 获取规则集
|
||||
// export const getType7 = (params) => request.post('/Riskmanage/v2/decision_flow/getFieldOrScorecardForOption',params)
|
||||
|
||||
|
||||
|
||||
//==========type15 模型
|
||||
// 模型 获取评分卡
|
||||
export const getType15 = (params) => request.post('/Riskmanage/modelNode/getModelList',params)
|
||||
|
||||
|
||||
|
||||
//==========type14 子引擎
|
||||
// 子引擎 获取子引擎
|
||||
export const getType14 = (params) => request.post('/Riskmanage/childEngineNode/getEngineList',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 提交
|
||||
export const setType4 = (params) => request.post('/Riskmanage/v2/decision_flow/update',params)
|
||||
|
||||
|
||||
|
||||
|
||||
// =========================交叉决策表=================
|
||||
// 获取list
|
||||
export const getDecisionTablesList = (params) => request.post('/Riskmanage/v3/decisionTables/getDecisionTablesList',params)
|
||||
// 获得 info
|
||||
export const getDecisionTablesInfo = (id) => request.post('/Riskmanage/v3/decisionTables/getDecisionTablesInfo/'+id)
|
||||
// 添加列表
|
||||
export const addDecisionTables = (params) => request.post('/Riskmanage/v3/decisionTables/addDecisionTables',params)
|
||||
// 更新列表
|
||||
export const updateDecisionTables = (params) => request.post('/Riskmanage/v3/decisionTables/updateDecisionTables',params)
|
||||
// 状态更改
|
||||
export const updateDecisionTablesStatus = (params) => request.post('/Riskmanage/v3/decisionTables/updateDecisionTablesStatus',params)
|
||||
// 文件夹移动
|
||||
export const updateDecisionTablesParent = (params) => request.post('/Riskmanage/v3/decisionTables/updateDecisionTablesParent',params)
|
||||
// 获取 版本
|
||||
export const getDecisionTablesVersionInfo = (id) => request.post('/Riskmanage/v3/decisionTables/version/getVersionInfo/'+id)
|
||||
// 添加版本
|
||||
export const addDecVersion = (params) => request.post('/Riskmanage/v3/decisionTables/version/addVersion',params)
|
||||
// 复制版本
|
||||
export const copyDecVersion = (params) => request.post('/Riskmanage/v3/decisionTables/version/copyVersion',params)
|
||||
// 重命名 版本
|
||||
export const updateDecVersion = (params) => request.post('/Riskmanage/v3/decisionTables/version/updateVersion',params)
|
||||
// 删除版本
|
||||
export const updateDecVersionStatus = (params) => request.post('/Riskmanage/v3/decisionTables/version/updateVersionStatus',params)
|
||||
|
||||
|
||||
|
||||
// =========================决策树=================
|
||||
|
||||
// 获取list
|
||||
export const getDecisionTreeList = (params) => request.post('/Riskmanage/v3/decisionTree/getDecisionTreeList',params)
|
||||
// 获得 info
|
||||
export const getDecisionTreeInfo = (id) => request.post('/Riskmanage/v3/decisionTree/getDecisionTreeInfo/'+id)
|
||||
// 添加列表
|
||||
export const addDecisionTree = (params) => request.post('/Riskmanage/v3/decisionTree/addDecisionTree',params)
|
||||
// 更新列表
|
||||
export const updateDecisionTree = (params) => request.post('/Riskmanage/v3/decisionTree/updateDecisionTree',params)
|
||||
// 状态更改
|
||||
export const updateDecisionTreeStatus = (params) => request.post('/Riskmanage/v3/decisionTree/updateDecisionTreeStatus',params)
|
||||
// 文件夹移动
|
||||
export const updateDecisionTreeFolder = (params) => request.post('/Riskmanage/v3/decisionTree/updateDecisionTreeFolder',params)
|
||||
// 获取 版本
|
||||
export const getDecisionTreeVersionInfo = (id) => request.post('/Riskmanage/v3/decisionTree/version/getVersionInfo/'+id)
|
||||
// 添加版本
|
||||
export const addDecTreeVersion = (params) => request.post('/Riskmanage/v3/decisionTree/version/addVersion',params)
|
||||
// 复制版本
|
||||
export const copyDecTreeVersion = (params) => request.post('/Riskmanage/v3/decisionTree/version/copyVersion',params)
|
||||
// 重命名 版本
|
||||
export const updateDecTreeVersion = (params) => request.post('/Riskmanage/v3/decisionTree/version/updateVersion',params)
|
||||
// 删除版本
|
||||
export const updateDecTreeVersionStatus = (params) => request.post('/Riskmanage/v3/decisionTree/version/updateVersionStatus',params)
|
||||
|
||||
|
||||
// =====================接口管理==============================
|
||||
// 获取list
|
||||
export const getInterfaceList = (params) => request.post('/Riskmanage/v3/interface/getInterfaceList',params)
|
||||
// 新增list
|
||||
export const addInterface = (params) => request.post('/Riskmanage/v3/interface/addInterface',params)
|
||||
// 修改list
|
||||
export const updateInterface = (params) => request.post('/Riskmanage/v3/interface/updateInterface',params)
|
||||
// 删除list
|
||||
export const deleteInterface = (params) => request.post('/Riskmanage/v3/interface/deleteInterface',params)
|
||||
// 测试接口
|
||||
export const getHttpResponse = (params) => request.post('/Riskmanage/v3/interface/getHttpResponse',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ======================接口管理 ==============================
|
||||
|
||||
export const getengineSummaryList = (params) => request.post('/Riskmanage/v3/1',params)
|
||||
// export const getengineSummaryList = (params) => request.post('/Riskmanage/v3/1',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ======================趋势分析 ==============================
|
||||
|
||||
export const getTendencyList = (params) => request.post('/Riskmanage/v3/qvshi1',params)
|
||||
// export const getengineSummaryList = (params) => request.post('/Riskmanage/v3/1',params)
|
||||
|
||||
|
||||
// =============决策流 - 7.25. 获取决策流条件入参==================
|
||||
export const getConditionInputParam = (params) => request.post('/Riskmanage/v2/decision_flow/getNodeConditionInputParam',params)
|
||||
|
||||
|
||||
|
||||
|
||||
// ======================决策流监控 ==============================
|
||||
// 获取list
|
||||
export const getMonitorResults = (params) => request.post('/Riskmanage/v2/monitor/results',params)
|
||||
// 获取具体数据
|
||||
export const getMonitorDecisionFlow = (params) => request.post('/Riskmanage/v2/monitor/decisionFlow',params)
|
||||
// 根据ID获取Node节点
|
||||
export const getMonitorNode = (params) => request.post('/Riskmanage/v2/monitor/node',params)
|
||||
// 策略层面接口返回信息
|
||||
export const getStrategy = (params) => request.post('/Riskmanage/v2/monitor/strategy',params)
|
||||
// 获取具体数据
|
||||
export const getMonitorDecisionFlowMysql = (params) => request.post('/Riskmanage/v2/monitor/decisionFlowMysql',params)
|
||||
// 根据ID获取Node节点
|
||||
export const getMonitorNodeMysql = (params) => request.post('/Riskmanage/v2/monitor/nodeMysql',params)
|
||||
// 策略层面接口返回信息
|
||||
export const getStrategyMysql = (params) => request.post('/Riskmanage/v2/monitor/strategyMysql',params)
|
||||
|
||||
|
||||
|
||||
// ======================趋势分析 ==============================
|
||||
// 获取list
|
||||
export const getAnalyseData = (params) => request.post('/Riskmanage/v3/analyse/getData',params)
|
||||
|
||||
// 获取总数
|
||||
export const getAnalyseSummary = (params) => request.post('/Riskmanage/v3/analyse/getEngineSummary',params)
|
||||
|
||||
// ======================= 审批设置 ======================
|
||||
// 获取审批设置
|
||||
export const approvalConfigGetApprovalList = (params) => request.post('/Riskmanage/v3/approvalConfig/getApprovalList',params)
|
||||
// 更改审批设置
|
||||
export const approvalConfigUpdateApprovalStatus = (params) => request.post('/Riskmanage/v3/approvalConfig/updateApprovalStatus',params)
|
||||
|
||||
|
||||
// ======================== 审批管理 ======================
|
||||
// 获取审批列表
|
||||
export const approvalGetApprovalList = (params) => request.post('/Riskmanage/v3/approval/getApprovalList',params)
|
||||
// 更改审批状态
|
||||
export const approvalUpdateApplyStatus = (params) => request.post('/Riskmanage/v3/approval/updateApplyStatus',params)
|
||||
|
||||
|
||||
// =============================集合操作==============
|
||||
|
||||
// 获取list
|
||||
export const getListOperationList = (params) => request.post('/Riskmanage/v3/listOperation/getListOperationList',params)
|
||||
// 获得 info
|
||||
export const getListOperation = (id) => request.post('/Riskmanage/v3/listOperation/getListOperation/'+id)
|
||||
// 添加列表
|
||||
export const addListOperation = (params) => request.post('/Riskmanage/v3/listOperation/addListOperation',params)
|
||||
// 更新列表
|
||||
export const updateListOperation = (params) => request.post('/Riskmanage/v3/listOperation/updateListOperation',params)
|
||||
// 状态更改
|
||||
export const updateListOperationStatus = (params) => request.post('/Riskmanage/v3/listOperation/updateListOperationStatus',params)
|
||||
// 文件夹移动
|
||||
export const updateListOperationFolder = (params) => request.post('/Riskmanage/v3/listOperation/updateListOperationFolder',params)
|
||||
|
||||
|
||||
// // 获取 版本
|
||||
// export const getDecisionTreeVersionInfo = (id) => request.post('/Riskmanage/v3/listOperation/version/getVersionInfo/'+id)
|
||||
// // 添加版本
|
||||
export const addlistOperationVersion = (params) => request.post('/Riskmanage/v3/listOperation/version/addVersion',params)
|
||||
// // 复制版本
|
||||
export const copyListOperationVersion = (params) => request.post('/Riskmanage/v3/listOperation/version/copyVersion',params)
|
||||
// // 重命名 版本
|
||||
export const updatelistOperationVersion = (params) => request.post('/Riskmanage/v3/listOperation/version/updateVersion',params)
|
||||
// // 删除版本
|
||||
export const updatelistOperationStatusVersion = (params) => request.post('/Riskmanage/v3/listOperation/version/updateVersionStatus',params)
|
||||
7
h5-enginex-manager/src/api/oss.js
Executable file
7
h5-enginex-manager/src/api/oss.js
Executable file
@@ -0,0 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
export function policy() {
|
||||
return request({
|
||||
url:'/aliyun/oss/policy',
|
||||
method:'get',
|
||||
})
|
||||
}
|
||||
134
h5-enginex-manager/src/api/toolbar.js
Executable file
134
h5-enginex-manager/src/api/toolbar.js
Executable file
@@ -0,0 +1,134 @@
|
||||
|
||||
|
||||
// 页面工具栏
|
||||
function showJTopoToobar(stage){
|
||||
var toobarDiv = $('<div class="jtopo_toolbar">').html(''
|
||||
+'<input type="radio" name="modeRadio" value="normal" checked id="r1"/>'
|
||||
+'<label for="r1"> 默认</label>'
|
||||
+' <input type="radio" name="modeRadio" value="select" id="r2"/><label for="r2"> 框选</label>'
|
||||
+' <input type="radio" name="modeRadio" value="edit" id="r4"/><label for="r4"> 加线</label>'
|
||||
+' <input type="button" id="centerButton" value="居中显示"/>'
|
||||
+'<input type="button" id="fullScreenButton" value="全屏显示"/>'
|
||||
+'<input type="button" id="zoomOutButton" value=" 放 大 " />'
|
||||
+'<input type="button" id="zoomInButton" value=" 缩 小 " />'
|
||||
+' <input type="checkbox" id="zoomCheckbox"/><label for="zoomCheckbox">鼠标缩放</label>'
|
||||
+' <input type="text" id="findText" style="width: 100px;" value="" onkeydown="enterPressHandler(event)">'
|
||||
+ '<input type="button" id="findButton" value=" 查 询 ">'
|
||||
+ ' <input type="button" id="cloneButton" value="选中克隆">'
|
||||
+' <input type="button" id="exportButton" value="导出PNG">'
|
||||
+ ' <input type="button" id="printButton" value="导出PDF">');
|
||||
|
||||
$('#content').prepend(toobarDiv);
|
||||
|
||||
// 工具栏按钮处理
|
||||
$("input[name='modeRadio']").click(function(){
|
||||
stage.mode = $("input[name='modeRadio']:checked").val();
|
||||
});
|
||||
$('#centerButton').click(function(){
|
||||
stage.centerAndZoom(); //缩放并居中显示
|
||||
});
|
||||
$('#zoomOutButton').click(function(){
|
||||
stage.zoomOut();
|
||||
});
|
||||
$('#zoomInButton').click(function(){
|
||||
stage.zoomIn();
|
||||
});
|
||||
$('#cloneButton').click(function(){
|
||||
stage.saveImageInfo();
|
||||
});
|
||||
$('#exportButton').click(function() {
|
||||
stage.saveImageInfo();
|
||||
});
|
||||
$('#printButton').click(function() {
|
||||
stage.saveImageInfo();
|
||||
});
|
||||
$('#zoomCheckbox').click(function(){
|
||||
if($('#zoomCheckbox').is(':checked')){
|
||||
stage.wheelZoom = 1.2; // 设置鼠标缩放比例
|
||||
}else{
|
||||
stage.wheelZoom = null; // 取消鼠标缩放比例
|
||||
}
|
||||
});
|
||||
$('#fullScreenButton').click(function(){
|
||||
runPrefixMethod(stage.canvas, "RequestFullScreen")
|
||||
});
|
||||
|
||||
window.enterPressHandler = function (event){
|
||||
if(event.keyCode == 13 || event.which == 13){
|
||||
$('#findButton').click();
|
||||
}
|
||||
};
|
||||
|
||||
// 查询
|
||||
$('#findButton').click(function(){
|
||||
var text = $('#findText').val().trim();
|
||||
//var nodes = stage.find('node[text="'+text+'"]');
|
||||
var scene = stage.childs[0];
|
||||
var nodes = scene.childs.filter(function(e){
|
||||
return e instanceof JTopo.Node;
|
||||
});
|
||||
nodes = nodes.filter(function(e){
|
||||
if(e.text == null) return false;
|
||||
return e.text.indexOf(text) != -1;
|
||||
});
|
||||
|
||||
if(nodes.length > 0){
|
||||
var node = nodes[0];
|
||||
node.selected = true;
|
||||
var location = node.getCenterLocation();
|
||||
// 查询到的节点居中显示
|
||||
stage.setCenter(location.x, location.y);
|
||||
|
||||
function nodeFlash(node, n){
|
||||
if(n == 0) {
|
||||
node.selected = false;
|
||||
return;
|
||||
};
|
||||
node.selected = !node.selected;
|
||||
setTimeout(function(){
|
||||
nodeFlash(node, n-1);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 闪烁几下
|
||||
nodeFlash(node, 6);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var runPrefixMethod = function(element, method) {
|
||||
var usablePrefixMethod;
|
||||
["webkit", "moz", "ms", "o", ""].forEach(function(prefix) {
|
||||
if (usablePrefixMethod) return;
|
||||
if (prefix === "") {
|
||||
// 无前缀,方法首字母小写
|
||||
method = method.slice(0,1).toLowerCase() + method.slice(1);
|
||||
}
|
||||
var typePrefixMethod = typeof element[prefix + method];
|
||||
if (typePrefixMethod + "" !== "undefined") {
|
||||
if (typePrefixMethod === "function") {
|
||||
usablePrefixMethod = element[prefix + method]();
|
||||
} else {
|
||||
usablePrefixMethod = element[prefix + method];
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return usablePrefixMethod;
|
||||
};
|
||||
/*
|
||||
runPrefixMethod(this, "RequestFullScreen");
|
||||
if (typeof window.screenX === "number") {
|
||||
var eleFull = canvas;
|
||||
eleFull.addEventListener("click", function() {
|
||||
if (runPrefixMethod(document, "FullScreen") || runPrefixMethod(document, "IsFullScreen")) {
|
||||
runPrefixMethod(document, "CancelFullScreen");
|
||||
this.title = this.title.replace("退出", "");
|
||||
} else if (runPrefixMethod(this, "RequestFullScreen")) {
|
||||
this.title = this.title.replace("点击", "点击退出");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("浏览器不支持");
|
||||
}*/
|
||||
159
h5-enginex-manager/src/assets/css/ManageRedact.css
Executable file
159
h5-enginex-manager/src/assets/css/ManageRedact.css
Executable file
@@ -0,0 +1,159 @@
|
||||
.dataManageRedact {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.MR_header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
padding:20px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.MR_header>div:nth-of-type(1) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 12%;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.MR_input {
|
||||
|
||||
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
|
||||
padding: 20px 0 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.MR_input input {
|
||||
|
||||
|
||||
transition: all 0.2s;
|
||||
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.MR_scope {
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
padding: 20px 0 20px 0;
|
||||
font-size: 16px;
|
||||
/* display: flex; */
|
||||
}
|
||||
|
||||
.MR_scope input {
|
||||
height: 40px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.MR_headerSmall {
|
||||
padding:8px 20px 8px 20px;
|
||||
|
||||
}
|
||||
.MR_inputSmall {
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_inputSmall input {
|
||||
height: 25px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_scopeSmall input {
|
||||
height: 25px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_scopeSmall {
|
||||
padding:0;
|
||||
font-size: 14px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.MR_input>div {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.MR_input>div>p {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.MR_checkbox {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.MR_scope>div>p {
|
||||
width: 7.6%;
|
||||
}
|
||||
|
||||
.MR_derive {
|
||||
|
||||
margin: 0 40px 0 40px;
|
||||
|
||||
}
|
||||
|
||||
.MR_rule_home {
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.MR_rule_home::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.MR_toolbar {
|
||||
background-color: #F0F0F0;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
.MR_toolbar>p:hover {
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
265
h5-enginex-manager/src/assets/css/alicdn.css
Executable file
265
h5-enginex-manager/src/assets/css/alicdn.css
Executable file
File diff suppressed because one or more lines are too long
28
h5-enginex-manager/src/assets/css/color-dark.css
Executable file
28
h5-enginex-manager/src/assets/css/color-dark.css
Executable file
@@ -0,0 +1,28 @@
|
||||
.header{
|
||||
background-color: #242f42;
|
||||
}
|
||||
.login-wrap{
|
||||
background: #324157;
|
||||
}
|
||||
.plugins-tips{
|
||||
background: #eef1f6;
|
||||
}
|
||||
.plugins-tips a{
|
||||
color: #20a0ff;
|
||||
}
|
||||
.el-upload--text em {
|
||||
color: #20a0ff;
|
||||
}
|
||||
.pure-button{
|
||||
background: #20a0ff;
|
||||
}
|
||||
.tags-li.active {
|
||||
border: 1px solid #409EFF;
|
||||
background-color: #409EFF;
|
||||
}
|
||||
.message-title{
|
||||
color: #20a0ff;
|
||||
}
|
||||
.collapse-btn:hover{
|
||||
background: rgb(40,52,70);
|
||||
}
|
||||
124
h5-enginex-manager/src/assets/css/cont.css
Executable file
124
h5-enginex-manager/src/assets/css/cont.css
Executable file
@@ -0,0 +1,124 @@
|
||||
.cont_cont {
|
||||
display: flex;
|
||||
border-radius: 20px;
|
||||
height: 85vh;
|
||||
}
|
||||
|
||||
.cont_left {
|
||||
width: 200px;
|
||||
flex-shrink: 0;
|
||||
background-color: #fff;
|
||||
border-radius: 10px 0 0 10px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cont_list {
|
||||
height: 70vh;
|
||||
overflow: scroll;
|
||||
scrollbar-width: none;
|
||||
/* Firefox */
|
||||
-ms-overflow-style: none;
|
||||
/* IE 10+ */
|
||||
overflow-x: hidden;
|
||||
/* position: relative; */
|
||||
}
|
||||
|
||||
.cont_list::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.cont_left::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.cont_header {
|
||||
margin-left: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.cont_header_title {
|
||||
color: #444;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.cont_header_subtitle {
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.cont_new_file {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 10px 0 10px 15px;
|
||||
box-sizing: border-box;
|
||||
margin-top: 15px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.cont_new_file>div{
|
||||
margin-left: 10px;
|
||||
}
|
||||
.file_select {
|
||||
border: #409EFF 2px solid;
|
||||
border-radius: 2px;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.cont_right {
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
background-color: #fafafa;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
.cont_right_hint {
|
||||
font-size: 100px;
|
||||
color: #00000011;
|
||||
text-align: center;
|
||||
line-height: 80vh;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.cont_right_top {
|
||||
padding: 21px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 2px solid #eee;
|
||||
}
|
||||
.contText{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
}
|
||||
.contText:hover{
|
||||
white-space:inherit !important
|
||||
}
|
||||
.fileHint{
|
||||
position: fixed;
|
||||
background-color: #fafafa;
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
.fileHint>p{
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
.fileHint>p:hover{
|
||||
color: #409EFF;
|
||||
}
|
||||
4
h5-enginex-manager/src/assets/css/icon.css
Executable file
4
h5-enginex-manager/src/assets/css/icon.css
Executable file
@@ -0,0 +1,4 @@
|
||||
|
||||
[class*=" el-icon-lx"], [class^=el-icon-lx] {
|
||||
font-family: lx-iconfont!important;
|
||||
}
|
||||
185
h5-enginex-manager/src/assets/css/main.css
Executable file
185
h5-enginex-manager/src/assets/css/main.css
Executable file
@@ -0,0 +1,185 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app,
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
|
||||
.content-box {
|
||||
position: absolute;
|
||||
left: 250px;
|
||||
right: 0;
|
||||
top: 70px;
|
||||
bottom: 0;
|
||||
padding-bottom: 30px;
|
||||
-webkit-transition: left .3s ease-in-out;
|
||||
transition: left .3s ease-in-out;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
/* overflow-y: scroll; */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.content-collapse {
|
||||
left: 65px;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 30px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.el-table th {
|
||||
background-color: #f5f7fa !important;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin: 20px 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.plugins-tips {
|
||||
padding: 20px 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.el-button+.el-tooltip {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.el-table tr:hover {
|
||||
background: #f6faff;
|
||||
}
|
||||
|
||||
.mgb20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.move-enter-active,
|
||||
.move-leave-active {
|
||||
transition: opacity .5s;
|
||||
}
|
||||
|
||||
.move-enter,
|
||||
.move-leave {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/*BaseForm*/
|
||||
|
||||
.form-box {
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.form-box .line {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-time-panel__content::after,
|
||||
.el-time-panel__content::before {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
.el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/*Upload*/
|
||||
|
||||
.pure-button {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.g-core-image-corp-container .info-aside {
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.el-upload--text {
|
||||
background-color: #fff;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
width: 360px;
|
||||
height: 180px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.el-upload--text .el-icon-upload {
|
||||
font-size: 67px;
|
||||
color: #97a8be;
|
||||
margin: 40px 0 16px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.el-upload--text {
|
||||
color: #97a8be;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-upload--text em {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/*VueEditor*/
|
||||
|
||||
.ql-container {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip {
|
||||
transform: translateX(117.5px) translateY(10px) !important;
|
||||
}
|
||||
|
||||
.editor-btn {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/*markdown*/
|
||||
|
||||
.v-note-wrapper .v-note-panel {
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.content-wrapper{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 21px;
|
||||
}
|
||||
29
h5-enginex-manager/src/assets/css/theme-green/color-green.css
Executable file
29
h5-enginex-manager/src/assets/css/theme-green/color-green.css
Executable file
@@ -0,0 +1,29 @@
|
||||
.header{
|
||||
background-color: #07c4a8;
|
||||
}
|
||||
.login-wrap{
|
||||
background: rgba(56, 157, 170, 0.82);;
|
||||
}
|
||||
.plugins-tips{
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.plugins-tips a{
|
||||
color: #00d1b2;
|
||||
}
|
||||
.el-upload--text em {
|
||||
color: #00d1b2;
|
||||
}
|
||||
.pure-button{
|
||||
background: #00d1b2;
|
||||
}
|
||||
.pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus {
|
||||
background-color: #00d1b2 !important;
|
||||
border-color: #00d1b2 !important;
|
||||
}
|
||||
.tags-li.active {
|
||||
border: 1px solid #00d1b2;
|
||||
background-color: #00d1b2;
|
||||
}
|
||||
.collapse-btn:hover{
|
||||
background: #00d1b2;
|
||||
}
|
||||
BIN
h5-enginex-manager/src/assets/css/theme-green/fonts/element-icons.ttf
Executable file
BIN
h5-enginex-manager/src/assets/css/theme-green/fonts/element-icons.ttf
Executable file
Binary file not shown.
BIN
h5-enginex-manager/src/assets/css/theme-green/fonts/element-icons.woff
Executable file
BIN
h5-enginex-manager/src/assets/css/theme-green/fonts/element-icons.woff
Executable file
Binary file not shown.
1
h5-enginex-manager/src/assets/css/theme-green/index.css
Executable file
1
h5-enginex-manager/src/assets/css/theme-green/index.css
Executable file
File diff suppressed because one or more lines are too long
BIN
h5-enginex-manager/src/assets/img/img.jpg
Executable file
BIN
h5-enginex-manager/src/assets/img/img.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
h5-enginex-manager/src/assets/img/img(1).jpg
Executable file
BIN
h5-enginex-manager/src/assets/img/img(1).jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
BIN
h5-enginex-manager/src/assets/img/login-bg.jpg
Executable file
BIN
h5-enginex-manager/src/assets/img/login-bg.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
h5-enginex-manager/src/assets/logo.png
Executable file
BIN
h5-enginex-manager/src/assets/logo.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
24
h5-enginex-manager/src/assets/utils.js
Executable file
24
h5-enginex-manager/src/assets/utils.js
Executable file
@@ -0,0 +1,24 @@
|
||||
|
||||
export function formatDate (date, fmt) {
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||||
}
|
||||
let o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'h+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds()
|
||||
};
|
||||
for (let k in o) {
|
||||
if (new RegExp(`(${k})`).test(fmt)) {
|
||||
let str = o[k] + '';
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
};
|
||||
|
||||
function padLeftZero (str) {
|
||||
return ('00' + str).substr(str.length);
|
||||
};
|
||||
289
h5-enginex-manager/src/components/common/Header.vue
Executable file
289
h5-enginex-manager/src/components/common/Header.vue
Executable file
@@ -0,0 +1,289 @@
|
||||
<template>
|
||||
<div class="header">
|
||||
<!-- 折叠按钮 -->
|
||||
<div class="collapse-btn" @click="collapseChage">
|
||||
<i v-if="!collapse" class="el-icon-s-fold"></i>
|
||||
<i v-else class="el-icon-s-unfold"></i>
|
||||
</div>
|
||||
<div class="logo">决策引擎系统</div>
|
||||
<div class="header-right">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList}} -->
|
||||
|
||||
<!-- {{fielduser==''}} -->
|
||||
<!-- {{ruleList==null}} -->
|
||||
<div class="header-user-con">
|
||||
<!-- -->
|
||||
<div class="btn-fullscreen" @click="ReGetStorage">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList=='[]'}} -->
|
||||
<el-tooltip effect="dark" content="刷新缓存" placement="bottom">
|
||||
|
||||
<i :class="Loading?'el-icon-loading':'el-icon-refresh'"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<!-- 全屏显示 -->
|
||||
<div class="btn-fullscreen" @click="handleFullScreen">
|
||||
<el-tooltip effect="dark" :content="fullscreen?`取消全屏`:`全屏`" placement="bottom">
|
||||
<i class="el-icon-rank"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<!-- 消息中心
|
||||
<div class="btn-bell">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="message?`有${message}条未读消息`:`消息中心`"
|
||||
placement="bottom"
|
||||
>
|
||||
<router-link to="/tabs">
|
||||
<i class="el-icon-bell"></i>
|
||||
</router-link>
|
||||
</el-tooltip>
|
||||
<span class="btn-bell-badge" v-if="message"></span>
|
||||
</div> -->
|
||||
<!-- 用户头像 -->
|
||||
<div class="user-avator">
|
||||
<img src="../../assets/img/img.jpg" />
|
||||
</div>
|
||||
<!-- 用户名下拉菜单 -->
|
||||
<el-dropdown class="user-name" trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
{{username}}
|
||||
<i class="el-icon-caret-bottom"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import bus from '../common/bus';
|
||||
import {
|
||||
getLogout
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
fullscreen: false,
|
||||
name: '',
|
||||
message: 2
|
||||
};
|
||||
},
|
||||
created() {
|
||||
bus.$on('collapseHeader', res => {
|
||||
this.busCollapseChage(res)
|
||||
})
|
||||
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
this.$store.dispatch('getRuleList')
|
||||
|
||||
Object.keys(this.$store.state.cacheList).forEach(value => {
|
||||
this.$store.dispatch('getcache', value)
|
||||
})
|
||||
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
},
|
||||
computed: {
|
||||
username() {
|
||||
if (localStorage.getItem('ms_username')) {
|
||||
return localStorage.getItem('ms_username');
|
||||
} else {
|
||||
return "未命名"
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
ruleList() {
|
||||
if (this.$store.state.RuleList) {
|
||||
return this.$store.state.RuleList
|
||||
// return this.$store.state.RuleList
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
Loading() {
|
||||
if (this.$store.state.FieldUser == null) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
if (this.$store.state.Sourcelist == null) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ReGetStorage() {
|
||||
|
||||
if (this.Loading) {
|
||||
return
|
||||
}
|
||||
|
||||
this.mixinReGetStorage()
|
||||
},
|
||||
// 用户名下拉菜单选择事件
|
||||
handleCommand(command) {
|
||||
if (command == 'loginout') {
|
||||
// 调用退出登录接口
|
||||
getLogout();
|
||||
localStorage.removeItem("engineId");
|
||||
// localStorage.removeItem("token");
|
||||
localStorage.removeItem('ms_username');
|
||||
this.$router.push('/login');
|
||||
}
|
||||
},
|
||||
// Bus侧边栏折叠
|
||||
busCollapseChage(res) {
|
||||
this.collapse = res;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 侧边栏折叠
|
||||
collapseChage() {
|
||||
this.collapse = !this.collapse;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 全屏事件
|
||||
handleFullScreen() {
|
||||
let element = document.documentElement;
|
||||
if (this.fullscreen) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
} else {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.webkitRequestFullScreen) {
|
||||
element.webkitRequestFullScreen();
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
// IE11
|
||||
element.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
this.fullscreen = !this.fullscreen;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (document.body.clientWidth < 1500) {
|
||||
this.collapseChage();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.header {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.collapse-btn {
|
||||
float: left;
|
||||
padding: 0 21px;
|
||||
cursor: pointer;
|
||||
line-height: 70px;
|
||||
}
|
||||
|
||||
.header .logo {
|
||||
float: left;
|
||||
width: 250px;
|
||||
line-height: 70px;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
float: right;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.header-user-con {
|
||||
display: flex;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-fullscreen {
|
||||
transform: rotate(45deg);
|
||||
margin-right: 5px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.btn-bell,
|
||||
.btn-fullscreen {
|
||||
position: relative;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-bell-badge {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -2px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-bell .el-icon-bell {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.user-avator {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.user-avator img {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-dropdown-menu__item {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
51
h5-enginex-manager/src/components/common/Home.vue
Executable file
51
h5-enginex-manager/src/components/common/Home.vue
Executable file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<v-head></v-head>
|
||||
<v-sidebar></v-sidebar>
|
||||
<div class="content-box" :class="{'content-collapse':collapse}">
|
||||
<v-tags></v-tags>
|
||||
<div class="content" >
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tagsList">
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vHead from './Header.vue';
|
||||
import vSidebar from './Sidebar.vue';
|
||||
import vTags from './Tags.vue';
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: [],
|
||||
collapse: false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
vHead,
|
||||
vSidebar,
|
||||
vTags
|
||||
},
|
||||
created() {
|
||||
bus.$on('collapse-content', msg => {
|
||||
this.collapse = msg;
|
||||
});
|
||||
|
||||
// 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
|
||||
bus.$on('tags', msg => {
|
||||
let arr = [];
|
||||
for (let i = 0, len = msg.length; i < len; i++) {
|
||||
msg[i].name && arr.push(msg[i].name);
|
||||
}
|
||||
this.tagsList = arr;
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
100
h5-enginex-manager/src/components/common/Sidebar.vue
Executable file
100
h5-enginex-manager/src/components/common/Sidebar.vue
Executable file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
|
||||
text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened :router="true">
|
||||
<template v-for="item in items">
|
||||
<template v-if="item.subs">
|
||||
<el-submenu :index="item.index" :key="item.index">
|
||||
<template slot="title">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</template>
|
||||
<template v-for="subItem in item.subs">
|
||||
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
|
||||
<template slot="title">{{ subItem.title }}</template>
|
||||
<el-menu-item v-for="(threeItem,i) in subItem.subs" :key="i" :index="threeItem.index">{{ threeItem.title }}</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-menu-item :index="item.index" :key="item.index">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</el-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
import {
|
||||
getMenus
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
onRoutes() {
|
||||
return this.$route.path
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 通过 Event Bus 进行组件间通信,来折叠侧边栏
|
||||
bus.$on('collapse', msg => {
|
||||
this.collapse = msg;
|
||||
// bus.$emit('setcanvasn',msg)
|
||||
bus.$emit('collapse-content', msg);
|
||||
});
|
||||
|
||||
// 获取菜单接口
|
||||
this.getMenus()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getMenus() {
|
||||
const data = await getMenus({});
|
||||
// console.log('菜单接口返回的数据',data);
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
this.items = data.data;
|
||||
// console.log("items", this.items);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 70px;
|
||||
bottom: 0;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.sidebar-el-menu:not(.el-menu--collapse) {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.sidebar>ul {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
186
h5-enginex-manager/src/components/common/Tags.vue
Executable file
186
h5-enginex-manager/src/components/common/Tags.vue
Executable file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="tags" v-if="showTags">
|
||||
<ul>
|
||||
<li class="tags-li" v-for="(item,index) in tagsList" :class="{'active': isActive(item.path)}" :key="index">
|
||||
<router-link :to="item.path" class="tags-li-title">
|
||||
{{item.title}}
|
||||
</router-link>
|
||||
<span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tags-close-box">
|
||||
<el-dropdown @command="handleTags">
|
||||
<el-button size="mini" type="primary">
|
||||
标签选项<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu size="small" slot="dropdown">
|
||||
<el-dropdown-item command="other">关闭其他</el-dropdown-item>
|
||||
<el-dropdown-item command="all">关闭所有</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isActive(path) {
|
||||
return path === this.$route.fullPath;
|
||||
},
|
||||
// 关闭单个标签
|
||||
closeTags(index) {
|
||||
const delItem = this.tagsList.splice(index, 1)[0];
|
||||
const item = this.tagsList[index] ? this.tagsList[index] : this.tagsList[index - 1];
|
||||
if (item) {
|
||||
delItem.path === this.$route.fullPath && this.$router.push(item.path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
},
|
||||
// 关闭全部标签
|
||||
closeAll(){
|
||||
this.tagsList = [];
|
||||
this.$router.push('/');
|
||||
},
|
||||
// 关闭其他标签
|
||||
closeOther(){
|
||||
const curItem = this.tagsList.filter(item => {
|
||||
return item.path === this.$route.fullPath;
|
||||
})
|
||||
this.tagsList = curItem;
|
||||
},
|
||||
// 设置标签
|
||||
setTags(route){
|
||||
const isExist = this.tagsList.some(item => {
|
||||
return item.path === route.fullPath;
|
||||
})
|
||||
if(!isExist){
|
||||
if(this.tagsList.length >= 8){
|
||||
this.tagsList.shift();
|
||||
}
|
||||
this.tagsList.push({
|
||||
title: route.meta.title,
|
||||
path: route.fullPath,
|
||||
name: route.matched[1].components.default.name
|
||||
})
|
||||
}
|
||||
bus.$emit('tags', this.tagsList);
|
||||
},
|
||||
handleTags(command){
|
||||
command === 'other' ? this.closeOther() : this.closeAll();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showTags() {
|
||||
return this.tagsList.length > 0;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
$route(newValue, oldValue){
|
||||
this.setTags(newValue);
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.setTags(this.$route);
|
||||
// 监听关闭当前页面的标签页
|
||||
bus.$on('close_current_tags', () => {
|
||||
for (let i = 0, len = this.tagsList.length; i < len; i++) {
|
||||
const item = this.tagsList[i];
|
||||
if(item.path === this.$route.fullPath){
|
||||
if(i < len - 1){
|
||||
this.$router.push(this.tagsList[i+1].path);
|
||||
}else if(i > 0){
|
||||
this.$router.push(this.tagsList[i-1].path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
this.tagsList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.tags {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
padding-right: 120px;
|
||||
box-shadow: 0 5px 10px #ddd;
|
||||
}
|
||||
|
||||
.tags ul {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tags-li {
|
||||
float: left;
|
||||
margin: 3px 5px 2px 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
border: 1px solid #e9eaec;
|
||||
background: #fff;
|
||||
padding: 0 5px 0 12px;
|
||||
vertical-align: middle;
|
||||
color: #666;
|
||||
-webkit-transition: all .3s ease-in;
|
||||
-moz-transition: all .3s ease-in;
|
||||
transition: all .3s ease-in;
|
||||
}
|
||||
|
||||
.tags-li:not(.active):hover {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.tags-li.active {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-li-title {
|
||||
float: left;
|
||||
max-width: 80px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 5px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tags-li.active .tags-li-title {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-close-box {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
padding-top: 1px;
|
||||
text-align: center;
|
||||
width: 110px;
|
||||
height: 30px;
|
||||
background: #fff;
|
||||
box-shadow: -3px 0 15px 3px rgba(0, 0, 0, .1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
</style>
|
||||
286
h5-enginex-manager/src/components/common/Version.vue
Executable file
286
h5-enginex-manager/src/components/common/Version.vue
Executable file
@@ -0,0 +1,286 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="Rule_version">
|
||||
<el-select value="V:0" placeholder="请选择版本" v-if="!id" :disabled="true" @change="versionChange" size='mini'>
|
||||
</el-select>
|
||||
<el-select v-model="version.id" placeholder="请选择版本" v-else :disabled="addVersionStatus"
|
||||
@change="versionChange" size='mini'>
|
||||
<el-option v-for="item in ruleVersionList" :key="item.id" :label="item.versionCode" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button plain class="Rule_version_buttom" style="margin-left: 10px;" size='mini' @click="addVersion"
|
||||
v-show="!addVersionStatus" :disabled="!id">新增版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="success" @click="sureAddVersion"
|
||||
v-show="addVersionStatus">确认新增</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="danger" @click="addVersionClose"
|
||||
v-show="addVersionStatus">取消新增</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="$emit('Dialog',true)"
|
||||
:disabled="addVersionStatus||!id">复制版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="updateVersion=true;$emit('Dialog',true)"
|
||||
:disabled="addVersionStatus||!id">版本重命名</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' type="danger" @click="delectVersion"
|
||||
:disabled="addVersionStatus||!id">删除此版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="$emit('exportVersion')"
|
||||
v-if="exportVersion" :disabled="addVersionStatus||!id">导出此版本</el-button>
|
||||
<el-button plain class="Rule_version_buttom" size='mini' @click="importVersion" v-if="exportVersion"
|
||||
:disabled="addVersionStatus||!id">导入版本</el-button>
|
||||
|
||||
<span style="font-size: 12px;color: #999;margin-left: 10px;">切换版本并不会自动保存内容 请手动保存</span>
|
||||
|
||||
</div>
|
||||
<span style="color: #00A854;font-size: 14px;margin-left: 10px;">版本描述:{{id?version.description:'初始版本'}}</span>
|
||||
<el-dialog title="提示" :visible.sync="addVersionDialog" width="30%"
|
||||
@close="updateVersion=false;tempVersion.versionCode='',tempVersion.description=''"
|
||||
:close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
|
||||
<div v-loading="addVersionLoading">
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本名称:</span>
|
||||
<el-input placeholder="请输入新版本名称" maxlength="30" v-model="tempVersion.versionCode" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本描述:</span>
|
||||
<el-input placeholder="请输入新版本描述" maxlength="30" v-model="tempVersion.description" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right;margin-top: 20px;">
|
||||
<el-button @click="$emit('Dialog',false)">取 消</el-button>
|
||||
<el-button type="primary" @click="addVersionSure">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="提示" :visible.sync="importVersionDialog" width="30%" @close="" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" :show-close="false">
|
||||
<div v-loading="importVersionLoading">
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本名称:</span>
|
||||
<el-input placeholder="请输入新版本名称" maxlength="30" v-model="tempVersion.versionCode" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
<p style="margin-top: 20px;"><span style="width: 30%;">新版本描述:</span>
|
||||
<el-input placeholder="请输入新版本描述" maxlength="30" v-model="tempVersion.description" clearable
|
||||
style="width: 70%;"></el-input>
|
||||
</p>
|
||||
|
||||
<div style="display: flex;justify-content: center;padding-top: 20px;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList"
|
||||
:before-upload="beforeUpload" v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传json文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right;margin-top: 20px;">
|
||||
<el-button @click="importVersionDialog=false">取 消</el-button>
|
||||
<el-button type="primary" @click="importVersionSure">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
ruleVersionList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
version: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
id: '',
|
||||
description: '',
|
||||
versionCode: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
addVersionDialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
addVersionLoading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
addVersionStatus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
exportVersion: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempJsonObj: null,
|
||||
files: null,
|
||||
fileName: '',
|
||||
fileList: [],
|
||||
importVersionDialog: false,
|
||||
importVersionLoading: false,
|
||||
Uploadloading: false,
|
||||
tempVersion: {
|
||||
versionCode: '',
|
||||
description: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUpload(file) {
|
||||
// console.log(file, '文件');
|
||||
this.files = file;
|
||||
const extension = file.name.split('.')[file.name.split('.').length - 1] === 'json'
|
||||
const isLt2M = file.size / 1024 / 1024 < 5
|
||||
if (!extension) {
|
||||
this.$message.warning('上传模板只能是 json格式!')
|
||||
return
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.warning('上传模板大小不能超过 5MB!')
|
||||
return
|
||||
}
|
||||
this.fileName = file.name;
|
||||
|
||||
var reader = new FileReader() // 新建一个FileReader
|
||||
reader.readAsText(file, 'UTF-8') // 读取文件
|
||||
reader.onload =(evt)=>{ // 读取完文件之后会回来这里
|
||||
this.tempJsonObj = JSON.parse(evt.target.result) // 读取文件内容
|
||||
console.log(this.tempJsonObj)
|
||||
}
|
||||
return false // 返回false不会自动上传
|
||||
},
|
||||
importVersionSure() {
|
||||
if(this.tempJsonObj==null){
|
||||
this.$message.error('请上传文件')
|
||||
return
|
||||
}
|
||||
if(this.tempVersion.versionCode.trim()===''){
|
||||
this.$message.error('请填写新版本名称')
|
||||
return
|
||||
}
|
||||
if(this.tempVersion.description.trim()===''){
|
||||
this.$message.error('请填写新版本描述')
|
||||
return
|
||||
}
|
||||
console.log(JSON.parse(JSON.stringify(this.tempJsonObj)))
|
||||
this.$emit('importNewVersion',{data:JSON.parse(JSON.stringify(this.tempJsonObj)),name:JSON.parse(JSON.stringify(this.tempVersion))})
|
||||
this.tempJsonObj=null
|
||||
this.tempVersion.versionCode=''
|
||||
this.tempVersion.description=''
|
||||
this.importVersionDialog = false
|
||||
},
|
||||
importVersion() {
|
||||
this.importVersionDialog = true
|
||||
},
|
||||
versionChange(e) {
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.$emit('versionChange', value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
addVersion(e) {
|
||||
// this.addVersionStatus = true
|
||||
this.$emit('StatusChange', true)
|
||||
this.$emit('addVersion', e)
|
||||
},
|
||||
sureAddVersion(e) {
|
||||
this.$emit('addVersionExamine', this.tempVersion)
|
||||
// this.addVersionDialog = true
|
||||
// this.$emit('Dialog',true)
|
||||
},
|
||||
delectVersion(e) {
|
||||
if (this.ruleVersionList.length == 1) {
|
||||
this.$message.error('最少要有一个版本存在')
|
||||
return
|
||||
}
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectVersion', e)
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
addVersionSure(e) {
|
||||
if (this.verificationTempVersion()) {
|
||||
this.addVersionLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
console.log(1)
|
||||
if (this.addVersionStatus) { // 添加版本
|
||||
this.$emit('addVersionSure', this.tempVersion)
|
||||
} else if (this.updateVersion) { //重命名版本
|
||||
this.$emit('updateVersion', this.tempVersion)
|
||||
} else { // 复制版本
|
||||
this.$emit('copyVersion', this.tempVersion)
|
||||
}
|
||||
// this.addVersionStatus = false
|
||||
// this.$emit('StatusChange',false)
|
||||
|
||||
},
|
||||
addVersionClose(e) {
|
||||
// this.addVersionStatus = false
|
||||
this.$emit('StatusChange', false)
|
||||
this.$emit('addVersionClose', e)
|
||||
},
|
||||
verificationTempVersion() {
|
||||
if (this.tempVersion.versionCode.trim() === "") {
|
||||
this.$message.error('请填入新版本名称')
|
||||
return true
|
||||
}
|
||||
let is = {
|
||||
is: false,
|
||||
msg: '',
|
||||
}
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.versionCode === this.tempVersion.versionCode) {
|
||||
is.is = true
|
||||
is.msg = '已存在此版本名'
|
||||
}
|
||||
})
|
||||
if (is.is) {
|
||||
this.$message.error(is.msg)
|
||||
return true
|
||||
}
|
||||
if (this.tempVersion.description.trim() === "") {
|
||||
this.$message.error('请填入新版本描述')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.Rule_version {
|
||||
/* margin-top: 20px; */
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
108
h5-enginex-manager/src/components/common/ZoomView.vue
Executable file
108
h5-enginex-manager/src/components/common/ZoomView.vue
Executable file
@@ -0,0 +1,108 @@
|
||||
<style>
|
||||
.zoomView {
|
||||
background-color: #eee;
|
||||
height: 250px;
|
||||
/* overflow: hidden; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#zoomView_cont {
|
||||
background-color: #DDDDDD;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
transition: all 0.1s;
|
||||
position: absolute;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.zoomView_modal{
|
||||
/* background-color: #0000FF; */
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="zoomView" @mouseup="mouseup" ref="zoomView">
|
||||
<span style="font-size: 12px;color: #aaa;">双击回归原位置</span>
|
||||
<div id="zoomView_cont" ref="zoomViewCont" :style="{transform: 'scale('+mult+','+mult+')',top:top,left:left}">
|
||||
<div class="zoomView_modal">
|
||||
|
||||
</div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mult: 1,
|
||||
ismove: false,
|
||||
timeout: null,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
ClientX: '',
|
||||
ClientY: '',
|
||||
OffsetLeft: '',
|
||||
OffsetTop: '',
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.onmousemove = () => {}
|
||||
window.mouseup = () => {}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.zoomView.onmousewheel = (e) => {
|
||||
this.mult -= e.deltaY / 1000
|
||||
if (this.mult >= 1) {
|
||||
|
||||
} else {
|
||||
this.mult = 1
|
||||
}
|
||||
}
|
||||
this.$refs.zoomView.onmousedown = (e) => {
|
||||
this.ismove = true
|
||||
this.ClientX = e.clientX;
|
||||
this.ClientY = e.clientY;
|
||||
this.OffsetLeft = this.$refs.zoomViewCont.offsetLeft
|
||||
this.OffsetTop = this.$refs.zoomViewCont.offsetTop
|
||||
}
|
||||
window.onmousemove = (e) => {
|
||||
if (this.ismove && (new Date() - this.timeout > 50 || this.timeout == null)) {
|
||||
|
||||
|
||||
this.top = e.clientY - (this.ClientY - this.OffsetTop) + 'px'
|
||||
this.left = e.clientX - (this.ClientX - this.OffsetLeft) + 'px'
|
||||
|
||||
|
||||
|
||||
this.timeout = new Date()
|
||||
}
|
||||
|
||||
}
|
||||
window.mouseup = () => {
|
||||
this.ismove = false
|
||||
}
|
||||
this.$refs.zoomViewCont.ondblclick = () => {
|
||||
this.top = '0px'
|
||||
this.left = '0px'
|
||||
this.mult = 1
|
||||
}
|
||||
this.$refs.zoomView.ondblclick = () => {
|
||||
this.top = '0px'
|
||||
this.left = '0px'
|
||||
this.mult = 1
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
mouseup() {
|
||||
this.ismove = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
86
h5-enginex-manager/src/components/common/bigElCascader.vue
Executable file
86
h5-enginex-manager/src/components/common/bigElCascader.vue
Executable file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<el-cascader :value="value" @input="$emit('input',$evnet)" v-el-select-loadmore="loadMore(num)" filterable
|
||||
:size="size" :options="MyOptions" clearable @change="$emit('change',$event)" :key="Mykey" :props="props">
|
||||
</el-cascader>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
Mykey: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
props: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
expandTrigger: 'hover'
|
||||
}
|
||||
}
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
num: 10,
|
||||
MyOptions: [],
|
||||
page: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadMore()
|
||||
},
|
||||
methods: {
|
||||
loadMore(n) {
|
||||
let start = (this.page - 1) * 10
|
||||
this.MyOptions.push(...this.options.splice(start, start + 10))
|
||||
console.log(this.MyOptions)
|
||||
this.page++
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
directives: {
|
||||
|
||||
'el-select-loadmore': (el, binding) => {
|
||||
// 获取element-ui定义好的scroll盒子
|
||||
const SELECTWRAP_DOM = el.querySelector(".el-cascader-menu .el-scrollbar__wrap");
|
||||
console.log(SELECTWRAP_DOM)
|
||||
if (SELECTWRAP_DOM) {
|
||||
SELECTWRAP_DOM.addEventListener("scroll", function() {
|
||||
/**
|
||||
* scrollHeight 获取元素内容高度(只读)
|
||||
* scrollTop 获取或者设置元素的偏移值,
|
||||
* 常用于:计算滚动条的位置, 当一个元素的容器没有产生垂直方向的滚动条, 那它的scrollTop的值默认为0.
|
||||
* clientHeight 读取元素的可见高度(只读)
|
||||
* 如果元素滚动到底, 下面等式返回true, 没有则返回false:
|
||||
* ele.scrollHeight - ele.scrollTop === ele.clientHeight;
|
||||
*/
|
||||
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
|
||||
if (condition) this.loadMore();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
6
h5-enginex-manager/src/components/common/bus.js
Executable file
6
h5-enginex-manager/src/components/common/bus.js
Executable file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
55
h5-enginex-manager/src/components/common/charts.vue
Executable file
55
h5-enginex-manager/src/components/common/charts.vue
Executable file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div :id="sid" :style="{height: height,width:width}">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
export default {
|
||||
props: {
|
||||
sid: {
|
||||
type: String,
|
||||
default: 'echartsId'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
option: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chartDom: null,
|
||||
myChart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.chartDom = document.getElementById(this.sid);
|
||||
this.myChart = echarts.init(this.chartDom);
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
watch: {
|
||||
option: {
|
||||
handler: function() {
|
||||
this.myChart.clear()
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
// 开启深度监听:只要obj中的任何一个属性发生改变,都会触发相应的代码
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
56
h5-enginex-manager/src/components/common/condition.vue
Executable file
56
h5-enginex-manager/src/components/common/condition.vue
Executable file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
+
|
||||
</div>
|
||||
<div>
|
||||
X
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="value" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in inp1"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
<div>
|
||||
<input type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
porps:{
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
value:1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
349
h5-enginex-manager/src/components/common/cont.vue
Executable file
349
h5-enginex-manager/src/components/common/cont.vue
Executable file
@@ -0,0 +1,349 @@
|
||||
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<div class="cont_new_file">
|
||||
<div v-if="!newf" @click="newFile"><i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>新建文件夹</div>
|
||||
<div v-else style="padding: 5px;box-sizing:border-box;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>
|
||||
<el-input v-model="tempNewF" placeholder="请输入新文件夹名字,最长20个字符" size="small"></el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 60px;margin-top: 10px;" type="danger" icon="el-icon-close" circle size="mini"
|
||||
@click="newf=false;tempNewF=''"></el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle size="mini" @click="newFileSure"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_list">
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'" filterable @change="mixinMoveChange"> -->
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="moveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
<!-- 断点 准备移动 -->
|
||||
</div>
|
||||
<div v-if="getData.type==1">
|
||||
<el-button @click="upShow=true">批量导入</el-button>
|
||||
<el-button @click="down">模板下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]=="1"?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='type'">
|
||||
{{scope.row[item.row]=="1"?'数值型':(scope.row[item.row]=="2"?'字符型':(scope.row[item.row]=="3"?'枚举型':(scope.row[item.row]=="4"?'小数型':(scope.row[item.row]=="5"?'数组型':(scope.row[item.row]=="6"?'JSON型':'')))))}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pager.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<template v-else>
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist();currPage=1"
|
||||
:updata="getData.updatafield" :id='tempRedactId' :fieldTypeId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
|
||||
:ftype="getData.type"></dataManageRedact>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
|
||||
v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from '@/components/common/dataManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
import {
|
||||
updateFieldFolder
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
updateFieldFolder
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
Uploadloading: false,
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
tempHintTop: null,
|
||||
tempHintLeft: null,
|
||||
tempId: null,
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
type: this.getData.type
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
moveChange(e) { //移动文件夹
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
ids: arr,
|
||||
folderId: e
|
||||
}
|
||||
updateFieldFolder(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.clickCurrid(this.currid)
|
||||
this.$message({
|
||||
message: '移动成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
this.tempMove = ""
|
||||
},
|
||||
|
||||
down() {
|
||||
window.open(window.origin + '/Riskmanage/v2/datamanage/field/downTemplate')
|
||||
},
|
||||
delectFun(id) {
|
||||
let name
|
||||
this.deepGetCurr(id, this.list, (value) => {
|
||||
name = value.name
|
||||
})
|
||||
let params = {
|
||||
status: -1,
|
||||
id: id,
|
||||
fieldType: name
|
||||
}
|
||||
this.getData.updatalist(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
|
||||
this.deepGetCurr(id, this.list, (value, item, index) => {
|
||||
item.splice(index, 1)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
this.leftloading = false
|
||||
this.currid = 99999999
|
||||
this.getlist()
|
||||
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
updatafilelist(params) {
|
||||
this.leftloading = true
|
||||
let tempNum = null
|
||||
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
tempNum = value.parentId
|
||||
})
|
||||
params.parentId = tempNum == 99999999 ? 0 : tempNum
|
||||
tempNum = null
|
||||
let obj = {
|
||||
fieldType: params.name,
|
||||
id: params.id,
|
||||
parentId: params.parentId
|
||||
}
|
||||
this.getData.updatalist(obj).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
value.name = params.name
|
||||
value.Rename = false
|
||||
})
|
||||
this.leftloading = false
|
||||
} else {
|
||||
this.leftloading = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": e
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
using(id) {
|
||||
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
status: id,
|
||||
ids: arr.join(','),
|
||||
fieldTypeId: this.currid
|
||||
}
|
||||
|
||||
this.getData.fieldusing(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.getlist()
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
})
|
||||
},
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: this.currid,
|
||||
fieldType: this.tempNewF,
|
||||
type: this.getData.type
|
||||
}
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
851
h5-enginex-manager/src/components/common/dataManageRedact.vue
Executable file
851
h5-enginex-manager/src/components/common/dataManageRedact.vue
Executable file
@@ -0,0 +1,851 @@
|
||||
<style>
|
||||
.dataManageRedact {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* .MR_header {
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_header>div:nth-of-type(1) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 12%;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.MR_input {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 0 0 20px 0;
|
||||
}
|
||||
|
||||
.MR_input>div {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
margin-left: 2%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.MR_input>div>p {
|
||||
width: 30%;
|
||||
} */
|
||||
|
||||
.MR_checkbox {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.MR_scope>div>p {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.MR_derive {
|
||||
|
||||
margin: 0 40px 0 40px;
|
||||
|
||||
}
|
||||
|
||||
.MR_rule_home {
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.MR_rule_home::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.MR_toolbar {
|
||||
background-color: #F0F0F0;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
.MR_toolbar>p:hover {
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="$emit('close')"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增字段 :</span>
|
||||
<span v-else>编辑字段 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit"></el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>字段名称: </p>
|
||||
<el-input placeholder="请输入字段名" maxlength="30" v-model="fieldEn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>字段中文名: </p>
|
||||
<el-input placeholder="请输入字段中文名" maxlength="20" v-model="fieldCn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>值类型 : </p>
|
||||
<el-select v-model="valueType" placeholder="请选择">
|
||||
<el-option label="数值型" :value="1" />
|
||||
<el-option label="字符型" :value="2" />
|
||||
<!-- <el-option label="枚举型" :value="3" /> -->
|
||||
<!-- <el-option label="小数型" :value="4" /> -->
|
||||
<!-- <el-option label="数组型" :value="5" /> -->
|
||||
<el-option label="JSON型" :value="6" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="flex: 1;overflow: auto;">
|
||||
|
||||
<div v-show="isDerivative=='Derivative'" class="MR_derive">
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="条件区域" name="first">
|
||||
<div class="MR_rule_home">
|
||||
<rule :Data="ruledata" @faadd="faadd" @fadelect="fadelect" @sonadd="sonadd"
|
||||
@sondelect="sondelect" @change="change"></rule>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="公式编辑" name="second">
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="groovy脚本" name="third">
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-show="activeName!=='first'">
|
||||
<teV2 v-model="formula" :hint="activeName=='second'">
|
||||
|
||||
</teV2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="Sourcelist">
|
||||
<div v-show="isDerivative=='SQL'" class="MR_derive">
|
||||
|
||||
<el-select v-model="SQLType" placeholder="请选择数据源类型" style="margin-top: 20px;width: 200px;"
|
||||
@change="SQLName = ''">
|
||||
<el-option v-for="item in SourcelistType" :key="item.type" :label="item.type"
|
||||
:value="item.type">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select v-model="SQLName" placeholder="请选择数据源" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in Sourcelist" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<br />
|
||||
<p
|
||||
style="margin-top: 20px;border-top: 1px dotted #ddd;padding-top: 10px;display: flex;align-items: center;">
|
||||
变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;"
|
||||
@click="addsqlVariable"></i></p>
|
||||
|
||||
<div v-for="(value,index) in sqlVariable"
|
||||
style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-input v-model="value.value" style="width: 200px;" placeholder="默认值"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectsqlVariable(index)"></i>
|
||||
</div>
|
||||
|
||||
|
||||
<p
|
||||
style="margin-top: 20px;border-top: 1px dotted #ddd;padding-top: 10px;display: flex;align-items: center;">
|
||||
字典变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;"
|
||||
@click="addDictVariable"></i></p>
|
||||
|
||||
<div v-for="(value,index) in dictVariable"
|
||||
style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-select v-model="value.type" placeholder="请选择类型">
|
||||
<el-option v-for="item in dictVariableType" :key="item.value" :label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input v-model="value.value" style="width: 200px;margin-left: 20px;" placeholder="格式"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectDictVariable(index)"></i>
|
||||
</div>
|
||||
|
||||
<el-input type="textarea" v-model="SQLItem" rows="9" style="margin-top: 20px;"
|
||||
placeholder="请输入SQL语句">
|
||||
</el-input>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ftype==4">
|
||||
<el-select v-model="interfaceId" placeholder="请选择接口" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in interfaceList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-cascader style="margin-left: 20px;" v-model="interfaceParseField" :key="keynum" :options="dataJson"
|
||||
:props="{ checkStrictly: true }" clearable></el-cascader>
|
||||
</div>
|
||||
<div v-show="valueType==6" class="MR_derive">
|
||||
<p style="margin-top: 20px;">JSON:</p>
|
||||
<el-input type="textarea" v-model="jsonValue" :rows="9" style="margin-top: 20px;"
|
||||
placeholder="请输入格式JSON">
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import fieldUserTable from './fieldUserTable.vue'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import {
|
||||
getInterfaceList
|
||||
} from '@/api/index.js'
|
||||
import rule from './rule.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
getInterfaceList,
|
||||
// fieldUserTable,
|
||||
rule,
|
||||
teV2
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
setsave: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getInfo: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
updata: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
ftype: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
sqlVariable: [],
|
||||
interfaceParseField: [],
|
||||
keynum: 1,
|
||||
interfaceId: '',
|
||||
jsonValue: '',
|
||||
loading: false,
|
||||
SQLItem: '',
|
||||
SQLName: '',
|
||||
tempFormula: '',
|
||||
formula: '',
|
||||
fieldEn: '',
|
||||
fieldCn: '',
|
||||
valueType: '',
|
||||
SQLType: '',
|
||||
isDerivative: "",
|
||||
isOutput: false,
|
||||
activeName: 'first',
|
||||
isrecord: false, //开始记录
|
||||
text: '', //剪出的字符串
|
||||
tempIndex: null, //暂存index
|
||||
lest: "", //暂存末尾
|
||||
isshow: false,
|
||||
islest: true,
|
||||
interfaceList: [],
|
||||
ruledata: [{
|
||||
"fieldSubCond": [{
|
||||
"fieldId": '',
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
}],
|
||||
"conditionValue": "",
|
||||
"fieldValue": ""
|
||||
}],
|
||||
dictVariable: [],
|
||||
dictVariableType: [{
|
||||
label: '时间',
|
||||
value: 'date'
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.ftype == 4) {
|
||||
getInterfaceList({
|
||||
pageNo: 0,
|
||||
pageSize: 0,
|
||||
interfaceInfo: {}
|
||||
}).then(res => {
|
||||
this.interfaceList = res.data.klist
|
||||
|
||||
})
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.isDerivative = 'SQL'
|
||||
console.log(1)
|
||||
} else if (this.ftype == 3) {
|
||||
this.isDerivative = 'Derivative'
|
||||
}
|
||||
this.$store.dispatch('getfielduser')
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getInfo(this.id, {}).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.jsonValue = JSON.stringify(JSON.parse(res.data.fieldVo.jsonValue), null, 4)
|
||||
|
||||
this.fieldCn = res.data.fieldVo.fieldCn
|
||||
this.fieldEn = res.data.fieldVo.fieldEn
|
||||
this.valueType = res.data.fieldVo.valueType
|
||||
this.interfaceId = res.data.fieldVo.interfaceId
|
||||
this.interfaceParseField = res.data.fieldVo.interfaceParseField ? res.data.fieldVo
|
||||
.interfaceParseField.split('.') : ''
|
||||
this.fid = res.data.fieldVo.fieldTypeId
|
||||
this.isOutput = res.data.fieldVo.isOutput == 1 ? true : false
|
||||
|
||||
if (res.data.fieldVo.isDerivative) {
|
||||
this.isDerivative = 'Derivative'
|
||||
} else if (res.data.fieldVo.useSql) {
|
||||
this.isDerivative = 'SQL'
|
||||
this.SQLType = this.$store.state.Sourcelist.find(x => x.id == res.data.fieldVo
|
||||
.dataSourceId).type
|
||||
|
||||
this.SQLName = res.data.fieldVo.dataSourceId
|
||||
this.SQLItem = res.data.fieldVo.sqlStatement
|
||||
}
|
||||
if (res.data.hasFormula == "y" || res.data.hasGroovy == "y") {
|
||||
this.formula = JSON.parse(res.data.fieldVo.formula)[0].formula
|
||||
if (res.data.hasFormula == "y") {
|
||||
this.activeName = "second"
|
||||
}
|
||||
if (res.data.hasGroovy == "y") {
|
||||
this.activeName = "third"
|
||||
}
|
||||
} else if (res.data.fieldVo.fieldCondList.length > 0) {
|
||||
|
||||
this.ruledata = res.data.fieldVo.fieldCondList
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (res.data.fieldVo.sqlVariable == null) {
|
||||
this.sqlVariable = []
|
||||
} else {
|
||||
this.sqlVariable = JSON.parse(res.data.fieldVo.sqlVariable)
|
||||
}
|
||||
if (res.data.fieldVo.dictVariable == null) {
|
||||
this.dictVariable = []
|
||||
} else {
|
||||
this.dictVariable = JSON.parse(res.data.fieldVo.dictVariable)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// console.log(res.data.fieldVo.fieldCondList)
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
dataJson() {
|
||||
if (this.ftype != 4) {
|
||||
return {}
|
||||
}
|
||||
let obj = {}
|
||||
this.interfaceList.forEach(value => {
|
||||
if (value.id == this.interfaceId) {
|
||||
obj = JSON.parse(value.responseBody)
|
||||
}
|
||||
})
|
||||
|
||||
obj = this.deepGetLayout(obj)
|
||||
console.log(obj)
|
||||
return obj
|
||||
},
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
},
|
||||
SourcelistType() {
|
||||
let arr = []
|
||||
if (this.$store.state.Sourcelist) {
|
||||
this.$store.state.Sourcelist.forEach(value => {
|
||||
let sarr = arr.find(x => x.type == value.type)
|
||||
if (sarr) {
|
||||
sarr.data.push(value)
|
||||
} else {
|
||||
arr.push({
|
||||
type: value.type,
|
||||
data: [value]
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
console.log(arr)
|
||||
return arr
|
||||
},
|
||||
Sourcelist() {
|
||||
let arr = this.SourcelistType.find(x => x.type == this.SQLType)
|
||||
if (arr) {
|
||||
return arr.data
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
// if (e.key === 'Backspace') {
|
||||
// this.text = ""
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
addDictVariable() {
|
||||
this.dictVariable.push({
|
||||
key: '',
|
||||
type: '',
|
||||
value: ''
|
||||
})
|
||||
},
|
||||
delectDictVariable(index) {
|
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dictVariable.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
},
|
||||
delectsqlVariable(index) {
|
||||
this.sqlVariable.splice(index, 1)
|
||||
},
|
||||
addsqlVariable() {
|
||||
this.sqlVariable.push({
|
||||
value: '',
|
||||
key: ''
|
||||
})
|
||||
},
|
||||
deepGetLayout(obj) {
|
||||
let sobj = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: this.deepGetLayout(obj[key])
|
||||
})
|
||||
|
||||
} else if (typeof obj[key] == 'object' && Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: [{
|
||||
label: '元素',
|
||||
value: '[]',
|
||||
children: this.deepGetLayout(obj[key][0])
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return sobj
|
||||
},
|
||||
submit() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.fieldEn.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return
|
||||
}
|
||||
if (this.verificationNameCode(this.fieldEn) || this.verificationNameCode(this.fieldCn)) {
|
||||
return
|
||||
}
|
||||
if (this.fieldEn.trim() == '' || this.fieldCn.trim() == '' || this.valueType == '') {
|
||||
this.$message.error('请填入所有字段,并检查空格');
|
||||
return
|
||||
}
|
||||
let is = {
|
||||
is:true,
|
||||
msg:'请填入页面中未填的部分'
|
||||
}
|
||||
if (this.isDerivative == "Derivative" && this.activeName == 'first') {
|
||||
this.ruledata.forEach(value => {
|
||||
if (value.conditionValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
value.fieldSubCond.forEach((item, inde) => {
|
||||
if (item.fieldId == "" || item.operator == "" || item.fieldValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
if (item.logical == "" && inde !== value.fieldSubCond.length - 1) {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.sqlVariable.forEach(value => {
|
||||
if (value.value.trim() === "" || value.key.trim() === "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
this.dictVariable.forEach(value => {
|
||||
if (value.key.trim() === "" || value.type=== ""|| value.value.trim()=== "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
let arr = []
|
||||
arr.push(...this.sqlVariable.map(value=>value.key))
|
||||
arr.push(...this.dictVariable.map(value=>value.key))
|
||||
|
||||
if(arr.length!=Array.from(new Set(arr)).length){
|
||||
is.is=false
|
||||
is.msg = '不允许出现重复的变量'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (this.ftype == 4 && !this.interfaceId) {
|
||||
is.is = false
|
||||
}
|
||||
if (is.is === false) {
|
||||
this.$message.error(is.msg);
|
||||
return
|
||||
}
|
||||
if (this.valueType == 6 && !this.isJSON(this.jsonValue)) {
|
||||
this.$message.error('请检查JSON格式');
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
searchKey: '',
|
||||
fieldEn: this.fieldEn,
|
||||
fieldCn: this.fieldCn,
|
||||
valueType: this.valueType, //字段值类型
|
||||
isDerivative: this.isDerivative == "Derivative" ? 1 : 0, //是否衍生字段
|
||||
isOutput: this.isOutput ? 1 : 0, //是否输出字段
|
||||
// valueScope: this.valueScope, //字段约束范围
|
||||
fieldCondList: '',
|
||||
formulaHidden: '',
|
||||
isUseSql: this.isDerivative == "SQL" ? true : false, //是否使用sql
|
||||
dataSourceId: 0,
|
||||
sqlStatement: '', //sql语句
|
||||
}
|
||||
if (this.valueType == 6) {
|
||||
obj.jsonValue = this.jsonValue
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (this.sqlVariable.length == 0) {
|
||||
obj.sqlVariable = null
|
||||
} else {
|
||||
obj.sqlVariable = JSON.stringify(this.sqlVariable)
|
||||
}
|
||||
obj.dictVariable = JSON.stringify(this.dictVariable)
|
||||
}
|
||||
if (this.ftype == 4) {
|
||||
obj.isInterface = 1
|
||||
obj.interfaceId = this.interfaceId
|
||||
obj.interfaceParseField = this.interfaceParseField.join('.')
|
||||
} else {
|
||||
obj.isInterface = 0
|
||||
}
|
||||
// console.log(this.isDerivative)
|
||||
if (this.isDerivative == "Derivative") {
|
||||
if (this.activeName == "first") {
|
||||
obj.fieldCondList = JSON.stringify(this.ruledata)
|
||||
} else if (this.activeName == "second" || this.activeName == "third") {
|
||||
let tempArr = []
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 0 && num != 0) {
|
||||
this.formula.match(/@.*?@/g).forEach(value => {
|
||||
let tempObj = {
|
||||
fieldCN: value.substring(1, value.length - 1),
|
||||
fieldCond: ''
|
||||
}
|
||||
tempArr.push(tempObj)
|
||||
})
|
||||
}
|
||||
obj.formulaHidden = JSON.stringify([{
|
||||
fvalue: '',
|
||||
formula: this.formula.trim(),
|
||||
idx: '0',
|
||||
farr: tempArr,
|
||||
}])
|
||||
}
|
||||
|
||||
} else if (this.isDerivative == "SQL") {
|
||||
obj.dataSourceId = this.SQLName
|
||||
obj.sqlStatement = this.SQLItem
|
||||
|
||||
}
|
||||
let isT = true;
|
||||
if (this.isDerivative == "SQL") {
|
||||
let sqlCheck = obj.sqlStatement.match(/(create|update|delete|truncate|alert|drop)\s+/im);
|
||||
if (sqlCheck != null) {
|
||||
isT = false;
|
||||
this.$message.error('存在有风险sql关键词:' + sqlCheck[0].toUpperCase());
|
||||
}
|
||||
}
|
||||
if (isT) {
|
||||
if (this.id == 0) {
|
||||
obj.fieldTypeId = this.fieldTypeId == 99999999 ? 0 : this.fieldTypeId,
|
||||
this.loading = true
|
||||
this.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.fieldTypeId = this.fid
|
||||
this.loading = true
|
||||
this.updata(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log('error:' + str + '!!!' + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
change(index, inde) {
|
||||
this.ruledata[index].fieldSubCond[inde].operator = ""
|
||||
this.ruledata[index].fieldSubCond[inde].fieldValue = ""
|
||||
},
|
||||
sondelect(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde, 1)
|
||||
},
|
||||
sonadd(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde + 1, 0, {
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
})
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
this.ruledata.splice(index + 1, 0, {
|
||||
"conditionValue": "",
|
||||
"fieldSubCond": [{
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": "",
|
||||
|
||||
|
||||
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
textareaAdd(text) {
|
||||
if (text === "fx") {
|
||||
this.formula = "def main(_){\n\n}"
|
||||
} else {
|
||||
this.formula += text
|
||||
}
|
||||
},
|
||||
dbclick(e) {
|
||||
let T = ""
|
||||
T = this.formula.split("")
|
||||
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula = T.join("")
|
||||
this.isshow = false
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
interfaceId() {
|
||||
this.keynum++
|
||||
},
|
||||
formula() {
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula) {
|
||||
if (this.formula[i] !== this.tempFormula[i] && this.formula[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
this.islest = false
|
||||
}
|
||||
// console.log('字段:' + this.formula[i] + "暂存字段:" + this.tempFormula[i])
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.tempFormula = this.formula
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
80
h5-enginex-manager/src/components/common/directives.js
Executable file
80
h5-enginex-manager/src/components/common/directives.js
Executable file
@@ -0,0 +1,80 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// v-dialogDrag: 弹窗拖拽属性
|
||||
Vue.directive('dialogDrag', {
|
||||
bind(el, binding, vnode, oldVnode) {
|
||||
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
|
||||
dialogHeaderEl.style.cssText += ';cursor:move;'
|
||||
dragDom.style.cssText += ';top:0px;'
|
||||
|
||||
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
|
||||
const sty = (() => {
|
||||
if (window.document.currentStyle) {
|
||||
return (dom, attr) => dom.currentStyle[attr];
|
||||
} else {
|
||||
return (dom, attr) => getComputedStyle(dom, false)[attr];
|
||||
}
|
||||
})()
|
||||
|
||||
dialogHeaderEl.onmousedown = (e) => {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离
|
||||
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
||||
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
||||
|
||||
const screenWidth = document.body.clientWidth; // body当前宽度
|
||||
const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
|
||||
|
||||
const dragDomWidth = dragDom.offsetWidth; // 对话框宽度
|
||||
const dragDomheight = dragDom.offsetHeight; // 对话框高度
|
||||
|
||||
const minDragDomLeft = dragDom.offsetLeft;
|
||||
const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
|
||||
|
||||
const minDragDomTop = dragDom.offsetTop;
|
||||
const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
|
||||
|
||||
|
||||
// 获取到的值带px 正则匹配替换
|
||||
let styL = sty(dragDom, 'left');
|
||||
let styT = sty(dragDom, 'top');
|
||||
|
||||
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
|
||||
if (styL.includes('%')) {
|
||||
styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
|
||||
styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
|
||||
} else {
|
||||
styL = +styL.replace(/\px/g, '');
|
||||
styT = +styT.replace(/\px/g, '');
|
||||
};
|
||||
|
||||
document.onmousemove = function (e) {
|
||||
// 通过事件委托,计算移动的距离
|
||||
let left = e.clientX - disX;
|
||||
let top = e.clientY - disY;
|
||||
|
||||
// 边界处理
|
||||
if (-(left) > minDragDomLeft) {
|
||||
left = -(minDragDomLeft);
|
||||
} else if (left > maxDragDomLeft) {
|
||||
left = maxDragDomLeft;
|
||||
}
|
||||
|
||||
if (-(top) > minDragDomTop) {
|
||||
top = -(minDragDomTop);
|
||||
} else if (top > maxDragDomTop) {
|
||||
top = maxDragDomTop;
|
||||
}
|
||||
|
||||
// 移动当前元素
|
||||
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
|
||||
};
|
||||
|
||||
document.onmouseup = function (e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
235
h5-enginex-manager/src/components/common/endRule.vue
Executable file
235
h5-enginex-manager/src/components/common/endRule.vue
Executable file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
|
||||
<div class="stop-condition">
|
||||
|
||||
<!-- 标题 -->
|
||||
<div style="background-color: #aaa; height: 30px;line-height: 30px; color: #fff;padding: 10px; box-sizing: border-box; margin: 10px 0;display: flex;align-items: center;justify-content: space-between;">
|
||||
<p>终止条件</p>
|
||||
</div>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<el-button type="primary" round size="mini" @click="selRule(true)" style="margin-top: 10px;">
|
||||
选择({{data.selectedRule.length}})</el-button>
|
||||
|
||||
|
||||
|
||||
<div v-if="data.selectedRule.length>0">
|
||||
<div v-for="(condition,index) in data.conditions" :key="index" class="conditions-wrapper"
|
||||
style="display: flex;">
|
||||
<el-select v-model="condition.fieldCode" placeholder="条数/分数" size="mini" style="width: 110px;">
|
||||
<slot>
|
||||
|
||||
</slot>
|
||||
</el-select>
|
||||
<ruleRelation v-model="condition.operator" :value2.sync="condition.value" :valueType="valueType" size="mini"
|
||||
style="width:200px;"></ruleRelation>
|
||||
|
||||
<el-select v-model="condition.relativeOperator" placeholder="请选择" style="width: 70px;margin-left: 10px;"
|
||||
size="mini" v-if="index!=data.conditions.length-1">
|
||||
<el-option label="and" value="&&"></el-option>
|
||||
<el-option label="or" value="||"></el-option>
|
||||
</el-select>
|
||||
<i class="el-icon-plus" style="font-size: 20px;color: #409EFF;" @click="addCondition(index)"></i>
|
||||
<i class="el-icon-close" style="font-size: 20px;color: #F56C6C;" v-show="index!=0"
|
||||
@click="delCondtion(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="data.selectedRule.length>0">
|
||||
<div
|
||||
style="background-color: #aaa; height: 30px;line-height: 30px; color: #fff;padding: 10px; box-sizing: border-box; margin: 10px 0;display: flex;align-items: center;justify-content: space-between;">
|
||||
<p>终止结果</p>
|
||||
</div>
|
||||
<div class="setting-wrapper">
|
||||
<el-select v-model="data.output.fieldId" filterable placeholder="输出变量" @change="data.output.fieldCode = mixinGetvalueEn($event)" size="mini" style="width:130px;">
|
||||
<el-option v-for="(item,index) in Fielduser" :key="index" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="line">=</div>
|
||||
<varialeSelect v-model="data.output.fieldValue" :valueType="mixinGetvalueType(data.output.fieldId)" :variableType.sync="data.output.variableType" height="28px"></varialeSelect>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="选择条件(多选)" :visible="showRuleDialog" width="40%" :append-to-body="true" @close="cancelSelRule">
|
||||
<div>
|
||||
<el-checkbox-group v-model="currentSelectRule">
|
||||
<el-table ref="ruleArr" :data="pageRuleList" size="mini">
|
||||
|
||||
<el-table-column width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox :label="scope.row.id"> </el-checkbox>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="id" >
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :prop="name" label="名称">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :prop="code" label="code">
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<el-pagination small layout="prev, pager, next" :total="list.length" :page-size="10"
|
||||
@current-change="page=$event" style="margin-left: 70%;margin-top: 10px;">
|
||||
</el-pagination>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelSelRule">取 消</el-button>
|
||||
<el-button type="primary" @click="selRuleSure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components:{ruleRelation,varialeSelect},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}, //nodeJson.terminationInfo
|
||||
list:{
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
onlyOne:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
valueType:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
name:{
|
||||
type: String,
|
||||
default: 'name'
|
||||
},
|
||||
code:{
|
||||
type: String,
|
||||
default: 'code'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRuleDialog: false,
|
||||
page: 1,
|
||||
currentSelectRule:[]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
Fielduser() {
|
||||
if (this.$store.state.FieldUser != null) {
|
||||
this.loading = false
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
pageRuleList(){
|
||||
return this.list.filter((value,index)=>{
|
||||
return index>=(this.page-1)*10&&index<this.page*10
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addCondition(index) {
|
||||
this.data.conditions.splice(index + 1, 0, {
|
||||
"fieldCode": "",
|
||||
"fieldName": "",
|
||||
"valueType": this.valueType,
|
||||
"operator": "",
|
||||
"value": "",
|
||||
"relativeOperator": ""
|
||||
})
|
||||
},
|
||||
selRuleSure(){ //确定选择
|
||||
this.data.selectedRule = this.list.filter(value=>{
|
||||
return this.currentSelectRule.indexOf(value.id)!=-1
|
||||
})
|
||||
if(this.data.selectedRule.length==0){
|
||||
this.$emit('reSetTerminationInfo')
|
||||
}
|
||||
this.showRuleDialog = false
|
||||
|
||||
},
|
||||
cancelSelRule(){ //取消选择规则
|
||||
this.showRuleDialog = false
|
||||
},
|
||||
selRule(isShow) {
|
||||
if(this.onlyOne){
|
||||
console.log(this.data.selectedRule,this.pageRuleList)
|
||||
if(!this.pageRuleList[0]){
|
||||
this.$message.warning('请先选择上方节点')
|
||||
return
|
||||
}
|
||||
if(!this.data.selectedRule.length){
|
||||
this.data.selectedRule = this.pageRuleList
|
||||
this.$message.success('已为选中上方节点')
|
||||
return
|
||||
}else{
|
||||
this.$emit('reSetTerminationInfo')
|
||||
this.$message.success('已为你取消选中上方节点')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(this.currentSelectRule )
|
||||
|
||||
if (this.list.length > 0 && isShow) {
|
||||
this.showRuleDialog = true;
|
||||
this.currentSelectRule = this.data.selectedRule.map(value=>value.id)
|
||||
} else if (isShow) {
|
||||
this.$message.error('请先选择策略!');
|
||||
}
|
||||
|
||||
},
|
||||
delCondtion(index){
|
||||
this.data.conditions.splice(index, 1);
|
||||
},
|
||||
},
|
||||
watch:{
|
||||
list(newValue){
|
||||
|
||||
if(this.data.selectedRule&&this.data.selectedRule.length>0){
|
||||
let num = -1
|
||||
this.data.selectedRule.forEach((value,index)=>{
|
||||
let is = true
|
||||
newValue.forEach(item=>{
|
||||
if(item.id==value.id){
|
||||
console.log(item.id,value.id)
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if(is){
|
||||
num = index
|
||||
}
|
||||
})
|
||||
|
||||
if(num!=-1){
|
||||
|
||||
this.data.selectedRule.splice(num,1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
208
h5-enginex-manager/src/components/common/fieldUserTable.vue
Executable file
208
h5-enginex-manager/src/components/common/fieldUserTable.vue
Executable file
@@ -0,0 +1,208 @@
|
||||
<style>
|
||||
.fieldUserTable {
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
overflow: hidden;
|
||||
z-index: 9;
|
||||
border: 6px solid #9bcdff;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.FUT_header {
|
||||
background-color: #3584d3;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
.FUT_table::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
.FUT_table{
|
||||
height: 93%;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
margin-top: 30px;
|
||||
|
||||
}
|
||||
.FUT_table>p {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.FUT_table>p:hover {
|
||||
color: #fff;
|
||||
background-color: #9bcdff;
|
||||
}
|
||||
#fieldUserTabletempcurr{
|
||||
background-color: #d9ebff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-show="show" class="fieldUserTable" @mousedown="mousedowm" ref="UserTable" :style="{top:this.tempTop+'px',left:this.tempLeft+'px'}">
|
||||
<div class="FUT_header" >
|
||||
<p>字段列表</p>
|
||||
<p><i class="el-icon-close" @click="$emit('close')"></i></p>
|
||||
</div>
|
||||
<div class="FUT_table" v-show="fieldUserRemind.length>0" id="FUT_table">
|
||||
<p v-for="(item,index) in fieldUserRemind" @dblclick="dbc(item.fieldCn)" :id="index==tempCurIndex?'fieldUserTabletempcurr':''">{{item.fieldCn?item.fieldCn:item.fieldEn}}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
fieldUser: {
|
||||
type: Array||Boolean,
|
||||
default: false
|
||||
},
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempCurIndex:0,
|
||||
tempTop:300,
|
||||
tempLeft:800,
|
||||
drag:false,
|
||||
tempClientX:0,
|
||||
tempClientY:0,
|
||||
tempOffsetLeft:0,
|
||||
tempOffsetTop:0,
|
||||
temptext:"",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
beforeUnmount() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
window.onmousemove=(e)=>{
|
||||
if(this.drag){
|
||||
this.tempTop=e.clientY-(this.tempClientY-this.tempOffsetTop)
|
||||
this.tempLeft=e.clientX-(this.tempClientX-this.tempOffsetLeft)
|
||||
}
|
||||
},
|
||||
window.onmouseup=()=>{
|
||||
this.drag=false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
fieldUserRemind() {
|
||||
if (this.show === true) {
|
||||
let arr = []
|
||||
|
||||
this.fieldUser.forEach(value => {
|
||||
|
||||
if (value.fieldCn.indexOf(this.text) !== -1) {
|
||||
arr.push({ ...value
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(){
|
||||
// console.log(this.show)
|
||||
if(this.show){
|
||||
window.onkeydown=(e)=>{
|
||||
if(e.key=='ArrowUp'||e.key=='ArrowDown'){
|
||||
e.preventDefault()
|
||||
var tempcurrDom = document.getElementById('fieldUserTabletempcurr')
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
if(e.key=='ArrowUp'&&this.tempCurIndex>0){
|
||||
this.tempCurIndex--
|
||||
}
|
||||
if(e.key=='ArrowDown'&&this.tempCurIndex<this.fieldUserRemind.length-1){
|
||||
this.tempCurIndex++
|
||||
}
|
||||
FUTTable.scrollTop = tempcurrDom.offsetTop-180
|
||||
}
|
||||
if(e.key=='Enter'){
|
||||
e.preventDefault()
|
||||
this.dbc(this.fieldUserRemind[this.tempCurIndex].fieldCn)
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
window.onkeydown=()=>{
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
text(){
|
||||
this.tempCurIndex = 0
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
FUTTable.scrollTop =0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
mousedowm(e){
|
||||
this.tempClientX = e.clientX;
|
||||
this.tempClientY = e.clientY;
|
||||
this.tempOffsetLeft=this.$refs.UserTable.offsetLeft
|
||||
this.tempOffsetTop=this.$refs.UserTable.offsetTop
|
||||
|
||||
|
||||
|
||||
this.drag=true
|
||||
|
||||
},
|
||||
dbc(e){
|
||||
this.$emit('dbc',e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
139
h5-enginex-manager/src/components/common/file.vue
Executable file
139
h5-enginex-manager/src/components/common/file.vue
Executable file
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
|
||||
<div :style="{display:show?'block':'none',position:'relative'}">
|
||||
<div @click="opening()" :style="{marginLeft:(5+retract*10)+'px',display:show?'flex':'none'}" class="file_file" @contextmenu.prevent="opening();$emit('fileRight',{e:$event,item:item})">
|
||||
<p style="width: 16px;">
|
||||
<i :class="open?'el-icon-arrow-down':'el-icon-arrow-right'" :style="{display:iconshow?'inline':'none'}"></i>
|
||||
</p>
|
||||
<i :class="iconshow?open?'el-icon-folder-opened file_icon':'el-icon-folder file_icon':'el-icon-folder file_icon'"></i>
|
||||
<span class="file_name" v-show="Rename">
|
||||
<el-input v-model="inputValue" placeholder="回车键确认,esc取消" size="mini" ref="input" @keyup.enter="submit"></el-input>
|
||||
</span>
|
||||
<span class="file_name" v-show="!Rename">{{name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from '@/components/common/bus.js'
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
Rename: '',
|
||||
retract: '',
|
||||
open: '',
|
||||
show: '',
|
||||
|
||||
id: '',
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.$refs.input.onkeydown = (e) => {
|
||||
this.keyDown(e)
|
||||
}
|
||||
this.setItem(this.item)
|
||||
},
|
||||
methods: {
|
||||
setItem(e){
|
||||
this.name =e.name
|
||||
this.Rename=e.Rename
|
||||
this.retract=e.ZIndex
|
||||
this.open=e.open
|
||||
this.show=e.show
|
||||
this.id=e.id
|
||||
},
|
||||
keyDown(e) {
|
||||
// console.log(e)
|
||||
if (e.key === "Enter") {
|
||||
if (this.inputValue.length > 20) {
|
||||
this.$message({
|
||||
message: '最大长度20个字符',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
name: this.inputValue.trim(),
|
||||
id: this.id
|
||||
}
|
||||
this.$emit("updatafilelist", params)
|
||||
|
||||
|
||||
}
|
||||
} else if (e.key === "Escape") {
|
||||
this.inputValue = ""
|
||||
this.$emit('RenameClose', this.id)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
opening() {
|
||||
if (!this.Rename) {
|
||||
this.$emit('curr', this.id)
|
||||
}
|
||||
|
||||
},
|
||||
submit(e) {
|
||||
console.log(1)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
Rename() {
|
||||
if (this.Rename === true) {
|
||||
setTimeout(() => {
|
||||
this.$refs.input.focus()
|
||||
}, 10)
|
||||
}
|
||||
},
|
||||
item: {
|
||||
deep: true, //深度监听设置为 true
|
||||
handler: function(e) {
|
||||
this.setItem(e)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
iconshow(){
|
||||
return !!this.item.children.length
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.file_file {
|
||||
transition: all .3s;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.file_icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.file_name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
147
h5-enginex-manager/src/components/common/fileHome.vue
Executable file
147
h5-enginex-manager/src/components/common/fileHome.vue
Executable file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="item in data">
|
||||
<file :class="item.id===currid?'file_select':''" @curr="curr" :item="item"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="value in item.children">
|
||||
|
||||
<file :class="value.id===currid?'file_select':''" @curr="curr" :item="value"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont in value.children">
|
||||
|
||||
<file :class="cont.id===currid?'file_select':''" @curr="curr" :item="cont"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont1 in cont.children">
|
||||
|
||||
<file :class="cont1.id===currid?'file_select':''" @curr="curr" :item="cont1"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont2 in cont1.children">
|
||||
|
||||
<file :class="cont2.id===currid?'file_select':''" @curr="curr" :item="cont2"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont3 in cont2.children">
|
||||
|
||||
<file :class="cont3.id===currid?'file_select':''" @curr="curr" :item="cont3"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="fileHint" :style="{top:tempHintTop+'px',left:tempHintLeft+'px',display:tempHintTop&&tempHintLeft?'block':'none'}">
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="RenameFun">重命名</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="delectFun">删除</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="tempHintLeft=null;tempHintTop=null">取消</el-button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import file from './file.vue'
|
||||
export default {
|
||||
components: {
|
||||
file
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
tempHintTop : null,
|
||||
tempHintLeft :null,
|
||||
tempId:null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
currid:{
|
||||
type:Number,
|
||||
default : 99999999
|
||||
}
|
||||
},
|
||||
created() {
|
||||
setTimeout(() => {
|
||||
console.log(this.data)
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
curr(e) {
|
||||
this.tempHintLeft = null
|
||||
this.tempHintTop = null
|
||||
this.tempId = null
|
||||
this.$emit('curr',e)
|
||||
},
|
||||
RenameClose() {
|
||||
this.$emit('RenameClose',this.tempId )
|
||||
},
|
||||
updatafilelist(e) {
|
||||
this.$emit('updatafilelist',e)
|
||||
},
|
||||
fileRight(e){
|
||||
this.tempHintLeft = e.e.x
|
||||
this.tempHintTop = e.e.y
|
||||
this.tempId = e.item.id
|
||||
},
|
||||
RenameFun(){
|
||||
this.$emit('RenameFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
},
|
||||
delectFun(){
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
this.tempHintTop = null
|
||||
this.tempHintLeft = null
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
61
h5-enginex-manager/src/components/common/flowHint.vue
Executable file
61
h5-enginex-manager/src/components/common/flowHint.vue
Executable file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<el-drawer title="操作提示" :visible="open" @update:visible="$emit('update:open',false)">
|
||||
|
||||
<div v-for="value in data" style="padding-left: 10px;">
|
||||
<p style="font-size: 18px;font-weight: bold;">{{value.title}}</p>
|
||||
<div v-for="(item,index) in value.cont" style="padding-left: 10px;margin-top: 3px;">
|
||||
<p :style="{color:item.type=='limit'?'#f56c6c':'#000'}">{{index+1}}.{{item.text}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</el-drawer>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
open: false
|
||||
},
|
||||
data() {
|
||||
return{
|
||||
data:[{
|
||||
title:'节点',
|
||||
cont:[
|
||||
{text:'红色节点以及名单库决策选项统称为策略节点'},
|
||||
{text:'紫色节点统称为分支节点'},
|
||||
{text:'分支节点后可以有多个节点,但策略节点后只能有一个节点'},
|
||||
{text:'拖动节点可以改变位置,双击节点可以编辑节点内容'},
|
||||
|
||||
]
|
||||
},{
|
||||
title:'连线',
|
||||
cont:[
|
||||
{text:'右键点击节点可以呼出连线,再次右击可以连接下一个节点'},
|
||||
{text:'连线不能封闭',type:'limit'},
|
||||
{text:'并行节点后只能有策略节点,需要使用分支节点可以先聚合',type:'limit'},
|
||||
{text:'多出口节点需要先定义出口并提交才能连线',type:'limit'},
|
||||
{text:'多出口节点不能同时编辑和连线',type:'limit'},
|
||||
|
||||
]
|
||||
},{
|
||||
title:'版本',
|
||||
cont:[
|
||||
{text:'新建和复制版本会生成一个小版本,小版本部署成功后会变成主版本'},
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
30
h5-enginex-manager/src/components/common/i18n.js
Executable file
30
h5-enginex-manager/src/components/common/i18n.js
Executable file
@@ -0,0 +1,30 @@
|
||||
export const messages = {
|
||||
'zh': {
|
||||
i18n: {
|
||||
breadcrumb: '国际化产品',
|
||||
tips: '通过切换语言按钮,来改变当前内容的语言。',
|
||||
btn: '切换英文',
|
||||
title1: '常用用法',
|
||||
p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。',
|
||||
p2: '没有什么比信念更能支撑我们度过艰难的时光了。',
|
||||
p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。',
|
||||
title2: '组件插值',
|
||||
info: 'Element组件需要国际化,请参考 {action}。',
|
||||
value: '文档'
|
||||
}
|
||||
},
|
||||
'en': {
|
||||
i18n: {
|
||||
breadcrumb: 'International Products',
|
||||
tips: 'Click on the button to change the current language. ',
|
||||
btn: 'Switch Chinese',
|
||||
title1: 'Common usage',
|
||||
p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.",
|
||||
p2: "Nothing can help us endure dark times better than our faith. ",
|
||||
p3: "If you can do what you do best and be happy, you're further along in life than most people.",
|
||||
title2: 'Component interpolation',
|
||||
info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.',
|
||||
value: 'documentation'
|
||||
}
|
||||
}
|
||||
}
|
||||
114
h5-enginex-manager/src/components/common/listOutput.vue
Executable file
114
h5-enginex-manager/src/components/common/listOutput.vue
Executable file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-for="(value,index) in list" style="width: 800px;display: flex;align-items: center;margin-bottom: 10px;">
|
||||
<el-input v-model="value.outputKey" placeholder="请输入Key" style="width: 160px;margin-right: 10px;">
|
||||
</el-input>
|
||||
:
|
||||
|
||||
<el-select v-model="value.outputOp" clearable placeholder="请选择" style="width: 120px;margin-left: 10px;"
|
||||
@change="Opchange(value)">
|
||||
<el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-cascader v-model="value.outputOpKey" filterable :options="ValueObj" clearable placeholder="请选择计算依赖"
|
||||
v-if="value.outputOp!='custom'&&value.outputOp!='count'" :key="(value.random?value.random:0)" style="margin-left: 10px;"
|
||||
:props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(value,$event)">
|
||||
</el-cascader>
|
||||
|
||||
|
||||
|
||||
<varialeSelect v-if="value.outputOp=='custom'" :variableType.sync="value.variableType" :disabled="[2]"
|
||||
:variableCascaderValue="ValueObj" :variableCascader="true" size="medium" height="36px"
|
||||
v-model="value.outputValue" :interceptCustom="true" @CustomCallback="CustomCallback(value,list,index)"
|
||||
style="margin-left: 10px;">
|
||||
</varialeSelect>
|
||||
|
||||
|
||||
<i class="el-icon-circle-close" style="color: red;margin-left: 10px;" @click="deleteOutput(index)"></i>
|
||||
</div>
|
||||
<el-button @click="addOutput">+</el-button>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
ValueObj: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
option: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
CustomCallback(value,list,index) {
|
||||
|
||||
let arr = JSON.parse(JSON.stringify(list))
|
||||
|
||||
arr = list.filter((value,index2) =>index2<index)
|
||||
arr = arr.map(value => value.outputKey)
|
||||
value.arr = []
|
||||
value.arr = arr
|
||||
this.$emit('CustomCallback', value)
|
||||
},
|
||||
|
||||
Opchange(value) {
|
||||
|
||||
value.variableType = 1
|
||||
value.outputValue = ''
|
||||
value.outputOpKey = []
|
||||
|
||||
|
||||
},
|
||||
deleteOutput(index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.list.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
},
|
||||
addOutput() {
|
||||
this.list.push({
|
||||
outputKey: '',
|
||||
outputOp: '',
|
||||
variableType: 1,
|
||||
outputValue: '',
|
||||
outputOpKey: []
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
15
h5-enginex-manager/src/components/common/miniSCO.vue
Executable file
15
h5-enginex-manager/src/components/common/miniSCO.vue
Executable file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
109
h5-enginex-manager/src/components/common/rule.vue
Executable file
109
h5-enginex-manager/src/components/common/rule.vue
Executable file
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="Data&&FieldUser">
|
||||
<div v-for="(item,index) in Data" class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('faadd',index)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('fadelect',index)" :disabled="index===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-input v-model="item.conditionValue" style="width: 200px;" maxlength="20" placeholder="请输入内容"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<div v-for="(value,inde) in item.fieldSubCond" class="rule_son">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('sonadd',index,inde)" ></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('sondelect',index,inde)" :disabled="inde===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-select v-model="value.fieldId" placeholder="请选择" filterable style="width: 200px;" @change="$emit('change',index,inde)">
|
||||
<el-option v-for="cont in FieldUser.data.fieldList" :key="cont.id" :label="cont.fieldCn" :value="cont.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<ruleRelation v-model="value.operator" :value2.sync="value.fieldValue" :valueType="getvalueType(value.fieldId)" ></ruleRelation> 12312312
|
||||
<!-- <el-input v-model="value.fieldValue" maxlength="30" placeholder="请输入内容,最长30位" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)!==3">
|
||||
</el-input>
|
||||
<el-select v-model="value.fieldValue" placeholder="请选择" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
<el-select v-model="value.logical" placeholder="请选择" style="width: 100px;margin-left: 10px;" v-show="inde!==item.fieldSubCond.length-1">
|
||||
<el-option label="and" value="&&"></el-option>
|
||||
<el-option label="or" value="or"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components:{
|
||||
ruleRelation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.Data)
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
}
|
||||
},
|
||||
props: {
|
||||
Data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getvalueType(cont){
|
||||
let num
|
||||
this.FieldUser.data.fieldList.forEach(value=>{
|
||||
if(value.id===cont){
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
489
h5-enginex-manager/src/components/common/rule/easyRuleManageRedact.vue
Executable file
489
h5-enginex-manager/src/components/common/rule/easyRuleManageRedact.vue
Executable file
@@ -0,0 +1,489 @@
|
||||
<style>
|
||||
|
||||
.easyrule_com{
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
margin: 20px 0px 0px 10px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增规则 :</span>
|
||||
<span v-else>编辑规则 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>规则代码: </p>
|
||||
<el-input placeholder="请输入规则代码" maxlength="30" v-model="code" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 规则名称: </p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>优 先 级 : </p>
|
||||
<el-select v-model="priority" placeholder="请选择">
|
||||
<el-option label="0" :value="0" />
|
||||
<el-option label="1" :value="1" />
|
||||
<el-option label="2" :value="2" />
|
||||
<el-option label="3" :value="3" />
|
||||
<el-option label="4" :value="4" />
|
||||
<el-option label="5" :value="5" />
|
||||
<el-option label="6" :value="6" />
|
||||
<el-option label="7" :value="7" />
|
||||
<el-option label="8" :value="8" />
|
||||
<el-option label="9" :value="9" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>规则描述: </p>
|
||||
<el-input placeholder="请输入规则描述" maxlength="300" v-model="description" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="easyrule_com">
|
||||
|
||||
<RuleDown :type="1" :Data="ruledata" @faadd="faadd" @outAdd="outAdd" @outDelect="outDelect" @fadelect="fadelect"
|
||||
@change="change" :SpecialField="SpecialField" :outcontent="outcontent">
|
||||
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)"></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
|
||||
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</RuleDown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import RuleDown from '@/components/common/rule/ruleRule.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
RuleDown
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
setsave: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
getInfo: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
updata: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
scoreFieldEn: '',
|
||||
resultFieldEn: '',
|
||||
loading: false,
|
||||
|
||||
priority: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
ruledata: null,
|
||||
"outcontent": [],
|
||||
SpecialField: {
|
||||
score: '1',
|
||||
ruleAudit: 5,
|
||||
lastLogical: '-1'
|
||||
},
|
||||
tempisEmpty: false,
|
||||
parentId: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('getfielduser')
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getInfo(this.id).then(res => {
|
||||
this.scoreFieldEn = res.data.scoreFieldEn
|
||||
this.resultFieldEn = res.data.resultFieldEn
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.parentId = res.data.parentId
|
||||
this.ruledata = res.data.ruleFieldList ? res.data.ruleFieldList : [{
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
}],
|
||||
this.outcontent = res.data.tacticsOutputList
|
||||
this.outcontent.forEach(value => {
|
||||
if (!value.variableType) {
|
||||
value.variableType = 1
|
||||
}
|
||||
if (value.variableType == 2) {
|
||||
value.fieldValue = Number(value.fieldValue.split('|')[0])
|
||||
}
|
||||
})
|
||||
this.SpecialField.score = res.data.score
|
||||
this.SpecialField.ruleAudit = res.data.ruleAudit
|
||||
this.SpecialField.lastLogical = res.data.lastLogical
|
||||
|
||||
console.log(res.data.tacticsOutputList)
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
this.ruledata = [{
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
getType(obj) {
|
||||
if (obj.conditionType == 2 && !obj.valueType) {
|
||||
obj.valueType = this.mixinGetvalueType(obj.fieldId)
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.getType(value)
|
||||
})
|
||||
}
|
||||
},
|
||||
outAdd(index) {
|
||||
this.outcontent.splice(index, 0, {
|
||||
"fieldId": "",
|
||||
tacticsType: 'base_rule',
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
outDelect(index) {
|
||||
this.outcontent.splice(index, 1)
|
||||
},
|
||||
submit() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return
|
||||
}
|
||||
if (this.code.trim() === '') {
|
||||
this.$message.error('请填入规则代码,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.priority === '') {
|
||||
this.$message.error('请选择规则优先级');
|
||||
return
|
||||
}
|
||||
if (this.name.trim() === '') {
|
||||
this.$message.error('请填入规则名称,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.description === '') {
|
||||
this.$message.error('请填入规则描述,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.resultFieldEn === "" || this.resultFieldEn == null) {
|
||||
this.$message.error('请选择命中时输出变量');
|
||||
return
|
||||
}
|
||||
if (this.scoreFieldEn == "" || this.scoreFieldEn == null) {
|
||||
this.$message.error('请选择得分时输出变量');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
|
||||
this.$message.error('得分只能是数字');
|
||||
return
|
||||
}
|
||||
let is = {
|
||||
is: true,
|
||||
msg: '',
|
||||
}
|
||||
|
||||
this.ruledata.forEach(value => {
|
||||
if (value.logical === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有连接符未选'
|
||||
}
|
||||
if (value.fieldId === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有条件未选'
|
||||
}
|
||||
if (value.operator === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有运算符未选'
|
||||
}
|
||||
if (String(value.fieldValue).trim() === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否有条件对比值未填'
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if (this.SpecialField.score === "" || this.SpecialField.ruleAudit === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查是否得分未填'
|
||||
}
|
||||
|
||||
|
||||
let str = ""
|
||||
this.ruledata.forEach(value => {
|
||||
str += value.logical
|
||||
})
|
||||
|
||||
str += this.SpecialField.lastLogical
|
||||
console.log(str)
|
||||
if (!this.is_leagl_brackets(str)) {
|
||||
this.$message.error('请检查括号完整性');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
is.is = false
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is.is = false
|
||||
is.msg = '请检查自定义输出部分是否有未填项'
|
||||
}
|
||||
})
|
||||
|
||||
if (is.is === false) {
|
||||
this.$message.error(is.msg);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
if (value.variableType == 2) {
|
||||
|
||||
value.fieldValue = value.fieldValue + '|' + this.mixinGetvalueEn(value.fieldValue)
|
||||
|
||||
}
|
||||
})
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"priority": this.priority,
|
||||
"description": String(this.description).trim(),
|
||||
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn
|
||||
}
|
||||
let arr = this.ruledata.map(value => {
|
||||
value.valueType = this.getvalueType(value.fieldId)
|
||||
console.log(value)
|
||||
return value
|
||||
})
|
||||
obj.difficulty = 1
|
||||
obj.ruleFieldList = arr
|
||||
obj.tacticsOutputList = this.outcontent.length > 0 ? this.outcontent : null
|
||||
obj.lastLogical = this.SpecialField.lastLogical
|
||||
|
||||
if (this.id == 0) {
|
||||
this.loading = true
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
this.loading = true
|
||||
this.updata(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
},
|
||||
change(index) {
|
||||
this.ruledata[index].operator = ""
|
||||
this.ruledata[index].fieldValue = ""
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
this.ruledata.splice(index + 1, 0, {
|
||||
"logical": "",
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": ""
|
||||
})
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
is_leagl_brackets(string) {
|
||||
console.log(1)
|
||||
var array = [];
|
||||
for (var i = 0; i < string.length; i++) {
|
||||
var item = string[i];
|
||||
if (item === "(") {
|
||||
array.push("(");
|
||||
} else if (item === ")") {
|
||||
if (array.length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
array.pop();
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
return array.length === 0;
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
},
|
||||
getvalueEn(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.fieldEn
|
||||
console.log(1)
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
332
h5-enginex-manager/src/components/common/rule/ruleCont.vue
Executable file
332
h5-enginex-manager/src/components/common/rule/ruleCont.vue
Executable file
@@ -0,0 +1,332 @@
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading" v-if="!listRedact">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
<div class="cont_new_file">
|
||||
<div v-if="!newf" @click="newFile"><i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>新建文件夹</div>
|
||||
<div v-else style="padding: 5px;box-sizing:border-box;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>
|
||||
<el-input v-model="tempNewF" placeholder="请输入新文件夹名字,最长20个字符" size="small"></el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 60px;margin-top: 10px;" type="danger" icon="el-icon-close" circle size="mini"
|
||||
@click="newf=false;tempNewF=''"></el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle size="mini" @click="newFileSure"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_list">
|
||||
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="mixinMoveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<el-input placeholder="请输入搜索内容" v-model="search">
|
||||
<i slot="suffix" class="el-input__icon el-icon-search" @click="getsearch"></i>
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="upShow=true" v-if="getData.type==1">批量导入</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]==1?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pageInfo.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="height: 100%;overflow: hidden;">
|
||||
<easyDataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()"
|
||||
:updata="getData.updatafield" :id='tempRedactId' :nameId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
|
||||
:type="getData.type" v-if="getData.type==1">
|
||||
</easyDataManageRedact>
|
||||
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist()" :getData="getData"
|
||||
:id='tempRedactId' :nameId="currid" :type="getData.type" v-if="getData.type==2">
|
||||
</dataManageRedact>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
|
||||
v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload();" :disabled="fileName?false:'disabled'">确定</el-button>
|
||||
</span>
|
||||
|
||||
|
||||
</el-dialog>
|
||||
<el-dialog title="导入结果" :visible.sync="upCallbackShow" width="60%" close-on-click-modal close-on-press-escape
|
||||
show-close>
|
||||
<p style="font-size: 18px;font-weight: bold;">
|
||||
导入成功{{callbackresult.sucRows}}条,失败{{callbackresult.failRows}}条,重复{{callbackresult.repeatRows}}条,已存在{{callbackresult.existRows}}条
|
||||
</p>
|
||||
<div style="">
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">文件夹不存在({{callbackresult.result.folderNotExistList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.folderNotExistList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">系统中已存在的代码({{callbackresult.result.existCodeList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.existCodeList" style="margin-top: 10px;">
|
||||
{{value}}
|
||||
</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">系统中已存在的名称({{callbackresult.result.existNameList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.existNameList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">表格中重复的代码({{callbackresult.result.rpCodeList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.rpCodeList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
<div style="width:98%;border-bottom: 1px dashed #ddd;padding: 1%;">
|
||||
<p style="font-weight: bold;font-size: 16px;">表格中重复的名称({{callbackresult.result.rpNameList.length}})</p>
|
||||
<p v-for="value in callbackresult.result.rpNameList" style="margin-top: 10px;">{{value}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upCallbackShow = false">取消</el-button>
|
||||
</span>
|
||||
|
||||
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import '@/assets/css/cont.css'
|
||||
import dataManageRedact from '@/components/common/rule/ruleManageRedact.vue'
|
||||
import easyDataManageRedact from '@/components/common/rule/easyRuleManageRedact.vue'
|
||||
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
easyDataManageRedact,
|
||||
|
||||
// file,
|
||||
dataManageRedact,
|
||||
fileHome
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
parentId: 0,
|
||||
treeType:this.getData.treeType,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
callbackresult: {
|
||||
sucRows: '',
|
||||
failRows: '',
|
||||
repeatRows: '',
|
||||
existRows: '',
|
||||
result: {
|
||||
existCodeList: [],
|
||||
existNameList: [],
|
||||
folderNotExistList: [],
|
||||
rpCodeList: [],
|
||||
rpNameList: []
|
||||
}
|
||||
},
|
||||
upCallbackShow: false,
|
||||
Uploadloading: false,
|
||||
tempMove: '',
|
||||
leftloading: false, //暂时关闭loading
|
||||
search: "",
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getsearch() {
|
||||
this.contloading = true
|
||||
let params = {
|
||||
|
||||
key: "ruleName",
|
||||
status: "0,1",
|
||||
"parentIds": String(this.currid) === "99999999" ? '' : String(this.currid),
|
||||
"pageNum": 1,
|
||||
isSearch: 1,
|
||||
ruleInfo: {
|
||||
|
||||
name: this.search,
|
||||
}
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
this.currPage = 1
|
||||
},
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
status: "0,1",
|
||||
ruleInfo: {},
|
||||
"pageNum": 1
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.ruleInfo.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
status: "0,1",
|
||||
ruleInfo: {},
|
||||
"pageNum": e
|
||||
}
|
||||
if (String(this.currid) !== "99999999") {
|
||||
params.ruleInfo.parentId = this.currid
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
},
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: String(this.currid),
|
||||
name: this.tempNewF,
|
||||
"treeType": this.getData.treeType,
|
||||
"type": "1",
|
||||
"engineId": ""
|
||||
}
|
||||
// if (this.getData.type == 2) {
|
||||
// params.treeType = '5'
|
||||
// }
|
||||
this.mixnewFileSure(params)
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
824
h5-enginex-manager/src/components/common/rule/ruleManageRedact.vue
Executable file
824
h5-enginex-manager/src/components/common/rule/ruleManageRedact.vue
Executable file
@@ -0,0 +1,824 @@
|
||||
<style>
|
||||
.rule_com {
|
||||
/* height: 51vh; */
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
/* overflow-x: hidden; */
|
||||
margin: 0px 0px 0px 10px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.rule_com::-webkit-scrollbar {
|
||||
/* display: none; */
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.Rule_version_buttom {
|
||||
/* width: 100px; */
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.rule_outcontent_box {
|
||||
border: 1px dotted #00000022;
|
||||
|
||||
margin-top: 20px;
|
||||
padding:10px 0 10px 10px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="mixinClose"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增规则 :</span>
|
||||
<span v-else>编辑规则 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit" :disabled="addVersionStatus">
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>规则代码: </p>
|
||||
<el-input placeholder="请输入规则代码" maxlength="30" v-model="code" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p> 规则名称: </p>
|
||||
<el-input placeholder="请输入规则名称" maxlength="20" v-model="name" clearable :disabled="addVersionStatus">
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_scope MR_scopeSmall':'MR_scope'">
|
||||
<div>
|
||||
<p>规则描述: </p>
|
||||
<el-input placeholder="请输入规则描述" maxlength="300" v-model="description" clearable
|
||||
:disabled="addVersionStatus"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<version style="margin:5px;" :id="id" :ruleVersionList="ruleVersionList" :version="version"
|
||||
:addVersionStatus="addVersionStatus" :addVersionDialog="addVersionDialog"
|
||||
:addVersionLoading="addVersionLoading" @addVersion="addVersion" @addVersionClose="addVersionClose"
|
||||
@copyVersion="copyVersion" @delectVersion="delectVersion" @updateVersion="updateVersion"
|
||||
@addVersionSure="addVersionSure" @Dialog="addVersionDialog=$event" @addVersionExamine="addVersionExamine"
|
||||
@versionChange="versionChange" @StatusChange="addVersionStatus=$event" :exportVersion="true" @exportVersion="exportVersion" @importNewVersion="importNewVersion">
|
||||
</version>
|
||||
|
||||
<div class="rule_com">
|
||||
<rule :data="ruledata" :ZIndex="1"></rule>
|
||||
|
||||
<div class="rule_outcontent_box">
|
||||
<p>命中输出:</p>
|
||||
<div class="rule_home" style="margin-top: 10px;">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)" disabled></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px">
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select v-model="resultFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="是否命中" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<outcontent :outcontent="outcontent" :ruleOut="true" type="complex_rule" :outType="outTypeSuccess">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="scoreFieldEn" filterable placeholder="请选择" style="width: 200px;" clearable>
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn"
|
||||
:value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">=</p>
|
||||
<div>
|
||||
<el-input v-model="SpecialField.score" maxlength="30" style="width: 255px;">
|
||||
<template slot="prepend">得分</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
</outcontent>
|
||||
</div>
|
||||
<br>
|
||||
<div class="rule_outcontent_box">
|
||||
<p>未命中输出:</p>
|
||||
<outcontent :outcontent="failOutputList" :unone="true" :ruleOut="true" type="complex_rule"
|
||||
:outType="outTypeFail">
|
||||
|
||||
</outcontent>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import version from '@/components/common/Version.vue'
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
import rule from '@/components/models/RuleCont.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
rule,
|
||||
outcontent,
|
||||
version
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
nameId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
tempVersion: {
|
||||
versionCode: '',
|
||||
description: ''
|
||||
},
|
||||
addVersionLoading: false,
|
||||
addVersionDialog: false,
|
||||
version: {},
|
||||
addVersionStatus: false,
|
||||
ruleVersionList: [],
|
||||
scoreFieldEn: '',
|
||||
resultFieldEn: '',
|
||||
loading: false,
|
||||
valueScope: '',
|
||||
priority: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
ruledata: null,
|
||||
outcontent: [],
|
||||
failOutputList: [],
|
||||
SpecialField: {
|
||||
score: '1',
|
||||
ruleAudit: 5
|
||||
},
|
||||
tempisEmpty: false,
|
||||
parentId: '',
|
||||
outTypeSuccess: {
|
||||
outType: 'success'
|
||||
},
|
||||
outTypeFail: {
|
||||
outType: 'fail'
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('getfielduser')
|
||||
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getData.getVersion(this.id).then(res => {
|
||||
this.parentId = res.data.parentId
|
||||
this.ruleVersionList = res.data.ruleVersionList
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.code = res.data.code
|
||||
this.name = res.data.name
|
||||
this.priority = res.data.priority
|
||||
this.description = res.data.description
|
||||
this.getRuleCont()
|
||||
})
|
||||
} else {
|
||||
this.ruledata = {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if(this.$store.state.FieldUser){
|
||||
console.log(this.$store.state.FieldUser.data.fieldList)
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
importNewVersion(e){
|
||||
this.addVersionLoading = true
|
||||
console.log(e)
|
||||
this.tempisEmpty = false
|
||||
this.deepverify(e.data.ruleConditionVo)
|
||||
if (this.tempisEmpty) {
|
||||
this.addVersionLoading = false
|
||||
return true
|
||||
}
|
||||
|
||||
// return
|
||||
let obj = {
|
||||
versionCode: e.name.versionCode,
|
||||
description: e.name.description,
|
||||
ruleId: this.id,
|
||||
score: e.data.score,
|
||||
// ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: e.data.scoreFieldEn,
|
||||
resultFieldEn: e.data.resultFieldEn,
|
||||
ruleConditionVo: e.data.ruleConditionVo,
|
||||
tacticsOutputList: e.data.tacticsOutputList,
|
||||
failOutputList: e.data.failOutputList
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
async exportVersion(){
|
||||
const res = await this.getData.getInfo({
|
||||
id: this.version.id
|
||||
})
|
||||
|
||||
if(res.status!='1'){
|
||||
return
|
||||
}
|
||||
|
||||
this.mixinSaveJSON(res.data,`${this.name}_${res.data.description}.json`)
|
||||
|
||||
},
|
||||
addVersionExamine() {
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
addVersionSure(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
|
||||
let obj = {
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
ruleId: this.id,
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
tacticsOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
}
|
||||
this.getData.addVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '添加版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
|
||||
},
|
||||
updateVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description,
|
||||
ruleId: this.id,
|
||||
score: this.SpecialField.score,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
tacticsOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
|
||||
}
|
||||
this.getData.updateVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '版本重命名成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
copyVersion(tempVersion) {
|
||||
this.addVersionLoading = true
|
||||
let obj = {
|
||||
ruleId: this.id,
|
||||
id: this.version.id,
|
||||
versionCode: tempVersion.versionCode,
|
||||
description: tempVersion.description
|
||||
}
|
||||
this.getData.copyVersion(obj).then(res => {
|
||||
if (res.status == '1') {
|
||||
this.$message({
|
||||
message: '复制版本成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.addVersionDialog = false
|
||||
this.addVersionStatus = false
|
||||
this.getRuleCont()
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.addVersionLoading = false
|
||||
})
|
||||
},
|
||||
getRuleCont() {
|
||||
this.loading = true
|
||||
this.getData.getInfo({
|
||||
id: this.version.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.scoreFieldEn = res.data.scoreFieldEn
|
||||
this.resultFieldEn = res.data.resultFieldEn
|
||||
this.getType(res.data.ruleConditionVo)
|
||||
this.ruledata = res.data.ruleConditionVo ? res.data.ruleConditionVo : {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
}
|
||||
this.outcontent = res.data.tacticsOutputList
|
||||
this.failOutputList = res.data.failOutputList
|
||||
this.outcontent.forEach(value => {
|
||||
if (!value.variableType) {
|
||||
value.variableType = 1
|
||||
}
|
||||
})
|
||||
this.redeepverify(this.ruledata)
|
||||
|
||||
this.SpecialField.score = res.data.score
|
||||
this.SpecialField.ruleAudit = res.data.ruleAudit
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
versionChange() {
|
||||
this.ruleVersionList.forEach(value => {
|
||||
if (value.id === this.version.id) {
|
||||
this.version = JSON.parse(JSON.stringify(value))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
},
|
||||
addVersion() {
|
||||
this.addVersionStatus = true
|
||||
this.tempadd = {
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruledata: this.ruledata,
|
||||
outcontent: this.outcontent,
|
||||
failOutputList: this.failOutputList,
|
||||
score: this.SpecialField.score,
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
sureAddVersion() {
|
||||
if (this.verification()) {
|
||||
return
|
||||
}
|
||||
this.addVersionDialog = true
|
||||
},
|
||||
verification() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.code.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return true
|
||||
}
|
||||
if(this.verificationNameCode(this.code)||this.verificationNameCode(this.name)){
|
||||
return true
|
||||
}
|
||||
if (this.code.trim() === '') {
|
||||
this.$message.error('请填入规则代码,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.priority === '') {
|
||||
this.$message.error('请选择规则优先级');
|
||||
return true
|
||||
}
|
||||
if (this.name.trim() === '') {
|
||||
this.$message.error('请填入规则名称,并检查空格');
|
||||
return true
|
||||
}
|
||||
if (this.description === '') {
|
||||
this.$message.error('请填入规则描述,并检查空格');
|
||||
return true
|
||||
}
|
||||
// if (this.resultFieldEn === "") {
|
||||
// this.$message.error('请选择命中时输出变量');
|
||||
// return true
|
||||
// }
|
||||
// if (this.scoreFieldEn == "") {
|
||||
// this.$message.error('请选择得分时输出变量');
|
||||
// return true
|
||||
// }
|
||||
if (isNaN(Number(this.SpecialField.score)) || String(this.SpecialField.score).trim() === "") {
|
||||
this.$message.error('得分只能是数字');
|
||||
return true
|
||||
}
|
||||
let is = true
|
||||
this.tempisEmpty = false
|
||||
this.deepverify(this.ruledata)
|
||||
if (this.tempisEmpty) {
|
||||
return true
|
||||
}
|
||||
this.outcontent.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
"") {
|
||||
is = false
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
this.failOutputList.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType ===
|
||||
"") {
|
||||
is = false
|
||||
}
|
||||
if (value.variableType == 3 && (String(value.fieldValue).trim() === "" || JSON.parse(value
|
||||
.fieldValue).formula.trim() ===
|
||||
'')) {
|
||||
is = false
|
||||
}
|
||||
})
|
||||
if (is === false) {
|
||||
this.$message.error('请检查自定义输出部分是否有未填项');
|
||||
return true
|
||||
}
|
||||
},
|
||||
addVersionClose() {
|
||||
this.addVersionStatus = false
|
||||
this.SpecialField.score = this.tempadd.score
|
||||
this.scoreFieldEn = this.tempadd.scoreFieldEn
|
||||
this.resultFieldEn = this.tempadd.resultFieldEn
|
||||
this.ruledata = this.tempadd.ruledata
|
||||
this.outcontent = this.tempadd.outcontent
|
||||
this.failOutputList = this.tempadd.failOutputList
|
||||
},
|
||||
reset() {
|
||||
this.ruledata = {
|
||||
"logical": "&&",
|
||||
"fieldId": null,
|
||||
"operator": null,
|
||||
"fieldValue": null,
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: []
|
||||
}
|
||||
this.SpecialField.score = 1
|
||||
this.outcontent = []
|
||||
this.failOutputList = []
|
||||
this.scoreFieldEn = ""
|
||||
this.resultFieldEn = ""
|
||||
},
|
||||
delectVersion() {
|
||||
this.getData.delectVersion({
|
||||
status: -1,
|
||||
ids: [this.version.id],
|
||||
tacticsId: this.id
|
||||
}).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.ruleVersionList = res.data
|
||||
this.version = JSON.parse(JSON.stringify(this.ruleVersionList[0]))
|
||||
this.getRuleCont()
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getType(obj) {
|
||||
if (obj.conditionType == 2 && !obj.valueType) {
|
||||
obj.valueType = this.mixinGetvalueType(obj.fieldId)
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.getType(value)
|
||||
})
|
||||
}
|
||||
},
|
||||
outAdd(index) {
|
||||
this.outcontent.splice(index, 0, {
|
||||
"fieldId": "",
|
||||
tacticsType: 'base_rule',
|
||||
"fieldValue": "",
|
||||
variableType: 1
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.loading = true
|
||||
if (this.verification()) {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
let tempRuleData = JSON.parse(JSON.stringify(this.ruledata))
|
||||
this.deepTypetransition(tempRuleData)
|
||||
|
||||
|
||||
|
||||
this.outcontent.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
})
|
||||
this.failOutputList.forEach(value => {
|
||||
value.fieldEn = this.mixinGetvalueEn(value.fieldId)
|
||||
})
|
||||
let obj = {
|
||||
"code": this.code.trim(),
|
||||
"name": this.name.trim(),
|
||||
"priority": this.priority,
|
||||
"description": String(this.description).trim(),
|
||||
difficulty: 2,
|
||||
ruleAudit: this.SpecialField.ruleAudit,
|
||||
ruleVersionList: [{
|
||||
score: this.SpecialField.score,
|
||||
scoreFieldEn: this.scoreFieldEn,
|
||||
resultFieldEn: this.resultFieldEn,
|
||||
ruleConditionVo: tempRuleData,
|
||||
tacticsOutputList: this.outcontent,
|
||||
failOutputList: this.failOutputList
|
||||
}],
|
||||
}
|
||||
|
||||
|
||||
if (this.id == 0) {
|
||||
obj.ruleVersionList[0].versionCode = 'V:0'
|
||||
obj.ruleVersionList[0].description = '初始版本'
|
||||
obj.parentId = this.nameId == 99999999 ? 0 : this.nameId,
|
||||
this.getData.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.parentId = this.parentId
|
||||
obj.ruleVersionList[0].id = this.version.id
|
||||
this.getData.updatafield(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
// this.$emit('Ok')
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
console.log(obj)
|
||||
},
|
||||
change(index) {
|
||||
this.ruledata[index].operator = ""
|
||||
this.ruledata[index].fieldValue = ""
|
||||
},
|
||||
redeepverify(obj) {
|
||||
if (obj.fieldEn) {
|
||||
if ((obj.fieldEn.indexOf('.') != -1 && obj.fieldEn[0] == '%') || obj.conditionType == 3||obj.conditionType===2) {
|
||||
obj.fieldEn = obj.fieldEn.split('.')
|
||||
}
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.redeepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (value.actionValue.indexOf('.') != -1) {
|
||||
value.actionValue = value.actionValue.split('.')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
deepverify(obj) {
|
||||
if (this.tempisEmpty) {
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 0) {
|
||||
if (obj.fieldId && obj.fieldValue && obj.operator) {} else {
|
||||
this.tempisEmpty = true
|
||||
return
|
||||
}
|
||||
}
|
||||
if (obj.children.length === 0 && obj.conditionType != 2) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('非规则节点后不允许为空');
|
||||
return
|
||||
}
|
||||
|
||||
if (obj.conditionType == 5) { //如果是条件组
|
||||
if (obj.children.length === 0 && obj.conditionType != 5) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组后不允许为空');
|
||||
return
|
||||
}
|
||||
obj.condGroupResultCondition.children[0].fieldValue = obj.condGroupResultCondition.children[0]
|
||||
.fieldValue.trim()
|
||||
obj.condGroupResultCondition.children[1].fieldValue = obj.condGroupResultCondition.children[1]
|
||||
.fieldValue.trim()
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue.trim() === "" || obj.condGroupResultCondition
|
||||
.children[1].fieldValue
|
||||
.trim() ===
|
||||
"" || isNaN(Number(obj.condGroupResultCondition.children[0].fieldValue)) || isNaN(Number(obj
|
||||
.condGroupResultCondition
|
||||
.children[1].fieldValue))) {
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue !== 0 && obj.condGroupResultCondition
|
||||
.children[1].fieldValue !==
|
||||
0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中条件只能为数字且不为空与空格');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (obj.condGroupResultCondition.children[0].fieldValue < 0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中左边不能小于0');
|
||||
return
|
||||
}
|
||||
if (obj.condGroupResultCondition.children[1].fieldValue > obj.children.length) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中右边不能大于条件总个数');
|
||||
return
|
||||
}
|
||||
if (Number(obj.condGroupResultCondition.children[0].fieldValue) > Number(obj.condGroupResultCondition
|
||||
.children[1].fieldValue)) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('条件组命中左边不能大于右边');
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
if (obj.conditionType == 3 && !obj.fieldEn) { //如果是for节点 且没有选择 被遍历的指标
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('for后需要确定循环的数组');
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 2) {
|
||||
obj.fieldValue = obj.fieldValue.trim()
|
||||
if (!obj.fieldEn || !obj.operator || !obj.fieldValue) {
|
||||
if (obj.fieldValue !== 0) {
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('规则节点不允许有空值');
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.conditionType == 3 && obj.loopResultCondition.children.length === 0) { //如果是for节点 且没有子节点
|
||||
this.tempisEmpty = true
|
||||
this.$message.error('for的输出节点后不允许为空');
|
||||
return
|
||||
}
|
||||
if (obj.conditionType == 3 && obj.loopResultCondition.children.length != 0) { //如果是for节点 且 有输出节点
|
||||
obj.loopResultCondition.children.forEach(value => {
|
||||
this.deepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.children.length > 0) { //如果有子节点
|
||||
obj.children.forEach(value => {
|
||||
this.deepverify(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) { //如果有输出节点
|
||||
console.log(obj)
|
||||
let is = false
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (!value.actionKey || !value.actionType || !value.actionValue) {
|
||||
if (value.actionValue === 0 && value.actionType != 1) {
|
||||
this.tempisEmpty = true
|
||||
|
||||
is = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error('输出变量不允许有空值');
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
deepTypetransition(obj) {
|
||||
if (Array.isArray(obj.fieldEn)) {
|
||||
obj.fieldEn = obj.fieldEn.join('.')
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.deepTypetransition(value)
|
||||
})
|
||||
}
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
if (Array.isArray(value.actionValue)) {
|
||||
value.actionValue = value.actionValue.join('.')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
478
h5-enginex-manager/src/components/common/rule/ruleRule.vue
Executable file
478
h5-enginex-manager/src/components/common/rule/ruleRule.vue
Executable file
@@ -0,0 +1,478 @@
|
||||
<style>
|
||||
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.rule_dialg_header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
}
|
||||
.rule_dialg_cont{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
height: 40vh;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.rule_dialg_cont>div{
|
||||
width: 30%;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.rule_dialg_cont>div:hover{
|
||||
|
||||
overflow: unset;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="margin-left: 20px;margin-top: 20px;">
|
||||
<div v-if="Data&&FieldUser">
|
||||
<div v-if="type==1">
|
||||
条件:
|
||||
<div v-for="(item,index) in Data" class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('faadd',index)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('fadelect',index)" :disabled="index===0?'disabled':false"
|
||||
style="margin-right: 10px;"></el-button>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
|
||||
|
||||
<el-select v-show="index===0" v-model="item.logical" placeholder="请选择" style="width: 200px;margin-right: 10px;">
|
||||
<el-option label="(" value="("></el-option>
|
||||
<el-option label="((" value="(("></el-option>
|
||||
<el-option label="(((" value="((("></el-option>
|
||||
<el-option label="空置" value="-1"></el-option>
|
||||
</el-select>
|
||||
<el-select v-show="index!=0" v-model="item.logical" placeholder="请选择" style="width: 200px;margin-right: 10px;">
|
||||
<el-option v-for="cont in logical" :key="cont.id" :label="cont.label" :value="cont.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select :value="getCn(item.fieldId,2)" placeholder="请选择" style="width: 200px;" @change="$emit('change',index)"
|
||||
@focus="dataClick(index,item.fieldId)">
|
||||
</el-select>
|
||||
|
||||
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue" :valueType="getvalueType(item.fieldId)"></ruleRelation>
|
||||
|
||||
<!-- <el-input v-model="item.fieldValue" maxlength="30" placeholder="请输入内容,最长30位" style="width: 300px;margin-left: 10px;"
|
||||
v-show="getvalueType(item.fieldId)!==3">
|
||||
</el-input>
|
||||
<el-select v-model="item.fieldValue" placeholder="请选择" style="width: 300px;margin-left: 10px;" v-show="getvalueType(item.fieldId)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle disabled='disabled'></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<el-select v-model="SpecialField.lastLogical" placeholder="请选择" style="width: 200px;">
|
||||
<el-option label=")" value=")"></el-option>
|
||||
<el-option label="))" value="))"></el-option>
|
||||
<el-option label=")))" value=")))"></el-option>
|
||||
<el-option label="空置" value="-1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
输出:
|
||||
<slot></slot>
|
||||
<!-- <div class="rule_home">
|
||||
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle disabled='disabled'></el-button>
|
||||
<el-button icon="el-icon-close" circle disabled='disabled' style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-input value="命中动作:" maxlength="30" style="width: 200px;margin-right: 10px;" disabled></el-input>
|
||||
<p style="margin-right: 10px;">=</p>
|
||||
<el-select v-model="SpecialField.ruleAudit" placeholder="请选择" style="width: 200px;">
|
||||
<el-option label="终止决策流" :value="2"></el-option>
|
||||
<el-option label="继续决策流" :value="5"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
|
||||
<div v-for="(value,index) in outcontent" class="rule_home">
|
||||
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('outAdd',index+1)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('outDelect',index)" style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select :value="getCn(value.fieldId)" placeholder="请选择" style="width: 200px;margin-right: 10px;" @focus="outClick(index)">
|
||||
</el-select>
|
||||
<p style="margin-right: 10px;">=</p>
|
||||
<div style="display: flex;">
|
||||
<div style="font-size: 14px;padding-right: 5px;width: 60px;height: 40px;background-color: #d4d4d4;border-radius: 4px;line-height: 40px;color: #fff;text-align: center;">
|
||||
<!-- <el-select v-model="value.variableType" placeholder="请选择" @change="value.fieldValue=''">
|
||||
<el-option label="常量" value="1"></el-option>
|
||||
<el-option label="变量" value="2"></el-option>
|
||||
</el-select> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<el-dropdown trigger="click" @command="value.variableType=$event;value.fieldValue=''">
|
||||
<span class="el-dropdown-link" style="color: #fff;">
|
||||
{{value.variableType==1?"常量":"变量"}}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="1">常量</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="2">变量</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<el-input v-show="value.variableType==1" v-model="value.fieldValue" maxlength="30" style="width: 200px;margin-right:10px;margin-left: -5px;"></el-input>
|
||||
<!-- {{Number(value.fieldValue.split('|')[0])}} -->
|
||||
<el-select v-show="value.variableType==2" filterable v-model="value.fieldValue" placeholder="请选择" style="width: 200px;margin-right:10px;margin-left: -5px;">
|
||||
<el-option v-for="item in FieldUser" :label="item.fieldCn" :value="Number(item.id)"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="输入参数" :visible.sync="dialogVisible" width="50%">
|
||||
|
||||
<div class="rule_dialg_header">
|
||||
请选择参数:
|
||||
<div>
|
||||
<el-input v-model="search" maxlength="30" placeholder="快速搜索"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rule_dialg_cont">
|
||||
<div v-for="value in fradioList">
|
||||
<el-radio v-model="radio" :label="value.id" border size="mini">{{value.fieldCn}}</el-radio>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false;radio='';search=''">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSure()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
search: '',
|
||||
tempcur: '',
|
||||
|
||||
radioList: [],
|
||||
radio: '',
|
||||
dialogVisible: false,
|
||||
logical: [{
|
||||
value: '&&',
|
||||
label: 'and',
|
||||
}, {
|
||||
value: '||',
|
||||
label: 'or',
|
||||
}, {
|
||||
value: '(',
|
||||
label: '(',
|
||||
}, {
|
||||
value: '((',
|
||||
label: '((',
|
||||
}, {
|
||||
value: '(((',
|
||||
label: '(((',
|
||||
}, {
|
||||
value: ')',
|
||||
label: ')',
|
||||
}, {
|
||||
value: '))',
|
||||
label: '))',
|
||||
}, {
|
||||
value: ')))',
|
||||
label: ')))',
|
||||
}, {
|
||||
value: '&&(',
|
||||
label: 'and (',
|
||||
}, {
|
||||
value: '&&((',
|
||||
label: 'and ((',
|
||||
}, {
|
||||
value: '&&(((',
|
||||
label: 'and (((',
|
||||
}, {
|
||||
value: ')&&',
|
||||
label: ') and',
|
||||
}, {
|
||||
value: '))&&',
|
||||
label: '))and',
|
||||
}, {
|
||||
value: ')))&&',
|
||||
label: ')))and',
|
||||
}, {
|
||||
value: ')&&(',
|
||||
label: ')and(',
|
||||
}, {
|
||||
value: '))&&',
|
||||
label: '))and',
|
||||
}, {
|
||||
value: ')&&((',
|
||||
label: ') and ((',
|
||||
}, {
|
||||
value: ')&&(((',
|
||||
label: ') and (((',
|
||||
}, {
|
||||
value: '))&&(',
|
||||
label: ')) and (',
|
||||
}, {
|
||||
value: '))&&((',
|
||||
label: ')) and ((',
|
||||
}, {
|
||||
value: '))&&(((',
|
||||
label: ')) and (((',
|
||||
}, {
|
||||
value: ')))&&(',
|
||||
label: '))) and (',
|
||||
}, {
|
||||
value: ')))&&((',
|
||||
label: '))) and ((',
|
||||
}, {
|
||||
value: ')))&&(((',
|
||||
label: '))) and (((',
|
||||
}, {
|
||||
value: '||(',
|
||||
label: 'or (',
|
||||
}, {
|
||||
value: '||((',
|
||||
label: 'or ((',
|
||||
}, {
|
||||
value: '||(((',
|
||||
label: 'or(((',
|
||||
}, {
|
||||
value: ')||',
|
||||
label: ') or ',
|
||||
}, {
|
||||
value: '))||',
|
||||
label: ')) or ',
|
||||
}, {
|
||||
value: ')))||',
|
||||
label: '))) or ',
|
||||
}, {
|
||||
value: ')||(',
|
||||
label: ' ) or (',
|
||||
}, {
|
||||
value: ')||((',
|
||||
label: ' ) or (( ',
|
||||
}, {
|
||||
value: '))||(',
|
||||
label: ')) or ( ',
|
||||
}, {
|
||||
value: '))||((',
|
||||
label: ')) or (( ',
|
||||
}, {
|
||||
value: '))||(((',
|
||||
label: ')) or (((',
|
||||
}, {
|
||||
value: ')))||(',
|
||||
label: ' ))) or (',
|
||||
}, {
|
||||
value: ')))||((',
|
||||
label: '))) or ((',
|
||||
}, {
|
||||
value: ')))||(((',
|
||||
label: '))) or (((',
|
||||
}, {
|
||||
value: '-1',
|
||||
label: '空置',
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.Data)
|
||||
},
|
||||
computed: {
|
||||
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
outPutUser() {
|
||||
if (this.$store.state.Output) {
|
||||
return this.$store.state.Output.data.paramMap.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fradioList() {
|
||||
if (this.search != "") {
|
||||
let arr = []
|
||||
|
||||
arr = this.radioList.filter(value => {
|
||||
if (value.fieldCn.indexOf(this.search) != -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
return arr
|
||||
} else {
|
||||
return this.radioList
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
Data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
SpecialField: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
outcontent: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dialogSure() {
|
||||
|
||||
if (this.radio == '') {
|
||||
this.$message.error('请选择一个字段,或者选择取消')
|
||||
} else {
|
||||
if (this.tempcur.split('###')[1] === "Data") {
|
||||
this.Data.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
console.log(value)
|
||||
value.fieldId = this.radio + '|' + this.getvalueEn(this.radio)
|
||||
value.operator = ""
|
||||
value.fieldValue = ""
|
||||
}
|
||||
})
|
||||
} else if (this.tempcur.split('###')[1] === "out") {
|
||||
console.log(this.outcontent)
|
||||
this.outcontent.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
value.fieldId = this.radio
|
||||
value.fieldEn = this.mixinGetvalueEn(this.radio)
|
||||
value.fieldValue = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
this.radio = '';
|
||||
this.search = '';
|
||||
}
|
||||
|
||||
},
|
||||
getCn(id, type) {
|
||||
let Cn
|
||||
if (type != 2) {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
return Cn
|
||||
},
|
||||
getvalueEn(cont) {
|
||||
let num
|
||||
console.log(cont)
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.fieldEn
|
||||
console.log(1)
|
||||
}
|
||||
})
|
||||
return num
|
||||
},
|
||||
dataClick(index, id) {
|
||||
this.tempcur = index + '###Data'
|
||||
this.radioList = this.FieldUser
|
||||
this.radio = Number(id.split('|')[0])
|
||||
console.log(id)
|
||||
this.dialogVisible = true
|
||||
},
|
||||
outClick(index) {
|
||||
this.tempcur = index + '###out'
|
||||
console.log(this.tempcur)
|
||||
this.radioList = this.FieldUser
|
||||
this.dialogVisible = true
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
140
h5-enginex-manager/src/components/common/ruleRelation.vue
Executable file
140
h5-enginex-manager/src/components/common/ruleRelation.vue
Executable file
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div style="display: inline;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="data" :size="size" :filterable="type==2?'filterable':false" placeholder="请选择"
|
||||
ref="select" style="width: 100px;margin-left: 10px;" @change="change" @blur="$emit('blur')">
|
||||
<el-option label="大于" value=">" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="大于等于" value=">=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="等于" value="==" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于" value="<" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于等于" value="<=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="不等于" value="!=" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="包含" value="contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不包含" value="not contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="为空" value="is empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不为空" value="not empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="正则匹配" value="regex" v-show="[2].indexOf(valueType)!=-1"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input :value="value2" @input="$emit('update:value2',$event)" maxlength="30" :size="size"
|
||||
placeholder="请输入内容,最长30位" style="width: 100px;margin-left: 10px;"
|
||||
v-if="!variableType&&openValue2&&valueType!==3&&['is empty','not empty'].indexOf(data)==-1">
|
||||
</el-input>
|
||||
<el-select :value="value2" @input="$emit('update:value2',$event)" placeholder="请选择" :size="size"
|
||||
style="width: 100px;margin-left: 10px;" v-if="!variableType&&openValue2&&valueType===3">
|
||||
<el-option label="是" value="="></el-option>
|
||||
<el-option label="否" value="!="></el-option>
|
||||
</el-select>
|
||||
<varialeSelect v-if="variableType" :valueType="valueType"
|
||||
:disabled="variableDisList" :variableType="variableType"
|
||||
@update:variableType="$emit('update:variableType',$event)" :value="value2"
|
||||
@input="$emit('update:value2',$event)" v-bind="$attrs" @CustomCallback="$emit('CustomCallback',$event)" style="margin-left: 10px;"></varialeSelect>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
openValue2: { //是否打开后半截输入框
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
value2: { //后半截输入框的Key
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
type: { //是否打开搜索
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
openSelect: { //是否自动打开下拉选择框
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: { //大于小于等信息
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
valueType: { //数字 或者字符串 或者 JSON
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
size: { //大小
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
variableType: { //是否打开 常量变量自定义 以及默认为哪个 0为不打开
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
variableDis: { //禁用常量变量自定义
|
||||
type: Array || null,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.data = this.value
|
||||
// console.log(this.$listeners)
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change')
|
||||
if (['is empty', 'not empty'].indexOf(this.data) == -1) {
|
||||
if (this.data == 'regex') {
|
||||
this.$emit('update:value2', '')
|
||||
} else {
|
||||
this.$emit('update:value2', '0')
|
||||
}
|
||||
}
|
||||
if (this.data == 'regex') { //如果选择正则匹配 则只能为变量
|
||||
this.$emit('update:variableType', 1)
|
||||
}
|
||||
|
||||
|
||||
this.$emit('input', this.data)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
variableDisList() {
|
||||
|
||||
let arr = []
|
||||
if (this.variableDis) {
|
||||
|
||||
arr.push(...this.variableDis)
|
||||
}
|
||||
if (this.data == 'regex') {
|
||||
arr.push(...[2, 3])
|
||||
}
|
||||
arr = Array.from(new Set(arr))
|
||||
return arr
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
this.data = this.value
|
||||
},
|
||||
openSelect() {
|
||||
if (this.openSelect) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select.focus()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
572
h5-enginex-manager/src/components/common/te.vue
Executable file
572
h5-enginex-manager/src/components/common/te.vue
Executable file
@@ -0,0 +1,572 @@
|
||||
<style>
|
||||
.te_top{
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
user-select: none;
|
||||
}
|
||||
.te_top>p{
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.te_top>p:hover{
|
||||
color: #fff;
|
||||
cursor:pointer
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<div class="te_top">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea" @input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="FieldUser" refs="t" @dbc="dbclick" :show="isshow" @close="isshow=false"></fieldUserTable>
|
||||
<el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
import {
|
||||
validateSection
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
fields: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
if (e.key == 'a') {
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show, '@') == false)) {
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
}
|
||||
if (((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) || (this.dialogVisible ==
|
||||
true)) {
|
||||
|
||||
e.preventDefault()
|
||||
this.openDialog()
|
||||
}
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onclick = (e) => {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true) && this.formula_show
|
||||
.indexOf(
|
||||
'@') != -1) {
|
||||
this.openDialog()
|
||||
}
|
||||
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onfocus = () => {
|
||||
document.body.onmousemove = (e) => {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
this.$refs.textarea.$refs.textarea.onblur = () => {
|
||||
document.body.onmousemove = (e) => {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
console.log(this.formula_show,this.value)
|
||||
|
||||
},
|
||||
methods: {
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(()=>{
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if(e.split(',')[1]){
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
}else{
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea,(this.cursorfront + e.split(',')[0]).length)
|
||||
|
||||
// console.log(e, this.formula_show)
|
||||
},
|
||||
sectionSure() {
|
||||
this.loading = true
|
||||
let isNot = false
|
||||
let Z = /^(\[|\()\d*,\d*(\]|\))$/
|
||||
this.tempsection.forEach(value => {
|
||||
if (!Z.test(value.segment)) {
|
||||
isNot = true
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
if (isNot) {
|
||||
this.$message.error('请检查区间格式');
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
let arr = this.tempsection.map(value => {
|
||||
return value.segment
|
||||
})
|
||||
|
||||
validateSection(arr).then(res => {
|
||||
if (res.status == "1") {
|
||||
if (res.data.result == "1") {
|
||||
this.$message({
|
||||
message: res.data.msg,
|
||||
type: 'success'
|
||||
});
|
||||
let isNotValue = false
|
||||
this.tempsection.forEach(value => {
|
||||
if (value.value == "") {
|
||||
|
||||
isNotValue = true
|
||||
}
|
||||
})
|
||||
if (isNotValue) {
|
||||
|
||||
setTimeout(() => {
|
||||
this.$message.error('值不能为空');
|
||||
}, 10)
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
this.fields[ind.length].segments = this.deepClone(this.tempsection)
|
||||
this.sectionVisible = false
|
||||
this.tempsection = []
|
||||
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
this.loading = false
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
delectSegment(index) {
|
||||
this.tempsection.splice(index, 1)
|
||||
},
|
||||
addSegment(index) {
|
||||
this.tempsection.splice(index, 0, {
|
||||
"segment": "",
|
||||
"value": ''
|
||||
})
|
||||
},
|
||||
// 打开区间编辑
|
||||
openSection() {
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
this.tempsection = this.deepClone(this.fields[ind.length].segments)
|
||||
// this.sectionVisible = true
|
||||
},
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {
|
||||
// console.log(this.cursorfront.substring(this.cursorfront.lastIndexOf('@')))
|
||||
// console.log(this.cursorlest.substring(0,this.cursorlest.indexOf('@')+1))
|
||||
// console.log(this.cursorfront.lastIndexOf('@'),'上半句最后一个@')
|
||||
|
||||
|
||||
|
||||
} else if (this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
// console.log(this.cursorfront, str)
|
||||
// console.log(this.formula_show.indexOf(str,1),'整句中str的位置(1)')
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
|
||||
|
||||
},
|
||||
openDialog() {
|
||||
this.countCurr()
|
||||
this.dialogVisible = true
|
||||
this.$refs.textarea.$refs.textarea.blur()
|
||||
|
||||
// 数组添加
|
||||
if (this.getTempIndex(this.formula_show, this.nowCurr.split('|')[0]) > this.getTempArreyIndex(this.fields, this.nowCurr
|
||||
.split('|')[0].substring(1, this.nowCurr.split('|')[0].Length - 1))) {
|
||||
|
||||
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
let ind2 = this.formula_show.match(/@.*?@/g) === null ? [] : this.formula_show.match(/@.*?@/g);
|
||||
|
||||
|
||||
// console.log(this.fields, ind2, ind, ind2)
|
||||
let name = this.nowCurr.split('|')[0].substring(1, this.nowCurr.split('|')[0].length - 1)
|
||||
let obj = {}
|
||||
this.FieldUser.data.fieldList.forEach(value => {
|
||||
if (value.fieldCn === name) {
|
||||
obj = value
|
||||
}
|
||||
})
|
||||
if (typeof this.fields[ind.length] === 'object' && this.fields[ind.length].field_type != 0) {
|
||||
// console.log(this.fields[ind.length].length)
|
||||
if (this.fields.length < ind2.length) {
|
||||
|
||||
// console.log(ind)
|
||||
|
||||
this.fields.splice(ind.length, 0, {
|
||||
"field_id": obj.id,
|
||||
"field_code": obj.fieldEn,
|
||||
"field_name": name,
|
||||
"field_type": 1,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
// this.fields[ind.length] = {
|
||||
// n: Math.random()
|
||||
// }
|
||||
// 开启数据回显
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// this.fields[ind.length] = {
|
||||
// "field_id": obj.id,
|
||||
// "field_code": obj.fieldEn,
|
||||
// "field_name": name,
|
||||
// "field_type": 1,
|
||||
// "segments": [{
|
||||
// "segment": "",
|
||||
// "value": ''
|
||||
// }]
|
||||
// }
|
||||
this.$set(this.fields, ind.length, {
|
||||
"field_id": obj.id,
|
||||
"field_code": obj.fieldEn,
|
||||
"field_name": name,
|
||||
"field_type": 1,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
for (let i = 0; i < ind.length; i++) {
|
||||
|
||||
if (typeof this.fields[i] !== 'object') {
|
||||
// this.fields[i] = {
|
||||
// "field_id": 0,
|
||||
// "field_code": "",
|
||||
// "field_name": "",
|
||||
// "field_type": 0,
|
||||
// "segments": [{
|
||||
// "segment": "",
|
||||
// "value": ''
|
||||
// }]
|
||||
// }
|
||||
|
||||
|
||||
this.$set(this.fields, i, {
|
||||
"field_id": 0,
|
||||
"field_code": "",
|
||||
"field_name": "",
|
||||
"field_type": 0,
|
||||
"segments": [{
|
||||
"segment": "",
|
||||
"value": ''
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// console.log(this.fields)
|
||||
} else { //数组更新
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
delect() {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
this.delectShow(str, parseInt(index))
|
||||
this.delectArray(str, parseInt(index))
|
||||
this.dialogVisible = false
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
// console.log(this.cursorfront.lastIndexOf('@'))
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
delectArray(str, index) { // 数组删除
|
||||
let ind = this.cursorfront.match(/@.*?@/g) === null ? [] : this.cursorfront.match(/@.*?@/g);
|
||||
|
||||
// console.log(ind)
|
||||
this.fields.splice(ind.length, 1)
|
||||
// console.log(this.fields)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
463
h5-enginex-manager/src/components/common/teParam.vue
Executable file
463
h5-enginex-manager/src/components/common/teParam.vue
Executable file
@@ -0,0 +1,463 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.teParamParamList {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p>
|
||||
入参:
|
||||
</p>
|
||||
<div>
|
||||
|
||||
|
||||
<div v-for="(value,index) in paramList"
|
||||
style="margin-top: 10px;border-bottom: 1px #ddd dotted;padding-bottom: 5px;">
|
||||
<el-select v-model="value.id" filterable placeholder="请选择" @change="paramChange(index,$event)">
|
||||
<el-option v-for="item in FieldUser" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<i class="el-icon-circle-close" style="color: red;font-size: 20px;margin-left: 10px;"
|
||||
@click="deleteparam(index)"></i>
|
||||
|
||||
<div v-if="value.paramList" v-for="item in value.paramList" class="teParamParamList">
|
||||
{{item.en}} : <varialeSelect :disabled="[3]" :variableCascader="true" v-bind="$attrs"
|
||||
:variableType.sync="item.type" v-model="item.value" style="margin-left: 10px;"></varialeSelect>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<el-button @click="addParam" style="margin-top: 10px;">+</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;margin-top: 30px;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
@input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="[...paramList,...tempAddOpkey]" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable,
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
paramList: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
tempAddOpkey:{
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
|
||||
// console.log(this.formula_show, this.value)
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
deleteparam(index) {
|
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.paramList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
paramChange(index, id) {
|
||||
let value = this.FieldUser.find(x => x.id == id)
|
||||
if (value.sqlStatement) {
|
||||
let arr = JSON.parse(value.sqlVariable)
|
||||
if (arr) {
|
||||
this.$set(value, 'paramList', arr.map(value => {
|
||||
return {
|
||||
en: value.key,
|
||||
value: "",
|
||||
type: 1
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
this.$set(this.paramList, index, JSON.parse(JSON.stringify(value)))
|
||||
},
|
||||
addParam() {
|
||||
// let arr = JSON.parse(JSON.stringify())
|
||||
|
||||
this.paramList.push({
|
||||
id: ''
|
||||
})
|
||||
// console.log(arr)
|
||||
// this.$emit('update:paramList', arr)
|
||||
|
||||
console.log(this.paramList)
|
||||
},
|
||||
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if (type == 'Backspace') {
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - str.length + 1))
|
||||
} else if (type == 'Delete') {
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length - 1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length + e.length + 1 - this
|
||||
.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value) {
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
367
h5-enginex-manager/src/components/common/teV2.vue
Executable file
367
h5-enginex-manager/src/components/common/teV2.vue
Executable file
@@ -0,0 +1,367 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
@input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="FieldUser" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
|
||||
// console.log(this.formula_show, this.value)
|
||||
|
||||
},
|
||||
methods: {
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if(type=='Backspace'){
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-str.length+1))
|
||||
}else if(type=='Delete'){
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length+e.length+1-this.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value){
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
136
h5-enginex-manager/src/components/common/textCustom.vue
Executable file
136
h5-enginex-manager/src/components/common/textCustom.vue
Executable file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div style="width: 100%;margin-left: 5px;">
|
||||
<div class="textInput" v-if="click=='dbl'" @dblclick="dialogVisibleOpen" :style="{'color':color,textAlign:center?'center':'left'}">{{value.trim()===""||JSON.parse(value).formula.trim()==""?'-':JSON.parse(value).formula}}</div>
|
||||
|
||||
|
||||
<el-dialog title="自定义" v-if="dialogVisible" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<teV2 v-model="tempValue"></teV2>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;tempValue=''">取 消</el-button>
|
||||
<el-button type="primary" @click="sectionSure" :disabled="type3Sure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
export default {
|
||||
components: {
|
||||
teV2
|
||||
},
|
||||
props: {
|
||||
center: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
click: {
|
||||
type: String,
|
||||
default: 'dbl'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
dialogVisible: false,
|
||||
tempValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
dialogVisibleOpen() {
|
||||
// console.log('this.value',this.value)
|
||||
this.tempValue = this.value==""?this.value:JSON.parse(this.value).formula
|
||||
this.dialogVisible = true
|
||||
},
|
||||
sectionSure(e) {
|
||||
// console.log(this.tempValue)
|
||||
let arr = String(this.tempValue).match(/@(.|\n)*?@/g) === null ? [] : this.tempValue.match(/@(.|\n)*?@/g);
|
||||
let is = false
|
||||
arr = Array.from(new Set(arr))
|
||||
// console.log(arr)
|
||||
arr = arr.map(value => {
|
||||
// console.log(value)
|
||||
value = value.split('')
|
||||
value.pop()
|
||||
value.shift()
|
||||
value = value.join('')
|
||||
if (this.mixinGetValueByCn(value)) {
|
||||
return this.mixinGetValueByCn(value)
|
||||
} else {
|
||||
is = true
|
||||
this.$message.error(`没有找到指标:${value}`);
|
||||
return this.mixinGetValueByCn(value)
|
||||
}
|
||||
|
||||
})
|
||||
if (is) {
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
farr: arr,
|
||||
formula: this.tempValue.trim()
|
||||
}
|
||||
if(this.tempValue.trim()===""){
|
||||
this.color = '#ee0000'
|
||||
}else{
|
||||
|
||||
this.color = '#009500'
|
||||
}
|
||||
|
||||
this.$emit('input', JSON.stringify(obj))
|
||||
this.dialogVisible = false
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
type3Sure() {
|
||||
return this.isodd(this.tempValue, '@')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.textInput {
|
||||
|
||||
width: 100% !important;
|
||||
table-layout: fixed !important;
|
||||
word-wrap: break-all !important;
|
||||
word-break: normal !important;
|
||||
overflow: hidden !important;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
137
h5-enginex-manager/src/components/common/textInput.vue
Executable file
137
h5-enginex-manager/src/components/common/textInput.vue
Executable file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<div style="width: 100%;margin-left: 5px;">
|
||||
<div class="textInput" v-if="click=='dbl'" @dblclick="openinput=true" :style="{'color':color,textAlign:center?'center':'left'}"
|
||||
v-show="!openinput">{{mytext.trim()==""?'-':mytext}}</div>
|
||||
<div class="textInput" v-if="click=='click'" @click="openinput=true" :style="{'color':color,textAlign:center?'center':'left'}"
|
||||
v-show="!openinput">{{mytext.trim()==""?'-':mytext}}</div>
|
||||
|
||||
<el-input v-show="openinput" ref='input' maxlength="30" v-model="mytext" placeholder="请输入内容" size="mini" @input="input" @blur="openinput=false"></el-input>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
center: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
examine: {
|
||||
type: Number,
|
||||
default: 1 // 1为范围检查 2为数字检查
|
||||
},
|
||||
click: {
|
||||
type: String,
|
||||
default: 'dbl'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
openinput: false,
|
||||
mytext: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.mytext = this.text ? this.text : this.text === 0 ? this.text : '-'
|
||||
if (this.text == null) {
|
||||
this.mytext = "-"
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.$refs.input.onkeydown = (e) => {
|
||||
if (e.key == 'Enter') {
|
||||
this.$refs.input.$refs.input.blur()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
input(e) {
|
||||
this.$emit('input', e)
|
||||
},
|
||||
verify(type = 1) {
|
||||
if (!this.mytext && this.mytext != 0) {
|
||||
this.mytext = '-'
|
||||
this.color = '#f00'
|
||||
} else {
|
||||
if (this.examine == 1) {
|
||||
if (this.type == 1) {
|
||||
// let Z = /^(\[|\()(\d|\.)*,(\d|\.)*(\]|\))$/
|
||||
let Z = /^((\[|\()(\d(\d)*(\.(\d)+)?)|\(),((\d(\d)*(\.(\d)+)?(\]|\)))|\))$/
|
||||
if (!Z.test(this.mytext)) {
|
||||
if (type == 1) {
|
||||
this.$message.error('该字段为数值型 请填写范围区间 如:[123,456) 留空请使用 "(" ');
|
||||
}
|
||||
this.color = "#ee0000"
|
||||
|
||||
} else {
|
||||
this.color = "#009500"
|
||||
}
|
||||
}
|
||||
} else if (this.examine == 2) {
|
||||
if (typeof Number(this.mytext) == 'number' && !isNaN(Number(this.mytext))) {
|
||||
|
||||
|
||||
this.color = "#009500"
|
||||
} else {
|
||||
if (type == 1) {
|
||||
this.$message.error('请填写数字');
|
||||
}
|
||||
this.color = "#ee0000"
|
||||
}
|
||||
} else if (this.examine == 3) {
|
||||
|
||||
if (String(this.mytext).trim() === "") {
|
||||
this.color = "#ee0000"
|
||||
} else {
|
||||
|
||||
this.color = "#009500"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
text() {
|
||||
this.mytext = this.text
|
||||
},
|
||||
openinput() {
|
||||
if (this.openinput) {
|
||||
if (this.mytext == "-") {
|
||||
this.mytext = ""
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.input.$refs.input.focus()
|
||||
})
|
||||
} else {
|
||||
this.verify()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.textInput {
|
||||
|
||||
width: 100% !important;
|
||||
table-layout: fixed !important;
|
||||
word-wrap: break-all !important;
|
||||
word-break: normal !important;
|
||||
overflow: hidden !important;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
158
h5-enginex-manager/src/components/common/textSelect.vue
Executable file
158
h5-enginex-manager/src/components/common/textSelect.vue
Executable file
@@ -0,0 +1,158 @@
|
||||
<style>
|
||||
.textSelectSpan {
|
||||
font-size: 14px;
|
||||
width: 120px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.textSelectSpan:hover {
|
||||
overflow: unset;
|
||||
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div style="display: flex;" v-if="type==1">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.fieldName?data.fieldName:'请选择指标'}}</p>
|
||||
<el-select v-model="data.fieldId" v-show="openSelect" filterable remote placeholder="请选择" size="mini" @change="change"
|
||||
ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="display: flex;width: 80px;margin-left: 5px;" v-else-if="type==2">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.calculateType==1?'分值':data.calculateType==2?'系数':'自定义'}}</p>
|
||||
<el-select v-model="data.calculateType" v-show="openSelect" filterable placeholder="请选择" size="mini" @change="change"
|
||||
ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option :key="1" label="分值" :value="1"></el-option>
|
||||
<el-option :key="2" label="系数" :value="2"></el-option>
|
||||
<el-option :key="3" label="自定义" :value="3"></el-option>
|
||||
</el-select>
|
||||
:
|
||||
</div>
|
||||
<div style="display: flex;width: 30px;margin-left: 5px;" v-else-if="type==3">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.operator?data.operator=='contains'?'包含':data.operator=='not contains'?'不包含':data.operator:'-'}}</p>
|
||||
<ruleRelation v-model="data.operator" :openValue2="false" :valueType="valueType" :openSelect="openSelect" :type="2" v-show="openSelect"
|
||||
size="mini" @change="change" ref="select" @blur="blur" @visible-change="visibleChange" :andTextInput="true"></ruleRelation>
|
||||
:
|
||||
</div>
|
||||
<div style="display: flex;width: 40px;margin-left: 5px;" v-else-if="type==4">
|
||||
<p v-show="!openSelect" @dblclick="openSelect=true;" class="textSelectSpan" :style="{'color':color}">{{data.logical=='||'?'OR':'AND'}}</p>
|
||||
<el-select v-model="data.logical" v-show="openSelect" filterable placeholder="请选择" size="mini" @change="change" ref="select" @blur="blur" @visible-change="visibleChange">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation
|
||||
},
|
||||
props: {
|
||||
valueType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
Number:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color: '#000',
|
||||
openSelect: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.$store.dispatch('getfielduser')
|
||||
if (this.type == 1) {
|
||||
if (!this.data.fieldId) {
|
||||
this.data.fieldName = '请选择指标'
|
||||
} else {
|
||||
this.data.fieldName = this.mixinGetvalueCn(this.data.fieldId)
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
openSelect() {
|
||||
if (this.openSelect && this.type != 3) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select.focus()
|
||||
})
|
||||
}
|
||||
},
|
||||
'data.operator'() {
|
||||
if (this.data.operator == "" || this.data.operator == "-") {
|
||||
this.color = '#F56C6C'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
visibleChange(e) {
|
||||
if (!e) {
|
||||
|
||||
this.openSelect = false
|
||||
|
||||
}
|
||||
},
|
||||
blur() {
|
||||
setTimeout(() => {
|
||||
this.openSelect = false
|
||||
}, 200)
|
||||
},
|
||||
change(e) {
|
||||
|
||||
|
||||
// this.type==3?return : ''
|
||||
if(this.type==1){
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == e) {
|
||||
this.data.fieldName = value.fieldCn
|
||||
}
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.openSelect = false
|
||||
}, 200)
|
||||
this.color = '#409EFF'
|
||||
|
||||
this.$emit('change')
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser == null) {
|
||||
return []
|
||||
} else {
|
||||
if(this.Number){
|
||||
return this.$store.state.FieldUser.data.fieldList.filter(value=>value.valueType==1)
|
||||
}else{
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
848
h5-enginex-manager/src/components/models/RuleCont.vue
Executable file
848
h5-enginex-manager/src/components/models/RuleCont.vue
Executable file
@@ -0,0 +1,848 @@
|
||||
<style>
|
||||
.rule {
|
||||
display: flex;
|
||||
/* margin-left: 5px; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Rule_cont {
|
||||
width: 30px;
|
||||
border-top: 1px dashed #C7C6C8;
|
||||
/* border-top: 1px dashed rgb(1,1,1); */
|
||||
margin-top: 7px;
|
||||
flex-grow: 0;
|
||||
height: 1px;
|
||||
/* background-color: #C7C6C8; */
|
||||
margin: 12px 0px 0 0;
|
||||
height: 0;
|
||||
|
||||
}
|
||||
|
||||
.RuleIcon {
|
||||
background-color: #EBEBEB;
|
||||
border: #DADADA 1px solid;
|
||||
border-radius: 4px;
|
||||
padding: 4px 6px 4px 2px;
|
||||
}
|
||||
|
||||
.RuleSelcet .el-input__inner {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.RuleCont_for_out {
|
||||
border-left: 1px dashed #ccc;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
border-right: 1px dashed #ccc;
|
||||
padding-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="rule" :style="{marginLeft:ZIndex==1?'20px':'0px'}" v-if="data">
|
||||
<div :style="{position: 'absolute',top:'0px', left: '-20px',marginTop: top===0?'0':'8px'}" class="RuleIcon">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-s-operation" :style="{color: color[ZIndex%5] ,fontSize: '16px'}"></i>
|
||||
</span>
|
||||
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-plus" command="addRule" v-if="data.conditionType!=3">添加规则
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-circle-plus-outline" command="addlogical">添加关系</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-video-play" command="addfor" v-if="data.conditionType!=4">添加循环规则
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-video-play" command="addcond">添加条件组</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-close" command="delect" v-if="ZIndex!=1&&data.conditionType!=4">
|
||||
删除此节点</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div v-if="data.conditionType==1||data.conditionType==4" class="RuleSelcet">
|
||||
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="data.conditionType==3" class="RuleSelcet">
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="FOR" value="for"></el-option>
|
||||
<!-- <el-option :key="2" label="包含" value="contains"></el-option> -->
|
||||
<!-- <el-option :key="3" label="长度" value="length"></el-option> -->
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="data.conditionType==5" class="RuleSelcet">
|
||||
|
||||
<div :style="{width: '80px',marginTop: top===0?'0':'8px'}">
|
||||
<el-select v-model="data.logical" placeholder="请选择" size="mini">
|
||||
<el-option :key="1" label="条件组" value="condGroup"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 10px;height: 0;border-top: 1px dashed #C7C6C8;margin-top: 19px;margin-left: 5px;">
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{border: '1px dashed '+ color[ZIndex%5],borderRadius: '5px',paddingRight: '5px',paddingBottom: '5px',position:'relative',minWidth:'30px',minHeight:'40px'}">
|
||||
<div v-if="data.conditionType==3" style="display: flex;margin-top: 6px;">
|
||||
<div class="Rule_cont" :style="{marginTop:'12px'}"></div>
|
||||
|
||||
<el-cascader v-model="data.fieldEn" filterable size="mini" :options="fielduserArr" :key="keyValue+(data.random?data.random:0)" @visible-change="randomAdd(data,$event)"
|
||||
:props="{ expandTrigger: 'hover' }" @change="EnChange"></el-cascader>
|
||||
|
||||
<!-- for 的输入 -->
|
||||
</div>
|
||||
<div
|
||||
:style="{border:data.conditionType==3?'1px dotted #000':'',margin:data.conditionType==3?'5px 10px ':'',padding:data.conditionType==3?'8px':'',paddingLeft:'0px'}">
|
||||
{{typeof sdataJson!= 'object'&&typeof sdataJson!= 'array'&&data.conditionType==3?'此处不支持继续遍历请删除此节点':''}}
|
||||
<div v-for="(item,index) in data.children" style="display: flex;margin-top: 7px;">
|
||||
<div class="Rule_cont"
|
||||
:style="{marginTop:item.conditionType===0?'12px':(index===0?'11px':'20px')}">
|
||||
</div>
|
||||
<!-- conditionType==2 规则部分 -->
|
||||
<div v-if="item.conditionType==2" style="display: flex;">
|
||||
<!-- {{fieldType}} -->
|
||||
<div v-if="fieldType!='for'" style="display: flex;">
|
||||
<!-- 普通规则部分 -->
|
||||
|
||||
<!-- 不为输出节点 则拉选 fielduser-->
|
||||
<div v-if="data.conditionType!=4&&out!='out'" style="display: flex;">
|
||||
|
||||
<el-cascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj" clearable @change="ruleCascaderChange(item)"
|
||||
:key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @visible-change="randomAdd(item,$event)">
|
||||
</el-cascader>
|
||||
|
||||
<!-- <bigElCascader v-model="item.fieldEn" filterable size="mini" :options="fieldUserObj"
|
||||
clearable @change="ruleCascaderChange(item)" :Mykey="keyValue"
|
||||
:props="{ expandTrigger: 'hover' }"></bigElCascader> -->
|
||||
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue"
|
||||
:variableType.sync="item.variableType"
|
||||
:valueType="mixinGetValueTypeByJSONEn(item.fieldEn)" size="mini"></ruleRelation>
|
||||
|
||||
<!-- 加入 变量选择 -->
|
||||
</div>
|
||||
<div v-else style="display: flex;">
|
||||
<el-select v-model="item.fieldEn" size="mini" filterable
|
||||
@change="selectChange(item)">
|
||||
<el-option v-for="cont in suseingfield" :key="cont.id" :label="cont.fieldCn"
|
||||
:value="cont.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue"
|
||||
:variableType.sync="item.variableType"
|
||||
:valueType="mixinGetValueTypeByEn(item.fieldEn)" size="mini"></ruleRelation>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <el-input v-model="item.fieldValue" maxlength="30" size="mini" placeholder="请输入内容,最长30位"
|
||||
style="width: 100px;margin-left: 10px;"
|
||||
v-if="mixinGetValueTypeByEn(item.fieldEn)!==3&&['is empty','not empty'].indexOf(item.operator)==-1">
|
||||
</el-input>
|
||||
<el-select v-model="item.fieldValue" placeholder="请选择" size="mini"
|
||||
style="width: 100px;margin-left: 10px;"
|
||||
v-if="mixinGetValueTypeByEn(item.fieldEn)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
|
||||
</div>
|
||||
<div v-else style="display: flex;">
|
||||
<!-- {{sEn}} -->
|
||||
<!-- for规则部分 -->
|
||||
|
||||
<!-- {{sEn}} -->
|
||||
<el-cascader size="mini" filterable v-model="item.fieldEn" :options="getUserObj" @visible-change="randomAdd(item,$event)"
|
||||
:key="keyValue+(item.random?item.random:0)" :props="{ expandTrigger: 'hover' }" @change="forChange(item)">
|
||||
</el-cascader>
|
||||
|
||||
<ruleRelation v-model="item.operator" :value2.sync="item.fieldValue"
|
||||
:variableType.sync="item.variableType" :valueType="getvalueTypebyEn(item.fieldEn)"
|
||||
size="mini"></ruleRelation>
|
||||
<!-- <el-input v-model="item.fieldValue" maxlength="30" size="mini" placeholder="请输入内容,最长30位"
|
||||
style="width: 100px;margin-left: 10px;" v-if="getvalueTypebyEn(item.fieldEn)!==3&&['is empty','not empty'].indexOf(item.operator)==-1">
|
||||
</el-input>
|
||||
<el-select v-model="item.fieldValue" placeholder="请选择" size="mini"
|
||||
style="width: 100px;margin-left: 10px;" v-if="getvalueTypebyEn(item.fieldEn)===3">
|
||||
<el-option label="是" value="="></el-option>
|
||||
<el-option label="否" value="!="></el-option>
|
||||
</el-select> -->
|
||||
|
||||
</div>
|
||||
|
||||
<i class="el-icon-circle-close" style="color: #fa4949;margin-left: 5px;"
|
||||
@click="deleteSon(index)"></i>
|
||||
</div>
|
||||
<!-- conditionType==1 关系节点 conditionType==3 for的输出的关系节点 节点部分 -->
|
||||
<div v-if="item.conditionType==1||item.conditionType==3||item.conditionType==5">
|
||||
<!-- {{fieldType}} -->
|
||||
<rule :data="item" :suseingfield="suseingfield" :top="index" :out="out" :ZIndex="ZIndex+1"
|
||||
:sEn="En" :index="index" :sdataJson="dataJson" @delectLogical="delectLogical"
|
||||
:fieldType="data.conditionType==3||data.loopGroupActions.length>0||fieldType=='for'?'for':''">
|
||||
</rule>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="data.conditionType==3" style="margin-left: 25px;margin-top: 10px;">
|
||||
<!-- for 的输出 -->
|
||||
|
||||
<rule :suseingfield="useingfield" :out="'out'" :data="data.loopResultCondition" :ZIndex="ZIndex+1"
|
||||
@delectLogical="delectLogical"></rule>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="data.conditionType==5" class="RuleCont_for_out">
|
||||
<span style="font-size: 12px;margin-left: 5px;">命中条件:</span>
|
||||
[
|
||||
<el-input size="mini" v-model="data.condGroupResultCondition.children[0].fieldValue"
|
||||
style="width:150px;"></el-input>
|
||||
~
|
||||
<el-input size="mini" v-model="data.condGroupResultCondition.children[1].fieldValue"
|
||||
style="width:150px;"></el-input>
|
||||
]
|
||||
|
||||
</div>
|
||||
<div v-if="data.loopGroupActions.length>0" class="RuleCont_for_out">
|
||||
<div v-for="(item,index) in data.loopGroupActions"
|
||||
style="display: flex; align-items: center;margin-bottom: 5px;margin-left: 5px;">
|
||||
<el-select v-model="item.actionKey" style="width: 150px;" size="mini" filterable>
|
||||
<el-option v-for="cont in fielduser" :key="cont.id" :label="cont.fieldCn" :value="cont.fieldEn"
|
||||
v-if="item.actionType!=6||cont.valueType==6">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p>:</p>
|
||||
<el-select v-model="item.actionType" size="mini" filterable @change="GroupselectChange(item)"
|
||||
style="width: 100px;">
|
||||
<el-option :key="value.value" :label="value.label" :value="value.value"
|
||||
v-for="value in actionTypelist"></el-option>
|
||||
</el-select>
|
||||
<p v-if="item.actionType!=1">:</p>
|
||||
<el-input size="mini" style="width: 120px;" v-model="item.actionValue"
|
||||
v-if="[2,4,6,7].indexOf(item.actionType)!=-1"></el-input>
|
||||
|
||||
<el-cascader size="mini" style="width: 120px;" filterable v-model="item.actionValue"
|
||||
:options="getUserObj" :key="keyValue+(item.random?item.random:0)" v-if="item.actionType==3" @visible-change="randomAdd(item,$event)"
|
||||
:props="{ expandTrigger: 'hover' }"></el-cascader>
|
||||
|
||||
<i class="el-icon-circle-plus-outline" style="color: #66B1FF;margin-left: 3px;"
|
||||
@click="addLoopOut(index)"></i>
|
||||
<i class="el-icon-circle-close" style="color: #F56C6C;margin-left: 3px;" v-if="index!=0"
|
||||
@click="delectLoopOut(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import bigElCascader from '@/components/common/bigElCascader.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation,
|
||||
bigElCascader
|
||||
},
|
||||
name: 'rule',
|
||||
data() {
|
||||
return {
|
||||
color: ['#0D183E', '#409EFF', '#67C23A', '#F56C6C', '#FFCD43'],
|
||||
En: '',
|
||||
keyValue: 1, //用于给级联选择框重新渲染
|
||||
keyValueReady: false,
|
||||
actionTypelist: [{
|
||||
label: '计数',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '过滤',
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: '输出变量',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: '输出常量',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: '添加元素(去重)',
|
||||
value: 6
|
||||
},
|
||||
// {label:'元素添加',value:7},
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (this.data) {
|
||||
// console.log(this.data.fieldEn)
|
||||
if (Array.isArray(this.data.fieldEn)) {
|
||||
if (this.data.fieldEn.length > 0) {
|
||||
this.EnChange(this.data.fieldEn, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.keyValueReady = true
|
||||
if (this.sEn !== "") {
|
||||
this.En = this.sEn
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
props: {
|
||||
sdataJson: {
|
||||
type: Object | String | Number | Boolean,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
fieldType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
ZIndex: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
sEn: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
top: {
|
||||
tyep: String,
|
||||
default: '8px'
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
suseingfield: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
out: {
|
||||
type: String,
|
||||
default: 'unout'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
useingfield() {
|
||||
let arr = []
|
||||
this.deepGetUseing(this.data, arr)
|
||||
// console.log(arr)
|
||||
arr = arr.map(value => JSON.stringify(value))
|
||||
arr = new Set(arr)
|
||||
arr = Array.from(arr)
|
||||
arr = arr.map(value => JSON.parse(value))
|
||||
return arr
|
||||
},
|
||||
fieldUserObj() {
|
||||
if (this.$store.state.FieldUserObj) {
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
dataJson() {
|
||||
let obj = {}
|
||||
if (this.fieldType == "for") {
|
||||
obj = this.sdataJson
|
||||
} else if (Array.isArray(this.data.fieldEn)) {
|
||||
// console.log(1, this.data.fieldEn)
|
||||
obj = JSON.parse(this.mixinGetFieldByEn(this.data.fieldEn[0]).jsonValue)
|
||||
}
|
||||
if (Array.isArray(this.data.fieldEn)) {
|
||||
this.data.fieldEn.forEach((value, index) => {
|
||||
if (index != 0) {
|
||||
obj = obj[value]
|
||||
}
|
||||
})
|
||||
if (Array.isArray(obj)) {
|
||||
obj = obj[0]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return obj
|
||||
},
|
||||
getUserObj() {
|
||||
let arr = []
|
||||
|
||||
let obj = {
|
||||
value: '%' + this.sEn.split('.')[this.sEn.split('.').length - 1] + '%',
|
||||
label: '%元素%',
|
||||
}
|
||||
obj.children = this.getdeepObj(this.sdataJson)
|
||||
|
||||
arr.push(obj)
|
||||
let tempTypeArr = this.fielduser.filter((value) => {
|
||||
return value.valueType != 6
|
||||
})
|
||||
arr.push(...this.typeConversion(tempTypeArr))
|
||||
return arr
|
||||
},
|
||||
fielduserArr() {
|
||||
let arr = []
|
||||
// console.log(11,this.fielduser)
|
||||
if (this.fielduser.length > 1) {
|
||||
if (this.fieldType != "for") { // 如果元素不为 for 则 用fielduser里的 json 格式指标
|
||||
arr = this.fielduser.filter((value) => {
|
||||
return value.valueType == 6
|
||||
})
|
||||
|
||||
arr = arr.map((value) => {
|
||||
let obj = {
|
||||
value: value.fieldEn,
|
||||
label: value.fieldCn,
|
||||
}
|
||||
obj.children = this.getdeepArr(JSON.parse(value.jsonValue))
|
||||
return obj
|
||||
})
|
||||
} else { // 如果元素为 for 则 使用元素节点 进行二次遍历
|
||||
// console.log(this.sdataJson)
|
||||
let obj = {
|
||||
value: '%' + this.sEn.split('.')[this.sEn.split('.').length - 1] + '%',
|
||||
label: '%元素%'
|
||||
}
|
||||
let sarr = []
|
||||
|
||||
for (let key in this.sdataJson) {
|
||||
if (this.sdataJson.hasOwnProperty(key)) {
|
||||
// console.log(key)
|
||||
// console.log(this.sdataJson[key])
|
||||
if (typeof this.sdataJson[key] != "object" || this.sdataJson[key] == null) {
|
||||
continue
|
||||
}
|
||||
let sobj = {
|
||||
value: key,
|
||||
label: key
|
||||
}
|
||||
sobj.children = this.getdeepArr(this.sdataJson[key])
|
||||
sarr.push(sobj)
|
||||
}
|
||||
}
|
||||
obj.children = sarr
|
||||
arr.push(obj)
|
||||
}
|
||||
// console.log(arr)
|
||||
return arr
|
||||
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
deepGetUseing(obj, arr) {
|
||||
if (obj.loopGroupActions.length > 0) {
|
||||
obj.loopGroupActions.forEach(value => {
|
||||
arr.push({
|
||||
fieldEn: value.actionKey,
|
||||
fieldCn: this.mixinGetCnByEn(value.actionKey)
|
||||
})
|
||||
})
|
||||
}
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
this.deepGetUseing(value, arr)
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
GroupselectChange(item, e) {
|
||||
item.actionValue = ""
|
||||
|
||||
if (this.mixinGetValueTypeByEn(item.actionKey) != 6 && item.actionType == 6) {
|
||||
item.actionKey = ''
|
||||
}
|
||||
},
|
||||
forChange(item) {
|
||||
item.operator = ""
|
||||
},
|
||||
getvalueTypebyEn(e) { //通过En 获取 valueType
|
||||
if (!Array.isArray(e)) {
|
||||
return
|
||||
}
|
||||
if (e[0][0] !== '%') {
|
||||
return this.mixinGetValueTypeByEn(e[0])
|
||||
}
|
||||
if (e[e.length - 1] == 'length') {
|
||||
return 1
|
||||
}
|
||||
let str = this.sdataJson
|
||||
if (JSON.stringify(this.sdataJson) != '{}') {
|
||||
e.forEach((value, index) => {
|
||||
if (index != 0) {
|
||||
str = str[value]
|
||||
}
|
||||
})
|
||||
}
|
||||
// console.log(this.sdataJson)
|
||||
switch (typeof str) {
|
||||
case 'string':
|
||||
return 2
|
||||
break;
|
||||
case 'object':
|
||||
return 6
|
||||
break;
|
||||
case 'boolean':
|
||||
return 3
|
||||
break;
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
|
||||
},
|
||||
EnChange(e, clear = true) {
|
||||
|
||||
this.En = e.join('.')
|
||||
if (!clear) return
|
||||
this.deepClearEn(this.data)
|
||||
},
|
||||
deepClearEn(obj) { // 递归清除用到父级的 En
|
||||
obj.children.forEach(value => {
|
||||
if (Array.isArray(value.fieldEn)) {
|
||||
if (value.fieldEn[0][0] == "%") {
|
||||
value.fieldEn = ""
|
||||
}
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.deepClearEn(value)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
typeConversion(arr) {
|
||||
let arr2 = arr.map((value) => {
|
||||
return {
|
||||
label: value.fieldCn,
|
||||
value: value.fieldEn
|
||||
}
|
||||
})
|
||||
return arr2
|
||||
},
|
||||
getdeepArr(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
return false
|
||||
} else if (typeof obj == 'object') {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
} else if (typeof obj[key] == 'object') {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepArr(obj[key])
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
getdeepObj(obj) {
|
||||
if (typeof obj == 'object') {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: [{
|
||||
value: 'length()',
|
||||
label: '长度'
|
||||
}]
|
||||
})
|
||||
} else if (typeof obj[key] == 'object' && obj[key] != null) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children: this.getdeepObj(obj[key])
|
||||
})
|
||||
} else {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
},
|
||||
getObj(obj) {
|
||||
// console.log(obj)
|
||||
},
|
||||
delectLoopOut(index) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.loopGroupActions.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
addLoopOut(index) {
|
||||
this.data.loopGroupActions.splice(index + 1, 0, {
|
||||
"id": '',
|
||||
"actionType": "",
|
||||
"actionKey": "",
|
||||
"actionValue": "",
|
||||
})
|
||||
},
|
||||
delectLogical(index) {
|
||||
this.data.children.splice(index, 1)
|
||||
},
|
||||
handleCommand(str) {
|
||||
if (str == "addRule") { //添加规则
|
||||
// console.log(this.data)
|
||||
this.data.children.push({
|
||||
"logical": null,
|
||||
"fieldId": null,
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 2,
|
||||
"variableType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: [],
|
||||
loopResultCondition: {},
|
||||
condGroupResultCondition: {}
|
||||
})
|
||||
|
||||
|
||||
} else if (str == "addlogical") { //添加链接符
|
||||
let obj = {
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: [],
|
||||
loopResultCondition: {},
|
||||
condGroupResultCondition: {}
|
||||
}
|
||||
if (this.data.conditionType == 3) {
|
||||
obj.loopGroupActions.push({
|
||||
"actionType": 1,
|
||||
"actionKey": "",
|
||||
"actionValue": "",
|
||||
})
|
||||
obj.children.push({
|
||||
"logical": null,
|
||||
"fieldId": null,
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 2,
|
||||
"variableType": 1,
|
||||
"children": [],
|
||||
loopGroupActions: [],
|
||||
loopResultCondition: {}
|
||||
})
|
||||
}
|
||||
this.data.children.push(obj)
|
||||
|
||||
|
||||
} else if (str == "addfor") { // 添加循环规则
|
||||
this.data.children.push({
|
||||
"logical": 'for',
|
||||
"fieldId": "",
|
||||
"fieldEn":[],
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 3,
|
||||
"children": [],
|
||||
loopGroupActions: [],
|
||||
condGroupResultCondition: {},
|
||||
loopResultCondition: {
|
||||
loopGroupActions: [],
|
||||
"id": '',
|
||||
"actionType": "",
|
||||
"actionKey": "",
|
||||
"actionValue": "",
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 4,
|
||||
"children": [],
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else if (str == "delect") {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectLogical', this.index)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
} else if (str == "addcond") { //添加条件组
|
||||
this.data.children.push({
|
||||
"logical": 'condGroup',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 5, // 条件组 conditionType 为 5
|
||||
"children": [],
|
||||
loopGroupActions: [],
|
||||
loopResultCondition: {},
|
||||
condGroupResultCondition: {
|
||||
loopGroupActions: [],
|
||||
"id": '',
|
||||
"actionType": "",
|
||||
"actionKey": "",
|
||||
"actionValue": "",
|
||||
"logical": '&&',
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"conditionType": 6, // 条件组的值 conditionType 为 6
|
||||
"children": [{
|
||||
operator: ">=",
|
||||
fieldValue: "",
|
||||
fieldEn: "hitNum",
|
||||
conditionType: 2,
|
||||
variableType: 1,
|
||||
fieldType: 1,
|
||||
}, {
|
||||
operator: "<=",
|
||||
fieldEn: "hitNum",
|
||||
fieldValue: "",
|
||||
fieldType: 1,
|
||||
conditionType: 2,
|
||||
variableType: 1,
|
||||
}],
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteSon(index) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.data.children.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
ruleCascaderChange(item) {
|
||||
item.valueType = this.mixinGetValueTypeByJSONEn(item.fieldEn)
|
||||
item.fieldValue = ""
|
||||
item.operator = ""
|
||||
if (this.data.conditionType != 4 && this.out != 'out') {
|
||||
return
|
||||
} // 不为for的输出节点 及其后置节点 则退出
|
||||
item.fieldType = 1
|
||||
},
|
||||
selectChange(item) {
|
||||
item.valueType = this.mixinGetValueTypeByEn(item.fieldEn)
|
||||
item.fieldValue = ""
|
||||
item.operator = ""
|
||||
if (this.data.conditionType != 4 && this.out != 'out') {
|
||||
return
|
||||
} // 不为for的输出节点 及其后置节点 则退出
|
||||
item.fieldType = 1
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.fielduser.forEach(value => {
|
||||
if (value.id === cont) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
getUserObj() {
|
||||
if (this.keyValueReady) {
|
||||
this.keyValue++
|
||||
}
|
||||
|
||||
},
|
||||
fielduserArr() {
|
||||
if (this.keyValueReady) {
|
||||
this.keyValue++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
313
h5-enginex-manager/src/components/models/addResourceDialog.vue
Executable file
313
h5-enginex-manager/src/components/models/addResourceDialog.vue
Executable file
@@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<div class="user-edit-wrapper">
|
||||
<el-dialog
|
||||
title="资源配置"
|
||||
:visible.sync="dialogVisible"
|
||||
width="50%"
|
||||
:before-close="handleClose">
|
||||
<el-form ref="myform" :model="form" :rules="rules" label-width="80px" label-position="left">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="资源编号" prop="code">
|
||||
<el-input v-model="form.code" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="资源名" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="icon" prop="icon">
|
||||
<el-input v-model="form.icon" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="资源描述" prop="des">
|
||||
<el-input v-model="form.des" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="访问路径" prop="url">
|
||||
<el-input v-model="form.url" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="菜单排序" prop="sort">
|
||||
<el-input v-model="form.sort" autocomplete="off" minlength="1" maxlength="3"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="grid-conten">
|
||||
<h3 style="margin-bottom:30px">
|
||||
父类资源:
|
||||
</h3>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="grid-conten">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:props="props"
|
||||
node-key="id"
|
||||
:data="treeList"
|
||||
:current-node-key="checkedKeys"
|
||||
:highlight-current="true"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item class="btn-group">
|
||||
<el-button type="primary" @click="onSubmit('myform')">确认</el-button>
|
||||
<el-button @click="handleClose()">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getResourceTreeMenu , resourceUpdate , resourceSave} from '@/api/index.js'
|
||||
export default {
|
||||
name: 'resourceDialog',
|
||||
props:{
|
||||
dialogVisible:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dataItem:{
|
||||
type:Object,
|
||||
default(){
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
dataItem(newVal){
|
||||
this.dataItem = newVal;
|
||||
if(JSON.stringify(newVal) !=='{}'){
|
||||
this.form = {
|
||||
"name": newVal.name,
|
||||
"code": newVal.code,
|
||||
"url": newVal.url,
|
||||
"parentId": newVal.parentId,
|
||||
"des": newVal.des,
|
||||
"icon": newVal.icon,
|
||||
"sort":newVal.sort
|
||||
}
|
||||
this.parentId = newVal.parentId;
|
||||
this.checkedKeys=newVal.parentId;
|
||||
}
|
||||
},
|
||||
dialogVisible: function (val,oldVla) {
|
||||
if (this.$refs['myform'] != undefined) {
|
||||
this.$refs["myform"].resetFields();
|
||||
}
|
||||
this.getTreeList(this.parentId);
|
||||
}
|
||||
},
|
||||
data(){
|
||||
let checkSort = (rule,value,callback) => {
|
||||
console.log(value)
|
||||
if(value===0){
|
||||
return callback(new Error('超出可选范围(1-100)'));
|
||||
}
|
||||
if(!value) {
|
||||
return callback(new Error('菜单排序不能为空'));
|
||||
}else{
|
||||
if(value>0&&value<=100) {
|
||||
callback();
|
||||
}else{
|
||||
return callback(new Error('超出可选范围(1-100)'));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
return {
|
||||
form: {
|
||||
name: "",
|
||||
code: "",
|
||||
url: "",
|
||||
parentId: 0,
|
||||
des: "",
|
||||
icon: "",
|
||||
sort:1
|
||||
},
|
||||
parentId:0,
|
||||
rules:{
|
||||
name: [
|
||||
{ required: true, message: '请输入资源名称', trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '请输入资源代号', trigger: 'blur' }
|
||||
],
|
||||
des:[
|
||||
{ required: true, message: '请输入资源描述', trigger: 'blur' }
|
||||
],
|
||||
sort:[
|
||||
{validator: checkSort,required: true, trigger: 'blur'}
|
||||
]
|
||||
},
|
||||
props: {
|
||||
label: 'name',
|
||||
children: 'children'
|
||||
},
|
||||
treeList:[],
|
||||
// 默认选中节点
|
||||
checkedKeys: ""
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
handleNodeClick(data) {
|
||||
this.form.parentId=data.id;
|
||||
},
|
||||
getTreeData(data) {
|
||||
let treeArr = data;
|
||||
let result=[]
|
||||
for(let i =0;i<treeArr.length;i++){
|
||||
let item = treeArr[i];
|
||||
if(item.parentId===0){
|
||||
result.push(item);
|
||||
}
|
||||
}
|
||||
this.data2treeDG(treeArr,result);
|
||||
},
|
||||
data2treeDG(datas, dataArray,type){
|
||||
for (let j = 0; j < dataArray.length; j++) {
|
||||
let dataArrayIndex = dataArray[j];
|
||||
let childrenArray = [];
|
||||
let Id = dataArrayIndex.id;
|
||||
if(dataArrayIndex.checked){
|
||||
this.checkedKeys=dataArrayIndex.id
|
||||
}
|
||||
for (let i = 0; i < datas.length; i++) {
|
||||
let data = datas[i];
|
||||
let parentId = data.parentId;
|
||||
if (parentId == Id) {//判断是否为儿子节点
|
||||
childrenArray.push(data);
|
||||
}
|
||||
}
|
||||
dataArrayIndex.children = childrenArray;
|
||||
if (childrenArray.length > 0) {//有儿子节点则递归
|
||||
this.data2treeDG(datas, childrenArray)
|
||||
}
|
||||
}
|
||||
this.treeList = dataArray;
|
||||
},
|
||||
// 新增或编辑
|
||||
onSubmit(myForm) {
|
||||
let form=this.form;
|
||||
this.$refs[myForm].validate((valid) => {
|
||||
if (valid) {
|
||||
if(JSON.stringify(this.dataItem)=='{}'){
|
||||
// 新增
|
||||
this.saveResource(form);
|
||||
}else{
|
||||
// 编辑
|
||||
form.id=this.dataItem.id
|
||||
this.updateResource(form);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
async updateResource(form){
|
||||
const data = await resourceUpdate(form)
|
||||
if(data.status != "0"){
|
||||
if(data.data){
|
||||
this.$message({
|
||||
message: '修改成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
async saveResource(form){
|
||||
const data = await resourceSave(form)
|
||||
if(data.status != "0"){
|
||||
if(data.data){
|
||||
this.$message({
|
||||
message: '添加成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
async getTreeList(id){
|
||||
const data = await getResourceTreeMenu({
|
||||
"parentId": id
|
||||
})
|
||||
if(data.status !="0"){
|
||||
this.getTreeData(data.data);
|
||||
this.$nextTick(() => {
|
||||
if(this.parentId!=0){
|
||||
this.$refs.tree.setCurrentKey(this.checkedKeys)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.form ={
|
||||
"name": "",
|
||||
"code": "",
|
||||
"url": "",
|
||||
"parentId": null,
|
||||
"des": "",
|
||||
"icon": "",
|
||||
"sort":1
|
||||
}
|
||||
this.$refs["myform"].resetFields();
|
||||
this.$emit('closeEvent');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-dialog__body{
|
||||
padding: 20px 40px;
|
||||
}
|
||||
.user-edit-wrapper .el-input{
|
||||
width: 80%;
|
||||
}
|
||||
.user-edit-wrapper .btn-group{
|
||||
margin-top: 30px;
|
||||
}
|
||||
.user-edit-wrapper .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{
|
||||
background: #409EFF;
|
||||
color: #fff;
|
||||
}
|
||||
.user-edit-wrapper .is-checked{
|
||||
background: #F5F7FA;
|
||||
}
|
||||
|
||||
</style>
|
||||
295
h5-enginex-manager/src/components/models/addUserDialog.vue
Executable file
295
h5-enginex-manager/src/components/models/addUserDialog.vue
Executable file
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<div class="user-edit-wrapper">
|
||||
<el-dialog title="配置账号" :visible.sync="dialogVisible" width="50%" @open="open" :before-close="handleClose">
|
||||
<el-form ref="myform" :model="form" :rules="rules" label-width="80px" label-position="left">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="账号" prop="account">
|
||||
<el-input v-model="form.account"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="公司" prop="organId">
|
||||
<el-select v-model="form.organId" :disabled="listOrganArr.length==1?true:false" placeholder="" @change="organChange">
|
||||
<el-option v-for="item in listOrganArr" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="角色">
|
||||
<el-select v-model="form.sysRole" placeholder="">
|
||||
<el-option v-for="item in validRoleArr" :key="item.id" :label="item.roleName" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
<h3 style="margin-bottom:40px">
|
||||
使用人信息:
|
||||
</h3>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="员工编号" prop="employeeId">
|
||||
<el-input v-model="form.employeeId"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="姓名" prop="nickName">
|
||||
<el-input v-model="form.nickName"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="手机号" prop="cellphone">
|
||||
<el-input v-model="form.cellphone"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="form.email"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-form-item class="btn-group">
|
||||
<el-button type="primary" @click="onSubmit('myform')">确认</el-button>
|
||||
<el-button @click="handleClose()">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getAllValidRole,
|
||||
saveUser,
|
||||
updateUser
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
name: 'userDialog',
|
||||
props: {
|
||||
dialogVisible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dataItem: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
listOrganArr: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
watch: {
|
||||
dataItem(newVal) {
|
||||
this.dataItem = newVal;
|
||||
if (JSON.stringify(newVal) !== '{}') {
|
||||
this.validRole(newVal.sysOrgan.id);
|
||||
this.disabled = true;
|
||||
this.form = {
|
||||
organId: newVal.organId,
|
||||
employeeId: newVal.employeeId,
|
||||
account: newVal.account,
|
||||
nickName: newVal.nickName,
|
||||
cellphone: newVal.cellphone,
|
||||
email: newVal.email,
|
||||
sysRole: newVal.sysRole.id
|
||||
}
|
||||
}
|
||||
},
|
||||
dialogVisible: function(val, oldVla) {
|
||||
console.log(1)
|
||||
if (this.$refs['myform'] != undefined) {
|
||||
this.$refs["myform"].resetFields();
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let checkPhone = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('手机号不能为空'));
|
||||
} else {
|
||||
const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
|
||||
if (reg.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
return callback(new Error('请输入正确的手机号'));
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
text: "text",
|
||||
form: {
|
||||
organId: '',
|
||||
employeeId: '',
|
||||
account: '',
|
||||
nickName: '',
|
||||
cellphone: '',
|
||||
email: '',
|
||||
sysRole: ''
|
||||
},
|
||||
disabled: false,
|
||||
validRoleArr: [],
|
||||
rules: {
|
||||
account: [{
|
||||
required: true,
|
||||
message: '请输入账号',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
nickName: [{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
cellphone: [{
|
||||
validator: checkPhone,
|
||||
required: true,
|
||||
trigger: 'blur'
|
||||
}],
|
||||
email: [{
|
||||
required: true,
|
||||
message: '请输入邮箱',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
type: 'email',
|
||||
message: '请输入正确的邮箱地址',
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
employeeId: [{
|
||||
required: true,
|
||||
message: '请输入员工编号',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
organId: [{
|
||||
required: true,
|
||||
message: '请选择公司',
|
||||
trigger: 'change'
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
if (this.listOrganArr.length == 1) {
|
||||
this.form.organId = this.listOrganArr[0].id
|
||||
this.organChange(this.listOrganArr[0].id)
|
||||
}
|
||||
},
|
||||
organChange(e) {
|
||||
this.validRoleArr = [];
|
||||
this.form.sysRole = "";
|
||||
this.validRole(e);
|
||||
},
|
||||
// 新增或编辑名单库
|
||||
onSubmit(myForm) {
|
||||
let form = this.form;
|
||||
form.sysRole = {
|
||||
id: this.form.sysRole
|
||||
}
|
||||
this.$refs[myForm].validate((valid) => {
|
||||
if (valid) {
|
||||
if (JSON.stringify(this.dataItem) == '{}') {
|
||||
// 新增
|
||||
this.save(form);
|
||||
} else {
|
||||
// 编辑
|
||||
form.id = this.dataItem.id
|
||||
this.update(form);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
async save(form) {
|
||||
const data = await saveUser(form)
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '添加成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
|
||||
},
|
||||
async update(form) {
|
||||
const data = await updateUser(form)
|
||||
if (data.status != "0") {
|
||||
if (data.data) {
|
||||
this.$message({
|
||||
message: '修改成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
async validRole(id) {
|
||||
const data = await getAllValidRole({
|
||||
"organId": id
|
||||
})
|
||||
if (data.status != "0") {
|
||||
this.validRoleArr = data.data
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.form = {
|
||||
organId: '',
|
||||
employeeId: '',
|
||||
account: '',
|
||||
nickName: '',
|
||||
cellphone: '',
|
||||
email: '',
|
||||
sysRole: ''
|
||||
}
|
||||
this.validRoleArr = [];
|
||||
this.disabled = false;
|
||||
this.$emit('closeEvent');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-dialog__body {
|
||||
padding: 20px 40px;
|
||||
}
|
||||
|
||||
.user-edit-wrapper .el-input {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.user-edit-wrapper .btn-group {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
317
h5-enginex-manager/src/components/models/authorityAssignmentDialog.vue
Executable file
317
h5-enginex-manager/src/components/models/authorityAssignmentDialog.vue
Executable file
@@ -0,0 +1,317 @@
|
||||
<template>
|
||||
<div class="user-edit-wrapper">
|
||||
<el-dialog title="角色配置" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
|
||||
<el-form ref="myform" :model="form" label-width="80px" label-position="left">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="角色名">
|
||||
<el-input v-model="form.roleName" autocomplete="off" :disabled="disabled"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-conten">
|
||||
<el-form-item label="所属公司">
|
||||
<el-select v-model="form.organId" :disabled="disabled">
|
||||
<el-option v-for="item in listOrganArr" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<h3 style="margin-bottom:30px">
|
||||
功能权限:
|
||||
</h3>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<!-- <h3 style="margin-bottom:30px">
|
||||
搜索引擎子权限:
|
||||
</h3> -->
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<el-tree ref="tree" :props="props" :data="treeList" show-checkbox node-key="id" :default-checked-keys="checkedKeys"
|
||||
@check-change="findTreeChange">
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-conten">
|
||||
<!-- <el-tree
|
||||
ref="engineTree"
|
||||
:props="props"
|
||||
:data="engineList"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
:default-checked-keys="engineCheckedKeys"
|
||||
@check-change="engineTreeChange"
|
||||
>
|
||||
</el-tree> -->
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-form-item class="btn-group">
|
||||
|
||||
<el-button @click="handleClose()">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit()">确认</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getFindTreeList,
|
||||
getEngineTree,
|
||||
insertRoleMenu,
|
||||
insertRoleEngine
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
name: 'authorityAssignmentDialog',
|
||||
props: {
|
||||
dialogVisible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dataItem: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
listOrganArr: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dataItem(newVal) {
|
||||
this.dataItem = newVal;
|
||||
if (JSON.stringify(newVal) !== '{}') {
|
||||
this.getTreeList(newVal.id);
|
||||
// this.getEngineTreeList(newVal.id);
|
||||
this.form = {
|
||||
roleId: newVal.id,
|
||||
organId: newVal.organId,
|
||||
roleName: newVal.roleName
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
roleId: '',
|
||||
organId: '',
|
||||
roleName: ''
|
||||
},
|
||||
disabled: true,
|
||||
props: {
|
||||
label: 'name',
|
||||
children: 'children'
|
||||
},
|
||||
count: 1,
|
||||
treeList: [],
|
||||
engineList: [],
|
||||
// 默认选中节点
|
||||
checkedKeys: [],
|
||||
engineCheckedKeys: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
findTreeChange(data, checked, indeterminate) {
|
||||
let nodes = this.$refs.tree.getCheckedNodes()
|
||||
this.checkedKeys = nodes.map(item => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
},
|
||||
// 搜索引擎子权限:
|
||||
// engineTreeChange(data,checked,indeterminate){
|
||||
// let nodes = this.$refs.engineTree.getCheckedNodes()
|
||||
// this.engineCheckedKeys = nodes.map(item => {
|
||||
// return item.id
|
||||
// })
|
||||
// },
|
||||
getTreeData(data, type) {
|
||||
|
||||
let treeArr = data;
|
||||
let result = []
|
||||
for (let i = 0; i < treeArr.length; i++) {
|
||||
let item = treeArr[i];
|
||||
if (item.parentId == 0) {
|
||||
result.push(item);
|
||||
}
|
||||
}
|
||||
this.data2treeDG(treeArr, result, type);
|
||||
},
|
||||
data2treeDG(datas, dataArray, type) {
|
||||
// console.log(datas, dataArray, type)
|
||||
|
||||
|
||||
for (let j = 0; j < dataArray.length; j++) {
|
||||
let dataArrayIndex = dataArray[j];
|
||||
let childrenArray = [];
|
||||
let Id = dataArrayIndex.id;
|
||||
if (dataArrayIndex.checked) {
|
||||
(type == 1) ? this.checkedKeys.push(dataArrayIndex.id): this.engineCheckedKeys.push(dataArrayIndex.id)
|
||||
}
|
||||
for (let i = 0; i < datas.length; i++) {
|
||||
let data = datas[i];
|
||||
let parentId = data.parentId;
|
||||
if (parentId == Id) { //判断是否为儿子节点
|
||||
childrenArray.push(data);
|
||||
if (data.checked) {
|
||||
(type == 1) ? this.checkedKeys.push(data.id): this.engineCheckedKeys.push(data.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
dataArrayIndex.children = childrenArray;
|
||||
if (childrenArray.length > 0) { //有儿子节点则递归
|
||||
this.data2treeDG(datas, childrenArray)
|
||||
}
|
||||
}
|
||||
if (type == 1) {
|
||||
this.treeList = dataArray;
|
||||
// console.log(this.treeList)
|
||||
} else {
|
||||
this.engineList = dataArray;
|
||||
}
|
||||
},
|
||||
// 新增或编辑
|
||||
onSubmit() {
|
||||
|
||||
|
||||
|
||||
this.checkedKeys.forEach(value => {
|
||||
if (this.deepparentId(value)) {
|
||||
this.checkedKeys.push(this.deepparentId(value))
|
||||
}
|
||||
|
||||
})
|
||||
let arr = this.unique(this.checkedKeys)
|
||||
this.updateInsertRoleMenu({
|
||||
roleId: this.dataItem.id,
|
||||
ids: arr.join(',')
|
||||
})
|
||||
// 搜索引擎子权限:
|
||||
// this.updateInsertRoleEngine({
|
||||
// roleId:this.dataItem.id,
|
||||
// ids:this.engineCheckedKeys.join(',')
|
||||
// })
|
||||
},
|
||||
unique(arr) {
|
||||
return Array.from(new Set(arr))
|
||||
},
|
||||
deepparentId(id) {
|
||||
let num
|
||||
this.treeList.forEach(value => {
|
||||
if (value.id == id) {
|
||||
num = value.parentId
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
value.children.forEach(item => {
|
||||
if (item.id == id) {
|
||||
num = item.parentId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
|
||||
},
|
||||
async updateInsertRoleMenu(form) {
|
||||
const data = await insertRoleMenu(form)
|
||||
if (data.status != "0") {
|
||||
if (data.data) {
|
||||
this.$message({
|
||||
message: '修改成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
async updateInsertRoleEngine(form) {
|
||||
const data = await insertRoleEngine(form)
|
||||
if (data.status != "0") {
|
||||
if (data.data) {
|
||||
this.$message({
|
||||
message: '修改成功!',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
async getTreeList(id) {
|
||||
const data = await getFindTreeList({
|
||||
"roleId": id
|
||||
})
|
||||
if (data.status != "0") {
|
||||
data.data.forEach(value=>{
|
||||
if(!value.checked){
|
||||
data.data.forEach(item=>{
|
||||
if(item.id==value.parentId){
|
||||
item.checked = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
this.getTreeData(data.data, 1);
|
||||
}
|
||||
},
|
||||
async getEngineTreeList(id) {
|
||||
const data = await getEngineTree({
|
||||
"roleId": id
|
||||
})
|
||||
if (data.status != "0") {
|
||||
|
||||
this.getTreeData(data.data, 2);
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.form = {
|
||||
roleId: '',
|
||||
organId: '',
|
||||
roleName: ''
|
||||
}
|
||||
this.checkedKeys = [];
|
||||
this.$emit('closeEvent');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-dialog__body {
|
||||
padding: 20px 40px;
|
||||
}
|
||||
|
||||
.user-edit-wrapper .el-input {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.user-edit-wrapper .btn-group {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
327
h5-enginex-manager/src/components/models/batchTest.vue
Executable file
327
h5-enginex-manager/src/components/models/batchTest.vue
Executable file
@@ -0,0 +1,327 @@
|
||||
<template>
|
||||
<div v-show="upShow">
|
||||
<el-dialog title="上传测试文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div v-loading="Uploadloading">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;" :disabled="true">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload">
|
||||
<el-button slot="trigger" size="small" type="primary" style="margin-top: 60px;">选取文件</el-button>
|
||||
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer" style="margin-left: 30%;margin-top: 30px;">
|
||||
|
||||
<el-button slot="trigger" size="mini" type="primary" @click="accessTemplate">下载模板</el-button>
|
||||
<!-- getDownloadJsonField -->
|
||||
<el-button slot="trigger" size="mini" type="primary" @click="JsonFieldOpen">查看JSON</el-button>
|
||||
<el-button @click="$emit('upshowf')">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload()" :disabled="fileName?false:'disabled'">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="查看JSON" :visible.sync="JsonField" width="50%" append-to-body >
|
||||
<div v-loading="JsonFieldloading">
|
||||
|
||||
<el-input type="textarea" rows="20" id="tempJsonValue" :value="tempJson">
|
||||
|
||||
</el-input>
|
||||
<div slot="footer" class="dialog-footer" style="margin-left: 50%;margin-top: 30px;">
|
||||
<el-button type="primary" @click="copy">复制</el-button>
|
||||
<el-button type="primary" @click="JsonField=false">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="批量测试结果" :visible.sync="resultShow" width="50%" append-to-body >
|
||||
<div>
|
||||
<el-row class="top-head">
|
||||
<el-col :span="8"><div class="grid-content">执行状态</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">执行结果</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">条数</div></el-col>
|
||||
</el-row>
|
||||
<div class="result-box">
|
||||
<el-row v-for="(item,key) in result.success">
|
||||
<el-col :span="8"><div class="grid-content">成功</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">{{key?key:key==0?'0':'-'}}</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">{{item?item:'-'}}</div></el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8"><div class="grid-content">失败</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">-</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">{{result.failNum}}</div></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<el-row>
|
||||
<el-col :span="8"><div class="grid-content">总计</div></el-col>
|
||||
<el-col :span="8"><div class="grid-content"> </div></el-col>
|
||||
<el-col :span="8"><div class="grid-content">{{result.total}}</div></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getDownloadJsonField,
|
||||
batchTest
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
components: {
|
||||
getDownloadJsonField
|
||||
},
|
||||
props: {
|
||||
upShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
versionId: {
|
||||
type: Number | String,
|
||||
default: 0
|
||||
},
|
||||
engid:{
|
||||
type:Number | String,
|
||||
default:null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
JsonField: false,
|
||||
Uploadloading: false,
|
||||
fileName: '',
|
||||
fileList: [],
|
||||
tempJson: '',
|
||||
JsonFieldloading: false,
|
||||
resultloading:false,
|
||||
resultShow:false,
|
||||
result:{}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
copy() {
|
||||
var Url2 = document.getElementById("tempJsonValue");
|
||||
Url2.select(); // 选择对象
|
||||
document.execCommand("Copy")
|
||||
this.$message({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
});
|
||||
},
|
||||
JsonFieldOpen() {
|
||||
this.tempJson = ""
|
||||
this.JsonFieldloading = true
|
||||
this.JsonField = true
|
||||
getDownloadJsonField({
|
||||
versionId: Number(this.versionId)
|
||||
}).then(res => {
|
||||
this.JsonFieldloading = false
|
||||
if (res.status == 1) {
|
||||
this.tempJson = JSON.stringify(JSON.parse(res.data), null, 4)
|
||||
} else {
|
||||
this.tempJson = '暂无数据'
|
||||
}
|
||||
}).catch(err => {
|
||||
this.JsonFieldloading = false
|
||||
})
|
||||
},
|
||||
accessTemplate() {
|
||||
var that = this
|
||||
let size = 0;
|
||||
var data = {
|
||||
versionId: Number(this.versionId),
|
||||
}
|
||||
this.Uploadloading = true
|
||||
fetch('/Riskmanage/v2/engine/createSampleData', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
'token': localStorage.getItem("token"),
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
// console.log(response)
|
||||
return response;
|
||||
} else {
|
||||
// console.log("请求失败")
|
||||
}
|
||||
})
|
||||
.then(response => response.body)
|
||||
.then(body => {
|
||||
const reader = body.getReader();
|
||||
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
return pump();
|
||||
|
||||
function pump() {
|
||||
return reader.read().then(res => { //res ({ done, value })
|
||||
// 读不到更多数据就关闭流
|
||||
// console.log(res, "res");
|
||||
const {
|
||||
done,
|
||||
value
|
||||
} = res;
|
||||
if (done) {
|
||||
// console.log("end")
|
||||
controller.close();
|
||||
// return;
|
||||
}
|
||||
size += value.length || 0;
|
||||
// console.log(size, "size")
|
||||
// 将下一个数据块置入流中
|
||||
controller.enqueue(value);
|
||||
// this.Uploadloading = false
|
||||
return pump();
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
.then(stream => new Response(stream))
|
||||
.then(response => that.savingFile(response, '引擎入参.xlsx'))
|
||||
.catch(err => console.error(err));
|
||||
},
|
||||
beforeUpload(file) {
|
||||
// console.log(file, '文件');
|
||||
this.files = file;
|
||||
const extension = file.name.split('.')[1] === 'xls'
|
||||
const extension2 = file.name.split('.')[1] === 'xlsx'
|
||||
const isLt2M = file.size / 1024 / 1024 < 5
|
||||
if (!extension && !extension2) {
|
||||
this.$message.warning('上传模板只能是 xls、xlsx格式!')
|
||||
return
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.warning('上传模板大小不能超过 5MB!')
|
||||
return
|
||||
}
|
||||
this.fileName = file.name;
|
||||
return false // 返回false不会自动上传
|
||||
},
|
||||
submitUpload() {
|
||||
this.Uploadloading = true
|
||||
// console.log('上传' + this.files.name)
|
||||
if (this.fileName == "") {
|
||||
this.$message.warning('请选择要上传的文件!')
|
||||
this.Uploadloading = false
|
||||
return false
|
||||
}
|
||||
let fileFormData = new FormData();
|
||||
fileFormData.append('file', this.files); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名
|
||||
fileFormData.append('engineId',this.engid)
|
||||
this.batchTest(fileFormData).then(res=>{
|
||||
if (res.status === "1") {
|
||||
this.upShowClose()
|
||||
this.resultShow=true;
|
||||
this.result = res.data;
|
||||
}
|
||||
this.Uploadloading = false
|
||||
})
|
||||
// console.log(this.getData)
|
||||
// this.getData.fieldsubmit(fileFormData).then(res => {
|
||||
// if (res.status === "1") {
|
||||
|
||||
// this.upShowClose()
|
||||
// }
|
||||
// this.Uploadloading = false
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
upShowClose() {
|
||||
this.$emit('upshowf')
|
||||
},
|
||||
savingFile(response, fileName) {
|
||||
const that = this;
|
||||
response.blob().then(blob => {
|
||||
|
||||
if (typeof FileReader === 'undefined') {
|
||||
notification.open({
|
||||
message: '您的浏览器不支持 FileReader,请升级浏览器',
|
||||
})
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("loadend", function() {
|
||||
let resu = '';
|
||||
try {
|
||||
resu = JSON.parse(reader.result);
|
||||
// resu = eval('('+ reader.result + ')')
|
||||
if (resu.code == 500) {
|
||||
notification.open({
|
||||
message: resu.msg,
|
||||
})
|
||||
} else if (resu.code == 401) {
|
||||
notification.error({
|
||||
message: resu.msg
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
that.Uploadloading = false
|
||||
//捕获错误 说明是文本字符串
|
||||
resu = reader.result;
|
||||
downloadBlob(blob, fileName);
|
||||
}
|
||||
|
||||
});
|
||||
reader.readAsText(blob);
|
||||
|
||||
//下载
|
||||
function downloadBlob(blob, fileName) {
|
||||
let blobUrl = window.URL.createObjectURL(blob);
|
||||
let a = document.createElement('a');
|
||||
a.href = blobUrl;
|
||||
a.target = '_blank';
|
||||
a.style.display = 'none'
|
||||
document.body.appendChild(a)
|
||||
a.download = fileName;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
document.body.removeChild(a)
|
||||
that.Uploadloading = false
|
||||
// that.setState({
|
||||
// downloading: false
|
||||
// })
|
||||
}
|
||||
}).catch(err => {
|
||||
that.Uploadloading = false
|
||||
// console.log(err)
|
||||
if (err == 'TypeError: Failed to fetch') {
|
||||
that.accessTemplate()
|
||||
}
|
||||
})
|
||||
},
|
||||
async batchTest(param) {
|
||||
const data = await batchTest(param);
|
||||
return data
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.result-box{
|
||||
min-height:100px;
|
||||
max-height:300px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
.top-head .grid-content{
|
||||
background:#F2F6FC;
|
||||
}
|
||||
.grid-content{
|
||||
line-height:35px;
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
290
h5-enginex-manager/src/components/models/detail.vue
Executable file
290
h5-enginex-manager/src/components/models/detail.vue
Executable file
@@ -0,0 +1,290 @@
|
||||
<template>
|
||||
<div class="detailmodel" >
|
||||
|
||||
<el-card shadow="never" v-loading="loading">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="$emit('close')"></el-button>
|
||||
</div>
|
||||
<el-form :model="model" :rules="rules" ref="modelFrom" label-width="150px">
|
||||
<el-form-item class="cWidth" label="模型名称:" prop="modelName">
|
||||
<el-input v-model="model.modelName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item class="cWidth" label="模型描述:">
|
||||
<el-input v-model="model.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模型文件:">
|
||||
<single-upload @getMessage="uploadSuccess" :fileList='fileList'></single-upload>
|
||||
</el-form-item>
|
||||
<el-card class="box-card card_left" shadow='never'>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>模型解析字段</span>
|
||||
</div>
|
||||
<div class="overSro">
|
||||
<div v-for="item in model.modelFieldArr" class="text item">
|
||||
{{item}}
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="card_left padding_bot">
|
||||
<el-transfer filterable :filter-method="filterMethod" :titles="titles" target-order="push" filter-placeholder="请输入字段名称"
|
||||
v-model="model.mappingFieldArr" :data="transferData">
|
||||
</el-transfer>
|
||||
</div>
|
||||
<el-form-item class="cWidth" label="输出字段:" prop="resultFieldEn">
|
||||
|
||||
<outcontent :outcontent="model.tacticsOutputList" type="models" style="margin-top: 20px;margin-left: 50px;">
|
||||
<div style="display:flex; align-items: center;">
|
||||
<el-select v-model="model.resultFieldEn" filterable placeholder="请选择" style="width: 200px;">
|
||||
<el-option v-for="item in FieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<p style="margin: 10px;">
|
||||
=
|
||||
</p>
|
||||
<el-select filterable value="预测结果" disabled style="width: 255px;">
|
||||
</el-select>
|
||||
</div>
|
||||
</outcontent>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit('modelFrom')">提交</el-button>
|
||||
<el-button v-if="!isEdit" @click="resetForm('modelFrom')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getAllFields,
|
||||
saveModel,
|
||||
updateModel,
|
||||
getModelDetailInfo
|
||||
} from '../../api/index';
|
||||
import outcontent from '@/components/models/outcontent.vue'
|
||||
|
||||
import SingleUpload from '@/components/upload/singleUpload'
|
||||
const defaultModel = {
|
||||
tacticsOutputList: [],
|
||||
modelName: '',
|
||||
description: '',
|
||||
fileName: '',
|
||||
resultFieldEn: '',
|
||||
filePath: '',
|
||||
modelFieldArr: [],
|
||||
mappingFieldArr: [],
|
||||
};
|
||||
export default {
|
||||
name: 'BrandDetail',
|
||||
components: {
|
||||
SingleUpload,
|
||||
outcontent,
|
||||
},
|
||||
props: {
|
||||
isEdit: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
model: Object.assign({}, defaultModel),
|
||||
fileList: [], // 回显文件信息
|
||||
rules: {
|
||||
modelName: [{
|
||||
required: true,
|
||||
message: '请输入模型名称',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
min: 2,
|
||||
max: 100,
|
||||
message: '长度在 2 到 100 个字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
transferData: [],
|
||||
titles: ['待选指标', '已选指标'],
|
||||
filterMethod(query, item) {
|
||||
return item.label.indexOf(query) > -1;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.model.tacticsOutputList = []
|
||||
this.getAllFields();
|
||||
this.dogetModelDetailInfo();
|
||||
},
|
||||
methods: {
|
||||
async getAllFields() {
|
||||
const {
|
||||
data
|
||||
} = await getAllFields();
|
||||
this.transferData = data;
|
||||
},
|
||||
dogetModelDetailInfo() {
|
||||
if (this.isEdit) {
|
||||
this.loading = true
|
||||
getModelDetailInfo(this.id).then(({
|
||||
data
|
||||
}) => {
|
||||
this.loading = false
|
||||
this.model = data;
|
||||
this.fileList.push({
|
||||
name: data.fileName,
|
||||
url: data.filePath
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.model = JSON.parse(JSON.stringify(defaultModel));
|
||||
}
|
||||
},
|
||||
uploadSuccess(data) {
|
||||
this.model.fileName = data.fileName;
|
||||
this.model.filePath = data.filePath;
|
||||
this.model.modelFieldArr = data.fieldList;
|
||||
},
|
||||
|
||||
onSubmit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.model.fileName == '') {
|
||||
this.$message({
|
||||
message: '请先上传模型文件',
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (this.model.modelFieldArr.length != this.model.mappingFieldArr.length) {
|
||||
this.$message({
|
||||
message: '模型解析字段和映射字段数量不一致',
|
||||
type: 'error',
|
||||
duration: 3000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
let is =false
|
||||
this.model.tacticsOutputList.forEach(value => {
|
||||
if (value.fieldId === "" || String(value.fieldValue).trim() === "" || value.variableType === "") {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
if(is){
|
||||
this.$message.error('请检查输出字段是否填写')
|
||||
return false
|
||||
}
|
||||
|
||||
this.$confirm('是否提交数据', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
if (this.isEdit) {
|
||||
this.loading = true
|
||||
updateModel(this.$route.query.id, this.model).then(response => {
|
||||
if (response.error == '00000000') {
|
||||
this.$refs[formName].resetFields();
|
||||
this.model.tacticsOutputList = []
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
this.$emit('close')
|
||||
}
|
||||
this.loading = false
|
||||
});
|
||||
} else {
|
||||
this.loading = true
|
||||
saveModel(this.model).then(response => {
|
||||
if (response.error == '00000000') {
|
||||
this.$refs[formName].resetFields();
|
||||
this.model.tacticsOutputList = []
|
||||
this.model = JSON.parse(JSON.stringify(defaultModel))
|
||||
this.$message({
|
||||
message: '提交成功',
|
||||
type: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
this.$emit('close')
|
||||
}
|
||||
this.loading = false
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.$message({
|
||||
message: '验证失败',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.model = JSON.parse(JSON.stringify(defaultModel));
|
||||
this.model.tacticsOutputList = []
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.detailmodel {
|
||||
padding-bottom: 20px;
|
||||
height: 100%;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both
|
||||
}
|
||||
|
||||
.box-card {
|
||||
width: 582px;
|
||||
}
|
||||
|
||||
.cWidth {
|
||||
width: 650px;
|
||||
}
|
||||
|
||||
.card_left {
|
||||
margin: 0 0px 24px 68px;
|
||||
}
|
||||
|
||||
.padding_bot {
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
.overSro {
|
||||
height: 220px !important;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
149
h5-enginex-manager/src/components/models/fieldUserDialog.vue
Executable file
149
h5-enginex-manager/src/components/models/fieldUserDialog.vue
Executable file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div class="field-wrapper">
|
||||
<el-dialog title="输入参数" :visible.sync="isShow" width="50%" :before-close="fieldClose">
|
||||
<div class="rule_dialg_header" style="padding-left:0;">
|
||||
当前选项为: {{radio.fieldCn}}
|
||||
<div>
|
||||
<el-input v-model="search" maxlength="30" placeholder="快速搜索"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rule_dialg_cont">
|
||||
<div v-for="(value,index) in fradioList" :key="index">
|
||||
|
||||
<el-radio v-model="active" :label="value.id" border size="mini" @change="change">{{value.fieldCn}}</el-radio>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="fieldClose">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSure()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
isShow:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
radioList:{
|
||||
type:Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
radio: {},
|
||||
search:"",
|
||||
active:""
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.$store.dispatch('getfielduser')
|
||||
},
|
||||
computed: {
|
||||
outPutUser() {
|
||||
if (this.$store.state.Output) {
|
||||
return this.$store.state.Output.data.paramMap.fieldList
|
||||
} else {
|
||||
return this.$store.state.Output
|
||||
}
|
||||
},
|
||||
fradioList() {
|
||||
if(this.search!=""){
|
||||
let arr = []
|
||||
arr=this.radioList.filter(value=>{
|
||||
if(value.fieldCn.indexOf(this.search)!=-1){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
})
|
||||
return arr
|
||||
}else{
|
||||
return this.radioList
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
change(e){
|
||||
this.active = e;
|
||||
// this.radio=this.radioList[this.active];
|
||||
this.radio=this.mixinGetValueById(e)
|
||||
},
|
||||
fieldClose(){
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
this.radio={};
|
||||
this.search="";
|
||||
this.active="";
|
||||
this.$emit('fieldClose');
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
dialogSure(){
|
||||
if(typeof this.radio.id == "undefined"){
|
||||
this.$message.error('请选择一个字段,或者选择取消')
|
||||
}else{
|
||||
this.$emit('selEvent',this.radio)
|
||||
this.radio={};
|
||||
this.search="";
|
||||
this.active="";
|
||||
this.$emit('fieldClose');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.rule_dialg_header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
}
|
||||
.rule_dialg_cont{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
height: 40vh;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.rule_dialg_cont>div{
|
||||
width: 30%;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.rule_dialg_cont .el-radio--mini.is-bordered{
|
||||
border: none;
|
||||
}
|
||||
.rule_dialg_cont>div:hover{
|
||||
|
||||
overflow: unset;
|
||||
}
|
||||
.field-wrapper .el-dialog__body{
|
||||
padding-top: 10px;
|
||||
}
|
||||
</style>
|
||||
403
h5-enginex-manager/src/components/models/outcontent.vue
Executable file
403
h5-enginex-manager/src/components/models/outcontent.vue
Executable file
@@ -0,0 +1,403 @@
|
||||
<style>
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.rule_dialg_header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
}
|
||||
|
||||
.rule_dialg_cont {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
height: 40vh;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
.rule_dialg_cont>div {
|
||||
width: 30%;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.rule_dialg_cont>div:hover {
|
||||
overflow: unset;
|
||||
}
|
||||
.ruleOut{
|
||||
position: absolute;
|
||||
padding-top: 10px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 100px;
|
||||
|
||||
}
|
||||
.ruleOut>span{
|
||||
border-radius: 2px;
|
||||
}
|
||||
.ruleOut>span:hover{
|
||||
/* cursor:hand */
|
||||
user-select: none;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
.ruleOut>span:active{
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(0)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="outDelect(index)" v-if="!unone" disabled style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
<div v-for="(value,index) in outcontent" class="rule_home" style="display: flex;position: relative;">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="outAdd(index+1)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="outDelect(index)" style="margin-right: 10px"></el-button>
|
||||
</div>
|
||||
<div v-if="ruleOut" class="ruleOut">
|
||||
<span :style="{backgroundColor:value.outCondition?'#afd7ff':'#e8e8e8',border:value.outCondition?'1px solid #409EFF':'1px solid #adadad',color:value.outCondition?'#409EFF':'#adadad',fontSize:'12px',padding:'2px'}"
|
||||
@click="ruleOutDialogOpen(value,index)">条件输出</span>
|
||||
</div>
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select :value="getCn(value.fieldId)" placeholder="请选择" style="width: 200px;margin-right: 10px;" @focus="outClick(index)">
|
||||
</el-select>
|
||||
<p style="margin-right: 10px;">=</p>
|
||||
|
||||
<varialeSelect v-model="value.fieldValue" :valueType="mixinGetvalueType(value.fieldId)" :variableType.sync="value.variableType" width="255px" height="40px" size="—"></varialeSelect>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="输入参数" :visible.sync="dialogVisible" width="50%" >
|
||||
<div class="rule_dialg_header">
|
||||
请选择参数:
|
||||
<div>
|
||||
<el-input v-model="search" maxlength="30" placeholder="快速搜索"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rule_dialg_cont">
|
||||
<div v-for="value in fradioList">
|
||||
<el-radio v-model="radio" :label="value.id" border size="mini">{{value.fieldCn}}</el-radio>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false;radio='';search=''">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogSure()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog title="条件输出" :visible.sync="ruleOutDialog" width="40%" :close-on-click-modal="false" @close="tempOutCondition='';tempIndex=''">
|
||||
<el-select v-model="tempOutCondition.logical" placeholder="请选择关系符">
|
||||
<el-option :key="1" label="AND" value="&&"></el-option>
|
||||
<el-option :key="2" label="OR" value="||"></el-option>
|
||||
</el-select>
|
||||
|
||||
<div style="margin-top: 20px;margin-left: 100px;">
|
||||
<div v-for="(value,index) in tempOutCondition.conditionList" style="display: flex;align-items: center;margin-top: 5px;">
|
||||
<el-select filterable v-model="value.fieldEn" placeholder="请选择" style="width: 200px;margin-right:10px;" @change="value.operator=''"
|
||||
size="mini">
|
||||
<el-option v-for="item in FieldUser" :label="item.fieldCn" :value="item.fieldEn"></el-option>
|
||||
</el-select>
|
||||
<ruleRelation style="width: 200px;" :openValue2="false" v-model="value.operator" :valueType="mixinGetValueTypeByEn(value.fieldEn)"
|
||||
:type="2" size="mini" :andTextInput="true"></ruleRelation>
|
||||
<varialeSelect v-model="value.fieldValue" :valueType="mixinGetValueTypeByEn(value.fieldEn)" :variableType.sync="value.variableType" style="margin-left: 20px;" height="28px"></varialeSelect>
|
||||
<i class="el-icon-circle-plus-outline" style="font-size: 20px;color: #409EFF;" @click="addRule(index)"></i>
|
||||
<i class="el-icon-circle-close" :style="{fontSize: '20px',color:index===0?'#ddd':'#F56C6C'}" @click="delectRule(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="ruleOutDialog = false;">取 消</el-button>
|
||||
<el-button type="primary" @click="ruleOutDialogSure()">确 定</el-button>
|
||||
<el-button type="primary" @click="delectOutCondition()">关闭条件输出</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
ruleRelation,
|
||||
varialeSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempOutCondition: {},
|
||||
ruleOutDialog: false,
|
||||
dialogVisible: false,
|
||||
search: '',
|
||||
radioList: [],
|
||||
radio: '',
|
||||
tempIndex: '',
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
ruleOut: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
outcontent: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
zhezhao: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
unone:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
outType:{
|
||||
type: Object|null,
|
||||
default: () => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
},
|
||||
// watch: {
|
||||
// outcontent: {
|
||||
// handler(val, oldVal) {
|
||||
// if(this.unone&&val.length===0){
|
||||
// this.outAdd(0)
|
||||
// }
|
||||
// },
|
||||
// deep: true
|
||||
// }
|
||||
// },
|
||||
computed: {
|
||||
FieldUser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
outPutUser() {
|
||||
if (this.$store.state.Output) {
|
||||
return this.$store.state.Output.data.paramMap.fieldList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
},
|
||||
fradioList() {
|
||||
if (this.search != "") {
|
||||
let arr = []
|
||||
|
||||
arr = this.radioList.filter(value => {
|
||||
if (value.fieldCn.indexOf(this.search) != -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
return arr
|
||||
} else {
|
||||
return this.radioList
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
delectOutCondition() {
|
||||
delete this.outcontent[this.tempIndex].outCondition
|
||||
this.ruleOutDialog = false
|
||||
},
|
||||
delectRule(index) {
|
||||
this.tempOutCondition.conditionList.splice(index, 1)
|
||||
},
|
||||
addRule(index) {
|
||||
this.tempOutCondition.conditionList.splice(index + 1, 0, {
|
||||
conditionType: 2,
|
||||
fieldEn: '',
|
||||
fieldValue: '',
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
})
|
||||
},
|
||||
ruleOutDialogOpen(e, index) {
|
||||
this.tempIndex = index
|
||||
this.ruleOutDialog = true
|
||||
if (e.outCondition) {
|
||||
this.tempOutCondition = JSON.parse(e.outCondition)
|
||||
} else {
|
||||
this.tempOutCondition = {
|
||||
logical: '&&',
|
||||
conditionList: [{
|
||||
conditionType: 2,
|
||||
fieldEn: '',
|
||||
fieldValue: '',
|
||||
operator: '',
|
||||
variableType: 1,
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
ruleOutDialogSure() {
|
||||
let is = false
|
||||
this.tempOutCondition.conditionList.forEach(value => {
|
||||
if (value.fieldEn.trim() === "" || value.fieldValue.trim() === "" || value.operator.trim() === "") {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
if (is) {
|
||||
this.$message.error('请检查是否有未填项')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.outcontent[this.tempIndex].outCondition = JSON.stringify(this.tempOutCondition)
|
||||
|
||||
this.ruleOutDialog = false
|
||||
},
|
||||
outAdd(index) {
|
||||
let obj = {
|
||||
"fieldId": "",
|
||||
"fieldValue": "",
|
||||
variableType: 1,
|
||||
}
|
||||
if(this.outType){
|
||||
obj=Object.assign(obj,this.outType)
|
||||
}
|
||||
if (this.type !== "") {
|
||||
obj.tacticsType = this.type
|
||||
}
|
||||
this.outcontent.splice(index, 0, obj)
|
||||
},
|
||||
outDelect(index) {
|
||||
this.outcontent.splice(index, 1)
|
||||
},
|
||||
dialogSure() {
|
||||
if (this.radio == '') {
|
||||
this.$message.error('请选择一个字段,或者选择取消')
|
||||
} else {
|
||||
if (this.tempcur.split('###')[1] === "Data") {
|
||||
this.Data.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
console.log(value)
|
||||
value.fieldId = this.radio + '|' + this.getvalueEn(this.radio)
|
||||
value.operator = ""
|
||||
value.fieldValue = ""
|
||||
}
|
||||
})
|
||||
} else if (this.tempcur.split('###')[1] === "out") {
|
||||
console.log(this.outcontent)
|
||||
this.outcontent.forEach((value, index) => {
|
||||
if (index === parseInt(this.tempcur.split('###')[0])) {
|
||||
value.fieldId = this.radio
|
||||
// value.fieldEn = this.mixinGetvalueEn(this.radio)
|
||||
this.$set(value,'fieldEn',this.mixinGetvalueEn(this.radio))
|
||||
value.fieldValue = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
this.radio = '';
|
||||
this.search = '';
|
||||
}
|
||||
|
||||
},
|
||||
getCn(id, type) {
|
||||
let Cn
|
||||
if (type != 2) {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id == parseInt(id)) {
|
||||
Cn = value.fieldCn
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
return Cn
|
||||
},
|
||||
getvalueEn(cont) {
|
||||
let num
|
||||
console.log(cont)
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.fieldEn
|
||||
console.log(1)
|
||||
}
|
||||
})
|
||||
return num
|
||||
},
|
||||
dataClick(index, id) {
|
||||
this.tempcur = index + '###Data'
|
||||
this.radioList = this.FieldUser
|
||||
this.radio = Number(id.split('|')[0])
|
||||
console.log(id)
|
||||
this.dialogVisible = true
|
||||
},
|
||||
outClick(index) {
|
||||
this.tempcur = index + '###out'
|
||||
console.log(this.tempcur)
|
||||
this.radioList = this.FieldUser
|
||||
this.dialogVisible = true
|
||||
},
|
||||
getvalueType(cont) {
|
||||
let num
|
||||
this.FieldUser.forEach(value => {
|
||||
if (value.id === parseInt(cont)) {
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
229
h5-enginex-manager/src/components/models/varialeSelect.vue
Executable file
229
h5-enginex-manager/src/components/models/varialeSelect.vue
Executable file
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<div class="variateSelect" :style="{width:width,height:height}">
|
||||
<div style="width: 35%;" class="variateSelectLeft" :style="{height:height}">
|
||||
<el-dropdown trigger="click" @command="em">
|
||||
<span class="el-dropdown-link" style="color: #fff;">
|
||||
{{variableType==1?"常量":variableType==2?"变量":variableType==3?"自定义":"错误"}}<i
|
||||
class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="1" :disabled="disabled.indexOf(1)!=-1">常量
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="2" :disabled="disabled.indexOf(2)!=-1">变量
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="3" :disabled="disabled.indexOf(3)!=-1">自定义
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- 常量 -->
|
||||
<el-input style="margin-left: -10%;width: 75%;" :value="value" :size="size" placeholder="请输入内容"
|
||||
v-if="variableType===1" @input="$emit('input',$event)"></el-input>
|
||||
|
||||
|
||||
<!-- 变量 -->
|
||||
<el-select style="margin-left: -10%;width: 75%;" :size="size" :value="value" filterable
|
||||
@change="$emit('input',$event)" v-else-if="variableType===2&&!variableCascader">
|
||||
<el-option v-for="item in MyFieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<!-- 变量级联 -->
|
||||
|
||||
<el-cascader style="margin-left: -10%;width: 75%;" :value="value" :size="size" v-else-if="variableType===2&&variableCascader" filterable :options="FieldUserObj"
|
||||
:key="(value.random?value.random:0)" @visible-change="randomAdd(value,$event)" @change="$emit('input',$event)"
|
||||
:props="{ expandTrigger: 'hover' }" ></el-cascader>
|
||||
|
||||
<!-- 自定义按钮 -->
|
||||
<el-button plain @click="CustomClick" v-else-if="variableType===3"
|
||||
:style="{height:height}" class="varialeType3Button" :size="size">
|
||||
{{value==""||JSON.parse(value).formula===""?'请输入自定义内容':JSON.parse(value).formula}}</el-button>
|
||||
<!-- 自定义的弹框 -->
|
||||
<el-dialog title="自定义" v-if="dialogVisible" :visible.sync="dialogVisible" width="70%"
|
||||
:close-on-click-modal="false" append-to-body>
|
||||
<teV2 v-model="tempValue"></teV2>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;tempValue=''">取 消</el-button>
|
||||
<el-button type="primary" @click="sectionSure" :disabled="type3Sure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
export default {
|
||||
components: {
|
||||
teV2
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tempValue: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini'
|
||||
},
|
||||
variableType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
value: {
|
||||
type: String|Array,
|
||||
default: ""
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '28px'
|
||||
},
|
||||
disabled: {
|
||||
type: Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
valueType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
interceptCustom: { //是否拦截自定义点击
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
variableCascader:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
variableCascaderValue:{
|
||||
type: Array,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// console.log(this.variableType)
|
||||
if (!this.variableType) {
|
||||
this.$emit('update:variableType', 1)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
CustomClick() {
|
||||
if(this.interceptCustom){
|
||||
this.$emit('CustomCallback',this.value)
|
||||
return
|
||||
}
|
||||
this.tempValue = this.value === '' ? this.value : JSON.parse(this.value).formula;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
sectionSure(e) {
|
||||
let arr = String(this.tempValue).match(/@(.|\n)*?@/g) === null ? [] : this.tempValue.match(/@(.|\n)*?@/g);
|
||||
let is = false
|
||||
// console.log(arr,this.tempValue)
|
||||
arr = Array.from(new Set(arr))
|
||||
// console.log(arr)
|
||||
arr = arr.map(value => {
|
||||
console.log(value)
|
||||
value = value.split('')
|
||||
value.pop()
|
||||
value.shift()
|
||||
value = value.join('')
|
||||
if (this.mixinGetValueByCn(value)) {
|
||||
return this.mixinGetValueByCn(value)
|
||||
} else {
|
||||
is = true
|
||||
this.$message.error(`没有找到指标:${value}`);
|
||||
return this.mixinGetValueByCn(value)
|
||||
}
|
||||
|
||||
})
|
||||
// console.log(arr)
|
||||
// console.log(e)
|
||||
if (is) {
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
farr: arr,
|
||||
formula: this.tempValue.trim()
|
||||
}
|
||||
|
||||
|
||||
// console.log(this.tempValue)
|
||||
this.$emit('input', JSON.stringify(obj))
|
||||
this.dialogVisible = false
|
||||
},
|
||||
em(e) {
|
||||
this.$emit('update:variableType', e)
|
||||
this.$emit('input', "")
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUserObj(){
|
||||
|
||||
if(this.variableCascaderValue===undefined){
|
||||
|
||||
if(this.$store.state.FieldUserObj){
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
}
|
||||
return this.variableCascaderValue
|
||||
|
||||
},
|
||||
MyFieldUser(e) {
|
||||
if (this.valueType) {
|
||||
return this.FieldUser.filter(x => x.valueType == this.valueType)
|
||||
} else {
|
||||
return this.FieldUser
|
||||
}
|
||||
},
|
||||
type3Sure() {
|
||||
return this.isodd(this.tempValue, '@')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.variateSelect {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.variateSelectLeft {
|
||||
background-color: #ddd;
|
||||
border-radius: 5px;
|
||||
padding-right: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 6px;
|
||||
padding-right: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
.varialeType3Button{
|
||||
flex-shrink: 0;flex-grow: 1; margin-left: -10%;width: 75%;overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
56
h5-enginex-manager/src/components/page/403.vue
Executable file
56
h5-enginex-manager/src/components/page/403.vue
Executable file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="error-page">
|
||||
<div class="error-code">4<span>0</span>3</div>
|
||||
<div class="error-desc">啊哦~ 你没有权限访问该页面哦</div>
|
||||
<div class="error-handle">
|
||||
<router-link to="/">
|
||||
<el-button type="primary" size="large">返回首页</el-button>
|
||||
</router-link>
|
||||
<el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
goBack(){
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.error-page{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f3f3f3;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.error-code{
|
||||
line-height: 1;
|
||||
font-size: 250px;
|
||||
font-weight: bolder;
|
||||
color: #f02d2d;
|
||||
}
|
||||
.error-code span{
|
||||
color: #00a854;
|
||||
}
|
||||
.error-desc{
|
||||
font-size: 30px;
|
||||
color: #777;
|
||||
}
|
||||
.error-handle{
|
||||
margin-top: 30px;
|
||||
padding-bottom: 200px;
|
||||
}
|
||||
.error-btn{
|
||||
margin-left: 100px;
|
||||
}
|
||||
</style>
|
||||
56
h5-enginex-manager/src/components/page/404.vue
Executable file
56
h5-enginex-manager/src/components/page/404.vue
Executable file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="error-page">
|
||||
<div class="error-code">4<span>0</span>4</div>
|
||||
<div class="error-desc">啊哦~ 你所访问的页面不存在</div>
|
||||
<div class="error-handle">
|
||||
<router-link to="/">
|
||||
<el-button type="primary" size="large">返回首页</el-button>
|
||||
</router-link>
|
||||
<el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
goBack(){
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.error-page{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f3f3f3;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.error-code{
|
||||
line-height: 1;
|
||||
font-size: 250px;
|
||||
font-weight: bolder;
|
||||
color: #2d8cf0;
|
||||
}
|
||||
.error-code span{
|
||||
color: #00a854;
|
||||
}
|
||||
.error-desc{
|
||||
font-size: 30px;
|
||||
color: #777;
|
||||
}
|
||||
.error-handle{
|
||||
margin-top: 30px;
|
||||
padding-bottom: 200px;
|
||||
}
|
||||
.error-btn{
|
||||
margin-left: 100px;
|
||||
}
|
||||
</style>
|
||||
420
h5-enginex-manager/src/components/page/Dashboard.vue
Executable file
420
h5-enginex-manager/src/components/page/Dashboard.vue
Executable file
@@ -0,0 +1,420 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-card shadow="hover" class="mgb20" style="height:252px;">
|
||||
<div class="user-info">
|
||||
<img src="../../assets/img/img.jpg" class="user-avator" alt />
|
||||
<div class="user-info-cont">
|
||||
<div class="user-info-name">{{name}}</div>
|
||||
<div>{{role}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-info-list">
|
||||
上次登录时间:
|
||||
<span>{{lastLoginTime | formatDate}}</span>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="hover" style="height:252px;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>引擎详情</span>
|
||||
</div>
|
||||
<span v-if="engineRatio1">{{engineRatio1.engineName}}
|
||||
<el-progress :percentage="engineRatio1.useRatio" color="#42b983"></el-progress>
|
||||
</span>
|
||||
<span v-if="engineRatio2">{{engineRatio2.engineName}}
|
||||
<el-progress :percentage="engineRatio2.useRatio" color="#f1e05a"></el-progress>
|
||||
</span>
|
||||
<span v-if="engineRatio3">{{engineRatio3.engineName}}
|
||||
<el-progress :percentage="engineRatio3.useRatio"></el-progress>
|
||||
</span>
|
||||
<span v-if="engineRatio4">{{engineRatio4.engineName}}
|
||||
<el-progress :percentage="engineRatio4.useRatio" color="#f56c6c"></el-progress>
|
||||
</span>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-row :gutter="20" class="mgb20">
|
||||
<el-col :span="8">
|
||||
<el-card shadow="hover" :body-style="{padding: '0px'}">
|
||||
<div class="grid-content grid-con-1">
|
||||
<i class="el-icon-lx-people grid-con-icon"></i>
|
||||
<div class="grid-cont-right">
|
||||
<div class="grid-num">{{engineNum}}</div>
|
||||
<div>引擎</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-card shadow="hover" :body-style="{padding: '0px'}">
|
||||
<div class="grid-content grid-con-2">
|
||||
<i class="el-icon-lx-notice grid-con-icon"></i>
|
||||
<div class="grid-cont-right">
|
||||
<div class="grid-num">{{engineNodeNum}}</div>
|
||||
<div>决策节点</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-card shadow="hover" :body-style="{padding: '0px'}">
|
||||
<div class="grid-content grid-con-3">
|
||||
<i class="el-icon-lx-goods grid-con-icon"></i>
|
||||
<div class="grid-cont-right">
|
||||
<div class="grid-num">{{engineResultNum}}</div>
|
||||
<div>决策结果</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-card shadow="hover" style="height:403px;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>活动日志</span>
|
||||
</div>
|
||||
<el-table :show-header="false" :data="todoList" style="width:100%;">
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<div class="todo-item">{{scope.row.opUserName}} {{scope.row.ip}} 在{{scope.row.startTime | formatDate}}
|
||||
{{scope.row.opName}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-card shadow="hover">
|
||||
<charts sid="dashboardLeft" height='250px' width='100%' :option="options"></charts>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card shadow="hover">
|
||||
<charts sid="dashboardRight" height='250px' width='100%' :option="options2"></charts>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import charts from '@/components/common/charts.vue'
|
||||
import bus from '../common/bus';
|
||||
import {
|
||||
getIndexInfo
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
name: 'dashboard',
|
||||
components: {
|
||||
// Schart,
|
||||
charts
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: localStorage.getItem('ms_username'),
|
||||
lastLoginTime: null,
|
||||
engineNum: null,
|
||||
engineNodeNum: null,
|
||||
engineResultNum: null,
|
||||
engineRatio1: {},
|
||||
engineRatio2: {},
|
||||
engineRatio3: {},
|
||||
engineRatio4: {},
|
||||
|
||||
todoList: [],
|
||||
options: {
|
||||
title: {
|
||||
text: '最近几天引擎使用情况',
|
||||
left: 'center'
|
||||
},
|
||||
grid: {
|
||||
bottom: '10% '
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
data: []
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value'
|
||||
}],
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left',
|
||||
},
|
||||
series: []
|
||||
|
||||
},
|
||||
options2: {
|
||||
title: {
|
||||
text: '最近几个月引擎使用趋势图',
|
||||
left: 'center'
|
||||
},
|
||||
grid: {
|
||||
bottom: '10% '
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
data: []
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value'
|
||||
}],
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
series: []
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
role() {
|
||||
return this.name === 'admin' ? '超级管理员' : '普通用户';
|
||||
}
|
||||
},
|
||||
// created() {
|
||||
// this.handleListener();
|
||||
// this.changeDate();
|
||||
// },
|
||||
// activated() {
|
||||
// this.handleListener();
|
||||
// },
|
||||
// deactivated() {
|
||||
// window.removeEventListener('resize', this.renderChart);
|
||||
// bus.$off('collapse', this.handleBus);
|
||||
// },
|
||||
|
||||
created() {
|
||||
// this.getIndexInfos();
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeDate() {
|
||||
const now = new Date().getTime();
|
||||
this.data.forEach((item, index) => {
|
||||
const date = new Date(now - (6 - index) * 86400000);
|
||||
item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
|
||||
});
|
||||
},
|
||||
|
||||
async getIndexInfos() {
|
||||
const result = await getIndexInfo();
|
||||
const data = result.data;
|
||||
|
||||
|
||||
// 引擎基本信息
|
||||
this.engineNum = data.engineBaseInfo.engineNum;
|
||||
this.engineNodeNum = data.engineBaseInfo.engineNodeNum;
|
||||
this.engineResultNum = data.engineBaseInfo.engineResultNum;
|
||||
|
||||
// 引擎使用占比
|
||||
this.engineRatio1 = data.engineUseRatio[0];
|
||||
this.engineRatio2 = data.engineUseRatio[1];
|
||||
this.engineRatio3 = data.engineUseRatio[2];
|
||||
this.engineRatio4 = data.engineUseRatio[3];
|
||||
|
||||
// 最近几天引擎使用情况
|
||||
|
||||
|
||||
|
||||
var labelOption = {
|
||||
show: true,
|
||||
position: 'insideBottomRight',
|
||||
distance: 10,
|
||||
align: 'left',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 90,
|
||||
// formatter: '{c} {name|{a}}',
|
||||
fontSize: 12,
|
||||
rich: {
|
||||
name: {}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.options.xAxis[0].data = data.recentDayMap.labels;
|
||||
let arr = data.recentDayMap.datasets.map(value => {
|
||||
return {
|
||||
name: value.label,
|
||||
type: 'bar',
|
||||
barGap: 0,
|
||||
label: labelOption,
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: value.data
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
this.options.series = arr.filter((value,index)=>{
|
||||
return index<5
|
||||
})
|
||||
|
||||
// 最近几个月引擎使用情况
|
||||
this.options2.xAxis[0].data = data.recentMonthMap.labels;
|
||||
this.options2.series = data.recentMonthMap.datasets.map(value => {
|
||||
return {
|
||||
name: value.label,
|
||||
type: 'line',
|
||||
barGap: 0,
|
||||
label: labelOption,
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: value.data
|
||||
}
|
||||
})
|
||||
|
||||
// 上次登录时间
|
||||
this.lastLoginTime = data.lastLoginTime;
|
||||
|
||||
// 活动日志
|
||||
this.todoList = data.logList;
|
||||
}
|
||||
},
|
||||
|
||||
filters: {
|
||||
formatDate: function(value) {
|
||||
let date = new Date(value);
|
||||
let y = date.getFullYear();
|
||||
let MM = date.getMonth() + 1;
|
||||
MM = MM < 10 ? ('0' + MM) : MM;
|
||||
let d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
let h = date.getHours();
|
||||
h = h < 10 ? ('0' + h) : h;
|
||||
let m = date.getMinutes();
|
||||
m = m < 10 ? ('0' + m) : m;
|
||||
let s = date.getSeconds();
|
||||
s = s < 10 ? ('0' + s) : s;
|
||||
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.grid-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.grid-cont-right {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.grid-num {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.grid-con-icon {
|
||||
font-size: 50px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
text-align: center;
|
||||
line-height: 100px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.grid-con-1 .grid-con-icon {
|
||||
background: rgb(45, 140, 240);
|
||||
}
|
||||
|
||||
.grid-con-1 .grid-num {
|
||||
color: rgb(45, 140, 240);
|
||||
}
|
||||
|
||||
.grid-con-2 .grid-con-icon {
|
||||
background: rgb(100, 213, 114);
|
||||
}
|
||||
|
||||
.grid-con-2 .grid-num {
|
||||
color: rgb(45, 140, 240);
|
||||
}
|
||||
|
||||
.grid-con-3 .grid-con-icon {
|
||||
background: rgb(242, 94, 67);
|
||||
}
|
||||
|
||||
.grid-con-3 .grid-num {
|
||||
color: rgb(242, 94, 67);
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 2px solid #ccc;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.user-avator {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.user-info-cont {
|
||||
padding-left: 50px;
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.user-info-cont div:first-child {
|
||||
font-size: 30px;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.user-info-list {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.user-info-list span {
|
||||
margin-left: 70px;
|
||||
}
|
||||
|
||||
.mgb20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.todo-item {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.todo-item-del {
|
||||
text-decoration: line-through;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.schart {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
706
h5-enginex-manager/src/components/page/DataSource.vue
Executable file
706
h5-enginex-manager/src/components/page/DataSource.vue
Executable file
@@ -0,0 +1,706 @@
|
||||
<template>
|
||||
<div style="height: 90%; ">
|
||||
<!-- 创建和搜索 -->
|
||||
<div class="datasou_top" style="height: 10%;">
|
||||
<el-row style="margin-bottom: 30px;margin-top: 20px;">
|
||||
<el-col :span="15">
|
||||
<el-button style="margin-right:20px;" type="primary" @click="createEngine">创建数据源</el-button>
|
||||
<el-select v-model="sourceType" placeholder="请选择数据源类型" @change="changeSource">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="datasou_cont" style="height: 80%;" v-if="data">
|
||||
<div class="datasou_table">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-table border :data="data.data.data" style="width: 100%" v-loading="loading">
|
||||
|
||||
<el-table-column label="序号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{((pageNo-1)*10+scope.$index+1)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="name" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType == 'Spark'" prop="sparkHome" label="park-home" align="center"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType == 'Spark'" prop="appName" label="app-name" align="center"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType == 'Spark'" prop="masterUrl" label="master" align="center"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="sourceType == 'Hive'" prop="url" label="url" align="center"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="sourceType != 'Hive'&&sourceType!='Spark'" prop="host" label="host"
|
||||
align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType != 'Hive'&&sourceType!='Spark'" prop="port" label="port"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType !='Hive'&&sourceType!='Spark'" prop="dbName" label="db-name"
|
||||
align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="sourceType!='Spark'" prop="userName"
|
||||
label="user-name" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="updataTime" label="最后更新时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span style="white-space: nowrap;">{{
|
||||
new Date(scope.row.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row.updateTime).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<el-button icon="el-icon-search" circle size="mini"
|
||||
@click="dialogShow(scope.$index)"></el-button>
|
||||
<el-button type="primary" icon="el-icon-edit" circle size="mini"
|
||||
@click="modificationShow(scope.row.id)"></el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" circle size="mini"
|
||||
@click="deletelistsor(scope.row.id)"></el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
<div style="float: right;margin-right: 120px;margin-top: 40px;">
|
||||
<el-pagination :current-page="pageNo" @current-change="currpage" background layout="prev, pager, next"
|
||||
:total="data.data.pager.total" v-if="data!==null">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="数据库详情" :visible.sync="dialogVisible" width="40%" :before-close="handleClose"
|
||||
class="DataSource_look">
|
||||
<div v-if="tempDialogData!==null">
|
||||
<div class="textLayout">
|
||||
<p>连接名称:</p>
|
||||
<p v-if="tempDialogData.name">{{tempDialogData.name}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
|
||||
<p>spark-home:</p>
|
||||
<p v-if="tempDialogData.sparkHome">{{tempDialogData.sparkHome}}</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
|
||||
<p>app-name:</p>
|
||||
<p v-if="tempDialogData.appName">{{tempDialogData.appName}}</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
|
||||
<p>master:</p>
|
||||
<p v-if="tempDialogData.masterUrl">{{tempDialogData.masterUrl}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="tempDialogData.type == 'Hive'">
|
||||
<p>地址:</p>
|
||||
<p v-if="tempDialogData.url">{{tempDialogData.url}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="tempDialogData.type != 'Hive'&&tempDialogData.type!='Spark'">
|
||||
<p>主机地址:</p>
|
||||
<p v-if="tempDialogData.host">{{tempDialogData.host}}</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="tempDialogData.type != 'Hive'&&tempDialogData.type!='Spark'">
|
||||
<p>端口:</p>
|
||||
<p v-if="tempDialogData.port">{{tempDialogData.port}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="tempDialogData.type !='Hive'&&tempDialogData.type!='Spark'">
|
||||
<p>数据库名称:</p>
|
||||
<p v-if="tempDialogData.dbName">{{tempDialogData.dbName}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="tempDialogData.type!='Spark'">
|
||||
<p>用户名:</p>
|
||||
<p v-if="tempDialogData.userName">{{tempDialogData.userName}}</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout">
|
||||
<p>创建时间:</p>
|
||||
<p v-if="tempDialogData.createTime">
|
||||
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout">
|
||||
<p>创建人:</p>
|
||||
<p v-if="tempDialogData.creator">{{tempDialogData.creatorName}}</p>
|
||||
</div>
|
||||
<div class="textLayout">
|
||||
<p>修改时间:</p>
|
||||
<p v-if="tempDialogData.updateTime">
|
||||
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout">
|
||||
<p>修改人:</p>
|
||||
<p v-if="tempDialogData.modifier">{{tempDialogData.modifierName}}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="textLayout">
|
||||
<p>数据库类型:</p>
|
||||
<p v-if="tempDialogData.type">{{tempDialogData.type}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
数据错误 请重新尝试
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
||||
<el-button type="primary" @click="dialogVisible = false;tempDialogData=null">确 定</el-button>
|
||||
</span>
|
||||
|
||||
</el-dialog>
|
||||
<el-dialog :title="modificationId===null?'创建'+sourceType+'数据源':'修改'+sourceType+'数据源'"
|
||||
:visible.sync="modificationVisible" width="35%" :before-close="handleClose">
|
||||
<div>
|
||||
<div class="textLayout">
|
||||
<p>name:</p>
|
||||
<p>
|
||||
<el-input placeholder="名称" v-model="modificationData.name" clearable maxlength="20">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="sourceType == 'Spark'">
|
||||
<p>spark-home:</p>
|
||||
<p>
|
||||
<el-input placeholder="如:/opt/soft/spark-2.4.6-bin-hadoop2.7"
|
||||
v-model="modificationData.sparkHome" clearable>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="sourceType == 'Spark'">
|
||||
<p>app-name:</p>
|
||||
<p>
|
||||
<el-input placeholder="如:sparkTest" v-model="modificationData.appName" clearable>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="sourceType == 'Spark'">
|
||||
<p>master:</p>
|
||||
<p>
|
||||
<el-input placeholder="如:local[4]" v-model="modificationData.masterUrl" clearable>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="textLayout" v-if="sourceType != 'Hive'&&sourceType!='Spark'">
|
||||
<p>host:</p>
|
||||
<p>
|
||||
<el-input placeholder="如:192.168.1.1" v-model="modificationData.host" clearable maxlength="20">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="sourceType == 'Hive'">
|
||||
<p>url:</p>
|
||||
<p>
|
||||
<el-input placeholder="请输入地址" v-model="modificationData.url" clearable maxlength="50">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="textLayout" v-if="sourceType != 'Hive'&&sourceType!='Spark'">
|
||||
<p>port:</p>
|
||||
<p>
|
||||
<el-input :placeholder="sourceType=='Redis'?'如:6379':'如:3306'" v-model="modificationData.port"
|
||||
clearable maxlength="20">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="sourceType !='Hive'&&sourceType!='Spark'">
|
||||
<p>db:</p>
|
||||
<p v-if="sourceType =='MySQL'||sourceType =='Oracle'||sourceType =='Sqlserver'">
|
||||
<el-input placeholder="请输入数据库名称" v-model="modificationData.dbName" clearable maxlength="50">
|
||||
</el-input>
|
||||
</p>
|
||||
<p v-if="sourceType =='Redis'">
|
||||
<el-input placeholder="0~15" type="number" v-model="modificationData.dbName" clearable>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="sourceType!='Spark'">
|
||||
<p>user-name:</p>
|
||||
<p>
|
||||
<el-input placeholder="请输入用户名" v-model="modificationData.userName" clearable maxlength="50">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="textLayout" v-if="sourceType!='Spark'">
|
||||
<p>password:</p>
|
||||
<p>
|
||||
<el-input placeholder="请输入密码" v-model="modificationData.password" clearable maxlength="50"
|
||||
auto-complete="new-password" show-password>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="modificationSure">确 定</el-button>
|
||||
</span>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getDataSourcelist
|
||||
} from '../../api/index';
|
||||
import {
|
||||
setDataSource
|
||||
} from '../../api/index';
|
||||
import {
|
||||
deleteDataSource,
|
||||
updataDataSource
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
name: 'datasource',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
searchString: "",
|
||||
data: null,
|
||||
currentPage: null,
|
||||
dialogVisible: false,
|
||||
tempDialogData: null,
|
||||
pageNo: 1,
|
||||
modificationId: null,
|
||||
modificationVisible: false,
|
||||
modificationData: {
|
||||
name: "",
|
||||
host: "",
|
||||
url: "",
|
||||
port: "",
|
||||
dbName: "",
|
||||
userName: "",
|
||||
password: "",
|
||||
sparkHome: "",
|
||||
appName: "",
|
||||
masterUrl: ""
|
||||
},
|
||||
options: [{
|
||||
value: 'MySQL',
|
||||
label: 'MySQL'
|
||||
}, {
|
||||
value: 'Redis',
|
||||
label: 'Redis'
|
||||
}, {
|
||||
value: 'Hive',
|
||||
label: 'Hive'
|
||||
}, {
|
||||
value: 'Spark',
|
||||
label: 'Spark'
|
||||
}, {
|
||||
value: 'Oracle',
|
||||
label: 'Oracle'
|
||||
}, {
|
||||
value: 'Sqlserver',
|
||||
label: 'Sqlserver'
|
||||
}],
|
||||
sourceType: 'MySQL'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
let params = {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
typeList: [this.sourceType]
|
||||
}
|
||||
this.getDataSourcelists(params)
|
||||
},
|
||||
changeSource(e) {
|
||||
this.initData();
|
||||
},
|
||||
// 关闭弹窗所有弹窗 且清除临时数据
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
this.modificationVisible = false
|
||||
|
||||
this.tempDialogData = null
|
||||
this.modificationData = {
|
||||
host: "",
|
||||
userName: "",
|
||||
dbName: "",
|
||||
name: "",
|
||||
password: "",
|
||||
port: "",
|
||||
}
|
||||
|
||||
this.modificationId = null
|
||||
},
|
||||
// 查看 弹窗显示
|
||||
dialogShow(index) {
|
||||
this.tempDialogData = this.data.data.data[index]
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 修改 弹窗显示
|
||||
modificationShow(id) {
|
||||
this.modificationId = id
|
||||
this.data.data.data.forEach(value => {
|
||||
if (value.id === id) {
|
||||
this.modificationData = {
|
||||
...value
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.modificationVisible = true
|
||||
},
|
||||
checkMySql() {
|
||||
if (this.modificationData.name.indexOf(' ') !== -1 || String(this.modificationData.host).indexOf(' ') !== -
|
||||
1 ||
|
||||
this.modificationData.userName.indexOf(' ') !== -1 || this.modificationData.password.indexOf(' ') !== -
|
||||
1 || this.modificationData
|
||||
.port.indexOf(' ') !== -1 || this.modificationData.dbName.indexOf(' ') !== -1) {
|
||||
this.$message.error('不允许出现空格!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.modificationData.name.length < 4 || this.modificationData.host.length < 4 || this
|
||||
.modificationData.userName
|
||||
.length < 4 || this.modificationData.password.length < 4 || this.modificationData.port.length <
|
||||
4 || this.modificationData
|
||||
.dbName.length < 4) {
|
||||
this.$message.error('均为必填项且长度不小于4!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.isChinese(this.modificationData.host) || this.isChinese(this.modificationData.userName) ||
|
||||
this.isChinese(this.modificationData.port)) {
|
||||
this.$message.error('主机地址,端口,用户名 不允许出现中文')
|
||||
return
|
||||
}
|
||||
|
||||
let params = {}
|
||||
params.name = this.modificationData.name
|
||||
params.host = this.modificationData.host
|
||||
params.userName = this.modificationData.userName
|
||||
params.password = this.modificationData.password
|
||||
params.port = this.modificationData.port
|
||||
params.dbName = this.modificationData.dbName
|
||||
return params;
|
||||
}
|
||||
}
|
||||
},
|
||||
checkRedis() {
|
||||
if (this.modificationData.name.indexOf(' ') !== -1 || String(this.modificationData.host).indexOf(' ') !== -
|
||||
1 ||
|
||||
this.modificationData.password.indexOf(' ') !== -1 || this.modificationData
|
||||
.port.indexOf(' ') !== -1 || this.modificationData.dbName.indexOf(' ') !== -1) {
|
||||
this.$message.error('不允许出现空格!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.modificationData.name.length < 4 || this.modificationData.host.length < 4 || this
|
||||
.modificationData.password.length < 4 || this.modificationData.port.length < 4) {
|
||||
this.$message.error('均为必填项且长度不小于4!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.isChinese(this.modificationData.host) || this.isChinese(this.modificationData.port)) {
|
||||
this.$message.error('主机地址,端口 不允许出现中文')
|
||||
return
|
||||
}
|
||||
if (this.modificationData.dbName < 0 || this.modificationData.dbName > 15) {
|
||||
this.$message.error('db超出有效范围!')
|
||||
return
|
||||
}
|
||||
console.log(this.modificationData.dbName);
|
||||
let params = {}
|
||||
params.name = this.modificationData.name
|
||||
params.host = this.modificationData.host
|
||||
params.userName = this.modificationData.userName
|
||||
params.password = this.modificationData.password
|
||||
params.port = this.modificationData.port
|
||||
params.dbName = this.modificationData.dbName ? this.modificationData.dbName : 0;
|
||||
return params;
|
||||
}
|
||||
}
|
||||
},
|
||||
checkHive() {
|
||||
|
||||
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.userName.indexOf(' ') !== -1 ||
|
||||
this.modificationData.password.indexOf(' ') !== -1 || this.modificationData
|
||||
.url.indexOf(' ') !== -1) {
|
||||
this.$message.error('不允许出现空格!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.modificationData.name.length < 4 || this.modificationData.url.length < 4 || this
|
||||
.modificationData.password.length < 4 || this.modificationData.userName.length < 4) {
|
||||
this.$message.error('均为必填项且长度不小于4!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.isChinese(this.modificationData.url) || this.isChinese(this.modificationData.userName)) {
|
||||
this.$message.error('连接地址,用户名 不允许出现中文')
|
||||
return false
|
||||
}
|
||||
|
||||
let params = {}
|
||||
params.name = this.modificationData.name
|
||||
params.url = this.modificationData.url
|
||||
params.userName = this.modificationData.userName
|
||||
params.password = this.modificationData.password
|
||||
return params;
|
||||
}
|
||||
}
|
||||
},
|
||||
checkSpark() {
|
||||
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.sparkHome.indexOf(' ') !== -
|
||||
1 ||
|
||||
this.modificationData.appName.indexOf(' ') !== -1 || this.modificationData.masterUrl.indexOf(' ') !== -
|
||||
1) {
|
||||
this.$message.error('不允许出现空格!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.modificationData.name.length < 4 || this.modificationData.sparkHome.length < 4 || this
|
||||
.modificationData.appName.length < 4 || this.modificationData.masterUrl.length < 4) {
|
||||
this.$message.error('均为必填项且长度不小于4!')
|
||||
return false;
|
||||
} else {
|
||||
if (this.isChinese(this.modificationData.sparkHome) || this.isChinese(this.modificationData
|
||||
.appName) || this.isChinese(this.modificationData.masterUrl)) {
|
||||
this.$message.error('spark-home,app-name,master 不允许出现中文')
|
||||
return false
|
||||
}
|
||||
|
||||
let params = {}
|
||||
params.name = this.modificationData.name
|
||||
params.sparkHome = this.modificationData.sparkHome
|
||||
params.appName = this.modificationData.appName
|
||||
params.masterUrl = this.modificationData.masterUrl
|
||||
return params;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 确定修改或者添加
|
||||
modificationSure() {
|
||||
let params = null;
|
||||
switch (this.sourceType) {
|
||||
case 'MySQL':
|
||||
params = this.checkMySql();
|
||||
break;
|
||||
case 'Redis':
|
||||
params = this.checkRedis();
|
||||
break;
|
||||
case 'Hive':
|
||||
params = this.checkHive();
|
||||
break;
|
||||
case 'Spark':
|
||||
params = this.checkSpark();
|
||||
break;
|
||||
case 'Oracle':
|
||||
params = this.checkMySql();
|
||||
break;
|
||||
case 'Sqlserver':
|
||||
params = this.checkMySql();
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
if (params) {
|
||||
params.type = this.sourceType;
|
||||
if (this.modificationId !== null) {
|
||||
params.id = this.modificationData.id
|
||||
this.updataDataSource(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.data.data.data.forEach((value, index) => {
|
||||
if (value.id === this.modificationData.id) {
|
||||
console.log(value.id, this.modificationData.id)
|
||||
this.$set(this.data.data.data, index, {
|
||||
...this.modificationData
|
||||
})
|
||||
}
|
||||
})
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
params.id = ""
|
||||
this.setDataSources(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
// 创建成功方法
|
||||
this.initData();
|
||||
// this.pageNo = 1
|
||||
// this.getDataSourcelists({
|
||||
// pageNo: this.pageNo,
|
||||
// pageSize: 10
|
||||
// })
|
||||
this.$message({
|
||||
message: '创建成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// console.log(this.modificationData.name.indexOf(' '))
|
||||
},
|
||||
// 新增数据源
|
||||
async setDataSources(params) {
|
||||
this.loading = true
|
||||
const data = await setDataSource(params)
|
||||
this.loading = false
|
||||
return data
|
||||
},
|
||||
// 修改数据源信息
|
||||
async updataDataSource(params) {
|
||||
this.loading = true
|
||||
const data = await updataDataSource(params)
|
||||
this.loading = false;
|
||||
return data
|
||||
},
|
||||
createEngine() {
|
||||
this.modificationVisible = true
|
||||
},
|
||||
searchEngine() {},
|
||||
async getDataSourcelists(params) {
|
||||
this.loading = true
|
||||
const data = await getDataSourcelist(params)
|
||||
if (data.status === "1") {
|
||||
this.data = data
|
||||
this.pageSize = data.data.pager.pages
|
||||
} else {
|
||||
this.$message.error('访问出错了-_-');
|
||||
}
|
||||
this.loading = false
|
||||
},
|
||||
deletelistsor(id) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'error'
|
||||
}).then(() => {
|
||||
this.deletelists(id)
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
deletelists(id) {
|
||||
this.deletelist(id).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.initData();
|
||||
// this.getDataSourcelists({
|
||||
// pageNo: this.pageNo,
|
||||
// pageSize: 10
|
||||
// })
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
async deletelist(id) {
|
||||
this.loading = true
|
||||
return await deleteDataSource(id)
|
||||
this.loading = false
|
||||
},
|
||||
currpage(num) {
|
||||
this.pageNo = num
|
||||
this.getDataSourcelists({
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
typeList:[this.sourceType]
|
||||
})
|
||||
console.log(this.pageNo)
|
||||
},
|
||||
isChinese(temp) {
|
||||
// var re = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
|
||||
// if (re.test(temp)) {
|
||||
// console.log(temp)
|
||||
// return false
|
||||
// };
|
||||
// return true;
|
||||
if (escape(temp).indexOf("%u") < 0) {
|
||||
return false
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-pagination.is-background .btn-next,
|
||||
.el-pagination.is-background .btn-prev,
|
||||
.el-pagination.is-background .el-pager li {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.el-pagination.is-background .el-pager li:not(.disabled).active {
|
||||
background-color: #409EFF !important;
|
||||
}
|
||||
|
||||
.textLayout {
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
padding-left: 30px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.textLayout>p {
|
||||
height: 100%;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.textLayout>p:nth-of-type(1) {
|
||||
width: 42%;
|
||||
text-align: right;
|
||||
margin-right: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.DataSource_look .textLayout>p:nth-of-type(2) {
|
||||
border-radius: 5px;
|
||||
line-height: 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.el-dialog {
|
||||
border-radius: 20px !important;
|
||||
}
|
||||
</style>
|
||||
119
h5-enginex-manager/src/components/page/Datamanage.vue
Executable file
119
h5-enginex-manager/src/components/page/Datamanage.vue
Executable file
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="指标管理" :getData="getDataFun"></cont>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cont from '@/components/common/cont.vue'
|
||||
import {
|
||||
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
name:'datamanage',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
type:1,
|
||||
row: [ {
|
||||
label: '序号',
|
||||
row: 'id'
|
||||
}, {
|
||||
label: '字段名称',
|
||||
row: 'fieldEn'
|
||||
}, {
|
||||
label: '字段中文名',
|
||||
row: 'fieldCn'
|
||||
}, {
|
||||
label: '字段类型',
|
||||
row: 'valueType',
|
||||
type: 'type'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type: 'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'nickName'
|
||||
},{
|
||||
label: '创建时间',
|
||||
row: 'created',
|
||||
type: 'Time'
|
||||
} ],
|
||||
redact: "dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getfieldListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) {
|
||||
e.fType = 1
|
||||
return await getfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) {
|
||||
return await addfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
|
||||
return await updatafieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) {
|
||||
|
||||
return await getfieldsave(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getInfo(e) {
|
||||
|
||||
console.log(e)
|
||||
return await getfieldInfo(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e) {
|
||||
|
||||
return await updatafield(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e) {
|
||||
|
||||
return await fieldusing(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e) {
|
||||
|
||||
return await fielddownTemplate(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldsubmit(e) {
|
||||
|
||||
return await fieldupdata(e).then(res => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
36
h5-enginex-manager/src/components/page/DragDialog.vue
Executable file
36
h5-enginex-manager/src/components/page/DragDialog.vue
Executable file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<section class="main">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-rank"></i> 拖拽组件</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>拖拽弹框</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<p>通过指令 v-dialogDrag 使 Dialog 对话框具有可拖拽的功能。</p>
|
||||
<br>
|
||||
<el-button type="primary" @click="visible = true;">点我弹框</el-button>
|
||||
</div>
|
||||
<el-dialog v-dialogDrag title="拖拽弹框" center :visible.sync="visible" width="30%">
|
||||
我是一个可以拖拽的对话框!
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="visible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
174
h5-enginex-manager/src/components/page/DragList.vue
Executable file
174
h5-enginex-manager/src/components/page/DragList.vue
Executable file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<section class="main">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-rank"></i> 拖拽组件</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>拖拽排序</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="plugins-tips">
|
||||
Vue.Draggable:基于 Sortable.js 的 Vue 拖拽组件。
|
||||
访问地址:<a href="https://github.com/SortableJS/Vue.Draggable" target="_blank">Vue.Draggable</a>
|
||||
</div>
|
||||
<div class="drag-box">
|
||||
<div class="drag-box-item">
|
||||
<div class="item-title">todo</div>
|
||||
<draggable v-model="todo" @remove="removeHandle" :options="dragOptions">
|
||||
<transition-group tag="div" id="todo" class="item-ul">
|
||||
<div v-for="item in todo" class="drag-list" :key="item.id">
|
||||
{{item.content}}
|
||||
</div>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</div>
|
||||
<div class="drag-box-item">
|
||||
<div class="item-title">doing</div>
|
||||
<draggable v-model="doing" @remove="removeHandle" :options="dragOptions">
|
||||
<transition-group tag="div" id="doing" class="item-ul">
|
||||
<div v-for="item in doing" class="drag-list" :key="item.id">
|
||||
{{item.content}}
|
||||
</div>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</div>
|
||||
<div class="drag-box-item">
|
||||
<div class="item-title">done</div>
|
||||
<draggable v-model="done" @remove="removeHandle" :options="dragOptions">
|
||||
<transition-group tag="div" id="done" class="item-ul">
|
||||
<div v-for="item in done" class="drag-list" :key="item.id">
|
||||
{{item.content}}
|
||||
</div>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import draggable from 'vuedraggable'
|
||||
export default {
|
||||
name: 'draglist',
|
||||
data() {
|
||||
return {
|
||||
dragOptions:{
|
||||
animation: 120,
|
||||
scroll: true,
|
||||
group: 'sortlist',
|
||||
ghostClass: 'ghost-style'
|
||||
},
|
||||
todo: [
|
||||
{
|
||||
id: 1,
|
||||
content: '开发图表组件'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
content: '开发拖拽组件'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
content: '开发权限测试组件'
|
||||
}
|
||||
],
|
||||
doing: [
|
||||
{
|
||||
id: 1,
|
||||
content: '开发登录注册页面'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
content: '开发头部组件'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
content: '开发表格相关组件'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
content: '开发表单相关组件'
|
||||
}
|
||||
],
|
||||
done:[
|
||||
{
|
||||
id: 1,
|
||||
content: '初始化项目,生成工程目录,完成相关配置'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
content: '开发项目整体框架'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
components:{
|
||||
draggable
|
||||
},
|
||||
methods: {
|
||||
removeHandle(event){
|
||||
console.log(event);
|
||||
this.$message.success(`从 ${event.from.id} 移动到 ${event.to.id} `);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drag-box{
|
||||
display: flex;
|
||||
user-select: none;
|
||||
}
|
||||
.drag-box-item {
|
||||
flex: 1;
|
||||
max-width: 330px;
|
||||
min-width: 300px;
|
||||
background-color: #eff1f5;
|
||||
margin-right: 16px;
|
||||
border-radius: 6px;
|
||||
border: 1px #e1e4e8 solid;
|
||||
}
|
||||
.item-title{
|
||||
padding: 8px 8px 8px 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: #24292e;
|
||||
font-weight: 600;
|
||||
}
|
||||
.item-ul{
|
||||
padding: 0 8px 8px;
|
||||
height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.item-ul::-webkit-scrollbar{
|
||||
width: 0;
|
||||
}
|
||||
.drag-list {
|
||||
border: 1px #e1e4e8 solid;
|
||||
padding: 10px;
|
||||
margin: 5px 0 10px;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
-webkit-transition: border .3s ease-in;
|
||||
transition: border .3s ease-in;
|
||||
}
|
||||
.drag-list:hover {
|
||||
border: 1px solid #20a0ff;
|
||||
}
|
||||
.drag-title {
|
||||
font-weight: 400;
|
||||
line-height: 25px;
|
||||
margin: 10px 0;
|
||||
font-size: 22px;
|
||||
color: #1f2f3d;
|
||||
}
|
||||
.ghost-style{
|
||||
display: block;
|
||||
color: transparent;
|
||||
border-style: dashed
|
||||
}
|
||||
</style>
|
||||
47
h5-enginex-manager/src/components/page/I18n.vue
Executable file
47
h5-enginex-manager/src/components/page/I18n.vue
Executable file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<section class="main">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-global"></i> {{$t('i18n.breadcrumb')}}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<span>{{$t('i18n.tips')}}</span>
|
||||
<el-button type="primary" @click="$i18n.locale = $i18n.locale === 'zh'?'en':'zh';">{{$t('i18n.btn')}}</el-button>
|
||||
<div class="list">
|
||||
<h2>{{$t('i18n.title1')}}</h2>
|
||||
<p>{{$t('i18n.p1')}}</p>
|
||||
<p>{{$t('i18n.p2')}}</p>
|
||||
<p>{{$t('i18n.p3')}}</p>
|
||||
</div>
|
||||
<h2>{{$t('i18n.title2')}}</h2>
|
||||
<div>
|
||||
<i18n path="i18n.info" tag="p">
|
||||
<a place="action" href="https://element.eleme.cn/2.0/#/zh-CN/component/i18n">{{ $t('i18n.value') }}</a>
|
||||
</i18n>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
data(){
|
||||
return {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.list{
|
||||
padding: 30px 0;
|
||||
}
|
||||
.list p{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
a{
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
225
h5-enginex-manager/src/components/page/Icon.vue
Executable file
225
h5-enginex-manager/src/components/page/Icon.vue
Executable file
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-emoji"></i> 自定义图标</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<h2>使用方法</h2>
|
||||
<p style="line-height: 50px;">
|
||||
直接通过设置类名为 el-icon-lx-iconName 来使用即可。例如:(共{{iconList.length}}个图标)
|
||||
</p>
|
||||
<p class="example-p">
|
||||
<i class="el-icon-lx-redpacket_fill" style="font-size: 30px;color: #ff5900"></i>
|
||||
<span><i class="el-icon-lx-redpacket_fill"></i></span>
|
||||
</p>
|
||||
<p class="example-p">
|
||||
<i class="el-icon-lx-weibo" style="font-size: 30px;color:#fd5656"></i>
|
||||
<span><i class="el-icon-lx-weibo"></i></span>
|
||||
</p>
|
||||
<p class="example-p">
|
||||
<i class="el-icon-lx-emojifill" style="font-size: 30px;color: #ffc300"></i>
|
||||
<span><i class="el-icon-lx-emojifill"></i></span>
|
||||
</p>
|
||||
<br>
|
||||
<h2>图标</h2>
|
||||
<div class="search-box">
|
||||
<el-input class="search" size="large" v-model="keyword" clearable placeholder="请输入图标名称"></el-input>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="icon-li" v-for="(item,index) in list" :key="index">
|
||||
<div class="icon-li-content">
|
||||
<i :class="`el-icon-lx-${item}`"></i>
|
||||
<span>{{item}}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function(){
|
||||
return {
|
||||
keyword: '',
|
||||
iconList: [
|
||||
'attentionforbid',
|
||||
'attentionforbidfill',
|
||||
'attention',
|
||||
'attentionfill',
|
||||
'tag',
|
||||
'tagfill',
|
||||
'people',
|
||||
'peoplefill',
|
||||
'notice',
|
||||
'noticefill',
|
||||
'mobile',
|
||||
'mobilefill',
|
||||
'voice',
|
||||
'voicefill',
|
||||
'unlock',
|
||||
'lock',
|
||||
'home',
|
||||
'homefill',
|
||||
'delete',
|
||||
'deletefill',
|
||||
'notification',
|
||||
'notificationfill',
|
||||
'notificationforbidfill',
|
||||
'like',
|
||||
'likefill',
|
||||
'comment',
|
||||
'commentfill',
|
||||
'camera',
|
||||
'camerafill',
|
||||
'warn',
|
||||
'warnfill',
|
||||
'time',
|
||||
'timefill',
|
||||
'location',
|
||||
'locationfill',
|
||||
'favor',
|
||||
'favorfill',
|
||||
'skin',
|
||||
'skinfill',
|
||||
'news',
|
||||
'newsfill',
|
||||
'record',
|
||||
'recordfill',
|
||||
'emoji',
|
||||
'emojifill',
|
||||
'message',
|
||||
'messagefill',
|
||||
'goods',
|
||||
'goodsfill',
|
||||
'crown',
|
||||
'crownfill',
|
||||
'move',
|
||||
'add',
|
||||
'hot',
|
||||
'hotfill',
|
||||
'service',
|
||||
'servicefill',
|
||||
'present',
|
||||
'presentfill',
|
||||
'pic',
|
||||
'picfill',
|
||||
'rank',
|
||||
'rankfill',
|
||||
'male',
|
||||
'female',
|
||||
'down',
|
||||
'top',
|
||||
'recharge',
|
||||
'rechargefill',
|
||||
'forward',
|
||||
'forwardfill',
|
||||
'info',
|
||||
'infofill',
|
||||
'redpacket',
|
||||
'redpacket_fill',
|
||||
'roundadd',
|
||||
'roundaddfill',
|
||||
'friendadd',
|
||||
'friendaddfill',
|
||||
'cart',
|
||||
'cartfill',
|
||||
'more',
|
||||
'moreandroid',
|
||||
'back',
|
||||
'right',
|
||||
'shop',
|
||||
'shopfill',
|
||||
'question',
|
||||
'questionfill',
|
||||
'roundclose',
|
||||
'roundclosefill',
|
||||
'roundcheck',
|
||||
'roundcheckfill',
|
||||
'global',
|
||||
'mail',
|
||||
'punch',
|
||||
'exit',
|
||||
'upload',
|
||||
'read',
|
||||
'file',
|
||||
'link',
|
||||
'full',
|
||||
'group',
|
||||
'friend',
|
||||
'profile',
|
||||
'addressbook',
|
||||
'calendar',
|
||||
'text',
|
||||
'copy',
|
||||
'share',
|
||||
'wifi',
|
||||
'vipcard',
|
||||
'weibo',
|
||||
'remind',
|
||||
'refresh',
|
||||
'filter',
|
||||
'settings',
|
||||
'scan',
|
||||
'qrcode',
|
||||
'cascades',
|
||||
'apps',
|
||||
'sort',
|
||||
'searchlist',
|
||||
'search',
|
||||
'edit'
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
list(){
|
||||
return this.iconList.filter((item) => {
|
||||
return item.indexOf(this.keyword) !== -1;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.example-p{
|
||||
height: 45px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.search-box{
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.search{
|
||||
width: 300px;
|
||||
}
|
||||
ul,li{
|
||||
list-style: none;
|
||||
}
|
||||
.icon-li{
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
.icon-li-content{
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.icon-li-content i{
|
||||
font-size: 36px;
|
||||
color: #606266;
|
||||
}
|
||||
.icon-li-content span{
|
||||
margin-top: 10px;
|
||||
color: #787878;
|
||||
}
|
||||
</style>
|
||||
149
h5-enginex-manager/src/components/page/Knowledge.vue
Executable file
149
h5-enginex-manager/src/components/page/Knowledge.vue
Executable file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="复杂规则集" :getData="getDataFun" ></cont>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import bus from '@/components/common/rule/bus.js'
|
||||
import cont from '@/components/common/rule/ruleCont.vue'
|
||||
import {
|
||||
getRulesList, // 获取列表
|
||||
addListRules, //新增文件夹
|
||||
getRulesListTree, // 获取列表树
|
||||
updataListRules, // 删除更新列表树
|
||||
getrulesave,
|
||||
getRuleInfo,
|
||||
getRuleUpdata,
|
||||
Rulesusing, // 删启停
|
||||
fielddownTemplate,
|
||||
ruleupdata,
|
||||
updateRuleParent, //更新文件夹
|
||||
addRuleVersion,
|
||||
updateRuleVersionStatus,
|
||||
copyRuleVersion,
|
||||
updateRuleVersion,
|
||||
getRuleVersionInfo //获取具体规则
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
name:'Knowledge',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
type:2,
|
||||
treeType:'5',
|
||||
row: [{
|
||||
label: '规则代码',
|
||||
row: 'code',
|
||||
}, {
|
||||
label: '规则名称',
|
||||
row: 'name'
|
||||
}, {
|
||||
label: '规则描述',
|
||||
row: 'description'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type: 'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'authorName'
|
||||
}, {
|
||||
label: '创建时间',
|
||||
row: 'created',
|
||||
type: 'Time'
|
||||
}],
|
||||
redact: "dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getRulesListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) { // 获取列表
|
||||
e.ruleInfo.difficulty=2
|
||||
return await getRulesList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) { //新增文件夹
|
||||
return await addListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
return await updataListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) {
|
||||
return await getrulesave(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getVersion(e) { //获取单个规则详细信息
|
||||
return await getRuleInfo(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e) {
|
||||
return await getRuleUpdata(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e) {
|
||||
return await Rulesusing(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e) {
|
||||
return await fielddownTemplate(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updateParent(e) {
|
||||
return await updateRuleParent(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getInfo(e) { //获取单个规则详细信息
|
||||
return await getRuleVersionInfo(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addVersion(e) { //添加新版本
|
||||
return await addRuleVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async delectVersion(e) { //删除版本
|
||||
return await updateRuleVersionStatus(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async copyVersion(e) { //复制新版本
|
||||
return await copyRuleVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updateVersion(e) { //更新版本
|
||||
return await updateRuleVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
134
h5-enginex-manager/src/components/page/Login.vue
Executable file
134
h5-enginex-manager/src/components/page/Login.vue
Executable file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<div class="login-wrap">
|
||||
<div class="ms-login">
|
||||
<div class="ms-title">决策引擎系统</div>
|
||||
<el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="param.username" placeholder="username">
|
||||
<el-button slot="prepend" icon="el-icon-lx-people"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
type="password"
|
||||
placeholder="password"
|
||||
v-model="param.password"
|
||||
@keyup.enter.native="submitForm()"
|
||||
>
|
||||
<el-button slot="prepend" icon="el-icon-lx-lock"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<div class="login-btn">
|
||||
<el-button type="primary" @click="submitForm()">登录</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLogin } from '../../api/index';
|
||||
export default {
|
||||
created() {
|
||||
// if(this.$route.query.type=="token"){
|
||||
// this.$message.error('登陆授权码已过期')
|
||||
// this.$route.query.type=""
|
||||
// }
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
param: {
|
||||
username: '',
|
||||
password: '',
|
||||
},
|
||||
rules: {
|
||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.$refs.login.validate(valid => {
|
||||
if (valid) {
|
||||
// 调用登录接口
|
||||
this.getLogins();
|
||||
|
||||
} else {
|
||||
this.$message.error('请输入账号和密码');
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
async getLogins() {
|
||||
// var formdata = new FormData();
|
||||
// formdata.append('account', this.param.username);
|
||||
// formdata.append('password', this.param.password);
|
||||
var params ={
|
||||
account:this.param.username,
|
||||
password:this.param.password
|
||||
}
|
||||
|
||||
const data = await getLogin(params);
|
||||
console.log('登录接口返回的数据',data);
|
||||
const code = data.code;
|
||||
|
||||
if(data.status==="1"){
|
||||
this.$message.success('登录成功,即将跳转');
|
||||
localStorage.setItem('ms_username', this.param.username);
|
||||
localStorage.setItem('token', data.data.token);
|
||||
this.$router.push('/');
|
||||
this.mixinReGetStorage()
|
||||
}
|
||||
else{
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url(../../assets/img/login-bg.jpg);
|
||||
background-size: 100%;
|
||||
}
|
||||
.ms-title {
|
||||
width: 100%;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.ms-login {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 350px;
|
||||
margin: -190px 0 0 -175px;
|
||||
border-radius: 5px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
.ms-content {
|
||||
padding: 30px 30px;
|
||||
}
|
||||
.login-btn {
|
||||
text-align: center;
|
||||
}
|
||||
.login-btn button {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.login-tips {
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
67
h5-enginex-manager/src/components/page/Markdown.vue
Executable file
67
h5-enginex-manager/src/components/page/Markdown.vue
Executable file
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-calendar"></i> 表单</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>markdown编辑器</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="plugins-tips">
|
||||
mavonEditor:基于Vue的markdown编辑器。
|
||||
访问地址:<a href="https://github.com/hinesboy/mavonEditor" target="_blank">mavonEditor</a>
|
||||
</div>
|
||||
<mavon-editor v-model="content" ref="md" @imgAdd="$imgAdd" @change="change" style="min-height: 600px"/>
|
||||
<el-button class="editor-btn" type="primary" @click="submit">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mavonEditor } from 'mavon-editor'
|
||||
import 'mavon-editor/dist/css/index.css'
|
||||
export default {
|
||||
name: 'markdown',
|
||||
data: function(){
|
||||
return {
|
||||
content:'',
|
||||
html:'',
|
||||
configs: {
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
mavonEditor
|
||||
},
|
||||
methods: {
|
||||
// 将图片上传到服务器,返回地址替换到md中
|
||||
$imgAdd(pos, $file){
|
||||
var formdata = new FormData();
|
||||
formdata.append('file', $file);
|
||||
// 这里没有服务器供大家尝试,可将下面上传接口替换为你自己的服务器接口
|
||||
this.$axios({
|
||||
url: '/common/upload',
|
||||
method: 'post',
|
||||
data: formdata,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}).then((url) => {
|
||||
this.$refs.md.$img2Url(pos, url);
|
||||
})
|
||||
},
|
||||
change(value, render){
|
||||
// render 为 markdown 解析后的结果
|
||||
this.html = render;
|
||||
},
|
||||
submit(){
|
||||
console.log(this.content);
|
||||
console.log(this.html);
|
||||
this.$message.success('提交成功!');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.editor-btn{
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
38
h5-enginex-manager/src/components/page/Permission.vue
Executable file
38
h5-enginex-manager/src/components/page/Permission.vue
Executable file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-warn"></i> 权限测试</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<h1>管理员权限页面</h1>
|
||||
<p>只有用 admin 账号登录的才拥有管理员权限,才能进到这个页面,其他账号想进来都会跳到403页面,重新用管理员账号登录才有权限。</p>
|
||||
<p>想尝试一下,请<router-link to="/login" class="logout">退出登录</router-link>,随便输入个账号名,再进来试试看。</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function(){
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h1{
|
||||
text-align: center;
|
||||
margin: 30px 0;
|
||||
}
|
||||
p{
|
||||
line-height: 30px;
|
||||
margin-bottom: 10px;
|
||||
text-indent: 2em;
|
||||
}
|
||||
.logout{
|
||||
color: #409EFF;
|
||||
}
|
||||
</style>
|
||||
124
h5-enginex-manager/src/components/page/SQLManage.vue
Executable file
124
h5-enginex-manager/src/components/page/SQLManage.vue
Executable file
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="数据源指标" :getData="getDataFun"></cont>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cont from '@/components/common/cont.vue'
|
||||
import {
|
||||
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
name:'SQLManage',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
type:2,
|
||||
row: [ {
|
||||
label: '创建时间',
|
||||
row: 'created',
|
||||
type:'Time'
|
||||
}, {
|
||||
label: '序号',
|
||||
row: 'id'
|
||||
}, {
|
||||
label: '字段名称',
|
||||
row: 'fieldEn'
|
||||
}, {
|
||||
label: '字段中文名',
|
||||
row: 'fieldCn'
|
||||
}, {
|
||||
label: '数据源类型',
|
||||
row: 'valueType',
|
||||
type:'type'
|
||||
}, {
|
||||
label: '字段类型',
|
||||
row: 'valueType',
|
||||
type:'type'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type:'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'nickName'
|
||||
},],
|
||||
redact:"dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getfieldListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) {
|
||||
e.fType = 2
|
||||
return await getfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) {
|
||||
|
||||
return await addfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
|
||||
return await updatafieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) {
|
||||
|
||||
return await getfieldsave(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getInfo(e){
|
||||
|
||||
return await getfieldInfo(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e){
|
||||
|
||||
return await updatafield(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e){
|
||||
|
||||
return await fieldusing(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e){
|
||||
|
||||
return await fielddownTemplate(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldsubmit(e){
|
||||
|
||||
return await fieldupdata(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
129
h5-enginex-manager/src/components/page/Tabs.vue
Executable file
129
h5-enginex-manager/src/components/page/Tabs.vue
Executable file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-copy"></i> tab选项卡</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<el-tabs v-model="message">
|
||||
<el-tab-pane :label="`未读消息(${unread.length})`" name="first">
|
||||
<el-table :data="unread" :show-header="false" style="width: 100%">
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<span class="message-title">{{scope.row.title}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" width="180"></el-table-column>
|
||||
<el-table-column width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" @click="handleRead(scope.$index)">标为已读</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="handle-row">
|
||||
<el-button type="primary">全部标为已读</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="`已读消息(${read.length})`" name="second">
|
||||
<template v-if="message === 'second'">
|
||||
<el-table :data="read" :show-header="false" style="width: 100%">
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<span class="message-title">{{scope.row.title}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" width="150"></el-table-column>
|
||||
<el-table-column width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="danger" @click="handleDel(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="handle-row">
|
||||
<el-button type="danger">删除全部</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="`回收站(${recycle.length})`" name="third">
|
||||
<template v-if="message === 'third'">
|
||||
<el-table :data="recycle" :show-header="false" style="width: 100%">
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<span class="message-title">{{scope.row.title}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" width="150"></el-table-column>
|
||||
<el-table-column width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="handleRestore(scope.$index)">还原</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="handle-row">
|
||||
<el-button type="danger">清空回收站</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tabs',
|
||||
data() {
|
||||
return {
|
||||
message: 'first',
|
||||
showHeader: false,
|
||||
unread: [{
|
||||
date: '2018-04-19 20:00:00',
|
||||
title: '【系统通知】该系统将于今晚凌晨2点到5点进行升级维护',
|
||||
},{
|
||||
date: '2018-04-19 21:00:00',
|
||||
title: '今晚12点整发大红包,先到先得',
|
||||
}],
|
||||
read: [{
|
||||
date: '2018-04-19 20:00:00',
|
||||
title: '【系统通知】该系统将于今晚凌晨2点到5点进行升级维护'
|
||||
}],
|
||||
recycle: [{
|
||||
date: '2018-04-19 20:00:00',
|
||||
title: '【系统通知】该系统将于今晚凌晨2点到5点进行升级维护'
|
||||
}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRead(index) {
|
||||
const item = this.unread.splice(index, 1);
|
||||
console.log(item);
|
||||
this.read = item.concat(this.read);
|
||||
},
|
||||
handleDel(index) {
|
||||
const item = this.read.splice(index, 1);
|
||||
this.recycle = item.concat(this.recycle);
|
||||
},
|
||||
handleRestore(index) {
|
||||
const item = this.recycle.splice(index, 1);
|
||||
this.read = item.concat(this.read);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
unreadNum(){
|
||||
return this.unread.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.message-title{
|
||||
cursor: pointer;
|
||||
}
|
||||
.handle-row{
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
141
h5-enginex-manager/src/components/page/Upload.vue
Executable file
141
h5-enginex-manager/src/components/page/Upload.vue
Executable file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-calendar"></i> 表单</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>图片上传</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="content-title">支持拖拽</div>
|
||||
<div class="plugins-tips">
|
||||
Element UI自带上传组件。
|
||||
访问地址:<a href="http://element.eleme.io/#/zh-CN/component/upload" target="_blank">Element UI Upload</a>
|
||||
</div>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
drag
|
||||
action="http://jsonplaceholder.typicode.com/api/posts/"
|
||||
multiple>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
<div class="content-title">支持裁剪</div>
|
||||
<div class="plugins-tips">
|
||||
vue-cropperjs:一个封装了 cropperjs 的 Vue 组件。
|
||||
访问地址:<a href="https://github.com/Agontuk/vue-cropperjs" target="_blank">vue-cropperjs</a>
|
||||
</div>
|
||||
<div class="crop-demo">
|
||||
<img :src="cropImg" class="pre-img">
|
||||
<div class="crop-demo-btn">选择图片
|
||||
<input class="crop-input" type="file" name="image" accept="image/*" @change="setImage"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="裁剪图片" :visible.sync="dialogVisible" width="30%">
|
||||
<vue-cropper ref='cropper' :src="imgSrc" :ready="cropImage" :zoom="cropImage" :cropmove="cropImage" style="width:100%;height:300px;"></vue-cropper>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelCrop">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueCropper from 'vue-cropperjs';
|
||||
export default {
|
||||
name: 'upload',
|
||||
data: function(){
|
||||
return {
|
||||
defaultSrc: require('../../assets/img/img.jpg'),
|
||||
fileList: [],
|
||||
imgSrc: '',
|
||||
cropImg: '',
|
||||
dialogVisible: false,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
VueCropper
|
||||
},
|
||||
methods:{
|
||||
setImage(e){
|
||||
const file = e.target.files[0];
|
||||
if (!file.type.includes('image/')) {
|
||||
return;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
this.dialogVisible = true;
|
||||
this.imgSrc = event.target.result;
|
||||
this.$refs.cropper && this.$refs.cropper.replace(event.target.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
},
|
||||
cropImage () {
|
||||
this.cropImg = this.$refs.cropper.getCroppedCanvas().toDataURL();
|
||||
},
|
||||
cancelCrop(){
|
||||
this.dialogVisible = false;
|
||||
this.cropImg = this.defaultSrc;
|
||||
},
|
||||
imageuploaded(res) {
|
||||
console.log(res)
|
||||
},
|
||||
handleError(){
|
||||
this.$notify.error({
|
||||
title: '上传失败',
|
||||
message: '图片上传接口上传失败,可更改为自己的服务器接口'
|
||||
});
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.cropImg = this.defaultSrc;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content-title{
|
||||
font-weight: 400;
|
||||
line-height: 50px;
|
||||
margin: 10px 0;
|
||||
font-size: 22px;
|
||||
color: #1f2f3d;
|
||||
}
|
||||
.pre-img{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: #f8f8f8;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.crop-demo{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.crop-demo-btn{
|
||||
position: relative;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 20px;
|
||||
margin-left: 30px;
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.crop-input{
|
||||
position: absolute;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
53
h5-enginex-manager/src/components/page/VueEditor.vue
Executable file
53
h5-enginex-manager/src/components/page/VueEditor.vue
Executable file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item><i class="el-icon-lx-calendar"></i> 表单</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>编辑器</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="plugins-tips">
|
||||
Vue-Quill-Editor:基于Quill、适用于Vue2的富文本编辑器。
|
||||
访问地址:<a href="https://github.com/surmon-china/vue-quill-editor" target="_blank">vue-quill-editor</a>
|
||||
</div>
|
||||
<quill-editor ref="myTextEditor" v-model="content" :options="editorOption"></quill-editor>
|
||||
<el-button class="editor-btn" type="primary" @click="submit">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'quill/dist/quill.core.css';
|
||||
import 'quill/dist/quill.snow.css';
|
||||
import 'quill/dist/quill.bubble.css';
|
||||
import { quillEditor } from 'vue-quill-editor';
|
||||
export default {
|
||||
name: 'editor',
|
||||
data: function(){
|
||||
return {
|
||||
content: '',
|
||||
editorOption: {
|
||||
placeholder: 'Hello World'
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
quillEditor
|
||||
},
|
||||
methods: {
|
||||
onEditorChange({ editor, html, text }) {
|
||||
this.content = html;
|
||||
},
|
||||
submit(){
|
||||
console.log(this.content);
|
||||
this.$message.success('提交成功!');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.editor-btn{
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
6
h5-enginex-manager/src/components/page/bus.js
Executable file
6
h5-enginex-manager/src/components/page/bus.js
Executable file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
127
h5-enginex-manager/src/components/page/easyRule.vue
Executable file
127
h5-enginex-manager/src/components/page/easyRule.vue
Executable file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="基础规则集" :getData="getDataFun"></cont>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import bus from '@/components/common/rule/bus.js'
|
||||
import cont from '@/components/common/rule/ruleCont.vue'
|
||||
import {
|
||||
getRulesList, // 获取列表
|
||||
addListRules, //新增文件夹
|
||||
getRulesListTree, // 获取列表树
|
||||
updataListRules, // 删除更新列表树
|
||||
getrulesave,
|
||||
getRuleInfo,
|
||||
getRuleUpdata,
|
||||
Rulesusing, // 删启停
|
||||
fielddownTemplate,
|
||||
getEasyRulesave,
|
||||
getEasyRuleUpdata,
|
||||
getEasyRuleInfo,
|
||||
ruleupdata,
|
||||
updateRuleParent //更新文件夹
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
name:'easyRule',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
type:1,
|
||||
treeType:'0',
|
||||
row: [{
|
||||
label: '规则代码',
|
||||
row: 'code',
|
||||
}, {
|
||||
label: '规则名称',
|
||||
row: 'name'
|
||||
}, {
|
||||
label: '规则描述',
|
||||
row: 'description'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type: 'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'authorName'
|
||||
}, {
|
||||
label: '创建时间',
|
||||
row: 'created',
|
||||
type: 'Time'
|
||||
}],
|
||||
redact: "dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getRulesListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) { // 获取列表
|
||||
e.ruleInfo.difficulty=1
|
||||
return await getRulesList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) { //新增文件夹
|
||||
return await addListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
return await updataListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) {
|
||||
return await getEasyRulesave(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
async getInfo(e) { //获取单个规则详细信息
|
||||
return await getEasyRuleInfo({id:e}).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e) {
|
||||
return await getEasyRuleUpdata(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e) {
|
||||
return await Rulesusing(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e) {
|
||||
return await fielddownTemplate(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldsubmit(e) {
|
||||
return await ruleupdata(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updateParent(e) {
|
||||
return await updateRuleParent(e).then(res => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
191
h5-enginex-manager/src/components/page/engineSummary.vue
Executable file
191
h5-enginex-manager/src/components/page/engineSummary.vue
Executable file
@@ -0,0 +1,191 @@
|
||||
<style >
|
||||
.engSu{
|
||||
display: flex;
|
||||
border: 1px solid #ccc;
|
||||
align-items: center;
|
||||
height: 80px;
|
||||
margin-top: 20px;
|
||||
border-radius: 5px;
|
||||
justify-content: space-around;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
.engSu_cont{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border: 1px dashed #ccc;
|
||||
height: 50px;
|
||||
margin-left: 20px;
|
||||
border-radius: 5px;
|
||||
transition: all 1s;
|
||||
/* border: 1px solid #ddd; */
|
||||
}
|
||||
.engSu_cont>div:nth-of-type(1){
|
||||
background-color: #2db46c;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
}
|
||||
.engSu_day{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.engSu_day>div{
|
||||
width: 80px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.engSu_day>div>p:nth-of-type(1){
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.engSu_name{
|
||||
border: 1px solid #ddd;
|
||||
width: 150px;
|
||||
text-align: center;
|
||||
/* background-color: #000000; */
|
||||
}
|
||||
.engSu_top{
|
||||
|
||||
width: 50px;
|
||||
border-radius: 50%;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
margin-left: 20px;
|
||||
color: #fff;
|
||||
font-size: 26px;
|
||||
}
|
||||
.engSuFor{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
transition: all 0.3s;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.engSuForHome{
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div :style="{width:'100%',height:klist.length*120+'px'}" class="engSuForHome">
|
||||
<div v-for="(value,index) in klist" :key="value.id" class="engSuFor" :style="{top:index*120+'px'}">
|
||||
<div class="engSu">
|
||||
<div class="engSu_name">
|
||||
{{value.name}}
|
||||
</div>
|
||||
<div class="engSu_cont">
|
||||
<div>
|
||||
调用次数
|
||||
</div>
|
||||
<div class="engSu_day">
|
||||
<div>
|
||||
<p>昨日</p>
|
||||
<p>{{value.call.yesterday}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日</p>
|
||||
<p>{{value.call.today}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日预计</p>
|
||||
<p>{{value.call.todayPredict}}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="engSu_cont">
|
||||
<div>
|
||||
决策结果
|
||||
</div>
|
||||
<div class="engSu_day">
|
||||
<div>
|
||||
<p>昨日</p>
|
||||
<p>{{value.call.yesterday}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日</p>
|
||||
<p>{{value.call.today}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日预计</p>
|
||||
<p>{{value.call.todayPredict}}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="engSu_cont">
|
||||
<div>
|
||||
命中规则
|
||||
</div>
|
||||
<div class="engSu_day">
|
||||
<div>
|
||||
<p>昨日</p>
|
||||
<p>{{value.call.yesterday}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日</p>
|
||||
<p>{{value.call.today}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>今日预计</p>
|
||||
<p>{{value.call.todayPredict}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="engSu_top" :style="{backgroundColor:value.top?'#349d00':'#dcdcdc'}" @click="switchTop(value)">
|
||||
<i class="el-icon-top"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getengineSummaryList} from '../../api/index'
|
||||
export default{
|
||||
name:'engineSummary',
|
||||
data(){
|
||||
return {
|
||||
topKlist:[],
|
||||
klist:[]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getengineSummaryList().then(res=>{
|
||||
if(res.status=="1"){
|
||||
this.klist = res.data.klist
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
methods:{
|
||||
switchTop(item){
|
||||
this.klist.forEach((value,index)=>{
|
||||
if(value == item){
|
||||
this.klist.splice(index,1)
|
||||
}
|
||||
})
|
||||
item.top=!item.top
|
||||
if(item.top){
|
||||
this.klist.unshift(item)
|
||||
}else{
|
||||
this.klist.push(item)
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
151
h5-enginex-manager/src/components/page/listOperation.vue
Executable file
151
h5-enginex-manager/src/components/page/listOperation.vue
Executable file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="集合操作" :getData="getDataFun"></cont>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cont from '@/components/common/listOperation/listOperation.vue'
|
||||
import {
|
||||
getListOperationList, // 获取列表
|
||||
addListRules, //新增文件夹
|
||||
getRulesListTree, // 获取列表树
|
||||
updataListRules, // 删除更新列表树
|
||||
getrulesave,
|
||||
getListOperation,
|
||||
getRuleUpdata,
|
||||
updateListOperationStatus, // 删启停
|
||||
fielddownTemplate,
|
||||
updateListOperation, //更新内容
|
||||
addListOperation,// 添加
|
||||
updateListOperationFolder, // 移动文件夹
|
||||
getDecisionTreeVersionInfo,
|
||||
addlistOperationVersion, // 添加版本
|
||||
copyListOperationVersion, // 复制版本
|
||||
updatelistOperationVersion, // 重命名版本
|
||||
updatelistOperationStatusVersion //删除版本
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
name:'decisionTree',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
treeType:'8',
|
||||
row: [{
|
||||
label: '集合代码',
|
||||
row: 'code',
|
||||
}, {
|
||||
label: '集合名称',
|
||||
row: 'name'
|
||||
}, {
|
||||
label: '集合描述',
|
||||
row: 'description'
|
||||
}, {
|
||||
label: '类型',
|
||||
row: 'opType',
|
||||
fn: (res)=>res==1?'集合规则':'集合处理'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type: 'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'createUserName'
|
||||
}, {
|
||||
label: '创建时间',
|
||||
row: 'createTime',
|
||||
type: 'Time'
|
||||
}],
|
||||
redact: "dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getRulesListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) { // 获取列表
|
||||
return await getListOperationList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) { //新增文件夹
|
||||
return await addListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
return await updataListRules(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) { // 添加
|
||||
return await addListOperation(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getVersion(e) { //获取单个规则详细信息
|
||||
return await getListOperation(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getInfo(e) { //获取单个规则详细信息
|
||||
return await getDecisionTreeVersionInfo(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e) { //更新内容
|
||||
return await updateListOperation(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e) {
|
||||
return await updateListOperationStatus(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e) {
|
||||
return await fielddownTemplate(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updateParent(e) { // 移动文件夹
|
||||
return await updateListOperationFolder(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addVersion(e) { //添加新版本
|
||||
return await addlistOperationVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async delectVersion(e) { //删除版本
|
||||
return await updatelistOperationStatusVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async copyVersion(e) { //复制新版本
|
||||
return await copyListOperationVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updateVersion(e) { //更新版本
|
||||
return await updatelistOperationVersion(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
117
h5-enginex-manager/src/components/page/portManage.vue
Executable file
117
h5-enginex-manager/src/components/page/portManage.vue
Executable file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<cont title="接口指标" :getData="getDataFun"></cont>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cont from '@/components/common/cont.vue'
|
||||
import {
|
||||
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
|
||||
} from '@/api/index.js'
|
||||
|
||||
export default {
|
||||
name:'portManage',
|
||||
components: {
|
||||
cont
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
getDataFun: {
|
||||
type:4,
|
||||
row: [ {
|
||||
label: '创建时间',
|
||||
row: 'created',
|
||||
type:'Time'
|
||||
}, {
|
||||
label: '序号',
|
||||
row: 'id'
|
||||
}, {
|
||||
label: '字段名称',
|
||||
row: 'fieldEn'
|
||||
}, {
|
||||
label: '字段中文名',
|
||||
row: 'fieldCn'
|
||||
}, {
|
||||
label: '字段类型',
|
||||
row: 'valueType',
|
||||
type:'type'
|
||||
}, {
|
||||
label: '状态',
|
||||
row: 'status',
|
||||
type:'State'
|
||||
}, {
|
||||
label: '创建人',
|
||||
row: 'nickName'
|
||||
},],
|
||||
redact:"dataManageRedact",
|
||||
async getTree(e){
|
||||
return await getfieldListTree(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getlist(e) {
|
||||
e.fType = 4
|
||||
return await getfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async addlist(e) {
|
||||
|
||||
return await addfieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatalist(e) {
|
||||
|
||||
return await updatafieldList(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async setsave(e) {
|
||||
|
||||
return await getfieldsave(e).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
async getInfo(e){
|
||||
|
||||
return await getfieldInfo(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async updatafield(e){
|
||||
|
||||
return await updatafield(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldusing(e){
|
||||
|
||||
return await fieldusing(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async down(e){
|
||||
|
||||
return await fielddownTemplate(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
},
|
||||
async fieldsubmit(e){
|
||||
|
||||
return await fieldupdata(e).then(res=>{
|
||||
return res
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
666
h5-enginex-manager/src/components/page/portSource.vue
Executable file
666
h5-enginex-manager/src/components/page/portSource.vue
Executable file
@@ -0,0 +1,666 @@
|
||||
<template>
|
||||
<div style="height: 90%; " class="portS">
|
||||
<!-- 创建和搜索 -->
|
||||
<div class="datasou_top" style="height: 10%;">
|
||||
<el-row style="margin-bottom: 30px;margin-top: 20px;">
|
||||
<el-col :span="15">
|
||||
<el-button type="primary" @click="createEngine">创建接口</el-button>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="datasou_cont" style="height: 80%;" v-if="data">
|
||||
<div class="datasou_table">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-table border :data="data.data.klist" style="width: 100%" :cell-style="{padding: '10px'}"
|
||||
v-loading="loading">
|
||||
|
||||
<el-table-column prop="id" label="ID" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="连接名称" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="url" label="连接地址" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="method" label="请求方法" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="requestBody" label="请求体类型" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="" label="调用量" align="center" show-overflow-tooltip>
|
||||
{{1}}
|
||||
</el-table-column>
|
||||
<el-table-column prop="creatorName" label="创建人" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updataTime" label="最后更新时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span style="white-space: nowrap;">{{
|
||||
new Date(scope.row.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row.updateTime).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<div style="display: flex;">
|
||||
<el-button icon="el-icon-search" circle size="mini"
|
||||
@click="dialogShow(scope.$index)"></el-button>
|
||||
<el-button type="primary" icon="el-icon-edit" circle size="mini"
|
||||
@click="modificationShow(scope.row.id)"></el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" circle size="mini"
|
||||
@click="deletelistsor(scope.row.id)"></el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
<div style="float: right;margin-right: 120px;margin-top: 40px;">
|
||||
<el-pagination :current-page="pageNo" @current-change="currpage" background layout="prev, pager, next"
|
||||
:total="data.data.pageInfo.total" v-if="data!==null">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="接口详情" :visible.sync="dialogVisible" width="40%" :before-close="handleClose"
|
||||
class="DataSource_look">
|
||||
<div v-if="tempDialogData!==null">
|
||||
<div class="port_textLayout">
|
||||
<p>连接名称:</p>
|
||||
<p v-if="tempDialogData.name">{{tempDialogData.name}}</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>连接地址:</p>
|
||||
<p v-if="tempDialogData.url">{{tempDialogData.url}}</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>请求方式:</p>
|
||||
<p v-if="tempDialogData.method">{{tempDialogData.method}}</p>
|
||||
</div>
|
||||
<div class="port_textLayout" >
|
||||
<p>请求头:</p>
|
||||
<div v-if="tempDialogData.requestHeaders" >
|
||||
<p
|
||||
v-for="value in typeof tempDialogData.requestHeaders == 'string'?JSON.parse(tempDialogData.requestHeaders):tempDialogData.requestHeaders">
|
||||
{{value.key}}:{{value.value}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="port_textLayout" style="margin-top: 20px;">
|
||||
<p>请求体:</p>
|
||||
<el-input type="textarea" rows="8" placeholder="格式:{page:1} 变量格式:name:{name}"
|
||||
v-model="tempDialogData.requestBody" disabled style="width: 400px;">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>响应体:</p>
|
||||
<el-input type="textarea" rows="8" v-model="tempDialogData.responseBody" disabled
|
||||
style="width: 400px;">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>创建时间:</p>
|
||||
<p v-if="tempDialogData.createTime">
|
||||
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>创建人:</p>
|
||||
<p v-if="tempDialogData.creatorName">{{tempDialogData.creatorName}}</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>修改时间:</p>
|
||||
<p v-if="tempDialogData.updateTime">
|
||||
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>修改人:</p>
|
||||
<p v-if="tempDialogData.modifierName">{{tempDialogData.modifierName}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
数据错误 请重新尝试
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogVisible = false;tempDialogData=null">确 定</el-button>
|
||||
</span>
|
||||
|
||||
</el-dialog>
|
||||
<el-dialog :title="modificationId===null?'创建接口':'修改接口'" :visible.sync="modificationVisible" width="40%"
|
||||
class="portS_dialog" :before-close="handleClose">
|
||||
<div v-loading="dialogLoading">
|
||||
<div class="port_textLayout">
|
||||
<p><span style="color: red;">*</span>接口名称:</p>
|
||||
<p>
|
||||
<el-input placeholder="请输入连接名称" v-model="modificationData.name" clearable maxlength="20">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="port_textLayout">
|
||||
<p><span style="color: red;">*</span>请求地址:</p>
|
||||
<p>
|
||||
<el-input placeholder="如:192.168.1.1" v-model="modificationData.url" clearable maxlength="100">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p><span style="color: red;">*</span>请求方法:</p>
|
||||
<p>
|
||||
<el-select v-model="modificationData.method" placeholder="请选择请求方法">
|
||||
<el-option label="Get" value="GET"></el-option>
|
||||
<el-option label="Post" value="POST"></el-option>
|
||||
</el-select>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="port_textLayout">
|
||||
<p>请求头参数:</p>
|
||||
<div>
|
||||
<p style="display: flex;align-items: center;margin-top: 5px;">
|
||||
<el-input placeholder="key" v-model="modificationData.requestHeaders[0].key" disabled
|
||||
clearable size="mini"></el-input>
|
||||
<span>:</span>
|
||||
<el-select v-model="modificationData.requestHeaders[0].value" size="mini"
|
||||
placeholder="请选择请求方法">
|
||||
<el-option label="/json" value="application/json"></el-option>
|
||||
<el-option label="/x-www-form-urlencoded" value="application/x-www-form-urlencoded">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<i class="el-icon-circle-plus-outline" style="color: #409EFF;font-size: 20px;"
|
||||
@click="addheader(0)"></i>
|
||||
<i class="el-icon-circle-close" style="color: #ddd;font-size: 20px;"></i>
|
||||
</p>
|
||||
|
||||
<p v-for="(value,index) in modificationData.requestHeaders"
|
||||
style="display: flex;align-items: center;margin-top: 5px;" v-if="index!=0">
|
||||
<el-input placeholder="key" v-model="value.key" clearable size="mini"></el-input>
|
||||
<span>:</span>
|
||||
<el-input placeholder="value" v-model="value.value" clearable size="mini"></el-input>
|
||||
<i class="el-icon-circle-plus-outline" style="color: #409EFF;font-size: 20px;"
|
||||
@click="addheader(index)"></i>
|
||||
<i class="el-icon-circle-close" style="color: #F56C6C;font-size: 20px;"
|
||||
@click="delectheader(index)"></i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>请求体:</p>
|
||||
<p>
|
||||
<el-input type="textarea" rows="12" placeholder="格式:{page:1} 变量格式:name:{name}"
|
||||
v-model="modificationData.requestBody" style="width: 400px;">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>测试请求:</p>
|
||||
<p>
|
||||
<el-button plain @click="getHttpResponses">请求测试</el-button>
|
||||
<el-button plain @click="lookBig">大屏查看请求响应体</el-button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="port_textLayout">
|
||||
<p>响应体:</p>
|
||||
<p>
|
||||
<el-input type="textarea" placeholder="点击请求测试获取此值" v-model="modificationData.responseBody"
|
||||
style="width: 400px;">
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose" :disabled="dialogLoading?'disabled':false">取 消</el-button>
|
||||
<el-button type="primary" :disabled="dialogLoading?'disabled':false" @click="modificationSure">确 定
|
||||
</el-button>
|
||||
</span>
|
||||
<el-dialog width="70%" title="数据" :visible.sync="dialogVisibleBigData" append-to-body :close-on-click-modal="false">
|
||||
<span>
|
||||
ps:在此处也可以修改数据
|
||||
</span>
|
||||
<div style="display: flex;justify-content: space-between;width: 100%;">
|
||||
|
||||
<div style="width: 50%;">
|
||||
<p>请求体:</p>
|
||||
<p>
|
||||
<el-input type="textarea" rows="26" placeholder="格式:{page:1} 变量格式:name:{name}"
|
||||
v-model="modificationData.requestBody" >
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
<div style="width: 50%;">
|
||||
<p>响应体:</p>
|
||||
<p>
|
||||
<el-input type="textarea" rows="26" placeholder="点击请求测试获取此值" v-model="modificationData.responseBody"
|
||||
>
|
||||
</el-input>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
||||
<el-button type="primary" @click="dialogVisibleBigData=false">确 定
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getInterfaceList,
|
||||
addInterface,
|
||||
updateInterface,
|
||||
deleteInterface,
|
||||
getHttpResponse
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
name: "portSource",
|
||||
data() {
|
||||
return {
|
||||
dialogLoading: false,
|
||||
loading: false,
|
||||
searchString: "",
|
||||
data: null,
|
||||
currentPage: null,
|
||||
dialogVisible: false,
|
||||
tempDialogData: null,
|
||||
pageNo: 1,
|
||||
modificationId: null,
|
||||
modificationVisible: false,
|
||||
modificationData: {
|
||||
name: "",
|
||||
url: '',
|
||||
method: '',
|
||||
requestBody: '',
|
||||
requestHeaders: [{
|
||||
key: 'Content-Type',
|
||||
value: 'application/json'
|
||||
}],
|
||||
responseBody: '',
|
||||
},
|
||||
dialogVisibleBigData: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let params = {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
"interfaceInfo": {}
|
||||
}
|
||||
this.getInterfaceLists(params)
|
||||
},
|
||||
methods: {
|
||||
lookBig() {
|
||||
this.dialogVisibleBigData = true
|
||||
},
|
||||
random() {
|
||||
return Math.floor(Math.random() * 5000)
|
||||
},
|
||||
addheader(index) {
|
||||
this.modificationData.requestHeaders.splice(index + 1, 0, {
|
||||
key: '',
|
||||
value: ''
|
||||
})
|
||||
},
|
||||
delectheader(index) {
|
||||
this.modificationData.requestHeaders.splice(index, 1)
|
||||
},
|
||||
// 测试连接
|
||||
getHttpResponses() {
|
||||
|
||||
let subobj = {}
|
||||
this.modificationData.requestHeaders.forEach(value => {
|
||||
subobj[value.key] = value.value
|
||||
})
|
||||
|
||||
let Params = {
|
||||
url: this.modificationData.url,
|
||||
method: this.modificationData.method,
|
||||
requestHeaders: JSON.stringify(subobj),
|
||||
requestBody: this.modificationData.requestBody
|
||||
}
|
||||
this.dialogLoading = true
|
||||
getHttpResponse(Params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.modificationData.responseBody = JSON.stringify(JSON.parse(res.data), null, 4)
|
||||
}
|
||||
this.dialogLoading = false
|
||||
})
|
||||
},
|
||||
// 关闭弹窗所有弹窗 且清除临时数据
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
this.modificationVisible = false
|
||||
|
||||
this.tempDialogData = null
|
||||
this.modificationData = {
|
||||
name: "",
|
||||
url: '',
|
||||
method: '',
|
||||
requestBody: '',
|
||||
requestHeaders: [{
|
||||
key: 'Content-Type',
|
||||
value: 'application/json'
|
||||
}],
|
||||
responseBody: '',
|
||||
}
|
||||
|
||||
this.modificationId = null
|
||||
},
|
||||
// 查看 弹窗显示
|
||||
dialogShow(index) {
|
||||
this.tempDialogData = this.data.data.klist[index]
|
||||
console.log(this.tempDialogData)
|
||||
// this.tempDialogData.requestHeaders = JSON.parse(this.tempDialogData.requestHeaders)
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 修改 弹窗显示
|
||||
modificationShow(id) {
|
||||
this.modificationId = id
|
||||
this.data.data.klist.forEach(value => {
|
||||
if (value.id === id) {
|
||||
this.modificationData = {
|
||||
...value
|
||||
}
|
||||
if (value.requestHeaders) {
|
||||
if (typeof this.modificationData.requestHeaders == "string") {
|
||||
this.modificationData.requestHeaders = JSON.parse(value.requestHeaders)
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
this.modificationData.requestHeaders = [{
|
||||
key: 'Content-Type',
|
||||
value: 'application/json'
|
||||
}]
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
this.modificationVisible = true
|
||||
},
|
||||
// 确定修改或者添加
|
||||
modificationSure() {
|
||||
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.url.indexOf(' ') !== -1 || this
|
||||
.modificationData
|
||||
.method == "") {
|
||||
this.$message.error('必填项不允许出现空格!')
|
||||
} else {
|
||||
if (this.modificationData.name.length < 4 || this.modificationData.url.length < 4) {
|
||||
this.$message.error('请检查必填项且长度不小于4!')
|
||||
} else {
|
||||
let is = false
|
||||
this.modificationData.requestHeaders.forEach(value => {
|
||||
if (value.key.trim() == "" || value.value.trim() == "") {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
|
||||
if (is) {
|
||||
this.$message.error('请填入请求头');
|
||||
return
|
||||
}
|
||||
// this.modificationData.responseBody
|
||||
if (!this.isJSON(this.modificationData.responseBody)) {
|
||||
this.$message.error('请检查 响应体 是否为JSON格式');
|
||||
return
|
||||
}
|
||||
let params = {}
|
||||
|
||||
params.name = this.modificationData.name
|
||||
params.url = this.modificationData.url
|
||||
params.method = this.modificationData.method
|
||||
params.requestBody = this.modificationData.requestBody
|
||||
params.responseBody = this.modificationData.responseBody
|
||||
|
||||
let subobj = {}
|
||||
this.modificationData.requestHeaders.forEach(value => {
|
||||
subobj[value.key] = value.value
|
||||
})
|
||||
|
||||
params.requestHeaders = String(JSON.stringify(subobj))
|
||||
console.log(params.requestHeaders)
|
||||
if (this.modificationId !== null) {
|
||||
params.id = this.modificationData.id
|
||||
console.log(1)
|
||||
updateInterface(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data.data.klist.forEach((value, index) => {
|
||||
if (value.id === this.modificationData.id) {
|
||||
this.$set(this.data.data.klist, index, {
|
||||
...this.modificationData
|
||||
})
|
||||
}
|
||||
})
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
console.log(2)
|
||||
this.handleClose()
|
||||
console.log(3)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
params.id = ""
|
||||
this.setDataSources(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
// 创建成功方法
|
||||
this.pageNo = 1
|
||||
this.getInterfaceLists({
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
"interfaceInfo": {}
|
||||
})
|
||||
this.$message({
|
||||
message: '创建成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.handleClose()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// console.log(this.modificationData.name.indexOf(' '))
|
||||
},
|
||||
async setDataSources(params) {
|
||||
this.loading = true
|
||||
const data = await addInterface(params)
|
||||
this.loading = false
|
||||
return data
|
||||
},
|
||||
createEngine() {
|
||||
this.modificationVisible = true
|
||||
},
|
||||
searchEngine() {},
|
||||
async getInterfaceLists(params) {
|
||||
this.loading = true
|
||||
const data = await getInterfaceList(params)
|
||||
if (data.status === "1") {
|
||||
this.data = data
|
||||
data.data.klist = data.data.klist.map(value => {
|
||||
value.requestBody = this.isJSON(value.requestBody) ? JSON.stringify(JSON.parse(value
|
||||
.requestBody), null, 4) : ''
|
||||
value.responseBody = this.isJSON(value.responseBody) ? JSON.stringify(JSON.parse(value
|
||||
.responseBody), null, 4) : ''
|
||||
|
||||
if (!Array.isArray(JSON.parse(value.requestHeaders))) { //讲 key:value 格式 更改为老格式
|
||||
value.requestHeaders = JSON.stringify(this.format(JSON.parse(value
|
||||
.requestHeaders)))
|
||||
|
||||
|
||||
}
|
||||
|
||||
return value
|
||||
})
|
||||
this.page = data.data.pageInfo
|
||||
} else {
|
||||
this.$message.error('访问出错了-_-');
|
||||
}
|
||||
this.loading = false
|
||||
},
|
||||
format(obj) {
|
||||
return Object.keys(obj).map(value => {
|
||||
return {
|
||||
key: value,
|
||||
value: obj[value]
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
deletelistsor(id) {
|
||||
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'error'
|
||||
}).then(() => {
|
||||
this.deletelists({
|
||||
id: id
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
deletelists(id) {
|
||||
this.deletelist(id).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.getInterfaceLists({
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
"interfaceInfo": {}
|
||||
})
|
||||
this.$message({
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
async deletelist(id) {
|
||||
this.loading = true
|
||||
return await deleteInterface(id)
|
||||
this.loading = false
|
||||
},
|
||||
currpage(num) {
|
||||
this.pageNo = num
|
||||
this.getInterfaceLists({
|
||||
pageNo: this.pageNo,
|
||||
pageSize: 10,
|
||||
"interfaceInfo": {}
|
||||
})
|
||||
console.log(this.pageNo)
|
||||
},
|
||||
isChinese(temp) {
|
||||
// var re = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
|
||||
// if (re.test(temp)) {
|
||||
// console.log(temp)
|
||||
// return false
|
||||
// };
|
||||
// return true;
|
||||
if (escape(temp).indexOf("%u") < 0) {
|
||||
return false
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log('error:' + str + '!!!' + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-pagination.is-background .btn-next,
|
||||
.el-pagination.is-background .btn-prev,
|
||||
.el-pagination.is-background .el-pager li {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.el-pagination.is-background .el-pager li:not(.disabled).active {
|
||||
background-color: #409EFF !important;
|
||||
}
|
||||
|
||||
.portS_dialog .port_textLayout {
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
padding-left: 0px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.port_textLayout>p {
|
||||
height: 100%;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.portS_dialog .port_textLayout>p:nth-of-type(1) {
|
||||
width: 32%;
|
||||
text-align: right;
|
||||
margin-right: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.portS .DataSource_look .port_textLayout {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.DataSource_look .port_textLayout>p:nth-of-type(2) {
|
||||
border-radius: 5px;
|
||||
line-height: 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.el-dialog {
|
||||
border-radius: 20px !important;
|
||||
}
|
||||
|
||||
.portS_dialog .port_textLayout {
|
||||
height: unset !important;
|
||||
}
|
||||
</style>
|
||||
13
h5-enginex-manager/src/components/page/redirect/index.vue
Executable file
13
h5-enginex-manager/src/components/page/redirect/index.vue
Executable file
@@ -0,0 +1,13 @@
|
||||
<script>
|
||||
export default {
|
||||
created() {
|
||||
const { params, query } = this.$route
|
||||
console.log(params);
|
||||
const { path } = params
|
||||
this.$router.replace({ path: '/' + path, query })
|
||||
},
|
||||
render: function(h) {
|
||||
return h() // avoid warning message
|
||||
}
|
||||
}
|
||||
</script>
|
||||
BIN
h5-enginex-manager/src/components/page/start.png
Executable file
BIN
h5-enginex-manager/src/components/page/start.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
166
h5-enginex-manager/src/components/page/systemManagement/logManagement.vue
Executable file
166
h5-enginex-manager/src/components/page/systemManagement/logManagement.vue
Executable file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div class="content-wrapper">
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<div >
|
||||
当前时间:
|
||||
<el-date-picker v-model="dateValue" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd" @change="getlist">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div >
|
||||
<el-input placeholder="搜索" v-model="searchVal" class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-search" @click="getlist"></el-button>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="tab-wrapper">
|
||||
<div>
|
||||
<el-table border :data="dataList" style="width: 100%">
|
||||
|
||||
<el-table-column prop="id" width="200" label="ID">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="organName" label="公司名称" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="opName" label="操作名称" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="opUserName" label="操作人员名称" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="ip" label="IP" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="startTime" label="开始时间" width="" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.startTime|formatDate}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="endTime" label="结束时间" width="" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.endTime|formatDate}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="查看" placement="left">
|
||||
<el-button icon="el-icon-view" circle size="mini" @click="lockData(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagination-wrapper" background hide-on-single-page :current-page="pager.pageNum" :page-count="pager.lastPage"
|
||||
layout="prev, pager, next" @current-change="surrentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 查看 -->
|
||||
<el-dialog title="日志详情" :visible.sync="dialogVisible" width="30%" center>
|
||||
<div class="log-info-wrapper">
|
||||
<p><strong>操作名称:</strong>{{currentItem.opName}}</p>
|
||||
<p><strong>操作人员名称:</strong>{{currentItem.opUserName}}</p>
|
||||
<p><strong>IP:</strong>{{currentItem.ip}}</p>
|
||||
<p><strong>请求路径:</strong>{{currentItem.requestPath}}</p>
|
||||
<p><strong>请求参数:</strong>{{currentItem.requestParam}}</p>
|
||||
<p><strong>响应参数:</strong>{{currentItem.responseParam}}</p>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
formatDate
|
||||
} from '@/assets/utils.js'
|
||||
import {
|
||||
getLogList
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
//过滤
|
||||
name:'logManagement',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
let date = new Date(time)
|
||||
return formatDate(date, 'yyyy-MM-dd')
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pager: {},
|
||||
dataList: [],
|
||||
dateValue: [formatDate(new Date, 'yyyy-MM-dd'), formatDate(new Date, 'yyyy-MM-dd')],
|
||||
searchVal: "",
|
||||
dialogVisible: false,
|
||||
currentItem: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getlist();
|
||||
},
|
||||
methods: {
|
||||
lockData(e) {
|
||||
this.currentItem = e;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
surrentChange(e) {
|
||||
this.page = e;
|
||||
this.getlist();
|
||||
},
|
||||
async getlist() {
|
||||
const data = await getLogList({
|
||||
searchKey: this.searchVal,
|
||||
startDate: this.dateValue[0],
|
||||
endDate: this.dateValue[1],
|
||||
pageNo: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
if (data.status != "0") {
|
||||
const listUser = data.data.logList;
|
||||
const pager = data.data.pager;
|
||||
this.pager = pager;
|
||||
this.dataList = listUser
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tab-wrapper {
|
||||
padding: 21px 0;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-right: 40px;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.content-wrapper .el-date-editor .el-range-separator {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.el-dialog--center .el-dialog__body {
|
||||
max-height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.log-info-wrapper p {
|
||||
line-height: 2;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<div class="content-wrapper">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<!-- <el-col :span="16"> -->
|
||||
<div >
|
||||
<el-button @click="add()" type="primary">新增</el-button>
|
||||
<el-button @click="using(-1)" type="danger">删除</el-button>
|
||||
<el-button @click="using(1)" type="success">启用</el-button>
|
||||
<el-button @click="using(0)" type="warning">停用</el-button>
|
||||
</div>
|
||||
<!-- </el-col> -->
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="tab-wrapper">
|
||||
<div>
|
||||
<el-table border ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="id" width="200" label="ID">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" label="公司名称" width="" show-overflow-tooltip>
|
||||
<!-- <template slot-scope="scope">
|
||||
{{scope.row.name}}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="code" label="公司代号" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="status" width="" label="状态">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.status===0?'停用':'启用'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="token" label="TOKEN" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑" placement="left">
|
||||
<el-button icon="el-icon-edit" circle size="mini" @click="organEdit(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="right">
|
||||
<el-button icon="el-icon-delete" circle size="mini" @click="setStatus(-1,scope.row.id)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagination-wrapper" background hide-on-single-page :current-page="pager.pageNum" :page-count="pager.lastPage"
|
||||
layout="prev, pager, next" @current-change="surrentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加编辑 -->
|
||||
<el-dialog title="配置账号" :visible.sync="dialogFormVisible" width="30%" class="edit-password-dialog">
|
||||
<el-form :model="form" ref="changeOrganForm" label-width="100px" label-position="left">
|
||||
<el-form-item label="名称" prop="name" :rules="[
|
||||
{ required: true, message: '不能为空!'}
|
||||
]">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="代号" prop="code" :rules="[
|
||||
{ required: true, message: '不能为空!'}
|
||||
]">
|
||||
<el-input v-model="form.code" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="changeOrgan('changeOrganForm')">确 定</el-button>
|
||||
<el-button @click="cancel()">取 消</el-button>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getOrganList,
|
||||
updateStatusOrgan,
|
||||
saveOrgan,
|
||||
updateOrgan
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
name:'organizationManagement',
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pager: {},
|
||||
dataList: [],
|
||||
multipleSelection: [],
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
name: "",
|
||||
code: ""
|
||||
},
|
||||
currItem: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getlist();
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.currItem = {};
|
||||
this.dialogFormVisible = false;
|
||||
this.form = {
|
||||
name: "",
|
||||
code: ""
|
||||
}
|
||||
this.$refs["changeOrganForm"].resetFields();
|
||||
},
|
||||
changeOrgan(myForm) {
|
||||
let form = this.form;
|
||||
this.$refs[myForm].validate((valid) => {
|
||||
if (valid) {
|
||||
if (JSON.stringify(this.currItem) == '{}') {
|
||||
this.save(form);
|
||||
} else {
|
||||
form.id = this.currItem.id;
|
||||
this.update(form);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
organEdit(e) {
|
||||
this.currItem = e;
|
||||
this.form = {
|
||||
name: e.name,
|
||||
code: e.code
|
||||
}
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
async update(form) {
|
||||
const data = await updateOrgan(form)
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
this.cancel();
|
||||
}
|
||||
},
|
||||
async save(form) {
|
||||
const data = await saveOrgan(form)
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
this.cancel();
|
||||
}
|
||||
},
|
||||
// 添加
|
||||
add() {
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
setStatus(status, ids) {
|
||||
let msg = "确认修改用户状态?"
|
||||
if (status == -1) {
|
||||
msg = "此操作将永久删除该文件, 是否继续?"
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.updateStatus(status, ids + '');
|
||||
});
|
||||
},
|
||||
using(num) {
|
||||
let selArr = [];
|
||||
this.multipleSelection.forEach(value => {
|
||||
selArr.push(value.id);
|
||||
})
|
||||
if (selArr.length <= 0) {
|
||||
this.$message({
|
||||
message: '请选择!',
|
||||
type: "warning"
|
||||
});
|
||||
return
|
||||
}
|
||||
this.setStatus(num, selArr.join(','));
|
||||
},
|
||||
selectChanged(e) {
|
||||
this.page = 1;
|
||||
this.value = e;
|
||||
this.getlist();
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
surrentChange(e) {
|
||||
this.page = e;
|
||||
this.getlist();
|
||||
},
|
||||
async getlist() {
|
||||
const data = await getOrganList({
|
||||
pageNo: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
if (data.status != "0") {
|
||||
const listData = data.data.listOrgan;
|
||||
const pager = data.data.pager;
|
||||
this.pager = pager;
|
||||
this.dataList = listData
|
||||
}
|
||||
},
|
||||
async updateStatus(status, arrStr) {
|
||||
const data = await updateStatusOrgan({
|
||||
"ids": arrStr,
|
||||
"status": status
|
||||
})
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tab-wrapper {
|
||||
padding: 21px 0;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-right: 40px;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.edit-password-dialog .el-input {
|
||||
width: 70%;
|
||||
}
|
||||
</style>
|
||||
185
h5-enginex-manager/src/components/page/systemManagement/resourceManagement.vue
Executable file
185
h5-enginex-manager/src/components/page/systemManagement/resourceManagement.vue
Executable file
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<div class="content-wrapper">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<div >
|
||||
<el-button @click="add()" type="primary">新增</el-button>
|
||||
<el-button @click="using(-1)" type="danger">删除</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="tab-wrapper">
|
||||
<div>
|
||||
<el-table border ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="code" width="200" label="资源编号">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" label="名称" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="url" label="路径" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="icon" label="图标" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="sort" label="排序" width="" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="birth" label="创建时间" width="" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.birth|formatDate}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑" placement="left">
|
||||
<el-button icon="el-icon-edit" circle size="mini" @click="editDiaglo(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="right">
|
||||
<el-button icon="el-icon-delete" circle size="mini" @click="setStatus(-1,scope.row.id)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagination-wrapper" background hide-on-single-page :current-page="pager.pageNum" :page-count="pager.lastPage"
|
||||
layout="prev, pager, next" @current-change="surrentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<add-resource-dialog :dialogVisible="dialogVisible" @closeEvent="handleClose" :dataItem="dataItem"></add-resource-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
formatDate
|
||||
} from '@/assets/utils.js'
|
||||
import {
|
||||
getRsourceMenuList,
|
||||
resourceUpdateStatus
|
||||
} from '@/api/index.js'
|
||||
import AddResourceDialog from '../../models/addResourceDialog.vue'
|
||||
export default {
|
||||
name:'resourceManagement',
|
||||
components: {
|
||||
AddResourceDialog
|
||||
},
|
||||
//过滤
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
let date = new Date(time)
|
||||
return formatDate(date, 'yyyy-MM-dd')
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pager: {},
|
||||
dataList: [],
|
||||
multipleSelection: [],
|
||||
dialogVisible: false,
|
||||
dataItem: {},
|
||||
dialogFormVisible: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getlist();
|
||||
},
|
||||
methods: {
|
||||
handleClose() {
|
||||
this.dataItem = {};
|
||||
this.dialogVisible = false;
|
||||
this.getlist();
|
||||
},
|
||||
// 添加
|
||||
add() {
|
||||
this.dataItem = {};
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
// 权限分配
|
||||
editDiaglo(e) {
|
||||
this.dataItem = e;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
setStatus(status, ids) {
|
||||
let msg = "确认修改用户状态?"
|
||||
if (status == -1) {
|
||||
msg = "此操作将永久删除该文件, 是否继续?"
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.updateStatus(status, ids + '');
|
||||
});
|
||||
},
|
||||
using(num) {
|
||||
let selArr = [];
|
||||
this.multipleSelection.forEach(value => {
|
||||
selArr.push(value.id);
|
||||
})
|
||||
if (selArr.length <= 0) {
|
||||
this.$message({
|
||||
message: '请选择!',
|
||||
type: "warning"
|
||||
});
|
||||
return
|
||||
}
|
||||
this.setStatus(num, selArr.join(','));
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
surrentChange(e) {
|
||||
this.page = e;
|
||||
this.getlist();
|
||||
},
|
||||
async getlist() {
|
||||
const data = await getRsourceMenuList({
|
||||
pageNo: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
if (data.status != "0") {
|
||||
const listUser = data.data.listMenu;
|
||||
const pager = data.data.pager;
|
||||
this.pager = pager;
|
||||
this.dataList = listUser
|
||||
}
|
||||
},
|
||||
async updateStatus(status, arrStr) {
|
||||
const data = await resourceUpdateStatus({
|
||||
"ids": arrStr,
|
||||
"status": status
|
||||
})
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tab-wrapper {
|
||||
padding: 21px 0;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-right: 40px;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.edit-password-dialog .el-input {
|
||||
width: 70%;
|
||||
}
|
||||
</style>
|
||||
287
h5-enginex-manager/src/components/page/systemManagement/roleManagement.vue
Executable file
287
h5-enginex-manager/src/components/page/systemManagement/roleManagement.vue
Executable file
@@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<div class="content-wrapper">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<!-- <el-col :span="16"> -->
|
||||
<div>
|
||||
<el-button @click="add()" type="primary">新增</el-button>
|
||||
<el-button @click="using(-1)" type="danger" :disabled="multipleSelection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button @click="using(1)" type="success" :disabled="multipleSelection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button @click="using(0)" type="warning" :disabled="multipleSelection.length>0?false:'disabled'">停用</el-button>
|
||||
</div>
|
||||
<!-- </el-col> -->
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="tab-wrapper">
|
||||
<div>
|
||||
<el-table border ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="id" width="200" label="ID">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="roleName" label="角色名" width="" show-overflow-tooltip>
|
||||
<!-- <template slot-scope="scope">
|
||||
{{scope.row.name}}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="status" width="" label="状态">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.status===0?'禁用':'启用'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑" placement="left">
|
||||
<el-button icon="el-icon-edit" circle size="mini" @click="roleEdit(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="权限分配" placement="left">
|
||||
<el-button icon="el-icon-edit-outline" circle size="mini" @click="editDiaglo(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="right">
|
||||
<el-button icon="el-icon-delete" circle size="mini" @click="setStatus(-1,scope.row.id)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagination-wrapper" background hide-on-single-page :current-page="pager.pageNum" :page-count="pager.lastPage"
|
||||
layout="prev, pager, next" @current-change="surrentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 权限分配 -->
|
||||
<authority-assignment-dialog :dialogVisible="dialogVisible" @closeEvent="handleClose" :dataItem="dataItem"
|
||||
:listOrganArr="listOrganArr"></authority-assignment-dialog>
|
||||
<!-- 添加编辑角色 -->
|
||||
<el-dialog title="角色配置" :visible.sync="dialogFormVisible" width="30%" class="edit-password-dialog">
|
||||
<el-form :model="form" ref="changeRoleForm" label-width="100px" label-position="left">
|
||||
<el-form-item label="角色名" prop="roleName" :rules="[
|
||||
{ required: true, message: '不能为空!'}
|
||||
]">
|
||||
<el-input v-model="form.roleName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属公司" prop="organId" :rules="[
|
||||
{ required: true, message: '请选择公司', trigger: 'change'}
|
||||
]">
|
||||
<el-select v-model="form.organId" placeholder="请选择所属公司" :disabled="listOrganArr.length<2?true:false">
|
||||
<el-option v-for="item in listOrganArr" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="changeRole('changeRoleForm')">确 定</el-button>
|
||||
<el-button @click="cancel()">取 消</el-button>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getRoleList,
|
||||
roleUpdateStatus,
|
||||
getAllValidOrgan,
|
||||
saveRole,
|
||||
updateRole
|
||||
} from '@/api/index.js'
|
||||
import AuthorityAssignmentDialog from '../../models/authorityAssignmentDialog.vue'
|
||||
export default {
|
||||
name:'roleManagement',
|
||||
components: {
|
||||
AuthorityAssignmentDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pager: {},
|
||||
dataList: [],
|
||||
multipleSelection: [],
|
||||
dialogVisible: false,
|
||||
dataItem: {},
|
||||
listOrganArr: [],
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
roleName: "",
|
||||
organId: ""
|
||||
},
|
||||
currItem: {},
|
||||
disabled: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getlist();
|
||||
this.organList();
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.currItem = {};
|
||||
this.dialogFormVisible = false;
|
||||
this.form = {
|
||||
roleName: "",
|
||||
organId: ""
|
||||
}
|
||||
this.$refs["changeRoleForm"].resetFields();
|
||||
},
|
||||
changeRole(myForm) {
|
||||
let form = this.form;
|
||||
this.$refs[myForm].validate((valid) => {
|
||||
if (valid) {
|
||||
if (JSON.stringify(this.currItem) == '{}') {
|
||||
this.saveRole(form);
|
||||
} else {
|
||||
form.id = this.currItem.id;
|
||||
this.updateRole(form);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
roleEdit(e) {
|
||||
this.disabled = true;
|
||||
this.currItem = e;
|
||||
console.log(e);
|
||||
this.form = {
|
||||
roleName: e.roleName,
|
||||
organId: e.organId
|
||||
}
|
||||
this.dialogFormVisible = true;
|
||||
if (this.listOrganArr.length == 1) {
|
||||
this.form.organId = this.listOrganArr[0].id
|
||||
}
|
||||
},
|
||||
async updateRole(form) {
|
||||
const data = await updateRole(form)
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
this.cancel();
|
||||
}
|
||||
},
|
||||
async saveRole(form) {
|
||||
const data = await saveRole(form)
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
this.cancel();
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.dataItem = {};
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
// 添加
|
||||
add() {
|
||||
this.disabled = false;
|
||||
this.dataItem = {};
|
||||
this.dialogFormVisible = true;
|
||||
if (this.listOrganArr.length == 1) {
|
||||
this.form.organId = this.listOrganArr[0].id
|
||||
}
|
||||
},
|
||||
// 权限分配
|
||||
editDiaglo(e) {
|
||||
this.dataItem = e;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
setStatus(status, ids) {
|
||||
let msg = "确认修改用户状态?"
|
||||
if (status == -1) {
|
||||
msg = "此操作将永久删除该文件, 是否继续?"
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.updateStatus(status, ids + '');
|
||||
});
|
||||
},
|
||||
using(num) {
|
||||
let selArr = [];
|
||||
this.multipleSelection.forEach(value => {
|
||||
selArr.push(value.id);
|
||||
})
|
||||
if (selArr.length <= 0) {
|
||||
this.$message({
|
||||
message: '请选择!',
|
||||
type: "warning"
|
||||
});
|
||||
return
|
||||
}
|
||||
this.setStatus(num, selArr.join(','));
|
||||
},
|
||||
selectChanged(e) {
|
||||
this.page = 1;
|
||||
this.value = e;
|
||||
this.getlist();
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
surrentChange(e) {
|
||||
this.page = e;
|
||||
this.getlist();
|
||||
},
|
||||
async getlist() {
|
||||
const data = await getRoleList({
|
||||
pageNo: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
if (data.status != "0") {
|
||||
const listUser = data.data.listRole;
|
||||
const pager = data.data.pager;
|
||||
this.pager = pager;
|
||||
this.dataList = listUser
|
||||
}
|
||||
},
|
||||
async updateStatus(status, arrStr) {
|
||||
const data = await roleUpdateStatus({
|
||||
"ids": arrStr,
|
||||
"status": status
|
||||
})
|
||||
if (data.status != "0") {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
}
|
||||
},
|
||||
async organList() {
|
||||
const data = await getAllValidOrgan({})
|
||||
if (data.status != "0") {
|
||||
this.listOrganArr = data.data
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tab-wrapper {
|
||||
padding: 21px 0;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-right: 40px;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.edit-password-dialog .el-input {
|
||||
width: 70%;
|
||||
}
|
||||
</style>
|
||||
312
h5-enginex-manager/src/components/page/systemManagement/userManagement.vue
Executable file
312
h5-enginex-manager/src/components/page/systemManagement/userManagement.vue
Executable file
@@ -0,0 +1,312 @@
|
||||
<template>
|
||||
<div class="content-wrapper">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<!-- <el-col :span="16"> -->
|
||||
<div>
|
||||
<el-button @click="add" type="primary">新增</el-button>
|
||||
<el-button @click="using(-1)" type="danger" :disabled="multipleSelection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button @click="using(1)" type="success" :disabled="multipleSelection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button @click="using(0)" type="warning" :disabled="multipleSelection.length>0?false:'disabled'">停用</el-button>
|
||||
</div>
|
||||
<!-- </el-col> -->
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="tab-wrapper">
|
||||
<div>
|
||||
<el-table border ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="account" width="" label="账号">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="sysRole.roleName" label="角色" width="" show-overflow-tooltip>
|
||||
<!-- <template slot-scope="scope">
|
||||
{{scope.row.name}}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column
|
||||
prop="queryField"
|
||||
label="查询主键"
|
||||
width="200">
|
||||
</el-table-column> -->
|
||||
|
||||
<el-table-column prop="employeeId" label="员工编号">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="sysOrgan.id" width="" label="组织ID">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="sysOrgan.name" width="" label="组织名称">
|
||||
<!-- <template slot-scope="scope">
|
||||
{{scope.row.status==1?'启用':scope.row.status==0?'停用':'删除'}}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="status" width="" label="状态">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.status===0?'停用':scope.row.status==1?'启用':'删除'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="birth" label="创建时间">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.birth|formatDate}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑" placement="left">
|
||||
<el-button icon="el-icon-edit" circle size="mini" @click="editDiaglo(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="left">
|
||||
<el-button icon="el-icon-delete" circle size="mini" @click="setStatus(-1,scope.row.id)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改密码" placement="right">
|
||||
<el-button icon="el-icon-edit-outline" circle size="mini" @click="showDialogChangePassword(scope.row.id)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagination-wrapper" background hide-on-single-page :current-page="pager.pageNum" :page-count="pager.lastPage"
|
||||
layout="prev, pager, next" @current-change="surrentChange">
|
||||
</el-pagination>
|
||||
<!-- :page-size="pager.size" -->
|
||||
<!-- :total="pager.total" -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加/编辑 -->
|
||||
<!-- <add-block-white :dialogVisible="dialogVisible" @closeEvent="handleClose" :dataItem="dataItem"></add-block-white> -->
|
||||
<add-user-dialog :dialogVisible="dialogVisible" @closeEvent="handleClose" :dataItem="dataItem" :listOrganArr="listOrganArr"></add-user-dialog>
|
||||
|
||||
<!-- 修改密码 -->
|
||||
<el-dialog title="修改密码" :visible.sync="dialogFormVisible" width="30%" class="edit-password-dialog">
|
||||
<el-form :model="form" ref="changePasswordForm">
|
||||
<el-form-item label="新密码" label-width="100px" prop="password" :rules="[
|
||||
{ required: true, message: '不能为空!'}
|
||||
]">
|
||||
<el-input v-model="form.password" autocomplete="off" type="password"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeChangePasswordForm()">取 消</el-button>
|
||||
<el-button type="primary" @click="changePassword('changePasswordForm')">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
formatDate
|
||||
} from '@/assets/utils.js'
|
||||
import {
|
||||
getUserList,
|
||||
userUpdateStatus,
|
||||
getAllValidOrgan,
|
||||
updateUserPassword
|
||||
} from '@/api/index.js'
|
||||
import AddUserDialog from '../../models/addUserDialog.vue'
|
||||
export default {
|
||||
name:'userManagement',
|
||||
components: {
|
||||
AddUserDialog
|
||||
},
|
||||
//过滤
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
let date = new Date(time)
|
||||
return formatDate(date, 'yyyy-MM-dd')
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pager: {},
|
||||
dataList: [],
|
||||
multipleSelection: [],
|
||||
dialogVisible: false,
|
||||
dataItem: {},
|
||||
listOrganArr: [],
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
password: ""
|
||||
},
|
||||
currId: ""
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getlist();
|
||||
this.organList();
|
||||
},
|
||||
methods: {
|
||||
closeChangePasswordForm() {
|
||||
this.currId = "";
|
||||
this.dialogFormVisible = false;
|
||||
this.$refs["changePasswordForm"].resetFields();
|
||||
},
|
||||
changePassword(myForm) {
|
||||
this.$refs[myForm].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$confirm("确认修改", '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.updateUserPassword(this.currId, this.form.password);
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
showDialogChangePassword(id) {
|
||||
this.currId = id;
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
async updateUserPassword(id, password) {
|
||||
const data = await updateUserPassword({
|
||||
id: id,
|
||||
password: password
|
||||
})
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
return
|
||||
} else {
|
||||
this.$message({
|
||||
message: '修改成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.closeChangePasswordForm();
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.dataItem = {};
|
||||
this.dialogVisible = false;
|
||||
this.getlist();
|
||||
},
|
||||
// 添加
|
||||
add() {
|
||||
this.dialogVisible = true;
|
||||
// let e = "";
|
||||
// this.$router.push({path:'/blackWhiteManage/addBlackWihite/$'})
|
||||
},
|
||||
// 编辑
|
||||
editDiaglo(e) {
|
||||
this.dataItem = e;
|
||||
this.dialogVisible = true;
|
||||
// this.$router.push({path:`/blackWhiteManage/addBlackWihite/${e.id}`})
|
||||
},
|
||||
setStatus(status, ids) {
|
||||
let msg = "确认修改用户状态?"
|
||||
if (status == -1) {
|
||||
msg = "此操作将永久删除该文件, 是否继续?"
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.updateStatus(status, ids);
|
||||
});
|
||||
},
|
||||
using(num) {
|
||||
let selArr = [];
|
||||
this.multipleSelection.forEach(value => {
|
||||
selArr.push(value.id);
|
||||
})
|
||||
if (selArr.length <= 0) {
|
||||
this.$message({
|
||||
message: '请选择!',
|
||||
type: "warning"
|
||||
});
|
||||
return
|
||||
}
|
||||
this.setStatus(num, selArr.join(','));
|
||||
},
|
||||
selectChanged(e) {
|
||||
this.page = 1;
|
||||
this.value = e;
|
||||
this.getlist();
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
surrentChange(e) {
|
||||
this.page = e;
|
||||
this.getlist();
|
||||
},
|
||||
async getlist(e) {
|
||||
const data = await getUserList({
|
||||
pageNo: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
return
|
||||
} else {
|
||||
const listUser = data.data.listUser;
|
||||
const pager = data.data.pager;
|
||||
this.pager = pager;
|
||||
this.dataList = listUser
|
||||
}
|
||||
},
|
||||
async updateStatus(status, arrStr) {
|
||||
const data = await userUpdateStatus({
|
||||
"ids": arrStr,
|
||||
"status": status
|
||||
})
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
return
|
||||
} else {
|
||||
this.$message({
|
||||
message: '操作成功!',
|
||||
type: "success"
|
||||
});
|
||||
this.getlist();
|
||||
}
|
||||
},
|
||||
async organList() {
|
||||
const data = await getAllValidOrgan({})
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
return
|
||||
} else {
|
||||
this.listOrganArr = data.data
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tab-wrapper {
|
||||
padding: 21px 0;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-right: 40px;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.edit-password-dialog .el-input {
|
||||
width: 70%;
|
||||
}
|
||||
</style>
|
||||
70
h5-enginex-manager/src/components/upload/singleUpload.vue
Executable file
70
h5-enginex-manager/src/components/upload/singleUpload.vue
Executable file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-upload
|
||||
:headers="header"
|
||||
class="upload-demo"
|
||||
action="Riskmanage/models/uploadAndParseFile"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:file-list="fileList">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传pmml模型文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'singleUpload',
|
||||
props: {
|
||||
fileList: Array
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
header:{
|
||||
token:localStorage.getItem('token')
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||
},
|
||||
beforeUpload(file) {
|
||||
var fileType = file.name.substring(file.name.lastIndexOf('.') + 1);
|
||||
const extension = fileType === 'pmml';
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if(!extension) {
|
||||
this.$message({
|
||||
message: '上传文件只能是pmml格式!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
if(!isLt10M) {
|
||||
this.$message({
|
||||
message: '上传文件大小不能超过 10MB!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
return extension && isLt10M;
|
||||
},
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
console.log(file, fileList);
|
||||
this.$emit('getMessage', response.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
83
h5-enginex-manager/src/main.js
Executable file
83
h5-enginex-manager/src/main.js
Executable file
@@ -0,0 +1,83 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import ElementUI from 'element-ui';
|
||||
import VueI18n from 'vue-i18n';
|
||||
import { messages } from './components/common/i18n';
|
||||
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题
|
||||
// import './assets/css/theme-green/index.css'; // 浅绿色主题
|
||||
import './assets/css/icon.css';
|
||||
import './components/common/directives';
|
||||
import 'babel-polyfill';
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
import '@/utils/mock.js'
|
||||
|
||||
import store from './store'
|
||||
|
||||
import './styles/index.scss'; // global css
|
||||
import myMixin from '@/utils/mixin.js';
|
||||
|
||||
Vue.use(myMixin);
|
||||
Vue.config.productionTip = false;
|
||||
Vue.use(VueI18n);
|
||||
// Vue.use(ElementUI, {
|
||||
// size: 'small'
|
||||
// });
|
||||
Vue.use(ElementUI);
|
||||
|
||||
const i18n = new VueI18n({
|
||||
locale: 'zh',
|
||||
messages
|
||||
});
|
||||
|
||||
|
||||
Date.prototype.format = function(fmt) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"h+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (var k in o) {
|
||||
if (new RegExp("(" + k + ")").test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
//使用钩子函数对路由进行权限跳转
|
||||
router.beforeEach((to, from, next) => {
|
||||
// document.title = `${to.meta.title} | vue-manage-system`;
|
||||
document.title = `${to.meta.title}`;
|
||||
const role = localStorage.getItem('token');
|
||||
// const sid = Cookies.get("sid");
|
||||
// if (!role && to.path !== '/login') {
|
||||
// 老系统没登录,或者老系统登录了但是新系统没登录 都需要跳转到新系统去登录
|
||||
if (!role && to.path !== '/login') {
|
||||
next('/login');
|
||||
} else {
|
||||
// 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容
|
||||
if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {
|
||||
Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', {
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
}).$mount('#app');
|
||||
141
h5-enginex-manager/src/router/index.js
Executable file
141
h5-enginex-manager/src/router/index.js
Executable file
@@ -0,0 +1,141 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
export default new Router({
|
||||
routes: [{
|
||||
path: '/redirect/:path(.*)',
|
||||
component: () => import('../components/page/redirect/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/dashboard'
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('../components/page/Login.vue'),
|
||||
meta: {
|
||||
title: '登录'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('../components/common/Home.vue'),
|
||||
meta: {
|
||||
title: '自述文件'
|
||||
},
|
||||
children: [{
|
||||
path: '/dashboard',
|
||||
component: () => import('../components/page/Dashboard.vue'),
|
||||
meta: {
|
||||
title: '系统首页'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/Knowledge',
|
||||
component: () => import('../components/page/Knowledge.vue'),
|
||||
meta: {
|
||||
title: '复杂规则集'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/dataManage',
|
||||
component: () => import('../components/page/Datamanage.vue'),
|
||||
meta: {
|
||||
title: '基础指标'
|
||||
}
|
||||
}, {
|
||||
path: '/SQLmanage',
|
||||
component: () => import('../components/page/SQLManage.vue'),
|
||||
meta: {
|
||||
title: '数据源指标'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: '/userManagement',
|
||||
component: () => import('../components/page/systemManagement/userManagement.vue'),
|
||||
meta: {
|
||||
title: '用户管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/roleManagement',
|
||||
component: () => import('../components/page/systemManagement/roleManagement.vue'),
|
||||
meta: {
|
||||
title: '角色管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/resourceManagement',
|
||||
component: () => import(
|
||||
'../components/page/systemManagement/resourceManagement.vue'),
|
||||
meta: {
|
||||
title: '资源管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/organizationManagement',
|
||||
component: () => import(
|
||||
'../components/page/systemManagement/organizationManagement.vue'),
|
||||
meta: {
|
||||
title: '组织管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/logManagement',
|
||||
component: () => import('../components/page/systemManagement/logManagement.vue'),
|
||||
meta: {
|
||||
title: '日志管理'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: '/portManage',
|
||||
component: () => import('@/components/page/portManage.vue'),
|
||||
meta: {
|
||||
title: '接口指标'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/DataSource',
|
||||
component: () => import('@/components/page/DataSource.vue'),
|
||||
meta: {
|
||||
title: '数据源管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/portSource',
|
||||
component: () => import('@/components/page/portSource.vue'),
|
||||
meta: {
|
||||
title: '接口管理'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/404',
|
||||
component: () => import('../components/page/404.vue'),
|
||||
meta: {
|
||||
title: '404'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/403',
|
||||
component: () => import('../components/page/403.vue'),
|
||||
meta: {
|
||||
title: '403'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/404'
|
||||
}
|
||||
]
|
||||
});
|
||||
235
h5-enginex-manager/src/store/index.js
Executable file
235
h5-enginex-manager/src/store/index.js
Executable file
@@ -0,0 +1,235 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import request from '../utils/request.js'
|
||||
import {
|
||||
GetdeepObj
|
||||
} from '@/utils/GetdeepObj.js'
|
||||
import {
|
||||
getFieldUser, // 获取指标
|
||||
getDataSourcelist, //获取数据库列表
|
||||
getType2tree, // 获取规则集树
|
||||
getType2, //获取规则集
|
||||
getSCOList, //获取评分卡
|
||||
getDecisionTablesList, //获取决策表
|
||||
getDecisionTreeList, //获取决策树
|
||||
getEngineList //获取引擎
|
||||
} from '../api/index.js'
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
barShrink: false,
|
||||
isFieldUser: true,
|
||||
FieldUser: null,
|
||||
FieldUserObj: null,
|
||||
Sourcelist: null,
|
||||
blackWhiteId: null,
|
||||
isRuleList: true,
|
||||
RuleList: null,
|
||||
SCO: null,
|
||||
decisionTable: null,
|
||||
decisionTree: null,
|
||||
Engine: null,
|
||||
cacheList: {
|
||||
Sourcelist: {
|
||||
allow: true,
|
||||
url: getDataSourcelist,
|
||||
dataStr: 'data',
|
||||
body: {
|
||||
pageNum: 0,
|
||||
pageSize: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
mutations: {
|
||||
setCache(state, res) {
|
||||
state[res.str] = res.data
|
||||
},
|
||||
setbarShrink(state, res) {
|
||||
state.barShrink = res
|
||||
},
|
||||
setFieldUser(state, res) {
|
||||
// debugger
|
||||
state.FieldUser = res
|
||||
},
|
||||
setFieldUserObj(state, res) {
|
||||
state.FieldUserObj = res
|
||||
},
|
||||
setBlackWhiteId(state, res) {
|
||||
state.blackWhiteId = res
|
||||
},
|
||||
setRuleList(state, res) {
|
||||
state.RuleList = res
|
||||
},
|
||||
getfielduserObj(state, res) {
|
||||
if (res.status !== '1') return
|
||||
res.data.fieldList = res.data.fieldList.map(value => {
|
||||
if (value.valueType === 6) {
|
||||
return {
|
||||
label: value.fieldCn,
|
||||
value: value.fieldEn,
|
||||
valueType: value.valueType,
|
||||
jsonValue: value.jsonValue,
|
||||
children: GetdeepObj(JSON.parse(value.jsonValue))
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
label: value.fieldCn,
|
||||
value: value.fieldEn,
|
||||
valueType: value.valueType,
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
state.FieldUserObj = res
|
||||
|
||||
localStorage.setItem("fielduserObj", JSON.stringify(res))
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
getcache(context, str) {
|
||||
let obj = context.state.cacheList[str]
|
||||
if (context.state[str] != null || !obj.allow) {
|
||||
return
|
||||
}
|
||||
obj.allow = false
|
||||
if (window.localStorage.getItem(str)) {
|
||||
if (JSON.parse(window.localStorage.getItem(str))) {
|
||||
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: JSON.parse(window.localStorage.getItem(str))
|
||||
})
|
||||
}
|
||||
obj.allow = true
|
||||
return
|
||||
}
|
||||
|
||||
obj.url(obj.body).then(res => {
|
||||
if (res.status == 1) {
|
||||
|
||||
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: res.data[obj.dataStr]
|
||||
})
|
||||
localStorage.setItem(str, JSON.stringify(res.data[obj.dataStr]))
|
||||
|
||||
}
|
||||
obj.allow = true
|
||||
})
|
||||
},
|
||||
regetcache(context, str) {
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: null
|
||||
})
|
||||
localStorage.setItem(str, "")
|
||||
context.dispatch('getcache', str)
|
||||
},
|
||||
getfielduser(context) {
|
||||
if (context.state.FieldUser == null && context.state.isFieldUser) {
|
||||
context.state.isFieldUser = false
|
||||
let success = {
|
||||
fielduser: false,
|
||||
fielduserObj: false
|
||||
}
|
||||
|
||||
if (window.localStorage.getItem("fielduser")) {
|
||||
if (JSON.parse(window.localStorage.getItem("fielduser")).status == "1") {
|
||||
|
||||
context.commit('setFieldUser', JSON.parse(window.localStorage.getItem("fielduser")))
|
||||
success.fielduser = true
|
||||
}
|
||||
}
|
||||
if (window.localStorage.getItem("fielduserObj")) {
|
||||
if (JSON.parse(window.localStorage.getItem("fielduserObj")).status == "1") {
|
||||
context.commit('setFieldUserObj', JSON.parse(window.localStorage.getItem(
|
||||
"fielduserObj")))
|
||||
success.fielduserObj = true
|
||||
}
|
||||
}
|
||||
|
||||
if (success.fielduser && success.fielduserObj) {
|
||||
context.state.isFieldUser = true
|
||||
return
|
||||
}
|
||||
getFieldUser({}).then(res => {
|
||||
if (res.status == 1) {
|
||||
// debugger
|
||||
context.commit('setFieldUser', res)
|
||||
localStorage.setItem("fielduser", JSON.stringify(res))
|
||||
// debugger
|
||||
context.commit('getfielduserObj', JSON.parse(JSON.stringify(res)))
|
||||
}
|
||||
context.state.isFieldUser = true
|
||||
})
|
||||
}
|
||||
},
|
||||
async getRuleList(context) {
|
||||
// console.log(context,context.state.RuleList,context.state.isRuleList)
|
||||
// if (context.state.RuleList == null && context.state.isRuleList) {
|
||||
// context.state.isRuleList = false
|
||||
|
||||
// if (window.localStorage.getItem("RuleList")) {
|
||||
// context.commit('setRuleList', JSON.parse(window.localStorage.getItem("RuleList")))
|
||||
// context.state.isRuleList = true
|
||||
// return
|
||||
// }
|
||||
|
||||
// const cont = await getType2tree({
|
||||
// status: 1,
|
||||
// parentIds: ''
|
||||
// })
|
||||
// if (cont.status != "1") {
|
||||
// setCatch()
|
||||
// context.state.isRuleList = true
|
||||
// return
|
||||
// }
|
||||
// context.commit('setRuleList', cont.data.rlist)
|
||||
// localStorage.setItem("RuleList", JSON.stringify(
|
||||
// cont.data.rlist))
|
||||
// context.state.isRuleList = true
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// function setCatch() {
|
||||
// context.commit('setRuleList', [])
|
||||
// localStorage.setItem("RuleList", JSON.stringify([]))
|
||||
// context.state.isRuleList = true
|
||||
// }
|
||||
|
||||
|
||||
},
|
||||
|
||||
reGetfielduser(context) {
|
||||
// debugger
|
||||
context.commit('setFieldUser', null)
|
||||
localStorage.setItem("fielduser", "")
|
||||
|
||||
localStorage.setItem("fielduserObj", "")
|
||||
context.dispatch('getfielduser')
|
||||
},
|
||||
reGetRuleList(context) {
|
||||
context.commit('setRuleList', null)
|
||||
localStorage.setItem("RuleList", "")
|
||||
context.dispatch('getRuleList')
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
modules: {},
|
||||
getters: {
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
29
h5-enginex-manager/src/styles/element-ui.scss
Executable file
29
h5-enginex-manager/src/styles/element-ui.scss
Executable file
@@ -0,0 +1,29 @@
|
||||
//to reset element-ui default css
|
||||
.el-upload {
|
||||
input[type="file"] {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-upload__input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
//暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461
|
||||
.el-dialog {
|
||||
transform: none;
|
||||
left: 0;
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
//element ui upload
|
||||
.upload-container {
|
||||
.el-upload {
|
||||
width: 100%;
|
||||
.el-upload-dragger {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
158
h5-enginex-manager/src/styles/index.scss
Executable file
158
h5-enginex-manager/src/styles/index.scss
Executable file
@@ -0,0 +1,158 @@
|
||||
@import './variables.scss';
|
||||
@import './mixin.scss';
|
||||
@import './transition.scss';
|
||||
@import './element-ui.scss';
|
||||
@import './sidebar.scss';
|
||||
|
||||
body {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
|
||||
}
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
div:focus{
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a:focus,
|
||||
a:active {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a,
|
||||
a:focus,
|
||||
a:hover {
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.clearfix {
|
||||
&:after {
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
font-size: 0;
|
||||
content: " ";
|
||||
clear: both;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
//main-container全局样式
|
||||
.app-main{
|
||||
min-height: 100%
|
||||
}
|
||||
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
//搜索栏样式
|
||||
.filter-container {
|
||||
|
||||
}
|
||||
|
||||
//操作栏样式
|
||||
.operate-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.operate-container .btn-add {
|
||||
float: right;
|
||||
}
|
||||
|
||||
//表格栏样式
|
||||
.table-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//批量操作栏样式
|
||||
.batch-operate-container {
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//分页栏样式
|
||||
.pagination-container {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//添加、更新表单样式
|
||||
.form-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 720px;
|
||||
padding: 35px 35px 15px 35px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
//主标题
|
||||
.font-extra-large {
|
||||
font-size: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//标题
|
||||
.font-title-large {
|
||||
font-size: 18px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//小标题
|
||||
.font-title-medium {
|
||||
font-size: 16px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//正文
|
||||
.font-medium {
|
||||
font-size: 16px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
//正文
|
||||
.font-small {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
//正文(小)
|
||||
.font-extra-small {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.color-main {
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.color-success {
|
||||
color: #67C23A;
|
||||
}
|
||||
|
||||
.color-warning {
|
||||
color: #E6A23C;
|
||||
}
|
||||
|
||||
.color-danger {
|
||||
color: #F56C6C;
|
||||
}
|
||||
|
||||
.color-info {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
27
h5-enginex-manager/src/styles/mixin.scss
Executable file
27
h5-enginex-manager/src/styles/mixin.scss
Executable file
@@ -0,0 +1,27 @@
|
||||
@mixin clearfix {
|
||||
&:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin scrollBar {
|
||||
&::-webkit-scrollbar-track-piece {
|
||||
background: #d3dce6;
|
||||
}
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #99a9bf;
|
||||
border-radius: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin relative {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
105
h5-enginex-manager/src/styles/sidebar.scss
Executable file
105
h5-enginex-manager/src/styles/sidebar.scss
Executable file
@@ -0,0 +1,105 @@
|
||||
#app {
|
||||
|
||||
// 主体区域
|
||||
.main-container {
|
||||
min-height: 100%;
|
||||
transition: margin-left .28s;
|
||||
margin-left: 180px;
|
||||
}
|
||||
|
||||
// 侧边栏
|
||||
.sidebar-container {
|
||||
.horizontal-collapse-transition {
|
||||
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
|
||||
}
|
||||
transition: width .28s;
|
||||
width: 180px !important;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
font-size: 0px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
overflow: hidden;
|
||||
a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
.svg-icon {
|
||||
margin-right: 16px;
|
||||
}
|
||||
.el-menu {
|
||||
border: none;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hideSidebar {
|
||||
.sidebar-container {
|
||||
width: 36px !important;
|
||||
}
|
||||
.main-container {
|
||||
margin-left: 36px;
|
||||
}
|
||||
.submenu-title-noDropdown {
|
||||
padding-left: 10px !important;
|
||||
position: relative;
|
||||
.el-tooltip {
|
||||
padding: 0 10px !important;
|
||||
}
|
||||
}
|
||||
.el-submenu {
|
||||
&>.el-submenu__title {
|
||||
padding-left: 10px !important;
|
||||
&>span {
|
||||
height: 0;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
.el-submenu__icon-arrow {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-container .nest-menu .el-submenu>.el-submenu__title,
|
||||
.sidebar-container .el-submenu .el-menu-item {
|
||||
min-width: 180px !important;
|
||||
background-color: $subMenuBg !important;
|
||||
&:hover {
|
||||
background-color: $menuHover !important;
|
||||
}
|
||||
}
|
||||
.el-menu--collapse .el-menu .el-submenu {
|
||||
min-width: 180px !important;
|
||||
}
|
||||
|
||||
//适配移动端
|
||||
.mobile {
|
||||
.main-container {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.sidebar-container {
|
||||
top: 50px;
|
||||
transition: transform .28s;
|
||||
width: 180px !important;
|
||||
}
|
||||
&.hideSidebar {
|
||||
.sidebar-container {
|
||||
transition-duration: 0.3s;
|
||||
transform: translate3d(-180px, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.withoutAnimation {
|
||||
.main-container,
|
||||
.sidebar-container {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
h5-enginex-manager/src/styles/transition.scss
Executable file
32
h5-enginex-manager/src/styles/transition.scss
Executable file
@@ -0,0 +1,32 @@
|
||||
//globl transition css
|
||||
|
||||
/*fade*/
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.28s;
|
||||
}
|
||||
|
||||
.fade-enter,
|
||||
.fade-leave-active {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/*fade*/
|
||||
.breadcrumb-enter-active,
|
||||
.breadcrumb-leave-active {
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.breadcrumb-enter,
|
||||
.breadcrumb-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
.breadcrumb-move {
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.breadcrumb-leave-active {
|
||||
position: absolute;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user