ggooalice 2 years ago
parent
commit
73832d6ac5

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/components/Footer.vue

@@ -14,7 +14,7 @@
         </li>
         <li class="item" v-if="cost">
             <router-link to="/cost" class="flex2 aic f20 text" active-class="active">
-                <van-icon class="text" name="bar-chart-o" />
+                <van-icon class="text" name="after-sale" />
                 <p class="mt-5 text f12">成本统计</p>
             </router-link>
         </li>

+ 24 - 13
fhKeeper/formulahousekeeper/timesheet_h5/src/views/cost/cost.vue

@@ -26,18 +26,18 @@
                 <van-cell v-for="item in timeCostList" :key="item.id" style="padding: 2px 4px;background-color: transparent;">
                     <div style="padding: 0.26667rem 0.42667rem;background-color: #fff;">
                         <van-row>
-                            <van-col span="6" style="text-align:center">项目名称</van-col>
+                            <van-col span="6" style="text-align:center;color:#969799">项目名称</van-col>
                             <van-col span="18">{{item.project}}</van-col>
                         </van-row>
                         <van-row>
-                            <van-col span="6" style="text-align:center">项目编号</van-col>
+                            <van-col span="6" style="text-align:center;color:#969799">项目编号</van-col>
                             <van-col span="18">{{item.projectCode}}</van-col>
                         </van-row>
-                        <van-row style="color:#969799">
-                            <van-col span="4" style="text-align:center">工时</van-col>
-                            <van-col span="6">{{item.cost}} h</van-col>
-                            <van-col span="4" style="text-align:center">成本:</van-col>
-                            <van-col span="10">¥ {{item.costMoney}}</van-col>
+                        <van-row>
+                            <van-col v-if="countHours" span="4" style="text-align:center;color:#969799">工时</van-col>
+                            <van-col v-if="countHours" span="5" style="text-align:right">{{item.cost.toFixed(1)}} h</van-col>
+                            <van-col v-if="countCost" span="5" style="text-align:right;color:#969799">成本</van-col>
+                            <van-col v-if="countCost" span="8" style="text-align:right">¥ {{item.costMoney.toFixed(2)}}</van-col>
                         </van-row>
                     </div>
                 </van-cell>
@@ -46,14 +46,14 @@
                 <van-cell v-for="item in timeCostList" :key="item.category" style="padding: 2px 4px;background-color: transparent;">
                     <div style="padding: 0.26667rem 0.42667rem;background-color: #fff;">
                         <van-row>
-                            <van-col span="6" style="text-align:center">分类名称</van-col>
+                            <van-col span="6" style="text-align:center;color:#969799">分类名称</van-col>
                             <van-col span="18">{{item.categoryName}}</van-col>
                         </van-row>
-                        <van-row style="color:#969799">
-                            <van-col span="4" style="text-align:center">工时</van-col>
-                            <van-col span="6">{{item.cost}} h</van-col>
-                            <van-col span="4" style="text-align:center">成本:</van-col>
-                            <van-col span="10">¥ {{item.costMoney}}</van-col>
+                        <van-row>
+                            <van-col v-if="countHours" span="4" style="text-align:center;color:#969799">工时</van-col>
+                            <van-col v-if="countHours" span="5" style="text-align:right">{{item.cost.toFixed(1)}} h</van-col>
+                            <van-col v-if="countCost" span="5" style="text-align:right;color:#969799">成本</van-col>
+                            <van-col v-if="countCost" span="8" style="text-align:right">¥ {{item.costMoney.toFixed(2)}}</van-col>
                         </van-row>
                     </div>
                 </van-cell>
@@ -73,6 +73,8 @@ export default {
     },
     data() {
         return {
+            countCost: false,
+            countHours: false,
             active: 0,
             listLoading: false,
             minDate: new Date(2020,0,1),
@@ -84,6 +86,15 @@ export default {
         }
     },
     mounted() {
+        let user = JSON.parse(localStorage.userInfo)
+        for(let i in user.functionList){
+            if(user.functionList[i].name == '查看工时统计'){
+                this.countHours = true
+            }
+            if(user.functionList[i].name == '查看成本统计'){
+                this.countCost = true
+            }
+        }
         let end = new Date()
         let start = new Date(end.getFullYear(),end.getMonth(),1)
         this.costDate = [this.formatDate(start),this.formatDate(end)]

+ 42 - 4
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/details.vue

@@ -46,6 +46,7 @@
                         createDateShow = false;
                         $forceUpdate();
                     "
+                    v-model="currentDate1"
                     :min-date="minDate"
                     :max-date="maxDate"
                 />
@@ -53,7 +54,7 @@
             <!-- 发票张数 -->
             <van-field label="发票张数" :readonly="!canEdit">
                 <template #input>
-                    <van-stepper v-model="editForm.ticketNum" :disabled="!canEdit" />
+                    <van-stepper v-model="editForm.ticketNum" :disabled="true" />
                 </template>
             </van-field>
             <!-- 费用类型 -->
@@ -96,7 +97,7 @@
                         name="delete-o"
                         class="deletebtn"
                         @click="deleteInvoice(index)"
-                        v-if="canEdit"
+                        v-if="canEdit && index != 0"
                     />
                     <van-field
                         label="所属项目:"
@@ -104,6 +105,7 @@
                         @click="(in_projectShow = true), (invoiceIndex = index)"
                         readonly
                         clickable
+                        required
                     >
                         <template #input>{{
                             formshowText.inProjectName[index]
@@ -115,6 +117,7 @@
                         @click="(in_dateShow = true), (invoiceIndex = index)"
                         readonly
                         clickable
+                        required
                     ></van-field>
                     <van-field
                         label="发票种类:"
@@ -122,6 +125,7 @@
                         @click="(in_typeShow = true), (invoiceIndex = index)"
                         readonly
                         clickable
+                        required
                     >
                         <template #input>{{
                             inTypeList[item.invoiceType]
@@ -133,6 +137,7 @@
                         @click="(in_exTypeShow = true), (invoiceIndex = index)"
                         readonly
                         clickable
+                        required
                     ></van-field>
                     <van-field
                         label="费用金额(含税):"
@@ -140,6 +145,7 @@
                         type="number"
                         @input="costCount"
                         :readonly="!canEdit"
+                        required
                     ></van-field>
                     <van-field
                         label="发票号:"
@@ -195,6 +201,7 @@
                     <van-datetime-picker
                         type="date"
                         title="选择费用日期"
+                        v-model="currentDate2"
                         @confirm="inDateChange"
                         @cancel="
                             in_dateShow = false;
@@ -254,6 +261,8 @@ export default {
             user: JSON.parse(localStorage.userInfo),
             canEdit: this.$route.params.canEdit,
             canExamine: false,
+            currentDate1 : new Date(),
+            currentDate2 : new Date(),
             minDate: new Date(2020,0,1),
             maxDate: new Date(2025,11,31),
             editForm: {
@@ -406,8 +415,37 @@ export default {
                 this.$toast.fail('请选择填报日期')
                 return
             }
-            if(this.invoiceList.length == 0){
-                this.$toast.fail('请添加发票')
+            console.log(this.invoiceList);
+            let required1 = false
+            let required2 = false
+            let required3 = false
+            let required4 = false
+            let required5 = false
+            for(let i in this.invoiceList){
+                if(!this.invoiceList[i].projectId){
+                    required1 = '所属项目'
+                }
+                if(!this.invoiceList[i].happenDate){
+                    required2 = '费用日期'
+                }
+                if(!this.invoiceList[i].invoiceType){
+                    required3 = '发票种类'
+                }
+                if(!this.invoiceList[i].expenseType){
+                    required4 = '费用类型'
+                }
+                if(!this.invoiceList[i].amount){
+                    required5 = '费用金额(含税)'
+                }
+            }
+            if(required1 || required2 || required3 || required4 || required5){
+                let requiredStr = (required1 ? required1 + '、' : '')
+                                + (required2 ? required2 + '、' : '')
+                                + (required3 ? required3 + '、' : '')
+                                + (required4 ? required4 + '、' : '')
+                                + (required5 ? required5 + '、' : '')
+                requiredStr = requiredStr.substring(0,requiredStr.length - 1)
+                this.$toast.fail('请添加发票的[' + requiredStr + ']')
                 return
             }
             delete this.editForm.invoiceList

+ 77 - 19
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/index.vue

@@ -37,6 +37,7 @@
                     type="date"
                     title="选择填报日期"
                     @confirm="createDateChange"
+                    v-model="currentDate1"
                     @cancel="createDateShow = false;$forceUpdate();"
                     :min-date="minDate"
                     :max-date="maxDate"/>
@@ -44,7 +45,7 @@
                 <!-- 发票张数 -->
                 <van-field label="发票张数">
                     <template #input>
-                        <van-stepper v-model="editForm.ticketNum"/>
+                        <van-stepper v-model="editForm.ticketNum" disable-input @plus="ticNumChange(1)" @minus="ticNumChange(0)"/>
                     </template>
                 </van-field>
                 <!-- 费用类型 -->
@@ -67,16 +68,16 @@
                 <div class="invoice" v-if="invoiceList.length != 0">
                     <div v-for="item,index in invoiceList" :key="item.id" style="position:relative" :class="index == 0 ? '' : 'invoice_item'">
                         <!-- <van-button class="deletebtn" size="mini" type="default" @click="deleteInvoice(index)">删除</van-button> -->
-                        <van-icon name="delete-o" class="deletebtn" @click="deleteInvoice(index)" />
-                        <van-field label="所属项目:" v-model="item.projectId" @click="in_projectShow = true,invoiceIndex = index" readonly clickable>
+                        <van-icon name="delete-o" class="deletebtn" v-if="index != 0" @click="deleteInvoice(index)" />
+                        <van-field label="所属项目:" v-model="item.projectId" @click="in_projectShow = true,invoiceIndex = index" readonly clickable required>
                             <template #input>{{formshowText.inProjectName[index]}}</template>
                         </van-field>
-                        <van-field label="费用日期:" v-model="item.happenDate" @click="in_dateShow = true,invoiceIndex = index" readonly clickable></van-field>
-                        <van-field label="发票种类:" v-model="item.invoiceType" @click="in_typeShow = true,invoiceIndex = index" readonly clickable>
+                        <van-field label="费用日期:" v-model="item.happenDate" @click="in_dateShow = true,invoiceIndex = index" readonly clickable required></van-field>
+                        <van-field label="发票种类:" v-model="item.invoiceType" @click="in_typeShow = true,invoiceIndex = index" readonly clickable required>
                             <template #input>{{inTypeList[item.invoiceType]}}</template>
                         </van-field>
-                        <van-field label="费用类型:" v-model="item.expenseType" @click="in_exTypeShow = true,invoiceIndex = index" readonly clickable></van-field>
-                        <van-field label="费用金额(含税):" v-model="item.amount" type="number" @input="costCount"></van-field>
+                        <van-field label="费用类型:" v-model="item.expenseType" @click="in_exTypeShow = true,invoiceIndex = index" readonly clickable required></van-field>
+                        <van-field label="费用金额(含税):" v-model="item.amount" type="number" @input="costCount" required></van-field>
                         <van-field label="发票号:" v-model="item.invoiceNo"></van-field>
                         <van-field label="税率%:" v-model="item.taxPercent"></van-field>
                         <van-field label="税额:" readonly>
@@ -108,6 +109,7 @@
                         type="date"
                         title="选择费用日期"
                         @confirm="inDateChange"
+                        v-model="currentDate2"
                         @cancel="in_dateShow = false;$forceUpdate();"
                         :min-date="minDate"
                         :max-date="maxDate"/>
@@ -234,6 +236,8 @@ export default {
             user: JSON.parse(localStorage.userInfo),
             userList: [],
             canExamine: false,
+            currentDate1: new Date(),
+            currentDate2: new Date(),
             minDate: new Date(2020,0,1),
             maxDate: new Date(2025,11,31),
 
@@ -258,18 +262,18 @@ export default {
             invoiceIndex: 0,
             totalCost: 0,
             invoiceList: [
-                // {
-                //     projectId: '',
-                //     happenDate: '',
-                //     invoiceType: '',
-                //     expenseType: '',
-                //     amount: '',
-                //     invoiceNo: '',
-                //     taxPercent: '',
-                //     taxValue: '',
-                //     remark: '',
-                //     pic: ''
-                // }
+                {
+                    projectId: '',
+                    happenDate: '',
+                    invoiceType: '',
+                    expenseType: '',
+                    amount: '',
+                    invoiceNo: '',
+                    taxPercent: '',
+                    taxValue: '',
+                    remark: '',
+                    pic: '',
+                }
             ],
             in_projectShow: false,
             in_dateShow: false,
@@ -380,6 +384,26 @@ export default {
             this.typeShow = false
             this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
         },
+        ticNumChange(value){
+            
+            if(value){
+                this.invoiceList.push({
+                    projectId: '',
+                    happenDate: '',
+                    invoiceType: '',
+                    expenseType: '',
+                    amount: '',
+                    invoiceNo: '',
+                    taxPercent: '',
+                    taxValue: '',
+                    remark: '',
+                    pic: '',
+                })
+            }else{
+                this.invoiceList.pop()
+            }
+            console.log(value,this.invoiceList);
+        },
 
         // 发票
         inProjectChange(value,key){
@@ -414,10 +438,12 @@ export default {
                 pic: '',
             })
             this.uploader.push([])
+            this.editForm.ticketNum = this.invoiceList.length
         },
         deleteInvoice(index){
             this.invoiceList.splice(index,1)
             this.uploader.splice(index,1)
+            this.editForm.ticketNum = this.invoiceList.length
         },
 
         // 上传报销凭证
@@ -453,6 +479,38 @@ export default {
                 this.$toast.fail('请选择填报日期')
                 return
             }
+            let required1 = false
+            let required2 = false
+            let required3 = false
+            let required4 = false
+            let required5 = false
+            for(let i in this.invoiceList){
+                if(!this.invoiceList[i].projectId){
+                    required1 = '所属项目'
+                }
+                if(!this.invoiceList[i].happenDate){
+                    required2 = '费用日期'
+                }
+                if(!this.invoiceList[i].invoiceType){
+                    required3 = '发票种类'
+                }
+                if(!this.invoiceList[i].expenseType){
+                    required4 = '费用类型'
+                }
+                if(!this.invoiceList[i].amount){
+                    required5 = '费用金额(含税)'
+                }
+            }
+            if(required1 || required2 || required3 || required4 || required5){
+                let requiredStr = (required1 ? required1 + '、' : '')
+                                + (required2 ? required2 + '、' : '')
+                                + (required3 ? required3 + '、' : '')
+                                + (required4 ? required4 + '、' : '')
+                                + (required5 ? required5 + '、' : '')
+                requiredStr = requiredStr.substring(0,requiredStr.length - 1)
+                this.$toast.fail('请添加发票的[' + requiredStr + ']')
+                return
+            }
             if(this.invoiceList.length == 0){
                 this.$toast.fail('请添加发票')
                 return

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -105,7 +105,7 @@
                         this.routers.push({name: '项目管理',url: '/project',icon: 'label-o'})
                     }
                     if(list[i].name == '导入日报审核') {
-                        this.routers.push({name: '导入日报审核',url: '/audit',icon: 'label-o'})
+                        this.routers.push({name: '导入日报审核',url: '/audit',icon: 'completed'})
                     }
                     if(list[i].name == '费用报销') {
                         this.routers.push({

+ 17 - 4
fhKeeper/formulahousekeeper/timesheet_h5/src/views/task/editask.vue

@@ -22,10 +22,11 @@
                     <van-datetime-picker
                     type="date"
                     title="选择开始时间"
+                    v-model="currentDate1"
                     @confirm="startDateChange"
                     @cancel="startDateShow = false;$forceUpdate();"
                     :min-date="minDate"
-                    :max-date="taskform.endDate ? new Date(taskform.endDate) : maxDate"/>
+                    :max-date="maxDate"/>
                 </van-popup>
                 <!-- 截止时间 -->
                 <van-field v-model="taskform.endDate" label="截止时间" placeholder="请选择截止时间" @click="endDateShow = true" readonly clickable></van-field>
@@ -33,9 +34,10 @@
                     <van-datetime-picker
                     type="date"
                     title="选择截止时间"
+                    v-model="currentDate2"
                     @confirm="endDateChange"
                     @cancel="endDateShow = false;$forceUpdate();"
-                    :min-date="taskform.startDate ? new Date(taskform.startDate) : minDate"
+                    :min-date="minDate"
                     :max-date="maxDate"/>
                 </van-popup>
                 <!-- 完成时间 -->
@@ -44,6 +46,7 @@
                     <van-datetime-picker
                     type="date"
                     title="选择完成时间"
+                    v-model="currentDate3"
                     @confirm="finishDateChange"
                     @cancel="finishDateShow = false;$forceUpdate();"
                     :min-date="minDate"
@@ -71,7 +74,6 @@
                     <div style="minHeight:300px;">
                         <van-radio-group v-model="executor.item">
                             <van-radio v-for="uitem in executor.searchList" :key="uitem.id" :name="uitem" style="padding:10px">
-                                <span>{{uitem.name}}</span>
                                 <span v-if="user.userNameNeedTranslate != 1">{{uitem.name}}</span>
                                 <span v-else><ww-open-data type='userName' :openid='uitem.name'></ww-open-data></span>
                             </van-radio>
@@ -114,6 +116,9 @@ export default {
             title: '编辑任务',
             user: JSON.parse(localStorage.userInfo),
             taskId: JSON.parse(sessionStorage.taskId),
+            currentDate1: new Date(),
+            currentDate2: new Date(),
+            currentDate3: new Date(),
             minDate: new Date(2020,0,1),
             maxDate: new Date(2025,11,31),
             canEdit: true,
@@ -285,7 +290,15 @@ export default {
                     this.taskform.createDate = null;
                     this.taskform.indate = null;
                     let projectManagement = false
-
+                    if(this.taskform.startDate){
+                        this.currentDate1 = new Date(this.taskform.startDate)
+                    }
+                    if(this.taskform.endDate){
+                        this.currentDate2 = new Date(this.taskform.endDate)
+                    }
+                    if(this.taskform.finishDate){
+                        this.currentDate3 = new Date(this.taskform.finishDate)
+                    }
                     // 判断编辑权限
                     for(let i in this.user.functionList){
                         if(this.user.functionList[i].name == '查看全部项目'){