diff --git a/src/App.vue b/src/App.vue index b27d21c..6a0c2db 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,48 +1,14 @@ diff --git a/src/components/Index.vue b/src/components/Index.vue new file mode 100644 index 0000000..9984728 --- /dev/null +++ b/src/components/Index.vue @@ -0,0 +1,149 @@ + + + \ No newline at end of file diff --git a/src/components/common/Scoring.vue b/src/components/common/Scoring.vue index 51a7dcc..9451e85 100644 --- a/src/components/common/Scoring.vue +++ b/src/components/common/Scoring.vue @@ -2,11 +2,12 @@ + :min="form.score.minValue" :precision="2"/> + 确定 @@ -76,9 +78,9 @@ export default { maxValue: vueSelf.maxScore, minValue: vueSelf.minScore, reason: vueSelf.reason, - userId: '1', - userName: '管理员', - date: '' + // userId: '1', + // userName: '管理员', + // date: '' }, }, rules: { @@ -122,7 +124,7 @@ export default { } }, mounted() { - this.form.score.date = this.getCurrentDate() + // this.form.score.date = this.getCurrentDate() } } diff --git a/src/components/common/WgyWork.vue b/src/components/common/WgyWork.vue index 05a464b..e8d32ec 100644 --- a/src/components/common/WgyWork.vue +++ b/src/components/common/WgyWork.vue @@ -1,11 +1,6 @@ @@ -13,6 +8,7 @@ import { NSpace, NDataTable, + useMessage, } from 'naive-ui'; export default { @@ -21,62 +17,86 @@ export default { NSpace, NDataTable, }, + props: { + userId: { + required: true, + }, + userName: { + required: true, + }, + year: { + required: true, + }, + month: { + required: true + }, + level: { + required: true + } + }, data() { let vueSelf = this; return { + message: useMessage(), table: { columns: [ { align: 'center', - title: '张三2023年1月考勤得分明细表', + title: `${vueSelf.userName}${vueSelf.year}年${vueSelf.month}月考勤得分明细表`, key: 'title', children: [ { align: 'center', - title: '月', - key: 'month', - width: 60, - }, - { - align: 'center', - title: '日', - key: 'day', - width: 60, + title: '日期', + key: 'dayDate', + width: 100, }, { align: 'center', title: '签到', - key: 'signIn', + key: 'isSignin', width: 60, + render(row, index) { + return row.isSignin === 0 ? '否' : '是'; + } }, { align: 'center', title: '是否迟到', - key: 'isLate', + key: 'isSigninLate', width: 60, + render(row, index) { + return row.isSigninLate === 0 ? '否' : '是'; + } }, { align: 'center', title: '签退', - key: 'signOut', + key: 'isSignout', width: 60, + render(row, index) { + return row.isSignout === 0 ? '否' : '是'; + } }, { align: 'center', title: '是否早退', key: 'isEarly', width: 60, + render(row, index) { + return row.isSignoutEarly === 0 ? '否' : '是'; + } }, { align: 'center', title: '轨迹', - key: 'distance', + key: 'workDistance', width: 60, }, { align: 'center', title: '总分', - key: 'score', + key: 'dayScore', width: 60, }, { @@ -84,30 +104,54 @@ export default { title: '备注', key: 'remark', width: 100, + render(row, index) { + return row.isHoliday === 1 ? '法定假期' : '工作日'; + } } ] } ], - data: [] + data: [], } } }, methods: { - + init() { + let vueSelf = this; + vueSelf.$axios.get(`api/kpi/list-community-boss-day-count/user-id/${vueSelf.userId}`, { + params: { + year: vueSelf.year, + month: vueSelf.month, + level: vueSelf.level + } + }).then(({data}) => { + let dayScoreTotal = 0; + let signinCount = 0; + let signinLateCount = 0; + let signoutCount = 0; + let signoutEarlyCount = 0; + let workDistanceTotal = 0; + let workDay = 0; + data.forEach(item => { + dayScoreTotal += item.dayScore; + signinCount += item.isSignin; + signinLateCount += item.isSigninLate; + signoutCount += item.isSignout; + signoutEarlyCount += item.isSignoutEarly; + workDistanceTotal += item.workDistance; + if(item.isHoliday === 0) { + workDay++; + } + }); + console.log(dayScoreTotal, workDay) + vueSelf.table.data = data; + }).catch(({ data }) => { + vueSelf.message.error(data.msg); + }); + }, }, mounted() { - let data = []; - for(var i = 0; i < 100; i++) { - data.push({ - month: 12, - day: 1, - signIn: 1, - signOut: 1, - distance: 1, - remark: '123' - }) - } - this.table.data = data; + this.init(); } } diff --git a/src/components/table/Wgy.vue b/src/components/table/Wgy.vue index 2b6a2ac..9c240c1 100644 --- a/src/components/table/Wgy.vue +++ b/src/components/table/Wgy.vue @@ -7,8 +7,8 @@ - + + :options="search.select.year.options" /> + :options="search.select.month.options" /> - 搜索 + 搜索 导出 - 更新 @@ -46,7 +45,7 @@ - + @@ -107,8 +106,10 @@ export default { dialog: useDialog(), dataLoading: false, search: { + userId: null, + userName: null, select: { - street: { + area: { value: null, options: [ { label: '稀土路街道', value: 'xtl' } @@ -367,6 +368,14 @@ export default { keyName: 'overScore', width: 60, className: 'score-plus', + render(row, index) { + return h('a', { + href: 'javascript:void(0);', + onClick() { + vueSelf.onOverScoreClick(row, index); + } + }, row.U); + } }, { align: 'center', @@ -616,7 +625,7 @@ export default { fixed: 'right', width: 100, render(row, index) { - return vueSelf.computeAE(row) * row.AF / 100; + return (vueSelf.computeAE(row) * row.AF / 100).toFixed(2); } } ], @@ -673,6 +682,8 @@ export default { // 片区巡查打开 onDistanceClick(row, index) { let distance = row.C; + this.search.userId = row.user_id; + this.search.userName = row.B; this.modal.distance.show = true; }, // 4、5级网格员单选 @@ -731,6 +742,19 @@ export default { this.modal.scoring.userName = row.B; this.modal.scoring.title = '扣分其它情况'; }, + // 结案情况得分 - + onOverScoreClick(row, index) { + let overScore = row.Q; + this.modal.scoring.show = true; + this.modal.scoring.rowKey = 'Q'; + this.modal.scoring.rowIndex = index; + this.modal.scoring.score = overScore; + this.modal.scoring.reason = row.reasonQ; + this.modal.scoring.userName = row.B; + this.modal.scoring.maxScore = 10; + this.modal.scoring.minScore = 0; + this.modal.scoring.title = '结案情况得分'; + }, // 督察扣分 - onSuperviseCountClick(row, index) { let superviseCount = row.R; @@ -872,140 +896,12 @@ export default { this.modal.scoring.userName = row.B; this.modal.scoring.title = '党建信息抽查'; }, - computeAE(row) { - return row.C + row.H - row.J + row.L - row.M - row.N - row.O - row.P + row.Q - row.S - row.T - row.U - row.V + row.W + row.X + row.Y - row.Z + row.AA + row.AB + row.AC - row.AD; + let result = row.C + row.H - row.J + row.L - row.M - row.N - row.O - row.P + row.Q - row.S - row.T - row.U - row.V + row.W + row.X + row.Y - row.Z + row.AA + row.AB + row.AC - row.AD; + return result < 0 ? 0 : result.toFixed(2); }, - onUpdateClick() { - let vueSelf = this; - vueSelf.dialog.warning({ - title: '警告', - content: '确定更新吗?更新时间较长...', - positiveText: '确定', - negativeText: '不确定', - onPositiveClick: () => { - vueSelf.dataLoading = true; - vueSelf.$axios.put(`api/kpi/khxz/update-wgy/kh-year/${vueSelf.search.select.year.value}/kh-month/${vueSelf.search.select.month.value}/wgy-level/${vueSelf.search.select.wgy.value}`, { - }).then(resp => { - vueSelf.message.info('更新成功'); - vueSelf.listData(); - }).catch(resp => { - console.error(resp) - vueSelf.message.error('更新失败'); - }).finally(() => { - vueSelf.dataLoading = false; - }); - }, - onNegativeClick: () => { - } - }); - }, - listTestData() { - let data = []; - for (let i = 0; i < 100; i++) { - let d = { - userId: 'userId', - key: i + 1, - name: i + 'name', - distance: i, - baseScore: Math.floor(Math.random() * 100), - shouldReportCount: 30, - caseSingleScore: 2, - reportCount: Math.floor(Math.random() * 10), - reportScore: Math.floor(Math.random() * 10), - missReportCount: Math.floor(Math.random() * 10), - missReportScore: Math.floor(Math.random() * 10), - moreReportCount: Math.floor(Math.random() * 10), - moreReportScore: Math.floor(Math.random() * 10), - shouldButNo: Math.floor(Math.random() * 10), - reasonShouldButNo: '', - timeout: Math.floor(Math.random() * 10), - reasonTimeout: '', - maliciousChargeback: Math.floor(Math.random() * 10), - reasonMaliciousChargeback: '', - noDeductOthers: Math.floor(Math.random() * 10), - reasonNoDeductOthers: '', - overScore: Math.floor(Math.random() * 10), - superviseCount: Math.floor(Math.random() * 10), - reasonSuperviseCount: '', - superviseDeductScore: Math.floor(Math.random() * 10), - unCheckIn24Hours: Math.floor(Math.random() * 10), - fakeInfo: Math.floor(Math.random() * 10), - reasonFakeInfo: '', - handleOthers: Math.floor(Math.random() * 10), - reasonHandleOthers: '', - populationSave: Math.floor(Math.random() * 10), - reasonPopulationSave: '', - populationQuality: Math.floor(Math.random() * 10), - reasonPopulationQuality: '', - populationEdit: Math.floor(Math.random() * 10), - reasonPopulationEdit: '', - populationSpotCheck: Math.floor(Math.random() * 10), - reasonPopulationSpotCheck: '', - partySave: Math.floor(Math.random() * 10), - reasonPartySave: '', - partyQuality: Math.floor(Math.random() * 10), - reasonPartyQuality: '', - partyEdit: Math.floor(Math.random() * 10), - reasonPartyEdit: '', - partySpotCheck: Math.floor(Math.random() * 10), - reasonPartySpotCheck: '', - totalScore: Math.floor(Math.random() * 10), - shouldPay: Math.floor(Math.random() * 10), - actualPay: Math.floor(Math.random() * 10), - } - data.push({ - A: d.key, - B: d.name, - C: d.distance, - D: d.baseScore, - E: d.shouldReportCount, - F: d.caseSingleScore, - G: d.reportCount, - H: d.reportScore, - I: d.missReportCount, - J: d.missReportScore, - K: d.moreReportCount, - L: d.moreReportScore, - M: d.shouldButNo, - reasonM: d.reasonShouldButNo, - N: d.timeout, - reasonN: d.reasonTimeout, - O: d.maliciousChargeback, - reasonO: d.reasonMaliciousChargeback, - P: d.noDeductOthers, - reasonP: d.reasonNoDeductOthers, - Q: d.overScore, - R: d.superviseCount, - reasonR: d.reasonSuperviseCount, - S: d.superviseDeductScore, - T: d.unCheckIn24Hours, - U: d.fakeInfo, - reasonU: d.reasonFakeInfo, - V: d.handleOthers, - reasonV: d.reasonHandleOthers, - W: d.populationSave, - reasonW: d.reasonPopulationSave, - X: d.populationQuality, - reasonX: d.reasonPopulationQuality, - Y: d.populationEdit, - reasonY: d.reasonPopulationEdit, - Z: d.populationSpotCheck, - reasonZ: d.reasonPopulationSpotCheck, - AA: d.partySave, - reasonAA: d.reasonPartySave, - AB: d.partyQuality, - reasonAB: d.reasonPartyQuality, - AC: d.partyEdit, - reasonAC: d.reasonPartyEdit, - AD: d.partySpotCheck, - reasonAD: d.reasonPartySpotCheck, - AE: d.totalScore, - AF: d.shouldPay, - AG: d.actualPay, - }); - } - this.table.data = data; + onSearchClick() { + this.listData(); }, resize() { let body = document.body; @@ -1013,24 +909,70 @@ export default { this.table.maxHeight = body.clientHeight - 408; this.table.scrollX = body.clientWidth; }, + listArea() { + let vueSelf = this; + vueSelf.$axios.get(`api/kpi/list-area`, { + }).then(({data}) => { + let optionArray = []; + data.forEach((item, index) => { + optionArray.push({ + label: item.dictName, + value: item.dictId + }) + }) + vueSelf.search.select.area.options = optionArray; + }).catch(resp => { + vueSelf.message.error(resp.data.msg); + }) + }, + onAreaValueUpdate(value) { + this.listCommunity(value); + }, + listCommunity(areaId) { + let vueSelf = this; + vueSelf.search.select.community.value = null; + if(!areaId) { + vueSelf.search.select.community.options = []; + return; + } + vueSelf.$axios.get(`api/kpi/list-community/area-id/${areaId}`, { + }).then(({data}) => { + let optionArray = []; + data.forEach((item, index) => { + optionArray.push({ + label: item.communityName, + value: item.communityId + }) + }) + vueSelf.search.select.community.options = optionArray; + }).catch(resp => { + vueSelf.message.error(resp.data.msg); + }) + }, listData() { let vueSelf = this; vueSelf.dataLoading = true; vueSelf.$axios.get(`api/kpi/khxz/list-wgy`, { params: { + areaId: vueSelf.search.select.area.value, + communityId: vueSelf.search.select.community.value, khYear: vueSelf.search.select.year.value, khMonth: vueSelf.search.select.month.value, - wgyLevel: vueSelf.search.select.wgy.value + wgyLevel: vueSelf.search.select.wgy.value, + keywords: vueSelf.search.input.keywords } - }).then(resp => { - let data = resp.data; + }).then(({data}) => { data.forEach((item, index) => { item.A = index + 1; + item.F = item.E === 0 ? 0 : item.D / item.E; + item.H = item.F * item.G; + item.J = item.F * item.I; + item.L = (item.K > 10 ? 10 : item.K) * 0.5; + item.S = item.R * 0.2; }) this.table.data = data; - console.log(resp); - }).catch(resp => { - console.log(resp); + }).catch(({data}) => { + vueSelf.message.error(data.msg); }).finally(() => { vueSelf.dataLoading = false; }); @@ -1040,16 +982,15 @@ export default { this.search.select.year.value = getCurrentYear(); this.search.select.month.options = listMonth(); this.search.select.month.value = getCurrentMonth(); + this.listArea(); this.listData(); } }, computed() { - }, mounted() { let vueSelf = this; vueSelf.init(); - // vueSelf.listTestData(); vueSelf.resize(); window.onresize = this.resize; }