Quellcode durchsuchen

2022.3.25按周填报项目筛选

17613754660 vor 3 Jahren
Ursprung
Commit
7bd8930716

+ 69 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -527,8 +527,8 @@
         </el-dialog>
 
         <!-- 按周填报 -->
-        <el-dialog title="按周填报" :visible.sync="diasZho" width="60%" :close-on-click-modal="false" @closed="guanbi()">
-            <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
+        <el-dialog title="按周填报" :visible.sync="diasZho" width="60%" :close-on-click-modal="false" @closed="guanbi(),zhoAddqx()">
+            <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px" v-if="!selConShow">
                 <el-form-item label="工作日期" prop="createDate">
                      <el-date-picker v-model="zhoRqi" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="zhoRqis()" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="margin-right: 18px"></el-date-picker>
                      <el-button @click="handleGetPrevWeek()">上周</el-button>
@@ -543,7 +543,7 @@
                         </template>
                     </el-table-column>
                     <!-- <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200"> -->
-                    <el-table-column align="center" v-for="item in projectList" :key="item.id" :label="item.projectName" width="200">
+                    <el-table-column align="center" v-for="item in selProjectList" :key="item.id" :label="item.projectName" width="200">
                         <template slot-scope="scope">
                             <div v-if="reportTimeType.multiWorktime == 0" slot="reference" @click="tianxies(scope.row[item.projectName], scope.$index, item.projectName, workForm.domains)">
                                 <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 3 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
@@ -567,8 +567,31 @@
                     </el-table-column>
                 </el-table>
             </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="diasZho = false">取 消</el-button>
+
+
+            <!-- 按周填报项目筛选 -->
+            <div v-if="selConShow">
+                <span style="margin-right:1rem">请选择要填报的项目</span>
+                <el-select v-model="selCon" multiple placeholder="请选择" filterable style="width:40rem">
+                    <el-option
+                    v-for="item in projectList"
+                    :key="item.id"
+                    :label="item.projectName"
+                    :value="item.id">
+                    </el-option>
+                </el-select>
+            </div>
+            <span slot="footer" class="dialog-footer" v-if="selConShow">
+                <el-button @click="selListqx()">取 消</el-button>
+                <el-button type="primary" @click="selListFun()">确 认</el-button>
+                <!--  :loading="submitingReport" -->
+            </span>
+
+
+
+            <span slot="footer" class="dialog-footer" v-if="!selConShow">
+                <el-button @click="selConShow = true" style="float:left;" class="el-icon-back">选择项目</el-button>
+                <el-button @click="zhoAddqx()">取 消</el-button>
                 <el-button type="primary" @click="zhoAdd()" :loading="submitingReport">提 交</el-button>
             </span>
         </el-dialog>
@@ -1136,6 +1159,10 @@
                 reportList: [], //日报列表
                 reportNames:[], //批量审批列表
 
+                selCon:[],  //筛选条件
+                selProjectList:[],  //筛选后项目列表
+                selConShow: true,
+
                 dialogVisible: false, //项目弹窗
                 report: '',
                 workForm: {
@@ -2934,6 +2961,7 @@
                     this.listLoading = false;
                     if (res.code == "ok") {
                         this.projectList = res.data;
+                        // console.log("项目列表",this.projectList);
                     } else {
                         this.$message({
                             message: res.msg,
@@ -3321,6 +3349,31 @@
                 this.jiazai()
                 this.diasZho = true
                 this.getCurrentWeek()
+                // 项目数量判断 <=5
+                if(this.projectList.length < 5){
+                    this.selProjectList = this.projectList
+                    this.selConShow = false
+                }
+            },
+            // 按周填报的项目筛选
+            selListFun(){
+                if(this.selCon.length){
+                    for (let i = 0; i < this.selCon.length; i++) {
+                        this.selProjectList.push(this.projectList.find(item => item.id == this.selCon[i]))
+                    }
+                    // console.log("已筛选列表",this.selProjectList);
+                    this.selConShow = false 
+                }else{
+                    this.$message({
+                        message:'请选择要填报的项目',
+                        type:'error'
+                    })
+                }
+            },
+            selListqx(){
+                this.diasZho = false
+                this.selProjectList = []
+                this.selCon = []
             },
             handleScroll() {
                 this.changdu = this.projectList.length + 1
@@ -3419,6 +3472,13 @@
                 var arr = this.zhoData
                 arr.splice(i, 1)
             },
+
+            zhoAddqx(){
+                this.diasZho = false
+                this.selConShow = true
+                this.selProjectList = []
+                this.selCon = []
+            },
             // 提交按周填报
             zhoAdd() {
                 var zhi = this.zhoData
@@ -3621,6 +3681,7 @@
                                     type: "success"
                                 });
                                 this.diasZho = false
+                                this.selConShow = true
                                 this.zhoData = []
                                 this.zhoRqi = ''
                                 this.getReportList();
@@ -3643,6 +3704,9 @@
                 // this.diasZho = false
                 // this.zhoData = []
                 // this.zhoRqi = ''
+                this.selProjectList = []
+                this.selCon = []
+                
             },
             ChangeHourMinutestr (str) {
                 if (str !== "0" && str !== "" && str !== null) {