first commit

This commit is contained in:
“FiboAI”
2021-12-02 16:32:40 +08:00
parent 10be8c192e
commit 49016794cc
164 changed files with 35631 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8

12
h5-enginex-manager/.eslintrc.js Executable file
View File

@@ -0,0 +1,12 @@
// {
// "presets": [
// ["env", {
// "modules": false,
// "targets": {
// "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
// }
// }],
// "stage-2"
// ],
// "plugins": ["transform-remove-strict-mode"]
// }

22
h5-enginex-manager/.gitignore vendored Executable file
View File

@@ -0,0 +1,22 @@
.DS_Store
node_modules
/dist
example.html
favicon.ico
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

6
h5-enginex-manager/.prettierrc Executable file
View File

@@ -0,0 +1,6 @@
{
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 140
}

21
h5-enginex-manager/LICENSE Executable file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2019 vue-manage-system
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
h5-enginex-manager/README.md Executable file
View File

@@ -0,0 +1,12 @@
#EngineX—H5
----
Engine X - 实时智能决策引擎
---
#前言
Engine X - 实时智能决策引擎
一款将公司的商业规则转化成商业决策,通过将公司的行业决策经验进行知识化,来辅助公司做各种商业决策的决策引擎。
Engine X 提供了三个版本:开源版本、商用基础版本、商用高级版本,点击 [https://www.fibo.cn/](https://www.fibo.cn/) 了解更多关于 Engine X商用版本更多信息。 关注公众号「FiboAI」
加微信群交流,公众号后台回复「**加群**」即可。

View File

@@ -0,0 +1,6 @@
module.exports = {
presets: [
'@vue/app'
],
}

20
h5-enginex-manager/baseUrl.js Executable file
View File

@@ -0,0 +1,20 @@
// console.log(process.env)
var proxyObj = {}
// console.log(process.env.VUE_PROXY)
switch (process.env.NODE_ENV) {
case 'development': // 开发环境代理地址
proxyObj = {
'/Riskmanage': {
target: '', // 开发环境
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/Riskmanage': '/Riskmanage'
},
}
}
break
}
module.exports = proxyObj

BIN
h5-enginex-manager/favicon.icon Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

14
h5-enginex-manager/index.html Executable file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<body>
<div id="app"></div>
<script type="module" src="./src/main.js"></script>
</body>
</html>

BIN
h5-enginex-manager/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

12355
h5-enginex-manager/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

50
h5-enginex-manager/package.json Executable file
View File

@@ -0,0 +1,50 @@
{
"name": "vue-manage-system",
"version": "4.2.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"eslint": "eslint --fix --ext .js,.vue src",
"stylelint": "stylelint **/*.{vue,css,scss,less} --fix",
"standard": "standard",
"standfix": "standard --fix",
"dev": "vite",
"start": "vite",
"preview": "vite preview",
"vite-build": "vite build"
},
"dependencies": {
"axios": "^0.18.1",
"babel-polyfill": "^6.26.0",
"echarts": "^5.1.2",
"element-ui": "^2.11.0",
"js-cookie": "^2.2.1",
"less": "^4.1.1",
"less-loader": "^5.0.0",
"mavon-editor": "^2.6.17",
"node-sass": "^4.14.1",
"vue": "^2.6.10",
"vue-cropperjs": "^3.0.0",
"vue-i18n": "^8.10.0",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.3",
"vuedraggable": "^2.17.0",
"vuex": "^3.6.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.9.0",
"@vue/cli-service": "^3.9.0",
"babel-plugin-transform-remove-strict-mode": "0.0.2",
"mockjs": "^1.1.0",
"sass-loader": "^7.3.1",
"sass-resources-loader": "^2.1.1",
"style-loader": "^2.0.0",
"vue-template-compiler": "^2.6.10",
"vite": "2",
"@vitejs/plugin-legacy": "^1.4.4",
"vite-plugin-mock": "2",
"vite-plugin-vue2": "latest"
}
}

View File

@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

File diff suppressed because one or more lines are too long

2930
h5-enginex-manager/public/jtopo-0.4.8-min.js vendored Executable file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,40 @@
{
"list": [{
"id": 1,
"name": "张三",
"money": 123,
"address": "广东省东莞市长安镇",
"state": "成功",
"date": "2019-11-1",
"thumb": "https://lin-xin.gitee.io/images/post/wms.png"
},
{
"id": 2,
"name": "李四",
"money": 456,
"address": "广东省广州市白云区",
"state": "成功",
"date": "2019-10-11",
"thumb": "https://lin-xin.gitee.io/images/post/node3.png"
},
{
"id": 3,
"name": "王五",
"money": 789,
"address": "湖南省长沙市",
"state": "失败",
"date": "2019-11-11",
"thumb": "https://lin-xin.gitee.io/images/post/parcel.png"
},
{
"id": 4,
"name": "赵六",
"money": 1011,
"address": "福建省厦门市鼓浪屿",
"state": "成功",
"date": "2019-10-20",
"thumb": "https://lin-xin.gitee.io/images/post/notice.png"
}
],
"pageTotal": 4
}

62
h5-enginex-manager/src/App.vue Executable file
View 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>

View 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)

View File

@@ -0,0 +1,7 @@
import request from '@/utils/request'
export function policy() {
return request({
url:'/aliyun/oss/policy',
method:'get',
})
}

View 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>'
+'&nbsp;<input type="radio" name="modeRadio" value="select" id="r2"/><label for="r2"> 框选</label>'
+'&nbsp;<input type="radio" name="modeRadio" value="edit" id="r4"/><label for="r4"> 加线</label>'
+'&nbsp;&nbsp;<input type="button" id="centerButton" value="居中显示"/>'
+'<input type="button" id="fullScreenButton" value="全屏显示"/>'
+'<input type="button" id="zoomOutButton" value=" 放 大 " />'
+'<input type="button" id="zoomInButton" value=" 缩 小 " />'
+'&nbsp;&nbsp;<input type="checkbox" id="zoomCheckbox"/><label for="zoomCheckbox">鼠标缩放</label>'
+'&nbsp;&nbsp;<input type="text" id="findText" style="width: 100px;" value="" onkeydown="enterPressHandler(event)">'
+ '<input type="button" id="findButton" value=" 查 询 ">'
+ '&nbsp;&nbsp;<input type="button" id="cloneButton" value="选中克隆">'
+'&nbsp;&nbsp;<input type="button" id="exportButton" value="导出PNG">'
+ '&nbsp;&nbsp;<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("浏览器不支持");
}*/

View 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;
}

File diff suppressed because one or more lines are too long

View 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);
}

View 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;
}

View File

@@ -0,0 +1,4 @@
[class*=" el-icon-lx"], [class^=el-icon-lx] {
font-family: lx-iconfont!important;
}

View 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;
}

View 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;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View 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);
};

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@@ -0,0 +1,6 @@
import Vue from 'vue';
// 使用 Event Bus
const bus = new Vue();
export default bus;

View 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>

View 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>

View 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>

View 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>

View 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;
};
}
}
})

View 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">&nbsp;</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>

View 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>

View 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>

View 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>

View 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>

View 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'
}
}
}

View 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>

View File

@@ -0,0 +1,15 @@
<template>
<div>
</div>
</template>
<script>
</script>
<style>
</style>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

Some files were not shown because too many files have changed in this diff Show More