EasyUI datagrid 行编辑

一、HTML:

<div class="info">
    <div class="info_tt">
        <span class="info_tt1">明细</span> <span class="pucker2"></span><a class="del" onclick="detailDel()"
            href="javascript:void(0)">删除</a> <a class="sure" onclick="detailOK()" href="javascript:void(0)">
                确认</a> <a class="add" onclick="detailAdd()" href="javascript:void(0)">添加</a>
    </div>
    <div>
        <table id="detailList">
        </table>
    </div>
</div>
View Code

二、JS:

<script type="text/javascript">
    $(function () {
        //使用JavaScript创建数据表格
        $('#detailList').datagrid({
            url: '/PMP/EntryNoticeManage/GetDetailList',     //一个用以从远程站点请求数据的超链接地址。控制器/方法
            queryParams: {
                type: 1,
                entryNoticeId: 0,
                proTaskId: 0
            },
            iconCls: 'icon-save',
            loadMsg: '数据正在加载中,请稍后.....',    //当从远程站点载入数据时,显示的一条快捷信息。
            singleSelect: true,               //设置为true将只允许选择一行
            fitColumns: true,                  //设置为true将自动使列适应表格宽度以防止出现水平滚动
            striped: true,                     //设置为true将交替显示行背景
            pagination: false,                  //设置true将在数据表格底部显示分页工具栏。
            rownumbers: true,                  //设置为true将显示行数。
            pagePosition: 'bottom',            //定义的分页栏的位置。可用的值有 'top','bottom','both'。
            sortName: 'creatTime',                    //当数据表格初始化时以哪一列来排序。
            sortOrder: 'desc',                  //定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。
            idField: 'Id',                     //表明该列是一个唯一列。
            onClickRow: detailClickRow,
            frozenColumns: [[                  //跟列属性一样,但是这些列固定在左边,不会滚动。

                           ]],
            columns: [[
                         { field: 'Id', title: 'ID', hidden: true },
                         { field: 'ProtastDetId', title: 'ProtastDetId', hidden: true },
                         { field: 'WorkContent', title: '工作内容', width: 100, align: 'center', sortable: true,
                             editor: { type: 'textbox', options: { validType: 'length[1,50]', required: true} }
                         },
                         { field: 'Remarks', title: '备注', width: 100, align: 'center', sortable: true,
                             editor: { type: 'textbox', options: { validType: 'length[0,500]'} }
                         }
                     ]]
        }); //end datagrid

        loadgrid(1, "@entryNotice.Id", 0);

    });

    //明细编辑行索引
    var detailEditIndex = undefined;

    //明细结束编辑
    function detailEndEdit() {
        if (detailEditIndex == undefined) { return true }
        if ($('#detailList').datagrid('validateRow', detailEditIndex)) {
            $('#detailList').datagrid('endEdit', detailEditIndex);
            detailEditIndex = undefined;
            return true;
        } else {
            return false;
        }
    }

    //明细点击行
    function detailClickRow(index) {
        if (detailEditIndex != index) {
            if (detailEndEdit()) {
                $('#detailList').datagrid('selectRow', index)
                                .datagrid('beginEdit', index);
                detailEditIndex = index;
            } else {
                $('#detailList').datagrid('selectRow', detailEditIndex);
            }
        }
    }

    //添加行
    function detailAdd() {
        if (detailEndEdit()) {
            $('#detailList').datagrid('appendRow', {});
            detailEditIndex = $('#detailList').datagrid('getRows').length - 1;
            $('#detailList').datagrid('selectRow', detailEditIndex)
                            .datagrid('beginEdit', detailEditIndex);
        }
    }

    //删除行
    function detailDel() {
        if (detailEditIndex == undefined) { return }
        $('#detailList').datagrid('cancelEdit', detailEditIndex)
                        .datagrid('deleteRow', detailEditIndex);
        detailEditIndex = undefined;
    }

    //临时保存
    function detailOK() {
        if (detailEndEdit()) {
            $('#detailList').datagrid('acceptChanges');
        }
    }

    //重新查询,显示第一页
    function loadgrid(type, entryNoticeId, proTaskId) {
        $('#detailList').datagrid('load', {
            type: type,
            entryNoticeId: entryNoticeId,
            proTaskId: proTaskId
        });
        $('#detailList').datagrid('clearSelections');
    }
</script>
View Code

三、完整示例页面:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using Model.Suya;
@using Suya.PMP.Contract.Model;
@{
    BeforeAllocationModel beforeAllocation = ViewData["BeforeAllocationModel"] as BeforeAllocationModel;
}
<link href="/Content/Plugins/UploadifyJs/uploadify.css" rel="stylesheet" type="text/css" />
<script src="/Content/Plugins/UploadifyJs/swfobject.js" type="text/javascript"></script>
<script src="/Content/Plugins/UploadifyJs/jquery.uploadify-3.1.min.js" type="text/javascript"></script>
<link href="/Content/Styles/css1/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(function () {
        //使用JavaScript创建数据表格
        $('#checkList').datagrid({
            url: '/PMP/BeforeAllocationManage/GetCheckList',     //一个用以从远程站点请求数据的超链接地址。控制器/方法
            queryParams: {
                parentId: "@beforeAllocation.id"
            },
            iconCls: 'icon-save',
            loadMsg: '数据正在加载中,请稍后.....',    //当从远程站点载入数据时,显示的一条快捷信息。
            singleSelect: true,               //设置为true将只允许选择一行
            fitColumns: true,                  //设置为true将自动使列适应表格宽度以防止出现水平滚动
            striped: true,                     //设置为true将交替显示行背景
            pagination: false,                  //设置true将在数据表格底部显示分页工具栏。
            rownumbers: true,                  //设置为true将显示行数。               
            sortName: 'creatTime',                    //当数据表格初始化时以哪一列来排序。
            sortOrder: 'desc',                  //定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。
            idField: 'Id',                     //表明该列是一个唯一列。
            onClickRow: checkClickRow,
            onLoadSuccess: function (data) {
                calCheckTotal(data.rows);
            },
            frozenColumns: [[                  //跟列属性一样,但是这些列固定在左边,不会滚动。

                           ]],
            columns: [[
                         { field: 'id', title: 'ID', hidden: true },
                         { field: 'checkTime', title: '校对时间', width: 100, align: 'center', sortable: true,
                             formatter: dateformatter,
                             editor: { type: 'datetimebox', options: { parser: dateparser, required: true} }
                         },
                         { field: 'baackTime', title: '返回时间', width: 100, align: 'center', sortable: true,
                             formatter: dateformatter,
                             editor: { type: 'datetimebox', options: { parser: dateparser, required: true} }
                         },
                         { field: 'useTime', title: '校对用时', width: 100, align: 'center', sortable: true,
                             editor: { type: 'numberbox', options: { min: 0, precision: 2, required: true} }
                         },
                         { field: 'correctTime', title: '修改用时', width: 100, align: 'center', sortable: true,
                             editor: { type: 'numberbox', options: { min: 0, precision: 2, required: true} }
                         }
                     ]]
        }); //end datagrid

        $('#auditList').datagrid({
            url: '/PMP/BeforeAllocationManage/GetAuditList',     //一个用以从远程站点请求数据的超链接地址。控制器/方法
            queryParams: {
                parentId: "@beforeAllocation.id"
            },
            iconCls: 'icon-save',
            loadMsg: '数据正在加载中,请稍后.....',    //当从远程站点载入数据时,显示的一条快捷信息。
            singleSelect: true,               //设置为true将只允许选择一行
            fitColumns: true,                  //设置为true将自动使列适应表格宽度以防止出现水平滚动
            striped: true,                     //设置为true将交替显示行背景
            pagination: false,                  //设置true将在数据表格底部显示分页工具栏。
            rownumbers: true,                  //设置为true将显示行数。               
            sortName: 'creatTime',                    //当数据表格初始化时以哪一列来排序。
            sortOrder: 'desc',                  //定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。
            idField: 'Id',                     //表明该列是一个唯一列。
            onClickRow: auditClickRow,
            onLoadSuccess: function (data) {
                calAuditTotal(data.rows);
            },
            frozenColumns: [[                  //跟列属性一样,但是这些列固定在左边,不会滚动。

                           ]],
            columns: [[
                         { field: 'Id', title: 'ID', hidden: true },
                         { field: 'checkTime', title: '校对时间', width: 100, align: 'center', sortable: true,
                             formatter: dateformatter,
                             editor: { type: 'datetimebox', options: { parser: dateparser, required: true} }
                         },
                         { field: 'baackTime', title: '返回时间', width: 100, align: 'center', sortable: true,
                             formatter: dateformatter,
                             editor: { type: 'datetimebox', options: { parser: dateparser, required: true} }
                         },
                         { field: 'useTime', title: '校对用时', width: 100, align: 'center', sortable: true,
                             editor: { type: 'numberbox', options: { min: 0, precision: 2, required: true} }
                         },
                         { field: 'correctTime', title: '修改用时', width: 100, align: 'center', sortable: true,
                             editor: { type: 'numberbox', options: { min: 0, precision: 2, required: true} }
                         }
                     ]]
        }); //end datagrid

        $('#fileList').datagrid({
            url: '/PMP/BeforeAllocationManage/GetAttList',     //一个用以从远程站点请求数据的超链接地址。控制器/方法
            queryParams: {
                parentId: "@beforeAllocation.id"
            },
            iconCls: 'icon-save',
            loadMsg: '数据正在加载中,请稍后.....',    //当从远程站点载入数据时,显示的一条快捷信息。
            singleSelect: true,               //设置为true将只允许选择一行
            fitColumns: true,                  //设置为true将自动使列适应表格宽度以防止出现水平滚动
            striped: true,                     //设置为true将交替显示行背景
            pagination: false,                  //设置true将在数据表格底部显示分页工具栏。
            rownumbers: true,                  //设置为true将显示行数。               
            sortName: 'creatTime',                    //当数据表格初始化时以哪一列来排序。
            sortOrder: 'desc',                  //定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。
            idField: 'Id',                     //表明该列是一个唯一列。
            frozenColumns: [[                  //跟列属性一样,但是这些列固定在左边,不会滚动。

                           ]],
            columns: [[
                         { field: 'Id', title: 'ID', hidden: true },
                         { field: 'attachment', title: 'attachment', hidden: true },
                         { field: 'fileName', title: '附件', width: 100, align: 'center', sortable: true,
                             formatter: function (value, row, index) {
                                 return '<a href="DownloadFile?name=' + escape(value) + '&url=' + row.attachment + '" target="_blank">' + value + '</a>';
                             }
                         },
                         { field: 'uploadTime', title: '上传时间', width: 100, align: 'center', sortable: true, formatter: dateformatter },
                         { field: 'operate', title: '操作', width: 100, align: 'center', sortable: true,
                             formatter: function (value, row, index) {
                                 return '<a href="javascript:void(0);" onclick="delFile(' + index + ')">删除</a>';
                             }
                         }
                     ]]
        }); //end datagrid

        //验证信息
        jQuery("#frm").validate({
            //定义验证规则
            rules: {
                beforeBillCode: {
                    required: true
                },
                taskType: {
                    required: true
                },
                desingContent: {
                    required: true,
                    maxlength: 500
                },
                desingerShow: {
                    required: true
                },
                checkerShow: {
                    required: true
                },
                auditorShow: {
                    required: true
                },
                confirmPersonShow: {
                    required: true
                },
                auditorScore: {
                    number: true
                },
                score: {
                    number: true
                },
                needTime: {
                    number: true
                },
                factTime: {
                    number: true
                }
            },
            //定义提示信息
            messages: {
                beforeBillCode: {
                    required: "必填"
                },
                taskType: {
                    required: "必填"
                },
                desingContent: {
                    required: "必填",
                    maxlength: "长度不超过500"
                },
                desingerShow: {
                    required: "必填"
                },
                checkerShow: {
                    required: "必填"
                },
                auditorShow: {
                    required: "必填"
                },
                confirmPersonShow: {
                    required: "必填"
                },
                auditorScore: {
                    number: "数字"
                },
                score: {
                    number: "数字"
                },
                needTime: {
                    number: "数字"
                },
                factTime: {
                    number: "数字"
                }
            },
            submitHandler: function (form) {
                //点提交时调用更新方法
                btnAdd();
            }
        });

        $("#uploadify").uploadify({
            height: 25,
            width: 100,
            swf: '/Content/Plugins/UploadifyJs/uploadify.swf',
            uploader: '/PMP/BeforeAllocationManage/UploadFile',
            buttonText: '选择文件上传',
            fileSizeLimit: '4MB',
            fileTypeDesc: '文件',
            fileTypeExts: '*.*',
            multi: true,
            onUploadSuccess: function (fileObj, data, response) {
                var d = eval("(" + data + ")");
                $(".uploadify-queue-item").find(".data").html("&nbsp;&nbsp;上传完成");
                $('#fileList').datagrid("appendRow", {
                    fileName: d.name,
                    attachment: d.url,
                    uploadTime: new Date()
                });
            },
            onUploadError: function (event, ID, fileObj, errorObj) {
                if (event.size > 4 * 1024 * 1024) {
                    alert('超过文件上传大小限制(4M)!');
                    return;
                }
                alert('上传失败');
            }
        }); //end uploadify

    });                   //end $.ready

    //合计
    function calCheckTotal(rows) {
        var sum1 = 0;
        var sum2 = 0;
        for (var i = 0; i < rows.length; i++) {
            sum1 += parseFloat(rows[i].useTime);
            sum2 += parseFloat(rows[i].correctTime);
        }
        $("#checkTotal").html("合计:校对用时:" + sum1.toFixed(2) + "&nbsp;&nbsp;修改用时:" + sum2.toFixed(2));
    }

    //合计
    function calAuditTotal(rows) {
        var sum1 = 0;
        var sum2 = 0;
        for (var i = 0; i < rows.length; i++) {
            sum1 += parseFloat(rows[i].useTime);
            sum2 += parseFloat(rows[i].correctTime);
        }
        $("#auditTotal").html("合计:审核用时:" + sum1.toFixed(2) + "&nbsp;&nbsp;修改用时:" + sum2.toFixed(2));
    }

    //删除附件
    function delFile(index) {
        $("#fileList").datagrid('deleteRow', index);
    }

    //日期格式
    function dateformatter(value) {
        if (!value) return "";
        if (value instanceof Date) {
            return value.format("yyyy-MM-dd hh:mm");
        }
        else if (value.indexOf("Date") != -1) {
            var date = new Date();
            date.setTime(value.replace(/\/Date\((-?\d+)\)\//, '$1'));
            return date.format("yyyy-MM-dd hh:mm");
        }
        else if ($.trim(value) != "") {
            var date = new Date(value.replace(/-/g, '/'));
            return date.format("yyyy-MM-dd hh:mm");
        }
    }

    //日期格式
    function dateparser(value) {
        if (!value) return new Date();
        if (value.indexOf("Date") != -1) {
            var date = new Date();
            date.setTime(value.replace(/\/Date\((-?\d+)\)\//, '$1'));
            return date;
        }
        else {
            var arr = value.split(' ');
            var arr1 = arr[0].split('-');
            var arr2 = arr[1].split(':');
            var y = parseInt(arr1[0], 10);
            var M = parseInt(arr1[1], 10);
            var d = parseInt(arr1[2], 10);
            var h = parseInt(arr2[0], 10);
            var m = parseInt(arr2[1], 10);
            if (!isNaN(y) && !isNaN(M) && !isNaN(d) && !isNaN(h) && !isNaN(m)) {
                return new Date(y, M - 1, d, h, m);
            } else {
                return new Date();
            }
        }
    }

    //添加
    function btnAdd() {
        var params = FormToJson($("#frm").serializeArray());
        var att = $("#fileList").datagrid('getRows');
        var check = $("#checkList").datagrid('getRows');
        var audit = $("#auditList").datagrid('getRows');

        $.ajax({
            url: "/PMP/BeforeAllocationManage/InsertOrUpdate",
            type: "POST",
            dataType: "json",
            data: { params: params, att: JSON2.stringify(att), check: JSON2.stringify(check), audit: JSON2.stringify(audit) },
            success: function (data) {
                if (fnet.ajax.success(data)) {
                    fnet.msg.info("保存成功");
                    back();
                }
                else {
                    fnet.msg.error(data.msg);
                }
            }
        });
    }

    //保存
    function save() {
        if (checkEndEdit() && auditEndEdit()) {
            $("#frm").submit();
        }
        else {
            fnet.msg.info("请先保存校对记录和审核记录");
        }
    }

    //返回
    function back() {
        parent.$('#ttTab').tabs('select', "项目前期任务分配考核表");
        var tab = parent.$('#ttTab').tabs('getSelected');
        tab.find("iframe").contents().find("#btnSearch").click();
        parent.$("#ttTab").tabs('close', '修改项目前期任务分配考核表');
    }

    //选择项目前期任务单
    function selBeforeProtast() {
        $.iDialog({
            title: '选择项目前期任务单',
            height: "500px",
            width: "800px",
            content: "url:/Auth/BeforeProtastDialog/Index",
            okVal: "确认选择",
            ok: function () {
                return this.content.doOK(function (data) {
                    $("#beforeBillCode").val(data.BeforeBillCode);
                    $("#projectCode").val(data.ProjectCode);
                    $("#projectName").val(data.ProjectName);
                    $("#productCodeShow").html(data.ProjectCode);
                    if (data.Attachment) {
                        var pos = data.Attachment.lastIndexOf('/');
                        var len = data.Attachment.length - pos;
                        var name = data.Attachment.substr(pos + 1, len);
                        $("#attachment").html(name);
                        $("#attachment").attr("href", "DownloadFile?name=" + escape(name) + "&url=" + escape(data.Attachment));
                    }
                }); //调用子窗口的函数
            }
        });
    }

    //选择人员
    function selemp(id) {
        $.iDialog({
            title: '选择人员',
            height: "500px",
            width: "800px",
            content: "url:/HR/EmployeeManage/SelEmployee",
            okVal: "确认选择",
            ok: function () {
                return this.content.doOK(function (data) {
                    $("#" + id).val(data.EmployeeName);
                    $("#" + id + "+ input").val(data.EmployeeCode);
                }); //调用子窗口的函数
            }
        });
    }

    // checkList操作开始 ===================================================================================
    //编辑行索引
    var checkEditIndex = undefined;

    //结束编辑
    function checkEndEdit() {
        if (checkEditIndex == undefined) { return true }
        if ($('#checkList').datagrid('validateRow', checkEditIndex)) {
            $('#checkList').datagrid('endEdit', checkEditIndex);
            checkEditIndex = undefined;
            var rows = $('#checkList').datagrid('getRows');
            calCheckTotal(rows);
            return true;
        } else {
            return false;
        }
    }

    //点击行
    function checkClickRow(index) {
        if (checkEditIndex != index) {
            if (checkEndEdit()) {
                $('#checkList').datagrid('selectRow', index)
                                .datagrid('beginEdit', index);
                checkEditIndex = index;
            } else {
                $('#checkList').datagrid('selectRow', checkEditIndex);
            }
        }
    }

    //添加行
    function checkAdd() {
        if (checkEndEdit()) {
            $('#checkList').datagrid('appendRow', {});
            checkEditIndex = $('#checkList').datagrid('getRows').length - 1;
            $('#checkList').datagrid('selectRow', checkEditIndex)
                            .datagrid('beginEdit', checkEditIndex);
        }
    }

    //删除行
    function checkDel() {
        if (checkEditIndex == undefined) { return }
        $('#checkList').datagrid('cancelEdit', checkEditIndex)
                        .datagrid('deleteRow', checkEditIndex);
        checkEditIndex = undefined;
    }

    //临时保存
    function checkOK() {
        if (checkEndEdit()) {
            $('#checkList').datagrid('acceptChanges');
        }
    }

    //重新查询,显示第一页
    function loadcheckgrid(type, entryNoticeId, proTaskId) {
        $('#checkList').datagrid('load', {
            type: type,
            entryNoticeId: entryNoticeId,
            proTaskId: proTaskId
        });
        $('#checkList').datagrid('clearSelections');
    }
    // checkList操作结束 ===================================================================================

    // auditList操作开始 ===================================================================================
    //编辑行索引
    var auditEditIndex = undefined;

    //结束编辑
    function auditEndEdit() {
        if (auditEditIndex == undefined) { return true }
        if ($('#auditList').datagrid('validateRow', auditEditIndex)) {
            $('#auditList').datagrid('endEdit', auditEditIndex);
            auditEditIndex = undefined;
            var rows = $('#checkList').datagrid('getRows');
            calAuditTotal(rows);
            return true;
        } else {
            return false;
        }
    }

    //点击行
    function auditClickRow(index) {
        if (auditEditIndex != index) {
            if (auditEndEdit()) {
                $('#auditList').datagrid('selectRow', index)
                                .datagrid('beginEdit', index);
                auditEditIndex = index;
            } else {
                $('#auditList').datagrid('selectRow', auditEditIndex);
            }
        }
    }

    //添加行
    function auditAdd() {
        if (auditEndEdit()) {
            $('#auditList').datagrid('appendRow', {});
            auditEditIndex = $('#auditList').datagrid('getRows').length - 1;
            $('#auditList').datagrid('selectRow', auditEditIndex)
                            .datagrid('beginEdit', auditEditIndex);
        }
    }

    //删除行
    function auditDel() {
        if (auditEditIndex == undefined) { return }
        $('#auditList').datagrid('cancelEdit', auditEditIndex)
                        .datagrid('deleteRow', auditEditIndex);
        auditEditIndex = undefined;
    }

    //临时保存
    function auditOK() {
        if (auditEndEdit()) {
            $('#auditList').datagrid('acceptChanges');
        }
    }

    //重新查询,显示第一页
    function loadauditgrid(type, entryNoticeId, proTaskId) {
        $('#auditList').datagrid('load', {
            type: type,
            entryNoticeId: entryNoticeId,
            proTaskId: proTaskId
        });
        $('#auditList').datagrid('clearSelections');
    }
    // auditList操作结束 ===================================================================================
</script>
<form id="frm" action="">
<div class="label">
    <input type="button" class="submit_btn" value="保存" onclick="save()" style="float: right;" />
    <input type="button" class="submit_btn" value="返回" onclick="back()" style="float: right;" />
</div>
<div class="info" style="margin-top: 37px;">
    <div class="info_tt">
        <span class="info_tt1">基础信息</span>(带<i class="red"> * </i>号项必填) <span class="pucker2">
        </span>
    </div>
    <div class="info_con" style="padding-top: 5px;">
        <table width="100%" border="0" bgcolor="#f9f7f7" cellspacing="1" cellpadding="1">
            <tr>
                <td class="txt_right">
                    单号:
                </td>
                <td class="txt_left">
                    <input type="hidden" name="id" value="@beforeAllocation.id" />
                    <input type="hidden" class="xinxi_txt" id="billCode" name="billCode" value="@beforeAllocation.billCode" />
                    <span>@beforeAllocation.billCode</span>
                </td>
                <td class="txt_right">
                </td>
                <td class="txt_left">
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    制单人:
                </td>
                <td class="txt_left">
                    <input type="hidden" class="xinxi_txt" id="billCreator" name="billCreator" value="@ViewBag.employeeCode" />
                    <span>@ViewBag.employeeName</span>
                </td>
                <td class="txt_right">
                    制单时间:
                </td>
                <td class="txt_left">
                    <input type="hidden" class="xinxi_txt" id="billDate" name="billDate" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" />
                    <span>@DateTime.Now.ToString("yyyy-MM-dd HH:mm")</span>
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    <i class="red">*</i>项目前期任务单:
                </td>
                <td class="txt_left">
                    <input type="text" class="xinxi_txt" id="beforeBillCode" name="beforeBillCode"  value="@beforeAllocation.beforeBillCode"  readonly="readonly"
                        onclick="selBeforeProtast()" />
                    <input type="hidden" id="projectCode" name="projectCode" value="@(beforeAllocation.ProjectInfo == null ? "" : beforeAllocation.ProjectInfo.billCode)"  />
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="selBeforeProtast()"
                        data-options="iconCls:'icon-search'">选择</a>
                </td>
                <td class="txt_right">
                    项目名称:
                </td>
                <td class="txt_left">
                    <input type="text" class="xinxi_txt" id="projectName" name="projectName"  value="@(beforeAllocation.ProjectInfo == null ? "" : beforeAllocation.ProjectInfo.projectName)" readonly="readonly"
                        disabled="disabled" />
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    <i class="red">*</i>任务类型:
                </td>
                <td class="txt_left">
                    <select id="taskType" name="taskType" editable="false" style="width: 153px" class="xueli">
                        <option value=""></option>
                        <option value="0"  @(beforeAllocation.taskType == "0" ? "selected='selected'" : "") >
                            载荷图</option>
                        <option value="1"  @(beforeAllocation.taskType == "1" ? "selected='selected'" : "") >
                            方案图</option>
                        <option value="2"  @(beforeAllocation.taskType == "2" ? "selected='selected'" : "") >
                            工程量统计</option>
                        <option value="3"  @(beforeAllocation.taskType == "3" ? "selected='selected'" : "") >
                            载荷图与工程量统计</option>
                    </select>
                </td>
                <td class="txt_right">
                    提资附件:
                </td>
                <td class="txt_left">
                    @{
                        string attachmentName = "";
                        string attachmentHref = "";
                        if (beforeAllocation.BeforeProtast != null && !string.IsNullOrWhiteSpace(beforeAllocation.BeforeProtast.attachment))
                        {
                            int pos = beforeAllocation.BeforeProtast.attachment.LastIndexOf('/');
                            int len = beforeAllocation.BeforeProtast.attachment.Length - pos - 1;
                            attachmentName = beforeAllocation.BeforeProtast.attachment.Substring(pos + 1, len);
                            attachmentHref = "DownloadFile?name=" + Server.UrlEncode(attachmentName) + "&url=" + Server.UrlEncode(beforeAllocation.BeforeProtast.attachment);
                        }
                    }
                    <a id="attachment" href="@attachmentHref" target="_blank">@attachmentName</a>
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    任务内容附件上传:
                </td>
                <td class="txt_left" colspan="3">
                    <table id="fileList" style="width: 90%;">
                    </table>
                    <input type="file" id="uploadify" name="uploadify" style="width: 400px;" />
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    暂停原因:
                </td>
                <td class="txt_left" colspan="3">
                    <textarea type="text" class="xinxi_txt" id="stopReason" name="stopReason" style="width: 90%;">@beforeAllocation.stopReason</textarea>
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    暂停时间:
                </td>
                <td class="txt_left" colspan="3">
                    <input type="text" class="xinxi_txt" id="stopTime" name="stopTime"  value="@(beforeAllocation.stopTime.HasValue ? beforeAllocation.stopTime.Value.ToString("yyyy-MM-dd HH:mm") : "")"  readonly="readonly"
                        onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'1900-01-01'})" value="" />
                </td>
            </tr>
            <tr>
                <td class="txt_right">
                    备注:
                </td>
                <td class="txt_left" colspan="3">
                    <textarea class="xinxi_txt" id="remark" name="remark" style="width: 90%;">@beforeAllocation.remark</textarea>
                </td>
            </tr>
        </table>
    </div>
    <div class="info">
        <div class="info_tt">
            <span class="info_tt1">审核评分</span>(带<i class="red"> * </i>号项必填) <span class="pucker2">
            </span>
        </div>
        <div class="info_con" style="padding-top: 5px;">
            <table width="100%" border="0" bgcolor="#f9f7f7" cellspacing="1" cellpadding="1">
                <tr>
                    <td class="txt_right">
                        <i class="red">*</i>项目编号:
                    </td>
                    <td class="txt_left" colspan="3">
                        <span id="productCodeShow">@(beforeAllocation.ProjectInfo == null ? "" : beforeAllocation.ProjectInfo.billCode)</span>
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        <i class="red">*</i>设计内容:
                    </td>
                    <td class="txt_left" colspan="3">
                        <textarea class="xinxi_txt" id="desingContent" name="desingContent" style="width: 90%;">@beforeAllocation.desingContent</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        <i class="red">*</i>设计人:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="desinger" name="desingerShow" value="@(beforeAllocation.Desinger == null ? "" : beforeAllocation.Desinger.name)" readonly="readonly" />
                        <input type="hidden" name="desinger" value= "@(beforeAllocation.Desinger == null ? "" : beforeAllocation.Desinger.employeeCode)"/>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="selemp('desinger')"
                            data-options="iconCls:'icon-search'">选择</a>
                    </td>
                    <td class="txt_right">
                        <i class="red">*</i>校对人:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="checker" name="checkerShow" value="@(beforeAllocation.Checker == null ? "" : beforeAllocation.Checker.name)" readonly="readonly" />
                        <input type="hidden" name="checker" value="@(beforeAllocation.Checker == null ? "" : beforeAllocation.Checker.employeeCode)" />
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="selemp('checker')"
                            data-options="iconCls:'icon-search'">选择</a>
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        <i class="red">*</i>审核人:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="auditor" name="auditorShow" value="@(beforeAllocation.Auditor == null ? "" : beforeAllocation.Auditor.name)" readonly="readonly" />
                        <input type="hidden" name="auditor" value="@(beforeAllocation.Auditor == null ? "" : beforeAllocation.Auditor.employeeCode)"/>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="selemp('auditor')"
                            data-options="iconCls:'icon-search'">选择</a>
                    </td>
                    <td class="txt_right">
                        <i class="red">*</i>审核人打分:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="auditorScore" name="auditorScore" value="@beforeAllocation.auditorScore" />
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        <i class="red">*</i>审定人:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="confirmPerson" name="confirmPersonShow"
                        value="@(beforeAllocation.ConfirmPerson == null ? "" : beforeAllocation.ConfirmPerson.name)" readonly="readonly" />
                        <input type="hidden" name="confirmPerson" value="@(beforeAllocation.ConfirmPerson == null ? "" : beforeAllocation.ConfirmPerson.employeeCode)" />
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="selemp('confirmPerson')"
                            data-options="iconCls:'icon-search'">选择</a>
                    </td>
                    <td class="txt_right">
                    </td>
                    <td class="txt_left">
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        任务开始时间:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="startDate" name="startDate" readonly="readonly"
                        onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'1900-01-01'})" value="@(beforeAllocation.startDate.HasValue ? beforeAllocation.startDate.Value.ToString("yyyy-MM-dd HH:mm") : "")" />
                    </td>
                    <td class="txt_right">
                        任务结束时间:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="endDate" name="endDate" readonly="readonly"
                        onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'1900-01-01'})" value="@(beforeAllocation.endDate.HasValue ? beforeAllocation.endDate.Value.ToString("yyyy-MM-dd HH:mm") : "")" />
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        要求用时:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="needTime" name="needTime" value="@beforeAllocation.needTime" />
                    </td>
                    <td class="txt_right">
                        实际用时:
                    </td>
                    <td class="txt_left">
                        <input type="text" class="xinxi_txt" id="factTime" name="factTime" value="@beforeAllocation.factTime"/>
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        评分:
                    </td>
                    <td class="txt_left" colspan="3">
                        <input type="text" class="xinxi_txt" id="score" name="score" value="@beforeAllocation.score" />
                    </td>
                </tr>
                <tr>
                    <td class="txt_right">
                        备注:
                    </td>
                    <td class="txt_left" colspan="3">
                        <textarea class="xinxi_txt" id="scoreRemark" name="scoreRemark" style="width: 90%;">@beforeAllocation.scoreRemark</textarea>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="info">
        <div class="info_tt">
            <span class="info_tt1">校对记录</span>(带<i class="red"> * </i>号项必填) <span class="pucker2">
            </span><a class="del" onclick="checkDel()" href="javascript:void(0)">删除</a> <a class="sure"
                onclick="checkOK()" href="javascript:void(0)">确认</a> <a class="add" onclick="checkAdd()"
                    href="javascript:void(0)">添加</a>
        </div>
        <div class="info_con" style="padding: 0;">
            <table id="checkList">
            </table>
            <div id="checkTotal" style="padding: 5px; text-align: right;">
            </div>
        </div>
    </div>
    <div class="info">
        <div class="info_tt">
            <span class="info_tt1">审核记录</span>(带<i class="red"> * </i>号项必填) <span class="pucker2">
            </span><a class="del" onclick="auditDel()" href="javascript:void(0)">删除</a> <a class="sure"
                onclick="auditOK()" href="javascript:void(0)">确认</a> <a class="add" onclick="auditAdd()"
                    href="javascript:void(0)">添加</a>
        </div>
        <div class="info_con" style="padding: 0;">
            <table id="auditList">
            </table>
            <div id="auditTotal" style="padding: 5px; text-align: right;">
            </div>
        </div>
    </div>
</div>
</form>
View Code

 

posted @ 2015-06-11 17:54  0611163  阅读(1005)  评论(0编辑  收藏  举报