guohongjin
2024-05-01 1901fceb6ddaa56a57f3131191454554c3e77e68
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
 * ${context.bizChName}管理初始化
 */
var ${context.bizEnBigName} = new BasePage({
    id: "${context.bizEnBigName}Table"    //表格id
    //查询条件 支持集合和对象
    //  Array : [ key1,key2,key3,key4....]
    //  Object: { k(页面取值的domId): v(传入后台对象字段属性) }
    ,search_keys: {
        "create": "create",
        "createBegin": "beginTime",
        "createEnd": "endTime",
        "name": "name",
        "status": "status"
    }
});
 
/**
 * 初始化表格的列
 */
${context.bizEnBigName}.init_columns = function () {
    var that = this;
    return [
        {field: 'selectItem', checkbox: true},
        <% for(item in table.fields!){ %>
        <% if(strutil.lastIndex(item.propertyName, "Image") != -1) { %>
        {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle', formatter: that.getImageDom },
        <% } else if(strutil.lastIndex(item.propertyName, "Date") != -1) { %>
        {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle', formatter: that.getDateFormat },
        <% } else if(strutil.lastIndex(item.propertyName, "Text") != -1) { %>
        {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle', formatter: that.getTextFormat },
        <% } else { %>
        {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle'},
        <% }%>
        <% } %>
    ];
};
 
/**
 * 点击添加${context.bizChName}
 */
${context.bizEnBigName}.open_add = function () {
    this.open_modal({
        title: "添加${context.bizChName}",
        area: [ "65%", "75%"],
        content: this.ctxPath + '/${context.bizEnName}/open_add'
    });
};
 
/**
 * 点击编辑${context.bizChName}
 */
${context.bizEnBigName}.open_update = function () {
    var that = this;
    that.run_one_callback( function ( data) {
        that.open_modal({
            title: "编辑${context.bizChName}",
           area: [ "65%", "75%"],
           content: that.ctxPath + '/${context.bizEnName}/open_update/' + data.id
        });
    });
};
 
/**
 * 打开查看${context.bizChName}详情
 */
${context.bizEnBigName}.open_detail = function (id) {
    this.open_modal({
        title: "查看${context.bizChName}",
        area: [ "65%", "75%"],
        content: this.ctxPath + '/${context.bizEnName}/open_detail/' + id
    });
};
 
/**
 * 删除/批量删除${context.bizChName}
 */
${context.bizEnBigName}.delete = function(id){
    var that = this, ids = id == 0 ? this.check_ids() : id;
    if (ids.length == 0) { return; }
    that.confirm( "是否删除所选中的数据?", function () {
        that.$ajax( "删除", "/${context.bizEnName}/delete", { ids: ids}, function() { that.search(); });
    });
};
 
/**
 * 编辑${context.bizChName}状态
 */
${context.bizEnBigName}.updateState = function (id, state) {
    var that = this, ids = id == 0 ? this.check_ids() : id;
    if (ids.length == 0) { return; }
    var msg = state == 1 ? "启用" : "停用"
    that.confirm( "是否"+msg+"所选中的数据?", function () {
        that.$ajax( msg, "/${context.bizEnName}/updateState", { ids: ids, state: state}, function() { that.search(); });
    });
};
 
$(function () {
    ${context.bizEnBigName}.init_table( "/${context.bizEnName}/list");
});