Browse Source

优化

master
陈裕财 4 years ago
parent
commit
a66ff9a0c3
  1. 30
      src/api/xm/core/xmTaskSbill.js
  2. 44
      src/api/xm/core/xmTaskSbillDetail.js
  3. 209
      src/views/xm/core/xmTaskSbillDetail/XmTaskSbillDetailEdit.vue
  4. 411
      src/views/xm/core/xmTaskSbillDetail/XmTaskSbillDetailMng.vue

30
src/api/xm/core/xmTaskSbill.js

@ -1,22 +1,20 @@
import axios from '@/utils/request'
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
import config from '@/common/config'
let base = config.getCoreBasePath();
/**-------------------------与后端通讯接口------------------请写在下面-------------------------------------------- */
/**
* 任务结算表
*1 默认只开放普通查询所有查询只要上传 分页参数 {currentPage:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'结算单据编号 主键',title:'结算单标题',amt:'金额=工时表中结算金额之和',ctime:'创建时间',cuserid:'创建人编号',cusername:'创建人姓名',remark:'备注',branchId:'机构编号',deptid:'部门编号',cpId:'相对方编号(机构写机构号,个人写个人编号)',cpName:'相对方名称(机构写机构名称,个人写个人名称)',workload:'结算工作量=工时表中工时之和',bizMonth:'业务月份yyyy-MM',bizDate:'业务日期yyyy-MM-dd',bizFlowState:'结算流程状态',bizProcInstId:'结算流程实例',ltime:'更新时间',status:'0-待提交,1-已提交,2-已通过,3-已付款,4-已完成',fmsg:'最后审核意见',projectId:'项目编号',projectName:'项目名称'}
*1 默认只开放普通查询所有查询只要上传 分页参数 {pageNum:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'结算单据编号 主键',title:'结算单标题',amt:'金额=工时表中结算金额之和',ctime:'创建时间',cuserid:'创建人编号',cusername:'创建人姓名',remark:'备注',branchId:'机构编号',deptid:'部门编号',cpId:'相对方编号(机构写机构号,个人写个人编号)',cpName:'相对方名称(机构写机构名称,个人写个人名称)',workload:'结算工作量=工时表中工时之和',bizMonth:'业务月份yyyy-MM',bizDate:'业务日期yyyy-MM-dd',bizFlowState:'结算流程状态:0初始1审批中2审批通过3审批不通过4流程取消或者删除',bizProcInstId:'结算流程实例',ltime:'更新时间',status:'0-待提交,1-已提交,2-已通过,3-已付款,4-已完成',fmsg:'最后审核意见',projectId:'项目编号',projectName:'项目名称',userCnt:'结算人数'}
**/
//普通查询 条件之间and关系
//普通查询 条件之间and关系
export const listXmTaskSbill = params => { return axios.get(`${base}/xm/core/xmTaskSbill/list`, { params: params }); };
//模糊查询任务结算表 条件之间or关系
//export const listXmTaskSbillKey = params => { return axios.get(`${base}/xm/core/xmTaskSbill/listKey`, { params: params }); };
//删除一条任务结算表 params={id:'结算单据编号 主键'}
export const delXmTaskSbill = params => { return axios.post(`${base}/xm/core/xmTaskSbill/del`,params); };
@ -28,3 +26,19 @@ export const editXmTaskSbill = params => { return axios.post(`${base}/xm/core/xm
//新增一条任务结算表
export const addXmTaskSbill = params => { return axios.post(`${base}/xm/core/xmTaskSbill/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTaskSbill = params => { return axios.post(`${base}/xm/core/xmTaskSbill/editSomeFields`, params); };
/**-------------------------前端mng|add|edit界面公共函数---------------请写在下面----------------------------------------------- */
//初始化页面上的字典
export const initDicts = (that) => {
var itemCodes=[];//在此添加要加载的字典 如['sex','grade','lvl']
if(itemCodes.length>0){
initSimpleDicts('all',itemCodes).then(res=>{
Object.assign(that.dicts,res.data.data)
});
}
};

44
src/api/xm/core/xmTaskSbillDetail.js

@ -0,0 +1,44 @@
import axios from '@/utils/request'
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
import config from '@/common/config'
let base = config.getCoreBasePath();
/**-------------------------与后端通讯接口------------------请写在下面-------------------------------------------- */
/**
* 工时登记表
*1 默认只开放普通查询所有查询只要上传 分页参数 {pageNum:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'主键 主键',userid:'员工编号',username:'姓名',ctime:'创建日期',taskId:'业务对象主键任务编号',bizDate:'业务日期yyyy-MM-dd',remark:'备注',sbillId:'结算单据编号-来自task_sbill.id',stime:'结算提交时间',sstatus:'结算状态0-无需结算,1-待结算2-已提交3-已通过4-已结算',amt:'工时对应金额',samt:'结算工时对应结算金额-根据结算方案计算结算金额',workload:'报工工时',projectId:'归属项目',sworkload:'结算工时,用于结算,默认=workload',bizMonth:'月份yyyy-MM型',budgetAt:'任务预算金额-来自task表',budgetWorkload:'任务预算工时-来自task表',initWorkload:'任务初始工时-来自task表',quoteAt:'报价金额-来自task_execuser表',quoteWorkload:'报价工时-来自task_execuser表',sschemel:'任务结算方案,来自task表、来自数字字典xmTaskSettleSchemel',uniPrice:'工时单价,来自task表,根据task_out判断取内部还是外部单价',qendTime:'报价结束时间',qstartTime:'报价开始时间',actEndTime:'实际完工时间-来自task表',actStartTime:'实际开始时间-来自task表'}
**/
//普通查询 条件之间and关系
export const listXmTaskSbillDetail = params => { return axios.get(`${base}/xm/core/xmTaskSbillDetail/list`, { params: params }); };
//删除一条工时登记表 params={id:'主键 主键'}
export const delXmTaskSbillDetail = params => { return axios.post(`${base}/xm/core/xmTaskSbillDetail/del`,params); };
//批量删除工时登记表 params=[{id:'主键 主键'}]
export const batchDelXmTaskSbillDetail = params => { return axios.post(`${base}/xm/core/xmTaskSbillDetail/batchDel`, params); };
//修改一条工时登记表记录
export const editXmTaskSbillDetail = params => { return axios.post(`${base}/xm/core/xmTaskSbillDetail/edit`, params); };
//新增一条工时登记表
export const addXmTaskSbillDetail = params => { return axios.post(`${base}/xm/core/xmTaskSbillDetail/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTaskSbillDetail = params => { return axios.post(`${base}/xm/core/xmTaskSbillDetail/editSomeFields`, params); };
/**-------------------------前端mng|add|edit界面公共函数---------------请写在下面----------------------------------------------- */
//初始化页面上的字典
export const initDicts = (that) => {
var itemCodes=[];//在此添加要加载的字典 如['sex','grade','lvl']
if(itemCodes.length>0){
initSimpleDicts('all',itemCodes).then(res=>{
Object.assign(that.dicts,res.data.data)
});
}
};

209
src/views/xm/core/xmTaskSbillDetail/XmTaskSbillDetailEdit.vue

@ -0,0 +1,209 @@
<template>
<section class="page-container padding">
<el-row class="page-header">
</el-row>
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table">
<!--编辑界面 XmTaskSbillDetail 工时登记表-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<el-form-item label="员工编号" prop="userid">
<el-input v-model="editForm.userid" placeholder="员工编号" :maxlength="50"></el-input>
</el-form-item>
<el-form-item label="姓名" prop="username">
<el-input v-model="editForm.username" placeholder="姓名" :maxlength="255"></el-input>
</el-form-item>
<el-form-item label="创建日期" prop="ctime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.ctime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="业务对象主键任务编号" prop="taskId">
<el-input v-model="editForm.taskId" placeholder="业务对象主键任务编号" :maxlength="50"></el-input>
</el-form-item>
<el-form-item label="业务日期yyyy-MM-dd" prop="bizDate">
<el-input v-model="editForm.bizDate" placeholder="业务日期yyyy-MM-dd" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="editForm.remark" placeholder="备注" :maxlength="255"></el-input>
</el-form-item>
<el-form-item label="主键" prop="id">
<el-input v-model="editForm.id" placeholder="主键" :maxlength="50"></el-input>
</el-form-item>
<el-form-item label="结算单据编号-来自task_sbill.id" prop="sbillId">
<el-input v-model="editForm.sbillId" placeholder="结算单据编号-来自task_sbill.id" :maxlength="50"></el-input>
</el-form-item>
<el-form-item label="结算提交时间" prop="stime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.stime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="结算状态0-无需结算,1-待结算2-已提交3-已通过4-已结算" prop="sstatus">
<el-input v-model="editForm.sstatus" placeholder="结算状态0-无需结算,1-待结算2-已提交3-已通过4-已结算" :maxlength="1"></el-input>
</el-form-item>
<el-form-item label="工时对应金额" prop="amt">
<el-input v-model="editForm.amt" placeholder="工时对应金额" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="结算工时对应结算金额-根据结算方案计算结算金额" prop="samt">
<el-input v-model="editForm.samt" placeholder="结算工时对应结算金额-根据结算方案计算结算金额" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="报工工时" prop="workload">
<el-input v-model="editForm.workload" placeholder="报工工时" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="归属项目" prop="projectId">
<el-input v-model="editForm.projectId" placeholder="归属项目" :maxlength="50"></el-input>
</el-form-item>
<el-form-item label="结算工时,用于结算,默认=workload" prop="sworkload">
<el-input v-model="editForm.sworkload" placeholder="结算工时,用于结算,默认=workload" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="月份yyyy-MM型" prop="bizMonth">
<el-input v-model="editForm.bizMonth" placeholder="月份yyyy-MM型" :maxlength="7"></el-input>
</el-form-item>
<el-form-item label="任务预算金额-来自task表" prop="budgetAt">
<el-input v-model="editForm.budgetAt" placeholder="任务预算金额-来自task表" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="任务预算工时-来自task表" prop="budgetWorkload">
<el-input v-model="editForm.budgetWorkload" placeholder="任务预算工时-来自task表" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="任务初始工时-来自task表" prop="initWorkload">
<el-input v-model="editForm.initWorkload" placeholder="任务初始工时-来自task表" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="报价金额-来自task_execuser表" prop="quoteAt">
<el-input v-model="editForm.quoteAt" placeholder="报价金额-来自task_execuser表" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="报价工时-来自task_execuser表" prop="quoteWorkload">
<el-input v-model="editForm.quoteWorkload" placeholder="报价工时-来自task_execuser表" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="任务结算方案,来自task表、来自数字字典xmTaskSettleSchemel" prop="sschemel">
<el-input v-model="editForm.sschemel" placeholder="任务结算方案,来自task表、来自数字字典xmTaskSettleSchemel" :maxlength="1"></el-input>
</el-form-item>
<el-form-item label="工时单价,来自task表,根据task_out判断取内部还是外部单价" prop="uniPrice">
<el-input v-model="editForm.uniPrice" placeholder="工时单价,来自task表,根据task_out判断取内部还是外部单价" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="报价结束时间" prop="qendTime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.qendTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="报价开始时间" prop="qstartTime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.qstartTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="实际完工时间-来自task表" prop="actEndTime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.actEndTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="实际开始时间-来自task表" prop="actStartTime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.actStartTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
</el-form>
</el-row>
<el-row class="page-bottom bottom-fixed">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from "@/common/config"; //import
import { initDicts, addXmTaskSbillDetail,editXmTaskSbillDetail } from '@/api/xm/core/xmTaskSbillDetail';
import { mapGetters } from 'vuex'
export default {
name:'xmTaskSbillDetailEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmTaskSbillDetail','visible','opType'],
watch: {
'xmTaskSbillDetail':function( xmTaskSbillDetail ) {
if(xmTaskSbillDetail){
this.editForm = {...xmTaskSbillDetail};
}
},
'visible':function(visible) {
if(visible==true){
this.initData()
}
}
},
data() {
return {
currOpType:'add',//add/edit
load:{ list: false, edit: false, del: false, add: false },//...
dicts:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
editForm: {
userid:'',username:'',ctime:'',taskId:'',bizDate:'',remark:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:'',projectId:'',sworkload:'',bizMonth:'',budgetAt:'',budgetWorkload:'',initWorkload:'',quoteAt:'',quoteWorkload:'',sschemel:'',uniPrice:'',qendTime:'',qstartTime:'',actEndTime:'',actStartTime:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmTaskSbillDetail @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
var func=addXmTaskSbillDetail
if(this.currOpType=='edit'){
func=editXmTaskSbillDetail
}
func(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.editForm=res.data.data
this.initData()
this.currOpType="edit";
this.$emit('submit');// @submit="afterAddSubmit"
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err =>this.load.edit=false);
});
}else{
this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' });
}
});
},
initData: function(){
this.currOpType=this.opType
if(this.xmTaskSbillDetail){
this.editForm = Object.assign({},this.xmTaskSbillDetail);
}
if(this.opType=='edit'){
}else{
}
},
},//end method
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}
</script>
<style scoped>
</style>

411
src/views/xm/core/xmTaskSbillDetail/XmTaskSbillDetailMng.vue

@ -0,0 +1,411 @@
<template>
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmTaskSbillDetails" icon="el-icon-search">查询</el-button>
<span style="float:right;">
<el-button type="primary" @click="showAdd" icon="el-icon-plus" plain> </el-button>
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete" plain></el-button>
</span>
</el-row>
<el-row class="padding-top">
<!--列表 XmTaskSbillDetail 工时登记表-->
<el-table ref="xmTaskSbillDetailTable" :data="xmTaskSbillDetails" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column sortable type="index" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<!--
<el-table-column sortable prop="username" width="55" show-overflow-tooltip fixed="left">
<span class="cell-text"> {{scope.row.username}}} </span>
<span class="cell-bar"><el-input style="display:inline;" v-model="scope.row.username" placeholder="" @change="editSomeFields(scope.row,'username',$event)" :maxlength="22"></el-input></span>
</el-table-column>
-->
<el-table-column prop="id" label="主键" min-width="80" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="userid" label="员工编号" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.userid}} </span>
</template>
</el-table-column>
<el-table-column prop="username" label="姓名" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.username}} </span>
</template>
</el-table-column>
<el-table-column prop="ctime" label="创建日期" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ctime}} </span>
</template>
</el-table-column>
<el-table-column prop="taskId" label="业务对象主键任务编号" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.taskId}} </span>
</template>
</el-table-column>
<el-table-column prop="bizDate" label="业务日期yyyy-MM-dd" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bizDate}} </span>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.remark}} </span>
</template>
</el-table-column>
<el-table-column prop="sbillId" label="结算单据编号-来自task_sbill.id" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.sbillId}} </span>
</template>
</el-table-column>
<el-table-column prop="stime" label="结算提交时间" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.stime}} </span>
</template>
</el-table-column>
<el-table-column prop="sstatus" label="结算状态0-无需结算,1-待结算2-已提交3-已通过4-已结算" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.sstatus}} </span>
</template>
</el-table-column>
<el-table-column prop="amt" label="工时对应金额" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.amt}} </span>
</template>
</el-table-column>
<el-table-column prop="samt" label="结算工时对应结算金额-根据结算方案计算结算金额" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.samt}} </span>
</template>
</el-table-column>
<el-table-column prop="workload" label="报工工时" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.workload}} </span>
</template>
</el-table-column>
<el-table-column prop="projectId" label="归属项目" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.projectId}} </span>
</template>
</el-table-column>
<el-table-column prop="sworkload" label="结算工时,用于结算,默认=workload" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.sworkload}} </span>
</template>
</el-table-column>
<el-table-column prop="bizMonth" label="月份yyyy-MM型" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bizMonth}} </span>
</template>
</el-table-column>
<el-table-column prop="budgetAt" label="任务预算金额-来自task表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.budgetAt}} </span>
</template>
</el-table-column>
<el-table-column prop="budgetWorkload" label="任务预算工时-来自task表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.budgetWorkload}} </span>
</template>
</el-table-column>
<el-table-column prop="initWorkload" label="任务初始工时-来自task表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.initWorkload}} </span>
</template>
</el-table-column>
<el-table-column prop="quoteAt" label="报价金额-来自task_execuser表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.quoteAt}} </span>
</template>
</el-table-column>
<el-table-column prop="quoteWorkload" label="报价工时-来自task_execuser表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.quoteWorkload}} </span>
</template>
</el-table-column>
<el-table-column prop="sschemel" label="任务结算方案,来自task表、来自数字字典xmTaskSettleSchemel" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.sschemel}} </span>
</template>
</el-table-column>
<el-table-column prop="uniPrice" label="工时单价,来自task表,根据task_out判断取内部还是外部单价" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.uniPrice}} </span>
</template>
</el-table-column>
<el-table-column prop="qendTime" label="报价结束时间" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.qendTime}} </span>
</template>
</el-table-column>
<el-table-column prop="qstartTime" label="报价开始时间" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.qstartTime}} </span>
</template>
</el-table-column>
<el-table-column prop="actEndTime" label="实际完工时间-来自task表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.actEndTime}} </span>
</template>
</el-table-column>
<el-table-column prop="actStartTime" label="实际开始时间-来自task表" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.actStartTime}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template scope="scope">
<el-button type="primary" @click="showEdit( scope.row,scope.$index)" icon="el-icon-edit" plain></el-button>
<el-button type="danger" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete" plain></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>
<!--编辑 XmTaskSbillDetail 工时登记表界面-->
<el-drawer title="编辑工时登记表" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-sbill-detail-edit op-type="edit" :xm-task-sbill-detail="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-task-sbill-detail-edit>
</el-drawer>
<!--新增 XmTaskSbillDetail 工时登记表界面-->
<el-drawer title="新增工时登记表" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-sbill-detail-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-task-sbill-detail-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTaskSbillDetail, delXmTaskSbillDetail, batchDelXmTaskSbillDetail,editSomeFieldsXmTaskSbillDetail } from '@/api/xm/core/xmTaskSbillDetail';
import XmTaskSbillDetailEdit from './XmTaskSbillDetailEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmTaskSbillDetailMng',
components: {
XmTaskSbillDetailEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTaskSbillDetails()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTaskSbillDetails: [],//
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,//xmTaskSbillDetail
addForm: {
userid:'',username:'',ctime:'',taskId:'',bizDate:'',remark:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:'',projectId:'',sworkload:'',bizMonth:'',budgetAt:'',budgetWorkload:'',initWorkload:'',quoteAt:'',quoteWorkload:'',sschemel:'',uniPrice:'',qendTime:'',qstartTime:'',actEndTime:'',actStartTime:''
},
editFormVisible: false,//
editForm: {
userid:'',username:'',ctime:'',taskId:'',bizDate:'',remark:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:'',projectId:'',sworkload:'',bizMonth:'',budgetAt:'',budgetWorkload:'',initWorkload:'',quoteAt:'',quoteWorkload:'',sschemel:'',uniPrice:'',qendTime:'',qstartTime:'',actEndTime:'',actStartTime:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTaskSbillDetails();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTaskSbillDetails();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmTaskSbillDetails();
},
searchXmTaskSbillDetails(){
this.pageInfo.count=true;
this.getXmTaskSbillDetails();
},
// XmTaskSbillDetail
getXmTaskSbillDetails() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
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;
listXmTaskSbillDetail(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTaskSbillDetails = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmTaskSbillDetail
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTaskSbillDetail
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTaskSbillDetails();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTaskSbillDetail
selsChange: function (sels) {
this.sels = sels;
},
//xmTaskSbillDetail
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmTaskSbillDetail(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmTaskSbillDetails();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTaskSbillDetail
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { id:i.id}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmTaskSbillDetail(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmTaskSbillDetails();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.id==row.id)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['ids']=this.sels.map(i=>i.id)
}else{
params['ids']=[row].map(i=>i.id)
}
params[fieldName]=$event
var func = editSomeFieldsXmTaskSbillDetail
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmTaskSbillDetails();
}
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmTaskSbillDetails();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTaskSbillDetailTable.$el)
});
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save