Specials.cshtml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>SpecialsList</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. </section>
  35. @*<section class="text-center title">
  36. <h2>市场信息</h2>
  37. </section>*@
  38. <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
  39. <div class="row tbToolBar" id="tbToolBar">
  40. <div class="toolbar">
  41. <label>
  42. <input type="checkbox" id="DataToggle"> 显示已删除记录
  43. </label>
  44. </div>
  45. <div class="toolbar" id="CurdTool" style="float:left">
  46. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  47. <span class="shuxian"></span>
  48. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  49. <span class="shuxian"></span>
  50. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
  51. <span class="shuxian"></span>
  52. <a href="#" class="easyui-linkbutton" iconCls="icon-arrow_up" plain="true" onclick="Save('up')">上移</a>
  53. <span class="shuxian"></span>
  54. <a href="#" class="easyui-linkbutton" iconCls="icon-arrow_down" plain="true" onclick="Save('down')">下移</a>
  55. </div>
  56. <div class="col-sm-3" id="ResetTool">
  57. <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
  58. </div>
  59. <div class="col-sm-4" id="SearchTool">
  60. 商品大类:<select id="sGreatKind" name="sGreatKind" onchange="sGreatKind_Change()">@Html.Raw(ViewBag.SelGreatKind)</select>商品小类:
  61. <select id="sLittleKind" name="sLittleKind" onchange="sLittleKind_Change()"></select>
  62. </div>
  63. </div>
  64. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  65. data-options="singleSelect: true,
  66. method: 'post',
  67. multiSort: false,
  68. toolbar: '#tbToolBar',
  69. fitColumns: true,
  70. rownumbers: true,
  71. remoteSort: false,
  72. loadFilter: pagerFilter,
  73. pagination: true,
  74. pageSize: 15,
  75. pageList: [15, 25, 50, 100]
  76. ">
  77. <thead>
  78. <tr>
  79. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  80. <th data-options="field:'SpecialsID',width:50">编号</th>
  81. <th data-options="field:'Name',width:80,">名称</th>
  82. </tr>
  83. </thead>
  84. </table>
  85. </section>
  86. <section>
  87. <div id="winModal" class="easyui-window winModal" title="小类信息维护" style="width: 600px; height: 350px;padding:5px;"
  88. iconCls="icon-save" data-options="modal:true,closed:true">
  89. <div class="easyui-layout" data-options="fit:true" style="height:400px">
  90. <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
  91. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  92. <tr>
  93. <td class="td_1">商品大类</td>
  94. <td class="td_1">
  95. <select id="GreatKindID" name="GreatKindID" style="width:400px;height:20px" onchange="GreatKind_Change()" >
  96. @Html.Raw(ViewBag.SelGreatKind)
  97. </select>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="td_1">商品小类</td>
  102. <td class="td_1">
  103. <select id="LittleKindID" name="LittleKindID" style="width:400px;height:20px">
  104. </select>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="td_1">名称</td>
  109. <td class="td_1"><input class="easyui-textbox" type="text" id="Name" name="Name" style="width:400px;height:20px" /></td>
  110. </tr>
  111. <tr>
  112. <td class="td_1">编号</td>
  113. <td class="td_1">
  114. <input class="easyui-textbox" type="text" id="SpecialsID" name="SpecialsID" style="width:400px;height:20px" />
  115. </td>
  116. </tr>
  117. </table>
  118. </div>
  119. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  120. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  121. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  122. </div>
  123. </div>
  124. </div>
  125. </section>
  126. <script>
  127. //切换显示不同状态数据
  128. $("#DataToggle").on("click",
  129. function () {
  130. if ($('#hid_IsLock').val() === "0") {
  131. $('#hid_IsLock').val("1");
  132. $("#CurdTool").hide();
  133. $("#ResetTool").show();
  134. } else {
  135. $('#hid_IsLock').val("0");
  136. $("#ResetTool").hide();
  137. $("#CurdTool").show();
  138. }
  139. window.LoadTable();
  140. });
  141. //添加
  142. function btn_Add() {
  143. $("#hid_Type").val("Add");
  144. $("#GreatKindID").removeAttr("disabled")
  145. $("#LittleKindID").removeAttr("disabled")
  146. $("#SpecialsID").textbox('enable')
  147. $("#GreatKindID").val($('#sGreatKind').val())
  148. GreatKind_Change();
  149. $("#LittleKindID").val($('#sLittleKind').val())
  150. $("#Name").textbox("setValue", '')
  151. $("#SpecialsID").textbox("setValue", '')
  152. $('#winModal').window('open');
  153. }
  154. //修改
  155. function btn_Edit() {
  156. $("#hid_Type").val("Edit");
  157. var row = $('#dgTable').datagrid('getSelected');
  158. if (row) {
  159. $("#GreatKindID").val($('#sGreatKind').val());
  160. GreatKind_Change();
  161. $("#LittleKindID").val(row.LittleKindID)
  162. $("#Name").textbox("setValue", row.Name);
  163. $("#SpecialsID").textbox("setValue", row.SpecialsID);
  164. $("#GreatKindID").attr("disabled", "disabled")
  165. $("#LittleKindID").attr("disabled", "disabled")
  166. $("#SpecialsID").textbox('disable')
  167. $('#winModal').window('open');
  168. }
  169. }
  170. function DelOrRetore(type) {
  171. var SpecialsID = $('#dgTable').datagrid('getSelections')[0].SpecialsID;
  172. if (!SpecialsID) {
  173. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  174. return;
  175. }
  176. if (type == 'Del' || type === "ReDel" ) {
  177. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  178. if (r) {
  179. $.ajax({
  180. url: "@Url.Action("SpecialsListOper", "BaseInfo")",
  181. type: "post",
  182. data: {
  183. Type: type,
  184. SpecialsID: SpecialsID
  185. },
  186. success: function (data) {
  187. if (CheckAajxData(data) == false) {
  188. return;
  189. }
  190. var msg = JSON.parse(data);
  191. if (msg != null && msg.Success == true) {
  192. LoadTable();
  193. layer.alert("操作成功!", { title: '提示信息' });
  194. } else {
  195. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  196. }
  197. }
  198. });
  199. }
  200. })
  201. }
  202. }
  203. //提交
  204. function Save(type) {
  205. type = type || $("#hid_Type").val();
  206. if (type === "Edit" || type === "Add") {
  207. if ($("#SpecialsID").textbox('getValue').length <= 0) {
  208. $.messager.alert('提示', '编号不能为空!', 'error');
  209. return;
  210. }
  211. if ($("#LittleKindID").val().length <= 0) {
  212. $.messager.alert('提示', '小类不能为空!', 'error');
  213. return;
  214. }
  215. }
  216. var SpecialsID = (type === "Edit" || type === "up" || type === "down") ? $('#dgTable').datagrid('getSelections')[0].SpecialsID : $("#SpecialsID").textbox('getValue');
  217. $.ajax({
  218. url: "@Url.Action("SpecialsListOper", "BaseInfo")",
  219. type: "post",
  220. data: {
  221. Type: type,
  222. LittleKindID: $("#LittleKindID").val(),
  223. SpecialsID: SpecialsID,
  224. Name: $("#Name").textbox('getValue')
  225. },
  226. success: function (data) {
  227. if (CheckAajxData(data) == false) {
  228. return;
  229. }
  230. var msg = JSON.parse(data);
  231. if (msg != null && msg.Success == true) {
  232. LoadTable();
  233. $('#winModal').window('close');
  234. layer.alert("操作成功!", { title: '提示信息' });
  235. } else {
  236. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  237. }
  238. }
  239. });
  240. }
  241. //modal赋值
  242. function SetModalVal() {
  243. var rows = $('#dgTable').datagrid('getSelections');
  244. if (rows.length === 1) {
  245. var row = rows[0];
  246. //console.log(row);
  247. $("#LittleKindID").val(row.LittleKindID),
  248. $("#SortNumber").val(row.SortNumber),
  249. $("#SpecialsID").val(row.SpecialsID),
  250. $("#Name").val(row.Name),
  251. $("#modal").modal("show");
  252. } else {
  253. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  254. }
  255. }
  256. //加载表格数据
  257. function LoadTable() {
  258. $('#dgTable').datagrid({
  259. url: '@Url.Action("GetSpecialsList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val() + '&&LittleKindID=' + $("#sLittleKind").val(),
  260. onDblClickRow: function () {
  261. btn_Edit();
  262. }
  263. });
  264. }
  265. function sGreatKind_Change(){
  266. $("#sLittleKind").empty();
  267. $.ajax({
  268. url: "@Url.Action("GetLittleKindByGreatKindId", "BaseInfo")",
  269. type: "post",
  270. dataType:'json',
  271. data: {
  272. GreatKindID: $('#sGreatKind').val()
  273. },
  274. success: function (msg) {
  275. if (CheckAajxData(msg) == false) {
  276. return;
  277. }
  278. var option = "";
  279. for(var j =0;j < msg.length; j++)
  280. {
  281. $("#sLittleKind").append("<option value=\"" + msg[j].LittleKindID + "\">" + msg[j].Name + "</option>");
  282. }
  283. sLittleKind_Change();
  284. }
  285. })
  286. }
  287. function sLittleKind_Change(){
  288. LoadTable();
  289. }
  290. function GreatKind_Change() {
  291. $("#LittleKindID").empty();
  292. $.ajax({
  293. url: "@Url.Action("GetLittleKindByGreatKindId", "BaseInfo")",
  294. type: "post",
  295. dataType: 'json',
  296. data: {
  297. GreatKindID: $('#GreatKindID').val()
  298. },
  299. success: function (msg) {
  300. if (CheckAajxData(msg) == false) {
  301. return;
  302. }
  303. var option = "";
  304. for (var j = 0; j < msg.length; j++) {
  305. $("#LittleKindID").append("<option value=\"" + msg[j].LittleKindID + "\">" + msg[j].Name + "</option>");
  306. }
  307. }
  308. })
  309. }
  310. $(function () {
  311. //加载表格数据
  312. window.LoadTable();
  313. //加载日历控件
  314. //laydate({
  315. // elem: '#PractiseTime',
  316. // format: "YYYY-MM-DD",
  317. // min: "1980-01-01",
  318. // event: "focus"
  319. //});
  320. sGreatKind_Change();
  321. GreatKind_Change();
  322. });
  323. </script>
  324. </body>
  325. </html>