123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
-
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width" />
- <title>Habitat</title>
- <link href="~/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
- <link href="~/easyui/themes/icon.css" rel="stylesheet" />
- <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
- <script src="~/Content/js/jquery.min.js"></script>
- <script src="~/Content/js/bootstrap.min.js"></script>
- <script src="~/easyui/jquery.easyui.min.js"></script>
- <script src="~/easyui/jquery.easyui.mobile.js"></script>
- <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
- <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
- <script src="~/Content/js/plugins/layer/layer.min.js"></script>
- <script src="~/js/Utils.js"></script>
- <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
- <style>
- .td_1 {
- padding-bottom: 5px;
- padding-left: 5px;
- }
- </style>
- </head>
- <body>
- <section class="hidden">
- <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
- <input id="hid_IsLock" name="IsLock" type="hidden" value="0" />
- <input id="hid_MarketType" name="hid_MarketType" type="hidden" value="0" />
- </section>
- @*<section class="text-center title">
- <h2>市场信息</h2>
- </section>*@
- <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
- <div class="row tbToolBar" id="tbToolBar">
- <div class="toolbar">
- <label>
- <input type="checkbox" id="DataToggle"> 显示已删除记录
- </label>
- </div>
- <div class="toolbar" id="CurdTool" style="float:left">
-
- <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
- <span class="shuxian"></span>
- <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
- <span class="shuxian"></span>
- <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
- @*<input class="btn btn-primary" id="btn_back" type="button" value="返回" onclick="btn_Back()"/>*@
- </div>
- <div class="col-sm-3" id="ResetTool">
- <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
- </div>
- <div class="toolbar-search">
- <span>【请选择查询条件】</span>
- <input class="easyui-searchbox" data-options="prompt:'请输入查询条件...',menu:'#search',searcher:LoadTable" style="width: 300px;height:25px;" />
- <div id="search">
- <div data-options="name:'Names'">产地名称</div>
- </div>
- </div>
- </div>
- <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
- data-options="singleSelect: true,
- method: 'post',
- multiSort: false,
- toolbar: '#tbToolBar',
- fitColumns: true,
- rownumbers: true,
- remoteSort: false,
- loadFilter: pagerFilter,
-
- pagination: true,
- pageSize: 15,
- pageList: [15, 25, 50, 100]
- ">
- <thead>
- <tr>
- @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
- <th data-options="field:'HabitatID',width:50">产地编号</th>
- <th data-options="field:'Names',width:80,">产地名称</th>
- </tr>
- </thead>
- </table>
- </section>
- <section>
- <div id="winModal" class="easyui-window winModal" title="单位信息维护" style="width: 520px; height: 220px;padding:5px;"
- iconCls="icon-save" data-options="modal:true,closed:true">
- <div class="easyui-layout" data-options="fit:true" style="height:400px">
- <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
- <table cellpadding="10" cellspacing="0" style="margin-left:10px">
- <tr>
- <td class="td_1">产地编号</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="HabitatID" name="HabitatID" data-options="required:true" style="width:400px;height:20px" />
- </td>
-
- </tr>
- <tr>
- <td class="td_1">产地名称</td>
- <td class="td_1"><input class="easyui-textbox" type="text" id="Names" name="Names" data-options="required:true" style="width:400px;height:20px" /></td>
-
- </tr>
- <tr>
-
- </tr>
- <tr>
- <td class="td_1">是否国内</td>
- <td class="td_1">
- <select id="HabitatType" class="easyui-combobox" name="HabitatType" style="width:400px;height:20px">
- <option value="1">国内</option>
- <option value="2">国外</option>
- </select>
- </td>
- </tr>
-
- </table>
- </div>
- <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
- <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
- <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
- </div>
- </div>
- </div>
-
- </section>
- <script>
- //切换显示不同状态数据
- $("#DataToggle").on("click",
- function () {
- if ($('#hid_IsLock').val() === "0") {
- $('#hid_IsLock').val("1");
- $("#CurdTool").hide();
- $("#ResetTool").show();
- } else {
- $('#hid_IsLock').val("0");
- $("#ResetTool").hide();
- $("#CurdTool").show();
- }
- window.LoadTable();
- });
- //添加
- function btn_Add() {
- $("#hid_Type").val("Add");
- $("#HabitatID").textbox('setValue', "");
- $("#HabitatID").textbox('enable')
- $("#Names").textbox('setValue', "");
- $('#winModal').window('open')
- }
- //修改
- function btn_Edit() {
- $("#hid_Type").val("Edit");
- var row = $('#dgTable').datagrid('getSelected');
- if (row) {
- $("#HabitatID").textbox('setValue', row.HabitatID);
- $("#HabitatID").textbox('disable')
- $("#Names").textbox('setValue', row.Names);
- $("#HabitatType").combobox('setValue', row.Type);
- $('#winModal').window('open')
- } else {
- layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
- }
-
- }
- function DelOrRetore(type) {
- var HabitatID = $('#dgTable').datagrid('getSelections')[0].HabitatID;
- if (!HabitatID) {
- layer.alert('请选择一条记录进行设置', { icon:'0',title: '提示信息' });
- return;
- }
- if (type == 'Del' || type === "ReDel") {
- $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
- if (r) {
- $.ajax({
- url: "@Url.Action("HabitatListOper", "BaseInfo")",
- type: "post",
- data: {
- Type: type,
- HabitatID: HabitatID
- },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = JSON.parse(data);
- if (msg != null && msg.Success == true) {
- LoadTable();
- layer.alert("操作成功!", { icon: '1', title: '提示信息' });
- } else {
- layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
- }
- }
- });
- }
- })
- }
- }
- //提交
- function Save(type) {
- if ($("#HabitatID").textbox("getValue").length <= 0) {
- layer.alert('产地编号不能为空!', { icon: '2', title: '提示信息' });
- return;
- }
- if ($("#Names").textbox("getValue").length <= 0) {
- layer.alert('产地名称不能为空!', { icon: '2', title: '提示信息' });
- return;
- }
- type = type || $("#hid_Type").val();
- var HabitatID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].HabitatID : "";
- $.ajax({
- url: "@Url.Action("HabitatListOper", "BaseInfo")",
- type: "post",
- data: {
- Type: type,
- HabitatID: $("#HabitatID").textbox('getValue'),
- Names: $("#Names").textbox('getValue'),
- HabitatType: $('#HabitatType').combobox('getValue')
- },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = JSON.parse(data);
- if (msg != null && msg.Success == true) {
- LoadTable();
- $('#winModal').window('close')
- layer.alert("操作成功!", { icon: '1', title: '提示信息' });
- } else {
- layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
- }
- }
- });
- }
- //modal赋值
- function SetModalVal() {
- var rows = $('#dgTable').datagrid('getSelections');
- if (rows.length === 1) {
- var row = rows[0];
- //console.log(row);
- $("#HabitatID").val(row.HabitatID),
- $("#Names").val(row.Names),
- $("#Sort").val(row.Sort),
-
- $("#modal").modal("show");
- } else {
- layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
- }
- }
- //加载表格数据
- function LoadTable(value, item) {
- $('#dgTable').datagrid({
- url: '@Url.Action("GetHabitatList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val() + '&&' + item + '=' + escape(value),
- onDblClickRow: function () {
- if ($('#hid_IsLock').val() === "0") {
- btn_Edit();
- }
- }
- });
- }
- $(function () {
- //加载表格数据
- var value = $(".textbox.searchbox .textbox-value").val(), item = $(".textbox.searchbox .textbox-value").attr("name");
- window.LoadTable(value, item);
- //加载日历控件
- //laydate({
- // elem: '#PractiseTime',
- // format: "YYYY-MM-DD",
- // min: "1980-01-01",
- // event: "focus"
- //});
- });
- </script>
- </body>
- </html>
|