Repository navigation
Expand file tree
/
Copy pathroadui.dict.js
More file actions
86 lines (80 loc) · 3.15 KB
/
Copy pathroadui.dict.js
File metadata and controls
86 lines (80 loc) · 3.15 KB
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
//数据字典选择
; RoadUI.Dict = function ()
{
var instance = this;
this.init = function ($members)
{
$members.each(function (index)
{
var $_member = $members.eq(index);
var id = $_member.attr("id") || "";
var name = $_member.attr("name") || "";
var value = $_member.val() || "";
var title = $_member.attr("title") || "";
var disabled = $_member.prop("disabled");
$_member.prop("readonly", true);
var $hide = $('<input type="hidden" id="' + id + '" name="' + name + '" value="' + (value || "") + '" />');
var $but = $('<input type="button" ' + (disabled ? 'disabled="disabled"' : '') + ' title="' + title + '" class="mybutton" style="border-left:none; margin:0;" value="选择" />');
$_member.attr("id", id + "_text");
$_member.attr("name", name + "_text");
$_member.removeClass().addClass("mytext");
if (value && value.length > 0)
{
$.ajax({
url: top.rootdir + "/Controls/SelectDict/GetNames?values=" + value, type: "get", async: false, cache: false, success: function (txt)
{
$_member.val(txt);
}
});
}
if ($_member.prop("disabled"))
{
$but.prop("disabled", true);
}
else
{
$but.bind("click", function ()
{
var $obj = $(this).prev().prev();
var val = $obj.val();
var $obj1 = $(this).prev();
var ismore = $obj1.attr("more") || "";
var isparent = $obj1.attr("parent") || "";
var root = $obj1.attr("rootid") || "";
var ischild = $obj1.attr("child") || "";
var params = "eid=" + id + "&ismore=" + ismore + "&isparent=" + isparent + "&root=" + root + "&ischild=" + ischild + "&values=" + val;
new RoadUI.Window().open({ id: "dict_" + id, url: top.rootdir + "/Controls/SelectDict/Index?" + params, width: 500, height: 470, resize: false, title: "选择数据字典", openerid: RoadUI.Core.query("tabid") || "" });
});
}
$_member.after($but).before($hide);
});
};
this.setValue = function (objorid)
{
var $obj;
if (typeof (objorid) == "string")
{
$obj = $("#" + objorid);
}
else
{
$obj = $(objorid);
}
if (!$obj || $obj.size() == 0) return;
var value = $obj.val();
$obj.val(value);
if (value && value.length > 0)
{
$.ajax({
url: top.rootdir + "/Controls/SelectDict/GetNames?values=" + value, type: "get", async: false, cache: false, success: function (txt)
{
$obj.next().val(txt);
}
});
}
else
{
$obj.next().val('');
}
};
}