| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- $(document).ready(function () {
- getReactionCategory();
- $("#reflectCategory").bind("input propertychange", function () {
- $(".layui-dropdown").hide();
- $(".CleansReactionCategory").show();
- if ($("#reflectCategory").val() == "") {
- $(".reflectCategoryList-wrapper").hide();
- return;
- }
- $(".reflectCategoryList-wrapper").show();
- var debounceGetSearchReactionCategory = debounce(
- getSearchReactionCategory,
- 500
- );
- debounceGetSearchReactionCategory($("#reflectCategory").val());
- });
- $("#reflectCategoryList").on("click", "li", function () {
- $(".reflectCategoryList-wrapper").hide();
- $("#reflectCategory").val($(this).attr("indexName"));
- $("#keyid").val($(this).attr("index"));
- });
- });
- // 查看工单详情
- function View(val, row) {
- var workId = val;
- var workIdCode = workId.slice(0, 4);
- var workIdAddress = workId.slice(4, 10);
- var workIdDate = workId.slice(10, 16);
- var workIdSerialNumber = workId.slice(16);
- return (
- '<div class="imgs" ><a class="" style="font-weight: 700;" index="' +
- row.CreateUser +
- '" onclick= ckxq("' +
- row.F_WorkOrderId +
- '") >' +
- '<span style="color: #000000">' +
- workIdCode +
- "</span>" +
- '<span style="color: #FF0000">' +
- workIdAddress +
- "</span>" +
- '<span style="color: #008000">' +
- workIdDate +
- "</span>" +
- '<span style="color: #800080">' +
- workIdSerialNumber +
- "</span>" +
- "</a></div>"
- );
- }
- //查看详情
- function ckxq(str) {
- layer.open({
- type: 2,
- content: "../CommonHtml/WorkDatil.html?wid=" + str, //iframe的url,no代表不显示滚动条
- title: "工单详情",
- area: ["100%", "100%"], //宽高
- maxmin: true,
- shade: 0,
- });
- }
- function getReactionCategory(pid = 38) {
- $.get(
- huayi.config.callcenter_url + "Dictionary/GetZTreeNew",
- {
- token: $.cookie("token"),
- pid: pid,
- },
- function (result) {
- result = $.parseJSON(result);
- var content = JSON.parse(result.data);
- layui.use("dropdown", function () {
- var dropdown = layui.dropdown;
- dropdown.render({
- elem: "#reflectCategory", //可绑定在任意元素中,此处以上述按钮为例
- data: content,
- id: "reflectCategory",
- isclickparent: true,
- //菜单被点击的事件
- click: function (obj) {
- $("#reflectCategory").val(obj.title);
- $("#keyid").val(obj.id);
- $(".CleansReactionCategory").show();
- },
- });
- });
- }
- );
- }
- function getSearchReactionCategory(key) {
- $("#reflectCategoryList").empty();
- $.get(
- huayi.config.callcenter_url + "Dictionary/GetKeyListNew",
- {
- token: $.cookie("token"),
- key: key,
- },
- function (result) {
- result = $.parseJSON(result);
- if (result.state.toLowerCase() === "success") {
- var content = result.data;
- if (content.length > 0) {
- content.forEach(function (e, i) {
- $(
- "<li index='" +
- e.id +
- "' indexName='" +
- e.name +
- "'>" +
- e.names +
- "</li>"
- ).appendTo("#reflectCategoryList");
- });
- } else {
- $("<li index='' indexName=''>没有相关数据</li>").appendTo(
- "#reflectCategoryList"
- );
- }
- }
- }
- );
- }
- function debounce(fun, delay) {
- return function (args) {
- var that = this;
- var _args = args;
- clearTimeout(fun.id);
- fun.id = setTimeout(function () {
- fun.call(that, _args);
- }, delay);
- };
- }
- $(".CleansReactionCategory").click(function () {
- $("#reflectCategory").val("");
- $("#keyid").val("");
- $(".CleansReactionCategory").hide();
- });
|