DicPage.aspx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DicPage.aspx.cs" Inherits="DicPage" %>
  2. <!DOCTYPE html>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title></title>
  7. <script src="js/boot.js"></script>
  8. <link href="css/dic.css" rel="stylesheet" />
  9. <script src="js/dic.js"></script>
  10. <script type="text/javascript">
  11. var tree = null;
  12. var shopList = [];
  13. var productList = [];
  14. $(document).ready(function () {
  15. tree = mini.get("m_tree");
  16. $("#txtTreeKey").keydown(function (e) {
  17. if (e.which == 13) {
  18. tree_filter();
  19. }
  20. });
  21. if ($("#hPemShop").val() != "") mini.get("selPemShop").setValue($("#hPemShop").val());
  22. let txtShopDesign = mini.get("designPemShop");
  23. txtShopDesign.on("valuechanged", changeValue);
  24. postAjax("get_shop_list", "", function (data) {
  25. shopList = data;
  26. getDesignInfo();
  27. })
  28. postAjax("get_product_list", "", function (data) {
  29. productList = data;
  30. getDesignInfo();
  31. })
  32. });
  33. function onCloseClick(e) {
  34. var obj = e.sender;
  35. obj.setText("");
  36. obj.setValue("");
  37. }
  38. function tree_filter() {
  39. var key = $("#txtTreeKey").val();
  40. if (key == "") {
  41. tree.clearFilter();
  42. } else {
  43. key = key.toLowerCase();
  44. tree.filter(function (node) {
  45. //alert(node.name);
  46. var text = node.name ? node.name.toLowerCase() : "";
  47. if (text.indexOf(key) != -1) {
  48. return true;
  49. }
  50. });
  51. }
  52. }
  53. function importExcel() {
  54. openWin("出入库导入", "../reports/Imports.aspx?t=fitting_type", 420, 200, function (action) {
  55. if (action == "save") {
  56. resultShow("数据导入成功!", "view_search()");
  57. }
  58. });
  59. }
  60. function lineFn() {
  61. mini.get("txtLineSt").setValue(1);
  62. mini.get("txtLineEt").setValue(4);
  63. mini.get("win_line").show();
  64. }
  65. function saveLineFn() {
  66. var id = $("#hId").val();
  67. var st = mini.get("txtLineSt").getValue();
  68. var et = mini.get("txtLineEt").getValue();
  69. var prev = mini.get("txtPrev").getValue();
  70. getAjax("line_dic_item", "class=" + $("#hClass").val() + "&mId=" + id + "&st=" + st + "&et=" + et + "&prev=" + prev, function (data) {
  71. if (data != "") {
  72. var sArr = data.split('|');
  73. window.location = "DicPage.aspx?t=" + $("#hClass").val() + "&mId=" + id;
  74. //resultShow(sArr[1], "");
  75. } else {
  76. alert('保存失败!');
  77. }
  78. });
  79. }
  80. function codeFn() {
  81. var name = $("#hName").val();
  82. var id = $("#hId").val();
  83. $("#code_href").attr("href", "QRCode.aspx?text=" + name + "|" + id);
  84. $("#code_href")[0].click();
  85. }
  86. function saveFn_() {
  87. if (mini.get("selPemShop") != undefined && mini.get("selPemShop").getValue() != "id") $("#hPemShop").val(mini.get("selPemShop").getValue());
  88. saveFn();
  89. }
  90. function treeNodeSelFn_(e, node) {
  91. treeNodeSelFn(e, node);
  92. }
  93. function permsFn() {
  94. var id = $("#hId").val();
  95. if (id == "") {
  96. alert("找不到要生成的项!");
  97. return false;
  98. }
  99. getAjax("perms_dic_item", "mId=" + id, function (data) {
  100. if (data != "") {
  101. resultShow("加入权限完成");
  102. } else {
  103. alert('保存失败!');
  104. }
  105. });
  106. }
  107. var autoIdx = 0;
  108. function autoNextFn() {
  109. var list = importValueList;
  110. if (autoIdx >= list.length) {
  111. return;
  112. }
  113. var itemvalue = list[autoIdx];
  114. $("#txtName").val(itemvalue.text);
  115. $("#txtCode").val(itemvalue.value);
  116. autoIdx++;
  117. }
  118. var shop_list = []
  119. function changeValue(e) {
  120. let list = []
  121. let selecteds = e.selecteds;
  122. if ($("#txtShopDesign").nextAll().length > 0) {
  123. $("#txtShopDesign").nextAll().remove();
  124. }
  125. shop_list.forEach(item => {
  126. let index = selecteds.findIndex(e => item.shopId === e.id);
  127. if (index !== -1) {
  128. list.push({ id: item.id || "", shopId: item.shopId, designIds: item.designIds || "", shopName: item.shopName })
  129. selecteds?.splice(index, 1);
  130. }
  131. });
  132. selecteds?.forEach(item => {
  133. list.push({ id: "", shopId: item.id, designIds: item.ids || "", shopName: item.name })
  134. })
  135. shop_list = list;
  136. let html = ``;
  137. shop_list.forEach(item => {
  138. html += '<tr>';
  139. html += `<td class="td1">店铺:</td><td class="td2">${item.shopName}</td>
  140. <td class="td1">操作</td><td class="td2">
  141. <button type="button" onclick="showDesignPop('${item.shopId}')">修改技能</button>
  142. </td>`
  143. html += '</tr>';
  144. })
  145. $("#txtShopDesign").after(html);
  146. mini.parse(html)
  147. }
  148. function desgingChange(e) {
  149. let ids = mini.get("design_" + e).getValue();
  150. let index = shop_list.findIndex(item => item.shopId == e);
  151. shop_list[index].designIds = ids;
  152. }
  153. function saveShopDesign() {
  154. let tarId = $("#hId").val();
  155. if (!tarId) {
  156. saveFn(true)
  157. return;
  158. }
  159. let data = []
  160. let shopIds = [];
  161. shop_list?.map(item => {
  162. shopIds.push(item.shopId)
  163. })
  164. let params = {
  165. tarId,
  166. type: 0,
  167. shopIds: shopIds.join(",")
  168. }
  169. postAjax("save_shop_info", params, function (data) {
  170. resultShow(data);
  171. })
  172. }
  173. var selectShopId = 0;
  174. function saveShopDesignFun() {
  175. let designId = mini.get("showDesign").getValue();
  176. let productNames = mini.get("showDesign").getText();
  177. let id = $("#hId").val();
  178. let data = []
  179. shop_list?.map(item => {
  180. if (item.shopId == selectShopId) {
  181. data.push({ designIds: designId, shopId: selectShopId, orders: item.orders })
  182. }
  183. })
  184. let index = shop_list.findIndex(item => item.shopId == selectShopId);
  185. let params = {
  186. tarId: id,
  187. type: 0, shopId: selectShopId,
  188. data: JSON.stringify(data)
  189. };
  190. postAjax("save_dic_info", params, function (data) {
  191. shop_list[index].designIds = designId
  192. shop_list[index].productNames = productNames
  193. canceShopDesignFun();
  194. })
  195. }
  196. function canceShopDesignFun() {
  197. mini.get("showDesign_win").hide();
  198. }
  199. function showDesignPop(shopId) {
  200. selectShopId = shopId;
  201. let shop = shop_list.find(item => item.shopId == shopId);
  202. if (!shop) {
  203. shop.designIds = "";
  204. }
  205. mini.get("showDesign").setValue(shop.designIds);
  206. mini.get("showDesign").setText(shop.productNames);
  207. mini.get("showDesign_win").show();
  208. }
  209. function getDesignInfo() {
  210. if (shopList.length == 0 || productList.length == 0) {
  211. return;
  212. }
  213. let id = $("#hId").val();
  214. let params = {
  215. type: 0,
  216. tarId: id
  217. }
  218. if ($("#txtShopDesign").nextAll().length > 0) {
  219. $("#txtShopDesign").nextAll().remove();
  220. }
  221. shop_list = [];
  222. postAjax("get_design_info", params, function (data) {
  223. resultShow(data);
  224. if (data.length > 0) {
  225. let list = [];
  226. data.map(item => {
  227. let index = list.findIndex(e => e.shopId == item.shopId);
  228. let info = null;
  229. if (index == -1) {
  230. let name = '';
  231. for (let i = 0; i < shopList.length; i++) {
  232. if (item.shopId == shopList[i].id) {
  233. name = shopList[i].name;
  234. break;
  235. }
  236. }
  237. info = { shopId: item.shopId, name: name, ids: [], productNames: [] };
  238. list.push(info);
  239. index = list.length - 1;
  240. } else {
  241. info = list[index];
  242. }
  243. if (item.designId != 0) {
  244. info.ids.push(item.designId);
  245. info.productNames.push(item.PType);
  246. } else {
  247. info.id = item.ID;
  248. }
  249. list[index] = info;
  250. })
  251. let shopids = []
  252. list.map(item => {
  253. shop_list.push({ id: item.id || "", shopId: item.shopId, designIds: item.ids.join(",") || "", shopName: item.name, productNames: item.productNames.join(",") })
  254. shopids.push(item.shopId);
  255. })
  256. mini.get("designPemShop").setValue(shopids.join(","));
  257. let html = ``;
  258. shop_list.forEach(item => {
  259. html += '<tr>';
  260. html += `<td class="td1">店铺:</td><td class="td2">${item.shopName}</td>
  261. <td class="td1">操作</td><td class="td2">
  262. <button type="button" onclick="showDesignPop('${item.shopId}')">修改技能</button>
  263. </td>`
  264. html += '</tr>';
  265. })
  266. $("#txtShopDesign").after(html);
  267. mini.parse(html);
  268. }
  269. })
  270. }
  271. </script>
  272. <style>
  273. #showDesign_win .mini-panel-body {
  274. overflow-y: scroll;
  275. }
  276. </style>
  277. </head>
  278. <body>
  279. <div style="display: none">
  280. <input runat="server" type="hidden" id="hClass" />
  281. <input type="hidden" id="hId" />
  282. <input type="hidden" id="hName" />
  283. <input type="hidden" id="hParentId" />
  284. <input type="hidden" id="hPemShop" />
  285. <a id="code_href" target="_blank" href="#">提示</a>
  286. </div>
  287. <div id="showDesign_win" class="mini-window" title="店铺技能" style="width: 750px; height: 500px; position: relative; display: none">
  288. <table class="win_tb" border="0" cellpadding="0" cellspacing="1">
  289. <tr>
  290. <td class="td1"></td>
  291. <td class="td2" colspan="3">
  292. <div id="showDesign" class="mini-textboxlist" url="./Handler/sync.ashx?t=get_sel_product" style="width: 700px;" popupwidth="300" textfield="name" valuefield="id" multiselect="true" showclose="true" onvalidation="onComboValidation">
  293. <div property="columns">
  294. <div header="全部" field="name"></div>
  295. </div>
  296. </div>
  297. </td>
  298. </tr>
  299. <tr>
  300. <td colspan="4">
  301. <div class="win_btn" style="text-align: center;">
  302. <a class="mini-button" iconcls="icon-ok" onclick="saveShopDesignFun">保存</a>&nbsp;
  303. <a class="mini-button" iconcls="icon-cancel" onclick="canceShopDesignFun">取消</a>
  304. </div>
  305. </td>
  306. </tr>
  307. </table>
  308. </div>
  309. <div class="mini-layout" style="width: 100%; height: 100%;">
  310. <div id="m_tree_div" runat="server" region="west" runat="server" showheader="true" showspliticon="true" bodystyle="padding-left:1px;" width="200" minwidth="100" maxwidth="350">
  311. <input id="txtTreeKey" type="text" style="width: 92%;" />
  312. <ul id="m_tree" class="mini-tree" showtreeicon="true" onnodeselect="treeNodeSelFn_" textfield="name" idfield="id" parentfield="pid" style="width: 100%; height: 100%;" expandonload="0" enablehottrack="false"></ul>
  313. </div>
  314. <div title="填写内容" showheader="true" showcollapsebutton="false" region="center">
  315. <div class="mini-toolbar" style="padding: 1px; border-top: 0; border-left: 0; border-right: 0;">
  316. <a id="btnAdd" class="mini-button" iconcls="icon-add" plain="true" onclick="addFn()">新增</a>
  317. <span class="separator"></span>
  318. <%--<a id="btnSave" class="mini-button" iconCls="icon-save" plain="true" onclick="saveFn()">保存</a>--%>
  319. <a id="btnSave" class="mini-button" iconcls="icon-save" plain="true" onclick="saveFn_()">保存</a>
  320. <a id="btnDel" class="mini-button" iconcls="icon-remove" plain="true" onclick="delFn()">删除</a>
  321. <a id="btnBuild" runat="server" class="mini-button" iconcls="icon-downgrade" plain="true" onclick="builderFn()">生成操作</a>
  322. <a id="btnPerm" runat="server" class="mini-button" iconcls="icon-downgrade" plain="true" onclick="permsFn()">加入权限</a>
  323. <a id="btnTrans" class="mini-button" iconcls="icon-filter" plain="true" onclick="transferFn()">转移</a>
  324. <%--<a id="btnNextValue" class="mini-button" iconCls="icon-filter" plain="true" onclick="autoNextFn()">自动填入下一个</a>--%>
  325. </div>
  326. <form id="form1" runat="server">
  327. <table class="m_tb" border="0" cellspading="0" cellspacing="0">
  328. <tr>
  329. <td class="td1">父级:</td>
  330. <td class="td2">
  331. <input type="text" disabled="disabled" id="txtParentName" /></td>
  332. </tr>
  333. <tr>
  334. <td class="td1">名称<font color="red">*</font>:</td>
  335. <td class="td2">
  336. <input type="text" id="txtName" /></td>
  337. </tr>
  338. <tr>
  339. <td class="td1">编号:</td>
  340. <td class="td2">
  341. <input type="text" id="txtCode" /></td>
  342. </tr>
  343. <tr>
  344. <td class="td1">排序:</td>
  345. <td class="td2">
  346. <input type="text" id="txtSort" style="width: 50px" /></td>
  347. </tr>
  348. <tr>
  349. <td class="td1">删除:</td>
  350. <td class="td2">
  351. <input type="checkbox" id="chkDel" style="width: auto" /></td>
  352. </tr>
  353. <tr id="selOld" runat="server" visible="false">
  354. <td class="td1">老客户订单:</td>
  355. <td class="td2">
  356. <input type="checkbox" id="OldOrder" style="width: auto" /></td>
  357. </tr>
  358. <tr>
  359. <td class="td1" valign="top">备注:</td>
  360. <td class="td2">
  361. <textarea id="txtMemo" rows="3" style="width: 250px" cols="30"></textarea></td>
  362. </tr>
  363. <tr id="trOperate" runat="server" visible="false">
  364. <td class="td1">动作:</td>
  365. <td class="td2">
  366. <input type="checkbox" id="chkOperate" style="width: auto" /></td>
  367. </tr>
  368. <tr id="trIcon" runat="server" visible="false">
  369. <td class="td1">图标样式:</td>
  370. <td class="td2">
  371. <input type="text" id="txtIcon" style="width: 250px;" /></td>
  372. </tr>
  373. <tr id="trTag" runat="server" visible="false">
  374. <td class="td1">标签:</td>
  375. <td class="td2">
  376. <input type="text" id="txtTag" style="width: 250px;" /></td>
  377. </tr>
  378. <tr id="trUrl" runat="server" visible="false">
  379. <td class="td1">地址:</td>
  380. <td class="td2">
  381. <input type="text" id="txtUrl" style="width: 250px;" /></td>
  382. </tr>
  383. <tr id="trHostFieldName" runat="server" visible="false">
  384. <td class="td1">主机楼字段名:</td>
  385. <td class="td2">
  386. <input type="text" id="txtHostFieldName" style="width: 250px;" /></td>
  387. </tr>
  388. <tr id="trHostName" runat="server" visible="false">
  389. <td class="td1">主机楼名称:</td>
  390. <td class="td2">
  391. <input type="text" id="txtHostName" style="width: 250px;" /></td>
  392. </tr>
  393. <tr id="trMaxStock" runat="server" visible="false">
  394. <td class="td1">最大库存:</td>
  395. <td class="td2">
  396. <input type="text" id="txtMaxStock" style="width: 250px;" /></td>
  397. </tr>
  398. <tr id="trWaringStock" runat="server" visible="false">
  399. <td class="td1">预警库存:</td>
  400. <td class="td2">
  401. <input type="text" id="txtWaringStock" style="width: 250px;" /></td>
  402. </tr>
  403. </table>
  404. <table id="selShop" class="p_tb" border="0" cellspading="0" cellspacing="12" runat="server" visible="false">
  405. <tr>
  406. <td class="td1">关联店铺:</td>
  407. <td class="td2">
  408. <div id="selPemShop" class="mini-combobox" style="width: 300px;" popupwidth="300" textfield="name" valuefield="id"
  409. url="../Handler/sync.ashx?t=get_sel_shop" value="id" multiselect="true" showclose="true" oncloseclick="onCloseClick">
  410. <div property="columns">
  411. <div header="店铺" field="name"></div>
  412. </div>
  413. </div>
  414. </td>
  415. </tr>
  416. </table>
  417. <table id="designTable" class="p_tb" border="0" cellspading="0" cellspacing="12" runat="server" visible="false" style="display: none">
  418. <tr id="txtShopDesign">
  419. <td class="td1">抢单权限:</td>
  420. <td class="td2">
  421. <div id="designPemShop" class="mini-combobox" style="width: 300px;" popupwidth="300" allowinput="true" textfield="name" valuefield="id"
  422. url="../Handler/sync.ashx?t=get_sel_shop" value="id" multiselect="true" showclose="true" oncloseclick="onCloseClick">
  423. <div property="columns">
  424. <div header="店铺" field="name"></div>
  425. </div>
  426. </div>
  427. </td>
  428. </tr>
  429. </table>
  430. <div id="transfer_win" class="mini-window" title="转移节点" style="width: 300px; height: 210px;">
  431. <div class="mini-toolbar" style="border-top: 0; border-left: 0; border-right: 0;">
  432. <a class="mini-button" iconcls="icon-save" plain="true" onclick="saveTransferFn()">保存</a>
  433. </div>
  434. <table class="win_tb" border="0" cellpadding="0" cellspacing="0">
  435. <tr>
  436. <td class="td1">转移节点:</td>
  437. <td class="td2">
  438. <web:DropDownList ID="selTrans" runat="server"></web:DropDownList>
  439. </td>
  440. </tr>
  441. <tr>
  442. <td class="td1">排序:</td>
  443. <td class="td2">
  444. <input type="text" id="txtTransSort" class="mini-spinner" minvalue="0" maxvalue="100" />
  445. </td>
  446. </tr>
  447. </table>
  448. </div>
  449. <div id="win_line" class="mini-window" title="生成" style="width: 300px; height: 210px;">
  450. <div class="mini-toolbar" style="border-top: 0; border-left: 0; border-right: 0;">
  451. <a class="mini-button" iconcls="icon-save" plain="true" onclick="saveLineFn()">保存</a>
  452. </div>
  453. <table class="win_tb" border="0" cellpadding="0" cellspacing="0">
  454. <tr>
  455. <td class="td1">前缀:</td>
  456. <td class="td2">
  457. <input type="text" id="txtPrev" class="mini-textbox" minvalue="0" maxvalue="100" />
  458. </td>
  459. </tr>
  460. <tr>
  461. <td class="td1">开始:</td>
  462. <td class="td2">
  463. <input type="text" id="txtLineSt" class="mini-spinner" minvalue="0" maxvalue="1000" />
  464. </td>
  465. </tr>
  466. <tr>
  467. <td class="td1">数量:</td>
  468. <td class="td2">
  469. <input type="text" id="txtLineEt" class="mini-spinner" minvalue="0" maxvalue="1000" />
  470. </td>
  471. </tr>
  472. </table>
  473. </div>
  474. </form>
  475. </div>
  476. </div>
  477. <asp:Literal ID="litTree" runat="server"></asp:Literal>
  478. </body>
  479. </html>