Browse Source

获取所有成员的工资信息

master
xuesinan 4 years ago
parent
commit
5eca6edba5
  1. 3
      src/config/api.js
  2. 56
      src/views/SalarySummary/SalarySummary.vue

3
src/config/api.js

@ -16,3 +16,6 @@ export const clockAudit = params => axios.post(`${defaultwbs}/clock/audit`, para
// 导出考勤excel
export const clockExport = params => axios.post(`${defaultwbs}/clock/export`, params);
// 查询所有成员工资信息
export const queryMemberSalary = params => axios.post(`${defaultwbs}/salary/queryMemberSalary`, params);

56
src/views/SalarySummary/SalarySummary.vue

@ -9,7 +9,7 @@
:default-value="$moment(currDate, monthFormat)"
:format="monthFormat"
@change="onChange"
:getCalendarContainer="getCalendarContainer()"
@getCalendarContainer="getCalendarContainer()"
>
<a-icon slot="suffixIcon" type="down" />
</a-month-picker>
@ -118,6 +118,12 @@
<script>
import LineChart from '@/components/LineChart/LineChart.vue';
import BarChart from '@/components/BarChart/BarChart.vue';
import { queryMemberSalary } from '@/config/api';
import { mapState } from 'vuex';
const myDate = new Date();
const tYear = myDate.getFullYear();
const tMonth = myDate.getMonth();
const columns = [
{
@ -229,8 +235,8 @@ export default {
data() {
return {
timer: null,
monthFormat: 'YYYY年MM月',
today: this.$moment(new Date()).format('YYYY年MM月'),
isCurr: true,
columns,
data,
@ -255,14 +261,15 @@ export default {
{ key: 2, name: '项目1' },
{ key: 3, name: '项目2' },
],
monthStartTime: '',
monthEndTime: '',
};
},
computed: {
...mapState('home', ['projectId', 'roleId']),
currDate() {
var myDate = new Date();
var tYear = myDate.getFullYear();
var tMonth = myDate.getMonth();
let m = tMonth === 0 ? 12 : tMonth;
let y = tMonth === 0 ? tYear - 1 : tYear;
let data = y + '年' + m + '月';
@ -270,6 +277,18 @@ export default {
},
},
mounted() {
this.timer = setInterval(async () => {
if (this.projectId) {
clearInterval(this.timer);
await this.getQueryMemberSalary();
}
}, 300);
this.monthStartTime = new Date(tYear, tMonth - 1, 1).getTime(); //
this.monthEndTime = new Date(tYear, tMonth, 1).getTime(); //
},
methods: {
//
onChange(date, dateString) {
@ -316,6 +335,33 @@ export default {
onSearch(value) {
console.log(value);
},
//
async getQueryMemberSalary() {
const params = { param: { projectId, startTime: this.monthStartTime, endTime: this.monthEndTime } };
try {
const res = await queryMemberSalary(params);
const { code, msg, data } = res.data;
if (code === 200) {
data.forEach(item => {
item.recordList.forEach(clcok => {
clcok.morningVisible = false;
clcok.nightVisible = false;
clcok.showNightTime = false;
clcok.showMorningTime = false;
});
});
this.clockInfos = [...data];
} else {
this.$message.error(msg || '获取失败');
throw msg;
}
} catch (error) {
throw error || '获取失败';
}
},
},
};
</script>

Loading…
Cancel
Save