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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章