| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <link href="../css/layer/need/layer.css" />
- <link rel="stylesheet" href="../css/init.css" />
- <title>诉求单结案</title>
- <style type="text/css">
- .isStandard,
- .bulletUnit {
- display: none;
- }
- .bulletUnit ul {
- list-style: none;
- margin: 0;
- padding: 0;
- }
- .bulletUnit ul li {
- float: left;
- margin-right: 20px;
- text-align: center;
- padding: 6px 0;
- }
- .bulletUnit li input {
- display: none;
- }
- .bulletUnit li label {
- margin: 0;
- font-weight: normal;
- display: block;
- width: 100%;
- border: 1px solid #ccc;
- padding: 2px 10px;
- cursor: pointer;
- }
- .bulletUnit .checkedDept {
- border-color: #fe6604;
- }
- select:disabled {
- background-color: #eee;
- }
- .reasons {
- display: none;
- height: 160px;
- }
- #reasons {
- height: 160px;
- }
- #msg1,
- #msg2,
- #msg3,
- #phone {
- border: none;
- border-bottom: 1px solid #ccc;
- margin-bottom: 20px;
- background-color: #FFFFFF;
- color: #00a1cb;
- }
- #msg4 {
- width: 250px;
- height: 50px;
- border: none;
- border-bottom: 1px solid #ccc;
- margin-bottom: 20px;
- vertical-align: top;
- }
- #msg2 {
- vertical-align: top;
- height: 25px;
- }
- #msg1:focus,
- #msg2:focus,
- #msg3:focus,
- #msg4:focus,
- #phone:focus {
- outline: none;
- }
- </style>
- </head>
- <body>
- <div class="Common">
- <table>
- <tr class="files-wrappper">
- <th class="Importent updatingFiles">上传扫描件:</th>
- <td colspan="5">
- <div class="fileBox">
- </div>
- <!--<span class="fjnr"></span>-->
- <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
- <input class="input" type="button" value="上传" id="scwj" />
- <!--<input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />-->
- <input type="hidden" id="file" />
- <span style="color:#FF0000; border: none;">
- (文件格式为png,jpg,pdf,doc,docx)
- </span>
- </td>
- </tr>
- </table>
- <div class="btn_box">
- <button class="btns_save">保存</button>
- </div>
- </div>
- <input type="hidden" name="depID" id="depID" value="" />
- <script src="../js/adjustHeight.js"></script>
- <script>
- var wid = helper.request.queryString("wid");
- var fileType = helper.request.queryString("fileType");
- console.log(fileType)
- $(document).ready(function () {
- if (fileType =="2") {
- getFiles()
- } else if(fileType =="1"){
- $(".updatingFiles").text("上传附件")
- getFile()
- }else{
- getFiles()
- }
-
- //上传附件
- $("#scwj").click(function () {
- $("#upFile").trigger("click");
- })
- $("#upFile").change(function () {
- upload();
- })
- $(".btns_save").click(function () {
- if (fileType =="2") {
- JA();
- }else if(fileType =="1"){
- JAs()
- }else{
- JA()
- }
-
- });
- })
- function JA(bUnits) {
- $.post(huayi.config.callcenter_url + 'WorkOrder/AddFiles', {
- workorderid: wid,
- files: $("#file").val(),
- token: $.cookie("token"),
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- if (fileType) {
- parent.load()
- }else{
- parent.$('#orderlist').bootstrapTable('refresh');
- }
-
- parent.layer.msg("上传成功");
- }
- })
- }
- function JAs(bUnits) {
- $.post(huayi.config.callcenter_url + 'WorkOrder/saveFile', {
- fid: wid,
- file: $("#file").val(),
- token: $.cookie("token"),
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- if (fileType) {
- parent.load()
- }else{
- parent.$('#orderlist').bootstrapTable('refresh');
- }
- parent.layer.msg("上传成功");
- }
- })
- }
- // WorkOrder/getFile
- function getFiles(){
- $.ajax({
- type:"get",
- url:huayi.config.callcenter_url+"WorkOrder/getFiles",
- dataType:"json",
- async:true,
- data:{
- workorderid:wid,
- token: $.cookie("token")
- },
- success:function(res){
- if (res.state.toLowerCase() ==="success") {
- var dataFile = res.data[0].Files
- console.log(dataFile)
- getDataFile(dataFile)
- }
- }
- });
- }
- function getFile(){
- $.ajax({
- type:"get",
- url:huayi.config.callcenter_url+"WorkOrder/getFile",
- dataType:"json",
- async:true,
- data:{
- fid:wid,
- token: $.cookie("token")
- },
- success:function(res){
- if (res.state.toLowerCase() ==="success") {
- var dataFile = res.data[0].File
- console.log(dataFile)
- getDataFile(dataFile)
- }
- }
- });
- }
- //上传文件
- function upload() {
- var Files = document.getElementById("upFile").files;
- if (Files.length > 0) {
- var formData = new FormData();
- for (var i = 0; i < Files.length; i++) {
- formData.append('file' + i, Files[i]);
- }
- formData.append("token", $.cookie("token"));
- var typeName=Files[0].name.split('.')[1];
- if (typeName == "png" || typeName == 'jpg' || typeName =='pdf'|| typeName =='doc'|| typeName =='docx') {
- $.ajax({
- url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
- type: "POST",
- data: formData,
- /**
- *必须false才会自动加上正确的Content-Type
- */
- contentType: false,
- /**
- * 必须false才会避开jQuery对 formdata 的默认处理
- * XMLHttpRequest会对 formdata 进行正确的处理
- */
- 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") {
- $(".fjnr").text(r.data[0].F_FileName);
- var fileData =r.data
- getDataFile(fileData)
- }
- }
- });
- }else{
- layer.msg("格式不正确");
- }
- } else {
- layer.confirm('请上传文件!', {
- btn: ['确定']
- });
- }
- }
- //上传文件隐藏域值
- function file_num() {
- var str = '';
- var Str;
- $('.fileBox .files').each(function (j, m) {
- var aa = $(m).attr("fiel-num")
- console.log(aa);
- str += aa + ",";
- Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
- })
- $("#file").val(Str);
- }
-
- function getDataFile(getDataFile){
- $(getDataFile).each(function (i, n) {
- var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
- $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
- event.stopPropagation();
- $(this).parent().remove();
- file_num()
- })
- })
- file_num()
- }
- </script>
- </body>
- </html>
|