Explorar o código

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionOperation into 1.0.0_online

TonyKang %!s(int64=6) %!d(string=hai) anos
pai
achega
87224cbf5c

+ 2 - 0
modules/all_models/compilation.js

@@ -51,6 +51,8 @@ let modelSchema = {
     creator: String,
     //描述
     description: String,
+    //代码覆盖路径
+    overWriteUrl:String,
     // 发布时间
     release_time: {
         type: Number,

+ 12 - 0
modules/users/controllers/compilation_controller.js

@@ -487,6 +487,18 @@ class CompilationController extends BaseController {
             response.json({err: 1, msg: err, data: null});
         }
     }
+    async setOverWriteUrl(request, response){
+        let compilationId = request.body.id;
+        let overWriteUrl = request.body.overWriteUrl;
+        try{
+            let compilationModel = new CompilationModel();
+            await compilationModel.setOverWriteUrl(compilationId, overWriteUrl);
+            response.json({err: 0, msg: '', data: null});
+        }
+        catch (err){
+            response.json({err: 1, msg: err, data: null});
+        }
+    }
 
     /**
      * 模板设置页面

+ 9 - 0
modules/users/controllers/user_controller.js

@@ -8,6 +8,7 @@
 import BaseController from "../../common/base/base_controller";
 import UserModel from "../models/user_model";
 import Config from "../../../config/config";
+import CompilationModel from "../models/compilation_model";
 let config = require("../../../config/config.js");
 
 class UserController extends BaseController {
@@ -24,8 +25,15 @@ class UserController extends BaseController {
         let total = 0;
         let pageData = {};
         let userList = [];
+        let compilationList =[];
         let filter = request.query;
         try {
+            //获取编办列表
+            let  compilationModel = new CompilationModel();
+            compilationList = await compilationModel.getCompilationList();
+
+
+
             let condition = userModel.getFilterCondition(request);
 
             //获取注册时间
@@ -53,6 +61,7 @@ class UserController extends BaseController {
 
         // 渲染数据
         let renderData = {
+            compilationList:compilationList,
             userList: userList,
             pages: pageData,
             total: total,

+ 7 - 2
modules/users/models/compilation_model.js

@@ -36,7 +36,7 @@ class CompilationModel extends BaseModel {
      */
     async getCompilationList() {
         // 筛选字段
-        let field = {_id: 1, name: 1, is_release: 1, description: 1, "ration_valuation.id": 1, "ration_valuation.name": 1, "ration_valuation.enable": 1,
+        let field = {_id: 1, name: 1, is_release: 1, description: 1,overWriteUrl: 1, "ration_valuation.id": 1, "ration_valuation.name": 1, "ration_valuation.enable": 1,
             "bill_valuation.id": 1, "bill_valuation.name": 1, "bill_valuation.enable": 1};
         let compilationData = await this.findDataByCondition({name: {$ne: ''}}, field, false);
 
@@ -88,7 +88,12 @@ class CompilationModel extends BaseModel {
     async setDescription(compilationId, description){
         return await this.updateById(compilationId, {description: description});
     }
-
+    /*
+        设置代码覆盖路径
+     */
+    async setOverWriteUrl(compilationId, overWriteUrl){
+        return await this.updateById(compilationId, {overWriteUrl: overWriteUrl});
+    }
 
     /**
      * 新增计价规则

+ 1 - 0
modules/users/routes/compilation_route.js

@@ -22,6 +22,7 @@ module.exports = function (app) {
     router.post('/release', compilationController.auth, compilationController.init, compilationController.release);
     router.post('/add', compilationController.auth, compilationController.init, compilationController.addCompilation);
     router.post('/setDescription', compilationController.auth, compilationController.init, compilationController.setDescription);
+    router.post('/setOverWriteUrl', compilationController.auth, compilationController.init, compilationController.setOverWriteUrl);
     router.post('/add-valuation', compilationController.auth, compilationController.init, compilationController.addValuation);
     router.post('/save-valuation', compilationController.auth, compilationController.init, compilationController.saveValuation);
     router.post('/update-engineer', compilationController.auth, compilationController.init, compilationController.updateEngineer);

+ 17 - 0
web/users/js/compilation.js

@@ -227,6 +227,23 @@ $(document).ready(function() {
         });
     });
 
+    //更改代码覆盖路径
+    $('#overWriteUrl').change(function () {
+        let overWriteUrl = $(this).val();
+        if(overWriteUrl=="") overWriteUrl = undefined;
+        $.ajax({
+            url: '/compilation/setOverWriteUrl',
+            type: 'post',
+            dataType: "json",
+            data: {id: id, overWriteUrl: overWriteUrl},
+            success: function(response) {
+                if (response.err !== 0) {
+                    alert('更改失败');
+                }
+            }
+        });
+    });
+
     // 计价规则启用/禁止
     $(".enable").click(function() {
         let goingChangeStatus = switchChange($(this));

+ 1 - 0
web/users/views/compilation/index.html

@@ -99,6 +99,7 @@
             </div>
             <table class="table">
                 <tr><td><p>软件版本介绍</p><textarea id="description" class="form-control" placeholder="请简要描述改版本"><%= selectedCompilation.description%></textarea></td></tr>
+                <tr><td><span>重写路径:</span><input class="form-control" type="text" id="overWriteUrl" value="<%= selectedCompilation.overWriteUrl%>"></td></tr>
             </table>
         </div>
         <input type="hidden" name="id" value="<%= selectedCompilation._id %>" id="compilation-id">

+ 70 - 11
web/users/views/user/index.html

@@ -8,6 +8,32 @@
     <div class="content-wrap">
         <div class="c-header">
             <form class="form-inline" method="get" action="">
+                <!--最近使用定额-->
+                <div class="btn-group">
+                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
+                            aria-haspopup="true" aria-expanded="false">
+                       最近使用费用定额: <span class="caret"></span>
+                    </button>
+                    <ul class="dropdown-menu selector">
+                        <% for(let compilation of compilationList){ %>
+                        <li><a  data-value="<%= compilation._id.toString()%>"><%= compilation.name %></a></li>
+                        <% } %>
+                    </ul>
+                    <input type="hidden" name="latestUsed" value="<%= filter.latestUsed%>" />
+                </div>
+                <!--已升级费用定额-->
+                <div class="btn-group">
+                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
+                            aria-haspopup="true" aria-expanded="false">
+                        已升级费用定额: <span class="caret"></span>
+                    </button>
+                    <ul class="dropdown-menu selector">
+                        <% for(let compilation of compilationList){ %>
+                        <li><a  data-value="<%= compilation._id.toString()%>"><%= compilation.name %></a></li>
+                        <% } %>
+                    </ul>
+                    <input type="hidden" name="upGrade" value="<%= filter.upGrade%>" />
+                </div>
                 <!--最新注册-->
                 <div class="btn-group">
                     <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
@@ -15,25 +41,28 @@
                         最新注册:<%= filter.regtimeMsg === undefined ? '所有' : filter.regtimeMsg %><span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu selector">
-                        <li><a href="javascript:void(0);" data-value="0">所有</a></li>
-                        <li><a href="javascript:void(0);" data-value="1">最近24小时</a></li>
-                        <li><a href="javascript:void(0);" data-value="2">最近3天</a></li>
-                        <li><a href="javascript:void(0);" data-value="3">最近7天</a></li>
-                        <li><a href="javascript:void(0);" data-value="4">最近30天</a></li>
+                        <li><a  data-value="0">所有</a></li>
+                        <li><a  data-value="1">最近24小时</a></li>
+                        <li><a  data-value="2">最近3天</a></li>
+                        <li><a  data-value="3">最近7天</a></li>
+                        <li><a  data-value="4">最近30天</a></li>
                     </ul>
                     <input type="hidden" name="regtime" value="<%= filter.regtime%>" />
                 </div>
-                <!--版本-->
+                <!--最近登录-->
                 <div class="btn-group">
                     <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
                             aria-haspopup="true" aria-expanded="false">
-                        <%= filter.version === undefined || filter.version === '' ? '版本' : (filter.version === "1" ? '广东版' : '重庆版')%> <span class="caret"></span>
+                        最新注册:<%= filter.regtimeMsg === undefined ? '所有' : filter.regtimeMsg %><span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu selector">
-                        <li><a href="javascript:void(0);" data-value="1">广东版</a></li>
-                        <li><a href="javascript:void(0);" data-value="2">重庆版</a></li>
+                        <li><a  data-value="0">所有</a></li>
+                        <li><a  data-value="1">最近24小时</a></li>
+                        <li><a  data-value="2">最近3天</a></li>
+                        <li><a  data-value="3">最近7天</a></li>
+                        <li><a  data-value="4">最近30天</a></li>
                     </ul>
-                    <!--<input type="hidden" name="version" value="<%= filter.version%>" />-->
+                    <input type="hidden" name="loginTime" value="<%= filter.loginTime%>" />
                 </div>
                 <!--结果-->
                 <div class="btn-group">
@@ -79,7 +108,7 @@
                     <td>重庆01版</td>
                     <td>登录时间</td>
                     <td><%= moment(user.create_time).format('YYYY-MM-DD HH:mm:ss') %></td>
-                    <td>详细</td>
+                    <td><a>详细</a></td>
                     <td>升级</td>
                 </tr>
                 <% }) %>
@@ -91,4 +120,34 @@
         </div>
     </div>
 </div>
+
+
+<!-- 弹窗查看用户详情-->
+<div class="modal fade" id="view" tabindex="-1" role="dialog">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                <h4 class="modal-title" >用户信息</h4>
+            </div>
+            <div class="modal-body">
+                <table class="table table-bordered">
+                    <tbody>
+                    <tr><th>注册时间</th><td>2017-03-03 14:29:03</td><th>最近登录</th><td>2017-03-04 14:29:03</td></tr>
+                    <tr><th>手机</th><td>12345678909</td><th>邮箱</th><td></td></tr>
+                    <tr><th>姓名</th><td colspan="3">张三</td></tr>
+                    <tr><th>企业名称</th><td colspan="3">珠海纵横创新软件有限公司</td></tr>
+                    <tr><th>企业地区</th><td>珠海</td><th>企业类型</th><td>设计</td></tr>
+                    <tr><th>企业规模</th><td colspan="3">20-50</td></tr>
+                    </tbody>
+                </table>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+
 <script type="text/javascript" src="/web/users/js/user.js"></script>