| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563 |
- var keys;
- var Cids; //分类id
- var ids; //指标id
- var CategoryName; //分类名称
- var Sort; //排序
- var Score; //分数
- var Title; //标题
- var Remark; //备注
- var Pid; //父id
- var Left_Cids;
- var Left_Sort;
- var Left_Score;
- var Left_Pid;
- var $tableLeft = $("#tbr");
- var $tableLeft1 = $("#tb1");
- var token = $.cookie("token");
- Finish();
- IndexCategoryGe();
- Select();
- //所有指标
- $(".rightAll").click(function () {
- Finish();
- });
- //搜索功能
- $(".sear").click(function () {
- keys = $("#Keys").val();
- Finish(keys);
- });
- //*删除*/
- $(".inpBox").hover(
- function (event) {
- $(this).children(".de_icon").show();
- event.stopPropagation();
- },
- function () {
- $(this).children(".de_icon").hide();
- }
- );
- $(".de_icon").click(function (event) {
- event.stopPropagation();
- $(this).siblings("input").eq(0).val("");
- $(this).siblings("input").eq(1).val("");
- if ($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
- getRY($(".zrid"), $("#zrbm").val());
- }
- });
- $(".inpBox").mouseleave(function () {
- $(this).children(".addTree").hide();
- });
- $(".xl").click(function () {
- if ($(this).parent().find(".addTree").is(":hidden")) {
- $(this).parent().find(".addTree").show();
- } else {
- $(this).parent().find(".addTree").hide();
- }
- });
- //清空选项
- function Clean() {
- $(".model").hide();
- $("._CategoryName").val("");
- $("._Score").val("");
- $("._Sort").val("");
- $(".F_Title").val("");
- $(".F_Remark").val("");
- }
- ///////////////////////////////////左边表格
- /*获取选中行对象*/
- $tableLeft1.on("click-row.bs.table", function (e, row, ele) {
- $(".success").removeClass("success"); //去除之前选中的行的,选中样式
- $(ele).addClass("success"); //添加当前选中的 success样式用于区别
- Left_Cids = row.F_CategoryId; //分类ID
- Left_Pid = row.F_ParentId; //父id
- Right(Left_Cids);
- });
- //获取指标分类列表
- function IndexCategoryGe() {
- //销毁表格
- $tableLeft1.bootstrapTable("destroy");
- //初始化表格,动态从服务器加载数据
- $tableLeft1.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "IndexCategory/GetList",
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 5, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [5, 10, 50, 100], //记录数可选列表
- contentType: "application/x-www-form-urlencoded",
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) {
- //设置查询参数
- var param = {
- page: params.pageNumber,
- pagesize: params.pageSize,
- token: token,
- };
- return param;
- },
- onLoadSuccess: function () {
- //加载成功时执行
- // layer.msg("加载成功");
- },
- onLoadError: function () {
- //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- },
- });
- }
- //删除
- $(".leftDelete").click(function () {
- if (Left_Cids) {
- DelIndexCategory(Left_Cids);
- } else {
- layer.msg("没有可删除的选项!");
- }
- });
- //删除功能
- function DelIndexCategory(Left_Cids) {
- layer.confirm(
- "确定删除吗?",
- {
- btn: ["是", "否"], //按钮
- },
- function () {
- $.ajax({
- type: "post",
- url:
- huayi.config.callcenter_url +
- "IndexCategory/DelIndexCategory",
- dataType: "json",
- data: {
- id: Left_Cids,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- layer.msg("删除成功");
- IndexCategoryGe();
- Select();
- }
- },
- });
- }
- );
- }
- ///修改功能
- $(".leftChange ").click(function () {
- if (Left_Cids) {
- $(".model").show();
- $(".leftBox").show();
- $(".Left_xgbtn").show();
- $(".rightBox").hide();
- $("#Left_add").hide();
- $("#Left_xgbtn").show();
- GetIndexCategory(Left_Cids);
- } else {
- layer.msg("没有可修改的选项!");
- Clean();
- }
- });
- ///左边获取指标分类
- function GetIndexCategory(Left_Cids) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "IndexCategory/GetIndexCategory",
- dataType: "json",
- data: {
- id: Left_Cids,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- $("#Left_CategoryName").val(data.data.F_CategoryName);
- $("#Left_Sort").val(data.data.F_Sort);
- $("#Left_ParentId").val(data.data.F_ParentId);
- }
- },
- });
- }
- //下拉框
- function Select() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "IndexCategory/GetAllList",
- dataType: "json",
- async: true,
- data: {
- token: token,
- },
- success: function (data) {
- if (data.state == "success") {
- $("#Left_ParentId").empty();
- $("#Left_ParentId").append("<option value=''>请选择</option>");
- $(data.data).each(function (i, n) {
- $(
- '<option value="' +
- n.F_CategoryId +
- '">' +
- n.F_CategoryName +
- "</option>"
- ).appendTo($("#Left_ParentId"));
- });
- }
- },
- });
- }
- //编辑指标分类
- function EditIndexCategory(Left_Cids, Left_CategoryName, Left_Sort, Left_Pid) {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "IndexCategory/EditIndexCategory",
- dataType: "json",
- data: {
- id: Left_Cids,
- categoryName: Left_CategoryName,
- sort: Left_Sort,
- pid: Left_Pid,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- layer.msg("修改成功");
- IndexCategoryGe();
- Left_clean();
- Select();
- }
- },
- });
- }
- $("#Left_xgbtn").click(function () {
- if ($("#Left_CategoryName").val() === "") {
- layer.msg("分类名称不能为空");
- return;
- }
- Left_CategoryName = escape($("#Left_CategoryName").val());
- Left_Sort = $("#Left_Sort").val();
- EditIndexCategory(Left_Cids, Left_CategoryName, Left_Sort, Left_Pid);
- });
- //增加
- $(".leftAdd").click(function () {
- $("#Left_CategoryName").val("");
- $("#Left_Sort").val("");
- $(".model").show();
- $(".rightBox").hide();
- $("#Left_xgbtn").hide();
- $(".leftBox").show();
- });
- $("#Left_add").click(function () {
- if ($("#Left_CategoryName").val() === "") {
- layer.msg("分类名称不能为空");
- return;
- }
- Left_CategoryName = escape($("#Left_CategoryName").val());
- Left_Sort = $("#Left_Sort").val();
- AddIndexCategory(Left_CategoryName, Left_Sort, Left_Pid);
- });
- function AddIndexCategory(Left_CategoryName, Left_Sort, Left_Pid) {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "IndexCategory/AddIndexCategory",
- dataType: "json",
- data: {
- categoryName: Left_CategoryName,
- sort: Left_Sort,
- pid: Left_Pid,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- layer.msg("添加成功");
- IndexCategoryGe();
- Left_clean();
- Select();
- }
- },
- });
- }
- function Left_clean() {
- $("#Left_CategoryName").val("");
- $("#Left_Sort").val("");
- $(".model").hide();
- }
- ////////////////////////////////////////////////////////////////右边表格
- function Finish(Keys, Left_Cids) {
- //销毁表格
- $tableLeft.bootstrapTable("destroy");
- //初始化表格,动态从服务器加载数据
- $tableLeft.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "IndexBase/GetList",
- // url: "//117.158.196.116:8878/IndexBase/GetList",
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 5, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [5, 10, 50, 100], //记录数可选列表
- contentType: "application/x-www-form-urlencoded",
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) {
- //设置查询参数
- var param = {
- page: params.pageNumber,
- pagesize: params.pageSize,
- categoryid: Left_Cids || 0,
- key: Keys,
- token: token,
- };
- return param;
- },
- onLoadSuccess: function () {
- //加载成功时执行
- // layer.msg("加载成功");
- },
- onLoadError: function () {
- //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- },
- });
- }
- function Right(Left_Cids) {
- $tableLeft.bootstrapTable("destroy");
- //初始化表格,动态从服务器加载数据
- $tableLeft.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "IndexBase/GetList",
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 5, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [5, 10, 50, 100], //记录数可选列表
- contentType: "application/x-www-form-urlencoded",
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) {
- //设置查询参数
- var param = {
- page: params.pageNumber,
- pagesize: params.pageSize,
- categoryid: Left_Cids,
- token: token,
- };
- return param;
- },
- onLoadSuccess: function () {
- //加载成功时执行
- // layer.msg("加载成功");
- },
- onLoadError: function () {
- //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- },
- });
- }
- /*获取选中行对象*/
- $tableLeft.on("click-row.bs.table", function (e, row, ele) {
- $(".success").removeClass("success"); //去除之前选中的行的,选中样式
- $(ele).addClass("success"); //添加当前选中的 success样式用于区别
- Cids = row.F_CategoryId; //分类ID
- ids = row.F_IndexId; //指标ID
- CategoryName = row.F_CategoryName; //分类名称
- Sort = row.F_Sort; //排序
- Pid = row.F_ParentId; //父id
- });
- //增加
- $(".rightAdd").click(function () {
- $("._CategoryName").val("");
- $("._Score").val("");
- $("._Sort").val("");
- $(".F_Title").val("");
- $(".F_Remark").val("");
- $(".model").show();
- $(".rightBox").show();
- $(".leftBox").hide();
- $("#add").show();
- $("#xg_btn").hide();
- });
- //修改功能
- $(".rightChange ").click(function () {
- if (ids) {
- $(".model").show();
- $(".rightBox").show();
- $("#add").hide();
- $(".leftBox").hide();
- $("#xg_btn").show();
- GetIndexBase(ids);
- } else {
- layer.msg("没有可修改的选项!");
- Clean();
- }
- });
- //删除
- $(".rightDelete").click(function () {
- if (ids) {
- Delet(ids);
- } else {
- layer.msg("没有可删除的选项!");
- }
- });
- //编号
- function setCode(val, row, index) {
- return index + 1;
- }
- //删除指标
- function Delet(ids) {
- layer.confirm(
- "确定删除吗?",
- {
- btn: ["是", "否"], //按钮
- },
- function () {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "IndexBase/DelIndexBase",
- dataType: "json",
- data: {
- id: ids,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- layer.msg("删除成功");
- Finish();
- IndexCategoryGe();
- }
- },
- });
- }
- );
- }
- //关闭阴影
- $(".rbtr").click(function () {
- $(".model").hide();
- });
- //获取指标
- function GetIndexBase(ids) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "IndexBase/GetIndexBase",
- dataType: "json",
- data: {
- id: ids,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- $("._CategoryName").val(data.data.F_CategoryName);
- $("._Score").val(data.data.F_Score);
- $("._Sort").val(data.data.F_Sort);
- $(".F_Title").val(data.data.F_Title);
- $(".F_Remark").val(data.data.F_Remark);
- $("#Left_ParentId").val(data.data.F_CategoryId);
- }
- },
- });
- }
- //修改保存
- $("#xg_btn").click(function () {
- Cids = $("#Left_ParentId").val();
- CategoryName = $("._CategoryName").val();
- Score = $("._Score").val();
- Sort = $("._Sort").val();
- Title = $(".F_Title").val();
- Remark = $(".F_Remark").val();
- EditIndexBase(Cids, ids, Sort, Score, Title, Remark);
- });
- //增加按钮
- $("#add").click(function () {
- Cids = $("#Left_ParentId").val();
- Score = $("._Score").val();
- Sort = $("._Sort").val();
- Title = $(".F_Title").val();
- Remark = escape($(".F_Remark").val());
- AddIndexBase(Cids, Sort, Score, Title, Remark);
- });
- //编辑指标
- function EditIndexBase(Cids, ids, Sort, Score, Title, Remark) {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "IndexBase/EditIndexBase",
- dataType: "json",
- data: {
- id: ids,
- cid: Cids, //指标分类id
- sort: Sort, //排序
- score: Score,
- title: Title,
- remark: Remark,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- Clean();
- layer.msg("修改成功!");
- Finish();
- IndexCategoryGe();
- }
- },
- });
- }
- //添加指标
- function AddIndexBase(Cids, Sort, Score, Title, Remark) {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "IndexBase/AddIndexBase",
- dataType: "json",
- data: {
- cid: Cids, //指标分类id
- sort: Sort, //排序
- score: Score,
- title: Title,
- remark: Remark,
- token: token,
- },
- async: true,
- success: function (data) {
- if (data.state == "success") {
- Clean();
- layer.msg("添加成功!");
- Finish();
- IndexCategoryGe();
- }
- },
- });
- }
|