Nav apraksta

zhibiaoguanli.js 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. var keys;
  2. var Cids; //分类id
  3. var ids; //指标id
  4. var CategoryName; //分类名称
  5. var Sort; //排序
  6. var Score; //分数
  7. var Title; //标题
  8. var Remark; //备注
  9. var Pid; //父id
  10. var Left_Cids;
  11. var Left_Sort;
  12. var Left_Score;
  13. var Left_Pid;
  14. var $tableLeft = $("#tbr");
  15. var $tableLeft1 = $("#tb1");
  16. var token = $.cookie("token");
  17. Finish();
  18. IndexCategoryGe();
  19. Select();
  20. //所有指标
  21. $(".rightAll").click(function () {
  22. Finish();
  23. });
  24. //搜索功能
  25. $(".sear").click(function () {
  26. keys = $("#Keys").val();
  27. Finish(keys);
  28. });
  29. //*删除*/
  30. $(".inpBox").hover(
  31. function (event) {
  32. $(this).children(".de_icon").show();
  33. event.stopPropagation();
  34. },
  35. function () {
  36. $(this).children(".de_icon").hide();
  37. }
  38. );
  39. $(".de_icon").click(function (event) {
  40. event.stopPropagation();
  41. $(this).siblings("input").eq(0).val("");
  42. $(this).siblings("input").eq(1).val("");
  43. if ($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
  44. getRY($(".zrid"), $("#zrbm").val());
  45. }
  46. });
  47. $(".inpBox").mouseleave(function () {
  48. $(this).children(".addTree").hide();
  49. });
  50. $(".xl").click(function () {
  51. if ($(this).parent().find(".addTree").is(":hidden")) {
  52. $(this).parent().find(".addTree").show();
  53. } else {
  54. $(this).parent().find(".addTree").hide();
  55. }
  56. });
  57. //清空选项
  58. function Clean() {
  59. $(".model").hide();
  60. $("._CategoryName").val("");
  61. $("._Score").val("");
  62. $("._Sort").val("");
  63. $(".F_Title").val("");
  64. $(".F_Remark").val("");
  65. }
  66. ///////////////////////////////////左边表格
  67. /*获取选中行对象*/
  68. $tableLeft1.on("click-row.bs.table", function (e, row, ele) {
  69. $(".success").removeClass("success"); //去除之前选中的行的,选中样式
  70. $(ele).addClass("success"); //添加当前选中的 success样式用于区别
  71. Left_Cids = row.F_CategoryId; //分类ID
  72. Left_Pid = row.F_ParentId; //父id
  73. Right(Left_Cids);
  74. });
  75. //获取指标分类列表
  76. function IndexCategoryGe() {
  77. //销毁表格
  78. $tableLeft1.bootstrapTable("destroy");
  79. //初始化表格,动态从服务器加载数据
  80. $tableLeft1.bootstrapTable({
  81. method: "get", //使用get请求到服务器获取数据
  82. url: huayi.config.callcenter_url + "IndexCategory/GetList",
  83. contentType: "application/x-www-form-urlencoded",
  84. striped: true, //表格显示条纹
  85. pagination: true, //启动分页
  86. pageSize: 5, //每页显示的记录数
  87. pageNumber: 1, //当前第几页
  88. pageList: [5, 10, 50, 100], //记录数可选列表
  89. contentType: "application/x-www-form-urlencoded",
  90. search: false, //是否启用查询
  91. showColumns: false, //显示下拉框勾选要显示的列
  92. showRefresh: false, //显示刷新按钮
  93. sidePagination: "server", //表示服务端请求
  94. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  95. //设置为limit可以获取limit, offset, search, sort, order
  96. queryParamsType: "undefined",
  97. queryParams: function queryParams(params) {
  98. //设置查询参数
  99. var param = {
  100. page: params.pageNumber,
  101. pagesize: params.pageSize,
  102. token: token,
  103. };
  104. return param;
  105. },
  106. onLoadSuccess: function () {
  107. //加载成功时执行
  108. // layer.msg("加载成功");
  109. },
  110. onLoadError: function () {
  111. //加载失败时执行
  112. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  113. },
  114. });
  115. }
  116. //删除
  117. $(".leftDelete").click(function () {
  118. if (Left_Cids) {
  119. DelIndexCategory(Left_Cids);
  120. } else {
  121. layer.msg("没有可删除的选项!");
  122. }
  123. });
  124. //删除功能
  125. function DelIndexCategory(Left_Cids) {
  126. layer.confirm(
  127. "确定删除吗?",
  128. {
  129. btn: ["是", "否"], //按钮
  130. },
  131. function () {
  132. $.ajax({
  133. type: "post",
  134. url:
  135. huayi.config.callcenter_url +
  136. "IndexCategory/DelIndexCategory",
  137. dataType: "json",
  138. data: {
  139. id: Left_Cids,
  140. token: token,
  141. },
  142. async: true,
  143. success: function (data) {
  144. if (data.state == "success") {
  145. layer.msg("删除成功");
  146. IndexCategoryGe();
  147. Select();
  148. }
  149. },
  150. });
  151. }
  152. );
  153. }
  154. ///修改功能
  155. $(".leftChange ").click(function () {
  156. if (Left_Cids) {
  157. $(".model").show();
  158. $(".leftBox").show();
  159. $(".Left_xgbtn").show();
  160. $(".rightBox").hide();
  161. $("#Left_add").hide();
  162. $("#Left_xgbtn").show();
  163. GetIndexCategory(Left_Cids);
  164. } else {
  165. layer.msg("没有可修改的选项!");
  166. Clean();
  167. }
  168. });
  169. ///左边获取指标分类
  170. function GetIndexCategory(Left_Cids) {
  171. $.ajax({
  172. type: "get",
  173. url: huayi.config.callcenter_url + "IndexCategory/GetIndexCategory",
  174. dataType: "json",
  175. data: {
  176. id: Left_Cids,
  177. token: token,
  178. },
  179. async: true,
  180. success: function (data) {
  181. if (data.state == "success") {
  182. $("#Left_CategoryName").val(data.data.F_CategoryName);
  183. $("#Left_Sort").val(data.data.F_Sort);
  184. $("#Left_ParentId").val(data.data.F_ParentId);
  185. }
  186. },
  187. });
  188. }
  189. //下拉框
  190. function Select() {
  191. $.ajax({
  192. type: "get",
  193. url: huayi.config.callcenter_url + "IndexCategory/GetAllList",
  194. dataType: "json",
  195. async: true,
  196. data: {
  197. token: token,
  198. },
  199. success: function (data) {
  200. if (data.state == "success") {
  201. $("#Left_ParentId").empty();
  202. $("#Left_ParentId").append("<option value=''>请选择</option>");
  203. $(data.data).each(function (i, n) {
  204. $(
  205. '<option value="' +
  206. n.F_CategoryId +
  207. '">' +
  208. n.F_CategoryName +
  209. "</option>"
  210. ).appendTo($("#Left_ParentId"));
  211. });
  212. }
  213. },
  214. });
  215. }
  216. //编辑指标分类
  217. function EditIndexCategory(Left_Cids, Left_CategoryName, Left_Sort, Left_Pid) {
  218. $.ajax({
  219. type: "post",
  220. url: huayi.config.callcenter_url + "IndexCategory/EditIndexCategory",
  221. dataType: "json",
  222. data: {
  223. id: Left_Cids,
  224. categoryName: Left_CategoryName,
  225. sort: Left_Sort,
  226. pid: Left_Pid,
  227. token: token,
  228. },
  229. async: true,
  230. success: function (data) {
  231. if (data.state == "success") {
  232. layer.msg("修改成功");
  233. IndexCategoryGe();
  234. Left_clean();
  235. Select();
  236. }
  237. },
  238. });
  239. }
  240. $("#Left_xgbtn").click(function () {
  241. if ($("#Left_CategoryName").val() === "") {
  242. layer.msg("分类名称不能为空");
  243. return;
  244. }
  245. Left_CategoryName = escape($("#Left_CategoryName").val());
  246. Left_Sort = $("#Left_Sort").val();
  247. EditIndexCategory(Left_Cids, Left_CategoryName, Left_Sort, Left_Pid);
  248. });
  249. //增加
  250. $(".leftAdd").click(function () {
  251. $("#Left_CategoryName").val("");
  252. $("#Left_Sort").val("");
  253. $(".model").show();
  254. $(".rightBox").hide();
  255. $("#Left_xgbtn").hide();
  256. $(".leftBox").show();
  257. });
  258. $("#Left_add").click(function () {
  259. if ($("#Left_CategoryName").val() === "") {
  260. layer.msg("分类名称不能为空");
  261. return;
  262. }
  263. Left_CategoryName = escape($("#Left_CategoryName").val());
  264. Left_Sort = $("#Left_Sort").val();
  265. AddIndexCategory(Left_CategoryName, Left_Sort, Left_Pid);
  266. });
  267. function AddIndexCategory(Left_CategoryName, Left_Sort, Left_Pid) {
  268. $.ajax({
  269. type: "post",
  270. url: huayi.config.callcenter_url + "IndexCategory/AddIndexCategory",
  271. dataType: "json",
  272. data: {
  273. categoryName: Left_CategoryName,
  274. sort: Left_Sort,
  275. pid: Left_Pid,
  276. token: token,
  277. },
  278. async: true,
  279. success: function (data) {
  280. if (data.state == "success") {
  281. layer.msg("添加成功");
  282. IndexCategoryGe();
  283. Left_clean();
  284. Select();
  285. }
  286. },
  287. });
  288. }
  289. function Left_clean() {
  290. $("#Left_CategoryName").val("");
  291. $("#Left_Sort").val("");
  292. $(".model").hide();
  293. }
  294. ////////////////////////////////////////////////////////////////右边表格
  295. function Finish(Keys, Left_Cids) {
  296. //销毁表格
  297. $tableLeft.bootstrapTable("destroy");
  298. //初始化表格,动态从服务器加载数据
  299. $tableLeft.bootstrapTable({
  300. method: "get", //使用get请求到服务器获取数据
  301. url: huayi.config.callcenter_url + "IndexBase/GetList",
  302. // url: "//117.158.196.116:8878/IndexBase/GetList",
  303. contentType: "application/x-www-form-urlencoded",
  304. striped: true, //表格显示条纹
  305. pagination: true, //启动分页
  306. pageSize: 5, //每页显示的记录数
  307. pageNumber: 1, //当前第几页
  308. pageList: [5, 10, 50, 100], //记录数可选列表
  309. contentType: "application/x-www-form-urlencoded",
  310. search: false, //是否启用查询
  311. showColumns: false, //显示下拉框勾选要显示的列
  312. showRefresh: false, //显示刷新按钮
  313. sidePagination: "server", //表示服务端请求
  314. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  315. //设置为limit可以获取limit, offset, search, sort, order
  316. queryParamsType: "undefined",
  317. queryParams: function queryParams(params) {
  318. //设置查询参数
  319. var param = {
  320. page: params.pageNumber,
  321. pagesize: params.pageSize,
  322. categoryid: Left_Cids || 0,
  323. key: Keys,
  324. token: token,
  325. };
  326. return param;
  327. },
  328. onLoadSuccess: function () {
  329. //加载成功时执行
  330. // layer.msg("加载成功");
  331. },
  332. onLoadError: function () {
  333. //加载失败时执行
  334. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  335. },
  336. });
  337. }
  338. function Right(Left_Cids) {
  339. $tableLeft.bootstrapTable("destroy");
  340. //初始化表格,动态从服务器加载数据
  341. $tableLeft.bootstrapTable({
  342. method: "get", //使用get请求到服务器获取数据
  343. url: huayi.config.callcenter_url + "IndexBase/GetList",
  344. contentType: "application/x-www-form-urlencoded",
  345. striped: true, //表格显示条纹
  346. pagination: true, //启动分页
  347. pageSize: 5, //每页显示的记录数
  348. pageNumber: 1, //当前第几页
  349. pageList: [5, 10, 50, 100], //记录数可选列表
  350. contentType: "application/x-www-form-urlencoded",
  351. search: false, //是否启用查询
  352. showColumns: false, //显示下拉框勾选要显示的列
  353. showRefresh: false, //显示刷新按钮
  354. sidePagination: "server", //表示服务端请求
  355. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  356. //设置为limit可以获取limit, offset, search, sort, order
  357. queryParamsType: "undefined",
  358. queryParams: function queryParams(params) {
  359. //设置查询参数
  360. var param = {
  361. page: params.pageNumber,
  362. pagesize: params.pageSize,
  363. categoryid: Left_Cids,
  364. token: token,
  365. };
  366. return param;
  367. },
  368. onLoadSuccess: function () {
  369. //加载成功时执行
  370. // layer.msg("加载成功");
  371. },
  372. onLoadError: function () {
  373. //加载失败时执行
  374. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  375. },
  376. });
  377. }
  378. /*获取选中行对象*/
  379. $tableLeft.on("click-row.bs.table", function (e, row, ele) {
  380. $(".success").removeClass("success"); //去除之前选中的行的,选中样式
  381. $(ele).addClass("success"); //添加当前选中的 success样式用于区别
  382. Cids = row.F_CategoryId; //分类ID
  383. ids = row.F_IndexId; //指标ID
  384. CategoryName = row.F_CategoryName; //分类名称
  385. Sort = row.F_Sort; //排序
  386. Pid = row.F_ParentId; //父id
  387. });
  388. //增加
  389. $(".rightAdd").click(function () {
  390. $("._CategoryName").val("");
  391. $("._Score").val("");
  392. $("._Sort").val("");
  393. $(".F_Title").val("");
  394. $(".F_Remark").val("");
  395. $(".model").show();
  396. $(".rightBox").show();
  397. $(".leftBox").hide();
  398. $("#add").show();
  399. $("#xg_btn").hide();
  400. });
  401. //修改功能
  402. $(".rightChange ").click(function () {
  403. if (ids) {
  404. $(".model").show();
  405. $(".rightBox").show();
  406. $("#add").hide();
  407. $(".leftBox").hide();
  408. $("#xg_btn").show();
  409. GetIndexBase(ids);
  410. } else {
  411. layer.msg("没有可修改的选项!");
  412. Clean();
  413. }
  414. });
  415. //删除
  416. $(".rightDelete").click(function () {
  417. if (ids) {
  418. Delet(ids);
  419. } else {
  420. layer.msg("没有可删除的选项!");
  421. }
  422. });
  423. //编号
  424. function setCode(val, row, index) {
  425. return index + 1;
  426. }
  427. //删除指标
  428. function Delet(ids) {
  429. layer.confirm(
  430. "确定删除吗?",
  431. {
  432. btn: ["是", "否"], //按钮
  433. },
  434. function () {
  435. $.ajax({
  436. type: "post",
  437. url: huayi.config.callcenter_url + "IndexBase/DelIndexBase",
  438. dataType: "json",
  439. data: {
  440. id: ids,
  441. token: token,
  442. },
  443. async: true,
  444. success: function (data) {
  445. if (data.state == "success") {
  446. layer.msg("删除成功");
  447. Finish();
  448. IndexCategoryGe();
  449. }
  450. },
  451. });
  452. }
  453. );
  454. }
  455. //关闭阴影
  456. $(".rbtr").click(function () {
  457. $(".model").hide();
  458. });
  459. //获取指标
  460. function GetIndexBase(ids) {
  461. $.ajax({
  462. type: "get",
  463. url: huayi.config.callcenter_url + "IndexBase/GetIndexBase",
  464. dataType: "json",
  465. data: {
  466. id: ids,
  467. token: token,
  468. },
  469. async: true,
  470. success: function (data) {
  471. if (data.state == "success") {
  472. $("._CategoryName").val(data.data.F_CategoryName);
  473. $("._Score").val(data.data.F_Score);
  474. $("._Sort").val(data.data.F_Sort);
  475. $(".F_Title").val(data.data.F_Title);
  476. $(".F_Remark").val(data.data.F_Remark);
  477. $("#Left_ParentId").val(data.data.F_CategoryId);
  478. }
  479. },
  480. });
  481. }
  482. //修改保存
  483. $("#xg_btn").click(function () {
  484. Cids = $("#Left_ParentId").val();
  485. CategoryName = $("._CategoryName").val();
  486. Score = $("._Score").val();
  487. Sort = $("._Sort").val();
  488. Title = $(".F_Title").val();
  489. Remark = $(".F_Remark").val();
  490. EditIndexBase(Cids, ids, Sort, Score, Title, Remark);
  491. });
  492. //增加按钮
  493. $("#add").click(function () {
  494. Cids = $("#Left_ParentId").val();
  495. Score = $("._Score").val();
  496. Sort = $("._Sort").val();
  497. Title = $(".F_Title").val();
  498. Remark = escape($(".F_Remark").val());
  499. AddIndexBase(Cids, Sort, Score, Title, Remark);
  500. });
  501. //编辑指标
  502. function EditIndexBase(Cids, ids, Sort, Score, Title, Remark) {
  503. $.ajax({
  504. type: "post",
  505. url: huayi.config.callcenter_url + "IndexBase/EditIndexBase",
  506. dataType: "json",
  507. data: {
  508. id: ids,
  509. cid: Cids, //指标分类id
  510. sort: Sort, //排序
  511. score: Score,
  512. title: Title,
  513. remark: Remark,
  514. token: token,
  515. },
  516. async: true,
  517. success: function (data) {
  518. if (data.state == "success") {
  519. Clean();
  520. layer.msg("修改成功!");
  521. Finish();
  522. IndexCategoryGe();
  523. }
  524. },
  525. });
  526. }
  527. //添加指标
  528. function AddIndexBase(Cids, Sort, Score, Title, Remark) {
  529. $.ajax({
  530. type: "post",
  531. url: huayi.config.callcenter_url + "IndexBase/AddIndexBase",
  532. dataType: "json",
  533. data: {
  534. cid: Cids, //指标分类id
  535. sort: Sort, //排序
  536. score: Score,
  537. title: Title,
  538. remark: Remark,
  539. token: token,
  540. },
  541. async: true,
  542. success: function (data) {
  543. if (data.state == "success") {
  544. Clean();
  545. layer.msg("添加成功!");
  546. Finish();
  547. IndexCategoryGe();
  548. }
  549. },
  550. });
  551. }