123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- var url = CMS_SystemConfig.VirtualDirectoryPath + "/EvaluationNorm/DetailEdit";
- var mnu = "";
- //加载
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- })
- //刷新
- function reload() {
- $("#dgEvaluationNormDetailList").cmsXDataTable("load", $.getDataGridParams("dgEvaluationNormDetailList"));
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgEvaluationNormDetailList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.EvaluationNormDetailID);
- });
- return d;
- }
- //获取选中的数据All
- function validChooseAll() {
- var d = [];
- $.each($("#dgEvaluationNormDetailList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- function queryNormType(data) {
- var normTypeID = $("#NormTypeID").combogridX("getValue");
- if (normTypeID == checkBoxNormTypeID) {
- $("#divDetail").show();
- } else {
- $("#divDetail").hide();
- }
- }
- //查看
- function edit(rowindex, rowdata) {
- var redirectTo = url + "?evaluationNormDetailID=" + rowdata.EvaluationNormDetailID + "&RowIndex=" + rowindex + "&MNU=" + mnu + "&type=detail";
- $.popupTopWindow('评分标准明细信息', redirectTo, 650, 350, EvaluationNormDetail_Confirm, rowdata);
- }
- //新增
- function EvaluationNormDetail_Add() {
- var d = validChooseAll();
- if (d.length > 0) {
- $.popupTopWindow('评分标准明细复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/EvaluationNorm/CopyAddDetail?evaluationNormDetailID=' + d[0].EvaluationNormDetailID + '&MNU=' + mnu, 650, 350, EvaluationNormDetail_Confirm, d[0]);
- }
- else {
- var redirectTo = url + "?MNU=" + mnu;
- $.popupTopWindow('评分标准明细新增', redirectTo, 650, 350, EvaluationNormDetail_Confirm, null);
- }
- }
- //确定
- function EvaluationNormDetail_Confirm(resultData) {
- if (resultData) {
- var orderNo = resultData.OrderNo;
- var name = resultData.Name;
- var weight = resultData.Weight;
- var remark = resultData.Remark;
- var rowIndex = resultData.RowIndex;
- var detailViewList = $("#dgEvaluationNormDetailList").cmsXDataTable("getRows");
- if ($.grep(detailViewList, function (row, index) { return name == row.Name; }).length == 0) {
- if (rowIndex == null) {
- detailViewList.push({
- EvaluationNormDetailID: Guid.NewGuid().ToString(),
- OrderNo: orderNo,
- Name: name,
- Weight: weight,
- Remark: remark
- });
- } else {
- detailViewList[rowIndex].OrderNo = orderNo;
- detailViewList[rowIndex].Name = name;
- detailViewList[rowIndex].Weight = weight;
- detailViewList[rowIndex].Remark = remark;
- }
- } else {
- $.messager.alert("系统提示", "添加失败,评分标准明细名称已存在。");
- return;
- }
- $("#dgEvaluationNormDetailList").cmsXDataTable("loadData", { rows: detailViewList, total: detailViewList.length });
- }
- }
- //删除
- function EvaluationNormDetail_Delete() {
- var d = validChooseAll();
- if (d.length == 0) {
- $.messager.alert("系统提示", "请选择您要删除的信息。");
- return;
- }
- $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
- if (r) {
- var detailViewList = $("#dgEvaluationNormDetailList").cmsXDataTable("getRows");
- var i, j;
- var len = detailViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (detailViewList[i].EvaluationNormDetailID == d[j].EvaluationNormDetailID) {
- detailViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgEvaluationNormDetailList").cmsXDataTable("loadData", { rows: detailViewList, total: detailViewList.length });
- }
- });
- }
- //保存
- function EvaluationNorm_Save() {
- var normTypeID = $("#NormTypeID").combogridX("getValue");
- if (normTypeID == "" || normTypeID == "-1" || normTypeID == null) {
- $.messager.alert("系统提示", "请选择评分类型。");
- return;
- }
- if (normTypeID == checkBoxNormTypeID) {
- var rows = $("#dgEvaluationNormDetailList").cmsXDataTable("getRows");
- if (rows.length <= 0) {
- $.messager.alert("系统提示", "评分标准明细不能为空,请添加。");
- return;
- }
- }
- $(document.forms[0]).submit();
- }
- //设置列颜色为红色
- function SetRedColumn(index, row, value) {
- return " <span style=\"color: red;\">" + value + "</span>";
- }
|