瀏覽代碼

2022.3.16

17613754660 3 年之前
父節點
當前提交
3244cf8b28
共有 1 個文件被更改,包括 85 次插入37 次删除
  1. 85 37
      fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

+ 85 - 37
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -30,27 +30,34 @@
             </el-form-item>
             </el-form>
         </el-col>
-
+        <el-button @click="getCustomColumn()">测试</el-button>
         <!--列表-->
+        <!-- 222 -->
         <el-table :data="list" highlight-current-row v-loading="listLoading" 
         show-summary=true
         ref="table"
         :height="300" style="width: 100%;">
             <el-table-column prop="name" label="姓名" sortable width="150"></el-table-column>
-            <el-table-column prop="monthCost" label="工资"  width="150"></el-table-column>
-            <el-table-column prop="bonus" label="奖金" ></el-table-column>
-            <el-table-column prop="allowance" label="津贴" ></el-table-column>
-            <el-table-column prop="insuranceOld" label="养老保险" ></el-table-column>
-            <el-table-column prop="insuranceMedical" label="医疗保险" ></el-table-column>
-            <el-table-column prop="insuranceLosejob" label="失业保险" ></el-table-column>
-            <el-table-column prop="insuranceInjury" label="工伤保险" ></el-table-column>
-            <el-table-column prop="houseFund" label="住房公积金" ></el-table-column>
+            <el-table-column prop="monthCost" :label="customCols.monthCost"  width="150"></el-table-column>
+            <el-table-column prop="bonus" :label="customCols.bonus" ></el-table-column>
+            <el-table-column prop="allowance" :label="customCols.allowance" ></el-table-column>
+            <el-table-column prop="insuranceOld" :label="customCols.insuranceOld" ></el-table-column>
+            <el-table-column prop="insuranceMedical" :label="customCols.insuranceMedical" ></el-table-column>
+            <el-table-column prop="insuranceLosejob" :label="customCols.insuranceLosejob" ></el-table-column>
+            <el-table-column prop="insuranceInjury" :label="customCols.insuranceInjury" ></el-table-column>
+            <el-table-column prop="houseFund" :label="customCols.houseFund" ></el-table-column>
+            <el-table-column prop="field1" :label="customCols.field1" ></el-table-column>
+            <el-table-column prop="field2" :label="customCols.field2" ></el-table-column>
+            <el-table-column prop="field3" :label="customCols.field3" ></el-table-column>
+            <!-- <el-table-column v-for="(item,index) in customFieldList" :prop="item.prop" :label="item.label" :key="index">
+                
+            </el-table-column> -->
             <!-- <el-table-column prop="others" label="其他" ></el-table-column> -->
-            <el-table-column :label="item.fieldName" v-for="(item, index) in customCols" :key="item.id" :prop="index==0?'customField1':(index==1?'customField2':(index==2?'customField3':''))">
+            <!-- <el-table-column :label="item.fieldName" v-for="(item, index) in customCols" :key="item.id" :prop="index==0?'customField1':(index==1?'customField2':(index==2?'customField3':''))">
                 <template slot-scope="scope">
                     {{index==0?scope.row.customField1:(index==1?scope.row.customField2:(index==2?scope.row.customField3:''))}}
                 </template>
-            </el-table-column>
+            </el-table-column> -->
             <el-table-column prop="totalCost" label="总成本" ></el-table-column>
         </el-table>
         
@@ -165,18 +172,19 @@
 
         <el-dialog title="自定义薪资项" show-header="false" v-if="itemDialog" :visible.sync="itemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <div style="margin-left:30px;">
+                <!-- 111 -->
             <span style="color:#999;">薪资表包含以下数据</span>
-            <p>工资</p>
-            <p>奖金</p>
-            <p>津贴</p>
-            <p>养老保险</p>
-            <p>医疗保险</p>
-            <p>失业保险</p>
-            <p>工伤保险</p>
-            <p>住房公积金</p>
-            <p><el-input v-model="customFieldList.field1" placeholder="请输入自定义薪资项1名称" style="width:200px;" maxlength="8"></el-input></p>
-            <p><el-input v-model="customFieldList.field2" placeholder="请输入自定义薪资项2名称" style="width:200px;" maxlength="8"></el-input></p>
-            <p><el-input v-model="customFieldList.field3" placeholder="请输入自定义薪资项3名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.monthCost" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.bonus" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.allowance" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.insuranceOld" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.insuranceMedical" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.insuranceLosejob" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.insuranceInjury" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.houseFund" placeholder="请输入自定义薪资项名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.field1" placeholder="请输入自定义薪资项1名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.field2" placeholder="请输入自定义薪资项2名称" style="width:200px;" maxlength="8"></el-input></p>
+            <p><el-input v-model="customCols.field3" placeholder="请输入自定义薪资项3名称" style="width:200px;" maxlength="8"></el-input></p>
             </div>
             <div slot="footer" class="dialog-footer">
                 <el-button type="primary" @click="itemDialog = false" >关闭</el-button>
@@ -289,7 +297,7 @@
                 noReportUserList:[],
                 allFinanceList:[],
                 assignNoProUser: false,
-                customFieldList:{field1:null, field2: null, field3: null},
+                customFieldList:[],
                 itemDialog: false,
                 customCols:[],
                 // showNPDialog: false,
@@ -311,6 +319,12 @@
                 myChart: null,
                 params: null,
                 totalPercent:0,
+                // 111
+                aaaaa:[
+                    {label: "工资1"},
+                    {label: "工资2"},
+                    {label: "工资3"},
+                ]
             };
         },
         methods: {
@@ -544,36 +558,67 @@
                
             },
             saveItems() {
-                this.http.post('/finance-tblcuscol/save', this.customFieldList,
+                let savefields = {
+                    monthCost : this.customCols.monthCost,
+                    bonus : this.customCols.bonus,
+                    allowance : this.customCols.allowance,
+                    insuranceOld : this.customCols.insuranceOld,
+                    insuranceMedical : this.customCols.insuranceMedical,
+                    insuranceLosejob : this.customCols.insuranceLosejob,
+                    insuranceInjury : this.customCols.insuranceInjury,
+                    houseFund : this.customCols.houseFund,
+                    field1 : this.customCols.field1,
+                    field2 : this.customCols.field2,
+                    field3 : this.customCols.field3
+            }
+                this.http.post('/finance-tblcuscol/save', savefields,
                     res => {
                         if (res.code == "ok") {
                              this.itemDialog = false;
                             this.getCustomColumn();
                         }});
-               
+               this.$forceUpdate();
             },
             showItemDialog() {
                 this.itemDialog = true;
-                this.customFieldList = {field1:null,field2:null, field3:null};
-                for (var i=0;i<this.customCols.length; i++) {
-                    if (i == 0) {
-                        this.customFieldList.field1 = this.customCols[i].fieldName;
-                    } else if (i == 1) {
-                        this.customFieldList.field2 = this.customCols[i].fieldName;
-                    } else if (i == 2) {
-                        this.customFieldList.field3 = this.customCols[i].fieldName;
-                    }
-                }
+                // this.customFieldList = {field1:null,field2:null, field3:null};
+                // if (this.customCols.field1 !== undefined) {
+                //     this.customFieldList.field1 = this.customCols.field1;
+                // } else if (this.customCols.field2 !== undefined) {
+                //     this.customFieldList.field2 = this.customCols.field2;
+                // } else if (this.customCols.field3 !== undefined) {
+                //     this.customFieldList.field3 = this.customCols.field3;
+                // }
+                
                 
             },
             //获取自定义的字段
             getCustomColumn() {
-                this.http.post('/finance-tblcuscol/get', {companyId: this.user.companyId},
+                this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
                     res => {
                         if (res.code == "ok") {
                             this.customCols = res.data;
+                            this.$refs.table.doLayout();
                         }});
+                    
             },
+            // 222
+            // dynamicTable(){
+            //     this.customFieldList = [
+            //         {label : this.customCols.monthCost,prop : "monthCost"},
+            //         {label : this.customCols.bonus,prop:"bonus"},
+            //         {label : this.customCols.allowance,prop:"allowance"},
+            //         {label : this.customCols.insuranceOld,prop:"insuranceOld"},
+            //         {label : this.customCols.insuranceMedical,prop:"insuranceMedical"},
+            //         {label : this.customCols.insuranceLosejob,prop:"insuranceLosejob"},
+            //         {label : this.customCols.insuranceInjury,prop:"insuranceInjury"},
+            //         {label : this.customCols.houseFund,prop:"houseFund"},
+            //         {label : this.customCols.field1,prop:"field1"},
+            //         {label : this.customCols.field2,prop:"field2"},
+            //         {label : this.customCols.field3,prop:"field3"},
+            //     ]
+
+            // },
             // getProjects() {
             //     this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
             //         res => {
@@ -836,10 +881,11 @@
 
         },
         created() {
-            
+            this.getCustomColumn();
             var d = new Date();
             this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
             
+            
         },
         mounted() {
             let height = window.innerHeight;
@@ -850,12 +896,14 @@
             };
             this.getList();
             this.getCustomColumn();
+            
             // this.getProjects();
         },
         updated() {
             this.$nextTick(() => {
                 this.$refs['table'].doLayout();
             }) 
+            
         }
     };
 </script>