MarketInfo.cshtml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>MarketInfo</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_Attach" name="hid_Type_Attach" type="hidden" value="0" />
  31. @Html.Hidden("hid_Add_Warrant", "false")
  32. @Html.Hidden("hid_Type")
  33. </section>
  34. <section>
  35. <div class="winModal" style="width: 80%; margin: 5px auto;">
  36. <div class="panle-fluid " style="text-align: center"><h4 class="title"></h4></div>
  37. <form id="form" class="row">
  38. @Html.Hidden("Type", "Edit")
  39. <div class="panle-half">
  40. <div class="input-group">
  41. <label class="input-group-addon control-label" for="MarketID">注册号码</label>
  42. <input class="form-control input-group-addon required" aria-disabled="true" name="MarketID" id="MarketID" type="text" value="" placeholder="填写注册号码"/>
  43. <strong class="text-requird input-group-addon control-label">*</strong>
  44. </div>
  45. <div class="input-group">
  46. <label class="input-group-addon control-label" for="RegionId">辖区工商</label>
  47. <select class="form-control input-group-addon required" aria-disabled="true" name="RegionId" id="RegionId" type="text" value="" placeholder="选择所在辖区工商">
  48. @Html.Raw(ViewBag.SelRegionInfo)
  49. </select>
  50. <strong class="text-requird input-group-addon control-label">*</strong>
  51. </div>
  52. <div class="input-group">
  53. <label class="input-group-addon control-label" for="PractiseTime">开业时间</label>
  54. <input class="form-control input-group-addon laydate-icon required" readonly="readonly" aria-disabled="true" name="PractiseTime" id="PractiseTime" type="text" value="" placeholder="填写开业时间"/>
  55. <strong class="text-requird input-group-addon control-label">*</strong>
  56. </div>
  57. <div class="input-group">
  58. <label class="input-group-addon control-label" for="Area">
  59. 面积
  60. </label>
  61. <input class="form-control input-group-addon" aria-disabled="true" name="Area" id="Area" type="text" value=""/>
  62. <span class="input-group-addon control-label">平方米</span>
  63. </div>
  64. <div class="input-group">
  65. <label class="input-group-addon control-label" for="MarketSellerNum">经营户总数</label>
  66. <input class="form-control input-group-addon" aria-disabled="true" name="MarketSellerNum" id="MarketSellerNum" type="text" value=""/>
  67. </div>
  68. <div class="input-group">
  69. <label class="input-group-addon control-label" for="Principal">负责人</label>
  70. <input class="form-control input-group-addon" aria-disabled="true" name="Principal" id="Principal" type="text" value=""/>
  71. </div>
  72. <div class="input-group">
  73. <label class="input-group-addon control-label" for="LinkMan">联系人</label>
  74. <input class="form-control input-group-addon required" aria-disabled="true" name="LinkMan" id="LinkMan" type="text" value=""/>
  75. <strong class="text-requird input-group-addon control-label">*</strong>
  76. </div>
  77. <div class="input-group">
  78. <label class="input-group-addon control-label" for="FrontForUnit">主办单位</label>
  79. <input class="form-control input-group-addon" aria-disabled="true" name="FrontForUnit" id="FrontForUnit" type="text" value=""/>
  80. </div>
  81. <div class="input-group">
  82. <label class="input-group-addon control-label" for="Address">位置</label>
  83. <input class="form-control input-group-addon" aria-disabled="true" name="Address" id="Address" type="text" value=""/>
  84. </div>
  85. </div>
  86. <div class="panle-half">
  87. <div class="input-group">
  88. <label class="input-group-addon control-label" for="Name">市场名称</label>
  89. <input class="form-control input-group-addon required" aria-disabled="true" name="Name" id="Name" type="text" value=""/>
  90. <strong class="text-requird input-group-addon control-label">*</strong>
  91. </div>
  92. <div class="input-group">
  93. <label class="input-group-addon control-label" for="MarketTypeID">市场类型</label>
  94. <select class="form-control input-group-addon" aria-disabled="true" name="MarketTypeID" id="MarketTypeID" type="text" value="">
  95. @Html.Raw(ViewBag.SelMarketTypeInfo)
  96. </select>
  97. </div>
  98. <div class="input-group">
  99. <label class="input-group-addon control-label" for="Upgrade">提升方案</label>
  100. <select class="form-control input-group-addon" aria-disabled="true" name="Upgrade" id="Upgrade" type="text" value="">
  101. @Html.Raw(ViewBag.SelUpgradeInfo)
  102. </select>
  103. </div>
  104. <div class="input-group">
  105. <label class="input-group-addon control-label" for="Turnover">营业额</label>
  106. <input class="form-control input-group-addon" aria-disabled="true" name="Turnover" id="Turnover" type="text" value=""/>
  107. <span class="input-group-addon control-label">万元</span>
  108. </div>
  109. <div class="input-group">
  110. <label class="input-group-addon control-label" for="AuditFlag">规划审批</label>
  111. <select class="form-control input-group-addon" aria-disabled="true" name="AuditFlag" id="AuditFlag" type="text" value="">
  112. <option value="0">是</option>
  113. <option value="1">否</option>
  114. </select>
  115. </div>
  116. <div class="input-group">
  117. <label class="input-group-addon control-label" for="Telephone">联系电话</label>
  118. <input class="form-control input-group-addon" aria-disabled="true" name="Telephone" id="Telephone" type="text" value=""/>
  119. </div>
  120. <div class="input-group">
  121. <label class="input-group-addon control-label" for="LinkTel">联系人电话</label>
  122. <input class="form-control input-group-addon" aria-disabled="true" name="LinkTel" id="LinkTel" type="text" value=""/>
  123. </div>
  124. <div class="input-group">
  125. <label class="input-group-addon control-label" for="ManageUnit">管理单位</label>
  126. <input class="form-control input-group-addon" aria-disabled="true" name="ManageUnit" id="ManageUnit" type="text" value=""/>
  127. </div>
  128. </div>
  129. <div class="panle-fluid">
  130. <div class="input-group">
  131. <label class="input-group-addon control-label" for="Remark">备注</label>
  132. <textarea class="form-control input-group-addon" rows="3" aria-disabled="true" name="Remark" id="Remark" type="text" value=""></textarea>
  133. </div>
  134. </div>
  135. </form>
  136. <div class="panle-fluid " style="text-align: center"><h4 class="title">市场相关证件</h4>
  137. </div>
  138. <div class="panle-fluid">
  139. <section style="height: auto; padding: 10px 20px;">
  140. <div class="row tbToolBar" id="tbToolBar">
  141. <div class="toolbar" id="CurdTool">
  142. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  143. <span class="shuxian"></span>
  144. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  145. <span class="shuxian"></span>
  146. <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="btn_Del()">删除</a>
  147. <span class="shuxian"></span>
  148. <a href="#" class="easyui-linkbutton" iconCls="icon-link" plain="true" onclick="btn_Attach()">附件</a>
  149. </div>
  150. </div>
  151. <table id="dgTable" class="easyui-datagrid"
  152. data-options="singleSelect: true,
  153. method: 'post',
  154. multiSort: false,
  155. toolbar: '#tbToolBar',
  156. fitColumns: true,
  157. @*rownumbers: true,*@
  158. remoteSort: false,
  159. loadFilter: pagerFilter,
  160. onDblClickRow: function () {
  161. btn_Edit();
  162. },
  163. @*pagination: true,
  164. pageSize: 50,
  165. pageList: [20, 50, 100]*@
  166. ">
  167. <thead>
  168. <tr>
  169. <th data-options="field:'ID',width:80">编号</th>
  170. <th data-options="field:'Name',width:150">证件名称</th>
  171. <th data-options="field:'WarrantNumber',width:80,">证件号码</th>
  172. <th data-options="field:'ValidStartTime',width:50,">起始日期</th>
  173. <th data-options="field:'ValidEndTime',width:50,">截止日期</th>
  174. </tr>
  175. </thead>
  176. </table>
  177. </section>
  178. </div>
  179. <div class="panle-fluid" style="text-align: center">
  180. <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width: 120px">保存</a>
  181. </div>
  182. </div>
  183. </section>
  184. <section>
  185. <div id="winModal" class="easyui-window winModal" title="市场证照信息维护" style="width: 450px;height:320px; padding: 10px;"
  186. iconCls="icon-save" data-options="modal:true,closed:true">
  187. <div class="easyui-layout" data-options="fit:true" style="height: 99%">
  188. <div data-options="region:'center'" style="padding: 15px 25px 0;">
  189. <form id="form_Warrant" class="row">
  190. @Html.Hidden("ID")
  191. <div class="panle-fluid">
  192. <div class="input-group">
  193. <label class="input-group-addon control-label" for="WarrantTypeID">证件类型</label>
  194. <select class="form-control input-group-addon" aria-disabled="true" name="WarrantTypeID" id="WarrantTypeID" type="text" value="">
  195. @Html.Raw(ViewBag.SelWarrantTypeInfo)
  196. </select>
  197. </div>
  198. <div class="input-group">
  199. <label class="input-group-addon control-label" for="WarrantNumber">证件号</label>
  200. <input class="form-control input-group-addon" aria-disabled="true" name="WarrantNumber" id="WarrantNumber" type="text" value=""/>
  201. <strong class="text-requird input-group-addon control-label">*</strong>
  202. </div>
  203. <div class="input-group">
  204. <label class="input-group-addon control-label" for="ValidStartTime">起始日期</label>
  205. <input class="form-control input-group-addon" aria-disabled="true" name="ValidStartTime" id="ValidStartTime" type="text" value=""/>
  206. </div>
  207. <div class="input-group">
  208. <label class="input-group-addon control-label" for="ValidEndTime">起始日期</label>
  209. <input class="form-control input-group-addon" aria-disabled="true" name="ValidEndTime" id="ValidEndTime" type="text" value=""/>
  210. </div>
  211. </div>
  212. </form>
  213. </div>
  214. <div data-options="region:'south',border:false" style="text-align: right; height: 45px; padding: 13px 20px 0;">
  215. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save_Warrant()" style="width: 80px">确认</a>
  216. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width: 80px">取消</a>
  217. </div>
  218. </div>
  219. </div>
  220. <div id="winModal_Attach" class="easyui-window winModal" title="附件维护" style="width: 450px; padding: 10px;"
  221. iconCls="icon-save" data-options="modal:true,closed:true">
  222. <div class="easyui-layout" data-options="fit:true" style="height: 99%">
  223. <div data-options="region:'center'" style="padding: 15px 5px 5px;">
  224. <div class="panle-fluid">
  225. <div class="input-group">
  226. <label class="input-group-addon control-label" for="AttachFile">上传附件</label>
  227. <input class="form-control input-group-addon" aria-disabled="true" name="AttachFile" id="AttachFile" type="file" value="" placeholder="" onblur="CheckFileSize('AttachFile')"/>
  228. </div>
  229. <div class="input-group">
  230. <label class="input-group-addon control-label" for="FileTitle">附件名称</label>
  231. <input class="form-control input-group-addon" aria-disabled="true" name="FileTitle" id="FileTitle" type="text" value="" placeholder=""/>
  232. </div>
  233. <div class="input-group">
  234. <label class="input-group-addon control-label" for="Description_Attach">备注信息</label>
  235. <textarea class="form-control input-group-addon" aria-disabled="true" name="Description_Attach" id="Description_Attach" type="text" value="" placeholder="" ></textarea>
  236. </div>
  237. <div class="input-group" style="margin: 20px auto 10px">
  238. <input class="btn btn-default" aria-disabled="true" name="" id="Save_Attach" type="button" value="确认上传附件" placeholder="" onclick="Save_Attach('Add')"/>
  239. </div>
  240. </div>
  241. <div class="panle-fluid">
  242. <div class="row tbToolBar" id="tbToolBar_Attach" style="padding-left: 0;">
  243. <div class="toolbar">
  244. <a href="#" class="easyui-linkbutton" iconCls="icon-link_go" plain="true" onclick="btn_Look()">查看</a>
  245. <span class="shuxian"></span>
  246. <a href="#" class="easyui-linkbutton" iconCls="icon-link_delete" plain="true" onclick="btn_Del_Attach()">删除</a>
  247. </div>
  248. </div>
  249. <table id="dgTable_Attach" class="easyui-datagrid" style="width: 100%; height: 170px;"
  250. data-options="singleSelect: true,
  251. method: 'post',
  252. multiSort: false,
  253. toolbar: '#tbToolBar_Attach',
  254. fitColumns: true,
  255. @*rownumbers: true,*@
  256. remoteSort: false,
  257. @*loadFilter: pagerFilter,*@
  258. onDblClickRow: function () {
  259. btn_Look();
  260. },
  261. pagination: false,
  262. pageSize: 50,
  263. pageList: [20, 50, 100]
  264. ">
  265. <thead>
  266. <tr>
  267. <th data-options="field:'FileTitle',width:100">附件标题</th>
  268. <th data-options="field:'FileExt',width:60,">扩展名</th>
  269. <th data-options="field:'TimeLastMod',width:90,">上传日期</th>
  270. </tr>
  271. </thead>
  272. </table>
  273. </div>
  274. </div>
  275. <div data-options="region:'south',border:false" style="text-align: right; height: 45px; padding: 13px 20px 0;">
  276. @*<a class="easyui-linkbutton" id="Save_Attach" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save_Attach()" style="width:80px">确认</a>*@
  277. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal_Attach').window('close');" style="width: 80px">取消</a>
  278. </div>
  279. </div>
  280. </div>
  281. </section>
  282. <script>
  283. //提交
  284. function Save() {
  285. //type = type || $("#hid_Type").val();
  286. $.ajax({
  287. url: "@Url.Action("MarketsListOper", "MarketSystem",new {id= "MarketSystemMg" })",
  288. type: "post",
  289. dataType: "json",
  290. beforeSend: function () {
  291. return BeforeSend();
  292. },
  293. data: $("#form").serialize(),
  294. success: function (data) {
  295. if (CheckAajxData(data) === false) return;
  296. var msg = data.ErrorInfo;
  297. if (data.Success === true) {
  298. if ($("#hid_Add_Warrant").val() === "false") {
  299. LoadMarket();
  300. layer.confirm("市场信息保存成功,确认添加执照信息?",
  301. { icon: 3, title: '提示信息' },
  302. function (index) {
  303. //$("#hid__Add_Warrant").val("true");
  304. btn_Add();
  305. layer.close(index);
  306. });
  307. } else {
  308. LoadMarket();
  309. layer.alert(msg, { icon: 1, title: '提示信息' });
  310. }
  311. }
  312. else {
  313. layer.alert(msg, { icon: 2, title: '提示信息' });
  314. }
  315. }
  316. });
  317. }
  318. function Save_Warrant(type) {
  319. type = type || $("#hid_Type").val();
  320. var marketId = $("#MarketID").val();
  321. $.ajax({
  322. url: '@Url.Action("MarketWarrantOper", "MarketSystemMg")',
  323. type: "post",
  324. //data: $("#Warrant_form").serializeArray(),
  325. dataType: "json",
  326. data: {
  327. Type: type,
  328. MarketID: marketId,
  329. ID: $("#ID").val(),
  330. WarrantTypeID: $("#WarrantTypeID").val(),
  331. WarrantNumber: $("#WarrantNumber").val(),
  332. ValidStartTime: $("#ValidStartTime").val(),
  333. ValidEndTime: $("#ValidEndTime").val()
  334. },
  335. success: function(data) {
  336. if (CheckAajxData(data) === false) return;
  337. var msg = data.ErrorInfo;
  338. if (data.Success === true) {
  339. LoadTable();
  340. $("#winModal").window("close");
  341. layer.alert(msg, { icon: 1, title: '提示信息' });
  342. } else {
  343. layer.alert(msg, { icon: 7, title: '提示信息' });
  344. }
  345. }
  346. });
  347. }
  348. //添加
  349. function btn_Add() {
  350. if ($("#hid_Add_Warrant").val() === "false") {
  351. layer.confirm('需要先保存市场信息,才可添加证照信息!',
  352. { icon: 3, title: '提示信息' },
  353. function (index) {
  354. Save();
  355. layer.close(index);
  356. });
  357. }else {
  358. $("#hid_Type").val("Add");
  359. $("#winModal input").val("");
  360. $("#Save span.l-btn-text").html("添加");
  361. $("#winModal").window("open");
  362. }
  363. }
  364. //修改
  365. function btn_Edit() {
  366. $("#hid_Type").val("Edit");
  367. $("#Save span.l-btn-text").html("修改");
  368. console.log($("#hid_Type").val());
  369. SetModalVal_Warrant();
  370. }
  371. //删除
  372. function btn_Del() {
  373. $("#hid_Type").val("Del");
  374. var rows = $('#dgTable').datagrid('getSelections');
  375. if (rows.length === 1) {
  376. //var row = rows[0];
  377. //console.log(row);
  378. layer.confirm("您确定删除这条记录吗?", { icon: 3, title: '提示信息' },
  379. function (index) {
  380. SetModalVal_Warrant();
  381. Save_Warrant("Del");
  382. layer.close(index);
  383. });
  384. }
  385. }
  386. //证照modal赋值
  387. function SetModalVal_Warrant() {
  388. var rows = $('#dgTable').datagrid('getSelections');
  389. if (rows.length === 1) {
  390. var row = rows[0];
  391. $("#ID").val(row.ID);
  392. $("#WarrantNumber").val(row.WarrantNumber);
  393. $("#WarrantTypeID").val(row.WarrantTypeID);
  394. $("#ValidStartTime").val(row.ValidStartTime);
  395. $("#ValidEndTime").val(row.ValidEndTime);
  396. if ($("#hid_Type").val() === "Edit") {
  397. $("#winModal").window("open");
  398. }
  399. } else {
  400. layer.alert('请选择一条记录进行设置', {icon:2, title: '提示信息' });
  401. }
  402. }
  403. //加载表格数据
  404. function LoadTable() {
  405. $('#dgTable').datagrid({
  406. url: '@Url.Action("MarketsWarrantResult", "GetResult")' + '?MarketId=' + $('#MarketID').val(),
  407. onDblClickRow: function() {
  408. btn_Edit();
  409. }
  410. });
  411. }
  412. var start = {
  413. elem: "#ValidStartTime",
  414. format: "YYYY-MM-DD",
  415. min: "2010-01-01",
  416. event: "focus",
  417. choose: function (datas) {
  418. end.min = datas; //开始日选好后,重置结束日的最小日期
  419. end.start = datas; //将结束日的初始值设定为开始日
  420. }
  421. },
  422. end = {
  423. elem: "#ValidEndTime",
  424. format: "YYYY-MM-DD",
  425. min: "2010-01-01",
  426. event: "focus",
  427. choose: function (datas) {
  428. start.max = datas; //结束日选好后,重置开始日的最大日期
  429. }
  430. };
  431. function LoadMarket() {
  432. $.ajax({
  433. url: "@Url.Action("GetMarketInfo", "MarketSystemMg")",
  434. type: "post",
  435. dataType: "json",
  436. async:false,
  437. success: function (data) {
  438. if (CheckAajxData(data) === false) return;
  439. if (data.Success === true) {
  440. var row = data.MarketInfo[0];
  441. //console.log(row);
  442. $("#MarketID").val(row.MarketID);
  443. $("#RegionId").val(row.RegionID);
  444. $("#PractiseTime").val(row.PractiseTime);
  445. $("#Area").val(row.Area);
  446. $("#MarketSellerNum").val(row.MarketSellerNum);
  447. $("#Principal").val(row.Principal);
  448. $("#LinkMan").val(row.LinkMan);
  449. $("#FrontForUnit").val(row.FrontForUnit);
  450. $("#Address").val(row.Address);
  451. $("#Name").val(row.Names);
  452. $("#MarketTypeID").val(row.MarketTypeID);
  453. $("#Upgrade").val(row.Upgrade);
  454. $("#Turnover").val(row.Turnover);
  455. $("#AuditFlag").val(row.AuditFlag);
  456. $("#Telephone").val(row.Telephone);
  457. $("#LinkTel").val(row.LinkTel);
  458. $("#ManageUnit").val(row.ManageUnit);
  459. $("#Remark").val(row.Remark);
  460. $("#hid_Add_Warrant").val("true");
  461. } else {
  462. layer.alert(msg, { icon: 7, title: '提示信息' });
  463. }
  464. }
  465. });
  466. }
  467. $(function () {
  468. $("#form input").on("change",
  469. function () {
  470. $("#hid_Add_Warrant").val("false");
  471. });
  472. $("#form select").on("change",
  473. function () {
  474. $("#hid_Add_Warrant").val("false");
  475. });
  476. LoadMarket();
  477. //加载表格数据
  478. //var value = $(".textbox.searchbox .textbox-value").val(), item = $(".textbox.searchbox .textbox-value").attr("name");
  479. LoadTable();
  480. //加载日历控件
  481. laydate({
  482. elem: '#PractiseTime',
  483. format: "YYYY-MM-DD",
  484. min: "1980-01-01",
  485. event: "focus"
  486. });
  487. laydate(start);
  488. laydate(end);
  489. });
  490. function Save_Attach(type) {
  491. type = type || $("#hid_Type_Attach").val();
  492. $.ajaxFileUpload({
  493. url: "@Url.Action("AttachFileUpdate", "MarketSystem")",
  494. secureuri: false, //一般设置为false
  495. fileElementId: 'AttachFile', //文件上传控件的Id <input type="file" id="fileUpload" name="file" />
  496. type: "post",
  497. dataType: "json",
  498. data: {
  499. Type: type,
  500. UploadFile: "true",
  501. TableId: "MarketHasWarrant",
  502. ColumnId: "ID",
  503. SourceKey: $('#dgTable').datagrid('getSelections')[0].ID,
  504. FileTitle: $("#FileTitle").val(),
  505. Description: $("#Description_Attach").val()
  506. },
  507. success: function(data) {
  508. if (CheckAajxData(data) === false) return;
  509. var msg = data.ErrorInfo;
  510. if (data.Success === true) {
  511. LoadTable_Attach();
  512. layer.alert(msg, { icon: 1, title: '提示信息' });
  513. } else {
  514. LoadTable_Attach();
  515. layer.alert(msg, { icon: 7, title: '提示信息' });
  516. }
  517. }
  518. });
  519. }
  520. //加载附件表格数据
  521. function LoadTable_Attach() {
  522. $('#dgTable_Attach').datagrid({
  523. url: '@Url.Action("MarketAttachResult", "GetResult")' +
  524. '?SourceKey=' +
  525. $('#dgTable').datagrid('getSelections')[0].ID
  526. });
  527. }
  528. //打开附件modal
  529. function btn_Attach() {
  530. SetModalVal_Attach();
  531. }
  532. //查看附件
  533. function btn_Look() {
  534. var rows = $('#dgTable_Attach').datagrid('getSelections');
  535. if (rows.length === 1) {
  536. var row = rows[0];
  537. var path = "../" + row.FilePath + "/" + row.FileName;
  538. //window.location.href = path;
  539. window.open(path);
  540. } else {
  541. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  542. }
  543. }
  544. //删除附件
  545. function btn_Del_Attach() {
  546. $("#hid_Type_Attach").val("Del");
  547. var rows = $('#dgTable_Attach').datagrid('getSelections');
  548. if (rows.length === 1) {
  549. layer.confirm("您确定删除这条记录吗?",
  550. { icon: 3, title: '提示信息' },
  551. function(index) {
  552. SetModalVal_Attach();
  553. Save_Attach("Del");
  554. layer.close(index);
  555. });
  556. } else {
  557. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  558. }
  559. //附件
  560. }
  561. //修改附件
  562. function btn_Edit_Attach() {
  563. $("#hid_Type").val("Edit");
  564. $("#Save_Attach").html("修改");
  565. SetModalVal_Attach();
  566. }
  567. //附件modal赋值
  568. function SetModalVal_Attach() {
  569. var rows = $('#dgTable').datagrid('getSelections');
  570. if (rows.length === 1) {
  571. var row = rows[0];
  572. //console.log(row);
  573. $("#ID").val(row.ID);
  574. LoadTable_Attach();
  575. $("#winModal_Attach").window("open");
  576. } else {
  577. layer.alert('请选择一条记录进行设置', {icon:7, title: '提示信息' });
  578. }
  579. }
  580. </script>
  581. </body>
  582. </html>