ggooalice 2 年之前
父節點
當前提交
a717f8d861

+ 6 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/details.vue

@@ -245,6 +245,7 @@
                     block
                     type="info"
                     @click="submitExpense"
+                    :loading="confirmLoading"
                     style="width: 100%; float: left"
                     >提交</van-button
                 >
@@ -272,6 +273,7 @@ export default {
                 remark: ''
             },
             invoiceList: [],
+            confirmLoading: false,
 
             formshowText: {
                 name: '',
@@ -449,15 +451,18 @@ export default {
             delete this.editForm.invoiceList
             this.editForm.items = JSON.stringify(this.invoiceList)
             this.editForm.totalAmount = this.totalCost
+            this.confirmLoading = true
             this.$axios.post("/expense-sheet/add", this.editForm)
             .then(res => {
                 if(res.code == "ok") {
                     this.$toast.success('提交成功')
+                    this.confirmLoading = false
                     this.back()
                 } else {
+                    this.confirmLoading = false
                     this.$toast.fail('获取失败');
                 }
-            }).catch(err=> {this.$toast.clear();console.log(err)});
+            }).catch(err=> {this.confirmLoading = false;this.$toast.clear();console.log(err)});
         },
 
 

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

@@ -63,7 +63,7 @@
                 <van-field v-model="editForm.remark" label="备注" type="textarea"></van-field>
                 <!-- 发票 -->
                 <van-field label="发票" readonly>
-                    <template #input>总费用: ¥{{totalCost | numtosum}}</template>
+                    <template #input>总费用: ¥{{totalCost}}</template>
                 </van-field>
                 <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'">
@@ -77,7 +77,7 @@
                             <template #input>{{inTypeList[item.invoiceType]}}</template>
                         </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.amount" type="number" 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>
@@ -136,7 +136,7 @@
             <!-- 提交 -->
             <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
                 <div style="padding-bottom:10px;">
-                    <van-button square block type="info" @click="submitExpense" style="width:100%;float:left;">提交</van-button>
+                    <van-button square block type="info" @click="submitExpense" :loading="confirmLoading" style="width:100%;float:left;">提交</van-button>
                 </div>
             </div>
             
@@ -193,7 +193,7 @@
                         <div class="collapse_label_l">金额: ¥{{item.totalAmount | numtosum}}</div>
                         <div class="collapse_label_r">状态:<span :class="statusClass[item.status]">{{statusList[item.status]}}</span></div>
                         <div class="operation">
-                            <van-button size="small" type="info" @click.stop="approve(item.id)">通过</van-button>
+                            <van-button size="small" type="info" :loading="item.approveLoading" @click.stop="approve(item)">通过</van-button>
                             <van-button style="margin-left:15px" size="small" type="danger" @click.stop="denyToReason(item.id)">驳回</van-button>
                         </div>
                     </template>
@@ -221,7 +221,7 @@
                 <van-field class="form_input"
                     v-model="denyParm.denyReason" name="reason" type="textarea" placeholder="请输入您决定驳回的原因"
                     rows="3" autosize  />
-                <van-button style="width:100%;" type="info" @click="deny()">提交</van-button>
+                <van-button style="width:100%;" type="info" :loading="denyLoading" @click="deny()">提交</van-button>
             </van-popup>
         </div>
     </div>
@@ -240,6 +240,8 @@ export default {
             currentDate2: new Date(),
             minDate: new Date(2020,0,1),
             maxDate: new Date(2025,11,31),
+            confirmLoading: false,
+            denyLoading: false,
 
             formshowText: {
                 name: '',
@@ -260,7 +262,6 @@ export default {
             typeList: ['一般','差旅','外包'],
 
             invoiceIndex: 0,
-            totalCost: 0,
             invoiceList: [
                 {
                     projectId: '',
@@ -306,6 +307,15 @@ export default {
 
         }
     },
+    computed: {
+        totalCost(){
+            let costnum = 0
+            for(let i in this.invoiceList){
+                costnum += (this.invoiceList[i].amount ? parseFloat(this.invoiceList[i].amount) : 0)
+            }
+            return costnum.toFixed(2)
+        }
+    },
     filters: {
         numtosum(value) {
             if (value == undefined || !value) return '0.00'
@@ -361,13 +371,6 @@ export default {
                 this.getExamineList()
             }
         },
-        costCount(){
-            let costnum = 0
-            for(let i in this.invoiceList){
-                costnum += this.invoiceList[i].amount*1
-            }
-            this.totalCost = costnum
-        },
 
     // #region 费用报销
         ownerIdChange(){
@@ -519,6 +522,7 @@ export default {
             this.editForm.items = JSON.stringify(this.invoiceList)
             this.editForm.totalAmount = this.totalCost
             // 获取新的票据编号
+            this.confirmLoading = true
             this.$axios.post("/expense-sheet/getNextCode", {})
             .then(res => {
                 if(res.code == "ok") {
@@ -526,6 +530,7 @@ export default {
                     // 提交
                     this.$axios.post("/expense-sheet/add", this.editForm)
                     .then(res => {
+                        this.confirmLoading = false
                         if(res.code == "ok") {
                             this.$toast.success('填报成功')
                             this.editForm = {
@@ -541,17 +546,20 @@ export default {
                             // }
                             this.formshowText.name = ''
                             this.formshowText.inProjectName = []
-                            this.totalCost = 0
                             this.invoiceList = []
                             this.uploader = []
                         } else {
                             this.$toast.fail('获取失败');
                         }
-                    }).catch(err=> {this.$toast.clear();console.log(err)});
+                    }).catch(err=> {this.confirmLoading = false;this.$toast.clear();console.log(err)});
                 } else {
+                    this.confirmLoading = false
                     this.$toast.fail('获取失败');
                 }
-            }).catch(err=> {this.$toast.clear();console.log(err)});
+            }).catch(err=> {
+                this.confirmLoading = false;
+            this.$toast.clear();
+            console.log(err)});
 
             
         },
@@ -581,11 +589,13 @@ export default {
         },
 
         // 单据审核
-        approve(pid){
-            this.$axios.post("/expense-sheet/approve", {id: pid})
+        approve(item){
+            item.approveLoading = true
+            this.$axios.post("/expense-sheet/approve", {id: item.id})
             .then(res => {
                 if(res.code == "ok") {
                     this.$toast.success('已通过')
+                    item.approveLoading = false
                     this.getExamineList()
                 } else {
                     this.$toast.fail('获取失败');
@@ -597,10 +607,13 @@ export default {
             this.denyReasonDialog = true
         },
         deny(){
+            this.denyLoading = true
             this.$axios.post("/expense-sheet/deny", this.denyParm)
             .then(res => {
                 if(res.code == "ok") {
                     this.$toast.success('已驳回')
+                    this.denyReasonDialog = false
+                    this.denyLoading = false
                     this.getExamineList()
                 } else {
                     this.$toast.fail('获取失败');
@@ -659,7 +672,7 @@ export default {
 
         getExamineList(){
             this.$axios.post("/expense-sheet/list", {
-                pageSize: 20,
+                pageSize: 999,
                 pageIndex: 1,
                 startDate: '',
                 endDate: '',
@@ -669,6 +682,9 @@ export default {
             }).then(res => {
                 if(res.code == "ok") {
                     this.examineList = res.data.records
+                    for(let i in this.examineList){
+                        this.$set(this.examineList[i],'approveLoading',false)
+                    }
                 } else {
                     this.$toast.fail('获取失败');
                 }
@@ -784,6 +800,9 @@ export default {
                 display: flex;
                 align-items: center;
                 justify-content: flex-end;
+                button{
+                    width: 1.2rem;
+                }
             }
             .wrapper{
                 div{

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

@@ -67,7 +67,7 @@
                             <van-stepper v-model="item.planHours" :disabled="!canEdit"/><span>{{'\u3000h'}}</span>
                         </template>
                     </van-field>
-                    <van-icon v-if="index != 0" class="delete_executor" name="delete-o" @click.stop="deleteExecutor(index)" />
+                    <van-icon v-if="index != 0 && canEdit" class="delete_executor" name="delete-o" @click.stop="deleteExecutor(index)" />
                 </div>
                 <van-popup v-model="executor.show" position="bottom" v-if="canEdit">
                     <van-search v-model="executor.searchText" placeholder="输入员工姓名搜索" @search="onSearch" v-if="user.userNameNeedTranslate != '1'"></van-search>