| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- var id = helper.request.queryString("id");
- var type = helper.request.queryString("type");
- var uploadFileId = "";
- var isOver = "";
- $(document).ready(function () {
- /*
- type
- 1:处理
- 2:完结
- */
- if (type === "2"){
- $(".isOver-wrapper").hide();
- } else if(type === "1") {
- $(".isOver-wrapper").show();
- }
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- });
- })
- $("#btndr").click(function () {
- $("#upFile").trigger("click");
- var isover
- })
- $("#upFile").change(function () {
- upload();
- })
- //上传文件
- function upload() {
- if (document.getElementById("upFile").files.length > 0) {
- var formData = new FormData();
- formData.append("upFile", document.getElementById("upFile").files[0]);
- formData.append("token", $.cookie("token"));
- console.log("formData",formData)
- $.ajax({
- url: huayi.config.callcenter_url + "WorkOrder/UploadFile",
- type: "POST",
- data: formData,
- contentType: false,
- processData: false,
- success: function (result) {
- document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
- $("#upFile").change(function () {
- upload();
- });
- var r = $.parseJSON(result);
- if (r.state.toLowerCase() == "success") {
- uploadFileId = r.data[0].F_Id;
- $(".upfile-text").text(r.data[0].F_Name);
- layer.msg("上传成功");
- } else {
- layer.msg("上传失败");
- }
- }
- });
- } else {
- layer.confirm('请上传文件!', {
- btn: ['确定']
- });
- }
- }
- //保存
- function saveCustomer() {
- if (type === "2"){
- isOver = 1
- } else if(type === "1") {
- isOver = $('#customer_end').val();
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/DealWorkOrder",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('确定中...');
- },
- data: {
- token: $.cookie("token"),
- id: id,
- F_Files: uploadFileId,
- cont: $('#cont').val(), //提交内容
- isover: isOver, // 是否完结
- },
- 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("保存成功!");
- uploadFileId = "";
- parent.$('#workorderlist').bootstrapTable('refresh');
- // parent.initTable();
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- }
- }
- });
- }
|