NameBrandList.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>NameBrandList</title>
  10. <link href="~/easyui/themes/default/easyui.css" rel="stylesheet" />
  11. <link rel="stylesheet" type="text/css" href="~/easyui/themes/icon.css" />
  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="~/Content/js/plugins/validate/jquery.validate.min.js"></script>
  22. <script src="~/Content/js/plugins/validate/messages_zh.min.js"></script>
  23. <script src="~/js/Utils.js"></script>
  24. <script src="~/Content/plugins/ajaxFileUpload/ajaxFileUpload-M.js"></script>
  25. <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
  26. <script src="~/Content/js/js/MarketJs.js"></script>
  27. </head>
  28. <body >
  29. <section class="hidden">
  30. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  31. <input id="hid_Type_Attach" name="hid_Type" type="hidden" value="0" />
  32. </section>
  33. <section style="height:95vh; padding: 10px 20px;">
  34. <div class="row tbToolBar" id="tbToolBar">
  35. @*<div class="toolbar">
  36. <label>
  37. <input type="checkbox" id="DataToggle"> 显示已删除记录
  38. <span class="shuxian"></span>
  39. </label>
  40. </div>*@
  41. <div class="toolbar" id="CurdTool">
  42. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  43. <span class="shuxian"></span>
  44. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  45. <span class="shuxian"></span>
  46. <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="btn_Del()">删除</a>
  47. <span class="shuxian"></span>
  48. <a href="#" class="easyui-linkbutton" iconCls="icon-link" plain="true" onclick="btn_Attach()">附件</a>
  49. </div>
  50. <div class="toolbar-search">
  51. <span>【请选择查询条件】</span>
  52. <input class="easyui-searchbox" data-options="prompt:'请输入查询条件...',menu:'#search',searcher:LoadTable" style="width: 300px; height: 25px;"/>
  53. <div id="search">
  54. <div data-options="name:'NameBrandName'">品牌名称</div>
  55. <div data-options="name:'MarketName'">市场名称</div>
  56. <div data-options="name:'FoodName'">商品名</div>
  57. <div data-options="name:'NBByPerson'">品牌持有人</div>
  58. </div>
  59. </div>
  60. </div>
  61. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  62. data-options="singleSelect: true,
  63. method: 'post',
  64. multiSort: false,
  65. toolbar: '#tbToolBar',
  66. fitColumns: true,
  67. @*rownumbers: true,*@
  68. remoteSort: false,
  69. @*loadFilter: pagerFilter,*@
  70. onDblClickRow: function () {
  71. btn_Edit();
  72. },
  73. pagination: true,
  74. pageSize: 50,
  75. pageList: [20, 50, 100]
  76. ">
  77. <thead>
  78. <tr>
  79. <th data-options="field:'NameBrandName',width:150">品牌名称</th>
  80. <th data-options="field:'MarketName',width:150">市场名称</th>
  81. <th data-options="field:'FoodName',width:120,">商品名</th>
  82. <th data-options="field:'NBByPerson',width:90,">品牌持有人</th>
  83. </tr>
  84. </thead>
  85. </table>
  86. </section>
  87. <section>
  88. <div id="winModal" class="easyui-window winModal" title="品牌管理维护" style="width: 450px;padding:10px;"
  89. iconCls="icon-save" data-options="modal:true,closed:true">
  90. <div class="easyui-layout" data-options="fit:true" style="height:99%">
  91. <div data-options="region:'center'" style="padding:15px 5px 5px;" >
  92. <form id="form">
  93. @Html.Hidden("NameBrandID")
  94. <div class="panle-fluid">
  95. <div class="input-group">
  96. <label class="input-group-addon control-label" for="NameBrandName">品牌名称</label>
  97. <input class="form-control input-group-addon required" aria-disabled="true" name="NameBrandName" id="NameBrandName" type="text" value="" placeholder=""/>
  98. <strong class="text-requird input-group-addon control-label">*</strong>
  99. </div>
  100. <div class="input-group">
  101. <label class="input-group-addon control-label" for="NBByPerson">品牌持有人</label>
  102. <input class="form-control input-group-addon required" aria-disabled="true" name="NBByPerson" id="NBByPerson" type="text" value="" placeholder=""/>
  103. <strong class="text-requird input-group-addon control-label">*</strong>
  104. </div>
  105. <div class="input-group">
  106. <label class="input-group-addon control-label" for="MarketManager">直接主管人</label>
  107. <input class="form-control input-group-addon required" aria-disabled="true" name="MarketManager" id="MarketManager" type="text" value="" placeholder=""/>
  108. <strong class="text-requird input-group-addon control-label">*</strong>
  109. </div>
  110. <div class="input-group">
  111. <label class="input-group-addon control-label" for="yjzhizhao">经营执照</label>
  112. <input class="form-control input-group-addon required" aria-disabled="true" name="yjzhizhao" id="yjzhizhao" type="text" value="" placeholder=""/>
  113. <strong class="text-requird input-group-addon control-label">*</strong>
  114. </div>
  115. <div class="input-group">
  116. <label class="input-group-addon control-label" for="FoodName">商品名称</label>
  117. <input class="form-control input-group-addon required" aria-disabled="true" name="FoodName" id="FoodName" type="text" value="" placeholder=""/>
  118. <strong class="text-requird input-group-addon control-label">*</strong>
  119. </div>
  120. <div class="input-group">
  121. <label class="input-group-addon control-label" for="NBByPersonLinks">联系方式</label>
  122. <input class="form-control input-group-addon" aria-disabled="true" name="NBByPersonLinks" id="NBByPersonLinks" type="text" value="" placeholder=""/>
  123. </div>
  124. <div class="input-group">
  125. <label class="input-group-addon control-label" for="MarketId">所属市场</label>
  126. <select class="form-control input-group-addon required" aria-disabled="true" name="MarketId" id="MarketId" type="text" value="" placeholder="选择所属市场">
  127. @Html.Raw(ViewBag.SelMarketInfo)
  128. </select>
  129. <strong class="text-requird input-group-addon control-label">*</strong>
  130. </div>
  131. <div class="input-group">
  132. <label class="input-group-addon control-label" for="pinpaizhengshu">品牌证书</label>
  133. <input class="form-control input-group-addon" aria-disabled="true" name="pinpaizhengshu" id="pinpaizhengshu" type="text" value="" placeholder=""/>
  134. </div>
  135. <div class="input-group">
  136. <label class="input-group-addon control-label" for="Description">品牌其他描述</label>
  137. <textarea class="form-control input-group-addon" aria-disabled="true" rows="5" name="Description" id="Description" type="text" value="" placeholder="" ></textarea>
  138. </div>
  139. </div>
  140. </form>
  141. </div>
  142. <div data-options="region:'south',border:false" style="text-align:right;height:45px; padding:13px 20px 0;">
  143. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  144. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  145. </div>
  146. </div>
  147. </div>
  148. <div id="winModal_Attach" class="easyui-window winModal" title="附件维护" style="width: 450px;padding:10px;"
  149. iconCls="icon-save" data-options="modal:true,closed:true">
  150. <div class="easyui-layout" data-options="fit:true" style="height:99%">
  151. <div data-options="region:'center'" style="padding:15px 5px 5px;">
  152. <div class="panle-fluid">
  153. <div class="input-group">
  154. <label class="input-group-addon control-label" for="AttachFile">上传附件</label>
  155. <input class="form-control input-group-addon" aria-disabled="true" name="AttachFile" id="AttachFile" type="file" value="" placeholder="" onblur="CheckFileSize('AttachFile')"/>
  156. </div>
  157. <div class="input-group">
  158. <label class="input-group-addon control-label" for="FileTitle">附件名称</label>
  159. <input class="form-control input-group-addon" aria-disabled="true" name="FileTitle" id="FileTitle" type="text" value="" placeholder="" />
  160. </div>
  161. <div class="input-group">
  162. <label class="input-group-addon control-label" for="Description_Attach">备注信息</label>
  163. <textarea class="form-control input-group-addon" aria-disabled="true" name="Description_Attach" id="Description_Attach" type="text" value="" placeholder="" ></textarea>
  164. </div>
  165. <div class="input-group" style="margin:20px auto 10px">
  166. <input class="btn btn-default" aria-disabled="true" name="" id="Save_Attach" type="button" value="确认上传附件" placeholder="" onclick="Save_Attach('Add')"/>
  167. </div>
  168. </div>
  169. <div class="panle-fluid">
  170. <div class="row tbToolBar" id="tbToolBar_Attach" style="padding-left:0;">
  171. <div class="toolbar">
  172. <a href="#" class="easyui-linkbutton" iconCls="icon-link_go" plain="true" onclick="btn_Look()">查看</a>
  173. <span class="shuxian"></span>
  174. <a href="#" class="easyui-linkbutton" iconCls="icon-link_delete" plain="true" onclick="btn_Del_Attach()">删除</a>
  175. </div>
  176. </div>
  177. <table id="dgTable_Attach" class="easyui-datagrid" style="width:100%; height: 170px;"
  178. data-options="singleSelect: true,
  179. method: 'post',
  180. multiSort: false,
  181. toolbar: '#tbToolBar_Attach',
  182. fitColumns: true,
  183. @*rownumbers: true,*@
  184. remoteSort: false,
  185. @*loadFilter: pagerFilter,*@
  186. onDblClickRow: function () {
  187. btn_Look();
  188. },
  189. pagination: false,
  190. pageSize: 50,
  191. pageList: [20, 50, 100]
  192. ">
  193. <thead>
  194. <tr>
  195. <th data-options="field:'FileTitle',width:100">附件标题</th>
  196. <th data-options="field:'FileExt',width:60,">扩展名</th>
  197. <th data-options="field:'TimeLastMod',width:90,">上传日期</th>
  198. </tr>
  199. </thead>
  200. </table>
  201. </div>
  202. </div>
  203. <div data-options="region:'south',border:false" style="text-align:right;height:45px; padding:13px 20px 0;">
  204. @*<a class="easyui-linkbutton" id="Save_Attach" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save_Attach()" style="width:80px">确认</a>*@
  205. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal_Attach').window('close');" style="width:80px">取消</a>
  206. </div>
  207. </div>
  208. </div>
  209. </section>
  210. <script>
  211. function Save(type) {
  212. type = type || $("#hid_Type").val();
  213. var nameBrandId = (type === "Add" || type === "Edit") ? $("#NameBrandID").val() : $('#dgTable').datagrid('getSelections')[0].NameBrandID;
  214. $.ajax({
  215. url: "@Url.Action("NameBrandOper", "MarketSystem")",
  216. type: "post",
  217. dataType: "json",
  218. beforeSend: function () {
  219. return BeforeSend();
  220. },
  221. data: {
  222. Type: type,
  223. NameBrandID: nameBrandId,
  224. NameBrandName: $("#NameBrandName").val(),
  225. NBByPerson: $("#NBByPerson").val(),
  226. MarketManager: $("#MarketManager").val(),
  227. yjzhizhao: $("#yjzhizhao").val(),
  228. FoodName: $("#FoodName").val(),
  229. NBByPersonLinks: $("#NBByPersonLinks").val(),
  230. MarketId: $("#MarketId").val(),
  231. pinpaizhengshu: $("#pinpaizhengshu").val(),
  232. Description: $("#Description").val()
  233. },
  234. success: function (data) {
  235. if (CheckAajxData(data) === false) return;
  236. var msg = data.ErrorInfo;
  237. if (data.Success === true) {
  238. LoadTable();
  239. layer.alert(msg, { icon: 1, title: '提示信息' });
  240. } else {
  241. layer.alert(msg, { icon: 7, title: '提示信息' });
  242. }
  243. }
  244. });
  245. }
  246. function Save_Attach(type) {
  247. type = type || $("#hid_Type_Attach").val();
  248. $.ajaxFileUpload({
  249. url: "@Url.Action("AttachFileUpdate", "MarketSystem")",
  250. secureuri: false, //一般设置为false
  251. fileElementId: 'AttachFile', //文件上传控件的Id <input type="file" id="fileUpload" name="file" />
  252. type: "post",
  253. dataType: "json",
  254. data: {
  255. Type: type,
  256. UploadFile: "true",
  257. TableId :"NameBrands",
  258. ColumnId: "NameBrandID",
  259. SourceKey:$('#dgTable').datagrid('getSelections')[0].NameBrandID,
  260. FileTitle:$("#FileTitle").val(),
  261. Description: $("#Description_Attach").val()
  262. },
  263. success: function (data) {
  264. if (CheckAajxData(data) === false) return;
  265. var msg = data.ErrorInfo;
  266. if (data.Success === true) {
  267. LoadTable_Attach();
  268. layer.alert(msg, { icon: 1, title: '提示信息' });
  269. } else {
  270. LoadTable_Attach();
  271. layer.alert(msg, { icon: 7, title: '提示信息' });
  272. }
  273. }
  274. });
  275. }
  276. //添加
  277. function btn_Add() {
  278. $("#hid_Type").val("Add");
  279. $("#winModal input").val("");
  280. $("#winModal textarea").val("");
  281. $("#Save span.l-btn-text").html("添加");
  282. $("#winModal").window("open");
  283. }
  284. function btn_Look() {
  285. var rows = $('#dgTable_Attach').datagrid('getSelections');
  286. if (rows.length === 1) {
  287. var row = rows[0];
  288. var path = "../" + row.FilePath + "/" + row.FileName;
  289. //window.location.href = path;
  290. window.open(path);
  291. } else {
  292. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  293. }
  294. }
  295. function btn_Del_Attach() {
  296. $("#hid_Type_Attach").val("Del");
  297. var rows = $('#dgTable_Attach').datagrid('getSelections');
  298. if (rows.length === 1) {
  299. layer.confirm("您确定删除这条记录吗?", { icon: 3, title: '提示信息' },
  300. function (index) {
  301. SetModalVal_Attach();
  302. Save_Attach("Del");
  303. layer.close(index);
  304. });
  305. } else {
  306. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  307. }
  308. }
  309. //修改
  310. function btn_Edit() {
  311. $("#hid_Type").val("Edit");
  312. $("#Save span.l-btn-text").html("修改");
  313. SetModalVal();
  314. }
  315. function btn_Edit_Attach() {
  316. $("#hid_Type").val("Edit");
  317. $("#Save_Attach").html("修改");
  318. SetModalVal_Attach();
  319. }
  320. //附件
  321. function btn_Attach() {
  322. SetModalVal_Attach();
  323. }
  324. //modal赋值
  325. function SetModalVal() {
  326. var rows = $('#dgTable').datagrid('getSelections');
  327. if (rows.length === 1) {
  328. var row = rows[0];
  329. //console.log(row);
  330. $("#NameBrandID").val(row.NameBrandID);
  331. $("#NameBrandName").val(row.NameBrandName);
  332. $("#NBByPerson").val(row.NBByPerson);
  333. $("#MarketManager").val(row.MarketManager);
  334. $("#yjzhizhao").val(row.yjzhizhao);
  335. $("#FoodName").val(row.FoodName);
  336. $("#NBByPersonLinks").val(row.NBByPersonLinks);
  337. $("#MarketId").val(row.MarketId);
  338. $("#pinpaizhengshu").val(row.pinpaizhengshu);
  339. $("#Description").val(row.Description);
  340. if ($("#hid_Type").val()==="Edit") {
  341. $("#winModal").window("open");
  342. }
  343. } else {
  344. layer.alert('请选择一条记录进行设置', {title:'提示信息'});
  345. }
  346. }
  347. function SetModalVal_Attach() {
  348. var rows = $('#dgTable').datagrid('getSelections');
  349. if (rows.length === 1) {
  350. var row = rows[0];
  351. //console.log(row);
  352. $("#NameBrandID").val(row.NameBrandID);
  353. LoadTable_Attach();
  354. $("#winModal_Attach").window("open");
  355. } else {
  356. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  357. }
  358. }
  359. //加载表格数据
  360. function LoadTable(value, item) {
  361. $('#dgTable').datagrid({
  362. url: '@Url.Action("NameBrandListResult", "GetResult")' + '?PcVal=' + escape(value) + '&PcItem=' + item
  363. });
  364. }
  365. function LoadTable_Attach() {
  366. $('#dgTable_Attach').datagrid({
  367. url: '@Url.Action("NameBrandAttachResult", "GetResult")' + '?SourceKey=' + $('#dgTable').datagrid('getSelections')[0].NameBrandID
  368. });
  369. }
  370. $(function () {
  371. //加载表格数据
  372. var value = $(".textbox.searchbox .textbox-value").val(), item = $(".textbox.searchbox .textbox-value").attr("name");
  373. LoadTable(value, item);
  374. //加载日历控件
  375. //laydate({
  376. // elem: '#PractiseTime',
  377. // format: "YYYY-MM-DD",
  378. // min: "1980-01-01",
  379. // event: "focus"
  380. //});
  381. });
  382. </script>
  383. </body>
  384. </html>