前台单Grid页面模板

@using MESModel.Enum
@{
    ViewBag.Title = "特殊工艺评价";
    var F = @Html.F();
}

@section body {
    @(F.Panel()
        .ID("MainPanel")
        .IsViewPort(true)
        .ShowBorder(false)
        .ShowHeader(false)
        .Items(ViewBag.Grid)
    )
}


@section script {
    <script>
        var _WorkShopComboData = @Html.Raw(ViewBag.WorkShopList);
        @*var _WorkGroupComboData = @Html.Raw(ViewBag.WorkGroupList);
        var _TransferTypeComboData = @Html.Raw(ViewBag.TransferTypeList);
        var _TransferPatheComboData = @Html.Raw(ViewBag.TransferPatheList);*@

        function renderActionOption(value, params) {
            if (params.rowIndex < 0) return;
            var rowData = params.rowData.values;
            return '<a href="javascript:;" onclick="onShowFileWindow(\'' + rowData.EvaluateID + '\')">上传附件</a>';
        }
        function renderShowFile(value, params) {
            if (params.rowIndex < 0) return;
            return '<a href="javascript:;" onclick="ShowFile(\'' + params.rowId + '\',\'@(FileSourceType.转运车设计图纸.ToString() + ',' + FileSourceType.转运车清单.ToString())\')">查看附件</a>';
        }
        function renderWorkShopType(value) {
            return F.ui.ddlWorkShopType.getTextByValue(value);
        }
        function renderWorkGroupType(value) {
            return F.ui.ddlWorkGroupType.getTextByValue(value);
        }
        function renderTransferType(value) {
            return F.ui.ddlTransferType.getTextByValue(value);
        }
        function renderTransferPathe(value) {
            return F.ui.ddlTransferPathe.getTextByValue(value);
        }



        // 编辑前事件
        function onGrid1BeforeEdit(event, value, params) {
            var grid1 = F.ui.Grid1,
                columnId = params.columnId,
                rowId = params.rowId;

            if (columnId === 'WorkShopID') {
                var ddlWorkShopType = F.ui.ddlWorkShopType;
                var vId = grid1.getCellValue(rowId, 'FactoryID');
                GridBeforeEdit2Combo(ddlWorkShopType, _WorkShopComboData, vId, '请先选择工厂!');
            }
            else if (columnId === 'WorkGroupID') {
                var ddlWorkGroupType = F.ui.ddlWorkGroupType;
                var vId = grid1.getCellValue(rowId, 'WorkShopID');
                GridBeforeEdit2Combo(ddlWorkGroupType, _WorkGroupComboData, vId, '请先选择车间!');
            } else if (columnId === 'MaterialTransferTypeID') {
                var ddlTransferType = F.ui.ddlTransferType;
                var vId = grid1.getCellValue(rowId, 'FactoryID');
                GridBeforeEdit2Combo(ddlTransferType, _TransferTypeComboData, vId, '请先选择工厂!');
            } else if (columnId === 'TransferPatheID') {
                var ddlTransferPathe = F.ui.ddlTransferPathe;
                var vId = grid1.getCellValue(params.rowId, 'FactoryID');
                GridBeforeEdit2Combo(ddlTransferPathe, _TransferPatheComboData, vId, '请先选择工厂!');
            }
        }
        // 编辑后事件
        function onGrid1AfterEdit(event, value, params) {
         
            var grid1 = F.ui.Grid1,
                columnId = params.columnId,
                rowId = params.rowId;

            if (columnId === 'FactoryID') {
                GridAfterEdit2Combo(grid1, _WorkShopComboData, value, rowId, 'WorkShopID');
                //GridAfterEdit2Combo(grid1, _TransferTypeComboData, value, rowId, 'MaterialTransferTypeID');
              //  GridAfterEdit2Combo(grid1, _TransferPatheComboData, value, rowId, 'TransferPatheID');
            } else if (columnId === 'WorkShopID') {
               // GridAfterEdit2Combo(grid1, _WorkGroupComboData, value, rowId, 'WorkGroupID');
               // F.ui.ddlWorkShopType.loadData(obj2arr(_WorkShopComboData));
            } else if (columnId === 'WorkGroupID') {
                F.ui.ddlWorkGroupType.loadData(obj2arr(_WorkGroupComboData));
            } else if (columnId === 'MaterialTransferTypeID') {
                F.ui.ddlTransferType.loadData(obj2arr(_TransferTypeComboData));
            } else if (columnId === 'TransferPatheID') {
                F.ui.ddlTransferPathe.loadData(obj2arr(_TransferPatheComboData));
            }
        }

        function onShowFileWindow(id) {
            F.ui.Window1.show('FactoryResources/TransferLoad/Index?TransferID=' + id, "附件上传", 900, 750);
        }
    </script>
}

 

posted @ 2020-07-10 16:05  咖啡无眠  阅读(228)  评论(0编辑  收藏  举报