Browse Source

任务结算-工时暂存

master
chentaiyu 4 years ago
parent
commit
b2d55e119f
  1. 3
      src/api/xm/core/xmTaskWorkload.js
  2. 199
      src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue
  3. 2
      src/views/xm/core/xmTaskSbill/SelectXmProject.vue
  4. 8
      src/views/xm/core/xmTaskSbill/XmTaskSbillEdit.vue
  5. 98
      src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue

3
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 }); };

199
src/views/xm/core/xmTaskSbill/SelectTaskWorkload.vue

@ -0,0 +1,199 @@
<template>
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 30%;" placeholder="模糊查询任务ID/名称"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmTaskWorkloads" icon="el-icon-search">查询</el-button>
</el-row>
<el-row class="padding-top">
<!--列表 XmTaskWorkload 工时登记表-->
<el-table ref="xmTaskWorkloadTable" :data="xmTaskWorkloads" :height="maxTableHeight" highlight-current-row v-loading="load.list" border
@selection-change="selsChange" style="width: 100%;" :header-cell-style="{'text-align':'center'}"
:cell-style="{'text-align':'center'}">
<el-table-column type="selection" width="55" show-overflow-tooltip></el-table-column>
<!-- <el-table-column sortable type="index" width="55" show-overflow-tooltip></el-table-column>-->
<el-table-column prop="id" label="编号" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="userid" label="员工编号" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="username" label="姓名" min-width="80" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="ctime" label="创建日期" min-width="80" show-overflow-tooltip></el-table-column>-->
<el-table-column prop="taskId" label="任务编号" min-width="80" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="cuserid" label="创建人编号" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="bizDate" label="业务日期yyyy-MM-dd" min-width="80" show-overflow-tooltip></el-table-column>-->
<el-table-column prop="wstatus" label="登记状态" min-width="80" show-overflow-tooltip>
<!-- 0-待确认1-已确认2-无效-->
<template slot-scope="scope">
<span v-if="scope.row.wstatus=='0'">待确认</span>
<span v-else-if="scope.row.wstatus=='1'">已确认</span>
</template>
</el-table-column>
<!-- <el-table-column prop="remark" label="备注" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="ttype" label="任务类型-关联字典taskType" min-width="80" show-overflow-tooltip></el-table-column>-->
<!-- <el-table-column prop="sbillId" label="结算单据编号" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="stime" label="结算提交时间" min-width="80" show-overflow-tooltip></el-table-column>-->
<el-table-column prop="sstatus" label="结算状态" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<!-- 0-无需结算1-待结算2-已提交3-已通过4-已结算-->
<span v-if="scope.row.sstatus=='0'">无需结算</span>
<span v-else-if="scope.row.sstatus=='1'">待结算</span>
<span v-else-if="scope.row.sstatus=='2'">已提交</span>
<span v-else-if="scope.row.sstatus=='3'">已通过</span>
<span v-else-if="scope.row.sstatus=='4'">已结算</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="amt" label="工时金额" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="samt" label="结算金额" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="workload" label="工时" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template scope="scope">
<el-button :disabled="!(scope.row.sstatus=='1'&&scope.row.wstatus=='1')" @click="selectRow( scope.row,scope.$index)">选择</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
<el-row>
<!--编辑 XmTaskWorkload 工时登记表界面-->
<el-drawer title="编辑工时登记表" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-workload-edit op-type="edit" :xm-task-workload="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-task-workload-edit>
</el-drawer>
<!--新增 XmTaskWorkload 工时登记表界面-->
<el-drawer title="新增工时登记表" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-workload-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-task-workload-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//
import { listXmTaskWorkload, delXmTaskWorkload, batchDelXmTaskWorkload } from '@/api/xm/core/xmTaskWorkload';
import { mapGetters } from 'vuex'
import {listByProject} from "../../../../api/xm/core/xmTaskWorkload";
export default {
name:'xmTaskWorkloadMng',
components: {
},
props:['visible','xmTaskSbill'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTaskWorkloads()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTaskWorkloads: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmTaskWorkload
addForm: {
userid:'',username:'',ctime:'',taskId:'',cuserid:'',bizDate:'',wstatus:'',remark:'',ttype:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:''
},
editFormVisible: false,//
editForm: {
userid:'',username:'',ctime:'',taskId:'',cuserid:'',bizDate:'',wstatus:'',remark:'',ttype:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:''
},
maxTableHeight:300,
}
},//end data
methods: {
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTaskWorkloads();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTaskWorkloads();
},
searchXmTaskWorkloads(){
this.pageInfo.count=true;
this.getXmTaskWorkloads();
},
// XmTaskWorkload
getXmTaskWorkloads() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count,
projectId:this.xmTaskSbill.projectId
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key= "%" + this.filters.key + "%"
}
this.load.list = true;
listByProject(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTaskWorkloads = res.data.data;
}else{
this.$notify({ showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
//xmTaskWorkload
selsChange: function (sels) {
this.sels = sels;
},
selectRow(row,index){
this.$emit("submit",row);
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
//initSimpleDicts('all',['sex','gradeLvl']).then(res=>this.dicts=res.data.data);
this.initData()
this.searchXmTaskWorkloads();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTaskWorkloadTable.$el)
});
}
}
</script>
<style scoped>
</style>

2
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 );

8
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);
}
});

98
src/views/xm/core/xmTaskSbill/XmTaskSbillMng.vue

@ -1,7 +1,7 @@
<template>
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询:编号/标题"></el-input>
<el-input v-model="filters.key" clearable style="width: 20%;" placeholder="模糊查询:编号/标题/项目名称"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmTaskSbills" icon="el-icon-search">查询</el-button>
<!-- <el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete"></el-button>-->
<span style="float:right;">
@ -43,7 +43,7 @@
<el-table-column prop="bizFlowState" label="审批状态" min-width="60" show-overflow-tooltip>
<template scope="scope">
<el-tag v-if="scope.row.bizFlowState=='0'">未发审</el-tag>
<el-tag v-else-if="scope.row.bizFlowState=='1'">审批中</el-tag>
<el-tag type="warning" v-else-if="scope.row.bizFlowState=='1'">审批中</el-tag>
<el-tag type="success" v-else-if="scope.row.bizFlowState=='2'">已通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.bizFlowState=='3'">未通过</el-tag>
<el-tag type="info" v-else-if="scope.row.bizFlowState=='4'">已取消</el-tag>
@ -72,7 +72,7 @@
<el-button type="text">发审</el-button>
<el-button type="text" @click="showEdit( scope.row,scope.$index)" icon="el-icon-edit"></el-button>
<el-button type="text" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete"></el-button>
<el-button type="text" icon="el-icon-plus"></el-button>
<el-button type="text" @click="addWorkload(scope.row,scope.$index)" icon="el-icon-plus"></el-button>
</template>
</el-table-column>
</el-table>
@ -83,12 +83,15 @@
<el-drawer title="编辑任务结算单" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-sbill-edit op-type="edit" :xm-task-sbill="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-task-sbill-edit>
</el-drawer>
<!--新增 XmTaskSbill 任务结算表界面-->
<el-drawer title="新增任务结算单" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-sbill-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-task-sbill-edit>
</el-drawer>
</el-row>
<!--添加登记工时界面-->
<el-drawer title="添加工时登记单" :visible.sync="taskWorkloadVisible" size="60%" append-to-body :close-on-click-modal="false">
<select-task-workload :xm-task-sbill="thisBillRow" :visible="taskWorkloadVisible" @cancel="taskWorkloadVisible=false" @submit="afterWorkloadSubmit"></select-task-workload>
</el-drawer>
</el-row>
</section>
</template>
@ -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(() => {

Loading…
Cancel
Save