setting_proxy.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>服务公司管理</title>
  5. <meta http-equiv="X-UA-Compatible" content="IE=8" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <link rel="stylesheet" type="text/css" href="http://static.vbdsm.com/js/lib/easyui/themes/vber/easyui.css" />
  8. <link rel="stylesheet" type="text/css" href="http://static.vbdsm.com/js/lib/easyui/themes/icon.css" />
  9. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/jquery-1.8.0.min.js"></script>
  10. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/highcharts/highcharts.js"></script>
  11. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/easyui/jquery.easyui.min.js"></script>
  12. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
  13. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/loadmask/jquery.loadmask.min.js"></script>
  14. <script type="text/javascript" src="http://static.vbdsm.com/js/static.support.js"></script>
  15. <script type="text/javascript" src="http://static.vbdsm.com/js/easyui.support.js"></script>
  16. <script type="text/javascript" src="http://static.vbdsm.com/js/common.tools.js"></script>
  17. <script type="text/javascript" src="http://static.vbdsm.com/js/util.js"></script>
  18. <style type="text/css">
  19. .datagrid-cell-rownumber {
  20. height: 26px;
  21. }
  22. </style>
  23. <script type="text/javascript" charset="UTF-8"></script>
  24. </head>
  25. <body>
  26. <div style="width: 100%; height: 100%">
  27. <table id="easyui-datagrid-tab"></table>
  28. </div>
  29. <!-- 新增、修改窗口 -->
  30. <div id="proxy-window" style="top: 150px; width: 460px; height: 350px; overflow-x: hidden" data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closed:true,resizable:false">
  31. <form id="memberFrm" target="ajaxResult" method="post">
  32. <input type="hidden" name="id" />
  33. <table style="width: 450px; border: 0; font-size: 12px; margin-top: 5px">
  34. <tbody>
  35. <tr>
  36. <td style="width: 100px" align="right">名称:</td>
  37. <td style="width: 330px"><input id="name" name="name" style="width: 313px" class="easyui-validatebox easyui-textbox" autocomplete="off" maxlength="120" class="textbox" required="true" /><span style="color: #ff0000">*</span></td>
  38. </tr>
  39. <tr>
  40. <td align="right">所在省市:</td>
  41. <td>
  42. <input id="province" name="province" style="width: 100px" required="true" />
  43. <input id="city" name="city" style="width: 100px" required="true" />
  44. <input id="district" name="district" style="width: 100px" />
  45. </td>
  46. </tr>
  47. <tr>
  48. <td align="right">级别:</td>
  49. <td>
  50. <select id="tg" class="easyui-validatebox easyui-combobox" name="tg" style="width: 100px">
  51. <option value="1">总部</option>
  52. <option value="0">服务商/代理</option>
  53. <option value="2">服务公司</option>
  54. </select>
  55. <!-- <input id="higherOrg" name="higherOrg" style="width: 230px;" value="0"/> -->
  56. </td>
  57. </tr>
  58. <tr>
  59. <td align="right">上级公司:</td>
  60. <td>
  61. <input id="higherOrg" name="higherOrg" style="width: 230px" />
  62. </td>
  63. </tr>
  64. <tr>
  65. <td align="right">负责人:</td>
  66. <td><input id="principal" name="principal" style="width: 150px" class="easyui-validatebox easyui-textbox" autocomplete="off" maxlength="20" class="textbox" required="true" /><span style="color: #ff0000">*</span></td>
  67. </tr>
  68. <tr>
  69. <td align="right">联系电话:</td>
  70. <td><input id="tel" name="tel" style="width: 150px" class="easyui-validatebox easyui-textbox" autocomplete="off" maxlength="20" class="textbox" required="true" /><span style="color: #ff0000">*</span></td>
  71. </tr>
  72. <tr>
  73. <td align="right">坐标:</td>
  74. <td>
  75. <input id="coordinate" name="coordinate" style="width: 150px" class="easyui-validatebox easyui-textbox" autocomplete="off" maxlength="100" class="textbox" />
  76. </td>
  77. </tr>
  78. <tr>
  79. <td align="right">详细地址:</td>
  80. <td>
  81. <input id="address" name="address" style="width: 313px" class="easyui-validatebox easyui-textbox" autocomplete="off" maxlength="100" class="textbox" />
  82. </td>
  83. </tr>
  84. <tr id="siteTr" style="display: none">
  85. <td align="right">所属机构站点:</td>
  86. <td id="siteTd"><input type="checkbox" name="site" value="0" /></td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. </form>
  91. <div align="center" style="bottom: 15px; width: 98%">
  92. <hr style="color: #045b83; border: 1px solid; margin-left: 10px; margin-right: 10px" />
  93. <a style="" href="javascript:void(0)" onclick="return saveProxy();" id="btn-save" icon="icon-save">保存</a>
  94. <a href="javascript:void(0)" onclick="closeWindow()" id="btn-undo" icon="icon-undo">取消</a>
  95. </div>
  96. </div>
  97. <div id="user-window" title="用户管理" class="easyui-tabs" style="top: 150px; width: 550px; height: 400px" data-options="iconCls:'pag-list',modal:true,minimizable:false,maximizable:false,closed:true,resizable:false">
  98. <div title="已分配">
  99. <table class="easyui-datagrid" id="allotTable" style="width: 100%; height: 345px" data-options="rownumbers:true,method:'get',border:false,toolbar:'#allotTab', pagination:true, pageSize:2">
  100. <thead>
  101. <tr>
  102. <th data-options="field:'ck',checkbox:true,width:80"></th>
  103. <th data-options="field:'realName',width:120,align:'center'">用户名</th>
  104. <th data-options="field:'loginName',width:120,align:'center'">用户账号</th>
  105. <th
  106. data-options="field:'state',width:120,align:'center',formatter:function(value,row){
  107. if(value==0)return '关闭';
  108. if(value==1)return '开启'; }">
  109. 用户状态
  110. </th>
  111. <th
  112. data-options="field:'expiredTime',width:120,align:'center',formatter:function(value,row){
  113. return new Date(value).format('yyyy-MM-dd') }">
  114. 过期时间
  115. </th>
  116. </tr>
  117. </thead>
  118. </table>
  119. <div id="allotTab" style="height: auto">
  120. <div>
  121. <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="return confimUnAllot()">取消分配</a>
  122. </div>
  123. </div>
  124. </div>
  125. <div title="未分配">
  126. <table class="easyui-datagrid" id="noAllotTable" style="width: 100%; height: 345px" data-options="rownumbers:true, method:'get', border:false, toolbar:'#noAllotTab', pagination:true, pageSize:2">
  127. <thead>
  128. <tr>
  129. <th data-options="field:'ck',checkbox:true,width:80"></th>
  130. <th data-options="field:'realName',width:120,align:'center'">用户名</th>
  131. <th data-options="field:'loginName',width:120,align:'center'">用户账号</th>
  132. <th
  133. data-options="field:'state',width:120,align:'center',formatter:function(value,row){
  134. if(value==0)return '关闭';
  135. if(value==1)return '开启'; }">
  136. 用户状态
  137. </th>
  138. <th
  139. data-options="field:'expiredTime',width:120,align:'center',formatter:function(value,row){
  140. return new Date(value).format('yyyy-MM-dd') }">
  141. 过期时间
  142. </th>
  143. </tr>
  144. </thead>
  145. </table>
  146. <div id="noAllotTab" style="height: auto">
  147. <div>
  148. 用户账号:<input type="text" name="userAccount" class="easyui-textbox" id="userAccount" />
  149. <input type="hidden" id="operaPCID" />
  150. <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="queryUnAllotUsers(0)">查询</a>
  151. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="allotUsers(true)">分配</a>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <script>
  157. //下拉框联动
  158. //一层Combo
  159. var srmCombx = $("#province").combobox({
  160. loader: function (param, success, error) {
  161. $.ajax({
  162. url: "/web/area/getComboxData.json",
  163. dataType: "json",
  164. data: { parentId: 0 },
  165. success: function (data) {
  166. //data.unshift({id : '', title : '-请选择-'});
  167. success(data)
  168. },
  169. error: function () {
  170. error.apply(this, arguments)
  171. },
  172. })
  173. },
  174. onSelect: function (record) {
  175. // onSelect 用户点击时触发的事件
  176. // 在此的意义在于,用户点击一级后自动二级combobox
  177. piperowCombx
  178. .combobox({
  179. loader: function (param, success, error) {
  180. $.ajax({
  181. url: "/web/area/getComboxData.json",
  182. dataType: "json",
  183. data: { parentId: $("#province").combobox("getValue") },
  184. success: function (data) {
  185. //data.unshift({id : '', title : '全部'});
  186. success(data)
  187. },
  188. error: function () {
  189. error.apply(this, arguments)
  190. },
  191. })
  192. },
  193. onSelect: function (record) {
  194. // 这里也使用了onSelect事件,在二级combobox被用户点击时触发三级combobox
  195. pipeCombx.combobox({
  196. loader: function (param, success, error) {
  197. $.ajax({
  198. url: "/web/area/getComboxData.json",
  199. dataType: "json",
  200. data: { parentId: $("#city").combobox("getValue") },
  201. success: function (data) {
  202. // data.unshift({id : '', title : '全部'});
  203. success(data)
  204. },
  205. error: function () {
  206. error.apply(this, arguments)
  207. },
  208. })
  209. },
  210. valueField: "id",
  211. textField: "title",
  212. //value : '',
  213. editable: false,
  214. })
  215. },
  216. onLoadSuccess: function () {
  217. //清空三级下拉框 就是成功加载完触发的事件 当一级combobox改变时,二级和三级就需要清空
  218. //alert("111");
  219. pipeCombx.combobox("clear")
  220. },
  221. valueField: "id",
  222. textField: "title",
  223. //value : '',
  224. editable: false,
  225. })
  226. .combobox("clear") //清空二级下拉框
  227. },
  228. valueField: "id",
  229. textField: "title",
  230. //value : '',
  231. editable: false,
  232. onLoadSuccess: function () {
  233. //记载一级combobox时,二级和三级清空
  234. piperowCombx.combobox("clear")
  235. pipeCombx.combobox("clear")
  236. },
  237. })
  238. /******************************************************************************************************/
  239. //下面的俩个是组件,
  240. //二层Combo
  241. var piperowCombx = $("#city").combobox({
  242. loader: function (param, success, error) {
  243. var parentId = $("#province").combobox("getValue")
  244. if (parentId != null && parentId != "") {
  245. $.ajax({
  246. url: "/web/area/getComboxData.json",
  247. dataType: "json",
  248. data: { parentId: parentId },
  249. success: function (data) {
  250. //data.unshift({id:'',title:'全部'});
  251. success(data)
  252. },
  253. error: function () {
  254. error.apply(this, arguments)
  255. },
  256. })
  257. }
  258. },
  259. valueField: "id",
  260. textField: "title",
  261. //value:'',
  262. editable: false,
  263. })
  264. //三层Combo
  265. var pipeCombx = $("#district").combobox({
  266. loader: function (param, success, error) {
  267. var parentId = $("#province").combobox("getValue")
  268. if (parentId != null && parentId != "") {
  269. $.ajax({
  270. url: "/web/area/getComboxData.json",
  271. dataType: "json",
  272. data: { parentId: parentId },
  273. success: function (data) {
  274. //data.unshift({id:'',title:'全部'});
  275. success(data)
  276. },
  277. error: function () {
  278. error.apply(this, arguments)
  279. },
  280. })
  281. $("#district").show()
  282. }
  283. },
  284. valueField: "id",
  285. textField: "title",
  286. editable: false,
  287. })
  288. var tableObj = $("#easyui-datagrid-tab")
  289. var screenWidth = document.body.clientWidth
  290. var tableWidth = screenWidth * 0.95
  291. $(function () {
  292. initGridData()
  293. })
  294. //分页控件
  295. function initGridData() {
  296. //获取DataGrid分页组件对象
  297. var p = $("#easyui-datagrid-tab").datagrid("getPager")
  298. //设置分页组件参数
  299. $(p).pagination({
  300. pageSize: 20,
  301. pageNumber: 1,
  302. pageList: [10, 20, 50],
  303. onSelectPage: function (pageNumber, pageSize) {
  304. getData(pageNumber, pageSize)
  305. },
  306. })
  307. var obj = $(p).pagination("options")
  308. getData(obj.pageNumber, obj.pageSize)
  309. }
  310. //表格数据查询
  311. function getData(pageNumber, pageSize) {
  312. ajax({
  313. url: "/web/proxy/getList.json",
  314. type: "post",
  315. dataType: "json",
  316. data: { pageNo: pageNumber, pageSize: pageSize },
  317. success: function (data) {
  318. tableObj.datagrid("loadData", data)
  319. ResizeDG("easyui-datagrid-tab", 0, 0)
  320. },
  321. error: function () {
  322. alert("载入数据发生错误,请重试。")
  323. },
  324. })
  325. }
  326. //页面初始化加载数据
  327. tableObj.datagrid({
  328. fit: true,
  329. fitcolumns: true,
  330. pagination: true,
  331. pageSize: 20,
  332. border: false,
  333. rownumbers: true,
  334. singleSelect: true,
  335. selectOnCheck: false,
  336. checkOnSelect: true,
  337. columns: [
  338. [
  339. { field: "checkId", width: tableWidth * 0.1, checkbox: true },
  340. {
  341. field: "id",
  342. title: "操作",
  343. width: 170,
  344. align: "center",
  345. formatter: function (value, rec) {
  346. return '<a class="tb_btn_modify" href="javascript:modify(' + rec.id + ');" >修改</a> ' + '<a class="tb_btn_man" href="javascript:userDistribution(' + rec.id + ');" >用户</a> ' + '<a class="tb_btn_remove" href="javascript:deleteProxy(' + rec.id + ');" >删除</a>'
  347. },
  348. },
  349. { field: "name", title: "名称", width: tableWidth * 0.2, align: "left" },
  350. {
  351. field: "tg",
  352. title: "级别",
  353. width: tableWidth * 0.1,
  354. align: "center",
  355. formatter: function (value, rec) {
  356. if (0 == rec.tg) {
  357. return "服务商/代理"
  358. } else if (1 == rec.tg) {
  359. return "总部"
  360. } else if (2 == rec.tg) {
  361. return "服务公司"
  362. }
  363. },
  364. },
  365. { field: "higherOrgName", title: "上级", width: tableWidth * 0.1, align: "center" },
  366. { field: "principal", title: "负责人", width: tableWidth * 0.1, align: "center" },
  367. { field: "tel", title: "联系电话", width: tableWidth * 0.1, align: "center" },
  368. { field: "address", title: "详细地址", width: tableWidth * 0.22, align: "left" },
  369. ],
  370. ],
  371. toolbar: [
  372. {
  373. text: "新增",
  374. iconCls: "icon-add",
  375. handler: add,
  376. },
  377. "-",
  378. {
  379. text: "删除",
  380. iconCls: "icon-remove",
  381. handler: removeBatch,
  382. },
  383. "-",
  384. {
  385. text: "取消",
  386. iconCls: "icon-undo",
  387. handler: undo,
  388. },
  389. ],
  390. onLoadError: function () {
  391. alert("载入数据发生错误,请重试。")
  392. },
  393. onLoadSuccess: function (data) {
  394. $(".tb_btn_modify").linkbutton({ iconCls: "icon-edit", plain: true })
  395. $(".tb_btn_man").linkbutton({ iconCls: "icon-man", plain: true })
  396. $(".tb_btn_remove").linkbutton({ iconCls: "icon-remove", plain: true })
  397. },
  398. })
  399. //取消
  400. function undo() {
  401. tableObj.datagrid("rejectChanges")
  402. editIndex = undefined
  403. }
  404. $("#btn-save,#btn-undo").linkbutton()
  405. //增加、修改
  406. win = $("#proxy-window").window({
  407. closed: true,
  408. })
  409. //用户分配窗口关闭
  410. win_user = $("#user-window").window({
  411. closed: true,
  412. })
  413. //用户分配窗口打开
  414. function userDistribution(id) {
  415. $("#operaPCID").val(id)
  416. $("#userAccount").textbox("setValue", "")
  417. settingAllotPagination(id)
  418. settingUnAllotPagination(0)
  419. win_user.window("open")
  420. }
  421. //allotTable分页控件
  422. function settingAllotPagination(id) {
  423. //获取DataGrid分页组件对象
  424. var allot = $("#allotTable").datagrid("getPager")
  425. //设置分页组件参数
  426. $(allot).pagination({
  427. pageSize: 10,
  428. pageNumber: 1,
  429. pageList: [10, 15, 20, 40],
  430. onSelectPage: function (pageNumber, pageSize) {
  431. queryAllotUsers(id, pageNumber, pageSize)
  432. },
  433. })
  434. var obj = $(allot).pagination("options")
  435. queryAllotUsers(id, obj.pageNumber, obj.pageSize)
  436. }
  437. //noAllotTable分页控件
  438. function settingUnAllotPagination(id) {
  439. //获取DataGrid分页组件对象
  440. var noAllot = $("#noAllotTable").datagrid("getPager")
  441. //设置分页组件参数
  442. $(noAllot).pagination({
  443. pageSize: 10,
  444. pageNumber: 1,
  445. pageList: [10, 15, 20, 40],
  446. onSelectPage: function (pageNumber, pageSize) {
  447. queryUnAllotUsers(id, pageNumber, pageSize)
  448. },
  449. })
  450. var obj = $(noAllot).pagination("options")
  451. queryUnAllotUsers(id, obj.pageNumber, obj.pageSize)
  452. }
  453. //已分配用户查询
  454. function queryAllotUsers(pcId, pageNumber, pageSize) {
  455. ajax({
  456. url: "/web/user/getUserByContion.json",
  457. type: "post",
  458. dataType: "json",
  459. data: { proxyCompanyId: pcId, pageNo: pageNumber, pageSize: pageSize },
  460. success: function (data) {
  461. $("#allotTable").datagrid("loadData", data.data)
  462. },
  463. })
  464. }
  465. //未分配用户查询
  466. function queryUnAllotUsers(pcId, pageNumber, pageSize) {
  467. var userAccount = $("#userAccount").val()
  468. ajax({
  469. url: "/web/user/getUserByContion.json",
  470. type: "post",
  471. dataType: "json",
  472. data: {
  473. proxyCompanyId: pcId,
  474. loginName: userAccount,
  475. pageNo: pageNumber,
  476. pageSize: pageSize,
  477. },
  478. success: function (data) {
  479. $("#noAllotTable").datagrid("loadData", data.data)
  480. },
  481. })
  482. }
  483. function confimUnAllot() {
  484. confirm("警告", "将解除分配关系,是否确认取消分配?", function (data) {
  485. if (data) {
  486. allotUsers(false)
  487. } else {
  488. return false
  489. }
  490. })
  491. }
  492. //用户分配
  493. function allotUsers(flag) {
  494. var rows = null
  495. var oid = $("#operaPCID").val()
  496. var proxyCompanyId = 0
  497. if (flag) {
  498. proxyCompanyId = $("#operaPCID").val()
  499. rows = $("#noAllotTable").datagrid("getSelections")
  500. } else {
  501. rows = $("#allotTable").datagrid("getSelections")
  502. }
  503. if (rows.length > 0) {
  504. var ids = ""
  505. for (var i = 0; i < rows.length; i++) {
  506. var id = rows[i].id
  507. ids += id + ","
  508. }
  509. ids = ids.substring(0, ids.length - 1)
  510. ajax({
  511. url: "/web/user/addProxyUserBind.json",
  512. type: "post",
  513. dataType: "json",
  514. data: { userIds: ids, proxyCompanyId: proxyCompanyId },
  515. success: function (json) {
  516. alert(json.msg)
  517. if (json.status == 1) {
  518. queryAllotUsers(oid)
  519. queryUnAllotUsers(0)
  520. }
  521. },
  522. error: function (json) {
  523. alert("用户分配出错了,请重试")
  524. },
  525. })
  526. } else {
  527. alert("请选择用户")
  528. }
  529. }
  530. //服务公司添加、修改的form表单
  531. form = win.find("form")
  532. //新增
  533. function add() {
  534. $("#higherOrg").combobox({
  535. //上级机构数据请求
  536. loader: function (param, success, error) {
  537. $.ajax({
  538. url: "/web/proxy/getComboxData.json",
  539. dataType: "json",
  540. success: function (data) {
  541. success(data)
  542. },
  543. error: function () {
  544. error.apply(this, arguments)
  545. },
  546. })
  547. },
  548. valueField: "id",
  549. textField: "title",
  550. editable: false,
  551. })
  552. $.ajax({
  553. //机构站点数据请求,如果不是超级管理员,不予显示
  554. url: "/web/proxy/getSiteData.json",
  555. dataType: "json",
  556. success: function (jsonData) {
  557. var html = ""
  558. for (var i = 0; i < jsonData.length; i++) {
  559. var id = jsonData[i].id
  560. var name = jsonData[i].name
  561. var checked = jsonData[i].checked
  562. if (checked) {
  563. html += "<input type='checkbox' name='site' value='" + id + "' checked='checked' />" + name
  564. } else {
  565. html += "<input type='checkbox' name='site' value='" + id + "' />" + name
  566. }
  567. html += "<br/>"
  568. //修改为每个平台占一行
  569. /* if((i+1)%2 == 0){
  570. html += "<br/>";
  571. } */
  572. }
  573. $("#siteTd").html(html)
  574. $("#siteTr").show()
  575. },
  576. error: function () {
  577. error.apply(this, arguments)
  578. },
  579. })
  580. win.window("open")
  581. win.dialog("setTitle", "新增")
  582. form.form("clear")
  583. form.form("load", { tg: 1 })
  584. }
  585. //修改
  586. function modify(id) {
  587. $("#higherOrg").combobox({
  588. loader: function (param, success, error) {
  589. $.ajax({
  590. url: "/web/proxy/getComboxData.json",
  591. dataType: "json",
  592. success: function (data) {
  593. success(data)
  594. },
  595. error: function () {
  596. error.apply(this, arguments)
  597. },
  598. })
  599. },
  600. valueField: "id",
  601. textField: "title",
  602. editable: false,
  603. })
  604. $.getJSON("/web/proxy/getOne/" + id + ".json", function (json) {
  605. form.form("load", json)
  606. if (json.city == 0) {
  607. piperowCombx.combobox("clear")
  608. }
  609. if (json.district == 0) {
  610. pipeCombx.combobox("clear")
  611. }
  612. //加载二级下拉框
  613. piperowCombx
  614. .combobox({
  615. loader: function (param, success, error) {
  616. $.ajax({
  617. url: "/web/area/getComboxData.json",
  618. dataType: "json",
  619. data: { parentId: json.province },
  620. success: function (data) {
  621. $("#city").combobox("select", json.city)
  622. success(data)
  623. },
  624. error: function () {
  625. error.apply(this, arguments)
  626. },
  627. })
  628. },
  629. valueField: "id",
  630. textField: "title",
  631. //value : '',
  632. editable: false,
  633. })
  634. .combobox("clear") //清空二级下拉框
  635. //加载三级下拉框
  636. if (json.district != null && json.district != "undefind" && json.district != 0) {
  637. pipeCombx.combobox({
  638. loader: function (param, success, error) {
  639. $.ajax({
  640. url: "/web/area/getComboxData.json",
  641. dataType: "json",
  642. data: { parentId: json.city },
  643. success: function (data) {
  644. $("#district").combobox("select", json.district)
  645. success(data)
  646. },
  647. error: function () {
  648. error.apply(this, arguments)
  649. },
  650. })
  651. },
  652. valueField: "id",
  653. textField: "title",
  654. //value : '',
  655. editable: false,
  656. })
  657. }
  658. })
  659. $.ajax({
  660. //机构站点数据请求,如果不是超级管理员,不予显示
  661. url: "/web/proxy/getSiteData.json",
  662. dataType: "json",
  663. data: { orgId: id },
  664. success: function (jsonData) {
  665. var html = ""
  666. for (var i = 0; i < jsonData.length; i++) {
  667. var id = jsonData[i].id
  668. var name = jsonData[i].name
  669. var checked = jsonData[i].checked
  670. if (checked) {
  671. html += "<input type='checkbox' name='site' value='" + id + "' checked='checked' />" + name
  672. } else {
  673. html += "<input type='checkbox' name='site' value='" + id + "' />" + name
  674. }
  675. html += "<br/>"
  676. /* if((i+1)%2 == 0){
  677. html += "<br/>";
  678. } */
  679. }
  680. $("#siteTd").html(html)
  681. $("#siteTr").show()
  682. },
  683. error: function () {
  684. error.apply(this, arguments)
  685. },
  686. })
  687. win.window("open")
  688. win.dialog("setTitle", "修改")
  689. }
  690. function closeWindow() {
  691. win.window("close")
  692. win_user.window("close")
  693. }
  694. //保存
  695. function saveProxy() {
  696. $("#memberFrm").form("submit", {
  697. url: "/web/proxy/addOrModify.json",
  698. onSubmit: function () {
  699. return $(this).form("validate")
  700. },
  701. success: function (json) {
  702. var result = eval("(" + json + ")")
  703. if (result.status == 1) {
  704. closeWindow()
  705. initGridData()
  706. } else {
  707. alert("数据保存出错了")
  708. }
  709. },
  710. })
  711. }
  712. //删除
  713. function deleteProxy(id) {
  714. confirm("警告", "是否确认删除?", function (data) {
  715. if (data) {
  716. ajax({
  717. url: "/web/proxy/remove/" + id + ".json",
  718. type: "post",
  719. dataType: "json",
  720. success: function (json) {
  721. if (json.status == 1) {
  722. initGridData()
  723. } else {
  724. alert(json.msg)
  725. }
  726. },
  727. })
  728. }
  729. })
  730. }
  731. //批量删除
  732. function removeBatch() {
  733. var rows = tableObj.datagrid("getChecked")
  734. if (rows.length > 0) {
  735. confirm("警告", "是否确认删除?", function (data) {
  736. if (data) {
  737. var ids = ""
  738. for (var i = 0; i < rows.length; i++) {
  739. var id = rows[i].id
  740. ids += id + ","
  741. }
  742. ids = ids.substring(0, ids.length - 1)
  743. ajax({
  744. url: "/web/proxy/removeBatch.json",
  745. type: "post",
  746. dataType: "json",
  747. data: { ids: ids },
  748. success: function (json) {
  749. if (json.status == 1) {
  750. initGridData()
  751. } else {
  752. alert(json.msg)
  753. }
  754. },
  755. })
  756. }
  757. })
  758. } else {
  759. alert("请选择要删除的项!")
  760. }
  761. }
  762. </script>
  763. </body>
  764. </html>