ソースを参照

2022.10.12 移动端自选审批人

ggooalice 2 年 前
コミット
17f5c7688d

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

@@ -467,7 +467,7 @@
 
                     </el-form-item>
                     <!-- 111111 -->
-                    <el-form-item label="审核人" v-if="user.timeType.reportAuditType == 3">
+                    <el-form-item :label="$t('other.reviewer')" v-if="user.timeType.reportAuditType == 3">
                         <el-select v-model="domain.auditorFirst" placeholder="第一审核人" :disabled="!domain.canEdit" style="width:200px;">
                             <el-option v-for="item in allUsersList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                         </el-select>
@@ -5531,11 +5531,11 @@
                                     audItem.auditorFirst = this.workForm.domains[i].auditorFirst
                                 }
                                 if(this.user.timeType.auditLevel > 1){
-                                    if(!this.workForm.domains[i].auditorFirst){ auditRule += '第二、' }
+                                    if(!this.workForm.domains[i].auditorSec){ auditRule += '第二、' }
                                     audItem.auditorSec = this.workForm.domains[i].auditorSec
                                 }
                                 if(this.user.timeType.auditLevel > 2){
-                                    if(!this.workForm.domains[i].auditorFirst){ auditRule += '第三、' }
+                                    if(!this.workForm.domains[i].auditorThird){ auditRule += '第三、' }
                                     audItem.auditorThird = this.workForm.domains[i].auditorThird
                                 }
                                 if(this.workForm.domains[i].ccUserid){

+ 141 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -75,6 +75,7 @@
                             @cancel="item.showPickerCostId = false;$forceUpdate();" />
                     </van-popup>
                     <!-- 审核人 -->
+                <template v-if="user.timeType.reportAuditType != 3">
                     <van-field  readonly  name="projectAuditorId" v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
                         :value="item.projectAuditorName" :label="user.companyId==781?'审核人':'项目审核人'" placeholder="请选择审核人" 
                     @click="clickPickAuditor(index, item)">
@@ -92,6 +93,51 @@
                             </template>
                         </van-picker>
                     </van-popup>
+                </template>
+
+                    <!-- 自选审批人 -->
+                <template v-if="user.timeType.reportAuditType == 3">
+                    <van-field readonly clickable label="第一审核人" @click="auditorClick(index,'auditorFirst')">
+                        <template #input>
+                            <span v-if="!item.auditorFirst"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorFirst.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorFirst.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="第二审核人" @click="auditorClick(index,'auditorSec')" v-if="user.timeType.auditLevel > 1">
+                        <template #input>
+                            <span v-if="!item.auditorSec"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorSec.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorSec.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="第三审核人" @click="auditorClick(index,'auditorThird')" v-if="user.timeType.auditLevel > 2">
+                        <template #input>
+                            <span v-if="!item.auditorThird"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorThird.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorThird.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="抄送人" @click="auditorClick(index,'ccUserid')">
+                        <template #input>
+                            <span v-if="!item.ccUserid"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.ccUserid.name'></ww-open-data></span>
+                            <span v-else>{{item.ccUserid.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-popup v-model="auditorShow" position="bottom">
+                        <van-search v-model="auditor.searchText" placeholder="输入员工姓名搜索" @search="onSearch" v-if="user.userNameNeedTranslate != '1'"></van-search>
+                        <div style="minHeight:300px;">
+                            <van-radio-group v-model="auditor.item">
+                                <van-radio v-for="uitem in auditor.searchList" :key="uitem.id" :name="uitem" style="padding:10px">
+                                    <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='uitem.name'></ww-open-data></span>
+                                    <span v-else>{{uitem.name ? uitem.name : ''}}</span>
+                                </van-radio>
+                            </van-radio-group>
+                            <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="searchAuditor()">确定</van-button>
+                        </div>
+                    </van-popup>
+                </template>
 
 
                     <!-- 相关维度 -->
@@ -410,7 +456,17 @@ import timetoolVue from '../timetool/timetool.vue';
                 userName: '',
                 flgLg: true,
                 reportBasecostList: [],
-                isWeekend: false
+                isWeekend: false,
+
+                auditorShow: false,
+                auditor: {
+                    index: 0,
+                    auditorIndex: 'auditorFirst',
+                    searchText: '',
+                    item: {},
+                    list: [],
+                    searchList: []
+                }
             };
         },
 
@@ -419,6 +475,46 @@ import timetoolVue from '../timetool/timetool.vue';
         },
 
         methods: {
+            auditorClick(domainIndex,auditorIndex){
+                this.auditor.index = domainIndex
+                this.auditor.auditorIndex = auditorIndex
+                this.auditor.searchList.forEach(u=>{
+                    if(u.id == this.form.domains[domainIndex][auditorIndex].id){
+                        this.auditor.item = u
+                    }
+                })
+                this.auditorShow = true
+                
+            },
+            onSearch(val){
+                console.log(val);
+                this.auditor.searchList = [];
+                this.auditor.list.forEach(u=>{if (u.name.startsWith(val)) {
+                    this.auditor.searchList.push(u);
+                }})
+            },
+            searchAuditor(){
+                this.form.domains[this.auditor.index][this.auditor.auditorIndex] = this.auditor.item
+                this.auditorShow = false
+                console.log('searchAuditor');
+            },
+            getAllUsersList(){
+                this.$axios.post('/user/getSimpleActiveUserList',{})
+                .then(res => {
+                    if(res.code == 'ok'){
+                        this.auditor.list = res.data
+                        this.auditor.searchList = res.data
+                    }else{
+                        this.$toast.fail('获取失败:'+res.msg);
+                    }
+                }).catch(err => {this.$toast.clear();})
+            },
+            requiredRule(val){
+                console.log('requiredRule',val);
+                return false
+            },
+
+
             // 获取预算来源
             getReportBasecostList(){
                 this.$axios.post('/project-basecost-setting/getReportBasecostList',{
@@ -979,7 +1075,12 @@ import timetoolVue from '../timetool/timetool.vue';
                                     auditUserList: list[i].auditUserList,
                                     overtimeHours: list[i].overtimeHours,
                                     customText: list[i].customText,
-                                    canEdit: list[i].state >= 2 ? true : false
+                                    canEdit: list[i].state >= 2 ? true : false,
+
+                                    auditorFirst: list[i].auditorSetting && list[i].auditorSetting.auditorFirst ? list[i].auditorSetting.auditorFirst : {name:'',id:''},
+                                    auditorSec: list[i].auditorSetting && list[i].auditorSetting.auditorSec ? list[i].auditorSetting.auditorSec : {name:'',id:''},
+                                    auditorThird: list[i].auditorSetting && list[i].auditorSetting.auditorThird ? list[i].auditorSetting.auditorThird : {name:'',id:''},
+                                    ccUserid: list[i].auditorSetting && list[i].auditorSetting.ccUserid ? list[i].auditorSetting.ccUserid : {name:'',id:''},
                                 })
                                 if (list[i].state >= 2) {
                                     this.canEdit = true;
@@ -1010,7 +1111,12 @@ import timetoolVue from '../timetool/timetool.vue';
                                 professionProgress:[],
                                 multiWorktime:t.multiWorktime,
                                 worktimeList:[{}],  
-                                canEdit: true
+                                canEdit: true,
+
+                                auditorFirst: {name:'',id:''},
+                                auditorSec: {name:'',id:''},
+                                auditorThird: {name:'',id:''},
+                                ccUserid: {name:'',id:''}
                             }]
                             if(this.isWeekend && this.user.timeType.lockWorktime != 1){
                                 this.$set(this.form.domains[0],'isOvertime',true)
@@ -1425,6 +1531,37 @@ import timetoolVue from '../timetool/timetool.vue';
                             }
                     //填字段
                     for(var i in this.form.domains) {
+                        if(this.user.timeType.reportAuditType == 3){
+                            let audItem = {}
+                            let auditRule = ''
+                            if(this.form.domains[i].id){
+                                audItem.reportId = this.form.domains[i].id
+                            }
+                            if(this.user.timeType.auditLevel > 0){
+                                if(!this.form.domains[i].auditorFirst.id){ auditRule += '第一、' }
+                                audItem.auditorFirst = this.form.domains[i].auditorFirst.id
+                            }
+                            if(this.user.timeType.auditLevel > 1){
+                                if(!this.form.domains[i].auditorSec.id){ auditRule += '第二、' }
+                                audItem.auditorSec = this.form.domains[i].auditorSec.id
+                            }
+                            if(this.user.timeType.auditLevel > 2){
+                                if(!this.form.domains[i].auditorThird.id){ auditRule += '第三、' }
+                                audItem.auditorThird = this.form.domains[i].auditorThird.id
+                            }
+                            if(this.form.domains[i].ccUserid.id){
+                                audItem.ccUserid = this.form.domains[i].ccUserid.id
+                            }
+                            if(auditRule){
+                                auditRule = auditRule.substring(0,auditRule.length - 1)
+                                this.$toast.fail('请指定[' + auditRule + ']审核人')
+                                return
+                            }
+                            formData.append("auditorSettingArray", JSON.stringify(audItem).replace(/,/g,"@"));
+                        }
+
+
+
                         if (this.user.timeType.customDegreeActive == 1) {
                             if(this.form.domains[i].degreeId) {
                                 formData.append("degreeId", this.form.domains[i].degreeId);
@@ -1695,6 +1832,7 @@ import timetoolVue from '../timetool/timetool.vue';
             
             // this.getProject();
             this.getReport();
+            this.getAllUsersList()
             this.getTimeType();
             
             //初始化微信js-sdk参数

+ 133 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -80,6 +80,7 @@
                             @cancel="item.showPickerCostId = false;$forceUpdate();" />
                     </van-popup>
                     <!-- 审核人 -->
+                <template v-if="user.timeType.reportAuditType != 3">
                     <van-field  readonly  name="projectAuditorId" v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
                         :value="item.projectAuditorName" :label="user.companyId==781?'审核人':'项目审核人'" placeholder="请选择审核人" 
                     @click="clickPickAuditor(index, item)">
@@ -97,6 +98,51 @@
                             </template>
                         </van-picker>
                     </van-popup>
+                </template>
+
+
+                    <!-- 自选审批人 -->
+                <template v-if="user.timeType.reportAuditType == 3">
+                    <van-field readonly clickable label="第一审核人" @click="auditorClick(index,'auditorFirst')">
+                        <template #input>
+                            <span v-if="!item.auditorFirst"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorFirst.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorFirst.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="第二审核人" @click="auditorClick(index,'auditorSec')" v-if="user.timeType.auditLevel > 1">
+                        <template #input>
+                            <span v-if="!item.auditorSec"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorSec.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorSec.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="第三审核人" @click="auditorClick(index,'auditorThird')" v-if="user.timeType.auditLevel > 2">
+                        <template #input>
+                            <span v-if="!item.auditorThird"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.auditorThird.name'></ww-open-data></span>
+                            <span v-else>{{item.auditorThird.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-field readonly clickable label="抄送人" @click="auditorClick(index,'ccUserid')">
+                        <template #input>
+                            <span v-if="!item.ccUserid"></span>
+                            <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.ccUserid.name'></ww-open-data></span>
+                            <span v-else>{{item.ccUserid.name}}</span>
+                        </template>
+                    </van-field>
+                    <van-popup v-model="auditorShow" position="bottom">
+                        <van-search v-model="auditor.searchText" placeholder="输入员工姓名搜索" @search="onSearch" v-if="user.userNameNeedTranslate != '1'"></van-search>
+                        <div style="minHeight:300px;">
+                            <van-radio-group v-model="auditor.item">
+                                <van-radio v-for="uitem in auditor.searchList" :key="uitem.id" :name="uitem" style="padding:10px">
+                                    <span>{{uitem.name}}</span>
+                                </van-radio>
+                            </van-radio-group>
+                            <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="searchAuditor()">确定</van-button>
+                        </div>
+                    </van-popup>
+                </template>
 
 
                     <!-- 相关维度 -->
@@ -390,10 +436,55 @@
                 kaoqinText: false,
                 workTimeText: false,
 
-                reportBasecostList: []
+                reportBasecostList: [],
+
+                auditorShow: false,
+                auditor: {
+                    index: 0,
+                    auditorIndex: 'auditorFirst',
+                    searchText: '',
+                    item: {},
+                    list: [],
+                    searchList: []
+                }
             };
         },
         methods: {
+            auditorClick(domainIndex,auditorIndex){
+                this.auditor.index = domainIndex
+                this.auditor.auditorIndex = auditorIndex
+                this.auditor.searchList.forEach(u=>{
+                    if(u.id == this.form.domains[domainIndex][auditorIndex].id){
+                        this.auditor.item = u
+                    }
+                })
+                this.auditorShow = true
+                
+            },
+            onSearch(val){
+                console.log(val);
+                this.auditor.searchList = [];
+                this.auditor.list.forEach(u=>{if (u.name.startsWith(val)) {
+                    this.auditor.searchList.push(u);
+                }})
+            },
+            searchAuditor(){
+                this.currentForm.domains[this.auditor.index][auditorIndex] = this.auditor.item
+                this.auditorShow = false
+                console.log('searchAuditor');
+            },
+            getAllUsersList(){
+                this.$axios.post('/user/getSimpleActiveUserList',{})
+                .then(res => {
+                    if(res.code == 'ok'){
+                        this.auditor.list = res.data
+                        this.auditor.searchList = res.data
+                    }else{
+                        this.$toast.fail('获取失败:'+res.msg);
+                    }
+                }).catch(err => {this.$toast.clear();})
+            },
+
             // 预算来源
             clickPickCostId(i, item) {
                 // if (!item.canEdit) return;
@@ -539,7 +630,12 @@
                                 state: 2,
                                 multiWorktime:0,
                                 worktimeList:[{}],
-                                degreeId: ''
+                                degreeId: '',
+
+                                auditorFirst: {name:'',id:''},
+                                auditorSec: {name:'',id:''},
+                                auditorThird: {name:'',id:''},
+                                ccUserid: {name:'',id:''}
                             }],
                         }
                     this.form.push(formItem)
@@ -1515,6 +1611,40 @@
                         if (!this.form[formIndex].domains[i].projectId) {
                             continue;
                         }
+
+
+                        if(this.user.timeType.reportAuditType == 3){
+                            let audItem = {}
+                            let auditRule = ''
+                            if(this.form[formIndex].domains[i].id){
+                                audItem.reportId = this.form[formIndex].domains[i].id
+                            }
+                            if(this.user.timeType.auditLevel > 0){
+                                if(!this.form[formIndex].domains[i].auditorFirst.id){ auditRule += '第一、' }
+                                audItem.auditorFirst = this.form[formIndex].domains[i].auditorFirst.id
+                            }
+                            if(this.user.timeType.auditLevel > 1){
+                                if(!this.form[formIndex].domains[i].auditorSec.id){ auditRule += '第二、' }
+                                audItem.auditorSec = this.form[formIndex].domains[i].auditorSec.id
+                            }
+                            if(this.user.timeType.auditLevel > 2){
+                                if(!this.form[formIndex].domains[i].auditorThird.id){ auditRule += '第三、' }
+                                audItem.auditorThird = this.form[formIndex].domains[i].auditorThird.id
+                            }
+                            if(this.form[formIndex].domains[i].ccUserid.id){
+                                audItem.ccUserid = this.form[formIndex].domains[i].ccUserid.id
+                            }
+                            if(auditRule){
+                                auditRule = auditRule.substring(0,auditRule.length - 1)
+                                this.$toast.fail('请指定' + this.weekArr[formIndex] + '的[' + auditRule + ']审核人')
+                                return
+                            }
+                            formData.append("auditorSettingArray", JSON.stringify(audItem).replace(/,/g,"@"));
+                        }
+
+
+
+
                         if (this.user.timeType.customDegreeActive == 1) {
                             if(this.form[formIndex].domains[i].degreeId) {
                                 formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
@@ -1775,6 +1905,7 @@
             
             this.getProject();
             this.getReportBasecostList()
+            this.getAllUsersList()
             // this.getReport();
             this.getTimeType();
             //初始化微信js-sdk参数

+ 82 - 17
fhKeeper/formulahousekeeper/timesheet_h5/src/views/review/index.vue

@@ -49,6 +49,11 @@
                 <van-button @click="batchAgree(false)" :disabled="!isCanAgree || report.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button>
                 </div>
             </div>
+
+            <van-pull-refresh v-model="downLoading" @refresh="onDownRefresh">
+                <!-- 列表 -->
+                <van-list v-model="upLoading" :finished="upFinished" :immediate-check="false" :offset="100" finished-text="没有更多了" @load="onLoadList">
+
             <van-skeleton  v-for="(item,index) in report" :key="index" title avatar :row="3" :loading="false">
                 <van-panel class="one_report">
                     <template #header>
@@ -152,6 +157,11 @@
                     </van-popup>
                 </van-panel>
             </van-skeleton>
+
+                </van-list>
+            </van-pull-refresh>
+
+            
             <van-popup v-model="denyReasonDialog" position="bottom" closeable >
                 <van-cell>请输入原因</van-cell>
                 <van-field class="form_input"
@@ -188,6 +198,15 @@
                 nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
                 showPicker: false,
                 report: [],
+
+                // 懒加载
+                total: 0,               // 列表总数据长度
+                pageIndex: 1,           // 页码,每页数据固定为25
+                upLoading: false,       // 上拉加载
+                upFinished: false,      // 上拉加载完毕
+                downLoading: false,     // 下拉刷新
+                listReLoading: false,   // 是否重新加载列表数据
+
                 flg: false,
                 isCanAgree: false,
                 approveinData: null,
@@ -208,17 +227,42 @@
         created() {
         },
         methods: {
+
+            onDownRefresh() {
+                this.pageIndex = 1
+                this.listReLoading = true
+                this.upLoading = true
+                this.upFinished = false // 不写这句会导致你上拉到底过后在下拉刷新将不能触发下拉加载事件
+                this.getReport()
+            },
+            onLoadList(){
+                if(this.total <= this.report.length) {
+                    this.upFinished = true
+                    this.upLoading = false
+                    return
+                }
+                this.pageIndex += 1
+                this.listReLoading = false
+                this.getReport()
+            },
+
+
+
             selectDateClear(){
                 this.selectDate = []
                 this.selectDateValue = ''
-                this.getReport()
+
+                this.listReLoading = true
+                this.onDownRefresh()
             },
             selectUserClear(){
                 this.userNameValue = ''
                 this.userIdList = []
                 this.userList.forEach(item => {delete item.isChecked})
                 this.showUserList = this.userList
-                this.getReport()
+
+                this.listReLoading = true
+                this.onDownRefresh()
             },
             selectUserClick(){
                 this.selectUserShow = true
@@ -230,7 +274,9 @@
                 this.selectShow = false;
                 this.selectDate = [this.getSelectDateStr(start),this.getSelectDateStr(end)]
                 this.selectDateValue = `${this.selectDate[0]} 至 ${this.selectDate[1]}`;
-                this.getReport()
+                
+                this.listReLoading = true
+                this.onDownRefresh()
             },
             getSelectDateStr(date){
                 return `${date.getFullYear()}-${(date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)}-${date.getDate() < 10 ? '0' + date.getDate() : date.getDate()}`;
@@ -253,9 +299,12 @@
                     this.userNameValue = this.userNameValue.substring(0, this.userNameValue.length-1);
                     this.userIdList = this.userIdList.substring(0, this.userIdList.length-1);
                 }
-                this.$forceUpdate()
                 this.selectUserShow = false
-                this.getReport()
+
+                this.listReLoading = true
+                this.onDownRefresh()
+
+                this.$forceUpdate()
                 
             },
 
@@ -416,7 +465,9 @@
             getReport() {
                 const toast = this.$toast.loading({
                     forbidClick: true,
-                    duration: 0
+                    duration: 0,
+                    pageIndex: this.pageIndex,
+                    pageSize: 25
                 });
                 let parameter = {
                     state: 0
@@ -432,19 +483,36 @@
                 .then(res => {
                     if(res.code == "ok") {
                         this.$toast.clear();
-                        this.report = res.data;
-                        // this.isAllChecked = this.report.length == 0 ? false : true
-                        if(this.report.length == 0){
-                            this.isAllChecked = false
-                        }
-                        for(let i in this.report){
-                            this.$set(this.report[i],'checked',false)
+                        // this.total = res.data.total
+                        this.downLoading = false
+                        this.upLoading = false
+
+                        this.isAllChecked = false
+                        if(this.listReLoading){
+                            this.report = res.data;
+                            document.documentElement.scrollTop = 0
+                            for(let i in this.report){
+                                this.$set(this.report[i],'checked',false)
+                            }
+                        }else{
+                            for(let i in res.data){
+                                this.report.push(res.data[i])
+                            }
+                            
                         }
+
+                        // this.isAllChecked = this.report.length == 0 ? false : true
+                        
+                        
                     } else {
                         this.$toast.clear();
                         this.$toast.fail('获取失败:'+res.msg);
+                        this.downLoading = false
+                        this.upLoading = false
                     }
-                }).catch(err=> {this.$toast.clear();});
+                }).catch(err=> {this.$toast.clear();
+                    this.downLoading = false
+                    this.upLoading = false});
             },
 
             approve(id, item) {
@@ -548,9 +616,6 @@
 </script>
 
 <style lang="less" scoped>
-.dateSelectCell{
-    display: -webkit-box;
-}
 .userCheckbox {
         padding: 10px;;
     }