From 5f4affdb2532bdec0e0d274a6dfb6feef9c8305e Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 08 五月 2025 16:12:07 +0800
Subject: [PATCH] 客户分类页面 添加删除时 对已审核数据的保护

---
 WebTM/views/基础资料/公用基础资料/Add_Edit_Gy_CusType.html |   68 ++++++++++++++++++++++++++++------
 WebTM/views/基础资料/公用基础资料/Gy_CusType.html          |    8 +++
 2 files changed, 63 insertions(+), 13 deletions(-)

diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_CusType.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_CusType.html"
index cfa3944..1c03c7a 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_CusType.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_CusType.html"
@@ -39,7 +39,7 @@
                                     <li lay-id="1" style="padding:1px;" class="layui-this">鍩烘湰淇℃伅</li>
                                     <li lay-id="2" style="padding:1px;">鍒跺崟淇℃伅</li>
                                 </ul>
-                                
+
                                 <div class="layui-tab-content">
                                     <div class="layui-tab-item layui-show">
                                         <!-- 鍩烘湰淇℃伅 -->
@@ -81,6 +81,13 @@
                                                         <option value="鏈娴�" selected>鏈娴�</option>
                                                         <option value="鏈娇鐢�">鏈娇鐢�</option>
                                                         <option value="宸蹭娇鐢�">宸蹭娇鐢�</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 120px">鎵�灞炵埗绾э細</label>
+                                                <div class="layui-input-inline">
+                                                    <select name="HParentID" id="HParentID" lay-verify="HParentID" lay-filter="HParentID">
                                                     </select>
                                                 </div>
                                             </div>
@@ -362,11 +369,16 @@
                             $("#HUseFlag ").val(data.浣跨敤鐘舵��);//浣跨敤鐘舵��
                             $("#HRemark").val(data.澶囨敞);//澶囨敞
                             $("input[name='HStopflag']").attr("checked", data.绂佺敤鏍囧織 == "鏄�" ? true : false);//true:閫変腑 false:涓嶉�変腑
+                            
+                            
                             layui.form.render();//瀹炴椂娓叉煋閫変腑鍜屼笉閫変腑鐨勬牱寮�,鏈�濂芥坊鍔犺繖鍙ヨ瘽
-
+                            get_parent(data.鐖剁骇ID);
+                            
                         } else {
                             layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
                         }
+
+
                     }, error: function () {
                         layer.alert("鍙戠敓閿欒!", { icon: 5 });
                     }
@@ -431,16 +443,16 @@
             function get_BillMakerEdit() {
                 $.ajax({
                     type: 'GET',
-                    url: GetWEBURL() + "/Gy_BadReason/Gy_CusTypeList", 
+                    url: GetWEBURL() + "/Gy_BadReason/Gy_CusTypeList",
                     data: {
                         "sWhere": "and HItemID = " + linterid,
-                        "user": sessionStorage["HUserName"] 
+                        "user": sessionStorage["HUserName"]
                     },
-                    success: function(result) {
+                    success: function (result) {
                         if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             var data = result.data[0];
-                            
-                            
+
+
                             $("#HMaker").val(data["鍒涘缓浜�"])
                             $("#HChecker").val(data["瀹℃牳浜�"])
                             // $("HCloseMan").val(data["鍏抽棴浜�"])
@@ -451,13 +463,13 @@
                             // $("HDeleteMan").val(data["浣滃簾浜�"])
                             $("#HUpdateDate").val(data["淇敼鏃堕棿"])
                             // $("HDeleteDate").val(data["浣滃簾鏃ユ湡"])
-                            if(OperationType === '1' || OperationType === '2' )
-                            {
+                            if (OperationType === '1' || OperationType === '2') {
                                 $('#check-btn').addClass("layui-btn-disabled").attr("disabled", true);// 绂佺敤瀹℃牳鎸夐挳
                             }
-                            else if(OperationType === '3' && data["瀹℃牳浜�"] !== ''  && data["瀹℃牳浜�"] !== null)
-                            {   
+                            else if (OperationType === '3' && data["瀹℃牳浜�"] !== '' && data["瀹℃牳浜�"] !== null) // 缂栬緫鐘舵�佷笖宸茬粡琚鏍�
+                            {
                                 $('#check-btn').addClass("layui-btn-disabled").attr("disabled", true);// 绂佺敤瀹℃牳鎸夐挳
+                                $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);// 淇濆瓨鎸夐挳
                             }
                         }
                     }
@@ -467,7 +479,39 @@
 
             // #region 鏂板鎴栬�呭鍒舵椂浠巗ession涓幏鍙栧埗鍗曚俊鎭�
             function get_BillMakerByCache() {
-                $("#HMaker").val(sessionStorage["HMaker"])
+                $("#HMaker").val(sessionStorage["HMaker"]);
+            }
+            // #endregion
+
+            // #region 鑾峰彇鐖剁骇淇℃伅
+            function get_parent(parentid) {
+                var sWhere = '';
+                if (linterid !== '' && linterid !== null) {
+                    sWhere += " and HItemID !=" + linterid;
+                }
+                $.ajax({
+                url: GetWEBURL() + '/Gy_BadReason/Gy_CusTypeList',
+                type: "GET",
+                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "Organization": sessionStorage["Organization"] },
+                success: function (data1) {
+                    var Parent = '<option  style="color:blue;" value="0">鏃�</option>';
+                    if (data1.count == 1) {
+                        var data = data1.data;
+                        for (var i = 0; i < data.length; i++) {
+                            Parent += '<option  style="color:blue;" value="' + data[i].HItemID + '">' + data[i]["瀹㈡埛鍒嗙被鍚嶇О"] + '</option>';
+                        }
+                        $("#HParentID").append(Parent);
+                        $("#HParentID").val(parentid)
+                        form.render('select');
+                    } else {
+                        layer.close(ajaxLoad);
+                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.close(ajaxLoad);
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            })
             }
             // #endregion
         });
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CusType.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CusType.html"
index f8fae2d..59d90db 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CusType.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CusType.html"
@@ -195,7 +195,6 @@
                 , laypage = layui.laypage
                 , laydate = layui.laydate
                 , tree = layui.tree;
-            debugger;
             //鏌ヨ鏉′欢
             var sWhere = "";
             var option = [];
@@ -658,6 +657,13 @@
             function set_DeleteBill() {
                 var checkStatus = table.checkStatus('mainTable')
                     , data = checkStatus.data;
+                // 宸插鏍哥殑鏁版嵁涓嶈兘琚垹闄�
+                if(data[0]['瀹℃牳浜�'] != null || data[0]['瀹℃牳浜�'] != '')
+                {
+                    layer.alert("涓嶈兘鍒犻櫎宸茶瀹℃牳鐨勬暟鎹�!", { icon: 5 });
+                    return;
+                }
+                
                 if (checkStatus.data.length === 1) {
                     var HItemID = data[0].HItemID.toString();
                     //閫昏緫鍒犻櫎鏂规硶

--
Gitblit v1.9.1