You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
853 lines
40 KiB
853 lines
40 KiB
6 years ago
|
|
||
|
<!DOCTYPE HTML>
|
||
|
<html lang="zh-hans" >
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||
|
<title>项目目录结构 · 调度系统-EasyScheduler</title>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
|
<meta name="description" content="">
|
||
|
<meta name="generator" content="GitBook 3.2.3">
|
||
|
<meta name="author" content="YIGUAN">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/style.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/gitbook-plugin-insert-logo-link/plugin.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="styles/website.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<meta name="HandheldFriendly" content="true"/>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||
|
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||
|
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||
|
|
||
|
|
||
|
<link rel="next" href="frontend-development.html" />
|
||
|
|
||
|
|
||
|
<link rel="prev" href="frontend-deploy.html" />
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<div class="book">
|
||
|
<div class="book-summary">
|
||
|
|
||
|
|
||
|
<div id="book-search-input" role="search">
|
||
|
<input type="text" placeholder="输入并搜索" />
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<nav role="navigation">
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="summary">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.1" data-path="./">
|
||
|
|
||
|
<a href="./">
|
||
|
|
||
|
|
||
|
Easyscheduler简介
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
前端文档
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.2.1" data-path="frontend-deploy.html">
|
||
|
|
||
|
<a href="frontend-deploy.html#前端项目环境构建及编译">
|
||
|
|
||
|
|
||
|
环境搭建
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.2" data-path="frontend-deploy.html">
|
||
|
|
||
|
<a href="frontend-deploy.html#安装及配置">
|
||
|
|
||
|
|
||
|
安装及配置
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.3" data-path="frontend-deploy.html">
|
||
|
|
||
|
<a href="frontend-deploy.html#项目生产环境配置">
|
||
|
|
||
|
|
||
|
项目生产环境Nginx配置
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.4" data-path="frontend-deploy.html">
|
||
|
|
||
|
<a href="frontend-deploy.html#前端项目发布">
|
||
|
|
||
|
|
||
|
前端项目发布
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.5" data-path="frontend-deploy.html">
|
||
|
|
||
|
<a href="frontend-deploy.html#问题">
|
||
|
|
||
|
|
||
|
问题
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.6" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#项目目录结构">
|
||
|
|
||
|
|
||
|
项目目录结构
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.7" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#系统功能模块">
|
||
|
|
||
|
|
||
|
系统功能模块
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.8" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#路由和状态管理">
|
||
|
|
||
|
|
||
|
路由和状态管理
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.9" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#规范">
|
||
|
|
||
|
|
||
|
规范
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.10" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#接口">
|
||
|
|
||
|
|
||
|
接口
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.2.11" data-path="frontend-development.html">
|
||
|
|
||
|
<a href="frontend-development.html#扩展开发">
|
||
|
|
||
|
|
||
|
扩展开发
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3" >
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
后端文档
|
||
|
|
||
|
</span>
|
||
|
|
||
|
|
||
|
|
||
|
<ul class="articles">
|
||
|
|
||
|
|
||
|
<li class="chapter " data-level="1.3.1" data-path="architecture-design.html">
|
||
|
|
||
|
<a href="architecture-design.html#调度系统架构设计">
|
||
|
|
||
|
|
||
|
系统架构设计
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.2" data-path="backend-deploy.html">
|
||
|
|
||
|
<a href="backend-deploy.html#部署文档">
|
||
|
|
||
|
|
||
|
部署文档
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.3.3" data-path="task-plugin-development.html">
|
||
|
|
||
|
<a href="task-plugin-development.html#任务插件开发">
|
||
|
|
||
|
|
||
|
自定义任务插件文档
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</li>
|
||
|
|
||
|
<li class="chapter " data-level="1.4" data-path="user-manual.md">
|
||
|
|
||
|
<span>
|
||
|
|
||
|
|
||
|
使用说明文档
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<li class="divider"></li>
|
||
|
|
||
|
<li>
|
||
|
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||
|
本书使用 GitBook 发布
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="book-body">
|
||
|
|
||
|
<div class="body-inner">
|
||
|
|
||
|
|
||
|
|
||
|
<div class="book-header" role="navigation">
|
||
|
|
||
|
|
||
|
<!-- Title -->
|
||
|
<h1>
|
||
|
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||
|
<a href="." >项目目录结构</a>
|
||
|
</h1>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="page-wrapper" tabindex="-1" role="main">
|
||
|
<div class="page-inner">
|
||
|
|
||
|
<div id="book-search-results">
|
||
|
<div class="search-noresults">
|
||
|
|
||
|
<section class="normal markdown-section">
|
||
|
|
||
|
<h1 id="前端开发文档">前端开发文档</h1>
|
||
|
<h3 id="技术选型">技术选型</h3>
|
||
|
<pre><code>Vue mvvm框架
|
||
|
|
||
|
Es6 ECMAScript 6.0
|
||
|
|
||
|
Ans-ui Analysys-ui
|
||
|
|
||
|
D3 可视化库图表库
|
||
|
|
||
|
Jsplumb 连线插件库
|
||
|
|
||
|
Lodash 高性能的 JavaScript 实用工具库
|
||
|
</code></pre><h3 id="项目目录结构">项目目录结构</h3>
|
||
|
<p><code>build</code> 打包及开发环境项目的一些webpack配置</p>
|
||
|
<p><code>node_modules</code> 开发环境node依赖包</p>
|
||
|
<p><code>src</code> 项目所需文件</p>
|
||
|
<p><code>src => combo</code> 项目第三方资源本地化 <code>npm run combo</code>具体查看<code>build/combo.js</code></p>
|
||
|
<p><code>src => font</code> 字体图标库可访问 <a href="https://www.iconfont.cn" target="_blank">https://www.iconfont.cn</a> 进行添加 注意:字体库用的自己的 二次开发需要重新引入自己的库 <code>src/sass/common/_font.scss</code></p>
|
||
|
<p><code>src => images</code> 公共图片存放</p>
|
||
|
<p><code>src => js</code> js/vue</p>
|
||
|
<p><code>src => lib</code> 公司内部组件(公司组件库开源后可删掉)</p>
|
||
|
<p><code>src => sass</code> sass文件 一个页面对应一个sass文件</p>
|
||
|
<p><code>src => view</code> 页面文件 一个页面对应一个html文件</p>
|
||
|
<pre><code>> 项目采用vue单页面应用(SPA)开发
|
||
|
- 所有页面入口文件在 `src/js/conf/${对应页面文件名 => home}` 的 `index.js` 入口文件
|
||
|
- 对应的sass文件则在 `src/sass/conf/${对应页面文件名 => home}/index.scss`
|
||
|
- 对应的html文件则在 `src/view/${对应页面文件名 => home}/index.html`
|
||
|
</code></pre><p>公共模块及util <code>src/js/module</code></p>
|
||
|
<p><code>components</code> => 内部项目公共组件</p>
|
||
|
<p><code>download</code> => 下载组件</p>
|
||
|
<p><code>echarts</code> => 图表组件</p>
|
||
|
<p><code>filter</code> => 过滤器和vue管道</p>
|
||
|
<p><code>i18n</code> => 国际化</p>
|
||
|
<p><code>io</code> => io请求封装 基于axios</p>
|
||
|
<p><code>mixin</code> => vue mixin 公共部分 用于disabled操作</p>
|
||
|
<p><code>permissions</code> => 权限操作</p>
|
||
|
<p><code>util</code> => 工具</p>
|
||
|
<h3 id="系统功能模块">系统功能模块</h3>
|
||
|
<p>首页 => <code>http://localhost:8888/#/home</code></p>
|
||
|
<p>项目管理 => <code>http://localhost:8888/#/projects/list</code></p>
|
||
|
<pre><code>| 项目首页
|
||
|
| 工作流
|
||
|
- 工作流定义
|
||
|
- 工作流实例
|
||
|
- 任务实例
|
||
|
</code></pre><p>资源管理 => <code>http://localhost:8888/#/resource/file</code></p>
|
||
|
<pre><code>| 文件管理
|
||
|
| UDF管理
|
||
|
- 资源管理
|
||
|
- 函数管理
|
||
|
</code></pre><p>数据源管理 => <code>http://localhost:8888/#/datasource/list</code></p>
|
||
|
<p>安全中心 => <code>http://localhost:8888/#/security/tenant</code></p>
|
||
|
<pre><code>| 租户管理
|
||
|
| 用户管理
|
||
|
| 告警组管理
|
||
|
- master
|
||
|
- worker
|
||
|
</code></pre><p>用户中心 => <code>http://localhost:8888/#/user/account</code></p>
|
||
|
<h2 id="路由和状态管理">路由和状态管理</h2>
|
||
|
<p>项目 <code>src/js/conf/home</code> 下分为</p>
|
||
|
<p><code>pages</code> => 路由指向页面目录</p>
|
||
|
<pre><code> 路由地址对应的页面文件
|
||
|
</code></pre><p><code>router</code> => 路由管理</p>
|
||
|
<pre><code>vue的路由器,在每个页面的入口文件index.js 都会注册进来 具体操作:https://router.vuejs.org/zh/
|
||
|
</code></pre><p><code>store</code> => 状态管理</p>
|
||
|
<pre><code>每个路由对应的页面都有一个状态管理的文件 分为:
|
||
|
|
||
|
actions => mapActions => 详情:https://vuex.vuejs.org/zh/guide/actions.html
|
||
|
|
||
|
getters => mapGetters => 详情:https://vuex.vuejs.org/zh/guide/getters.html
|
||
|
|
||
|
index => 入口
|
||
|
|
||
|
mutations => mapMutations => 详情:https://vuex.vuejs.org/zh/guide/mutations.html
|
||
|
|
||
|
state => mapState => 详情:https://vuex.vuejs.org/zh/guide/state.html
|
||
|
|
||
|
具体操作:https://vuex.vuejs.org/zh/
|
||
|
</code></pre><h2 id="规范">规范</h2>
|
||
|
<h2 id="vue规范">Vue规范</h2>
|
||
|
<h5 id="1组件名">1.组件名</h5>
|
||
|
<p>组件名为多个单词,并且用连接线(-)连接,避免与 HTML 标签冲突,并且结构更加清晰。</p>
|
||
|
<pre><code>// 正例
|
||
|
export default {
|
||
|
name: 'page-article-item'
|
||
|
}
|
||
|
</code></pre><h5 id="2组件文件">2.组件文件</h5>
|
||
|
<p><code>src/js/module/components</code>项目内部公共组件书写文件夹名与文件名同名,公共组件内部所拆分的子组件与util工具都放置组件内部 <code>_source</code>文件夹里。</p>
|
||
|
<pre><code>└── components
|
||
|
├── header
|
||
|
├── header.vue
|
||
|
└── _source
|
||
|
└── nav.vue
|
||
|
└── util.js
|
||
|
├── conditions
|
||
|
├── conditions.vue
|
||
|
└── _source
|
||
|
└── serach.vue
|
||
|
└── util.js
|
||
|
</code></pre><h5 id="3prop">3.Prop</h5>
|
||
|
<p>定义 Prop 的时候应该始终以驼峰格式(camelCase)命名,在父组件赋值的时候使用连接线(-)。
|
||
|
这里遵循每个语言的特性,因为在 HTML 标记中对大小写是不敏感的,使用连接线更加友好;而在 JavaScript 中更自然的是驼峰命名。</p>
|
||
|
<pre><code>// Vue
|
||
|
props: {
|
||
|
articleStatus: Boolean
|
||
|
}
|
||
|
// HTML
|
||
|
<article-item :article-status="true"></article-item>
|
||
|
</code></pre><p>Prop 的定义应该尽量详细的指定其类型、默认值和验证。</p>
|
||
|
<p>示例:</p>
|
||
|
<pre><code>props: {
|
||
|
attrM: Number,
|
||
|
attrA: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
},
|
||
|
attrZ: {
|
||
|
type: Object,
|
||
|
// 数组/对象的默认值应该由一个工厂函数返回
|
||
|
default: function () {
|
||
|
return {
|
||
|
msg: '成就你我'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
attrE: {
|
||
|
type: String,
|
||
|
validator: function (v) {
|
||
|
return !(['success', 'fail'].indexOf(v) === -1)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</code></pre><h5 id="4v-for">4.v-for</h5>
|
||
|
<p>在执行 v-for 遍历的时候,总是应该带上 key 值使更新 DOM 时渲染效率更高。</p>
|
||
|
<pre><code><ul>
|
||
|
<li v-for="item in list" :key="item.id">
|
||
|
{{ item.title }}
|
||
|
</li>
|
||
|
</ul>
|
||
|
</code></pre><p>v-for 应该避免与 v-if 在同一个元素(<code>例如:<li></code>)上使用,因为 v-for 的优先级比 v-if 更高,为了避免无效计算和渲染,应该尽量将 v-if 放到容器的父元素之上。</p>
|
||
|
<pre><code><ul v-if="showList">
|
||
|
<li v-for="item in list" :key="item.id">
|
||
|
{{ item.title }}
|
||
|
</li>
|
||
|
</ul>
|
||
|
</code></pre><h5 id="5v-if--v-else-if--v-else">5.v-if / v-else-if / v-else</h5>
|
||
|
<p>若同一组 v-if 逻辑控制中的元素逻辑相同,Vue 为了更高效的元素切换,会复用相同的部分,<code>例如:value</code>。为了避免复用带来的不合理效果,应该在同种元素上加上 key 做标识。</p>
|
||
|
<pre><code><div v-if="hasData" key="mazey-data">
|
||
|
<span>{{ mazeyData }}</span>
|
||
|
</div>
|
||
|
<div v-else key="mazey-none">
|
||
|
<span>无数据</span>
|
||
|
</div>
|
||
|
</code></pre><h5 id="6指令缩写">6.指令缩写</h5>
|
||
|
<p>为了统一规范始终使用指令缩写,使用<code>v-bind</code>,<code>v-on</code>并没有什么不好,这里仅为了统一规范。</p>
|
||
|
<pre><code><input :value="mazeyUser" @click="verifyUser">
|
||
|
</code></pre><h5 id="7单文件组件的顶级元素顺序">7.单文件组件的顶级元素顺序</h5>
|
||
|
<p>样式后续都是打包在一个文件里,所有在单个vue文件中定义的样式,在别的文件里同类名的样式也是会生效的所有在创建一个组件前都会有个顶级类名
|
||
|
注意:项目内已经增加了sass插件,单个vue文件里可以直接书写sass语法
|
||
|
为了统一和便于阅读,应该按 <code><template></code>、<code><script></code>、<code><style></code>的顺序放置。</p>
|
||
|
<pre><code><template>
|
||
|
<div class="test-model">
|
||
|
test
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
|
export default {
|
||
|
name: "test",
|
||
|
data() {
|
||
|
return {}
|
||
|
},
|
||
|
props: {},
|
||
|
methods: {},
|
||
|
watch: {},
|
||
|
beforeCreate() {
|
||
|
},
|
||
|
created() {
|
||
|
},
|
||
|
beforeMount() {
|
||
|
},
|
||
|
mounted() {
|
||
|
},
|
||
|
beforeUpdate() {
|
||
|
},
|
||
|
updated() {
|
||
|
},
|
||
|
beforeDestroy() {
|
||
|
},
|
||
|
destroyed() {
|
||
|
},
|
||
|
computed: {},
|
||
|
components: {},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" rel="stylesheet/scss">
|
||
|
.test-model {
|
||
|
|
||
|
}
|
||
|
</style>
|
||
|
</code></pre><h2 id="javascript规范">JavaScript规范</h2>
|
||
|
<h5 id="1var--let--const">1.var / let / const</h5>
|
||
|
<p>建议不再使用 var,而使用 let / const,优先使用 const。任何一个变量的使用都要提前申明,除了 function 定义的函数可以随便放在任何位置。</p>
|
||
|
<h5 id="2引号">2.引号</h5>
|
||
|
<pre><code>const foo = '后除'
|
||
|
const bar = `${foo},前端工程师`
|
||
|
</code></pre><h5 id="3函数">3.函数</h5>
|
||
|
<p>匿名函数统一使用箭头函数,多个参数/返回值时优先使用对象的结构赋值。</p>
|
||
|
<pre><code>function getPersonInfo ({name, sex}) {
|
||
|
// ...
|
||
|
return {name, gender}
|
||
|
}
|
||
|
</code></pre><p>函数名统一使用驼峰命名,以大写字母开头申明的都是构造函数,使用小写字母开头的都是普通函数,也不该使用 new 操作符去操作普通函数。</p>
|
||
|
<h5 id="4对象">4.对象</h5>
|
||
|
<pre><code>const foo = {a: 0, b: 1}
|
||
|
const bar = JSON.parse(JSON.stringify(foo))
|
||
|
|
||
|
const foo = {a: 0, b: 1}
|
||
|
const bar = {...foo, c: 2}
|
||
|
|
||
|
const foo = {a: 3}
|
||
|
Object.assign(foo, {b: 4})
|
||
|
|
||
|
const myMap = new Map([])
|
||
|
for (let [key, value] of myMap.entries()) {
|
||
|
// ...
|
||
|
}
|
||
|
</code></pre><h5 id="5模块">5.模块</h5>
|
||
|
<p>统一使用 import / export 的方式管理项目的模块。</p>
|
||
|
<pre><code>// lib.js
|
||
|
export default {}
|
||
|
|
||
|
// app.js
|
||
|
import app from './lib'
|
||
|
</code></pre><p>import 统一放在文件顶部。</p>
|
||
|
<p>如果模块只有一个输出值,使用 <code>export default</code>,否则不用。</p>
|
||
|
<h2 id="html--css">HTML / CSS</h2>
|
||
|
<h6 id="1标签">1.标签</h6>
|
||
|
<p>在引用外部 CSS 或 JavaScript 时不写 type 属性。HTML5 默认 type 为 <code>text/css</code> 和 <code>text/javascript</code> 属性,所以没必要指定。</p>
|
||
|
<pre><code><link rel="stylesheet" href="//www.test.com/css/test.css">
|
||
|
<script src="//www.test.com/js/test.js"></script>
|
||
|
</code></pre><h5 id="2命名">2.命名</h5>
|
||
|
<p>Class 和 ID 的命名应该语义化,通过看名字就知道是干嘛的;多个单词用连接线 - 连接。</p>
|
||
|
<pre><code>// 正例
|
||
|
.test-header{
|
||
|
font-size: 20px;
|
||
|
}
|
||
|
</code></pre><h5 id="3属性缩写">3.属性缩写</h5>
|
||
|
<p>CSS 属性尽量使用缩写,提高代码的效率和方便理解。</p>
|
||
|
<pre><code>// 反例
|
||
|
border-width: 1px;
|
||
|
border-style: solid;
|
||
|
border-color: #ccc;
|
||
|
|
||
|
// 正例
|
||
|
border: 1px solid #ccc;
|
||
|
</code></pre><h5 id="4文档类型">4.文档类型</h5>
|
||
|
<p>应该总是使用 HTML5 标准。</p>
|
||
|
<pre><code><!DOCTYPE html>
|
||
|
</code></pre><h5 id="5注释">5.注释</h5>
|
||
|
<p>应该给一个模块文件写一个区块注释。</p>
|
||
|
<pre><code>/**
|
||
|
* @module mazey/api
|
||
|
* @author Mazey <mazey@mazey.net>
|
||
|
* @description test.
|
||
|
* */
|
||
|
</code></pre><h2 id="接口">接口</h2>
|
||
|
<h5 id="所有的接口都以-promise-形式返回">所有的接口都以 Promise 形式返回</h5>
|
||
|
<p>注意非0都为错误走catch</p>
|
||
|
<pre><code>const test = () => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
resolve({
|
||
|
a:1
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// 调用
|
||
|
test.then(res => {
|
||
|
console.log(res)
|
||
|
// {a:1}
|
||
|
})
|
||
|
</code></pre><p>正常返回</p>
|
||
|
<pre><code>{
|
||
|
code:0,
|
||
|
data:{}
|
||
|
msg:'成功'
|
||
|
}
|
||
|
</code></pre><p>错误返回</p>
|
||
|
<pre><code>{
|
||
|
code:10000,
|
||
|
data:{}
|
||
|
msg:'失败'
|
||
|
}
|
||
|
</code></pre><h5 id="相关接口路径">相关接口路径</h5>
|
||
|
<p>dag 相关接口 <code>src/js/conf/home/store/dag/actions.js</code></p>
|
||
|
<p>数据源中心 相关接口 <code>src/js/conf/home/store/datasource/actions.js</code></p>
|
||
|
<p>项目管理 相关接口 <code>src/js/conf/home/store/projects/actions.js</code></p>
|
||
|
<p>资源中心 相关接口 <code>src/js/conf/home/store/resource/actions.js</code></p>
|
||
|
<p>安全中心 相关接口 <code>src/js/conf/home/store/security/actions.js</code></p>
|
||
|
<p>用户中心 相关接口 <code>src/js/conf/home/store/user/actions.js</code></p>
|
||
|
<h2 id="扩展开发">扩展开发</h2>
|
||
|
<h5 id="1增加节点">1.增加节点</h5>
|
||
|
<p>(1) 先将节点的icon小图标放置<code>src/js/conf/home/pages/dag/img</code>文件夹内,注意 <code>toolbar_${后台定义的节点的英文名称 例如:SHELL}.png</code>
|
||
|
(2) 找到 <code>src/js/conf/home/pages/dag/_source/config.js</code> 里的 <code>tasksType</code> 对象,往里增加</p>
|
||
|
<pre><code>'DEPENDENT': { // 后台定义节点类型英文名称用作key值
|
||
|
desc: 'DEPENDENT', // tooltip desc
|
||
|
color: '#2FBFD8' // 代表的颜色主要用于 tree和gantt 两张图
|
||
|
}
|
||
|
</code></pre><p>(3) 在 <code>src/js/conf/home/pages/dag/_source/formModel/tasks</code> 增加一个 <code>${节点类型(小写)}</code>.vue 文件,跟当前节点相关的组件内容都在这里写。 属于节点组件内的必须拥有一个函数 <code>_verification()</code> 验证成功后讲当前组件的相关数据往父组件抛。</p>
|
||
|
<pre><code>/**
|
||
|
* 验证
|
||
|
*/
|
||
|
_verification () {
|
||
|
// datasource 子组件验证
|
||
|
if (!this.$refs.refDs._verifDatasource()) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// 验证函数
|
||
|
if (!this.method) {
|
||
|
this.$message.warning(`${i18n.$t('请输入方法')}`)
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// localParams 子组件验证
|
||
|
if (!this.$refs.refLocalParams._verifProp()) {
|
||
|
return false
|
||
|
}
|
||
|
// 存储
|
||
|
this.$emit('on-params', {
|
||
|
type: this.type,
|
||
|
datasource: this.datasource,
|
||
|
method: this.method,
|
||
|
localParams: this.localParams
|
||
|
})
|
||
|
return true
|
||
|
}
|
||
|
</code></pre><p>(4) 节点组件内部所用到公共的组件都在<code>_source</code>下,<code>commcon.js</code>用与配置公共数据</p>
|
||
|
<h5 id="2增加状态类型">2.增加状态类型</h5>
|
||
|
<p>(1) 找到 <code>src/js/conf/home/pages/dag/_source/config.js</code> 里的 <code>tasksState</code> 对象,往里增加</p>
|
||
|
<pre><code>'WAITTING_DEPEND': { //后端定义状态类型 前端用作key值
|
||
|
id: 11, // 前端定义id 后续用作排序
|
||
|
desc: `${i18n.$t('等待依赖')}`, // tooltip desc
|
||
|
color: '#5101be', // 代表的颜色主要用于 tree和gantt 两张图
|
||
|
icoUnicode: '&#xe68c;', // 字体图标
|
||
|
isSpin: false // 是否旋转(需代码判断)
|
||
|
}
|
||
|
</code></pre><h5 id="3增加操作栏工具">3.增加操作栏工具</h5>
|
||
|
<p>(1) 找到 <code>src/js/conf/home/pages/dag/_source/config.js</code> 里的 <code>toolOper</code> 对象,往里增加</p>
|
||
|
<pre><code>{
|
||
|
code: 'pointer', // 工具标识
|
||
|
icon: '&#xe781;', // 工具图标
|
||
|
disable: disable, // 是否禁用
|
||
|
desc: `${i18n.$t('拖动节点和选中项')}` // tooltip desc
|
||
|
}
|
||
|
</code></pre><p>(2) 工具类都以一个构造函数返回 <code>src/js/conf/home/pages/dag/_source/plugIn</code></p>
|
||
|
<p><code>downChart.js</code> => dag 图片下载处理 </p>
|
||
|
<p><code>dragZoom.js</code> => 鼠标缩放效果处理 </p>
|
||
|
<p><code>jsPlumbHandle.js</code> => 拖拽线条处理 </p>
|
||
|
<p><code>util.js</code> => 属于 <code>plugIn</code> 工具类</p>
|
||
|
<p>操作则在 <code>src/js/conf/home/pages/dag/_source/dag.js</code> => <code>toolbarEvent</code> 事件中处理。</p>
|
||
|
<h5 id="3增加一个路由页面">3.增加一个路由页面</h5>
|
||
|
<p>(1) 首先在路由管理增加一个路由地址<code>src/js/conf/home/router/index.js</code></p>
|
||
|
<pre><code>{
|
||
|
path: '/test', // 路由地址
|
||
|
name: 'test', // 别名
|
||
|
component: resolve => require(['../pages/test/index'], resolve), // 路由对应组件入口文件
|
||
|
meta: {
|
||
|
title: `${i18n.$t('test')} - EasyScheduler` // title 显示
|
||
|
}
|
||
|
},
|
||
|
</code></pre><p>(2) 在<code>src/js/conf/home/pages</code> 建一个 <code>test</code> 文件夹,在文件夹里建一个<code>index.vue</code>入口文件。</p>
|
||
|
<pre><code>这样就可以直接访问 `http://localhost:8888/#/test`
|
||
|
</code></pre><h5 id="4增加预置邮箱">4.增加预置邮箱</h5>
|
||
|
<p>找到<code>src/lib/localData/email.js</code>启动和定时邮箱地址输入可以自动下拉匹配。</p>
|
||
|
<pre><code>export default ["test@analysys.com.cn","test1@analysys.com.cn","test3@analysys.com.cn"]
|
||
|
</code></pre><h5 id="5权限管理及disabled状态处理">5.权限管理及disabled状态处理</h5>
|
||
|
<p>权限根据后端接口<code>getUserInfo</code>接口给出<code>userType: "ADMIN_USER/GENERAL_USER"</code>权限控制页面操作按钮是否<code>disabled</code></p>
|
||
|
<p>具体操作:<code>src/js/module/permissions/index.js</code></p>
|
||
|
<p>disabled处理:<code>src/js/module/mixin/disabledState.js</code></p>
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
</div>
|
||
|
<div class="search-results">
|
||
|
<div class="has-results">
|
||
|
|
||
|
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||
|
<ul class="search-results-list"></ul>
|
||
|
|
||
|
</div>
|
||
|
<div class="no-results">
|
||
|
|
||
|
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<a href="frontend-deploy.html#问题" class="navigation navigation-prev " aria-label="Previous page: 问题">
|
||
|
<i class="fa fa-angle-left"></i>
|
||
|
</a>
|
||
|
|
||
|
|
||
|
<a href="frontend-development.html#系统功能模块" class="navigation navigation-next " aria-label="Next page: 系统功能模块">
|
||
|
<i class="fa fa-angle-right"></i>
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
var gitbook = gitbook || [];
|
||
|
gitbook.push(function() {
|
||
|
gitbook.page.hasChanged({"page":{"title":"项目目录结构","level":"1.2.6","depth":2,"next":{"title":"系统功能模块","level":"1.2.7","depth":2,"anchor":"#系统功能模块","path":"frontend-development.md","ref":"frontend-development.md#系统功能模块","articles":[]},"previous":{"title":"问题","level":"1.2.5","depth":2,"anchor":"#问题","path":"frontend-deploy.md","ref":"frontend-deploy.md#问题","articles":[]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","insert-logo-link"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"../images/logo.png","url":"/"},"expandable-chapters":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"YIGUAN","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"调度系统-EasyScheduler","language":"zh-hans","gitbook":"3.2.3","description":"调度系统"},"file":{"path":"frontend-development.md","mtime":"2019-03-27T10:41:58.990Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-28T11:15:13.750Z"},"basePath":".","book":{"language":""}});
|
||
|
});
|
||
|
</script>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook.js"></script>
|
||
|
<script src="gitbook/theme.js"></script>
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-insert-logo-link/plugin.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|