From bdc4e1bddd257f1fb04854e8654149b7d9f4975d Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 20 十一月 2023 12:02:54 +0800
Subject: [PATCH] 1
---
WebTM/views/设备管理/Sb_EquipMaintainPlanBillEdit.html | 602 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 515 insertions(+), 87 deletions(-)
diff --git "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_EquipMaintainPlanBillEdit.html" "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_EquipMaintainPlanBillEdit.html"
index bfd5639..9321e4a 100644
--- "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_EquipMaintainPlanBillEdit.html"
+++ "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_EquipMaintainPlanBillEdit.html"
@@ -20,11 +20,13 @@
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
- <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
+ <form id="component-form-group" class="layui-form" lay-filter="component-form-group" action="">
<div class="layui-card-header">
<div class="layui-btn-group">
-
- <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">淇濆瓨</button>
+ <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AddNew" id="set_AddNew">鏂板</button>
+ <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver" id="add-btn">淇濆瓨</button>
+ <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="view">棰勮</button>
+ <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="print">鎵撳嵃</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button>
</div>
@@ -61,7 +63,7 @@
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label">璁惧</label>
+ <label class="layui-form-label">璁惧<label style="color:red"> * </label></label>
<div class="layui-input-inline">
<input type="hidden" name="HEquipID" id="HEquipID" class="layui-input" value="" style="float:left;width:150px;">
<input type="text" name="HEquipName" id="HEquipName" class="layui-input" value="" style="float:left;width:150px;">
@@ -104,6 +106,16 @@
</div>
<div class="layui-form-item">
<div class="layui-inline">
+ <label class="layui-form-label">璁惧淇濆吇瑙勭▼<label style="color:red"></label></label>
+ <div class="layui-input-inline">
+ <input type="hidden" name="HMouldMaintainRuleID" id="HMouldMaintainRuleID" class="layui-input" value="0" style="float:left;width:150px;">
+ <input type="text" name="HMouldMaintainRuleNo" id="HMouldMaintainRuleNo" class="layui-input" value="" style="float:left;width:150px;background-color:#efefef4d;" readonly>
+ <button type="button" lay-submit="" class="layui-btn" lay-filter="HEquipDotCheckRuleInterList" style="width:40px;">
+ <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+ </button>
+ </div>
+ </div>
+ <div class="layui-inline">
<label class="layui-form-label">鎽樿</label>
<div class="layui-input-inline">
<textarea placeholder="璇疯緭鍏ユ憳瑕�" class="layui-textarea" name="HExplanation" id="HExplanation"></textarea>
@@ -120,8 +132,20 @@
</div>
</div>
</div>
-
- <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+ <div class="layui-tab layui-tab-card" lay-filter="TabTest">
+ <ul class="layui-tab-title">
+ <li class="layui-this">淇濆吇椤逛俊鎭�</li>
+ <li>閰嶄欢淇℃伅</li>
+ </ul>
+ <div class="layui-tab-content">
+ <div class="layui-tab-item layui-show">
+ <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+ </div>
+ <div class="layui-tab-item">
+ <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
+ </div>
+ </div>
+ </div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
@@ -130,7 +154,18 @@
</div>
</script>
+ <script type="text/html" id="toolbarDemo1">
+ <div class="layui-btn-container">
+
+ <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine1"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
+ <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine1"><i class="layui-icon layui-icon-form"></i>澶嶅埗涓�琛�</button>
+
+ </div>
+ </script>
<script type="text/html" id="xuhao">
+ {{d.LAY_TABLE_INDEX+1}}
+ </script>
+ <script type="text/html" id="xuhao1">
{{d.LAY_TABLE_INDEX+1}}
</script>
</form>
@@ -139,8 +174,10 @@
</div>
</div>
<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>
+ </script>
+ <script type="text/html" id="barDemo1">
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del1">鍒犻櫎</a>
</script>
<script src="../../layuiadmin/layui/layui.js"></script>
<script src="../../layuiadmin/Scripts/json2.js"></script>
@@ -173,9 +210,11 @@
, laydate = layui.laydate
, element = layui.element;
//鏌ヨ鏉′欢
- var option = [];
+ var option = [];//淇濆吇
+ var option1 = [];//閰嶄欢
var sBillType = "3902";
- var TabRow = { "HMaterID": 0, "HMaterCode":"", "HMaterName":"", "HUnitID": 0, "HUnitCode": "","HUnitName":"", "HQty": "", "HRemark": "" };
+ //var TabRow = { "HMaintainItemID": 0, "HMaintainItemNumber": " ", "HMaintainItem": " ", "HMaintainPart": " ", "HClaim": " ", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HRemark": " " };//淇濆吇
+ //var TabRow1 = { "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HQty": "", "HRemark": "" };//閰嶄欢
//#endregion
@@ -204,11 +243,13 @@
//#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
- //澶村伐鍏锋爮浜嬩欢
+ // 澶村伐鍏锋爮浜嬩欢
table.on('toolbar(mainTable)', function (obj) {
+ var rowid = 0;
var checkStatus = table.checkStatus('mainTable')
- , data = checkStatus.data;
- var NewRow = TabRow;
+ , data = checkStatus.data;;
+ var AddRow = table.cache['mainTable'];
+ var NewRow = { "HMaintainItemID": 0, "HMaintainItemNumber": " ", "HMaintainItem": " ", "HMaintainPart": " ", "HClaim": " ", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HRemark": " " };
switch (obj.event) {
//鏂板涓�琛�
case 'btn-AddLine': btnAddLine(NewRow);
@@ -218,10 +259,30 @@
break;
}
});
+
+ //澶村伐鍏锋爮浜嬩欢
+ table.on('toolbar(mainTable1)', function (obj) {
+ var checkStatus = table.checkStatus('mainTable1')
+ , data = checkStatus.data;
+ var NewRow = { "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HQty": "0", "HRemark": "" };
+ switch (obj.event) {
+ //鏂板涓�琛�
+ case 'btn-AddLine1': btnAddLine1(NewRow);
+ break;
+ //澶嶅埗涓�琛�
+ case 'btn-CopyLine1': btnCopyLine1(data);
+ break;
+ }
+ });
//琛屽唴浜嬩欢
table.on('tool(mainTable)', function (obj) {
set_GridDelete(obj); //琛屽唴鍒犻櫎
set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫�
+ });
+ //琛屽唴浜嬩欢
+ table.on('tool(mainTable1)', function (obj) {
+ set_GridDelete1(obj); //琛屽唴鍒犻櫎
+ set_GridCellCheck1(obj); //琛屽唴蹇嵎閿瓫閫�
});
//琛ㄥご淇℃伅璁惧寮圭獥
form.on('submit(ProductModulList)', function () {
@@ -244,7 +305,7 @@
return layer.msg('璇烽�夋嫨鏁版嵁');
}
$("#HEquipName").val(checkStatus.data[0].HName);
- $("#HEquipID").val(checkStatus.data[0].HItemID);
+ $("#HEquipID").val(checkStatus.data[0].HInterID);
layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
}
, btn2: function (index, layero) {
@@ -257,47 +318,102 @@
}
});
});
+ //鏂板
+ form.on('submit(set_AddNew)', function (data) {
+ $("#component-form-group")[0].reset();
+ layui.form.render();
+ set_AddFNew();
+ });
//淇濆瓨
form.on('submit(Saver)', function (data) {
//debugger;
data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
var sMainStr = JSON.stringify(data.field);
var sSubStr = JSON.stringify(table.cache['mainTable']);
- var sMainSub = sMainStr + ';' + sSubStr;
- if (AllowLoadData(sSubStr)) {
- $.ajax(
- {
- type: "POST",
- url: GetWEBURL() + "/Sb_EquipMaintainPlanBill/SaveEquipMaintainPlanBillList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
- async: true,
- data: { "msg": sMainSub },
- dataType: "json",
- success: function (data) {
- if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
- layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
- $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
- var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
- parent.layer.close(index); //鍐嶆墽琛屽叧闂� 聽 聽 聽 聽 聽聽 聽聽聽 聽
- });
- }
- else {
-
- f_alert(data.Message);
- console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
- }
- layer.closeAll("loading");
- },
- error: function (err) {
-
- f_alert("閿欒:" + err);
- console.log("Reason" + sMainStr);
- }
- });
+ var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
+ var sMainSub = sMainStr + ';' + sSubStr + ';' + sSubStr1 + ";" + sessionStorage["HUserName"];
+ if (!AllowLoadData(sSubStr))//鏁版嵁楠岃瘉
+ {
+ return false;
}
+ $.ajax(
+ {
+ type: "POST",
+ url: GetWEBURL() + "/Sb_EquipMaintainPlanBill/SaveEquipMaintainPlanBillList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+ async: true,
+ data: { "msg": sMainSub },
+ dataType: "json",
+ success: function (data) {
+ if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+ layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
+ $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
+ var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
+ parent.layer.close(index); //鍐嶆墽琛屽叧闂�
+ });
+ }
+ else {
+
+ f_alert(data.Message);
+ console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
+ }
+ layer.closeAll("loading");
+ },
+ error: function (err) {
+
+ f_alert("閿欒:" + err);
+ console.log("Reason" + sMainStr);
+ }
+ });
+
+ });
+ //琛ㄥご淇℃伅璁惧淇濆吇瑙勭▼
+ form.on('submit(HEquipDotCheckRuleInterList)', function () {
+ //椤甸潰灞�-鑷畾涔�
+ layer.open({
+ type: 2,
+ skin: 'layui-layer-rim', //鍔犱笂杈规
+ title: '璁惧淇濆吇瑙勭▼鍒楄〃',
+ closeBtn: 1,
+ shift: 2,
+ area: ['80%', '80%'],
+ maxmin: true,
+ content: ['../璁惧绠$悊/璁惧瑙勭▼鍗�/Sb_EquipMaintainRuleList.html', 'yes'],
+ btn: ['纭畾', '鍙栨秷']
+ , btn1: function (index, layero) {
+ //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+ var iframeWindow = window['layui-layer-iframe' + index] //鑾峰彇寮规椤甸潰
+ var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+ if (checkStatus.data.length === 0) {
+ return layer.msg('璇烽�夋嫨鏁版嵁');
+ }
+ $("#HMouldMaintainRuleNo").val(checkStatus.data[0].鍗曟嵁鍙�);
+ $("#HMouldMaintainRuleID").val(checkStatus.data[0].hmainid);
+ get_DocCheckItem2(checkStatus.data[0].hmainid);
+ layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+ }
+ });
+ });
+
+ //棰勮Printing
+ form.on("submit(view)", function (data) {
+ window.open("../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/HBarPlanPrint.html?linterid=" + linterid + "&Type=HEquipMaintainPlanBill&OpenTmp=璁惧淇濆吇璁″垝鏉$爜");
+
+ });
+ //鎵撳嵃Printing
+ form.on("submit(print)", function (data) {
+ window.open("../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/HBarPlanPrint.html?linterid=" + linterid + "&Type=HEquipMaintainPlanBill&OpenTmp=璁惧淇濆吇璁″垝鏉$爜");
+
});
//閫�鍑�
form.on('submit(Exit)', function () {
- Pub_Close(1);
+ if (linterid == undefined) {
+ //鍏抽棴椤电
+ Pub_Close(2);
+ }
+ else {
+ //鍏抽棴椤电
+ Pub_Close(1);
+ }
})
//鐩戝惉鎻愪氦
form.verify({
@@ -328,24 +444,62 @@
}
//鍒濆鍖栬〃鏍�
function set_InitGrid() {
+ Table(); //淇濆吇椤瑰垪琛�
+ Table1(); //閰嶄欢椤瑰垪琛�
+ }
+ //鍒濆鍖栦繚鍏婚」鍒楄〃
+ function Table() {
//琛ㄥご
columns = [
{ type: 'checkbox', fixed: 'left' }
, { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
- , { field: 'HMaterID', title: '閰嶄欢ID', edit: 'text', hide: true }
- , { field: 'HMaterCode', title: '閰嶄欢浠g爜', edit: 'text', event: "HMaterCode" }
- , { field: 'HMaterName', title: '閰嶄欢鍚嶇О', edit: 'text', event: "" }
- , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
- , { field: 'HUnitCode', title: '鍗曚綅浠g爜', edit: 'text', event: "HUnitCode" }
- , { field: 'HUnitName', title: '鍗曚綅鍚嶇О', edit: 'text', event: "" }
- , { field: 'HQty', title: '鐢ㄩ噺', edit: 'text' }
+ , { field: 'HMaintainItemID', title: '淇濆吇椤圭洰ID', edit: 'text', hide: true }
+ , { field: 'HMaintainItemNumber', title: '淇濆吇椤圭洰浠g爜', edit: 'text', event: 'HMaintainItemNumber' }
+ , { field: 'HMaintainItem', title: '淇濆吇椤圭洰' }
+ , { field: 'HMaintainPart', title: '淇濆吇閮ㄤ綅', edit: 'text' }
+ , { field: 'HClaim', title: '鍏蜂綋瑕佹眰', edit: 'text' }
+ , { field: 'HManagerID', title: '璐熻矗浜篒D', edit: 'text', hide: true }
+ , { field: 'HManagerNumber', title: '璐熻矗浜轰唬鐮�', edit: 'text', event: 'HManagerNumber' }
+ , { field: 'HManagerName', title: '璐熻矗浜�' }
, { field: 'HRemark', title: '澶囨敞', edit: 'text' }
- , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 }
+ , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' }
];
option = {
id: 'mainTable'
, elem: '#mainTable'
, toolbar: '#toolbarDemo'
+ , page: false
+ , cellMinWidth: 120
+ , height: 500
+ , cols: [columns]
+ , done: function (res, curr, count) {
+
+ }
+ };
+ }
+ //鍒濆鍖栭厤浠堕」鍒楄〃
+ function Table1() {
+ //琛ㄥご
+ columns = [
+ { type: 'checkbox', fixed: 'left' }
+ , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
+ , { field: 'HMaterID', title: '閰嶄欢ID', edit: 'text', hide: true }
+ , { field: 'HMaterNumber', title: '閰嶄欢浠g爜', edit: 'text', event: "HMaterCode" }
+ , { field: 'HMaterName', title: '閰嶄欢鍚嶇О', edit: 'text', event: "" }
+ , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
+ , { field: 'HUnitNumber', title: '鍗曚綅浠g爜', edit: 'text', event: "HUnitCode" }
+ , { field: 'HUnitName', title: '鍗曚綅鍚嶇О', edit: 'text', event: "" }
+ //, { field: 'HManagerID', title: '璐熻矗浜篒D', edit: 'text', hide: true }
+ //, { field: 'HManagerNumber', title: '璐熻矗浜轰唬鐮�', edit: 'text', event: 'HManagerNumber' }
+ //, { field: 'HManagerName', title: '璐熻矗浜�', edit: 'text' }
+ , { field: 'HQty', title: '鐢ㄩ噺', edit: 'text' }
+ , { field: 'HRemark', title: '澶囨敞', edit: 'text' }
+ , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo1', width: 150 }
+ ];
+ option1 = {
+ id: 'mainTable1'
+ , elem: '#mainTable1'
+ , toolbar: '#toolbarDemo1'
, height: 500
, page: true
, limit: 500
@@ -360,8 +514,10 @@
function set_AddFNew() {
//鑾峰彇鏈�澶у崟鎹彿
get_MAXNum();
- option.data = [TabRow];
+ option.data = [{ "HMaintainItemID": 0, "HMaintainItemNumber": " ", "HMaintainItem": " ", "HMaintainPart": " ", "HClaim": " ", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HRemark": " " }];
+ option1.data = [{ "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HQty": "0", "HRemark": "" }];
table.render(option);
+ table.render(option1);
}
//鑾峰彇鏈�澶у崟鎹彿
function get_MAXNum() {
@@ -387,8 +543,10 @@
function set_EditFromGrid(linterid) {
set_EditForm(linterid); //缂栬緫鑾峰彇琛ㄥご
set_EditGrid(linterid); //缂栬緫鑾峰彇琛ㄤ綋
- option.data = [TabRow];
+ option.data = [{ "HMaintainItemID": 0, "HMaintainItemNumber": " ", "HMaintainItem": " ", "HMaintainPart": " ", "HClaim": " ", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HRemark": " " }];
table.render(option);
+ option1.data = [{ "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HQty": "0", "HRemark": "" }];
+ table.render(option1);
}
//缂栬緫鑾峰彇琛ㄥご
function set_EditForm(linterid) {
@@ -407,6 +565,7 @@
"HBillNo": data.鍗曟嵁鍙�
, "HDate": formatDate(data.鏃ユ湡)
, "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
+ , "HEquipID": data.璁惧ID
, "HEquipName": data.璁惧鍚嶇О //璁惧鍚嶇О
, "HBeginDate": formatDate(data.寮�濮嬫棩鏈�) //寮�濮嬫棩鏈�
, "HEndDate": formatDate(data.缁撴潫鏃ユ湡) //缁撴潫鏃ユ湡
@@ -414,6 +573,8 @@
, "HRemark": data.琛ㄥご澶囨敞
, "HCycleUnit": data.鍛ㄦ湡鍗曚綅
, "HCheckCycle": data.淇濆吇鍛ㄦ湡
+ , "HMouldMaintainRuleID": data.HMouldMaintainRuleID
+ , "HMouldMaintainRuleNo": data.璁惧淇濆吇瑙勭▼
});
} else {
@@ -429,15 +590,15 @@
$("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
//缂栬緫鍔犺浇鏁版嵁
$.ajax({
- url: GetWEBURL() + 'Sb_EquipMaintainPlanBill/Sb_EquipMaintainPlanBillListProjectDetai',
+ url: GetWEBURL() + 'Sb_EquipMaintainPlanBill/Sb_EquipMaintainPlanBillListProjectDetaiNew',
type: "GET",
- data: { "sqlWhere": "and hmainid=" + linterid },
+ data: { "HInterID": linterid },
success: function (result) {
- //console.log(result);
- //console.log('gouba' + result);
if (result.count == 1) {
- option.data = result.data;
+ option.data = result.list[0];
table.render(option);
+ option1.data = result.list[1];
+ table.render(option1);
} else {
layer.alert(result.code + result.Message, { icon: 5 });
@@ -448,6 +609,66 @@
}
});
}
+
+ // 淇濆吇淇℃伅 閰嶄欢淇℃伅
+ function get_DocCheckItem2(data) {
+ $.ajax({
+ url: GetWEBURL() + "/Sb_EquipMaintainRuleBill/Sb_EquipMaintainRuleBillSubAndSubItem",
+ type: "GET",
+ async: false,
+ data: { "HInterID": data },
+ success: function (result) {
+ if (result != null) {
+ if (result.count == 1) {
+ var BYData = result.list[0];//淇濆吇
+ var PJData = result.list[1];//閰嶄欢
+ var rowdate1 = layui.table.cache["mainTable"];
+ var rowdate2 = layui.table.cache["mainTable1"];
+ option.data = [{ "HMaintainItemID": 0, "HMaintainItemNumber": " ", "HMaintainItem": " ", "HMaintainPart": " ", "HClaim": " ", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HRemark": " " }];
+ option1.data = [{ "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HQty": "0", "HRemark": "" }];
+ table.render(option);
+ table.render(option1);
+
+ if (BYData.length != 0) //琛ㄤ綋鏁版嵁涓嶄负绌烘椂
+ {
+ buttonArr = [];//娓呯┖鏁扮粍
+ for (var i = 0; i < BYData.length; i++) {
+ var checkrow = {
+ "HMaintainItemID": BYData[i].HMaintainItemID, "HMaintainItemNumber": BYData[i].HMaintainItemNumber, "HMaintainItem": BYData[i].HMaintainItem,
+ "HMaintainPart": BYData[i].HMaintainPart, "HClaim": BYData[i].HClaim, "HManagerID": BYData[i].HManagerID, "HManagerNumber": BYData[i].HManagerNumber,
+ "HManagerName": BYData[i].HManagerName, "HRemark": BYData[i].HRemark
+ };
+ buttonArr.push(checkrow); //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+ }
+ table.reload("mainTable", {
+ data: buttonArr //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+ })
+ }
+
+ if (PJData.length != 0) //琛ㄤ綋鏁版嵁涓嶄负绌烘椂
+ {
+ buttonArr = [];//娓呯┖鏁扮粍
+ for (var i = 0; i < PJData.length; i++) {
+ var checkrow = {
+ "HMaterID": PJData[i].HMaterID, "HMaterNumber": PJData[i].HMaterNumber, "HMaterName": PJData[i].HMaterName,
+ "HUnitID": PJData[i].HUnitID, "HUnitNumber": PJData[i].HUnitNumber,
+ "HUnitName": PJData[i].HUnitName, "HQty": PJData[i].HQty, "HRemark": PJData[i].HRemark
+ };
+ buttonArr.push(checkrow); //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+ }
+ table.reload("mainTable1", {
+ data: buttonArr //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+ })
+ }
+
+ } else {
+ layer.alert(result.code + result.Message, { icon: 5 });
+ }
+ }
+ }
+ })
+ }
+
//鏃ユ湡鏍煎紡鍖�
function formatDate(date) {
var d = new Date(date),
@@ -462,9 +683,27 @@
}
//澧炲姞涓�琛�
function btnAddLine(NewRow) {
- table.cache["mainTable"].push(NewRow);
- option.data = table.cache["mainTable"];
- table.render(option);
+ var tableBak = table.cache["mainTable"]; //鑾峰彇涔嬪墠缂栬緫杩囩殑琛ㄦ牸鏁版嵁
+ buttonArr = [];//娓呯┖鏁扮粍
+ for (var i = 0; i < tableBak.length; i++) {
+ buttonArr.push(tableBak[i]); //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+ }
+ buttonArr.push(NewRow); //鍦ㄥ熬閮ㄥ姞涓�琛�
+ table.reload("mainTable", {
+ data: buttonArr //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+ })
+ }
+ //澧炲姞涓�琛�
+ function btnAddLine1(NewRow) {
+ var tableBak = table.cache["mainTable1"]; //鑾峰彇涔嬪墠缂栬緫杩囩殑琛ㄦ牸鏁版嵁
+ buttonArr = [];//娓呯┖鏁扮粍
+ for (var i = 0; i < tableBak.length; i++) {
+ buttonArr.push(tableBak[i]); //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+ }
+ buttonArr.push(NewRow); //鍦ㄥ熬閮ㄥ姞涓�琛�
+ table.reload("mainTable1", {
+ data: buttonArr //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+ })
}
//澶嶅埗涓�琛�
function btnCopyLine(data) {
@@ -483,6 +722,23 @@
table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
}
}
+ //澶嶅埗涓�琛�
+ function btnCopyLine1(data) {
+ var copydata = JSON.stringify(data);
+ if (data.length <= 0) {
+ layer.msg("璇烽�夋嫨闇�瑕佸鍒剁殑涓�琛岋紒");
+ }
+ else if (data.length > 1) {
+ layer.msg("鍙兘閫夋嫨澶嶅埗涓�琛岋紒");
+ }
+ else {
+ var copydata2 = copydata.substring(1, copydata.length);//鍘婚櫎棣栬瀛楃'['
+ var copyrow = copydata2.substring(0, copydata2.length - 1);//鍘婚櫎鏈熬瀛楃']'
+ table.cache["mainTable1"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂
+ option1.data = table.cache["mainTable1"];//灏嗘暟鎹粦瀹氬埌data涓�
+ table.render(option1);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
+ }
+ }
// 琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎
function set_GridDelete(obj) {
var data = obj.data;
@@ -493,8 +749,6 @@
if (rowIndex === '0') {
layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
} else {
- //obj.del();
- //layer.close(index);
var oldData = table.cache["mainTable"];
oldData.splice(obj.tr.data('index'), 1);
table.reload('mainTable', { data: oldData });
@@ -503,13 +757,117 @@
});
}
}
- // 琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�
+ // 琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎
+ function set_GridDelete1(obj) {
+ var data = obj.data;
+ var rowIndex = $(obj.tr).attr("data-index");
+ if (obj.event === 'del1') {
+ layer.confirm('鐪熺殑鍒犻櫎琛屼箞', function (index) {
+ console.log("绱㈠紩涓�:" + rowIndex);
+ if (rowIndex === '0') {
+ layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
+ } else {
+ var oldData = table.cache["mainTable1"];
+ oldData.splice(obj.tr.data('index'), 1);
+ table.reload('mainTable1', { data: oldData });
+ layer.close(index);
+ }
+ });
+ }
+ }
+ //琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�
function set_GridCellCheck(obj) {
$(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
if (event.key == "F7") {
- //鍗曚綅浠g爜
- if (obj.event === 'HUnitCode')
+ if (obj.event === 'HMaintainItemNumber') //淇濆吇椤圭洰淇℃伅
{
+ //椤甸潰灞�-鑷畾涔�
+ layer.open({
+ type: 2,
+ skin: 'layui-layer-rim', //鍔犱笂杈规
+ title: '淇濆吇椤圭洰鍒楄〃',
+ closeBtn: 1,
+ shift: 2,
+ area: ['90%', '90%'],
+ maxmin: true,
+ content: ['../PublicPage/Gy_Maintain.html', 'yes'],
+ btn: ['纭畾', '鍙栨秷']
+ , btn1: function (index, layero) {
+ //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+ var iframeWindow = window['layui-layer-iframe' + index] //鑾峰彇寮规椤甸潰
+ var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+ if (checkStatus.data.length === 0) {
+ return layer.msg('璇烽�夋嫨鏁版嵁');
+ }
+
+ //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+ obj.update({
+ HMaintainItemID: checkStatus.data[0].HItemID,
+ HMaintainItemNumber: checkStatus.data[0].HNumber,
+ HMaintainItem: checkStatus.data[0].HName,
+ });
+ layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+ }
+ , btn2: function (index, layero) {
+ //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+ //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+ },
+ end: function () {
+ }
+ });
+ }
+ if (obj.event === 'HManagerNumber') //璐d换浜轰俊鎭�
+ {
+ //椤甸潰灞�-鑷畾涔�
+ layer.open({
+ type: 2,
+ skin: 'layui-layer-rim', //鍔犱笂杈规
+ title: '璐d换浜哄垪琛�',
+ closeBtn: 1,
+ shift: 2,
+ area: ['90%', '90%'],
+ maxmin: true,
+ content: ['../PublicPage/UserInformation.html', 'yes'],
+ btn: ['纭畾', '鍙栨秷']
+ , btn1: function (index, layero) {
+
+ //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+ var iframeWindow = window['layui-layer-iframe' + index] //鑾峰彇寮规椤甸潰
+ var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+ if (checkStatus.data.length === 0) {
+ return layer.msg('璇烽�夋嫨鏁版嵁');
+ }
+
+ //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+ obj.update({
+ HManagerID: checkStatus.data[0].HItemID,
+ HManagerNumber: checkStatus.data[0].HNumber,
+ HManagerName: checkStatus.data[0].HName
+ });
+
+ layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+ }
+ , btn2: function (index, layero) {
+ //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+ //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+ },
+ end: function () {
+
+ }
+ });
+ }
+ obj.event = "";
+ return false;
+
+ }
+ })
+ }
+ // 琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�
+ function set_GridCellCheck1(obj) {
+ $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+ if (event.key == "F7") {
+ //鍗曚綅浠g爜
+ if (obj.event === 'HUnitCode') {
//椤甸潰灞�-鑷畾涔�
layer.open({
type: 2,
@@ -531,7 +889,7 @@
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
HUnitID: checkStatus.data[0].HItemID,
- HUnitCode: checkStatus.data[0].HNumber,
+ HUnitNumber: checkStatus.data[0].HNumber,
HUnitName: checkStatus.data[0].HName
});
layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -567,7 +925,7 @@
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
HMaterID: checkStatus.data[0].HItemID,
- HMaterCode: checkStatus.data[0].HNumber,
+ HMaterNumber: checkStatus.data[0].HNumber,
HMaterName: checkStatus.data[0].HName
});
layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -580,6 +938,46 @@
}
});
}
+ //璐熻矗浜轰俊鎭�
+ if (obj.event === 'HManagerNumber') {
+ //椤甸潰灞�-鑷畾涔�
+ layer.open({
+ type: 2,
+ skin: 'layui-layer-rim', //鍔犱笂杈规
+ title: '璐d换浜哄垪琛�',
+ closeBtn: 1,
+ shift: 2,
+ area: ['90%', '90%'],
+ maxmin: true,
+ content: ['../PublicPage/UserInformation.html', 'yes'],
+ btn: ['纭畾', '鍙栨秷']
+ , btn1: function (index, layero) {
+
+ //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+ var iframeWindow = window['layui-layer-iframe' + index] //鑾峰彇寮规椤甸潰
+ var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+ if (checkStatus.data.length === 0) {
+ return layer.msg('璇烽�夋嫨鏁版嵁');
+ }
+
+ //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+ obj.update({
+ HManagerID: checkStatus.data[0].HItemID,
+ HManagerNumber: checkStatus.data[0].HNumber,
+ HManagerName: checkStatus.data[0].HName
+ });
+
+ layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+ }
+ , btn2: function (index, layero) {
+ //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+ //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+ },
+ end: function () {
+
+ }
+ });
+ }
obj.event = "";
return false;
@@ -588,32 +986,62 @@
}
//闈炵┖楠岃瘉
function AllowLoadData(sSubStr) {
- if ($("#HBillNo").val() == '') {
- layer.msg("閿欒鐨勫崟鎹彿", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
- return false;
+ var Result = true;
+ if ($("#HEquipID").val() == '' || $("#HEquipName").val() == '') {
+ layer.msg("璇烽�夋嫨璁惧", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
}
- if ($("#HInterID").val() == '') {
- layer.msg("閿欒鐨勫唴鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
- return false;
+ if ($("#HCheckCycle").val() == '' || $("#HCheckCycle").val() == '0') {
+ layer.msg("璇疯緭鍏ヤ繚鍏诲懆鏈�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
}
- if (typeof (sSubStr) == "undefined") {
- layer.msg("娌℃湁鐗╂枡鏄庣粏璁板綍", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
- return false;
+ if (typeof (sSubStr) == "undefined" || sSubStr == "" || sSubStr == "[]") {
+ layer.msg("淇濆吇椤规槑缁嗚褰曚笉鑳戒负绌�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
}
- if (!typeof (sSubStr) == "undefined") {
- for (var i = 0; i <= sSubStr.length - 1; i++) { //鍒ゆ柇鎵爜鏁伴噺涓嶈兘涓�0
- if (parseFloat(sSubStr[i].HQty) > 0) {
- s = 1;
+ if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
+ sSubStr = JSON.parse(sSubStr);
+ for (var i = 0; i < sSubStr.length; i++) {
+ if (sSubStr[i].HMaintainItemID == "") {
+ layer.msg("淇濆吇椤规槑缁嗚褰曠" + (i + 1) + "琛�,淇濆吇椤圭洰淇℃伅涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
}
- }
- if (s == 0) {
- layer.msg("浜у搧鍏ュ簱璁板綍鏈壂鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
- return false;
+ if (sSubStr[i].HMaintainItem == "") {
+ layer.msg("淇濆吇椤规槑缁嗚褰曠" + (i + 1) + "琛�,淇濆吇閮ㄤ綅淇℃伅涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
+ }
+ if (sSubStr[i].HManagerNumber == "") {
+ layer.msg("淇濆吇椤规槑缁嗚褰曠" + (i + 1) + "琛�,璐熻矗浜轰俊鎭负绌�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
+ }
+
}
}
+ //if (typeof (sSubStr1) == "undefined" || sSubStr1 == "" || sSubStr1 == "[]") {
+ // layer.msg("閰嶄欢椤规槑缁嗚褰曚笉鑳戒负绌�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ // return false;
+ //}
+ //if (typeof (sSubStr1) != "undefined" && typeof (sSubStr1) != "") {
+ // sSubStr1 = JSON.parse(sSubStr1);
+ // for (var i = 0; i < sSubStr1.length; i++) {
+ // if (sSubStr1[i].HMaterNumber == "") {
+ // layer.msg("閰嶄欢椤规槑缁嗚褰曠" + (i + 1) + "琛�,閰嶄欢浠g爜涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ // return false;
+ // }
+ // if (sSubStr1[i].HUnitNumber == "") {
+ // layer.msg("閰嶄欢椤规槑缁嗚褰曠" + (i + 1) + "琛�,鍗曚綅浠g爜淇℃伅涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ // return false;
+ // }
+ // if (sSubStr[i].HManagerNumber == "") {
+ // layer.msg("淇濆吇椤规槑缁嗚褰曠" + (i + 1) + "琛�,璐熻矗浜轰俊鎭负绌�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ // return false;
+ // }
+ // }
+ //}
else {
- return true;
+ return Result = true;
}
+ return Result;
}
function f_alert(sMsg) {
layer.alert(sMsg, { icon: 5 });
--
Gitblit v1.9.1