zeweizhong il y a 6 ans
Parent
commit
249720436c

+ 13 - 0
public/web/lock_util.js

@@ -0,0 +1,13 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/11/14
+ * @version
+ */
+
+const lockUtil = (() => {
+    
+})();

+ 16 - 8
web/maintain/bills_lib/html/main.html

@@ -36,7 +36,7 @@
                             <tr>
                                 <th>清单规则名称</th>
                                 <th width="160">添加时间</th>
-                                <th width="60">操作</th>
+                                <th width="70">操作</th>
                                 <th width="90">导入</th>
                                 <th width="90">复制</th>
                             </tr>
@@ -198,15 +198,9 @@
         //main 增删改
         $("#createA").click(function(){
             let billsLibName = $("#createText").val();
-         /*   let compilationName = $('#compilationSels option:selected').text();
-            let compilationId = $('#compilationSels option:selected').val();*/
             if(billsLibName.trim().length === 0){
                 alert("请输入清单规则名称!");
-            }
-          /*  else if(compilationName.trim().length === 0){
-                alert("编办不可为空!");
-            }*/
-            else {
+            } else {
                 mainAjax.createStdBillsLib(userAccount, billsLibName);
                 $("#createText").val("");
             }
@@ -252,7 +246,21 @@
            let renameId = $(this).parent().parent().attr("id");
            $('#renameText').val($(this).parent().parent().find('td:first-child').text());
            $("#renameA").attr("renameId", renameId);
+       });
 
+       $('#showArea').on('click', '.lock', function () {
+           const $lock = $(this);
+           const $url = $lock.parent().parent().children(':first-child').children(':first-child');
+           const locked = $lock.data().locked;
+           const url = $url.prop('href');
+           const curLocked = !locked;
+           const curURL = url.replace(`locked=${locked}`, `locked=${curLocked}`);
+           $(this).data('locked', curLocked);
+           $url.prop('href', curURL);
+           const innerHtml = curLocked ? '<i class="fa fa-unlock-alt"></i>' : '<i class="fa fa-lock"></i>';
+           $lock.html(innerHtml);
+           const title = curLocked ? '解锁' : '锁定';
+           $lock.prop('title', title);
        });
 
        $('#edit').on('shown.bs.modal', function () {

+ 2 - 1
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -57,11 +57,12 @@ var mainAjax = {
             const createDateFmt = new Date(libData.createDate).format("yyyy-MM-dd");
             const html = 
                 `<tr id="${id}">
-                    <td><a href="/stdBills?billsLibId=${id}">${billsLibName}</a></td>
+                    <td><a href="/stdBills?billsLibId=${id}&locked=true">${billsLibName}</a></td>
                     <td>${createDateFmt}</td>
                     <td>
                         <a href="javascript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
                         <a href="javascript:void(0);" class="text-danger" data-toggle="modal" data-target="#del" title="删除"><i class="fa fa-remove"></i></a>
+                        <a href="javascript:void(0);" class="lock" title="解锁" data-locked="true"><i class="fa fa-unlock-alt"></i></a>
                     </td>
                     <td>
                         <a href="javascript:void(0);" class="btn btn-secondary btn-sm import-data" data-id="${id}" title="导入数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>