From 820b3f7a95cd865b29b3ea8e19b47ee964e0a2c6 Mon Sep 17 00:00:00 2001
From: chenhaozhe <gaozhechen26@gmail.com>
Date: 星期六, 04 四月 2026 14:54:32 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI
---
WebTM/views/项目管理/工作任务/PM_WorkTaskReportBill.html | 428 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 379 insertions(+), 49 deletions(-)
diff --git "a/WebTM/views/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskReportBill.html" "b/WebTM/views/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskReportBill.html"
index 368ea93..8b492c6 100644
--- "a/WebTM/views/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskReportBill.html"
+++ "b/WebTM/views/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskReportBill.html"
@@ -1,11 +1,13 @@
锘�<!DOCTYPE html>
<html>
+
<head>
<meta charset="utf-8" />
<title>浠诲姟姹囨姤</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="viewport"
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
<script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
@@ -48,6 +50,7 @@
</style>-->
</head>
+
<body>
<div class="layui-fluid" style="padding: 0;">
<div class="layui-card" style="padding: 2px;background-color: #efefef;">
@@ -58,8 +61,10 @@
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">鏂板</button>
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">淇敼</button>-->
- <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">淇濆瓨</button>
- <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnEdit" id="btnEdit">閫�鍑�</button>
+ <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit=""
+ lay-filter="btnSave" id="btnSave">淇濆瓨</button>
+ <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit=""
+ lay-filter="btnEdit" id="btnEdit">閫�鍑�</button>
<!--<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="set_CheckBill" id="set_CheckBill">瀹℃牳</button>
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="set_AbandonCheck" id="set_AbandonCheck">鍙嶅鏍�</button>
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="set_CloseBill" id="set_CloseBill">鍏抽棴</button>
@@ -77,44 +82,72 @@
<div class="layui-form-item" style="padding-top: 10px;">
<div class="layui-row">
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;">鍗曟嵁鍙�<label style="color:red"> * </label></label>
+ <label class="layui-form-label" style="width: 85px;">鍗曟嵁鍙�<label
+ style="color:red"> * </label></label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
- <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
+ <input type="text" class="layui-input" name="HBillNo"
+ lay-verify="HBillNo" id="HBillNo"
+ style="background-color:#efefef4d;" readonly>
+ <input type="hidden" name="HInterID" id="HInterID"
+ lay-verify="HInterID">
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;">鏃ユ湡<label style="color:red"> * </label></label>
+ <label class="layui-form-label" style="width: 85px;">鏃ユ湡<label
+ style="color:red"> * </label></label>
<div class="layui-input-block" style="margin-left: 120px; width:180px;">
- <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
+ <input type="date" class="layui-input" lay-verify="HDate" name="HDate"
+ id="HDate" style="padding-left: 80px;">
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">姹囨姤浜�<label style="color:red"> * </label></label>
+ <label class="layui-form-label"
+ style="width: 85px;padding: 9px 18px;">姹囨姤浜�<label style="color:red"> *
+ </label></label>
<div class="layui-input-block" style="margin-left: 77px;">
- <input type="text" class="layui-input" lay-verify="HReportEmpName" name="HReportEmpName" id="HReportEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
- <input type="hidden" name="HReportEmpID" id="HReportEmpID" lay-verify="HReportEmpID" value="0">
- <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHReportEmp" id="btnSearchHReportEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
+ <input type="text" class="layui-input" lay-verify="HReportEmpName"
+ name="HReportEmpName" id="HReportEmpName"
+ style="background-color:#efefef4d;width: 60%;display: inline-block;"
+ readonly>
+ <input type="hidden" name="HReportEmpID" id="HReportEmpID"
+ lay-verify="HReportEmpID" value="0">
+ <button class="layui-btn layuiadmin-btn-order" type="button"
+ lay-submit="" lay-filter="btnSearchHReportEmp"
+ id="btnSearchHReportEmp"
+ style="padding: 0 10px;float: right;margin-right: 3px;">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">鎺ユ敹浜�</label>
+ <label class="layui-form-label"
+ style="width: 85px;padding: 9px 18px;">鎺ユ敹浜�</label>
<div class="layui-input-block" style="margin-left: 77px;">
- <input type="text" class="layui-input" lay-verify="HReceiveEmp" name="HReceiveEmp" id="HReceiveEmp" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+ <input type="text" class="layui-input" lay-verify="HReceiveEmp"
+ name="HReceiveEmp" id="HReceiveEmp"
+ style="background-color:#efefef4d;width: 60%;display: inline-block;"
+ readonly>
<!--<input type="hidden" name="HPMEmpID" id="HPMEmpID" lay-verify="HPMEmpID" value="0">-->
- <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHReceiveEmp" id="btnSearchHReceiveEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
+ <button class="layui-btn layuiadmin-btn-order" type="button"
+ lay-submit="" lay-filter="btnSearchHReceiveEmp"
+ id="btnSearchHReceiveEmp"
+ style="padding: 0 10px;float: right;margin-right: 3px;">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">鎶勯�佷汉</label>
+ <label class="layui-form-label"
+ style="width: 85px;padding: 9px 18px;">鎶勯�佷汉</label>
<div class="layui-input-block" style="margin-left: 77px;">
- <input type="text" class="layui-input" lay-verify="HCopyEmp" name="HCopyEmp" id="HCopyEmp" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+ <input type="text" class="layui-input" lay-verify="HCopyEmp"
+ name="HCopyEmp" id="HCopyEmp"
+ style="background-color:#efefef4d;width: 60%;display: inline-block;"
+ readonly>
<!--<input type="hidden" name="HWorkEmpID" id="HWorkEmpID" lay-verify="HWorkEmpID" value="0">-->
- <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHCopyEmp" id="btnSearchHCopyEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
+ <button class="layui-btn layuiadmin-btn-order" type="button"
+ lay-submit="" lay-filter="btnSearchHCopyEmp" id="btnSearchHCopyEmp"
+ style="padding: 0 10px;float: right;margin-right: 3px;">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
@@ -124,13 +157,15 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">澶囨敞</label>
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
- <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
+ <input type="text" class="layui-input" lay-verify="HRemark"
+ name="HRemark" id="HRemark">
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;">缁勭粐<label style="color:red"> * </label></label>
+ <label class="layui-form-label" style="width: 85px;">缁勭粐<label
+ style="color:red"> * </label></label>
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
<select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
<!--鍔ㄦ�佹覆鏌撶粍缁�-->
@@ -141,10 +176,14 @@
<div class="layui-row">
<div class="layui-inline">
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
- <input type="hidden" name="HProID" id="HProID" lay-verify="HProID" value="0">
- <input type="hidden" name="HProjectStageID" id="HProjectStageID" lay-verify="HProjectStageID" value="0">
- <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" lay-verify="HMainSourceBillType" value="">
- <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" lay-verify="HMainSourceBillNo" value="">
+ <input type="hidden" name="HProID" id="HProID" lay-verify="HProID"
+ value="0">
+ <input type="hidden" name="HProjectStageID" id="HProjectStageID"
+ lay-verify="HProjectStageID" value="0">
+ <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType"
+ lay-verify="HMainSourceBillType" value="">
+ <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo"
+ lay-verify="HMainSourceBillNo" value="">
</div>
</div>
</div>
@@ -157,19 +196,22 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">鍒跺崟浜�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HMaker" id="HMaker" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HMaker" id="HMaker"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">淇敼浜�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HUpdater" id="HUpdater" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HUpdater" id="HUpdater"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">瀹℃牳浜�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HChecker" id="HChecker" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HChecker" id="HChecker"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
@@ -178,19 +220,22 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">鍒跺崟鏃ユ湡</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HMakerDate" id="HMakerDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HMakerDate" id="HMakerDate"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">淇敼鏃ユ湡</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HUpdaterDate" id="HUpdaterDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HUpdaterDate"
+ id="HUpdaterDate" style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">瀹℃牳鏃ユ湡</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HCheckerDate" id="HCheckerDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HCheckerDate"
+ id="HCheckerDate" style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
@@ -198,19 +243,22 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">鍏抽棴浜�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HCloseMan" id="HCloseMan" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HCloseMan" id="HCloseMan"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">浣滃簾浜�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HDeleteMan" id="HDeleteMan" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HDeleteMan" id="HDeleteMan"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">閫�鍥炰汉</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HBacker" id="HBacker" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HBacker" id="HBacker"
+ style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
@@ -218,19 +266,22 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">鍏抽棴鏃ユ湡</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HCloseManDate" id="HCloseManDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HCloseManDate"
+ id="HCloseManDate" style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">浣滃簾鏃ユ湡</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HDeleteManDate" id="HDeleteManDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HDeleteManDate"
+ id="HDeleteManDate" style="background-color:#efefef4d;" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">閫�鍥炴棩鏈�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HBackerDate" id="HBackerDate" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HBackerDate"
+ id="HBackerDate" style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
@@ -238,7 +289,8 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">閫�鍥炲師鍥�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HBackRemark" id="HBackRemark" style="background-color:#efefef4d;" readonly>
+ <input type="text" class="layui-input" name="HBackRemark"
+ id="HBackRemark" style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
@@ -247,9 +299,10 @@
</div>
</div>
<div class="layui-tab" lay-filter="tab-POStockInBill">
-
+
<ul class="layui-tab-title" lay-filter="tab-all">
<li lay-id="1" style="padding:1px;" class="layui-this">椤圭洰闃舵</li>
+ <li lay-id="2" style="padding:1px;" class="layui-this">闄勪欢</li>
</ul>
<div class="layui-tab-content">
<!--瀛愯〃-->
@@ -265,6 +318,15 @@
</div>
</script>
</div>
+ <!-- 瀛愯〃闄勪欢 -->
+ <div class="layui-tab-item layui-show">
+ <script type="text/html" id="toolbarAttachmentTable">
+ <div class="layui-btn-container">
+ <!-- <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-ChooseFile"><i class="layui-icon layui-icon-form"></i>涓婁紶闄勪欢</button> -->
+ </div>
+ </script>
+ <table class="layui-hide" id="AttachmentTable" lay-filter="AttachmentTable"></table>
+ </div>
</div>
</div>
</form>
@@ -274,7 +336,24 @@
<!--瀛愯〃琛細鍒犻櫎-->
<script type="text/html" id="barDemo">
<!--<a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a>-->
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+ </script>
+
+ <!-- 瀛愯〃闄勪欢 鎿嶄綔鏍� -->
+ <script type="text/html" id="AttachmentOperate">
+ <!-- 涓婁紶鍓嶆樉绀� -->
+ <div {{d.uploadStatus==0 ? '' : 'style="display:none;"' }} class="waitUploaded">
+ <a class="layui-btn layui-btn-xs" lay-event="fileSelect">閫夋嫨鏂囦欢</a>
+ </div>
+ <!-- 寰呬笂浼犳樉绀� -->
+ <div {{d.uploadStatus==1 ? '' : 'style="display:none;"' }} class="preUploaded">
+ <a class="layui-btn layui-btn-xs" lay-event="fileUpload">涓婁紶鏂囦欢</a>
+ </div>
+ <!-- 涓婁紶鍚庢樉绀� -->
+ <div {{d.uploadStatus==2 ? '' : 'style="display:none;"' }} class="uploaded">
+ <a class="layui-btn layui-btn-xs" lay-event="downloadFile">涓嬭浇</a>
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delFile">鍒犻櫎</a>
+ </div>
</script>
<!--澶嶉�夋 瀹屾垚鏍囪-->
@@ -295,19 +374,25 @@
base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
}).extend({
index: 'lib/index' //涓诲叆鍙fā鍧�
- }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+ }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
//#region 鍏叡鍙橀噺
var $ = layui.$
, admin = layui.admin
, layer = layui.layer
, table = layui.table
, form = layui.form
- , element = layui.element;
+ , element = layui.element
+ , upload = layui.upload
+ ;
//妯″潡鍚�
var HModName = "PM_WorkTaskReportBill";
//琛ㄦ牸娓叉煋鍙傛暟
var option = {}; //椤圭洰闃舵琛ㄦ覆鏌撳弬鏁�
+ // 闄勪欢琛ㄦ牸娓叉煋鍙傛暟
+ var attachmentOption = {};
+ // 鏂囦欢涓婁紶缁勪欢缁戝畾瀹炰緥
+ fileUploadInst = {}
//璁板綍缁勭粐鐨勫��
var HOrgIDBar = 0;
//鑾峰彇鍙傛暟
@@ -316,6 +401,9 @@
var linterid = params[params[1]]; //浠庡弬鏁颁腑鑾峰彇 鍗曟嵁鍐呯爜
var HEntryID = params[params[3]]; //浠庡弬鏁颁腑鑾峰彇 鍗曟嵁鍐呯爜
//var HProjectStageID = params[params[3]]; //闃舵鍐呯爜
+
+ // 闄勪欢涓婁紶涓存椂鏂囦欢
+ var tempFileMap = {};
//鍏ㄥ眬鍙橀噺
window.OptionData = [];
@@ -361,7 +449,9 @@
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
//鍒濆鍖栭」鐩樁娈佃〃
get_InitGrid();
-
+ //鍒濆鍖� 闄勪欢琛�
+ get_InitAttachmentGrid();
+
}
else if (OperationType == 2) { //鎴戠殑浠诲姟妯″潡涓嬫帹
////绂佺敤缁勭粐閫夐」
@@ -379,7 +469,8 @@
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
//鍒濆鍖栭」鐩樁娈佃〃
get_InitGrid();
-
+ //鍒濆鍖� 闄勪欢琛�
+ get_InitAttachmentGrid();
get_Display();
}
else if (OperationType == 3) {//濡傛灉淇敼鍒欒蛋涓嬮潰 new //缂栬緫
@@ -387,6 +478,9 @@
//$("#HOrgID").attr("disabled", true);
//鍒濆鍖栭」鐩樁娈佃〃
get_InitGrid();
+ //鍒濆鍖� 闄勪欢琛�
+ get_InitAttachmentGrid();
+
RoadBillMain(linterid);
} else if (OperationType == 4) { //涓嬫帹
//绂佺敤缁勭粐閫夐」
@@ -404,9 +498,11 @@
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
//鍒濆鍖栭」鐩樁娈佃〃
get_InitGrid();
+ //鍒濆鍖� 闄勪欢琛�
+ get_InitAttachmentGrid();
//涓嬫帹-椤甸潰璁剧疆
set_WorkTaskReport();
-
+
}
//#endregion
@@ -514,11 +610,25 @@
, "HSourceBillNo": ""
, "HSourceBillType": ""
};
+
+ // 鏂板缓 闄勪欢琛屾暟鎹�
+ var attachmentNewRaw = {
+ "HWeekReportFileAddr": ""
+ , "HWeekReportFileName": ""
+ , "HWeekProDays": "0"
+ , "Size": ""
+ , "Status": ""
+ , "uploadStatus": 0
+ }
switch (obj.event) {
case 'btn-AddLine':
table.cache["mainTable"].push(NewRow);
option.data = table.cache["mainTable"];
table.render(option);
+ table.cache["AttachmentTable"].push(attachmentNewRaw);
+ attachmentOption.data = table.cache["AttachmentTable"]
+ table.render(attachmentOption);
+
CheckedSet_tableSub();
for (var i = 1; i <= option.data.length; i++) {
@@ -544,6 +654,9 @@
table.cache["mainTable"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂
option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓�
table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
+ table.cache["AttachmentTable"].push(attachmentNewRaw);
+ attachmentOption.data = table.cache["AttachmentTable"]
+ table.render(attachmentOption);
CheckedSet_tableSub();
for (var i = 1; i <= option.data.length; i++) {
@@ -597,6 +710,82 @@
})
//#endregion
+ table.on('tool(AttachmentTable)', function (obj) {
+ var data = obj.data; // 褰撳墠琛屾暟鎹�
+ var that = this; // 褰撳墠鐐瑰嚮鐨勬寜閽�
+ var tr = $(this).closest("tr");
+ var index = tr.data("index");
+ if (obj.event === 'fileUpload') {
+ // 鍒ゆ柇鏄惁宸查�夋嫨鏂囦欢
+ console.log(tempFileMap, index)
+ if (!tempFileMap[index]) {
+ layer.msg("璇峰厛閫夋嫨鏂囦欢锛�");
+ return;
+ }
+
+
+ var formData = new FormData();
+ formData.append("file", tempFileMap[index]); // 杩藉姞宸查�夋嫨鐨勬枃浠�
+ formData.append("HNumber", $("#HBillNo").val());
+ formData.append("HRemark", $("#HRemark").val());
+ formData.append("HUserName", sessionStorage["HUserName"]);
+
+ layer.load(); // 鍔犺浇涓�
+ $.ajax({
+ url: GetWEBURL() + "/PM_WorkTaskReportBill/UploadFile",
+ type: "POST",
+ data: formData,
+ contentType: false,
+ processData: false,
+ success: function (res) {
+ layer.closeAll('loading');
+ if (res.count == 1) {
+ // 鑾峰彇琛ㄦ牸缂撳瓨
+ var cache = table.cache['AttachmentTable'];
+
+ cache[index].Status = "宸蹭笂浼�";
+ cache[index].uploadStatus = 2;
+ cache[index].HWeekReportFileAddr = TransWebUrlToFileUrl(GetWEBURL(), res.data + cache[index].HWeekReportFileName)
+
+ console.log(cache[index].HWeekReportFileAddr)
+
+ table.reload('AttachmentTable', {
+ data: cache,
+ });
+
+ layer.msg("涓婁紶鎴愬姛");
+ } else {
+ layer.msg("涓婁紶澶辫触锛�" + res.Message);
+ }
+ },
+ error: function () {
+ layer.closeAll('loading');
+ layer.msg("涓婁紶寮傚父锛岃閲嶈瘯");
+ }
+ });
+ } else if (obj.event == 'downloadFile') {
+ // 涓嬭浇鏂囦欢
+ downloadFile(index)
+
+ } else if (obj.event == 'delFile') {
+ // 鍒犻櫎缂撳瓨
+ var cache = table.cache['AttachmentTable'];
+
+ cache[index].HWeekReportFileAddr = "";
+ cache[index].HWeekReportFileName = "";
+ cache[index].Size = "";
+ cache[index].Status = "";
+ cache[index].HWeekProDays = 0;
+ cache[index].uploadStatus = 0;
+
+ table.reload('AttachmentTable', {
+ data: cache,
+ });
+
+ layer.msg("鍒犻櫎鎴愬姛");
+ }
+ });
+
//
@@ -627,6 +816,48 @@
//#endregion
//#region 姝ら〉闈㈡墍鏈夌殑鏂规硶
+
+ function TransWebUrlToFileUrl(webUrl, fileAddr) {
+ webUrl = webUrl.substr(0, webUrl.length - 1) // 鍘婚櫎鍚庝竴涓�/
+ lastbackSlashIndex = webUrl.lastIndexOf("/")
+ webUrl = webUrl.substr(0, lastbackSlashIndex)
+ return webUrl + "/" + fileAddr
+ }
+
+ //#region
+ function downloadFile(index) {
+ var cache = table.cache['AttachmentTable'];
+ var row = cache[index];
+
+ // 浼樺厛浣跨敤鏈湴涓存椂鏂囦欢
+ if (tempFileMap[index]) {
+ const file = tempFileMap[index];
+ const url = URL.createObjectURL(file);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = file.name;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ return;
+ }
+
+ if (row.HWeekReportFileAddr) {
+ var fileUrl = row.HWeekReportFileAddr;
+
+ const a = document.createElement('a');
+ a.href = fileUrl;
+ a.download = row.HWeekReportFileName; // 鏂囦欢鍚�
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ return;
+ }
+
+ layer.msg('鏃犲彲涓嬭浇鐨勬枃浠�');
+ }
+ //#endregion
//#region 鑾峰彇缁勭粐
function Organ() {
@@ -755,7 +986,47 @@
CheckedSet_tableSub();
}
//#endregion
-
+
+ //#region 瀛愯〃闄勪欢琛� 鍒濆鍖�
+ function get_InitAttachmentGrid() {
+ attachmentOption = {
+ elem: '#AttachmentTable',
+ toolbar: '#toolbarAttachmentTable'
+ , totalRow: true
+ , cellMinWidth: 120
+ , height: 400
+ , cols: [[
+ { type: 'numbers', title: '搴忓彿', style: 'background-color: #f9f9f9;' }
+ , { field: 'HWeekReportFileAddr', title: '浜哄ぉ鍗曟枃浠惰矾寰�', hide: true, style: 'background-color: #f9f9f9;' }
+ , { field: 'HWeekReportFileName', title: '浜哄ぉ鍗曟枃浠跺悕绉�', style: 'background-color: #f9f9f9;' }
+ , { field: 'HWeekProDays', title: '鏈懆瀹炴柦娑堣�椾汉澶�', edit: true, style: 'background-color: #f9f9f9;' }
+ , { field: 'Size', title: '鏂囦欢澶у皬', style: 'background-color: #f9f9f9;' }
+ , { field: 'Status', title: '涓婁紶鐘舵��', style: 'background-color: #f9f9f9;' }
+ , { field: 'uploadStatus', title: '涓婁紶鐘舵�佷唬鐮�', hide: true, style: 'background-color: #f9f9f9;' }
+ , { fixed: 'right', title: '鎿嶄綔', toolbar: '#AttachmentOperate' }
+ ]]
+ , done: function () {
+ bindUploadToTable();
+ }
+ }
+
+ var rowDataAttachment = [
+ {
+ "HWeekReportFileAddr": ""
+ , "HWeekReportFileName": ""
+ , "HWeekProDays": "0"
+ , "Size": ""
+ , "Status": ""
+ , "uploadStatus": 0
+ },
+ ];
+
+ attachmentOption.data = rowDataAttachment;
+ table.render(attachmentOption);
+ }
+ //#endregion
+
+
//#region 瀹屾垚鏍囪
form.on('checkbox(HFinishFlag)', function (data) {
//鑾峰彇涓嬫媺妗嗛�変腑鐨勫��
@@ -767,6 +1038,40 @@
}
});
});
+ //#endregion
+
+ //#region 鑷畾涔夎〃鏍肩粦瀹氭枃浠朵笂浼犲姛鑳�
+ function bindUploadToTable() {
+ // 1. 閫夋嫨鏈湴鏂囦欢锛堟湭閫夋嫨 鈫� 寰呬笂浼狅級
+ upload.render({
+ elem: '[lay-event="fileSelect"]',
+ accept: 'file',
+ exts: 'doc|docx|xls|xlsx|pdf|zip|rar|txt',
+ auto: false,
+ choose: function (obj) {
+ var tr = this.item.parents('tr');
+ var index = tr.data('index');
+ var cache = table.cache['AttachmentTable'];
+
+ // 棰勮鏂囦欢淇℃伅
+ obj.preview(function (i, file) {
+ // 瀛樺叆涓存椂鏂囦欢
+ tempFileMap[index] = file;
+
+ // 鏇存柊琛岀姸鎬� 鈫� 寰呬笂浼�
+ cache[index].HWeekReportFileName = file.name;
+ cache[index].Size = (file.size / 1024).toFixed(2) + 'KB';
+ cache[index].Status = "寰呬笂浼�";
+ cache[index].uploadStatus = 1;
+
+ table.reload('AttachmentTable', { data: cache });
+ console.log(tempFileMap)
+ layer.msg('宸查�夋嫨鏂囦欢锛岃鐐瑰嚮涓婁紶');
+ });
+ }
+ });
+
+ }
//#endregion
//#region 姹囨姤浜洪�夋嫨椤甸潰
@@ -795,7 +1100,7 @@
layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
}
, btn2: function (index, layero) { }
- , end: function () {}
+ , end: function () { }
})
}
//#endregion
@@ -807,10 +1112,12 @@
for (var i = 0; i < table.cache["mainTable"].length; i++) {
if (table.cache["mainTable"][i] != "") {
table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+ // 鍚堝苟涓昏〃瀵硅薄鍜岄檮浠惰〃瀵硅薄
+ $.extend(true, table.cache["mainTable"][i], table.cache["AttachmentTable"][i])
num.push(table.cache["mainTable"][i])
}
}
-
+
//鑾峰彇缁勭粐鏁版嵁
data.field.HPRDORGID = sessionStorage["OrganizationID"];//缁勭粐
//鑻ヤ负缂栬緫-淇濆瓨锛屽垯鏇存柊淇敼浜哄拰淇敼鏃堕棿
@@ -970,7 +1277,7 @@
});
}
//#endregion
-
+
//#region 缂栬緫 椤甸潰璧嬪��
function RoadBillMain(linterid)//鍔犺浇琛ㄥご
{
@@ -1016,9 +1323,12 @@
//瀛愯〃 璧嬪��
for (var i = 0; i < tableSub.length; i++) {
tableSub[i].RowID = (i + 1) * 10;
+ tableSub[i]["uploadStatus"] = tableSub[i]["HWeekReportFileName"] ? 2 : 0
}
option.data = tableSub;
+ attachmentOption.data = tableSub;
table.render(option);
+ table.render(attachmentOption)
CheckedSet_tableSub();
form.render('select');
}
@@ -1030,6 +1340,7 @@
function set_WorkTaskReport() {
var data = getUrlVars_JSON().data;
var dataArray = [];
+ var AttachmentArray = [];
for (var i = 0; i < data.length; i++) {
var NewRow =
{
@@ -1051,11 +1362,23 @@
, "HSourceBillNo": data[i].HSourceBillNo
, "HSourceBillType": data[i].HSourceBillType
};
+
+ var attachmentNewRaw = {
+ "HWeekReportFileAddr": ""
+ , "HWeekReportFileName": ""
+ , "HWeekProDays": "0"
+ , "Size": ""
+ , "Status": ""
+ , "uploadStatus": 0
+ }
dataArray.push(NewRow);
+ AttachmentArray.push(attachmentNewRaw)
}
option.data = dataArray;
table.render(option);
+ attachmentOption.data = AttachmentArray;
+ table.render(attachmentOption)
CheckedSet_tableSub();
@@ -1328,6 +1651,12 @@
oldData.splice(obj.tr.data('index'), 1)
option.data = oldData;//灏嗘暟鎹粦瀹氬埌data涓�
table.render(option);
+
+ var oldDataAttachment = table.cache['AttachmentTable'];
+ oldDataAttachment.splice(obj.tr.data('index'), 1)
+ attachmentOption.data = oldDataAttachment
+ table.render(attachmentOption)
+
CheckedSet_tableSub();
layer.close(index);
}
@@ -1480,7 +1809,7 @@
url: GetWEBURL() + '/PM_WorkTaskBill/XTList',
type: "GET",
async: false,
- data: { "HInterID": linterid, sWhere: sWhere, "user": sessionStorage["HUserName"]},
+ data: { "HInterID": linterid, sWhere: sWhere, "user": sessionStorage["HUserName"] },
success: function (data1) {
if (data1.count == 1) {
var rowdata = [];
@@ -1698,4 +2027,5 @@
</script>
</body>
+
</html>
\ No newline at end of file
--
Gitblit v1.9.1