瀏覽代碼

解决单据总成本累加问题

Lljy-ai 4 年之前
父節點
當前提交
2d79144e07

+ 18 - 0
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -129,6 +129,24 @@ router.afterEach(() => {
     },0);
 })
 
+// 定义的方法,对文本框使用,只能输入数组, // 加 v-enter-number
+Vue.directive('enterNumber', {
+    inserted: function (el) {
+      el.addEventListener("keypress",function(e){
+        e = e || window.event;
+        let charcode = typeof e.charCode === 'number' ? e.charCode : e.keyCode;
+        let re = /\d/;
+        if(!re.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey){
+          if(e.preventDefault){
+            e.preventDefault();
+          }else{
+            e.returnValue = false;
+          }
+        }
+      });
+    }
+  });
+
 new Vue({
     router,
     store,

+ 60 - 31
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -46,15 +46,17 @@
       </div>
     <!-- 内容主体区域 -->
   <div class="contents">
+    <div v-if="!displayTable" class="headine" ref="headine">
+      <h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3>
+      <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits" size="mini">提交</el-button></p>
+    </div>
     <!-- 上面部分 -->
-    <div ref="staff" style="margin: 20px 20px 0 220px; width: 69%" >
+    <div ref="staff" style="margin: 20px 20px 0 220px; width: 81.5%" >
       <div class="staff" v-if="!displayTable">
         <!-- 公共 -->
         <div class="public">
           <el-form :model="addForm" label-width="80px">
             <!-- <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> -->
-              <h3 style="margin: 0;padding: 25px 0 0 25px;color: #20A0FF;display: block">{{shuz[ins]}}</h3>
-              <span class="pu_bu_t" @click="submits"> <i class="el-icon-circle-check"></i> 提交</span>
             <!-- 填报人 -->
             <el-form-item label="填报人">
               <el-select v-model="addForm.ownerId" placeholder="请选择填报人" style="width: 150px">
@@ -129,7 +131,7 @@
             </el-table-column>
             <el-table-column label="费用金额" width="135px">
               <template slot-scope="scope">
-                <el-input v-model.number="scope.row.amount" @blur="shiqu(scope.row.amount)"></el-input>
+                <el-input v-enter-number v-model.number="scope.row.amount" @change="shiqu(scope.row.amount)"></el-input>
               </template>
             </el-table-column>
             <el-table-column prop="invoiceNo" label="发票号" width="135px">
@@ -139,12 +141,12 @@
             </el-table-column>
             <el-table-column label="税率%" width="135px">
               <template slot-scope="scope">
-                <el-input v-model.number="scope.row.taxPercent"></el-input>
+                <el-input v-enter-number v-model.number="scope.row.taxPercent"></el-input>
               </template>
             </el-table-column>
             <el-table-column label="税额" width="135px">
               <template slot-scope="scope">
-                <el-input v-model.number="scope.row.taxValue"></el-input>
+                <el-input v-enter-number v-model.number="scope.row.taxValue"></el-input>
               </template>
             </el-table-column>
             <el-table-column label="备注" width="135px">
@@ -247,7 +249,7 @@
               <el-input v-model="ParticularsList.createDate" :disabled="flg"></el-input>
             </el-form-item>
             <el-form-item label="发票张数">
-              <el-input v-model="ParticularsList.ticketNum" :disabled="flg"></el-input>
+              <el-input v-enter-number v-model="ParticularsList.ticketNum" :disabled="flg"></el-input>
             </el-form-item>
             <el-form-item label="费用类型">
                 <el-select v-model="ParticularsList.type" placeholder="请选择" :disabled="flg">
@@ -259,13 +261,7 @@
             <el-form-item label="备注">
               <el-input v-model="ParticularsList.remark" :disabled="flg"></el-input>
             </el-form-item>
-            <!-- <el-form-item label="总成本">
-              <el-input v-model="ParticularsList.totalAmount" :disabled="flg"></el-input>
-            </el-form-item> -->
-            <el-form-item label="总成本" v-if="!flg">
-              <el-input v-model="ParticularsList.totalAmount" style="width: 165px"></el-input>&nbsp;&nbsp;元
-            </el-form-item>
-            <el-form-item label="总成本" v-else>
+            <el-form-item label="总成本">
               ¥{{ParticularsList.totalAmount | numberToCurrency}}&nbsp;&nbsp;元
             </el-form-item>
 
@@ -275,9 +271,9 @@
               </template> -->
           </el-form>
           <el-table :data="ParticularsList.invoiceList" border style="width: 100%">
-            <el-table-column prop="projectId" label="项目" width="130">
+            <el-table-column prop="projectId" label="项目" width="155">
                 <template slot-scope="scope">
-                  <el-select v-if="!flg" v-model="scope.row.projectId" placeholder="项目" style="width: 150px">
+                  <el-select v-if="!flg" v-model="scope.row.projectId" placeholder="项目" style="width: 130px">
                     <el-option v-for="(item, index) in projectList" :key="index" :label="item.projectName" :value="item.id" @click="ok(item)"></el-option>
                   </el-select>
                   <span v-else>{{projectIdName[scope.$index].projectName}}</span>
@@ -299,31 +295,31 @@
                 <span v-else>{{typeInvoic[scope.row.invoiceType]}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="amount" label="费用金额">
+            <el-table-column prop="amount" label="费用金额" width="172">
               <template slot-scope="scope">
-                <el-input v-if="!flg" v-model.number="scope.row.amount"></el-input>
+                <el-input v-enter-number v-if="!flg" v-model.number="scope.row.amount" @change="kan"></el-input>
                 <span v-else>{{scope.row.amount}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="invoiceNo" label="发票号">
+            <el-table-column prop="invoiceNo" label="发票号" width="172">
               <template slot-scope="scope">
                 <el-input v-if="!flg" v-model.number="scope.row.invoiceNo"></el-input>
                 <span v-else>{{scope.row.invoiceNo}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="taxPercent" label="税率%">
+            <el-table-column prop="taxPercent" label="税率%" width="172">
               <template slot-scope="scope">
-                <el-input v-if="!flg" v-model.number="scope.row.taxPercent"></el-input>
+                <el-input v-enter-number v-if="!flg" v-model.number="scope.row.taxPercent"></el-input>
                 <span v-else>{{scope.row.taxPercent}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="taxValue" label="税额">
+            <el-table-column prop="taxValue" label="税额" width="172">
               <template slot-scope="scope">
-                <el-input v-if="!flg" v-model.number="scope.row.taxValue"></el-input>
+                <el-input v-enter-number v-if="!flg" v-model.number="scope.row.taxValue"></el-input>
                 <span v-else>{{scope.row.taxValue}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="remark" label="备注">
+            <el-table-column prop="remark" label="备注" width="300">
               <template slot-scope="scope">
                 <el-input v-if="!flg" v-model.number="scope.row.remark"></el-input>
                 <span v-else>{{scope.row.remark}}</span>
@@ -724,32 +720,65 @@ export default {
         this.$refs.staff.style.margin = '20px 20px 0 20px'
         this.$refs.staff.style.width = '95%'
         this.$refs.xiaomian.style.width = '100%'
+        this.$refs.headHe.style.paddingLeft = '20px'
+        // this.$refs.headSpan.style.marginLeft = '81.7%'
       } else {
         this.$refs.sidebars.style.display = 'block'
         this.$refs.sid.style.left = '430px'
         this.$refs.side.style.left = '-19px'
         this.$refs.sideI.className = 'el-icon-arrow-left'
         this.$refs.staff.style.margin = '20px 20px 0 220px'
-        this.$refs.staff.style.width = '69%'
+        this.$refs.staff.style.width = '81%'
         this.$refs.xiaomian.style.width = '85%'
+        this.$refs.headHe.style.paddingLeft = '220px'
+        // this.$refs.headSpan.style.marginLeft = '58%'
       }
     },
     // 费用金额失去焦点时触发
-    shiqu(val){
-      console.log(this.addForm);
-      if(val == null || val == undefined) val = 0
-      this.addForm.totalAmount = this.addForm.totalAmount += val
-      console.log(this.addForm.totalAmount);
+    shiqu(){
+      this.addForm.totalAmount = this.invoiceList.reduce((prev, next) => {
+        return prev + next.amount;
+      }, 0)
+      console.log(k);
+    },
+    kan(){
+      console.log(123); // amount
+      console.log(this.ParticularsList.invoiceList);
+      console.log(this.ParticularsList.totalAmount);
+      this.ParticularsList.totalAmount = this.ParticularsList.invoiceList.reduce((prev, next) => {
+        return prev + next.amount
+      }, 0)
+      console.log(this.ParticularsList.totalAmount);
     }
   },
 };
 </script>
 <style scoped>
+/* 费用报销标题 */
+.headine {
+  width: 100%;
+  height: 70px;
+  line-height: 70px;
+  background: #fff;
+  box-sizing: border-box;
+}
+.headine h3 {
+  margin: 0;
+  display: inline-block;
+  box-sizing: border-box;
+  color: #20A0FF;
+}
+.headine p {
+  display: inline-block;
+  margin: 0;
+}
+/* /费用报销标题 */
 .sidebars {
   height: 100%;
   position: absolute;
   border-right: 1px solid #E6E6E6;
   z-index: 2;
+  top: 0;
 }
 .sidebars h2 {
   margin: 0;
@@ -880,7 +909,7 @@ export default {
   height: 100%;
   /* padding: 30px; */
   background: #F7F7F7;
-  position: absolute;
+  /* position: absolute; */
 }
 
 .submits {

+ 37 - 65
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -316,6 +316,29 @@
                     </div>
 
                     <!-- 任务进展列表 -->
+                    <!-- <div class="ddl" v-if="ProgressList.length > 0">
+                        <div class="elCard" v-for="item in ProgressList" :key="item.id" style="margin-bottom: 10px; height:" >
+                            <i class="el-icon-success" style="color: #43d14f;" v-if="item.status == 0"></i>
+                            <i class="el-icon-success" style="color: #fd7624;" v-else-if="item.status == 1"></i>
+                            <i class="el-icon-success" style="color: #fd4d47;" v-else></i>
+                            <span v-if="item.status == 0">状态正常</span>
+                            <span v-else-if="item.status == 1">状态正常</span>
+                            <span v-else>进展预期</span>
+
+                            <el-dropdown trigger="click" style="float:right;cursor:pointer; float: right;">
+                                    <i class="el-icon-more" ></i>
+                                    <el-dropdown-menu slot="dropdown">
+
+                                        <el-dropdown-item divided>
+                                            <span @click="deleteTaskProgress(item.id)"><i class="el-icon-delete"></i>删除列表</span></el-dropdown-item>
+                                    </el-dropdown-menu>
+                            </el-dropdown>
+                            <div class="elCard_qu">屈经理更新于{{item.indate | relativeTime}}</div>
+                            <p style="padding-left: 20px;">{{item.content}}</p>
+                            <div class="examine"><el-button type="text" @click="innerVisibless = true" style="color: #8F87A3;">查看历史记录</el-button></div>
+                        </div>
+                    </div> -->
+
                     <div class="ddl" v-if="ProgressList.length > 0">
                         <div class="elCard" v-for="item in ProgressList" :key="item.id" style="margin-bottom: 10px; height:" >
                             <i class="el-icon-success" style="color: #43d14f;" v-if="item.status == 0"></i>
@@ -469,11 +492,11 @@
                         <!-- <el-input type="textarea" class="textareays" label-width="100%" label-height="140px"></el-input> -->
                         <div class="issue_fixation">
                             <div class="inputDeep"><el-input
-                            class="issue-input"
                             type="textarea"
                             placeholder="请输入内容"
                             :autosize="{ minRows: 6, maxRows: 6}"
                             v-model.trim="textarea2"
+                            class="inputDeeps"
                             >
                             </el-input></div>
                             <el-button class="issue-button" type="primary" @click="release()">发布</el-button>
@@ -830,7 +853,6 @@
             },
             //删除任务进展
             deleteTaskProgress(id) {
-                console.log(id, '删除传过来的数据');
                 this.http.post('/task-progress/deleteProgress', {id: id},
                     res => {
                         if (res.code == "ok") {
@@ -850,16 +872,12 @@
             },
             //创建任务进展
             addTaskProgress() {
-                console.log(this.taskIid, 'idididi');
-                // var param = {taskId:0,status:0,content:'输入进展内容',participatorIds:'1,2,3,4,5'};
-                // console.log(this.checkLists.toString(), '看看打印的是什么');
                 var param = {
                     taskId: this.taskIid,
                     status: this.radio,
                     content: this.text2,
                     participatorIds: this.checkLists.toString()
                 };
-                console.log(param, '发布过去的数据');
                 this.http.post('/task-progress/addProgress', param,
                     res => {
                         if (res.code == "ok") {
@@ -884,15 +902,12 @@
             },
             //获取任务进展列表
             getTaskProgressList(taskId) {
-                console.log(taskId);
                 this.taskIid = taskId
                 this.http.post('/task-progress/list', {taskId: taskId},
                     res => {
                         if (res.code == "ok") {
                             this.ProgressList = res.data;
                             this.progres = res.data[0]
-                            console.log(this.addForm, '获取到的表单信息');
-                            console.log(this.ProgressList, '获取过来的任务进展列表数据');
                         } else {
                             this.$message({
                                 message: res.msg,
@@ -909,8 +924,6 @@
                 } else {
                     this.checkLists.splice(k, 1)
                 }
-                // this.checkLists.push(el.id)
-                // console.log(this.checkLists);
             },
             showExportDialog() {
                 this.exportDialog = true;
@@ -963,9 +976,7 @@
             // 获得焦点时触发
             onEditorBlur(){
                 let theEle = this.$refs.text; // 获取元素
-                console.log(theEle.value); // 获取到富文本内容
                 var img = theEle.value.match(/<img[^>]+>/g); // 赛选 img 标签
-                console.log(img);
                 var arrImg = ''
                 for (var j = 0; j < img.length; j++) {
                     // 正则匹配,摘出img标签下的src里的内容,即capture
@@ -977,7 +988,6 @@
                 var strLen = arrImg.length;
                 // 计算后得到的文件流大小,单位为字节
                 var fileSize=parseInt(strLen-(strLen/8)*2);
-                console.log(fileSize,"字节");
                 var size = "";
 	            size = (fileSize/1024/1024).toFixed(2);
                 if (size > 2){
@@ -1210,7 +1220,6 @@
                 res => {
                     if (res.code == "ok") {
                         this.taskDataList = res.data;
-                        console.log(this.taskDataList, '视图任务列表');
                         this.taskDataList.forEach(t=>{
                             t.isFinish = t.taskStatus==1?true:false;
                         });
@@ -1312,14 +1321,12 @@
             },
             // 点击卡片事件
             editTask(task) {
-                console.log(task);
-                // this.addForm = JSON.parse(JSON.stringify(task));
                 this.addFormVisible = true;
                 this.addLoading = false;
                 this.title = "编辑任务";
                 this.getTaskDetail(task.id);
                 this.getTaskProgressList(task.id); // 获取任务进展列表 
-                this.users(); // 获取名单数据
+                this.getUsers(); // 获取名单数据
                 this.gain(task); // 获取评论列表
             },  
             // 获取评论列表
@@ -1356,7 +1363,6 @@
             // 点击发布
             release() {
                 if(this.textarea2.length <= 0) return this.$message({message: "请输入内容", type: "error"})
-                // console.log(this.taskId);
                 this.http.post('/task-comment/add', {taskId: this.taskId, userId: this.user.id, content: this.textarea2},
                 res => {
                     if(res.code == "ok"){
@@ -1380,7 +1386,6 @@
             },
             // 滚动到底部
             contRoll(){
-                // console.log("滚动到底部");
                 this.$nextTick(() => {
                     this.$refs.main.scrollTop = this.$refs.contRoll.scrollHeight;
                 })
@@ -1390,7 +1395,6 @@
                 res => {
                     if (res.code == "ok") {
                         this.addForm = res.data;
-                        console.log(this.addForm, 'getTaskDetail');
                         this.addForm.createDate = null;
                         this.addForm.indate = null;
                         this.addLoading = false;
@@ -1498,7 +1502,6 @@
                 this.stageForm = {groupId: this.selectedGroup.id, projectId: this.curProjectId};
             },
             viewChange(index, indexPath) {
-                console.log(index);
                 this.groupType = 1;
                 this.order = "create_date";
                 this.isDesc = true;
@@ -1507,7 +1510,6 @@
                 this.displayTable = true;
             } ,
             groupChange(index, indexPath) {
-                console.log(index);
                 this.groupType = 0;
                 this.order = "seq";
                 this.isDesc = false;
@@ -1603,31 +1605,6 @@
                 });
             },
 
-            // addGroup() {
-            //     this.http.post('/task-group/save',this.groupForm,
-            //     res => {
-            //         if (res.code == "ok") {
-            //             this.groupList = res.data;
-            //             this.addGroupDialog = false;
-            //             this.modGroupDialog = false;
-            //             if (this.selectedGroup.id == this.groupForm.id) {
-            //                 this.selectedGroup = this.groupForm;
-            //             }
-            //         } else {
-            //             this.$message({
-            //             message: res.msg,
-            //             type: "error"
-            //             });
-            //         }
-            //     },
-            //     error => {
-            //         this.$message({
-            //             message: error,
-            //             type: "error"
-            //         });
-            //     });
-            // },
-
             // 重新定义了 addGroup 方法
              addGroup() {
                 this.http.post('/task-group/save',this.groupForm,
@@ -1636,7 +1613,6 @@
                         this.groupList = res.data;
                         this.addGroupDialog = false;
                         this.modGroupDialog = false;
-                        console.log(this.selectedGroup.id);
                         if (this.selectedGroup.id !== this.groupForm.id) {
                             this.selectedGroup = this.groupForm;
                         }
@@ -1702,8 +1678,6 @@
                 this.http.post('/task-group/list',{projectId: this.curProjectId},
                 res => {
                     if (res.code == "ok") {
-                        console.log(res);
-                        console.log(res.data.length)
                         this.allGroupData = res.data;
                         this.groupList = res.data;
                         if (this.groupList.length > 0) {
@@ -1736,7 +1710,6 @@
                 let path = this.$route.path;
                 path = path.substring(0,path.lastIndexOf('/'))+'/'+this.curProjectId;
                 this.$router.push(path);
-                console.log('this.activeName=='+this.activeName);
                 this.getTaskGroups();
                 this.$refs.fileCenter.refreshPage();
                 this.$refs.projectInfo.refreshPage();
@@ -1807,7 +1780,6 @@
                 res => {
                     if (res.code == "ok") {
                         this.users = res.data.records;
-                        console.log(this.users, '得到的数据');
                     } else {
                         this.$message({
                         message: res.msg,
@@ -1981,7 +1953,6 @@
             window.onresize = function temp() {
                 that.tableHeight = window.innerHeight - 135;
                 that.stageListHeight = that.tableHeight - 45;
-                console.log('stageList height=='+that.stageListHeight);
             };
         },
         mounted() {
@@ -1992,8 +1963,6 @@
             this.getMyProjectList();
             this.getInsideData();
             this.getGroupTemplate();
-            // tinymce.init({});
-            
         }
     };
 </script>
@@ -2336,18 +2305,20 @@
         right: 20px;
     }
 }
-.issue-input {
+.inputDeep {
     position: absolute;
-    bottom: 85px;    
+    bottom: 85px;
+    width: 95%;
+    margin: 0 12px;
 }
-.inputDeep>>>.el-input__inner {
-    border: 0;
-  }
-.inputDeep>>>.el-textarea__inner {
+.inputDeep .el-textarea .el-textarea__inner{
     border: 0 !important;
-    resize: none !important;/* 这个是去掉 textarea 下面拉伸的那个标志,如下图 */
-  }
-
+    resize: none !important;
+}
+.inputDeeps .el-textarea__inner {
+    border: 0 !important;
+    resize: none !important;
+}
 .scop_span {
     display: inline-block;
     padding: 2px 5px;
@@ -2530,6 +2501,7 @@
 .ddl {
     height: 136px;
     overflow: hidden;
+    border: 1px solid #EBEEF5
 }
 .tb{
     position: relative;