LittleKind.cshtml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>LittleKind</title>
  10. <link href="~/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
  11. <link href="~/easyui/themes/icon.css" rel="stylesheet" />
  12. <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
  13. <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
  14. <script src="~/Content/js/jquery.min.js"></script>
  15. <script src="~/Content/js/bootstrap.min.js"></script>
  16. <script src="~/easyui/jquery.easyui.min.js"></script>
  17. <script src="~/easyui/jquery.easyui.mobile.js"></script>
  18. <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
  19. <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
  20. <script src="~/Content/js/plugins/layer/layer.min.js"></script>
  21. <script src="~/js/Utils.js"></script>
  22. <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
  23. <style>
  24. .td_1 {
  25. padding-bottom: 5px;
  26. padding-left: 5px;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <section class="hidden">
  32. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  33. <input id="hid_IsLock" name="IsLock" type="hidden" value="0" />
  34. <input id="hid_MarketType" name="hid_MarketType" type="hidden" value="0" />
  35. </section>
  36. @*<section class="text-center title">
  37. <h2>市场信息</h2>
  38. </section>*@
  39. <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
  40. <div class="row tbToolBar" id="tbToolBar">
  41. <div class="toolbar">
  42. <label>
  43. <input type="checkbox" id="DataToggle"> 显示已删除记录
  44. </label>
  45. </div>
  46. <div class="toolbar" id="CurdTool" style="float:left">
  47. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  48. <span class="shuxian"></span>
  49. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  50. <span class="shuxian"></span>
  51. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
  52. </div>
  53. <div class="col-sm-3" id="ResetTool">
  54. <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
  55. </div>
  56. </div>
  57. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  58. data-options="singleSelect: true,
  59. method: 'post',
  60. multiSort: false,
  61. toolbar: '#tbToolBar',
  62. fitColumns: true,
  63. rownumbers: true,
  64. remoteSort: false,
  65. loadFilter: pagerFilter,
  66. pagination: true,
  67. pageSize: 25,
  68. pageList: [15, 25, 50, 100]
  69. ">
  70. <thead>
  71. <tr>
  72. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  73. <th data-options="field:'LittleKindID',width:50">编号</th>
  74. <th data-options="field:'Name',width:80,">名称</th>
  75. </tr>
  76. </thead>
  77. </table>
  78. </section>
  79. <section>
  80. <div id="winModal" class="easyui-window winModal" title="小类信息维护" style="width: 600px; height: 350px;padding:5px;"
  81. iconCls="icon-save" data-options="modal:true,closed:true">
  82. <div class="easyui-layout" data-options="fit:true" style="height:400px">
  83. <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
  84. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  85. <tr>
  86. <td class="td_1">商品大类</td>
  87. <td class="td_1">
  88. <select id="GreatKindID" class="easyui-combobox" name="GreatKindID" style="width:400px;height:20px">
  89. @Html.Raw(ViewBag.SelGreatKind)
  90. </select>
  91. </td>
  92. </tr>
  93. <tr>
  94. <td class="td_1">商品小类编号</td>
  95. <td class="td_1"><input class="easyui-textbox" type="text" id="LittleKindID" name="LittleKindID" data-options="required:true" style="width:400px;height:20px" /></td>
  96. </tr>
  97. <tr>
  98. <td class="td_1">名称</td>
  99. <td class="td_1"><input class="easyui-textbox" type="text" id="Name" name="Name" style="width:400px;height:20px" /></td>
  100. </tr>
  101. <tr>
  102. <td class="td_1">是否食品类</td>
  103. <td class="td_1">
  104. <select id="IsVeg" class="easyui-combobox" name="IsVeg" style="width:400px;height:20px">
  105. <option value="1">是</option>
  106. <option value="0">否</option>
  107. </select>
  108. </td>
  109. </tr>
  110. <tr>
  111. <td class="td_1">备注</td>
  112. <td class="td_1" >
  113. <textarea id="Remark" rows="4" style="width:467px"></textarea>
  114. </td>
  115. </tr>
  116. </table>
  117. </div>
  118. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  119. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  120. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  121. </div>
  122. </div>
  123. </div>
  124. </section>
  125. <script>
  126. //切换显示不同状态数据
  127. $("#DataToggle").on("click",
  128. function () {
  129. if ($('#hid_IsLock').val() === "0") {
  130. $('#hid_IsLock').val("1");
  131. $("#CurdTool").hide();
  132. $("#ResetTool").show();
  133. } else {
  134. $('#hid_IsLock').val("0");
  135. $("#ResetTool").hide();
  136. $("#CurdTool").show();
  137. }
  138. window.LoadTable();
  139. });
  140. //添加
  141. function btn_Add() {
  142. $("#hid_Type").val("Add");
  143. $("#LittleKindID").textbox('enable');
  144. $("#GreatKindID").combobox('enable');
  145. $("#IsVeg").combobox("setValue",'1');
  146. $("#LittleKindID").textbox("setValue", '');
  147. $("#Name").textbox("setValue", '');
  148. $("#Remark").val('');
  149. $('#winModal').window('open')
  150. }
  151. //修改
  152. function btn_Edit() {
  153. $("#hid_Type").val("Edit");
  154. var row = $('#dgTable').datagrid('getSelected');
  155. if (row) {
  156. $("#LittleKindID").textbox("setValue",row.LittleKindID);
  157. $("#GreatKindID").combobox("setValue",row.GreatKindID);
  158. $("#Name").textbox("setValue",row.Name);
  159. $("#IsVeg").combobox("setValue", row.IsVeg);
  160. $("#Remark").val(row.Remark);
  161. $("#LittleKindID").textbox('disable');
  162. $("#GreatKindID").combobox('disable');
  163. $('#winModal').window('open')
  164. } else {
  165. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  166. }
  167. }
  168. function DelOrRetore(type) {
  169. var LittleKindID = $('#dgTable').datagrid('getSelections')[0].LittleKindID;
  170. if (!LittleKindID) {
  171. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  172. return;
  173. }
  174. if (type == 'Del' || type === "ReDel" ) {
  175. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  176. if (r) {
  177. $.ajax({
  178. url: "@Url.Action("LittleKindListOper", "BaseInfo")",
  179. type: "post",
  180. data: {
  181. Type: type,
  182. LittleKindID: LittleKindID
  183. },
  184. success: function (data) {
  185. if (CheckAajxData(data) == false) {
  186. return;
  187. }
  188. var msg = JSON.parse(data);
  189. if (msg != null && msg.Success == true) {
  190. LoadTable();
  191. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  192. } else {
  193. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  194. }
  195. }
  196. });
  197. }
  198. })
  199. }
  200. }
  201. //提交
  202. function Save(type) {
  203. if ($("#LittleKindID").textbox("getValue").length <= 0) {
  204. layer.alert('小类编号不能为空!', { icon: '2', title: '提示信息' });
  205. return;
  206. }
  207. if ($("#Name").textbox("getValue").length <= 0) {
  208. layer.alert('小类名称不能为空!', { icon: '2', title: '提示信息' });
  209. return;
  210. }
  211. type = type || $("#hid_Type").val();
  212. var LittleKindID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].LittleKindID : "";
  213. $.ajax({
  214. url: "@Url.Action("LittleKindListOper", "BaseInfo")",
  215. type: "post",
  216. data: {
  217. Type: type,
  218. LittleKindID: $("#LittleKindID").textbox("getValue"),
  219. GreatKindID: $("#GreatKindID").combobox("getValue"),
  220. Name: $("#Name").textbox("getValue"),
  221. IsVeg: $("#IsVeg").combobox("getValue"),
  222. Remark:$("#Remark").val()
  223. },
  224. success: function (data) {
  225. if (CheckAajxData(data) == false) {
  226. return;
  227. }
  228. var msg = JSON.parse(data);
  229. if (msg != null && msg.Success == true) {
  230. LoadTable();
  231. $('#winModal').window('close');
  232. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  233. } else {
  234. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  235. }
  236. }
  237. });
  238. }
  239. //modal赋值
  240. function SetModalVal() {
  241. var rows = $('#dgTable').datagrid('getSelections');
  242. if (rows.length === 1) {
  243. var row = rows[0];
  244. //console.log(row);
  245. $("#LittleKindID").val(row.LittleKindID),
  246. $("#GreatKindID").val(row.GreatKindID),
  247. $("#Name").val(row.Name),
  248. $("#modal").modal("show");
  249. } else {
  250. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  251. }
  252. }
  253. //加载表格数据
  254. function LoadTable() {
  255. $('#dgTable').datagrid({
  256. url: '@Url.Action("GetLittleKindList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val(),
  257. onDblClickRow: function () {
  258. if ($('#hid_IsLock').val() === "0") {
  259. btn_Edit();
  260. }
  261. }
  262. });
  263. }
  264. $(function () {
  265. //加载表格数据
  266. window.LoadTable();
  267. //加载日历控件
  268. //laydate({
  269. // elem: '#PractiseTime',
  270. // format: "YYYY-MM-DD",
  271. // min: "1980-01-01",
  272. // event: "focus"
  273. //});
  274. });
  275. </script>
  276. </body>
  277. </html>