將圖片拖曳至這裡或點擊選擇圖片.
@@ -299,8 +317,8 @@
"url": "/Operation/OperationRecodeList",
"type": "POST",
"data": function (d) {
- d.CityIds = [1];
- d.PowerStationIds = [15, 16];
+ d.CityIds = [3];
+ d.PowerStationIds = [1];
d.WorkType = $('#company_phone').val();
d.Range = $('#company_taxIDNumber').val();
},
@@ -413,7 +431,7 @@
});
//#endregion
- //#region 儲存表單資料(未用到先註解)
+ //#region 儲存表單資料
function SaveRecode() {
if ($("#recode-form").valid()) {
@@ -446,22 +464,29 @@
}
var myDropzone = Dropzone.forElement("#recode-file-div");
- myDropzone.processQueue();
+ if (myDropzone.getAcceptedFiles().length > 1) {
- myDropzone.on("successmultiple", function (file, rel) {
- if (rel.code == "9999") {
+ myDropzone.processQueue();
+
+ myDropzone.on("successmultiple", function (file, rel) {
+ if (rel.code != "0000") {
+ toast_error(rel.msg);
+ return;
+ }
+
+ toast_ok(rel.msg);
$('#recode-form-modal').modal('hide');
- toast_error(rel.msg);
- return;
- }
+ recodeFileDropzone.removeAllFiles();
- toast_ok(rel.msg);
+ operationRecodeTable.ajax.reload();
+ });
+ } else {
$('#recode-form-modal').modal('hide');
- recodeFileDropzone.removeAllFiles();
+ myDropzone.removeAllFiles();
operationRecodeTable.ajax.reload();
- });
+ }
}
});
}
@@ -489,7 +514,7 @@
}
//#endregion
- //#region 表單檔案資料包含儲存
+ //#region 表單檔案資料
Dropzone.autoDiscover = false;
recodeFileDropzone = new Dropzone("#recode-file-div", {
url: "/Operation/SaveOperationRecodeFile",
@@ -519,9 +544,9 @@
}
});
-
//#endregion
+ //#region 產生檔案html
function CreateRecodeFileBox(dom, value) {
var str = "";
str += '
';
@@ -540,6 +565,57 @@
str += '
';
dom.append(str);
}
-
+ //#endregion
+
+ //#region 匯出excel
+ function ExportExcel() {
+ var url = "/Operation/ExportOperationRecodeExcel";
+ var send_data = {
+ CityIds: [3],
+ PowerStationIds: [1]
+ };
+ $.post(url, send_data, function (rel) {
+ if (rel.code != "0000") {
+ toast_error(rel.msg);
+ return;
+ }
+ $('#NoViewbody').empty();
+
+ var str = "";
+ rel.data.forEach(function (value, index) {
+ str += "
" +
+ "| " + value.powerStationName + " | " +
+ "" + value.formId + " | " +
+ "" + value.workTypeText + " | " +
+ "" + value.fixDo + " | " +
+ "" + value.statusText + " | " +
+ "" + value.workPersonName + " | " +
+ "" + value.operationPredict + " | ";
+
+ str += "";
+ if (value.hyperLinks != undefined || value.hyperLinks != null) {
+ value.hyperLinks.forEach(function (value2, index) {
+ str += value2 + " ";
+ });
+ }
+ str += " | ";
+
+ str += "" + value.finishTime + " | " +
+ "
";
+ });
+
+ $('#NoViewbody').append(str);
+
+ $("#NoView").table2excel({
+ // 匯出的Excel文件的名稱
+ name: "abc",
+ // Excel檔案的名稱
+ filename: "test",
+ //檔案字尾名
+ fileext: ".xls",
+ });
+ }, 'json');
+ }
+ //#endregion
}
\ No newline at end of file