QuYueTing il y a 18 heures
Parent
commit
3635326b8b

+ 384 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/task/reviewFiles.vue

@@ -0,0 +1,384 @@
+<template>
+    <div>
+        <van-nav-bar title="文件审核" left-text="返回" @click-left="back" fixed left-arrow/>
+        <div class="login_form">
+            <div class="formBatch">
+                <van-checkbox v-model="isAllChecked" :disabled="fileList.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
+                <div style="padding:1vh 2vw">
+                <van-button @click="batchAgree(true)" :disabled="!isCanAgree || fileList.length == 0" type="info" size="small" style="margin-right:6vw">批量通过</van-button>
+                <van-button @click="showBatchDenyDialog()" :disabled="!isCanAgree || fileList.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button>
+                </div>
+            </div>
+            <van-skeleton  v-for="(item,index) in fileList" :key="index" title avatar :row="3" :loading="false">
+                <van-panel class="one_report">
+                    <template #header>
+                        <div class="van-cell van-panel__header">
+                            <div class="van-cell__title" style="display:flex;align-items:center">
+                                <van-checkbox v-model="item.checked" @click="itemChecked" shape="square" style="margin-right:2vw"></van-checkbox>
+                                <div class="form_text"><a :href="item.url" target="_blank">{{ item.documentName }} - 下载 </a></div>
+                                <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='item.creatorName'></TranslationOpenDataText></span>
+                                <span v-else>{{item.creatorName}}</span>
+                            </div>
+                        </div>
+                    </template>
+                    <div class="form_btn" slot="footer">
+                        <van-button size="small" type="info" @click="approve(item)" style="margin-right: 4vw;">通过</van-button>
+                        <van-button size="small" type="danger" @click="showDenyDialog(item)">驳回</van-button>
+                    </div>
+                </van-panel>
+            </van-skeleton>
+            <van-popup v-model="denyReasonDialog" position="bottom" closeable >
+                <van-cell>请输入原因</van-cell>
+                <van-field class="form_input"
+                    v-model="denyForm.reason" name="reason" type="textarea" :placeholder="'请输入您决定驳回的原因'"
+                    rows="3" autosize  />
+                <van-button style="width:100%;" type="info" @click="deny()" :disabled="(Boolean(user.timeType.forceRejectReason) && !denyForm.reason)">提交</van-button>
+            </van-popup>
+        </div>
+    </div>
+</template>
+
+<script>
+    import { Dialog } from 'vant';
+    export default {
+        data() {
+            return {
+                isBatchDeny: false,
+                isAllChecked: false,
+                denyForm:{reason:null},
+                denyReasonDialog:false,
+                user: JSON.parse(localStorage.userInfo),
+                minDate: new Date(2010, 0, 1),
+                maxDate: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()),
+                currentDate: new Date(),
+                nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
+                fileList: [],
+                flg: false,
+                isCanAgree: false,
+                approveinData: null,
+                approveinDialog: false,
+                isbatch: false,
+
+                selectDate: [],
+                selectDateValue: '',
+                selectShow: false,
+                userList: [],
+                showUserList: [],
+                userIdList: [],
+                userNameValue: '',
+                searchInputValue: '',
+                selectUserShow: false
+            };
+        },
+        created() {
+        },
+        methods: {
+            selectDateClear(){
+                this.selectDate = []
+                this.selectDateValue = ''
+                this.getFileList()
+            },
+            selectUserClear(){
+                this.userNameValue = ''
+                this.userIdList = []
+                this.userList.forEach(item => {delete item.isChecked})
+                this.showUserList = this.userList
+                this.getFileList()
+            },
+            selectUserClick(){
+                this.selectUserShow = true
+                this.searchInputValue = ''
+                this.showUserList = this.userList
+            },
+            selectConfirm(date){
+                const [start, end] = date;
+                this.selectShow = false;
+                this.selectDate = [this.getSelectDateStr(start),this.getSelectDateStr(end)]
+                this.selectDateValue = `${this.selectDate[0]} 至 ${this.selectDate[1]}`;
+                this.getFileList()
+            },
+            // 批量操作
+            allChecked(){
+                if(this.isAllChecked){
+                    for(let i in this.fileList){
+                        this.fileList[i].checked = true
+                    }
+                    this.isCanAgree = true
+                }else{
+                    for(let i in this.fileList){
+                        this.fileList[i].checked = false
+                    }
+                    this.isCanAgree = false
+                }
+            },
+            itemChecked(){
+                let isall = true
+                let iscan = false
+                for(let i in this.fileList){
+                    if(!this.fileList[i].checked){
+                        isall = false
+                    }else {
+                        iscan = true
+                    }
+                }
+                this.isAllChecked = isall
+                this.isCanAgree = iscan
+            },
+            batchAgree(bol){
+                let ids = ''
+                for(let i in this.fileList){
+                    if(this.fileList[i].checked){
+                        ids += this.fileList[i].id + ','
+                    }
+                }
+                if(ids.length > 0){
+                    ids = ids.substring(0, ids.length-1);
+                }
+                if(bol){
+                    Dialog.confirm({
+                        message: `确认批量通过这些的文件吗?`
+                    })
+                    .then(() => {
+                        this.isbatch = true
+                        this.approveinData = {
+                            taskFileIds: ids
+                        }
+                        const toast = this.$toast.loading({
+                            forbidClick: true,
+                            duration: 0
+                        });
+                        this.batchApproveinfun()
+                    })
+                    .catch(() => {});
+                }
+            },
+            batchApproveinfun(){
+                let that = this
+                this.$axios.post('/task-files/approveFile', this.approveinData)
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.$toast.clear();
+                        setTimeout(function() {
+                            that.$toast.success('审核成功');
+                        }, 300);
+                        this.approveinDialog = false
+                        this.getFileList();
+                    } else {
+                        this.$toast.clear();
+                        this.$toast.fail('批量操作失败:'+res.msg);
+                    }
+                }).catch(err=> {this.$toast.clear();});
+            },
+            // 返回
+            back() {
+                history.back();
+            },
+             // 时间转换
+            format(date, pattern) {
+                pattern = pattern || "yyyy-MM-dd";
+                var _this = this;
+                return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
+                    switch ($0.charAt(0)) {
+                        case 'y': return _this.padding(date.getFullYear(), $0.length);
+                        case 'M': return _this.padding(date.getMonth() + 1, $0.length);
+                        case 'd': return _this.padding(date.getDate(), $0.length);
+                        case 'w': return date.getDay() + 1;
+                        case 'h': return _this.padding(date.getHours(), $0.length);
+                        case 'm': return _this.padding(date.getMinutes(), $0.length);
+                        case 's': return _this.padding(date.getSeconds(), $0.length);
+                    }
+                });
+            },
+
+            padding(s, len) {
+                var len = len - (s + '').length;
+                for (var i = 0; i < len; i++) { s = '0' + s; }
+                return s;
+            },
+            // 获取日报
+            getFileList() {
+                const toast = this.$toast.loading({
+                    forbidClick: true,
+                    duration: 0
+                });
+                
+                this.$axios.post("/task-files/getUnChargedFilesByTaskId", {taskId: JSON.parse(sessionStorage.taskId)})
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.$toast.clear();
+                        this.fileList = res.data;
+                        // this.isAllChecked = this.report.length == 0 ? false : true
+                        if(this.fileList.length == 0){
+                            this.isAllChecked = false
+                        }
+                        for(let i in this.fileList){
+                            this.$set(this.fileList[i],'checked',false)
+                        }
+                    } else {
+                        this.$toast.clear();
+                        this.$toast.fail('获取失败:'+res.msg);
+                    }
+                }).catch(err=> {this.$toast.clear();});
+            },
+
+            approve(item) {
+                Dialog.confirm({
+                    message: `确认通过吗?`
+                })
+                .then(() => {
+                    var ids = item.id;
+                    this.isbatch = false
+                    this.approveinData = {
+                        taskFileIds: ids
+                    }
+                    const toast = this.$toast.loading({
+                        forbidClick: true,
+                        duration: 0
+                    });
+                    this.approveinfun()
+                })
+                .catch(() => {});
+            },
+            approveinfun(){
+                let that = this;
+                this.$axios.post("/task-files/approveFile", this.approveinData)
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.$toast.clear();
+                        setTimeout(function() {
+                            that.$toast.success('审核成功');
+                        }, 300);
+                        this.approveinDialog = false
+                        this.getFileList();
+                    } else {
+                        this.$toast.clear();
+                        setTimeout(function() {
+                            that.$toast.fail('审核失败');
+                        }, 300);
+                    }
+                }).catch(err=> {this.$toast.clear();});
+            },
+
+            showDenyDialog(item) {
+                this.denyReasonDialog = true;
+                this.isBatchDeny = false;
+                this.denyForm = {taskFileIds: item.id,reason:null};
+            },
+            showBatchDenyDialog() {
+                this.isBatchDeny = true;
+                let ids = ''
+                for(let i in this.fileList){
+                    if(this.fileList[i].checked){
+                        ids += this.fileList[i].id + ','
+                    }
+                }
+                if(ids.length > 0){
+                    ids = ids.substring(0, ids.length-1);
+                }
+                this.denyForm = {taskFileIds: ids, reason:null};
+                this.denyReasonDialog = true;
+            },
+
+            deny() {
+                const toast = this.$toast.loading({
+                    forbidClick: true,
+                    duration: 0
+                });
+                let that = this;
+                this.$axios.post('/task-files/rejectFile', this.denyForm).then(res => {
+                    if(res.code == "ok") {
+                        this.$toast.clear();
+                        setTimeout(function() {
+                            that.$toast.success('审核成功');
+                        }, 300);
+                        that.getFileList();
+                        that.denyReasonDialog = false;
+                    } else {
+                        that.$toast.clear();
+                        that.$toast.fail('操作失败:'+res.msg);
+                    }
+                }).catch(err=> {this.$toast.clear();});
+            }
+        },
+
+        mounted() {
+            this.getFileList();
+        }
+    };
+</script>
+
+<style lang="less" scoped>
+.dateSelectCell{
+    display: -webkit-box;
+}
+.userCheckbox {
+        padding: 10px;;
+    }
+    .userNameValue{
+        white-space: nowrap;
+        text-overflow: ellipsis;
+    }
+    .formBatch{
+        position: fixed;
+        bottom: 0;
+        width: 100%;
+        z-index: 2;
+        background-color: #fff;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        height: 1.2rem;
+        border-top: 1px solid #ebebeb;
+    }
+    .login_form {
+        margin-top: 46px;
+        margin-bottom: 65px;
+    }
+
+    .one_report {
+        margin-bottom: 15px;
+        font-size:14px;
+    }
+
+    .form_text {
+        margin: 10px 0 10px;
+        padding: 0 12px;
+    }
+    
+    .form_btn {
+        text-align: right;
+    }
+
+    .form_btn button {
+        margin-left: 10px;
+    }
+
+    .one_report_data {
+        margin-bottom: 10px;
+        padding: 0 22px;
+        div {
+            line-height: 30px;
+        }
+    }
+</style>
+<style lang="less">
+    .van-nav-bar .van-icon , .van-nav-bar__text {
+        color: #20a0ff;
+    }
+    // 显示加班样式
+    .one_span {
+        width: 40px;
+        height: 25px;
+        line-height: 25px;
+        text-align: center;
+        box-sizing: border-box;
+        display: inline-block;
+        border: 1px solid #fde2e2;
+        background: #fef0f0;
+        color: #f56c6c;
+        font-size: 12px;
+        border-radius: 5px;
+        // margin-left: 40px;
+        float: right;
+    }
+</style>

BIN
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/image/timesheet_qr.png