| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- var id = helper.request.queryString("id");
- var type = helper.request.queryString("type");
- $(document).ready(function () {
-
- if (type === "1") {
- // 获取部门
- getDepartment($("#customer_department"));
- // 获取提交人
- $('#customer_department').on('change',function(){
- getManager($('#customer_submitter'));
- });
- //修改文本
- $(".submitterTitle").text("提交人:");
- $(".contentTitle").text("提交内容:")
- $(".comaddressSelect").css("width", "35%");
- $(".submitterSelect").css("width", "35%")
- $(".wrapper-content").css("padding","3% 8% 0 0")
- } else if (type === "2"){
- getSalesman($('#customer_submitter'));
- $(".comaddressTitle").hide();
- $(".comaddressSelect").hide();
- //修改文本
- $(".submitterTitle").text("分派人:");
- $(".contentTitle").text("分派内容:")
- $(".submitterSelect").css("width", "80%");
- $(".wrapper-content").css("padding","3% 10% 0 0")
- }
-
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- });
-
- })
- //办事处 提交人
- function getDepartment(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- pid: 1,
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //部门
- //function getDepartment(obj) {
- // obj.empty();
- // obj.append('<option selected="selected" value="">请选择</option>');
- // $.getJSON(huayi.config.callcenter_url + "Department/GetSubordinate", {
- // "token": $.cookie("token"),
- // }, function (data) {
- // if (data.state.toLowerCase() == "success") {
- // var content = data.data[0].children;
- // $(content).each(function (i, n) {
- // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
- // })
- // }
- // })
- //}
- //业务员
- function getSalesman(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="" deptId="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
- "token": $.cookie("token"),
- type: 2,
- dptid: $("#customer_department").val(),
- pagesize: 300,
- }, function (data) {
- var content = data.rows;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_DeptName + " - " +n.F_UserName + "</option>").appendTo(obj);
- })
- })
- }
- //获取经理
- function getManager(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="" deptId="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
- "token": $.cookie("token"),
- type: 1,
- dptid: $("#customer_department").val(),
- pagesize: 300,
- }, function (data) {
- var content = data.rows;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_DeptName + " - " + n.F_UserName + "</option>").appendTo(obj);
- })
- })
- }
- //保存
- function saveCustomer() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/Submission",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('保存中...');
- },
- data: {
- token: $.cookie("token"),
- id: id,
- cont: $('#cont').val(), //提交内容
- clid: $('#customer_submitter').val(), // 提交人
- type: type,
- },
- success: function(data) {
- if (data.state.toLowerCase() == 'success') {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.layer.msg("保存成功!");
- parent.$('#workorderlist').bootstrapTable('refresh');
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- }
- }
- });
- }
|