SpecialsMapping.cshtml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>SpecialsMapping</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. @*<input class="btn btn-primary" id="btn_back" type="button" value="返回" onclick="btn_Back()"/>*@
  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 class="toolbar-search">
  58. <div id="Search" class="easyui-panel" title="请展开面板输入查询条件" style="width: 300px; height: 330px; padding: 10px;"
  59. data-options="iconCls:'icon-heart',collapsible:true,minimizable:false,maximizable:false,closable:false,collapsed:true,tools:[
  60. {
  61. iconCls:'icon-search',
  62. handler:function(){LoadTable(true)}
  63. }]">
  64. <table>
  65. <tr>
  66. <td><label for="txtUserID">商品小类名</label></td>
  67. <td>
  68. <input type="text" class="easyui-textbox" id="sLittleKindID" name="sLittleKindID" style="height: 25px; width: 150px" />
  69. </td>
  70. </tr>
  71. <tr>
  72. <td><label for="SearchStartTime">商品</label></td>
  73. <td><input class="easyui-textbox" type="text" id="sName" name="sName" style="height: 25px; width: 150px" /></td>
  74. </tr>
  75. <tr>
  76. <td colspan="2" style="text-align: center; width: 100%">
  77. <a href="#" class="easyui-linkbutton" iconCls="icon-search" style="width: 100%; height: 25px" onclick="LoadTable(true);">查询</a>
  78. </td>
  79. </tr>
  80. </table>
  81. </div>
  82. </div>
  83. </div>
  84. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  85. data-options="singleSelect: true,
  86. method: 'post',
  87. multiSort: false,
  88. toolbar: '#tbToolBar',
  89. fitColumns: true,
  90. rownumbers: true,
  91. remoteSort: false,
  92. loadFilter: pagerFilter,
  93. pagination: true,
  94. pageSize: 50,
  95. pageList: [15, 25, 50, 100]
  96. ">
  97. <thead>
  98. <tr>
  99. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  100. <th data-options="field:'LittleKindID',width:50">小类编号</th>
  101. <th data-options="field:'LittleKindName',width:80,">小类名称</th>
  102. <th data-options="field:'SpecialsID',width:50">商品ID</th>
  103. <th data-options="field:'Name',width:80,">商品名称</th>
  104. <th data-options="field:'szLittleKindCode',width:50">映射小类代码</th>
  105. <th data-options="field:'szMappingContent',width:80,">映射小类名称</th>
  106. </tr>
  107. </thead>
  108. </table>
  109. </section>
  110. <section>
  111. <div id="winModal" class="easyui-window winModal" title="单位信息维护" style="width: 550px; height: 300px;padding:5px;"
  112. iconCls="icon-save" data-options="modal:true,closed:true">
  113. <div class="easyui-layout" data-options="fit:true" style="height:400px">
  114. <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
  115. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  116. <tr>
  117. <td class="td_1">商品小类</td>
  118. <td class="td_1">
  119. <select id="LittleKindID" name="LittleKindID" style="width:400px;height:20px" onchange="LittleKind_Change()">
  120. @Html.Raw(ViewBag.SelLittltKind)
  121. </select>
  122. </td>
  123. </tr>
  124. <tr>
  125. <td class="td_1">商品</td>
  126. <td class="td_1">
  127. <select id="SpecialsID" name="SpecialsID" style="width:400px;height:20px">
  128. </select>
  129. </td>
  130. </tr>
  131. <tr></tr>
  132. <tr>
  133. <td class="td_1">映射苏州代码</td>
  134. <td class="td_1">
  135. <input class="easyui-textbox" type="text" id="szLittleKindCode" name="szLittleKindCode" data-options="required:true" style="width:400px;height:20px" />
  136. </td>
  137. </tr>
  138. <tr>
  139. <td class="td_1">映射内容</td>
  140. <td class="td_1">
  141. <input class="easyui-textbox" type="text" id="szMappingContent" name="szMappingContent" data-options="required:true" style="width:400px;height:20px" />
  142. </td>
  143. </tr>
  144. </table>
  145. </div>
  146. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  147. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  148. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  149. </div>
  150. </div>
  151. </div>
  152. </section>
  153. <script>
  154. //切换显示不同状态数据
  155. //$("#DataToggle").on("click",
  156. // function () {
  157. // if ($('#hid_IsLock').val() === "0") {
  158. // $('#hid_IsLock').val("1");
  159. // $("#CurdTool").hide();
  160. // $("#ResetTool").show();
  161. // } else {
  162. // $('#hid_IsLock').val("0");
  163. // $("#ResetTool").hide();
  164. // $("#CurdTool").show();
  165. // }
  166. // window.LoadTable();
  167. // });
  168. //添加
  169. function btn_Add() {
  170. $("#hid_Type").val("Add");
  171. $("#szLittleKindCode").textbox('setValue', "");
  172. $("#szMappingContent").textbox('setValue', "");
  173. $('#winModal').window('open')
  174. }
  175. //修改
  176. function btn_Edit() {
  177. $("#hid_Type").val("Edit");
  178. var row = $('#dgTable').datagrid('getSelected');
  179. if (row) {
  180. $("#LittleKindID").val( row.LittleKindID);
  181. LittleKind_Change();
  182. $("#szLittleKindCode").textbox('setValue', row.szLittleKindCode);
  183. $("#szMappingContent").textbox('setValue', row.szMappingContent);
  184. $("#SpecialsID").val(row.SpecialsID);
  185. $('#winModal').window('open')
  186. } else {
  187. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  188. }
  189. }
  190. function DelOrRetore(type) {
  191. var SpecialsMappingID = $('#dgTable').datagrid('getSelections')[0].SpecialsMappingID;
  192. if (!SpecialsMappingID) {
  193. layer.alert('请选择一条记录进行设置', { icon:'0',title: '提示信息' });
  194. return;
  195. }
  196. if (type == 'Del' || type === "ReDel") {
  197. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  198. if (r) {
  199. $.ajax({
  200. url: "@Url.Action("SpecialsMappingOper", "BaseInfo")",
  201. type: "post",
  202. data: {
  203. Type: type,
  204. SpecialsMappingID: SpecialsMappingID
  205. },
  206. success: function (data) {
  207. if (CheckAajxData(data) == false) {
  208. return;
  209. }
  210. var msg = JSON.parse(data);
  211. if (msg != null && msg.Success == true) {
  212. LoadTable();
  213. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  214. } else {
  215. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  216. }
  217. }
  218. });
  219. }
  220. })
  221. }
  222. }
  223. //提交
  224. function Save(type) {
  225. if ($("#szLittleKindCode").textbox("getValue").length <= 0) {
  226. layer.alert('苏州小类编号不能为空!', { icon: '2', title: '提示信息' });
  227. return;
  228. }
  229. if ($("#szMappingContent").textbox("getValue").length <= 0) {
  230. layer.alert('映射内容不能为空!', { icon: '2', title: '提示信息' });
  231. return;
  232. }
  233. type = type || $("#hid_Type").val();
  234. var SpecialsMappingID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].SpecialsMappingID : "";
  235. $.ajax({
  236. url: "@Url.Action("SpecialsMappingOper", "BaseInfo")",
  237. type: "post",
  238. data: {
  239. Type: type,
  240. SpecialsID: $("#SpecialsID").val(),
  241. LittleKindID: $("#LittleKindID").val(),
  242. szLittleKindCode: $("#szLittleKindCode").textbox('getValue'),
  243. szMappingContent: $('#szMappingContent').textbox('getValue'),
  244. SpecialsMappingID: SpecialsMappingID
  245. },
  246. success: function (data) {
  247. if (CheckAajxData(data) == false) {
  248. return;
  249. }
  250. var msg = JSON.parse(data);
  251. if (msg != null && msg.Success == true) {
  252. LoadTable();
  253. $('#winModal').window('close')
  254. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  255. } else {
  256. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  257. }
  258. }
  259. });
  260. }
  261. //加载表格数据
  262. function LoadTable() {
  263. $('#dgTable').datagrid({
  264. url: '@Url.Action("GetSpecialsMappingList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val() + '&&LittleKindID=' + $('#sLittleKindID').textbox('getValue') + '&&Name=' + escape($('#sName').textbox('getValue')),
  265. onDblClickRow: function () {
  266. if ($('#hid_IsLock').val() === "0") {
  267. btn_Edit();
  268. }
  269. }
  270. });
  271. }
  272. function LittleKind_Change(){
  273. $("#SpecialsID").empty();
  274. $.ajax({
  275. url: "@Url.Action("GetSpecialsByLittltKind", "BaseInfo")",
  276. type: "post",
  277. dataType:'json',
  278. data: {
  279. LittleKindID: $('#LittleKindID').val()
  280. },
  281. success: function (msg) {
  282. if (CheckAajxData(msg) == false) {
  283. return;
  284. }
  285. var option = "";
  286. for(var j =0;j < msg.length; j++)
  287. {
  288. $("#SpecialsID").append("<option value=\"" + msg[j].SpecialsID + "\">" + msg[j].Name + "</option>");
  289. }
  290. var row = $('#dgTable').datagrid('getSelected');
  291. if (row) {
  292. $("#SpecialsID").val(row.SpecialsID);
  293. }
  294. }
  295. })
  296. }
  297. $(function () {
  298. //加载表格数据
  299. window.LoadTable();
  300. //加载日历控件
  301. //laydate({
  302. // elem: '#PractiseTime',
  303. // format: "YYYY-MM-DD",
  304. // min: "1980-01-01",
  305. // event: "focus"
  306. //});
  307. LittleKind_Change();
  308. });
  309. </script>
  310. </body>
  311. </html>