Browse Source

导入工料页调整和增加覆盖功能

ellisran 2 tuần trước cách đây
mục cha
commit
3832df321b

+ 7 - 0
app/controller/material_controller.js

@@ -1669,6 +1669,13 @@ module.exports = app => {
                     case 'adds':
                         responseData.data = await ctx.service.materialList.adds(data.postData, data.checklist);
                         break;
+                    case 'cover':
+                        if (ctx.material.checklistPermission && ctx.material.highOrder === ctx.material.order && (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo)) {
+                            responseData.data = await ctx.service.materialList.cover();
+                        } else {
+                            throw '本期发起审批或权限不足,无法覆盖本期清单数据';
+                        }
+                        break;
                     case 'dels':
                         responseData.data = await ctx.service.materialList.dels(data.postData, data.checklist, true, data.ms_id);
                         break;

+ 11 - 0
app/public/css/main.css

@@ -2119,6 +2119,17 @@ animation:shake 1s .2s ease both;}
 .card-gk-active{
   border: 1px solid #3377FF;
 }
+.card-upload-width{
+    width: 130px;
+    height:130px;
+}
+.card-upload-width:hover{
+    background: #f7f7f7;
+    border: none;
+}
+.card-upload-active{
+    border: 1px solid;
+}
 .sel-width{
   width: 20px;
   height: 20px;

BIN
app/public/images/json.png


BIN
app/public/images/xlsx.png


+ 7 - 1
app/public/js/material_checklist.js

@@ -1122,9 +1122,11 @@ $(document).ready(() => {
         $("#import").modal('show');
         // $(this).siblings('input').trigger('click');
     });
-    $('#upload-list-file').change(function () {
+    $('.upload-list-file').change(function () {
         const file = this.files[0];
+        console.log(file);
         importFile = file;
+        $('#upload-file-name').text('已选择文件:' + file.name);
     });
 
     $('#import_btn').click(function() {
@@ -1337,6 +1339,10 @@ $(document).ready(() => {
     async function pushListData(tree = []) {
         if (tree.length > 0) {
             const ignoreUnitPrice = $('#ignore').is(':checked');
+            const cover = $('#cover').is(':checked');
+            if (cover) {
+                await postDataAsync(window.location.pathname + '/save', { type: 'cover' });
+            }
             for (const [i,t] of tree.entries()) {
                 $('#list-detail').find('b').text(t.b_code);
                 resetProgress($('#list-progress'));

+ 4 - 0
app/service/material_list.js

@@ -672,6 +672,10 @@ module.exports = app => {
             }
         }
 
+        async cover() {
+            return await this.db.delete(this.ctx.service.materialList.tableName, { tid: this.ctx.tender.id, mid: this.ctx.material.id });
+        }
+
         /**
          * 删除工料清单关联(多清单对应)
          * @param {int} id 工料id

+ 37 - 4
app/view/material/checklist_modal.ejs

@@ -87,13 +87,42 @@
         <div class="modal-content">
             <div class="modal-header">
                 <h5 class="modal-title">选择文件</h5>
+                <div class="btn-group ml-auto">
+                    <a href="" data-toggle="dropdown" title="文件类型说明"><i class="fa fa-question-circle"></i></a>
+                    <div class="dropdown-menu bg-dark">
+                        <a class="dropdown-item text-light" href="#">1、json文件:来自于纵横造价软件</a>
+                        <a class="dropdown-item text-light in-3" href="#">操作:打开标段,点击“文件-导出-导出清单材料单位耗量(计量支付)”导出即可。</a>
+                        <a class="dropdown-item text-light" href="#">2、excel文件:可从纵横造价软件导出报表或者自己整理一份,格式参考示例。</a>
+                        <a class="dropdown-item text-light" href="#">3、导入匹配条件:</a>
+                        <a class="dropdown-item text-light in-3" href="#">清单:编号、名称、单位、单价;</a>
+                        <a class="dropdown-item text-light in-3" href="#">材料:编号、名称、单位;</a>
+                        <a class="dropdown-item text-light in-3" href="#">说明:云计量有的调差工料和清单,才被允许导入。</a>
+                    </div>
+                </div>
             </div>
             <div class="modal-body">
                 <p>请上传指定格式(.xls或.xlsx或.json) 的文件,<a href="https://jiliang-qa.oss-cn-shenzhen.aliyuncs.com/loginimg/%E6%B8%85%E5%8D%95%E6%9D%90%E6%96%99%E5%8D%95%E4%BD%8D%E6%B6%88%E8%80%97%E9%87%8FExcel%E7%A4%BA%E4%BE%8B.xlsx">下载示例</a>。</p>
-                <div class="form-group">
-                    <label for="upload-list-file">选择文件</label>
-                    <input type="file" class="form-control-file" id="upload-list-file" accept=".xls,.xlsx,.json">
+                <div class="d-flex justify-content-between">
+                    <!-- 为了排版放的空div -->
+                    <div></div>
+                    <div class="card card-upload-width p-2" style="position: relative;">
+                        <input type="file" class="upload-list-file" style="position: absolute;left: 0;top: 0;opacity: 0;cursor: pointer;width: 100%;height: 100%;" accept=".json">
+                        <div class="card-body p-0">
+                            <div class="mt-4"><img src="/public/images/json.png" class="rounded m-auto d-block"></div>
+                            <div class="text-center my-2">json文件</div>
+                        </div>
+                    </div>
+                    <div class="card card-upload-width p-2" style="position: relative;">
+                        <input type="file" class="upload-list-file" style="position: absolute;left: 0;top: 0;opacity: 0;cursor: pointer;width: 100%;height: 100%;" accept=".xls,.xlsx">
+                        <div class="card-body p-0">
+                            <div class="mt-4"><img src="/public/images/xlsx.png" class="rounded m-auto d-block" ></div>
+                            <div class="text-center my-2 ">excel文件</div>
+                        </div>
+                    </div>
+                    <!-- 为了排版放的空div -->
+                    <div></div>
                 </div>
+                <label id="upload-file-name" class="pt-2"></label>
                 <!--导入后选项-->
                 <!--<div>-->
                     <!--<hr></hr>-->
@@ -119,9 +148,13 @@
             <div class="modal-footer d-flex justify-content-between">
                 <div class="">
                     <div class="custom-control custom-checkbox custom-control-inline">
-                        <input type="checkbox" class="custom-control-input" name="customRadioInline1" id="ignore">
+                        <input type="checkbox" class="custom-control-input" name="customRadioInline1" id="ignore" checked>
                         <label class="custom-control-label" for="ignore">忽略清单单价</label>
                     </div>
+                    <div class="custom-control custom-checkbox custom-control-inline">
+                        <input type="checkbox" class="custom-control-input" name="customRadioInline2" id="cover">
+                        <label class="custom-control-label" for="cover">覆盖本期已有调差清单</label>
+                    </div>
                 </div>
                 <div>
                     <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>