123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
-
- @{
- ViewBag.Title = "AddClass";
- Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
- }
- <script src="~/Content/Scripts/Common.js"></script>
- <div class="easyui-layout" data-options="fit:true">
- <table class="layui-table">
- <colgroup>
- <col width="80">
- <col>
- </colgroup>
- <tr>
- <td><label class="layui-form-label"> 类型:</label></td>
- <td>
- <input class="easyui-combobox" id="LX" style="width:300px;" disabled >
- </td>
- </tr>
-
- <tr>
- <td><label class="layui-form-label">上级分类</label></td>
- <td>
- <input id="parentid" name="parentid" class="easyui-combotree" data-options="width:300,panelWidth:'300px'" panelheight="200px">
- </td>
- </tr>
- <tr>
- <td><label class="layui-form-label">名称</label></td>
- <td><input class="easyui-textbox" id="name" name="name" required="required" data-options="prompt:'分类名称',width:300"></td>
- </tr>
- </table>
- <div data-options="region:'south',border:false" style="height:50px;text-align:right; padding:5px">
- <button type="button" class="layui-btn layui-btn-normal" id="save">确定</button>
- <button type="button" class="layui-btn layui-btn-primary" id="cancel">取消</button>
- </div>
- <input type="hidden" id="ID" name="ID" value="" />
- </div>
- <script type="text/javascript">
- var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
- var ThisUrl = decodeURI(window.location.href);
- var id = PublicFun.getQueryValue(ThisUrl, "id");
- var type = PublicFun.getQueryValue(ThisUrl, "type");//1新增2修改
- var name = PublicFun.getQueryValue(ThisUrl, "name");
- var lx = PublicFun.getQueryValue(ThisUrl, "lx");//类型
- $(function () {
- if (type == 2) {//修改
- $('#ID').val(id);
- $("#parentid").combotree("setValue", id);
- $("#name").textbox('setValue', name);
- }
-
- $("#parentid").combotree({
- lines: true,
- animate: true,
- method: "post",
- idField: 'id',
- treeField: 'text',
- url: '/MedicalRecordManager/GetCategory?类型=' + lx,
- loadFilter: function (data, parent) {
- //无数据则显示为叶子节点
- if (parent && data.length == 0) {
- var node = $(this).tree("getSelected");
- if (node) {
- $(this).tree("update", {
- target: node.target,
- state: "open",
- iconCls: "icon-file"
- });
- }
- }
- if (data) {
- return eval(data);
- }
- },
- onLoadSuccess: function (node, data) {
- var tree = $("#parentid").combotree("tree");
- var node = tree.tree('getRoot');
- if (node.text != "无") {
- $(this).tree("insert", {
- before: node.target,
- data: [{
- id: '0',
- text: '无',
- state: "open",
- iconCls: "icon-file"
- }]
- });
- }
- $(this).tree("select", node.id);
- },
- onSelect: function (node) {
- if (node) {
- var t = $("#parentid").combotree('tree').tree("getSelected");
- $("#parentid").combotree("setValue", t.id);
- }
- }
- });
- /* $('#parentid').combotree('setValue', { id: id});*/
- $('#save').click(function () {
- var parentid = $("#parentid").val();
- var name = $("#name").val();
- var params = { 上级ID: parentid, 名称: name, 类型: $('#LX').combobox('getValue'), type: type };
- if (type == 2) //修改
- {
- params = { 上级ID: parentid, 名称: name, 类型: $('#LX').combobox('getValue'), type: type, ID: id };
- }
- if (params.名称 == "") {
- top.ZLPMS.Msg("名称不能为空");
- return
- }
- $.post("/MedicalRecordManager/AddUpdateCategory", params, function (data) {
- if (data.code == 200) {
- top.ZLPMS.Msg(data.msg);
- ZLPMS.CloseTopWindow(true, index);
- }
- else {
- top.ZLPMS.Msg("添加失败,请联系管理员");
- }
- })
- });
- $('#cancel').click(function () {
- top.ZLPMS.CloseWindow(index);
- });
- $("#LX").combobox({
- data: [{ ID: "1", MC: "个人" }, { ID: "2", MC: "渠道" }, { ID: "3", MC: "总部" }],
- valueField: "ID",
- textField: "MC",
- onSelect: function (data) {
- },
- onLoadSuccess: function () {
-
- $('#LX').combobox('setValue', lx);
- }
- });
- })
- </script>
|