From b2d55e119f94c86a1f799342302729853daa1ddd Mon Sep 17 00:00:00 2001 From: chentaiyu Date: Tue, 29 Mar 2022 10:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BB=93=E7=AE=97-=E5=B7=A5?= =?UTF-8?q?=E6=97=B6=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/xm/core/xmTaskWorkload.js | 3 + .../core/xmTaskSbill/SelectTaskWorkload.vue | 199 ++++++++++++++++++ .../xm/core/xmTaskSbill/SelectXmProject.vue | 2 +- .../xm/core/xmTaskSbill/XmTaskSbillEdit.vue | 8 +- .../xm/core/xmTaskSbill/XmTaskSbillMng.vue | 98 +++++++-- 5 files changed, 293 insertions(+), 17 deletions(-) create mode 100644 src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue diff --git a/src/api/xm/core/xmTaskWorkload.js b/src/api/xm/core/xmTaskWorkload.js index f85bc730..a003603f 100644 --- a/src/api/xm/core/xmTaskWorkload.js +++ b/src/api/xm/core/xmTaskWorkload.js @@ -28,3 +28,6 @@ export const editXmTaskWorkload = params => { return axios.post(`${base}/xm/core //新增一条工时登记表 export const addXmTaskWorkload = params => { return axios.post(`${base}/xm/core/xmTaskWorkload/add`, params); }; + +//普通查询 条件之间and关系 +export const listByProject = params => { return axios.get(`${base}/xm/core/xmTaskWorkload/listByProject`, { params: params }); }; diff --git a/src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue b/src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue new file mode 100644 index 00000000..27a5ab63 --- /dev/null +++ b/src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue @@ -0,0 +1,199 @@ + + + + + + diff --git a/src/views/xm/core/xmTaskSbill/SelectXmProject.vue b/src/views/xm/core/xmTaskSbill/SelectXmProject.vue index 0a6e3e82..256085b7 100644 --- a/src/views/xm/core/xmTaskSbill/SelectXmProject.vue +++ b/src/views/xm/core/xmTaskSbill/SelectXmProject.vue @@ -103,7 +103,7 @@ export default { this.pageInfo.count=false; this.xmProjects = res.data.data; }else{ - this.$message({ showClose: true, message: tips.msg, type: 'error' }); + this.$notify({ showClose: true, message: tips.msg, type: 'error' }); } this.load.list = false; }).catch( err => this.load.list = false ); diff --git a/src/views/xm/core/xmTaskSbill/XmTaskSbillEdit.vue b/src/views/xm/core/xmTaskSbill/XmTaskSbillEdit.vue index 5c249b0d..4fb0e5eb 100644 --- a/src/views/xm/core/xmTaskSbill/XmTaskSbillEdit.vue +++ b/src/views/xm/core/xmTaskSbill/XmTaskSbillEdit.vue @@ -150,12 +150,12 @@ this.load.edit=true let params = Object.assign({}, this.editForm); - let today = new Date(); + /*let today = new Date(); let year = today.getFullYear(); let m = today.getMonth() + 1; let d = today.getDay(); params.bizMonth = year+"-"+m; - params.bizDate = year+"-"+m+"-"+d; + params.bizDate = year+"-"+m+"-"+d;*/ if(this.currOpType=='edit'){ editXmTaskSbill(params).then((res) => { @@ -164,7 +164,7 @@ if(tips.isOk){ this.$emit('submit');// @submit="afterEditSubmit" } - this.$message({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); }).catch( err =>this.load.edit=false); }else{ addXmTaskSbill(params).then((res) => { @@ -174,7 +174,7 @@ this.$emit('submit');// @submit="afterAddSubmit" } - this.$message({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); }).catch( err =>this.load.edit=false); } }); diff --git a/src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue b/src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue index 30dcc34e..b130969d 100644 --- a/src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue +++ b/src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue @@ -1,7 +1,7 @@ @@ -99,10 +102,15 @@ import { listXmTaskSbill, delXmTaskSbill, batchDelXmTaskSbill } from '@/api/xm/core/xmTaskSbill'; import XmTaskSbillEdit from './XmTaskSbillEdit';//新增修改界面 import { mapGetters } from 'vuex' + import SelectTaskWorkload from "./SelectTaskWorkload"; + import {editXmTaskSbill} from "../../../../api/xm/core/xmTaskSbill"; + import dateUtil from "../../../../common/js/dateUtil"; + import {editXmTaskWorkload} from "../../../../api/xm/core/xmTaskWorkload"; export default { components: { - XmTaskSbillEdit, + XmTaskSbillEdit, + SelectTaskWorkload, }, props:['visible'], computed: { @@ -146,6 +154,9 @@ id:'',title:'',amt:'',ctime:'',cuserid:'',cusername:'',remark:'',branchId:'',deptid:'',cpId:'',cpName:'',workload:'',bizMonth:'',bizDate:'',bizFlowState:'',bizProcInstId:'',ltime:'',status:'',fmsg:'',projectId:'',projectName:'' }, maxTableHeight:300, + taskWorkloadVisible:false, + thisBillRow:{},//添加工时的结算单 + projectId:'',//添加工时的项目编号 } },//end data methods: { @@ -206,7 +217,7 @@ this.pageInfo.count=false; this.xmTaskSbills = res.data.data; }else{ - this.$message({ showClose:true, message: tips.msg, type: 'error' }); + this.$notify({ showClose:true, message: tips.msg, type: 'error' }); } this.load.list = false; }).catch( err => this.load.list = false ); @@ -248,7 +259,7 @@ this.pageInfo.count=true; this.getXmTaskSbills(); } - this.$message({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); }).catch( err => this.load.del=false ); }); }, @@ -266,18 +277,81 @@ this.pageInfo.count=true; this.getXmTaskSbills(); } - this.$message({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error'}); + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error'}); }).catch( err => this.load.del=false ); }); }, rowClick: function(row, event, column){ this.$emit('row-click',row, event, column);// @row-click="rowClick" }, - initData: function(){ + initData: function(){ - }, + }, /**begin 自定义函数请在下面加**/ - + addWorkload(row,index){ + if(row.status!='0'){ + this.$notify({ showClose:true, message: "只能修改待提交的数据", type: 'error'}); + return; + } + if(!(row.bizFlowState=='0' || row.bizFlowState=='3')){ + this.$notify({ showClose:true, message: "只能修改未发审、未通过的数据", type: 'error'}); + return; + } + this.thisBillRow = Object.assign({},row); + this.taskWorkloadVisible = true; + }, + afterWorkloadSubmit(row){ + this.taskWorkloadVisible = false; + this.thisBillRow.workload = this.thisBillRow.workload + row.workload; + this.thisBillRow.amt = this.thisBillRow.amt + row.samt; + //修改xmTaskSbill + this.changeXmTaskSbill(this.thisBillRow); + //更新xmTaskWokload现状 + this.changeXmTaskWorkload(row,this.thisBillRow); + }, + changeXmTaskSbill(data){ + let params = Object.assign({}, data); + editXmTaskSbill(params).then((res) => { + let tips=res.data.tips; + if(tips.isOk){ + this.getXmTaskSbills(); + } + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + }).catch( err =>{}); + }, + changeXmTaskWorkload(data,sbill){ + let params={ + id:data.id, + sstatus:'2',//2为已提交结算 + stime:this.formatDate("YYYY-mm-dd HH:MM",new Date()), + sbillId:sbill.id + } + editXmTaskWorkload(params).then((res) => { + let tips=res.data.tips; + if(tips.isOk){ + } + this.$notify({ showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + }).catch( err =>{}); + }, + dateFormat(fmt, date) { + let ret; + const opt = { + "Y+": date.getFullYear().toString(), // 年 + "m+": (date.getMonth() + 1).toString(), // 月 + "d+": date.getDate().toString(), // 日 + "H+": date.getHours().toString(), // 时 + "M+": date.getMinutes().toString(), // 分 + "S+": date.getSeconds().toString() // 秒 + // 有其他格式化字符需求可以继续添加,必须转化成字符串 + }; + for (let k in opt) { + ret = new RegExp("(" + k + ")").exec(fmt); + if (ret) { + fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) + }; + }; + return fmt; + } },//end methods mounted() { this.$nextTick(() => {