datagrid加载数据,列内容显示,改变字体颜色

//1.加载数据  列内容显示蓝色字体
#region 加载数据  列内容显示蓝色字体
//代码出自:三项工作--项目管理系统--项目管理--项目变更--采购方式变更申请
//页面路径:Operation/PurchaseModeAdjustList.aspx
     
 function loadData() {
            $('#dg').datagrid({
                url: '',
                fit: true, // 自动填充
                singleSelect: true, // 单选
                pagination: true, // 分页信息
                rownumbers: true, // 显示行号
                idField: 'AdjustId',
                columns: [[
                    //{ field: 'PetitionNo', title: '项目编号', width: 120, halign: 'center' },
                    { field: 'PetitionName', title: '项目名称', width: 240, halign: 'center' },
                    { field: 'Nd', title: '年度', width: 80, halign: 'center', align: 'center' },
                    { field: 'ProjectTypeName', title: '项目类型', width: 100, halign: 'center' },
                    { field: 'DeptName', title: '实施部门', width: 180, halign: 'center' },
                    { field: 'BuyManner', title: '采购方式', width: 100, halign: 'center' },
                    { field: 'SignManner', title: '采购形式', width: 100, halign: 'center' },
                    { field: 'BidingWay', title: '实施形式', width: 100, halign: 'center' },
                    {
                        field: 'AuditState', title: '审批状态', width: 100, halign: 'center', align: 'center', formatter: function (value, row, index) {
                            //switch (row.AuditState) {
                            //    case 0:
                            //        return "未变更";
                            //        break;
                            //    case 1:
                            //        return "审批中";
                            //        break;
                            //    case 2:
                            //        return "审批未通过";
                            //        break;
                            //    case 3:
                            //        return "已变更";
                            //        break;
                            //    case 4:
                            //        return "申请填写中";
                            //        break;
                            //}
                            var res = '';
                            switch (value) {
                                case 0:
                                    res = '<font style="color:blue;">未变更</font>';        //蓝色字体
                                    break;
                                case 1:
                                    res = '审批中';
                                    break;
                                case 2:
                                    res = '审批未通过';
                                    break;
                                case 3:
                                    res = '已变更';
                                    break;
                                case 4:
                                    res = '申请填写中';
                                    break;
                                default:
                                    break;
                            }
                            return res;
                        }
                    },
                    { field: 'ProjectType', hidden: true },
                    { field: 'ProjectSourceId', hidden: true },
                    { field: 'FundingProperty', hidden: true },
                    { field: 'Id', hidden: true }
                ]],
                onDblClickRow: function () {
                    viewInfo();
                }
            })
        }

  
  
  
  //加载数据
  //代码出自:三项工作--项目管理系统--项目管理--自行招标--竞争性谈判/询价--谈判/询价小组成立
        
function loadData() {
            $('#dg').datagrid({
                url: 'ajax/operation/GetPetitionList',
                queryParams: {
                    year: $('#cmbYear').combobox('getValue'),
                    state: $('#cmbState').combobox('getValue'),
                    keyword: $('#txtKeyword').val(),
                    buytype: BuyType,
                    reportState:1
                },
                fit: true, // 自动填充
                singleSelect: true, // 单选
                pagination: true, // 分页信息
                rownumbers: true, // 显示行号
                idField: 'Id',
                columns: [[
                    //{ field: 'PetitionNo', title: '项目编号', width: 120, halign: 'center' },
                    { field: 'PetitionName', title: '项目名称', width: 240, halign: 'center' },
                    { field: 'Nd', title: '年度', width: 80, halign: 'center', align: 'center' },
                    { field: 'ProjectTypeName', title: '项目类型', width: 100, halign: 'center' },
                    { field: 'DeptName', title: '实施部门', width: 180, halign: 'center' },
                    { field: 'BuyManner', title: '采购方式', width: 100, halign: 'center', align: 'center' },
                    { field: 'SignManner', title: '采购形式', width: 100, halign: 'center', align: 'center' },
                    { field: 'BidingWay', title: '实施形式', width: 100, halign: 'center', align: 'center' },
                    {
                        field: 'BuilderStateName', title: '成立状态', width: 100, halign: 'center', align: 'center',
                        formatter: function (value) { return value == '未成立' ? '<font style="color:blue">未成立</font>' : '已成立' }   //未成立标蓝
                    },
                    {
                        field: 'ReportState', title: '运作状态', width: 100, halign: 'center', align: 'center',
                        formatter: function (value, row, index) {
                            switch (value) {
                                case 1:
                                    return '运作中';
                                    break;
                                case 3:
                                    return '已中止';
                                    break;
                                case 4:
                                    return '已完成';
                            }
                        }
                    },
                    { field: 'ProjectType', hidden: true },
                    { field: 'ProjectSourceId', hidden: true },
                    { field: 'FundingProperty', hidden: true },
                    { field: 'Id', hidden: true },
                    { field: 'GId', hidden: true }
                ]],
                onDblClickRow: function () {
                    seeInfo();
                }
            })
        }
  
#endregion
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章