Menu

easyconf——基于AugularJS的配置管理系统开发框架 – jasonfreak

0 Comment

篇目

1 EasyCONF的浮现
2 EasyCONF的设计思惟
总体设计
详细情况设计
2. 综合储备单位德手术
.2 即时反省
.3 拉下有构架的设计
3 运用目录
根本议事程序
表配置证明
3.3 的用户化
3. 空话
3. URL地址
惯例反省方法
4 EasyCONF后端利用目录
必要特性描述
复回阐明
5 下一步任务


1 EasyCONF的浮现

  大概半载前,做了单独雏形系统,记录库中记忆了大批配置记录。,用户必要管理这些配置项。一律利用过异乎寻常的的的配置管理系统的人特权市瞥见,为A表组成的配置管理加密近似地同族相干。。前提可以较远的理论上的,或许咱们仅有的的利用一套前端和后端加密。,它可以满意差不多懂得明显的的配置表的召唤。。

  我很懒,厌恶做重复的任务,因而我设计了easyconf——本AugularJS的配置管理系统利用有构架的。EasyCONF后退JSON体式的表配置证明,咱们可以下定义必要在即将到来的证明中管理的杂多的通信。,列通信等,和通信的的前端把持通信等。。EasyCONF的最小集中和两个前端加密,后端可以比照本文射中靶子目录停止用户化。,自然,我还想要了单独本Python的演示后端。。

  尽管不愿意,easyconf被设计用来利用配置管理系统,您还可以运用它利用杂多的管理系统。,如XX管理系统,XX藏书楼管理系统等。异乎寻常的熟识,反正本科课程设计曾经做了异乎寻常的的单独系统。。前提你有单独复杂的,你甚至省掉写1音节加密就可以做出单独管理系统,您只必要做表设计并自下定义表配置F。

  眼前(2016-07),easyconf已后退0-String/1-Long/2-Double/3-Boolean/4-Date,总公共用地5某典型的记录典型;0-text/1-combo box,总公共用地2某典型的控制;0-查问/1-计入/2-以内/3-大于/4-以内相等的/5-大于相等的,总共6种查询方法。


2 EasyCONF的设计思惟

总体设计

  MVC结构想要了将记录映照到后端类的诞生图案。,对立的事物利用人员在后端映照了控制射中靶子类。。可是,管理系统是单独异乎寻常的复杂的系统。,总额综合储备单位德手术只旨在单表停止,因而,可以预先消化映照相干。,将记录礼物的映照到前端控制:

  上面的图显示了单独活泼的状况。,假说咱们在即将到来的政府的明显的地面有很多服现役的。,过后咱们必要单独名为Service的表来记忆这些服现役的的通信。,它包罗服现役的的IP,接口号,定位省市,和假设启用。运用MVC结构或本MVC的使最优化结构,咱们必需为后端组成反正一定数量的加密(下定义CL)。前提运用记录,则礼物的映照前端控制,从此处,这项任务将被阻止。。

详细情况设计

2. 综合储备单位德手术

  easyconf后退对有大调的单表的综合储备单位德手术。以服现役的配置为例,翻开配置管理首页如次:

  点击“新增”,进入新面板:

  在配置管理首页中,单击查找,比照前提查找首页上的成果:

  点击查找成果的详细情况,进入详细情况面板:

  点击查找成果的重申,进入重申面板:

  单击查找的迅速离开成果,迅速离开配置记录:

 

.2 即时反省

  点击做后反省用户的输出是不人性化的。,easyconf可以即时反省用户的输出:

  上面的图显示了两种反省。,第一种是记录典型反省。,因服现役的侦听接口接的下定义是约整数。,当字母A被输出时,将提词必需是约整数。;瞬间个是惯例结账。,对的,EasyCONF还后退自下定义签出有或起作用,在这种情况下,我自下定义IP和接口坚信礼功用。。

  仅有的性是单独坏的处置的结账一件商品。:率先,求爱真正的种特性,当新的面板翻开合拢时,锁定表是非正常的的。;其次,退而求其次,每个病灶定位大调接中。,或修正大调接,或从大调接查询含糊。,这种方法同样无理的的。,这将大大地增殖系统的用钱。。EasyCONF采取准即时方法,在做新必要后,前提后端判别不满意仅有的性约束,大调接的输出是历史输出。,鄙人一次做过去的,将将大调接的每个修正与历史记录停止区别。,但愿它是平等地的,记录曾经在将被提词。:

  

.3 拉下有构架的设计

  EasyCONF运用两个下拉框:定态下拉有构架的和静态下拉有构架的。定态下拉框的候选是不易挥发的的。,表配置证明射中靶子下定义。静态下拉框的候选变量,其取数的方法也表配置证明射中靶子下定义。在本例中,从记录库表省级中读取省域的满足的。,从记录库表C中读取城市接的候选满足的,在读取时,必要添加禁猎地接作为查询前提。;启用接是定态下拉框。:


3 运用目录

根本议事程序

  EasyCONF的运用可分为以下根本议事程序。:

表配置证明

  表配置证明的用户化是运用EAS的核议事程序。,让咱们来看一眼即将到来的配置射中靶子杂多的配置项的特性描述。:

 1{
 2     title:,                      <span>//</span><span>在这里下定义新闻提要显示满足的。</span><span> 3</span>     table:<table>,                      <span>//</span><span>表名</span><span> 4</span>     伯爵:10,                           <span>//</span><span>每页编号查询成果</span><span> 5</span>     columns:                            <span>//</span><span>下定义必要显示的表的列通信。</span><span> 6</span><span>    [
</span><span> 7</span><span>            {
</span><span> 8</span>                 id:<col1>,              <span>//</span><span>记录库中下定义的指定</span><span> 9</span>                 name:<列1>,             <span>//</span><span>列在页表上显示的中文名</span><span>10</span>                 isShow:<<span>true</span>>,          <span>//</span><span>假设显示在查询成果中</span><span>11</span>                 isPrimaryKey:[<span>true</span>],    <span>//</span><span>它假设是大调,添加新篇章时,大调的列的控制发现onchange事变后,必要做仅有的性反省。</span><span>12</span>                 无空<<span>true</span>>,          <span>//</span><span>假设为空,添加或修正页表时,大调的列的控制发现onchange事变后,假设必要停止空支票。</span><span>13</span>                 type:<0>,               <span>//</span><span>列的记录典型,0- String /1-Long/2-Double/3-Boolean/4-Date</span><span>14</span>                 control:<0>,            <span>//</span><span>页表上显示的控制典型,0-text/1-combo box</span><span>15</span>                 check:                  <span>//</span><span>添加或修正页表时,在Onchange事变以前命令的自下定义反省有或起作用由T发现</span><span>16</span><span>                [
</span><span>17</span><span>                    {
</span><span>18</span>                     funcname:<function1><span>,
</span><span>19</span>                     argument:<col1, col2…>
<span>20</span>                     },                  <span>//</span><span>命令有或起作用时,第单独参量是控制的值。,上面的参量是列出的通信的控制的值。</span><span>21</span><span>                    …
</span><span>22</span><span>                ],    
</span><span>23</span>                 isSelect:<<span>true</span>>,        <span>//</span><span>假设作为查询前提。</span><span>24</span>                 selectType:<0>,         <span>//</span><span>查询前提,0-查问/1-计入/2-以内/3-大于/4-以内相等的/5-大于相等的</span><span>25</span>                 candidate:<0/1>,        0 -不易挥发的值,1静态值,从不易挥发的值中抛候选满足的,从静态值中获取键,value,表和查询组SQL结算单从DA中查询候选满足的。攻读学位者的体式是核心付出代价。
<span>26</span><span>                fixed:
</span><span>27</span><span>                [
</span><span>28</span>                     {key1:<value1><span>}, 
</span><span>29</span>                     {key2:<value2><span>},
</span><span>30</span><span>                    …
</span><span>31</span><span>                ],
</span><span>32</span><span>                flexible:
</span><span>33</span><span>                {
</span><span>34</span>                     key:<col><span>,
</span><span>35</span>                     value:<col><span>,     
</span><span>36</span>                     table:<table><span>,
</span><span>37</span>                     where:<col1, col2…>
<span>38</span><span>                },
</span><span>39</span>                 dft:<dft?               <span>//</span><span>Windows 默认值,查询超过控制或新篇章得面临Windows 默认值。</span><span>40</span><span>            },
</span><span>41</span><span>            …
</span><span>42</span><span>    ]
</span><span>43</span> }</pre>
</div>
<h2>3.3 的用户化</h2>
<h3>3. 空话</h3>
<p>  在在位的,咱们可以自下定义显示在前端的元素的指定。,提词的通信:</p>
<div >
<pre><span> 1</span><span>//</span><span>下定义控制的显示指定</span><span> 2</span><span>names:{
</span><span> 3</span>     搜索:查找<span>,
</span><span> 4</span>     拔出:新<span>,
</span><span> 5</span>     详细情况:详细情况<span>,
</span><span> 6</span>     重申:重申<span>,
</span><span> 7</span>     迅速离开:迅速离开<span>,
</span><span> 8</span>     新生:更新<span>,
</span><span> 9</span>     上页:上页<span>,
</span><span>10</span>     下对折的:下对折的<span>,
</span><span>11</span>     去:跳<span>,
</span><span>12</span>     回归:回归<span>,
</span><span>13</span>     做:做<span>,
</span><span>14</span>     买卖:买卖
<span>15</span><span>},
</span><span>16</span><span>//</span><span>头衔的的下定义</span><span>17</span> 头衔的:[查找], 详细情况, 重申, 新<span>],
</span><span>18</span><span>//</span><span>下定义提词通信</span><span>19</span><span>msgs:{
</span><span>20</span>     好的:许可证<span>,
</span><span>21</span>     NOT NULL:不容为空<span>,
</span><span>22</span>     约整数:必需是约整数。<span>,
</span><span>23</span>     双:必需是浮点十进制数<span>,
</span><span>24</span>     TYPEERROR:典型不义行为<span>,
</span><span>25</span>     日期:必需是日期[YYY-MM-DD HH: mm:<span>,
</span><span>26</span>     责怪仅有的的:记录曾经在<span>,
</span><span>27</span> },</pre>
</div>
<h3>3. URL地址</h3>
<p>  在中,咱们也可以下定义URL地址,比如,区名是,下定义拔出必要的URL是拔出。,因而充分的URL地址是拔出:</p>
<div >
<pre><span>1</span><span>apps:{
</span><span>2</span>     init:init<span>,
</span><span>3</span>     列表:搜索<span>,
</span><span>4</span>     迅速离开:迅速离开<span>,
</span><span>5</span>     重申:重申<span>,
</span><span>6</span>     拔出:拔出<span>,
</span><span>7</span>     扣押:扣押
<span>8</span> },</pre>
</div>
<h3> 惯例反省方法</h3>
<p>  在中,咱们还可以惯例反省方法,在服现役的配置示例中,咱们将IP和接口坚信礼方法下定义如次:</p>
<div >
<pre><span> 1</span><span>//</span><span> 用户的 function here</span><span> 2</span><span>userfunc: {
</span><span> 3</span>     checkIp:<span>function</span><span>(IP) {
</span><span> 4</span><span>var</span> exp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/<span>; 
</span><span> 5</span><span>var</span> reg =<span> (EXP)
</span><span> 6</span><span>if</span>(招收)  != <span>null</span><span>) 
</span><span> 7</span><span>return</span><span>true</span><span>;
</span><span> 8</span><span>else</span><span> 9</span><span>return</span><span>false</span><span>;
</span><span>10</span><span>    },
</span><span>11</span><span>12</span>     checkPort:<span>function</span><span>(举枪) {
</span><span>13</span><span>if</span> (0 <= port && port <= 65535<span>)
</span><span>14</span><span>return</span><span>true</span><span>;
</span><span>15</span><span>else</span><span>16</span><span>return</span><span>false</span><span>;
</span><span>17</span><span>    }
</span><span>18</span> }</pre>
</div>
<hr />
<h3> </h3>
<h1>4 EasyCONF后端利用目录</h1>
<h2> 必要特性描述</h2>
<p>  比照即将到来的目录,咱们可认为EasyCONF利用本人的后端。:</p>
<table border="0" align="center">
<tbody>
<tr>
<td>必要</td>
<td>方法</td>
<td>url</td>
<td>必要记录</td>
<td>复回记录</td>
<td>阐明</td>
</tr>
<tr>
<td>配置管理首页</td>
<td>GET</td>
<td><domain>/<main>.html</td>
<td>无</td>
<td><></td>
<td>区名是区名,改名单独复本</td>
</tr>
<tr>
<td>设定初值</td>
<td>GET</td>
<td><domain>/<INIT></td>
<td>无</td>
<td><table.json></td>
<td>表是单独表配置证明</td>
</tr>
<tr>
<td>列表查询</td>
<td>GET</td>
<td><domain>/<LIST>?table=</p>
<table>&data=<col1,col2...>&query=<col1:value1,col2:value2...>&begin=<begin>&count=<count></td>
<td>无</td>
<td>查询复回,见下</td>
<td>
<p>后端收执必要后,解析记录和查询参量,data参量和query射中靶子col和value均停止了base64编码。过后查询组SQL结算单。,查询摆脱的成果为记录库射中靶子第begin*count+1条到begin*(count+1)条。</p>
</td>
</tr>
<tr>
<td>迅速离开</td>
<td>POST</td>
<td><domain>/<DELETE></td>
<td>迅速离开必要,见下</td>
<td>普通进项,见下</td>
<td>
<p>后端收执必要后,解析查询变量。过后迅速离开组SQL结算单。前提原始记录不在,回归成。</p>
</td>
</tr>
<tr>
<td>重申</td>
<td>POST</td>
<td><domain>/<UPDATE></td>
<td>重申必要,见下</td>
<td> 普通进项,见下</td>
<td> 后端收执必要后,解析记录和查询变量。过后重申组SQL结算单。前提原始记录不在,回归成。</td>
</tr>
<tr>
<td>新增</td>
<td>POST</td>
<td><domain>/<INSERT></td>
<td>新增必要,见下</td>
<td>普通进项,见下</td>
<td> 后端收执必要后,解析记录变量。过后重申组SQL结算单。</td>
</tr>
<tr>
<td>候选项查询</td>
<td>GET</td>
<td><domain>/<LIST>?table=</p>
<table>&key=<key>&value=<value>&query=<col1:value1,col2:value2...></td>
<td>无</td>
<td>攻读学位者有助益,见下</td>
<td>后端收执必要后,解析查询参量。过后查询组SQL结算单。,复回查询成果。</td>
</tr>
</tbody>
</table>
<p>  迅速离开必要:</p>
<div >
<pre><span>1</span><span>{
</span><span>2</span><span>    table:<table>,
</span><span>3</span><span>    query:<col1:value1,col2:value2...>
</span><span>4</span> }</pre>
</div>
<p>   重申必要:</p>
<div >
<pre><span>1</span><span>{
</span><span>2</span>     table:<table><span>,
</span><span>3</span>     data:<col1:value1,col2:value2...><span>,
</span><span>4</span>     query=<col1:value1,col2:value2...>
<span>5</span> }</pre>
</div>
<p>  新增必要:</p>
<div >
<pre><span>1</span><span>{
</span><span>2</span>     table:<table><span>,
</span><span>3</span>     data:<col1:value1,col2:value2...><span>,
</span><span>4</span> }</pre>
</div>
<h2> 复回阐明</h2>
<p>  查询复回:</p>
<div >
<pre><span> 1</span><span>{
</span><span> 2</span>     result:<00>,                <span>//</span><span>足以媲美的人成果,成00</span><span> 3</span>     message:<OK>,               <span>//</span><span>足以媲美的人通信</span><span> 4</span>     data:[                      <span>//</span><span>查询无成果复回空列表</span><span> 5</span>             [                   <span>//</span><span>查询的每单独记录</span><span> 6</span>                 value1,         <span>//</span><span>每个记录的每个列的值,前提列是静态下拉,过后必要查询表配置证明以诞生键的使成形。,键和值BASE64编码</span><span> 7</span><span>                value2,
</span><span> 8</span><span>                …
</span><span> 9</span><span>            ],
</span><span>10</span><span>            …
</span><span>11</span><span>    ]
</span><span>12</span> }</pre>
</div>
<p>  普通进项:</p>
<div >
<pre><span>1</span><span>{
</span><span>2</span>     result:<00>,                 <span>//</span><span>足以媲美的人成果,成00,01拔出时的大调冲</span><span>3</span>     message:<OK>,                <span>//</span><span>足以媲美的人通信</span><span>4</span> }</pre>
</div>
<p>  攻读学位者有助益:</p>
<div >
<pre><span> 1</span><span>{
</span><span> 2</span>     result:<00>,                <span>//</span><span>足以媲美的人成果,成00</span><span> 3</span>     message:<OK>,               <span>//</span><span>足以媲美的人通信</span><span> 4</span>     data:[                      <span>//</span><span>前提查询责怪记录,则复回空列表。</span><span> 5</span>             {                   <span>//</span><span>每条记录</span><span> 6</span>                 key:<key>
<span> 7</span>                 value:<value>
<span> 8</span><span>            }
</span><span> 9</span><span>            …
</span><span>10</span><span>    ]
</span><span>11</span> }</pre>
</div>
<hr />
<h1>5 下一步任务</h1>
<p>  EasyCONF从设计到编码花了我包括第一天和最后一天的工夫。,礼物版本可以满意根本配置管理查问。但仍有许多的有待改良和使最优化的地方的。,比如:页表丑化(也可以经过表格配置用户化),更难以对付的的非常处置,外键约束反省,表买卖的用发动机发动管理,等等及其他。因懒散,我有即将到来的。,同时为本人挖单独大坑,渐渐包装材料。您可以从GITHUB下载EasyCONF和DEMO后端。。</p>
</div>
</div></p>

	<nav class="navigation post-navigation" role="navigation">
		<h2 class="screen-reader-text">文章导航</h2>
		<div class="nav-links"><div class="nav-previous"><a href="https://www.cfsygs.com/ptpt/2244.html" rel="prev"><span class="meta-nav" aria-hidden="true">Previous page</span> <span class="screen-reader-text">Previous post:</span> <span class="post-title">复合树脂补牙的基本步骤及注意事项_搜狐健康</span></a></div><div class="nav-next"><a href="https://www.cfsygs.com/ptyl/2293.html" rel="next"><span class="meta-nav" aria-hidden="true">Next page</span> <span class="screen-reader-text">Next post:</span> <span class="post-title">pt娱乐</span></a></div></div>
	</nav><div class="clearfix"></div>
<div id="comments" class="comments-area">

	
	
		<div id="respond" class="comment-respond">
		<h2 id="reply-title" class="comment-reply-title">发表评论 <small><a rel="nofollow" id="cancel-comment-reply-link" href="/ptpt/2288.html#respond" style="display:none;">取消回复</a></small></h2>			<form action="https://www.cfsygs.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
				<p class="comment-notes"><span id="email-notes">电子邮件地址不会被公开。</span> 必填项已用<span class="required">*</span>标注</p><p class="comment-form-comment"><label for="comment">评论</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p><p class="comment-form-author"><label for="author">姓名 <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" aria-required='true' required='required' /></p>
<p class="comment-form-email"><label for="email">电子邮件 <span class="required">*</span></label> <input id="email" name="email" type="text" value="" size="30" maxlength="100" aria-describedby="email-notes" aria-required='true' required='required' /></p>
<p class="comment-form-url"><label for="url">站点</label> <input id="url" name="url" type="text" value="" size="30" maxlength="200" /></p>
<p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="发表评论" /> <input type='hidden' name='comment_post_ID' value='2288' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</p>			</form>
			</div><!-- #respond -->
	</div><!-- .comments-area -->						            	       	</div>
	            <div class="clearfix"></div>
    </div>
</div>


<div class="footersec">
	<div class="container">
		<div class="row">
			<div class="col-md-3 col-sm-3">
	            <aside id="search-2" class="widget widget_search"><form role="search" method="get" class="search-form" action="https://www.cfsygs.com/">
	<label>
		<input type="search" class="search-field" placeholder="Search" value="" name="s">
	</label>
	<input type="submit" class="search-submit" value="Search">
</form>

</aside>		<aside id="recent-posts-2" class="widget widget_recent_entries">		<h3 class="widget-title">近期文章</h3>		<ul>
					<li>
				<a href="https://www.cfsygs.com/ptdzyy/3321.html">台湾2年倒闭1000家医美诊所,大陆凭什么不会步其后尘?</a>
						</li>
					<li>
				<a href="https://www.cfsygs.com/ptpt/3320.html">2016先辈的旗帜观后感300字作文</a>
						</li>
					<li>
				<a href="https://www.cfsygs.com/ptpt/3319.html">长治医学院怎么样-全国排名-师资力量-王牌专业</a>
						</li>
					<li>
				<a href="https://www.cfsygs.com/ptdzyy/3318.html">【投资分红网】-投资分红网价格|批发-投资分红网公司</a>
						</li>
					<li>
				<a href="https://www.cfsygs.com/ptpt/3317.html">2018年一季度能源生产平稳增长 原油生产降幅收窄_财经</a>
						</li>
				</ul>
		</aside>		<aside id="archives-2" class="widget widget_archive"><h3 class="widget-title">文章归档</h3>		<ul>
			<li><a href='https://www.cfsygs.com/date/2018/09'>2018年九月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/08'>2018年八月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/07'>2018年七月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/06'>2018年六月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/05'>2018年五月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/04'>2018年四月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/03'>2018年三月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/02'>2018年二月</a></li>
	<li><a href='https://www.cfsygs.com/date/2018/01'>2018年一月</a></li>
	<li><a href='https://www.cfsygs.com/date/2017/12'>2017年十二月</a></li>
		</ul>
		</aside><aside id="categories-2" class="widget widget_categories"><h3 class="widget-title">分类目录</h3>		<ul>
	<li class="cat-item cat-item-1"><a href="https://www.cfsygs.com/./ptyl" >pt娱乐</a>
</li>
	<li class="cat-item cat-item-2"><a href="https://www.cfsygs.com/./ptpt" >pt平台</a>
</li>
	<li class="cat-item cat-item-3"><a href="https://www.cfsygs.com/./ptdzyy" >pt电子游艺</a>
</li>
		</ul>
</aside>	        </div>
	        <div class="col-md-3 col-sm-3">
	            	        </div>
	        <div class="col-md-3 col-sm-3">
	            	        </div> 
	        <div class="col-md-3 col-sm-3">
	            	        </div>        
		</div>
	</div>
</div>
<div class="copyright-wrapper">
	<div class="inner">
        <div class="copyright">
           <span>欢迎访问</span><a href="#"><span>体育资讯网</span></a>
        </div><!-- copyright -->
        <div class="clear"></div>
    </div><!-- inner -->
</div>
<script type='text/javascript' src='https://www.cfsygs.com/wp-content/themes/twentyseventeen/js/bootstrap.js?ver=4.7.11'></script>
<script type='text/javascript' src='https://www.cfsygs.com/wp-includes/js/comment-reply.min.js?ver=4.7.11'></script>
<script type='text/javascript' src='https://www.cfsygs.com/wp-includes/js/wp-embed.min.js?ver=4.7.11'></script>

</body>
</html>