90 lines
2.2 KiB
Vue
90 lines
2.2 KiB
Vue
<template>
|
|
<div class="pay-setting">
|
|
<div style="text-align:right;">
|
|
<el-button type="success" @click="doSave" v-loading="loading">保存</el-button>
|
|
</div>
|
|
<div>
|
|
<el-table v-loading="loading" :data="payList" height="60vh" class="my-table">
|
|
<el-table-column label="所属班组" align="center" prop="groupName" />
|
|
<el-table-column label="工种" align="center" prop="workTypeName" />
|
|
<el-table-column label="岗位工资" align="center" prop="pay">
|
|
<template slot-scope="{ row }">
|
|
<el-input v-model="row.unitPay" placeholder="请输入岗位工资" type="number" />
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {listUnitpay,addUnitpay} from '@/api/project/unitpay'
|
|
export default {
|
|
props:{
|
|
getPrjInfo:{
|
|
type:Function
|
|
}
|
|
},
|
|
data(){
|
|
return {
|
|
loading:false,
|
|
cfgList: [],
|
|
payList:[],
|
|
}
|
|
},
|
|
created(){
|
|
this.$api.publics.findAttendanceCfgList({}).then((response) => {
|
|
this.cfgList = response.data || [];
|
|
this.doQuery();
|
|
});
|
|
},
|
|
methods:{
|
|
doSave(){
|
|
let postData=this.payList.map(it=>{
|
|
let obj={...it};
|
|
obj.unitPay=obj.unitPay*100;
|
|
return obj;
|
|
})
|
|
this.loading=true;
|
|
addUnitpay(postData).then(d=>{
|
|
this.loading=false;
|
|
if(d.code==200){
|
|
this.$modal.msgSuccess("保存成功!");
|
|
this.doQuery();
|
|
}else{
|
|
this.$message.error("保存失败!");
|
|
}
|
|
|
|
});
|
|
},
|
|
doQuery(){
|
|
let postData = {};
|
|
let prj=this.getPrjInfo();
|
|
let tmps = this.cfgList.filter(
|
|
(d) =>
|
|
d.projectId == prj.id &&
|
|
d.subDeptId == prj.deptId
|
|
);
|
|
postData.cfgId = tmps.length > 0?tmps[0].id:0;
|
|
this.loading=true;
|
|
listUnitpay(postData).then(d=>{
|
|
this.payList=(d.data||[]).map(it=>{
|
|
it.unitPay=it.unitPay?(it.unitPay/100.0).toFixed(2):''
|
|
return it;
|
|
});
|
|
this.loading=false;
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.pay-setting{
|
|
.el-table.my-table{
|
|
height: calc(100vh - 240px) !important;
|
|
}
|
|
}
|
|
</style>
|