فهرست منبع

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

zhongzewei 6 سال پیش
والد
کامیت
e1cf03cba5

+ 5 - 1
modules/common/const/bills_fixed.js

@@ -58,7 +58,11 @@ const fixedFlag = {
     VISA: 27,
     VISA: 27,
     ADDITIONAL_TAX: 28,
     ADDITIONAL_TAX: 28,
     //环境保护税
     //环境保护税
-    ENVIRONMENTAL_PROTECTION_TAX: 29
+    ENVIRONMENTAL_PROTECTION_TAX: 29,
+    //建设工程竣工档案编制费
+    PROJECT_COMPLETE_ARCH_FEE:30,
+    //住宅工程质量分户验收费
+    HOUSE_QUALITY_ACCEPT_FEE:31
 };
 };
 
 
 export default fixedFlag;
 export default fixedFlag;

+ 3 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -96,8 +96,10 @@ function generateRationName(ration,gljList) {
     let caption = ration.caption ? ration.caption:ration.name;
     let caption = ration.caption ? ration.caption:ration.name;
     if(ration.rationAssList && ration.rationAssList.length > 0){
     if(ration.rationAssList && ration.rationAssList.length > 0){
         let ass = ration.rationAssList[0];
         let ass = ration.rationAssList[0];
-        if(ass.actualValue != null && ass.actualValue != undefined ){
+        if( ass.isAdjust == 1 && ass.actualValue != null && ass.actualValue != undefined ){
             caption =  caption.replace('%s',ass.actualValue);
             caption =  caption.replace('%s',ass.actualValue);
+        }else {
+            caption =  caption.replace('%s',ass.stdValue);//没勾选的时候要恢复成标准值
         }
         }
     }
     }
     let reNameList = [];
     let reNameList = [];

+ 14 - 1
modules/users/controllers/cld_controller.js

@@ -148,6 +148,19 @@ class CLDController {
             response.json({error: 1, msg: err});
             response.json({error: 1, msg: err});
         }
         }
     }
     }
+
+    /**
+     * 获取编办列表
+     *
+     * @param request
+     * @param response
+     * @return {Promise.<void>}
+     */
+    async getCompilationList (request, response) {
+        let compilationModel = new CompilationModel();
+        const compilationList = await compilationModel.getList();
+        response.json({error: 0, msg: 'success', data: compilationList});
+    }
 }
 }
 
 
-export default CLDController;
+export default CLDController;

+ 163 - 86
modules/users/controllers/login_controller.js

@@ -22,12 +22,89 @@ class LoginController {
      * @return {void}
      * @return {void}
      */
      */
     async index(request, response) {
     async index(request, response) {
-        let sessionUser = request.session.sessionUser;
-        if (sessionUser !== undefined && sessionUser.ssoId >= 0) {
-            return response.redirect("/pm");
-        }
+        // 判断是否有带token和ssoID参数
+        if (request.query.ssoID !== undefined && request.query.token !== undefined) {
+            let ssoID = request.query.ssoID;
+            let token = request.query.token;
+            let preferenceSetting = {};
+            let compilationList = [];
+            try {
+                let userModel = new UserModel();
+                // 调用接口验证登录信息
+                let responseData = await userModel.getInfoFromSSO2(ssoID, token);
+                // 先判断返回值是否为未激活状态
+                if ( responseData === '-3') {
+                    throw '因邮箱未完成认证,账号未激活;去<a href="https://sso.smartcost.com.cn" target="_blank">激活</a>。';
+                }
+                if ( responseData === '-2') {
+                    throw 'token已过期,请重新登录Z+获取';
+                }
+                responseData = JSON.parse(responseData);
+                if (typeof responseData !== 'object') {
+                    throw 'ssoId错误或token过期';
+                }
+
+                if (responseData.length <= 0) {
+                    throw '接口返回数据错误';
+                }
+                let userData = responseData[0];
+                let sessionUser = {
+                    ssoId: userData.id,
+                    username: userData.username,
+                    email: userData.useremail,
+                    mobile: userData.mobile,
+                };
+
+                request.session.sessionUser = sessionUser;
+                // 记录用户数据到数据库
+                let result = await userModel.markUser(sessionUser, request);
 
 
-        response.render('users/html/login', {});
+                // 获取偏好设置
+                let settingModel = new SettingModel();
+                preferenceSetting = await settingModel.getPreferenceSetting(request.session.sessionUser.id);
+                if (!result) {
+                    throw '标记用户信息失败!';
+                }
+                let compilationModel = new CompilationModel();
+                if (preferenceSetting.login_ask === 1 || preferenceSetting.select_version === ''){
+                    preferenceSetting.login_ask = 1;
+                    compilationList = await  compilationModel.getList();
+                } else {
+                    compilationList = [];
+                }
+                // 获取编办信息
+                let sessionCompilation = request.session.sessionCompilation;
+
+                if (preferenceSetting.login_ask === 0 && !sessionCompilation &&
+                    preferenceSetting.select_version !== '') {
+                    let compilationData = await compilationModel.getCompilationById(preferenceSetting.select_version);
+                    // 判断当前用户的是使用免费版还是专业版
+                    let compilationVersion = await userModel.getVersionFromUpgrade(sessionUser.ssoId, preferenceSetting.select_version);
+                    request.session.compilationVersion = compilationVersion;
+                    request.session.sessionCompilation = compilationData;
+                    if(request.session.sessionUser.latest_used !== preferenceSetting.select_version) await userModel.updateLatestUsed(request.session.sessionUser.id,preferenceSetting.select_version);
+                }
+                console.log(`${request.session.sessionUser.real_name}--id:${request.session.sessionUser.id}--登录了系统`);
+                if (preferenceSetting.login_ask === 1 || preferenceSetting.select_version === '') {
+                    let renderData = {
+                        versionData: compilationList,
+                    };
+                    response.render('users/html/login-ver', renderData);
+                } else {
+                    return response.redirect("/pm");
+                }
+            } catch (error) {
+                console.log(error)
+                return response.redirect("/login");
+            }
+        } else {
+            let sessionUser = request.session.sessionUser;
+            if (sessionUser !== undefined && sessionUser.ssoId >= 0) {
+                return response.redirect("/pm");
+            } else {
+                response.render('users/html/login', {});
+            }
+        }
     }
     }
 
 
     /**
     /**
@@ -68,34 +145,34 @@ class LoginController {
             }
             }
 
 
             //还要判断account是否是专业版用户
             //还要判断account是否是专业版用户
-            let isPro = false;
-            const userInfo = await userModel.findDataByAccount(account);
-
-            if (userInfo && userInfo.upgrade_list !== undefined) {
-                for (const ul of userInfo.upgrade_list) {
-                    if (ul.isUpgrade === true) {
-                        isPro = true;
-                        break;
-                    }
-                }
-            }
-            // 专业版短信验证码验证
-            if (isPro) {
-                const codeMsg = request.session.code;
-                if (codeMsg !== undefined && request.body.code !== '') {
-                    const code = codeMsg.split('_')[0];
-                    const time = codeMsg.split('_')[1];
-                    console.log(code);
-                    console.log(request.body.code);
-                    if (Date.parse(new Date())/1000 > time+60*5 || request.body.code !== code) {
-                        return response.json({error: 3, msg: '验证码错误。'});
-                    } else {
-                        delete request.session.code;
-                    }
-                } else {
-                    return response.json({error: 3, msg: '验证码错误。'});
-                }
-            }
+            // let isPro = false;
+            // const userInfo = await userModel.findDataByAccount(account);
+            //
+            // if (userInfo && userInfo.upgrade_list !== undefined) {
+            //     for (const ul of userInfo.upgrade_list) {
+            //         if (ul.isUpgrade === true) {
+            //             isPro = true;
+            //             break;
+            //         }
+            //     }
+            // }
+            // // 专业版短信验证码验证
+            // if (isPro) {
+            //     const codeMsg = request.session.code;
+            //     if (codeMsg !== undefined && request.body.code !== '') {
+            //         const code = codeMsg.split('_')[0];
+            //         const time = codeMsg.split('_')[1];
+            //         console.log(code);
+            //         console.log(request.body.code);
+            //         if (Date.parse(new Date())/1000 > time+60*5 || request.body.code !== code) {
+            //             return response.json({error: 3, msg: '验证码错误。'});
+            //         } else {
+            //             delete request.session.code;
+            //         }
+            //     } else {
+            //         return response.json({error: 3, msg: '验证码错误。'});
+            //     }
+            // }
 
 
             // 判断极验验证码是否通过
             // 判断极验验证码是否通过
             const captcha = new Captcha();
             const captcha = new Captcha();
@@ -175,59 +252,59 @@ class LoginController {
      * @param response
      * @param response
      * @returns {Promise<void>}
      * @returns {Promise<void>}
      */
      */
-    async accountIsPro(request, response) {
-        let res = {
-            error: 0,
-            msg: '',
-            result: false,
-        };
-        try{
-            const account = request.body.account;
-            const password = request.body.pw;
-
-            // 根据邮箱或手机号获取账号信息
-            let userModel = new UserModel();
-            // 调用接口验证登录信息
-            let responseData = await userModel.getInfoFromSSO(account, password);
-            // 先判断返回值是否为未激活状态
-            if ( responseData === '-3') {
-                throw '因邮箱未完成认证,账号未激活;去<a href="https://sso.smartcost.com.cn" target="_blank">激活</a>。';
-            }
-            responseData = JSON.parse(responseData);
-            if (typeof responseData !== 'object') {
-                throw '邮箱/手机 或 密码错误';
-            }
-
-            if (responseData.length <= 0) {
-                throw '接口返回数据错误';
-            }
-
-            // 正确登录后 存入session
-            let userData = responseData[0];
-
-            if (userData.mobile === '') {
-                return response.json({error: 2,ssoId: userData.id});
-            }
-
-            const userInfo = await userModel.findDataByAccount(account);
-            if (userInfo && userInfo.upgrade_list !== undefined) {
-                for (const ul of userInfo.upgrade_list) {
-                    if (ul.isUpgrade === true) {
-                        res.result = true;
-                        res.data = userInfo.mobile;
-                        break;
-                    }
-                }
-            } else {
-                res.msg = '当前未存在此用户';
-            }
-        } catch (err) {
-            res.error = 1;
-            res.msg = err;
-        }
-
-        response.json(res);
-    }
+    // async accountIsPro(request, response) {
+    //     let res = {
+    //         error: 0,
+    //         msg: '',
+    //         result: false,
+    //     };
+    //     try{
+    //         const account = request.body.account;
+    //         const password = request.body.pw;
+    //
+    //         // 根据邮箱或手机号获取账号信息
+    //         let userModel = new UserModel();
+    //         // 调用接口验证登录信息
+    //         let responseData = await userModel.getInfoFromSSO(account, password);
+    //         // 先判断返回值是否为未激活状态
+    //         if ( responseData === '-3') {
+    //             throw '因邮箱未完成认证,账号未激活;去<a href="https://sso.smartcost.com.cn" target="_blank">激活</a>。';
+    //         }
+    //         responseData = JSON.parse(responseData);
+    //         if (typeof responseData !== 'object') {
+    //             throw '邮箱/手机 或 密码错误';
+    //         }
+    //
+    //         if (responseData.length <= 0) {
+    //             throw '接口返回数据错误';
+    //         }
+    //
+    //         // 正确登录后 存入session
+    //         let userData = responseData[0];
+    //
+    //         if (userData.mobile === '') {
+    //             return response.json({error: 2,ssoId: userData.id});
+    //         }
+    //
+    //         const userInfo = await userModel.findDataByAccount(account);
+    //         if (userInfo && userInfo.upgrade_list !== undefined) {
+    //             for (const ul of userInfo.upgrade_list) {
+    //                 if (ul.isUpgrade === true) {
+    //                     res.result = true;
+    //                     res.data = userInfo.mobile;
+    //                     break;
+    //                 }
+    //             }
+    //         } else {
+    //             res.msg = '当前未存在此用户';
+    //         }
+    //     } catch (err) {
+    //         res.error = 1;
+    //         res.msg = err;
+    //     }
+    //
+    //     response.json(res);
+    // }
 
 
 }
 }
 
 

+ 32 - 0
modules/users/models/user_model.js

@@ -81,6 +81,38 @@ class UserModel extends BaseModel {
     }
     }
 
 
     /**
     /**
+     * 根据用户id和token调用SSO接口获取信息
+     *
+     * @param {string} username
+     * @param {string} password
+     * @return {object}
+     */
+    async getInfoFromSSO2(ssoID, token) {
+        let postData = {
+            url: 'http://sso.smartcost.com.cn/building/api/login/auth',
+            form: {ssoID: ssoID, token: token},
+            encoding: 'utf8'
+        };
+        return new Promise(function (resolve, reject) {
+            try {
+                // 请求接口
+                Request.post(postData, function (err, postResponse, body) {
+                    if (err) {
+                        console.log('111');
+                        throw '请求错误';
+                    }
+                    if (postResponse.statusCode !== 200) {
+                        throw '通行证验证失败!';
+                    }
+                    resolve(body);
+                });
+            } catch (error) {
+                reject([]);
+            }
+        });
+    }
+
+    /**
      * 标记用户
      * 标记用户
      *
      *
      * @param {object} userData
      * @param {object} userData

+ 3 - 1
modules/users/routes/cld_route.js

@@ -20,7 +20,9 @@ module.exports = function (app) {
 
 
     router.get('/getUsersAndCompilation', cldController.getUsersAndCompilationList);
     router.get('/getUsersAndCompilation', cldController.getUsersAndCompilationList);
 
 
+    router.get('/getCompilationList', cldController.getCompilationList);
+
     router.post('/setUserUpgrade', cldController.setUsersUpgrade);
     router.post('/setUserUpgrade', cldController.setUsersUpgrade);
 
 
     app.use('/cld',router)
     app.use('/cld',router)
-};
+};

+ 1 - 1
modules/users/routes/login_route.js

@@ -19,7 +19,7 @@ module.exports = function (app) {
 // 登录操作
 // 登录操作
     router.post('/login', loginController.login);
     router.post('/login', loginController.login);
 
 
-    router.post('/accountIsPro', loginController.accountIsPro);
+    // router.post('/accountIsPro', loginController.accountIsPro);
 
 
     // 验证码相关
     // 验证码相关
     router.get('/captcha', loginController.captcha);
     router.get('/captcha', loginController.captcha);

+ 19 - 12
server.js

@@ -56,24 +56,31 @@ app.use(session({
 // 登录状态全局判断
 // 登录状态全局判断
 app.use(function (req, res, next) {
 app.use(function (req, res, next) {
     let url = req.originalUrl;
     let url = req.originalUrl;
-    if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url)  || /^\/accountIsPro/.test(url)) {
+    // if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url)  || /^\/accountIsPro/.test(url)) {
+    if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url)) {
         // 如果是登录页面或短信接口或cld接口则忽略判断数据
         // 如果是登录页面或短信接口或cld接口则忽略判断数据
         next();
         next();
     } else {
     } else {
         try {
         try {
-            // 判断session
-            let sessionUser = req.session.sessionUser;
-            if (!sessionUser) {
-                //处理 ajax 请求 session 过期问题
-                if (req.headers["x-requested-with"] != null
-                    && req.headers["x-requested-with"] == "XMLHttpRequest"
-                    && req.url != "/login") {
-                    return res.json({ret_code: 99, ret_msg: '登录信息失效,请您重新登录'});
-                }else {
-                    throw 'session error';
+            if (req.query.ssoID !== undefined && req.query.ssoID !== null && req.query.token !== undefined && req.query.token !== null) {
+                delete req.session.sessionUser;
+                delete req.session.sessionCompilation;
+                return res.redirect('/login' + url);
+            } else {
+                // 判断session
+                let sessionUser = req.session.sessionUser;
+                if (!sessionUser) {
+                    //处理 ajax 请求 session 过期问题
+                    if (req.headers["x-requested-with"] != null
+                        && req.headers["x-requested-with"] == "XMLHttpRequest"
+                        && req.url != "/login") {
+                        return res.json({ret_code: 99, ret_msg: '登录信息失效,请您重新登录'});
+                    } else {
+                        throw 'session error';
+                    }
                 }
                 }
+                res.locals.sessionUser = sessionUser;
             }
             }
-            res.locals.sessionUser = sessionUser;
         } catch (error) {
         } catch (error) {
             // 最后一个页面存入session
             // 最后一个页面存入session
             req.session.lastPage = url;
             req.session.lastPage = url;

+ 9 - 1
web/building_saas/css/main.css

@@ -36,6 +36,9 @@ a{
 .modal-footer{
 .modal-footer{
     padding:.8rem 1rem;
     padding:.8rem 1rem;
 }
 }
+.form-check .form-check-label,.form-radio .form-check-label{
+    cursor: pointer;
+}
 /*自定义css*/
 /*自定义css*/
 .login-body,.login-html{
 .login-body,.login-html{
     height:100%;
     height:100%;
@@ -59,6 +62,10 @@ a{
     background:#fff;
     background:#fff;
     box-shadow:#333 1px 1px 5px
     box-shadow:#333 1px 1px 5px
 }
 }
+.ver-panel {
+    width:100%;
+    top:10%;
+}
 .header {
 .header {
     border-bottom: 1px solid #ccc
     border-bottom: 1px solid #ccc
 }
 }
@@ -534,6 +541,7 @@ a{
 }
 }
 .box-text-style {
 .box-text-style {
     font-size: 12px;
     font-size: 12px;
+    font-family:"Microsoft YaHei"
 }
 }
 .box-text-style p{
 .box-text-style p{
     margin:0 0 2px 0;
     margin:0 0 2px 0;
@@ -639,4 +647,4 @@ a{
         white-space: nowrap;
         white-space: nowrap;
         max-width:80px;
         max-width:80px;
     }
     }
-}
+}

+ 1 - 1
web/building_saas/main/html/main.html

@@ -1222,7 +1222,7 @@
                     </div>
                     </div>
                 </div>
                 </div>
                 <div class="modal-footer">
                 <div class="modal-footer">
-                    <button class="btn btn-primary" id="scope_position_confirm">确定</button>
+                    <button class="btn btn-primary" id="scope_position_confirm"  data-dismiss="modal">确定</button>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                 </div>
                 </div>
             </div>
             </div>

+ 5 - 1
web/building_saas/main/js/models/main_consts.js

@@ -261,7 +261,11 @@ const fixedFlag = {
     //附加税
     //附加税
     ADDITIONAL_TAX: 28,
     ADDITIONAL_TAX: 28,
     //环境保护税
     //环境保护税
-    ENVIRONMENTAL_PROTECTION_TAX: 29
+    ENVIRONMENTAL_PROTECTION_TAX: 29,
+    //建设工程竣工档案编制费
+    PROJECT_COMPLETE_ARCH_FEE:30,
+    //住宅工程质量分户验收费
+    HOUSE_QUALITY_ACCEPT_FEE:31
 };
 };
 const gljKeyArray =['code','name','specs','unit','type'];
 const gljKeyArray =['code','name','specs','unit','type'];
 const rationKeyArray =['code','name','specs','unit','subType'];
 const rationKeyArray =['code','name','specs','unit','subType'];

+ 1 - 0
web/building_saas/main/js/models/ration_glj.js

@@ -841,6 +841,7 @@ let ration_glj = {
                 doc.from = "std";
                 doc.from = "std";
             }
             }
             for(let d of this.datas){//查询出所有需替换的工料机
             for(let d of this.datas){//查询出所有需替换的工料机
+                if(!gljOprObj.scopeSelectedIDMap[d.billsItemID]) continue; //如果不在选中范围的,跳过
                 let tem_index = gljOprObj.getIndex(d, gljKeyArray);
                 let tem_index = gljOprObj.getIndex(d, gljKeyArray);
                 if(tem_index == oldIndex){
                 if(tem_index == oldIndex){
                     let tem_doc = _.cloneDeep(doc);
                     let tem_doc = _.cloneDeep(doc);

+ 147 - 1
web/building_saas/main/js/views/glj_col.js

@@ -78,6 +78,144 @@ let gljCol = {
             lockColumns: [0,1,2,3,4,5,6,7]
             lockColumns: [0,1,2,3,4,5,6,7]
         }
         }
     },
     },
+    scopeSetting:{
+        "emptyRows":0,
+        "headRows":1,
+        "headRowHeight":[30],
+        "defaultRowHeight": 21,
+        "treeCol": 1,
+        "cols":[
+            {
+                "width":40,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["选择"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"selected",
+                    "vAlign":1,
+                    "hAlign":1,
+                    "font":"Arial",
+                    "cellType":function (node) {
+                        return new GC.Spread.Sheets.CellTypes.CheckBox();
+                    }
+                }
+            },
+            {
+                "width":140,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["编号"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"code",
+                    "vAlign":1,
+                    "hAlign":0,
+                    "font":"Arial"
+                }
+            },
+            {
+                "width":240,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["名称"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"name",
+                    "vAlign":0,
+                    "hAlign":0,
+                    "font":"Arial"
+                }
+            },
+            {
+                "width":70,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["单位"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"unit",
+                    "vAlign":1,
+                    "hAlign":1,
+                    "font":"Arial"
+                }
+            },
+            {
+                "width":80,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["工程量"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"quantity",
+                    "vAlign":1,
+                    "hAlign":2,
+                    "font":"Arial"
+                }
+            },
+            {
+                "width":80,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["单价"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"unitPrice",
+                    "vAlign":1,
+                    "hAlign":2,
+                    "font":"Arial"
+                }
+            },
+            {
+                "width":80,
+                "readOnly": true,
+                "head":{
+                    "titleNames":["金额"],
+                    "spanCols":[1],
+                    "spanRows":[1],
+                    "vAlign":[1],
+                    "hAlign":[1],
+                    "font":["Arial"]
+                },
+                "data":{
+                    "field":"totalPrice",
+                    "vAlign":1,
+                    "hAlign":2,
+                    "font":"Arial"
+                }
+            }
+        ]
+    },
     removeCol:function (dataCode,setting) {
     removeCol:function (dataCode,setting) {
         let colIndex = _.findIndex(setting.header,{'dataCode':dataCode});
         let colIndex = _.findIndex(setting.header,{'dataCode':dataCode});
         if(colIndex != -1){
         if(colIndex != -1){
@@ -102,8 +240,16 @@ let gljCol = {
         gljOprObj.setting = me.ration_glj_setting;
         gljOprObj.setting = me.ration_glj_setting;
         projectGljObject.projectGljSetting = me.project_glj_setting;
         projectGljObject.projectGljSetting = me.project_glj_setting;
         projectGljObject.mixRatioSetting = me.mixRatio_Setting;
         projectGljObject.mixRatioSetting = me.mixRatio_Setting;
+        me.setScopeFormater();
+        gljOprObj.scopeSetting = me.scopeSetting;
+    },
+    setScopeFormater:function () {
+        // 综合单价、综合合价,小数部分应补0对齐。  CSL
+        for(let col of this.scopeSetting.cols){
+            if (col.data.field=="totalPrice") col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.totalPrice, true);
+            if (col.data.field== "unitPrice")  col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.unitPrice, true);
+        }
     }
     }
-
 };
 };
 /*
 /*
 $(function () {
 $(function () {

+ 84 - 6
web/building_saas/main/js/views/glj_view.js

@@ -102,6 +102,11 @@ var gljOprObj = {
         }
         }
     },
     },
     gljLibSheet: null,
     gljLibSheet: null,
+    scopeSetting:{},
+    scopeSpread:null,
+    scopeSheet:null,
+    scopeDatas:[],
+    scopeSelectedIDMap:{},
     initSheet: function (sheet) {
     initSheet: function (sheet) {
         var me = this;
         var me = this;
         me.sheet = sheet;
         me.sheet = sheet;
@@ -1096,7 +1101,6 @@ var gljOprObj = {
         if (me.GLJSelection.length <= 0) {
         if (me.GLJSelection.length <= 0) {
             return;
             return;
         }
         }
-        $("#glj_tree_div").modal('hide');
         $.bootstrapLoading.start();
         $.bootstrapLoading.start();
         project.ration_glj.insertGLJAsRation(me.GLJSelection, selected, function (parentNodeID,nextNodeID,data) {
         project.ration_glj.insertGLJAsRation(me.GLJSelection, selected, function (parentNodeID,nextNodeID,data) {
             let newNode=null;
             let newNode=null;
@@ -1139,7 +1143,6 @@ var gljOprObj = {
             return rg ? false : true;
             return rg ? false : true;
         })
         })
         if (gljOprObj.GLJSelection.length > 0 && selected && selected.sourceType == ModuleNames.ration) {
         if (gljOprObj.GLJSelection.length > 0 && selected && selected.sourceType == ModuleNames.ration) {
-            $("#glj_tree_div").modal('hide');
             project.ration_glj.addGLJByLib(gljOprObj.GLJSelection, selected.data, function (result) {
             project.ration_glj.addGLJByLib(gljOprObj.GLJSelection, selected.data, function (result) {
                 if (result) {
                 if (result) {
                     selected.data.adjustState = result.adjustState;
                     selected.data.adjustState = result.adjustState;
@@ -1155,8 +1158,6 @@ var gljOprObj = {
                     });
                     });
                 }
                 }
             });//doc.rationID=selected.data.ID;
             });//doc.rationID=selected.data.ID;
-        } else {
-            $("#glj_tree_div").modal('hide');
         }
         }
     },
     },
     doReplaceGLJ: function () {
     doReplaceGLJ: function () {
@@ -1165,7 +1166,6 @@ var gljOprObj = {
         let project = projectObj.project;
         let project = projectObj.project;
         let selectCode = gljOprObj.GLJSelection[0];
         let selectCode = gljOprObj.GLJSelection[0];
         let selected = projectObj.project.mainTree.selected;
         let selected = projectObj.project.mainTree.selected;
-        $("#glj_tree_div").modal('hide');
         project.ration_glj.replaceGLJ(selectCode, oldData, function (result) {
         project.ration_glj.replaceGLJ(selectCode, oldData, function (result) {
             if (result) {
             if (result) {
                 //result.adjustState;
                 //result.adjustState;
@@ -1204,7 +1204,6 @@ var gljOprObj = {
         let oldData = me.sheetData[gljContextMenu.selectedRow];
         let oldData = me.sheetData[gljContextMenu.selectedRow];
         let project = projectObj.project;
         let project = projectObj.project;
         let selectCode = me.GLJSelection[0];
         let selectCode = me.GLJSelection[0];
-        $("#glj_tree_div").modal('hide');
         project.ration_glj.mReplaceGLJ(selectCode, oldData, function (result,updateMap) {
         project.ration_glj.mReplaceGLJ(selectCode, oldData, function (result,updateMap) {
             if(result == null){
             if(result == null){
                 return;
                 return;
@@ -1424,6 +1423,70 @@ var gljOprObj = {
                 me.gljTreeSetting.callback.onClick(null, 'gljTree', me.rootNode);
                 me.gljTreeSetting.callback.onClick(null, 'gljTree', me.rootNode);
             }
             }
         }
         }
+    },
+    initScopeSpread:function() {
+        if (this.scopeSpread) return this.scopeSpread.repaint();
+        this.scopeSpread = SheetDataHelper.createNewSpread($('#scopeSpread')[0]);
+        sheetCommonObj.spreadDefaultStyle(this.scopeSpread);
+        this.scopeTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
+        this.scopeTreeController = TREE_SHEET_CONTROLLER.createNew(this.scopeTree, this.scopeSpread.getActiveSheet(), this.scopeSetting);
+        this.scopeSheet = this.scopeSpread.getActiveSheet();
+        this.scopeSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, this.onScopeChecked);
+    },
+    showScopeDatas:function () {
+        this.initScopeSpread();
+        this.scopeDatas =this.getScopeDatas();
+        this.scopeTree.loadDatas(this.scopeDatas);
+        this.scopeTreeController.showTreeData();
+    },
+    getScopeDatas:function () {
+        let controller = projectObj.mainController, project = projectObj.project;
+        let allNodes = [],datas = []
+        for(let rootNode of controller.tree.roots){
+            allNodes.push(rootNode);
+            controller.tree.getAllSubNode(rootNode.source,allNodes);
+        }
+        for(let n of allNodes){
+            let temData = {
+                ID:n.data.ID,
+                NextSiblingID:n.data.NextSiblingID,
+                ParentID:n.data.ParentID,
+                unit : n.data.unit,
+                code : n.data.code,
+                selected:0,
+                name : n.data.name,
+                quantity:calcTools.uiNodeQty(n)?calcTools.uiNodeQty(n):"",
+            };
+            if(n.data.feesIndex && n.data.feesIndex.common){
+                temData.unitPrice = n.data.feesIndex.common.unitFee;
+                temData.totalPrice = n.data.feesIndex.common.totalFee;
+            }
+            datas.push(temData);
+        }
+        return datas;
+    },
+    onScopeChecked:function (e,args) {
+        let me = gljOprObj,nodes = [];
+        var checkboxValue = args.sheet.getCell(args.row, args.col).value();
+        var newval = checkboxValue?0:1;
+        let node = me.scopeTree.items[args.row];
+        setNodeAndChildreSelected(node,newval,nodes);
+        me.scopeTreeController.refreshTreeNode(nodes);
+
+        function setNodeAndChildreSelected(n,val,arr){
+            n.data.selected = val;
+            nodes.push(n);
+            for(let c of n.children){
+                setNodeAndChildreSelected(c,val,arr)
+            }
+
+        }
+    },
+    setScopeSelection:function () {
+        for(let node of this.scopeTree.items){
+            //挑出选中数,过滤父节点
+            if(node.data.selected == 1 && node.children.length == 0) this.scopeSelectedIDMap[node.data.ID] = true
+        }
     }
     }
 }
 }
 
 
@@ -1484,6 +1547,12 @@ $(function () {
         } else gljOprObj.showLibGLJSheetData();
         } else gljOprObj.showLibGLJSheetData();
     });
     });
 
 
+    $('#mreplace_next_div').on('shown.bs.modal', function (e) {
+        gljOprObj.scopeSelectedIDMap = {};
+        gljOprObj.showScopeDatas();
+    });
+
+
     $('#glj_tree_div').on('hidden.bs.modal', function () {
     $('#glj_tree_div').on('hidden.bs.modal', function () {
         $('#gljSearchKeyword').val('');
         $('#gljSearchKeyword').val('');
     });
     });
@@ -1539,7 +1608,16 @@ $(function () {
         }else if($('#actionType').val() == 'addMix'){
         }else if($('#actionType').val() == 'addMix'){
             projectGljObject.addMixRatio();
             projectGljObject.addMixRatio();
         }
         }
+        $("#glj_tree_div").modal('hide');
     })
     })
+    $('#scope_position_confirm').click(function () {
+        gljOprObj.setScopeSelection();
+        gljOprObj.doMReplaceGLJ();
+    });
+    $('#replace_next_btn').click(function () {
+        $("#glj_tree_div").modal('hide');
+        $("#mreplace_next_div").modal('show');
+    });
 
 
     $('#class_selected_conf').click(function () {
     $('#class_selected_conf').click(function () {
         var gljClass = $('#selected_class').val();
         var gljClass = $('#selected_class').val();

+ 7 - 0
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -393,6 +393,13 @@ function getGLJData(actionType) {
         $('#modalCon').width($(window).width()*0.5);
         $('#modalCon').width($(window).width()*0.5);
         $("input[name='glj']").get(0).checked=true;
         $("input[name='glj']").get(0).checked=true;
         $.bootstrapLoading.end();
         $.bootstrapLoading.end();
+        if(actionType == "m_replace"){
+            $('#glj_selected_conf').hide();
+            $('#replace_next_btn').show();
+        }else {
+            $('#glj_selected_conf').show();
+            $('#replace_next_btn').hide();
+        }
         $("#glj_tree_div").modal({show:true});
         $("#glj_tree_div").modal({show:true});
         setTimeout(function(){
         setTimeout(function(){
             gljOprObj.gljLibSpresd?gljOprObj.gljLibSpresd.refresh():'';
             gljOprObj.gljLibSpresd?gljOprObj.gljLibSpresd.refresh():'';

+ 2 - 2
web/over_write/js/chongqing_2018.js

@@ -16,9 +16,9 @@ if(typeof gljUtil !== 'undefined'){
 }
 }
 
 
 //允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、其他材料费、机械台班、机上人工、仪器仪表、燃料动力费、折旧费、
 //允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、其他材料费、机械台班、机上人工、仪器仪表、燃料动力费、折旧费、
-// 检修费、维护费、安拆费及场外运费、校验费、其他费用、主材、企业管理费、利润、一般风险费
+// 检修费、维护费、安拆费及场外运费、校验费、其他费用、主材、设备、企业管理费、利润、一般风险费  前端工料机库编辑器下拉列表没有用到这个
 if(typeof allowGljType !== 'undefined'){
 if(typeof allowGljType !== 'undefined'){
-    allowGljType = [1, 201, 202, 203, 204, 205, 206, 207, 301, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 4, 6, 7, 8];
+    allowGljType = [1, 201, 202, 203, 204, 205, 206, 207, 301, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 4,5,6, 7, 8];
 }
 }
 if(typeof allowComponent !== 'undefined'){
 if(typeof allowComponent !== 'undefined'){
     //允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、仪器仪表、主材
     //允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、仪器仪表、主材

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 53 - 0
web/users/html/login-ver.html


+ 29 - 29
web/users/html/login.html

@@ -110,35 +110,35 @@
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
-    <!--弹出手机验证码-->
-    <div class="modal fade" id="phonepass" data-backdrop="static">
-        <div class="modal-dialog" role="document">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h5 class="modal-title">验证码安全登录</h5>
-                </div>
-                <div class="modal-body">
-                    <p class="">请您提供手机验证码进行安全登录。</p>
-                    <p class="">请点击“获取验证码”,验证码将发送至手机<span id="pro_mobile"></span>,注意查收。</p>
-                    <div class="form-row">
-                        <div class="form-group col-md-8">
-                            <input type="text" class="form-control" id="smsCode" placeholder="输入验证码">
-                            <div class="invalid-feedback">
-                            </div>
-                            <input type="hidden" class="form-control" id="proMobile">
-                        </div>
-                        <div class="form-group col-md-4">
-                            <button class="btn btn-primary" id="get-code2">获取验证码</button>
-                        </div>
-                    </div>
-                </div>
-                <div class="modal-footer">
-                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <button class="btn btn-primary" id="loginPro">登录</button>
-                </div>
-            </div>
-        </div>
-    </div>
+    <!--&lt;!&ndash;弹出手机验证码&ndash;&gt;-->
+    <!--<div class="modal fade" id="phonepass" data-backdrop="static">-->
+        <!--<div class="modal-dialog" role="document">-->
+            <!--<div class="modal-content">-->
+                <!--<div class="modal-header">-->
+                    <!--<h5 class="modal-title">验证码安全登录</h5>-->
+                <!--</div>-->
+                <!--<div class="modal-body">-->
+                    <!--<p class="">请您提供手机验证码进行安全登录。</p>-->
+                    <!--<p class="">请点击“获取验证码”,验证码将发送至手机<span id="pro_mobile"></span>,注意查收。</p>-->
+                    <!--<div class="form-row">-->
+                        <!--<div class="form-group col-md-8">-->
+                            <!--<input type="text" class="form-control" id="smsCode" placeholder="输入验证码">-->
+                            <!--<div class="invalid-feedback">-->
+                            <!--</div>-->
+                            <!--<input type="hidden" class="form-control" id="proMobile">-->
+                        <!--</div>-->
+                        <!--<div class="form-group col-md-4">-->
+                            <!--<button class="btn btn-primary" id="get-code2">获取验证码</button>-->
+                        <!--</div>-->
+                    <!--</div>-->
+                <!--</div>-->
+                <!--<div class="modal-footer">-->
+                    <!--<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>-->
+                    <!--<button class="btn btn-primary" id="loginPro">登录</button>-->
+                <!--</div>-->
+            <!--</div>-->
+        <!--</div>-->
+    <!--</div>-->
     <!-- JS. -->
     <!-- JS. -->
     <!-- inject:js -->
     <!-- inject:js -->
     <script type="text/javascript" src="/public/web/scMathUtil.js"></script>
     <script type="text/javascript" src="/public/web/scMathUtil.js"></script>

+ 66 - 66
web/users/js/login.js

@@ -51,47 +51,47 @@ $(document).ready(function () {
                 return false;
                 return false;
             }
             }
             let account = $("#inputEmail").val();
             let account = $("#inputEmail").val();
-            let pw = $("#inputPassword").val();
+            // let pw = $("#inputPassword").val();
 
 
             // 判断输入的邮箱/手机是否格式正确
             // 判断输入的邮箱/手机是否格式正确
             if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
             if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
-                // 先判断是否是专业版用户,是的话弹出短信验证
-                $.ajax({
-                    url: '/accountIsPro',
-                    type: 'post',
-                    async: true,
-                    data: {"account": account, "pw": pw},
-                    success: function (response) {
-                        if (response.error === 0) {
-                            const ispro = response.result;
-                            if (!ispro) {
+                // // 先判断是否是专业版用户,是的话弹出短信验证
+                // $.ajax({
+                //     url: '/accountIsPro',
+                //     type: 'post',
+                //     async: true,
+                //     data: {"account": account, "pw": pw},
+                //     success: function (response) {
+                //         if (response.error === 0) {
+                //             const ispro = response.result;
+                //             if (!ispro) {
                                 login(captchaObj);
                                 login(captchaObj);
-                            } else {
-                                $('#phonepass').modal('show');
-                                $('#proMobile').val(response.data);
-                                $('#pro_mobile').text(response.data.substr(0, 3) + '****' + response.data.substr(7, 11));
-                            }
-                        } else if(response.error === 2) {
-                            $('#check_ssoId').val(response.ssoId);
-                            $('#phone').modal('show');
-                        } else {
-                            let msg = response.msg !== undefined ? response.msg : '未知错误';
-                            showError(msg, $("input"));
-                        }
-                    }
-                });
+                //             } else {
+                //                 $('#phonepass').modal('show');
+                //                 $('#proMobile').val(response.data);
+                //                 $('#pro_mobile').text(response.data.substr(0, 3) + '****' + response.data.substr(7, 11));
+                //             }
+                //         } else if(response.error === 2) {
+                //             $('#check_ssoId').val(response.ssoId);
+                //             $('#phone').modal('show');
+                //         } else {
+                //             let msg = response.msg !== undefined ? response.msg : '未知错误';
+                //             showError(msg, $("input"));
+                //         }
+                //     }
+                // });
             } else {
             } else {
                 $('#emailHelp').text('您输入的 邮箱/手机 格式不对');
                 $('#emailHelp').text('您输入的 邮箱/手机 格式不对');
             }
             }
         });
         });
 
 
-        $('#loginPro').click(function () {
-            if ($('#smsCode').val() === '') {
-                showValidError('请输入验证码',$('#smsCode'));
-            } else {
-                login(captchaObj);
-            }
-        });
+        // $('#loginPro').click(function () {
+        //     if ($('#smsCode').val() === '') {
+        //         showValidError('请输入验证码',$('#smsCode'));
+        //     } else {
+        //         login(captchaObj);
+        //     }
+        // });
 
 
         $('#check-code').click(function () {
         $('#check-code').click(function () {
             const mobile = $("#mobile").val();
             const mobile = $("#mobile").val();
@@ -172,32 +172,32 @@ $(document).ready(function () {
         }
         }
     });
     });
 
 
-    $("#get-code2").click(function() {
-        const mobile = $("#proMobile").val();
-        if(!validMobile(mobile)){
-            return false;
-        }
-        const btn = $(this);
-        if(!btn.hasClass('disabled')){
-            $.ajax({
-                url: '/sms/code',
-                type: 'post',
-                data: { mobile: mobile, type: 3},
-                error: function() {
-                    showValidError('短信接口出错!',$('#smsCode'));
-                },
-                beforeSend: function() {
-                },
-                success: function(response) {
-                    if (response.err === 0) {
-                        codeSuccess(btn);
-                    } else {
-                        showValidError(response.msg,$('#smsCode'));
-                    }
-                }
-            });
-        }
-    });
+    // $("#get-code2").click(function() {
+    //     const mobile = $("#proMobile").val();
+    //     if(!validMobile(mobile)){
+    //         return false;
+    //     }
+    //     const btn = $(this);
+    //     if(!btn.hasClass('disabled')){
+    //         $.ajax({
+    //             url: '/sms/code',
+    //             type: 'post',
+    //             data: { mobile: mobile, type: 3},
+    //             error: function() {
+    //                 showValidError('短信接口出错!',$('#smsCode'));
+    //             },
+    //             beforeSend: function() {
+    //             },
+    //             success: function(response) {
+    //                 if (response.err === 0) {
+    //                     codeSuccess(btn);
+    //                 } else {
+    //                     showValidError(response.msg,$('#smsCode'));
+    //                 }
+    //             }
+    //         });
+    //     }
+    // });
 });
 });
 
 
 function login(captchaObj) {
 function login(captchaObj) {
@@ -206,7 +206,7 @@ function login(captchaObj) {
     let geetest_challenge = $('input[name="geetest_challenge"]').val();
     let geetest_challenge = $('input[name="geetest_challenge"]').val();
     let geetest_validate = $('input[name="geetest_validate"]').val();
     let geetest_validate = $('input[name="geetest_validate"]').val();
     let geetest_seccode = $('input[name="geetest_seccode"]').val();
     let geetest_seccode = $('input[name="geetest_seccode"]').val();
-    let code = $("#smsCode").val();
+    // let code = $("#smsCode").val();
 
 
     $.ajax({
     $.ajax({
         url: '/login',
         url: '/login',
@@ -217,11 +217,11 @@ function login(captchaObj) {
             "geetest_challenge": geetest_challenge,
             "geetest_challenge": geetest_challenge,
             "geetest_validate": geetest_validate,
             "geetest_validate": geetest_validate,
             "geetest_seccode": geetest_seccode,
             "geetest_seccode": geetest_seccode,
-            "code": code,
+            // "code": code,
         },
         },
         success: function (response) {
         success: function (response) {
             if (response.error === 0) {
             if (response.error === 0) {
-                $('#phonepass').modal('hide');
+                // $('#phonepass').modal('hide');
                 const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
                 const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
                     response.last_page : '/pm';
                     response.last_page : '/pm';
                 if (response.login_ask === 0) {
                 if (response.login_ask === 0) {
@@ -238,14 +238,14 @@ function login(captchaObj) {
                     $('#ver').modal('show');
                     $('#ver').modal('show');
                 }
                 }
             } else if(response.error === 2) {
             } else if(response.error === 2) {
-                $('#phonepass').modal('hide');
+                // $('#phonepass').modal('hide');
                 captchaObj.reset();
                 captchaObj.reset();
                 $('#check_ssoId').val(response.ssoId);
                 $('#check_ssoId').val(response.ssoId);
                 $('#phone').modal('show');
                 $('#phone').modal('show');
-            } else if(response.error === 3) {
-                showValidError(response.msg,$('#smsCode'));
+            // } else if(response.error === 3) {
+                // showValidError(response.msg,$('#smsCode'));
             } else {
             } else {
-                $('#phonepass').modal('hide');
+                // $('#phonepass').modal('hide');
                 let msg = response.msg !== undefined ? response.msg : '未知错误';
                 let msg = response.msg !== undefined ? response.msg : '未知错误';
                 showError(msg, $("input"));
                 showError(msg, $("input"));
                 captchaObj.reset();
                 captchaObj.reset();
@@ -292,7 +292,7 @@ function validMobile(mobile) {
         showValidError('手机号不能为空!',$('#mobile'));
         showValidError('手机号不能为空!',$('#mobile'));
         return false;
         return false;
     }
     }
-    let mobileValid =  /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(14[0-9]{1}))+\d{8})$/;
+    let mobileValid = /^1[3456789]\d{9}$/;
     if(!mobileValid.test(mobile)){
     if(!mobileValid.test(mobile)){
         showValidError('手机号码格式有误!',$('#mobile'));
         showValidError('手机号码格式有误!',$('#mobile'));
         return false;
         return false;

+ 186 - 0
web/users/js/login_startup.js

@@ -0,0 +1,186 @@
+/**
+ * 登录相关js
+ *
+ * @author CaiAoLin
+ * @date 2017/6/8
+ * @version
+ */
+$(document).ready(function () {
+    $("input").blur(function () {
+        cleanError();
+        cleanValidError($(this));
+    });
+
+    $("#get-code").click(function() {
+        const mobile = $("#proMobile").val();
+        const btn = $(this);
+        if(!btn.hasClass('disabled')){
+            $.ajax({
+                url: '/sms/code',
+                type: 'post',
+                data: { mobile: mobile, type: 3},
+                error: function() {
+                    showValidError('短信接口出错!',$('#smsCode'));
+                },
+                beforeSend: function() {
+                },
+                success: function(response) {
+                    if (response.err === 0) {
+                        codeSuccess(btn);
+                    } else {
+                        showValidError(response.msg,$('#smsCode'));
+                    }
+                }
+            });
+        }
+    });
+});
+
+function login() {
+    let ssoID = $("#ssoID").val();
+    let token = $("#token").val();
+    let code = $("#smsCode").val();
+
+    $.ajax({
+        url: '/login',
+        type: 'post',
+        data: {
+            "ssoID": ssoID,
+            "token": token,
+            "code": code,
+        },
+        success: function (response) {
+            if (response.error === 0) {
+                $('#phonepass').modal('hide');
+                const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
+                    response.last_page : '/pm';
+                if (response.login_ask === 0) {
+                    location.href = url;
+                } else {
+                    response.compilation_list = response.compilation_list === undefined || response.compilation_list === '' ?
+                        null : JSON.parse(response.compilation_list);
+                    if (response.compilation_list === null || response.compilation_list.length <= 0) {
+                        location.href = url;
+                        return false;
+                    }
+                    console.log(response.compilation_list);
+                    setVersion(response.compilation_list);
+                    $('#ver').modal('show');
+                }
+            } else if(response.error === 2) {
+                $('#phonepass').modal('hide');
+                captchaObj.reset();
+                $('#check_ssoId').val(response.ssoId);
+                $('#phone').modal('show');
+            } else if(response.error === 3) {
+                showValidError(response.msg,$('#smsCode'));
+            } else {
+                $('#phonepass').modal('hide');
+                let msg = response.msg !== undefined ? response.msg : '未知错误';
+                showError(msg, $("input"));
+                captchaObj.reset();
+            }
+        },
+        error: function (result) {
+            showError('内部程序错误', null);
+        }
+    });
+}
+
+/**
+ * 获取成功后的操作
+ *
+ * @param {Object} btn - 点击的按钮
+ * @return {void}
+ */
+function codeSuccess(btn) {
+    let counter = 60;
+    btn.removeClass('btn-primary').addClass('btn-outline-secondary disabled').text(counter + '秒 重新获取');
+    btn.parents().siblings('div').children('input').removeAttr('readonly');
+
+    const countDown = setInterval(function() {
+        const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + '秒 ';
+        // 倒数结束后
+        if (countString === '') {
+            clearInterval(countDown);
+            btn.removeClass('btn-outline-secondary disabled').addClass('btn-primary').text('获取验证码');
+        }
+        const text = countString + '重新获取';
+        btn.text(text);
+        counter -= 1;
+    }, 1000);
+}
+
+/**
+ * 提示验证信息错误
+ *
+ * @param {string} msg
+ * @param {object} element
+ * @return {void}
+ */
+function showValidError(msg, element) {
+    if (element !== null) {
+        element.addClass('is-invalid');
+        element.siblings().text(msg);
+    }
+}
+
+/**
+ * 清除验证信息错误提示
+ *
+ * @return {void}
+ */
+function cleanValidError(element) {
+    element.removeClass('is-invalid');
+    element.siblings().text('');
+}
+
+/**
+ * 提示错误
+ *
+ * @param {string} msg
+ * @param {object} element
+ * @return {void}
+ */
+function showError(msg, element) {
+    if (element !== null) {
+        element.parent().addClass('has-danger');
+    }
+    $("#message").html(msg);
+    $("#error-tips").show("fast");
+}
+
+/**
+ * 清除错误提示
+ *
+ * @return {void}
+ */
+function cleanError() {
+    $("input").parent().removeClass('has-danger');
+    $("#message").text('');
+    $("#error-tips").hide("fast");
+}
+
+/**
+ * 设置版本信息
+ *
+ * @param {Object} versionData
+ * @return {void}
+ */
+function setVersion(versionData) {
+    let html = '';
+    for (let version of versionData) {
+        let description = version.description ? version.description : '介绍内容';
+        let tmpHtml = '<div class="col-sm-6">' +
+            '<div class="card card-block">' +
+            '<div class="card-body">' +
+            '<h3 class="card-title">'+ version.name +'</h3>' +
+            '<p class="card-text">' + description + '</p>' +
+            '<a class="btn btn-primary" href="/boot/'+ version._id.toString() +'">开始使用</a>' +
+            '</div>' +
+            '</div>' +
+            '</div>';
+        html += tmpHtml;
+    }
+    $("#version-area").html(html);
+}