|
|
@ -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> |
|
|
|