DicPage.aspx 20 KB

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