DicPage.aspx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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 id = $("#hId").val();
  177. let data = []
  178. shop_list?.map(item => {
  179. if (item.shopId == selectShopId) {
  180. data.push({ designIds: designId, shopId: selectShopId, orders: item.orders })
  181. }
  182. })
  183. let index = shop_list.findIndex(item => item.shopId == selectShopId);
  184. let params = {
  185. tarId: id,
  186. type: 0, shopId: selectShopId,
  187. data: JSON.stringify(data)
  188. };
  189. postAjax("save_dic_info", params, function (data) {
  190. shop_list[index].designIds = designId
  191. canceShopDesignFun();
  192. })
  193. }
  194. function canceShopDesignFun() {
  195. mini.get("showDesign_win").hide();
  196. }
  197. function showDesignPop(shopId) {
  198. selectShopId = shopId;
  199. let shop = shop_list.find(item => item.shopId == shopId);
  200. if (!shop) {
  201. shop.designIds = "";
  202. }
  203. mini.get("showDesign").setValue(shop.designIds);
  204. mini.get("showDesign_win").show();
  205. }
  206. function getDesignInfo() {
  207. if (shopList.length == 0 || productList.length == 0) {
  208. return;
  209. }
  210. let id = $("#hId").val();
  211. let params = {
  212. type: 0,
  213. tarId: id
  214. }
  215. if ($("#txtShopDesign").nextAll().length > 0) {
  216. $("#txtShopDesign").nextAll().remove();
  217. }
  218. shop_list = [];
  219. postAjax("get_design_info", params, function (data) {
  220. resultShow(data);
  221. if (data.length > 0) {
  222. let list = [];
  223. data.map(item => {
  224. let index = list.findIndex(e => e.shopId == item.shopId);
  225. let info = null;
  226. if (index == -1) {
  227. let name = '';
  228. for (let i = 0; i < shopList.length; i++) {
  229. if (item.shopId == shopList[i].id) {
  230. name = shopList[i].name;
  231. break;
  232. }
  233. }
  234. info = { shopId: item.shopId, name: name, ids: [] };
  235. list.push(info);
  236. index = list.length - 1;
  237. } else {
  238. info = list[index];
  239. }
  240. if (item.designId != 0) {
  241. info.ids.push(item.designId);
  242. } else {
  243. info.id = item.ID;
  244. }
  245. list[index] = info;
  246. })
  247. let shopids = []
  248. list.map(item => {
  249. shop_list.push({ id: item.id || "", shopId: item.shopId, designIds: item.ids.join(",") || "", shopName: item.name })
  250. shopids.push(item.shopId);
  251. })
  252. mini.get("designPemShop").setValue(shopids.join(","));
  253. let html = ``;
  254. shop_list.forEach(item => {
  255. html += '<tr>';
  256. html += `<td class="td1">店铺:</td><td class="td2">${item.shopName}</td>
  257. <td class="td1">操作</td><td class="td2">
  258. <button type="button" onclick="showDesignPop('${item.shopId}')">修改技能</button>
  259. </td>`
  260. html += '</tr>';
  261. })
  262. $("#txtShopDesign").after(html);
  263. mini.parse(html);
  264. }
  265. })
  266. }
  267. </script>
  268. </head>
  269. <body>
  270. <div style="display: none">
  271. <input runat="server" type="hidden" id="hClass" />
  272. <input type="hidden" id="hId" />
  273. <input type="hidden" id="hName" />
  274. <input type="hidden" id="hParentId" />
  275. <input type="hidden" id="hPemShop" />
  276. <a id="code_href" target="_blank" href="#">提示</a>
  277. </div>
  278. <div id="showDesign_win" class="mini-window" title="店铺技能" style="width: 750px; height: 170px; position: relative; display: none">
  279. <table class="win_tb" border="0" cellpadding="0" cellspacing="1">
  280. <tr>
  281. <td class="td1"></td>
  282. <td class="td2" colspan="3">
  283. <div id="showDesign" class="mini-combobox" url="./Handler/sync.ashx?t=get_sel_product" style="width: 750px;" popupwidth="300" textfield="name" valuefield="id" multiselect="true" showclose="true">
  284. <div property="columns">
  285. <div header="全部" field="name"></div>
  286. </div>
  287. </div>
  288. </td>
  289. </tr>
  290. <tr>
  291. <td colspan="4">
  292. <div class="win_btn" style="text-align: center;">
  293. <a class="mini-button" iconcls="icon-ok" onclick="saveShopDesignFun">保存</a>&nbsp;
  294. <a class="mini-button" iconcls="icon-cancel" onclick="canceShopDesignFun">取消</a>
  295. </div>
  296. </td>
  297. </tr>
  298. </table>
  299. </div>
  300. <div class="mini-layout" style="width: 100%; height: 100%;">
  301. <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">
  302. <input id="txtTreeKey" type="text" style="width: 92%;" />
  303. <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>
  304. </div>
  305. <div title="填写内容" showheader="true" showcollapsebutton="false" region="center">
  306. <div class="mini-toolbar" style="padding: 1px; border-top: 0; border-left: 0; border-right: 0;">
  307. <a id="btnAdd" class="mini-button" iconcls="icon-add" plain="true" onclick="addFn()">新增</a>
  308. <span class="separator"></span>
  309. <%--<a id="btnSave" class="mini-button" iconCls="icon-save" plain="true" onclick="saveFn()">保存</a>--%>
  310. <a id="btnSave" class="mini-button" iconcls="icon-save" plain="true" onclick="saveFn_()">保存</a>
  311. <a id="btnDel" class="mini-button" iconcls="icon-remove" plain="true" onclick="delFn()">删除</a>
  312. <a id="btnBuild" runat="server" class="mini-button" iconcls="icon-downgrade" plain="true" onclick="builderFn()">生成操作</a>
  313. <a id="btnPerm" runat="server" class="mini-button" iconcls="icon-downgrade" plain="true" onclick="permsFn()">加入权限</a>
  314. <a id="btnTrans" class="mini-button" iconcls="icon-filter" plain="true" onclick="transferFn()">转移</a>
  315. <%--<a id="btnNextValue" class="mini-button" iconCls="icon-filter" plain="true" onclick="autoNextFn()">自动填入下一个</a>--%>
  316. </div>
  317. <form id="form1" runat="server">
  318. <table class="m_tb" border="0" cellspading="0" cellspacing="0">
  319. <tr>
  320. <td class="td1">父级:</td>
  321. <td class="td2">
  322. <input type="text" disabled="disabled" id="txtParentName" /></td>
  323. </tr>
  324. <tr>
  325. <td class="td1">名称<font color="red">*</font>:</td>
  326. <td class="td2">
  327. <input type="text" id="txtName" /></td>
  328. </tr>
  329. <tr>
  330. <td class="td1">编号:</td>
  331. <td class="td2">
  332. <input type="text" id="txtCode" /></td>
  333. </tr>
  334. <tr>
  335. <td class="td1">排序:</td>
  336. <td class="td2">
  337. <input type="text" id="txtSort" style="width: 50px" /></td>
  338. </tr>
  339. <tr>
  340. <td class="td1">删除:</td>
  341. <td class="td2">
  342. <input type="checkbox" id="chkDel" style="width: auto" /></td>
  343. </tr>
  344. <tr id="selOld" runat="server" visible="false">
  345. <td class="td1">老客户订单:</td>
  346. <td class="td2">
  347. <input type="checkbox" id="OldOrder" style="width: auto" /></td>
  348. </tr>
  349. <tr>
  350. <td class="td1" valign="top">备注:</td>
  351. <td class="td2">
  352. <textarea id="txtMemo" rows="3" style="width: 250px" cols="30"></textarea></td>
  353. </tr>
  354. <tr id="trOperate" runat="server" visible="false">
  355. <td class="td1">动作:</td>
  356. <td class="td2">
  357. <input type="checkbox" id="chkOperate" style="width: auto" /></td>
  358. </tr>
  359. <tr id="trIcon" runat="server" visible="false">
  360. <td class="td1">图标样式:</td>
  361. <td class="td2">
  362. <input type="text" id="txtIcon" style="width: 250px;" /></td>
  363. </tr>
  364. <tr id="trTag" runat="server" visible="false">
  365. <td class="td1">标签:</td>
  366. <td class="td2">
  367. <input type="text" id="txtTag" style="width: 250px;" /></td>
  368. </tr>
  369. <tr id="trUrl" runat="server" visible="false">
  370. <td class="td1">地址:</td>
  371. <td class="td2">
  372. <input type="text" id="txtUrl" style="width: 250px;" /></td>
  373. </tr>
  374. <tr id="trHostFieldName" runat="server" visible="false">
  375. <td class="td1">主机楼字段名:</td>
  376. <td class="td2">
  377. <input type="text" id="txtHostFieldName" style="width: 250px;" /></td>
  378. </tr>
  379. <tr id="trHostName" runat="server" visible="false">
  380. <td class="td1">主机楼名称:</td>
  381. <td class="td2">
  382. <input type="text" id="txtHostName" style="width: 250px;" /></td>
  383. </tr>
  384. <tr id="trMaxStock" runat="server" visible="false">
  385. <td class="td1">最大库存:</td>
  386. <td class="td2">
  387. <input type="text" id="txtMaxStock" style="width: 250px;" /></td>
  388. </tr>
  389. <tr id="trWaringStock" runat="server" visible="false">
  390. <td class="td1">预警库存:</td>
  391. <td class="td2">
  392. <input type="text" id="txtWaringStock" style="width: 250px;" /></td>
  393. </tr>
  394. </table>
  395. <table id="selShop" class="p_tb" border="0" cellspading="0" cellspacing="12" runat="server" visible="false">
  396. <tr>
  397. <td class="td1">关联店铺:</td>
  398. <td class="td2">
  399. <div id="selPemShop" class="mini-combobox" style="width: 300px;" popupwidth="300" textfield="name" valuefield="id"
  400. url="../Handler/sync.ashx?t=get_sel_shop" value="id" multiselect="true" showclose="true" oncloseclick="onCloseClick">
  401. <div property="columns">
  402. <div header="店铺" field="name"></div>
  403. </div>
  404. </div>
  405. </td>
  406. </tr>
  407. </table>
  408. <table id="designTable" class="p_tb" border="0" cellspading="0" cellspacing="12" runat="server" visible="false" style="display: none">
  409. <tr id="txtShopDesign">
  410. <td class="td1">抢单权限:</td>
  411. <td class="td2">
  412. <div id="designPemShop" class="mini-combobox" style="width: 300px;" popupwidth="300" allowinput="true" textfield="name" valuefield="id"
  413. url="../Handler/sync.ashx?t=get_sel_shop" value="id" multiselect="true" showclose="true" oncloseclick="onCloseClick">
  414. <div property="columns">
  415. <div header="店铺" field="name"></div>
  416. </div>
  417. </div>
  418. </td>
  419. </tr>
  420. </table>
  421. <div id="transfer_win" class="mini-window" title="转移节点" style="width: 300px; height: 210px;">
  422. <div class="mini-toolbar" style="border-top: 0; border-left: 0; border-right: 0;">
  423. <a class="mini-button" iconcls="icon-save" plain="true" onclick="saveTransferFn()">保存</a>
  424. </div>
  425. <table class="win_tb" border="0" cellpadding="0" cellspacing="0">
  426. <tr>
  427. <td class="td1">转移节点:</td>
  428. <td class="td2">
  429. <web:DropDownList ID="selTrans" runat="server"></web:DropDownList>
  430. </td>
  431. </tr>
  432. <tr>
  433. <td class="td1">排序:</td>
  434. <td class="td2">
  435. <input type="text" id="txtTransSort" class="mini-spinner" minvalue="0" maxvalue="100" />
  436. </td>
  437. </tr>
  438. </table>
  439. </div>
  440. <div id="win_line" class="mini-window" title="生成" style="width: 300px; height: 210px;">
  441. <div class="mini-toolbar" style="border-top: 0; border-left: 0; border-right: 0;">
  442. <a class="mini-button" iconcls="icon-save" plain="true" onclick="saveLineFn()">保存</a>
  443. </div>
  444. <table class="win_tb" border="0" cellpadding="0" cellspacing="0">
  445. <tr>
  446. <td class="td1">前缀:</td>
  447. <td class="td2">
  448. <input type="text" id="txtPrev" class="mini-textbox" minvalue="0" maxvalue="100" />
  449. </td>
  450. </tr>
  451. <tr>
  452. <td class="td1">开始:</td>
  453. <td class="td2">
  454. <input type="text" id="txtLineSt" class="mini-spinner" minvalue="0" maxvalue="1000" />
  455. </td>
  456. </tr>
  457. <tr>
  458. <td class="td1">数量:</td>
  459. <td class="td2">
  460. <input type="text" id="txtLineEt" class="mini-spinner" minvalue="0" maxvalue="1000" />
  461. </td>
  462. </tr>
  463. </table>
  464. </div>
  465. </form>
  466. </div>
  467. </div>
  468. <asp:Literal ID="litTree" runat="server"></asp:Literal>
  469. </body>
  470. </html>