123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- function viewModel() {
- this.init = function () {
- $('#Classfy').treegrid({
- idField: 'ID',
- treeField: '名称',
- url: '/ClassifyManage/GetTreeGrid',
- method: 'GET',
- fit: true,
- toolbar: '#btn_func',
- singleSelect: true,
- border: false,
- rownumbers: true,
- columns: [[
- { field: '编码', title: '编码', width: 100, align: 'center' },
- { field: '名称', title: '名称', width: 200, align: 'center' },
- { field: '说明', title: '说明', width: 600, align: 'center', halign: 'center' },
- {
- field: '分值', title: '分值', width: 70, align: 'center', halign: 'center', formatter: function (val, row, index) {
- return (val || 0) + "分";
- }
- }
- ]],
- onSelect: function (row) {
- },
- onLoadSuccess(row, data) {
- }
- });
- $("#btn_add").bind("click", function () {
- top.ZLPMS.OpenNewWindow("新建问题分类", "/ClassifyManage/Add_Window", "800px", "450px", function () {
- $("#Classfy").treegrid("load")
- })
- })
- $("#btn_edit").bind("click", function () {
- var data = $("#Classfy").treegrid("getSelected");
- if (data == null) {
- top.ZLPMS.Msg("请选择一行记录!!");
- return
- }
- top.ZLPMS.OpenNewWindow("修改问题分类", "/ClassifyManage/Edit_Window/" + data["ID"], "800px", "450px", function () {
- $("#Classfy").treegrid("load")
- })
- })
- $("#btn_del").bind("click", function () {
- var data = $("#Classfy").treegrid("getSelected");
- if (data == null) {
- top.ZLPMS.Msg("请选择一行记录!!");
- return
- }
- top.ZLPMS.Confirm("确认删除该记录?", 3, function () {
- $.get("/ClassifyManage/DelClass/" + data["ID"], function (data) {
- if (data == 1) {
- top.ZLPMS.Msg("删除成功!", 1);
- $("#Classfy").treegrid("reload");
- }
- })
- })
- })
- $("#btn_refresh").bind("click", function () {
- $("#Classfy").treegrid("reload");
- })
- }
- this.Add_Init = function () {
- $('#parentid').combotree({
- url: '/ClassifyManage/GetClassTree',
- method: 'GET',
- editable: false,
- onLoadSuccess: function () {
- }
- });
- $("#remove").bind("click", function () {
- $('#parentid').combotree('clear')
- })
- $("#Add_Class").bind("click", function () {
- var r = $('#insert_Class').form('validate');
- if (r) {
- var param = ZLPMS.FormToObject('insert_Class');
- $.post("/ClassifyManage/Add_Class", param, function (data) {
- if (data == 1) {
- top.ZLPMS.Msg("添加成功!", 1);
- ZLPMS.CloseTopWindow(true);
- }
- else {
- ZLPMS.CloseTopWindow(true)
- top.ZLPMS.Msg("数据异常请重新填写!", 2)
- }
- });
- }
- })
- }
- this.Edit_Init = function (ID) {
- $('#parentid').combotree({
- url: '/ClassifyManage/GetClassTree',
- method: 'GET',
- editable: false,
- onLoadSuccess: function () {
- }
- });
- $("#remove").bind("click", function () {
- $('#parentid').combotree('clear')
- })
- $("#Edit_Class").bind('click', function () {
- var r = $('#insert_Class').form('validate');
- if (r) {
- var param = ZLPMS.FormToObject('insert_Class');
- param.ID = ID;
- $.post("/ClassifyManage/EditClass", param, function (data) {
- if (data == "1") {
- top.ZLPMS.Msg("修改成功!", 1);
- ZLPMS.CloseTopWindow(true);
- }
- else {
- top.ZLPMS.Msg("数据异常请重新填写!", 2)
- }
- });
- }
- })
- $.get("/ClassifyManage/GetProblemClassByID/" + ID, function (data) {
- if (data) {
- $("#Coding").textbox("setValue", data[0].编码)
- $("#name").textbox("setValue", data[0].名称)
- $("#parentid").combotree("setValue", data[0].上级ID || '')
- $("#ClassCore").numberspinner("setValue", data[0].分值)
- $("#Deatil").html(data[0].说明);
- }
- })
- }
- }
- //关闭
- function Close() {
- ZLPMS.CloseTopWindow();
- }
|