浏览代码

修改装卸队展示表单方式

ajun 5 年之前
父节点
当前提交
df0c2c59e4

+ 63 - 18
resources/views/personnel/discharge/facilitator/_table.blade.php

@@ -1,35 +1,80 @@
-<table class="table table-sm table-striped table-bordered table-hover card-body p-0 m-0">
+<table class="table table-hover card-body p-0 m-0">
+{{--<table class="table table-sm table-striped table-bordered table-hover card-body p-0 m-0">--}}
+    <thead class="thead-light">
     <tr class="text-center">
-        <th><input type="checkbox" class="form-check" name="selectAll" id="selectAll" @click="checkAll" ></th>
         <th>序号</th>
-        <th>日期</th>
+        <th>时间段</th>
         <th>装卸队</th>
-        <th>数量</th>
-        <th>单位</th>
-        <th>单价</th>
-        <th>总金额合计</th>
+        <th>订单数量</th>
+        <th>总金额</th>
+        <th>月账单详情</th>
+        <th>操作</th>
     </tr>
+    </thead>
+    <tbody>
     <template v-if="facilitatorStatements.length>0">
-        <tr v-for="(facilitatorStatement,index) in facilitatorStatements" :key="index" class="text-center" @click="selectTr===index+1?selectTr=0:selectTr=index+1" :class="selectTr===index+1?'focusing' : ''">
-            <td><input type="checkbox" class="form-check" :value="facilitatorStatement.id" v-model="checkData"></td>
-            <td>@{{index+1}}</td>
-            <td>@{{ facilitatorStatement.created_at }}</td>
-            <td>@{{ facilitatorStatement.facilitator ? facilitatorStatement.facilitator.name : '' }}</td>
-            <td>@{{ facilitatorStatement.expenditure_amount }}</td>
-            <td>@{{ facilitatorStatement.expenditure_unit }}</td>
-            <td>@{{ facilitatorStatement.expenditure_unit_price }}</td>
-            <td>@{{ facilitatorStatement.expenditure_total_cost }}</td>
+        <template  v-for="(facilitatorStatement,index) in facilitatorStatements">
+        <tr class="text-center"
+            @click="selectTr===index+1?selectTr=0:selectTr=index+1" :class="selectTr===index+1?'focusing' : ''">
+            <td class="align-text-bottom">@{{index+1}}</td>
+            <td class="align-text-bottom">@{{ facilitatorStatement.months }}</td>
+            <td class="align-text-bottom">@{{ facilitatorStatement.facilitators_name }}</td>
+            <td class="align-text-bottom">@{{ facilitatorStatement.sum }}</td>
+            <td class="align-text-bottom">@{{ facilitatorStatement.total_cost }}</td>
+            <td>
+                <button class="align-self-center btn btn-outline-info m-0" @click="gainStatement(facilitatorStatement,index,$event)">点击展开</button>
+            </td>
+            <td class="align-text-bottom">
+                <button class="align-self-center btn btn-outline-primary m-0">查看</button>
+                <button class="align-self-center btn btn-outline-info m-0">打印</button>
+            </td>
+        </tr>
+        <tr v-if="facilitatorStatement.showSubject" class="p-0 up" >
+            <td></td>
+            <td colspan="7" class="p-0 m-0">
+                <div class="p-0 " :id="'Statement' + index">
+                    <table class="table table-bordered m-0">
+                        <thead class="thead-light">
+                        <tr>
+                            <th>日期</th>
+                            <th>装卸队</th>
+                            <th>数量</th>
+                            <th>单位</th>
+                            <th>单价</th>
+                            <th>总金额合计</th>
+                            <th>链接</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr v-for="(item,index) in facilitatorStatement.subjection">
+                            <td>@{{ item.created_at }}</td>
+                            <td>@{{ item.facilitator ? item.facilitator.name :'' }}</td>
+                            <td>@{{ item.expenditure_amount }}</td>
+                            <td>@{{ item.expenditure_unit }}</td>
+                            <td>@{{ item.expenditure_unit_price }}</td>
+                            <td>@{{ item.expenditure_total_cost }}</td>
+                            <td>
+                                <a href="">服务商</a>
+                            </td>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </td>
         </tr>
+        </template>
+
     </template>
     <template v-else>
         <tr>
             <td colspan="8">
-                <div class='alert alert-info text-lg-center' >
+                <div class='alert alert-info text-lg-center'>
                     装卸队对账单数据为空
                 </div>
             </td>
         </tr>
     </template>
-    {{ $facilitatorStatements->withQueryString()->links() }}
+    </tbody>
 </table>
+{{ $facilitatorStatements->withQueryString()->links() }}
 <hr>

+ 31 - 6
resources/views/personnel/discharge/facilitator/index.blade.php

@@ -56,11 +56,13 @@
                 let _this = this;
                 this.facilitatorStatements.forEach(function(facilitatorStatement,index,array){
                     array[index]['expenditure_unit'] = _this.units[facilitatorStatement['expenditure_unit']];
+                    array[index]['subjection'] = [];
+                    array[index]['showSubject'] = false;
                 });
-                this.facilitators.forEach(function(provider,index,array){
+                this.facilitators.forEach(function(provider,index,array) {
                     array[index] = {
-                        name:provider.id,
-                        value:provider.name,
+                        name: provider.id,
+                        value: provider.name,
                     }
                 });
             },
@@ -80,9 +82,7 @@
                 this.form = new query({
                     el: '#form_div',
                     condition: data,
-                    appendDom : "btn",
-                    paginations:[ 50, 100, 200, 500,1000,20],
-                })
+                });
                 this.form.init();
             },
             methods:{
@@ -94,6 +94,31 @@
                         });
                     }
                 },
+                gainStatement(facilitatorStatement,index,$e){
+                    if(facilitatorStatement.showSubject){
+                        facilitatorStatement.showSubject=false;
+                        $($e.target).html('点击展开');
+                        return;
+                    }
+                    $($e.target).html('加载中....');
+                    let url = '{{url('apiLocal/facilitator/gainStatement')}}'
+                    let data = {
+                        'created_range':facilitatorStatement['months'],
+                        'facilitator_id':facilitatorStatement['id'],
+                    };
+                    window.axios.post(url,data).then(res=>{
+                        if(res.data.success){
+                            this.$set(this.facilitatorStatements[index],'subjection',res.data.data);
+                            facilitatorStatement['showSubject'] = true;
+                            $("#Statement"+index).slideToggle();
+                            $($e.target).html('点击收起');
+                            this.$forceUpdate();
+                        }
+                    }).catch(err=>{
+                        $($e.target).html('点击展开');
+                        window.tempTip.show(err);
+                    });
+                },
                 Export(isExportAll) {
                     let url = '{{url('personnel/discharge/facilitator/export')}}';
                     let token = '{{ csrf_token() }}';