(1)前台技术:ajax+Jquery+jqgrid+Bootstrap

(2)开发环境:VS2012-VS2015

(3)数据库:SQL Server,Oracle、Mysql

(5)后台技术:ASP.NET MVC,TinyIoc(IoC容器),EF(ORM框架),Log4Net,NPOI等

7、字典

$('#F_ContractType').lrDataItemSelect({ code: 'htpslx' });

8、js设置属性:

                $("#F_DeviceNumber").attr("readOnly",true);

                $("#F_FaultTime").attr("disabled",true);

9、获取当前用户

            //获取当前用户

            var user = learun.clientdata.get(['userinfo']).realName

            document.getElementById("F_Applyer").value = user

10、获取当前时间

            //获取当前时间

            var nowDate = new Date();

            var year = nowDate.getFullYear();

            var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;

            var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();

            var hour = nowDate.getHours() < 10 ? "0" + nowDate.getHours() : nowDate.getHours();

            var minute = nowDate.getMinutes() < 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes();

            var second = nowDate.getSeconds() < 10 ? "0" + nowDate.getSeconds() : nowDate.getSeconds();

            var now = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;

            document.getElementById("F_ApplyTime").value = now;

11、获取当前用户ID

        var userID = learun.clientdata.get(['userinfo']).userId

        formData.F_ApplyerId = userID;

12、数据表显示下拉框(数据源)

$('#F_DeviceNumber').lrDataSourceSelect({ code: 'DeviceNumber', value: 'f_equipmentnumber', text: 'f_equipmentnumber' });

13、跳出提示框

learun.alert.warning("请填写搜索内容!");

14、设置表单数据为只读

            $('#F_Work')[0].ke.readonly(true);

            $('#F_Project')[0].ke.readonly(true);

15、判断gridcontrol是否为空

        var a = $('#BMS_Base_F_Work').jfGridGet("rowdatas");

        console.log(a)

        if (a == '' || a == null) {

            learun.alert.error("日常工作概要不能为空!");

            return false;

        }

循环判断:

        for (var t = 0; t < a.length; t++) {

            if (a[t].hasOwnProperty('F_col1')) {

            } else {

                learun.alert.warning("日常工作概要第" + (t + 1) + "行的工作时间(小时)不能为空!");

                return false;

            }

            if (a[t].hasOwnProperty('F_col2')) {

            } else {

                learun.alert.warning("日常工作概要第" + (t + 1) + "行的做的工作不能为空!");

                return false;

            }

            if (a[t].hasOwnProperty('F_col3')) {

            } else {

                learun.alert.warning("日常工作概要第" + (t + 1) + "行的数量不能为空!");

                return false;

            }

        }

16、附件名称同步

                //附件名称更新同步

                $('#F_DetailedList .lrUploader-input').on('DOMNodeInserted', function () {

                    var param = {};

                    param.keyValue = selectedRow.F_Id;

                    param.fileName = $("#F_DetailedList .lrUploader-input").text();

                    $.lrSetForm(top.$.rootUrl + "/LR_CodeDemo/EnquiryRequirements/SaveFileName?queryJson=" + JSON.stringify(param), function (data) {

                    });

                })

17、设置单元格显示格式

formatter: function (cellvalue) {

                            if (cellvalue == "已通过") {

                                return '<span class=\"label label-danger\">待报价</span>';

                            } else if (cellvalue == "已报价") {

                                return '<span class=\"label label-success\">已报价</span>';

                            } else if (cellvalue == "磋商中") {

                                return '<span class=\"label label-success\">磋商中</span>';

                            } else if (cellvalue == "关闭") {

                                return '<span class=\"label label-default\">关闭</span>';

                            } else if (cellvalue == "完成") {

                                return '<span class=\"label label-success\">完成</span>';

                            }

                        }},

18、拿到下拉框的值

var a = $('#F_UnitType')[0].innerText;

19、下拉框点击事件:

$('#F_UnitType').lrDataSourceSelect({ code: 'DeviceNumber', value: 'f_equipmentnumber ', text: 'f_equipmentnumber' }).on('change', function () {

            

                var a = $('#F_UnitType')[0].innerText;

                console.log(a);

                判断主语言是否重复

                learun.httpAsyncGet(top.$.rootUrl + '/LR_CodeDemo/MachineBook/GetDeviceNameByType?type=' + a, function (res) {

                    console.log(res["info"]);

                    document.getElementById("F_UnitName").value = res["info"];

                });

            });

20、获取查询到的列表值

data.BMS_Base_Purchase[0].F_WorkNumber

21、拿到文本框的值

$('#F_OrderType').children()[0].outerText;

22、查询数值赋值到单元格

       

        var equipments = $('#BMS_Base_SaleEquipment').jfGridGet('rowdatas');

        for (var j = 0; j < equipments.length; j++) {

            console.log(equipments[j].F_DeviceName);

            console.log(equipments[j].F_SpecificationsModels);

            if (!equipments[j].F_DeviceName) {

                learun.alert.error('设备名称不能为空');

                return false;

            }

            if (!equipments[j].F_SpecificationsModels) {

                learun.alert.error('设备型号不能为空');

                return false;

            }

            if (!!equipments[j].F_DeviceName && !!equipments[j].F_SpecificationsModels) {

                

                var a = learun.httpGet(top.$.rootUrl + '/LR_CodeDemo/SaleParameter/GetERP?name=' + equipments[j].F_DeviceName + '&model=' + equipments[j].F_SpecificationsModels).data.新编号;

                equipments[j].F_Code = a;

            }

        }

        $('#BMS_Base_SaleEquipment').jfGridSet('refreshdata', equipments);

23、获取部门名称

$('#F_UserDepartment')[0].lrvalue = learun.clientdata.get(['userinfo']).departmentId;

            learun.clientdata.getAsync('department', {

                key: learun.clientdata.get(['userinfo']).departmentId,

                callback: function (_data) {

                    $('#F_UserDepartment').val(_data.name);

                }

            });

24、转换

                            var a = eval('(' + data + ')')

25、获取单选按钮的值

        var MaintenanceItem = eval('(' + eval(postData).strbMS_Base_ProjectEntity + ')').F_MaintenanceItem;//获取单选按钮选中的值

$("input[name='F_YN']:checked").val();获取单选选择的是哪个(获取值)

        var user = learun.clientdata.get(['userinfo']).realName;

        console.log(MaintenanceItem);

        if (MaintenanceItem == '是')

        {

            learun.alert.warning("没有选择是否为维修项目");

            return;

        }

        if (MaintenanceItem == "否") {

            if (!$("#F_Contract .lrUploader-input").text()) {

                learun.alert.warning("没有上传合同");

                return;

            }

        }

默认选中第一个:

            $('#F_YN').find('input').eq(0).trigger('click');

            $('input:radio[name="F_ParticipateStatus"][value="参加"]')[0].checked = true;

26、清空文本框的值

document.getElementById("F_WorkNumber").value = "";

27、获取返回值

                   var money = res.data[0]["f_contractmoney"];

            var contracttype = res.data[0]["f_contracttype"];

28、按钮隐藏

           $("#select_Device").attr("style", "display:none;");

29、字典

            $('#F_MarriageStatus').lrDataItemSelect({ code: 'MarriageStatus' });

30、查询语句

var strSql = new StringBuilder();

                strSql.Append("SELECT DISTINCT");

                strSql.Append(@"

                b.F_UserId ,

                b.F_RealName,

                t.F_Description,

                c.F_CompanyName,

                c.F_LastModify,

                c.F_UserCapability,

                c.F_Note,

                c.F_BusinessLicense,

                c.F_Id,

                c.F_VIP");

                strSql.Append(" FROM BMS_Base_EnquiryCustomInfo c ");

                strSql.Append(" LEFT JOIN " + non_standard_cloud.dataBase + ".dbo.[LR_Base_User] b ON c.F_ParentId=b.F_UserId");

                strSql.Append(" LEFT JOIN  (SELECT F_RequirementsSubmitter , Count(F_Id) AS F_Description FROM BMS_Base_EnquiryRequirements GROUP BY F_RequirementsSubmitter )AS t ON b.F_UserId = t.F_RequirementsSubmitter");

                strSql.Append(" WHERE 1=1 ");

                strSql.Append(" AND b.F_DeleteMark = 0");

                return this.BaseRepository("db_xiangmuguanli_test").FindTable(strSql.ToString(), pagination);

.OrderByDescending(t => t.F_CreateDate)

31、标记颜色:                         

formatter: function (cellvalue) {

                                if (cellvalue == "1") {

                                    //return '<span class=\"label label-warning\"></span>';

                                    return '<span class=\"label \" style="background-color: #32CD32;">  √  </span>';

                                }  else {

                                    return '<span>' + cellvalue + '</span>';

                                }

                            }

31、Get

        learun.httpAsyncGet(top.$.rootUrl + '/LR_LGManager/LGType/GetEntityByCode?keyValue=' + postData.F_Code, function (res) {

            //判断编辑是否更改编码

            if (res.data) {

                learun.alert.warning("编码已存在");

                return false;

            }

});

                                        

32、Post:

learun.layerConfirm('是否确认撤销流程?', function (res, _index) {

                                            if (res) {

                                                

                                                learun.loading(true, '撤销流程...');

                                                var postData = {

                                                    processId: row.F_Id,

                                                };

                                                learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/RevokeFlow', postData, function (data) {

                                                    learun.loading(false);

                                                    refreshGirdData();

                                                });

                                                top.layer.close(_index);

                                            }

                                        });

33、post

                                    learun.httpAsync('Post', top.$.rootUrl + '/LR_CodeDemo/YPProjectMan/SaveFormProjectMan', postData, function (data) {

                                        page.initGird();

                                    });

34、截取时间

                        formatter: function (value, row, op, $cell) {

                            if (!!value) {

                                return value.substring(0, 11);

                            }

                        }

35、jfgrid点击跳转

{

                        label: "项目编号", name: "F_project_number", width: 150, align: "left",

                        formatter: function (cellvalue, row, dfop, $cell) {

                            $cell.on('click', '.start', function () {// 点击跳出界面

                                var keyValue = row.F_Id;

                                if (learun.checkrow(keyValue)) {

                                    learun.layerForm({

                                        id: 'form1',

                                        title: '查看',

                                        url: top.$.rootUrl + '/LR_CodeDemo/PurchaseInterface/Form?keyValue=' + keyValue,

                                        width: 1000,

                                        height: 800,

                                        btn: ['关闭']

                                    });

                                };

                                return false;

                            });

                            return '<span style = "color:blue;" class="label label-link start" ><ins>' + cellvalue + '</ins></span>';

                        }

                    },

36、升序排列

.OrderBy(t => t.F_ProjectNumber).AsList()

37、新界面

                if (learun.checkrow(keyValue)) {

                    var keyValue = $('#gridtable').jfGridValue('F_Id');

                    var name = $('#gridtable').jfGridValue('F_ProjectName');

                    top.learun.frameTab.open({ F_ModuleId: "edit" + keyValue, F_FullName: "编辑" + name, F_UrlAddress: top.$.rootUrl + '/LR_CodeDemo/ProjectG/FormEdit?keyValue=' + keyValue });

                }

38、排版

                    <div class="lr-layout-tool-item">

                        <span>项目编号</span>

                        <input id="F_project_number" type="text" class="form-control" style="height:28px;width:150px" />

                    </div>

                    <div class="lr-layout-tool-item">

                        <span>项目名称</span>

                        <input id="F_project_name" type="text" class="form-control" style="height:28px;width:150px" />

                    </div>

                    <div class="lr-layout-tool-item">

                        <span>采购组织</span>

                        <input id="F_purchse_organization" type="text" class="form-control" style="height:28px;width:150px" />

                    </div>

                    <div class="lr-layout-tool-item">

                        <button type="button" class=" btn btn-primary search" style="float:right">查询</button>

                    </div>

39、自定义按钮

            $('.search').on('click', function () {

                if (!$('body').lrValidform()) {

                    return false;

                }

                var groupData = $('#BMS_Base_ProjectGroup').jfGridGet('rowdatas');

                var manager = 0;

                for (var i in groupData) {

                    var F_ProjectRole = groupData[i].F_ProjectRole;

                    var F_Personnel = groupData[i].F_Personnel;

                    if (!F_ProjectRole || !F_Personnel) {

                        learun.alert.warning('团队成员表项目角色、人员不能为空!');

                        return false;

                    }

                    if (F_ProjectRole == '管理员') {

                        manager++;

                    }

                }

                if (manager != 1) {

                    learun.alert.warning('团队有且只能有一个管理员!');

                    return;

                }

                var postData = {};

                postData.strEntity = JSON.stringify($('body').lrGetFormData());

                postData.strbMS_Base_ProjectGroupList = JSON.stringify(groupData);

                postData.strbMS_Base_ProjectMissonList = JSON.stringify([]);

                //postData.strbMS_Base_SaleEquipmentList = JSON.stringify($('#BMS_Base_SaleEquipment').jfGridGet('rowdatas'));

                postData.strbMS_Base_SaleEquipmentList = JSON.stringify([]);

                $.lrSaveForm(top.$.rootUrl + '/LR_CodeDemo/ProjectG/SaveForm?keyValue=' + keyValue, postData, function (res) {

                    //learun.frameTab.close("edit" + keyValue);

                });

            });

40、传json

                                for (var index in data) {

                                    var rowData = {};

                                    rowData.F_DeviceName = data[index].F_DeviceName;

                                    rowData.F_DeviceDiretion = data[index].F_DeviceDirection;

                                    rowData.F_DeviceSingleNumber = data[index].F_DeviceQuality;

                                    rowData.F_ProjectNumber = projectnumber;

                                    rowData.F_ProjectName = projectname;

                                    rowData.F_ProjectQuantity = projectquantity;

                                    var postData = {

                                        strEntity: JSON.stringify(rowData)

                                    };

                                    console.log(postData);

                                    //$.lrSaveForm(top.$.rootUrl + '/LR_CodeDemo/YPAllProject/SaveFormDeviceWithModel?keyValue=' + keyValue, postData, function () {

                                    //    page.initData();

                                    //});

                                    learun.httpAsync('Post', top.$.rootUrl + '/LR_CodeDemo/YPAllProject/SaveFormDeviceWithModel?keyValue=' + keyValue, postData, function (data) {

                                        page.initData();

                                    });

                                    

                                }