MajorSpecials.cshtml 11 KB

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