Browse Source

资料归集,模板库相关

MaiXinRong 10 months ago
parent
commit
90ee2547c0
4 changed files with 24 additions and 12 deletions
  1. 16 9
      app/public/js/filing_template.js
  2. 1 1
      app/service/filing_template.js
  3. 2 2
      app/view/file/file.ejs
  4. 5 0
      sql/update.sql

+ 16 - 9
app/public/js/filing_template.js

@@ -355,18 +355,25 @@ $(document).ready(function() {
             });
         }
         getMultiUpdateData() {
-            const data = [];
+            const data = [], self = this;
             for (const [i, node] of this.checkTree.nodes.entries()) {
                 node.source_filing_type = i + 1;
-                let filing_type = node.source_filing_type;
-                if (!node.is_fixed) {
-                    const parents = this.checkTree.getAllParents(node);
-                    const fixedParent = _.findLast(parents, function(x) { return x.is_fixed; });
-                    if (!fixedParent) throw `【${node.name}】查询不到固定信息`;
-                    filing_type = fixedParent.source_filing_type;
-                }
-                data.push({ id: node.id, is_fixed: node.is_fixed, filing_type });
             }
+            const getUpdateData = function(children) {
+                for (const [i, node] of children.entries()) {
+                    let filing_type = node.source_filing_type;
+                    if (!node.is_fixed) {
+                        const parents = self.checkTree.getAllParents(node);
+                        parents.sort((a, b) => { return b.tree_level - a.tree_level});
+                        const fixedParent = parents.find(function(x) { return x.is_fixed; });
+                        if (!fixedParent) throw `【${node.name}】查询不到固定信息`;
+                        filing_type = fixedParent.source_filing_type;
+                    }
+                    data.push({ id: node.id, is_fixed: node.is_fixed, filing_type, tree_order: i + 1 });
+                    if (node.children) getUpdateData(node.children);
+                }
+            };
+            getUpdateData(this.checkTree.children);
             return {updateType: 'multi', data};
         }
         _convertData(sourceTree) {

+ 1 - 1
app/service/filing_template.js

@@ -255,7 +255,7 @@ module.exports = app => {
 
             const sourceData = await this.getData(templateId);
 
-            const validFields = ['id', 'is_fixed', 'name', 'filing_type'];
+            const validFields = ['id', 'is_fixed', 'name', 'filing_type', 'tree_order'];
             const updateData = [];
             for (const d of data) {
                 if (!d.id) throw '提交数据格式错误';

+ 2 - 2
app/view/file/file.ejs

@@ -69,7 +69,7 @@
                 <div class="resize-x" id="right-spr" r-Type="width" div1="#left-view" div2="#right-view" title="调整大小" a-type="percent"></div>
                 <div class="tab-content">
                     <div id="search" class="tab-pane tab-select-show mr-1">
-                        <div class="sjs-bar">
+                        <div class="sjs-bar mt-1">
                             <div class="input-group input-group-sm pb-1">
                                 <div class="input-group-prepend">
                                     <select class="input-group-text" id="search-filter">
@@ -81,7 +81,7 @@
                                 <div class="input-group-append"><button class="btn btn-outline-secondary" type="button">搜索</button></div>
                             </div>
                         </div>
-                        <div class="sjs-sh mt-1">
+                        <div class="sjs-sh scroll-y">
                             <table class="table table-bordered">
                                 <tr class="text-center"><th>文件名称</th><th width="15%">上传人</th><th width="15%">操作</th></tr>
                                 <tbody id="search-list"></tbody>

+ 5 - 0
sql/update.sql

@@ -440,3 +440,8 @@ CREATE TABLE `zh_stage_yjcl`  (
   `shistory` text NULL COMMENT '审批历史',
   PRIMARY KEY (`id`)
 );
+
+
+-- update请放在最后
+
+Update zh_filing_template SET is_fixed = 1 WHERE tree_level = 1;