mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
Optimize query blanks
This commit is contained in:
@@ -51,6 +51,8 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="dataLoading"
|
||||||
|
element-loading-text="加载中..."
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
:header-cell-style="{ background: 'aliceblue' }"
|
:header-cell-style="{ background: 'aliceblue' }"
|
||||||
@@ -153,7 +155,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { SIZE_ICON_SM, SIZE_ICON_XL } from '@/constants/Common.constants.js'
|
import { DATABASE_SELECT_OK, SIZE_ICON_SM, SIZE_ICON_XL } from '@/constants/Common.constants.js'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import 'element-plus/theme-chalk/el-message.css'
|
import 'element-plus/theme-chalk/el-message.css'
|
||||||
|
|
||||||
@@ -185,7 +187,7 @@ export default {
|
|||||||
attTime: ''
|
attTime: ''
|
||||||
},
|
},
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
|
dataLoading: true,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
@@ -226,43 +228,53 @@ export default {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.users = response.data.data
|
this.users = response.data.data
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {})
|
||||||
console.log(reportError)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 获取所有考勤信息
|
// 获取所有考勤信息
|
||||||
getAttendances() {
|
getAttendances() {
|
||||||
|
this.dataLoading = true
|
||||||
request
|
request
|
||||||
.get('/attendance/findAllAttendance')
|
.get('/attendance/findAllAttendance')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.tableData = response.data.data
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
|
this.dataLoading = false
|
||||||
|
this.tableData = response.data.data
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(reportError)
|
this.dataLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAttendancesByTime() {
|
getAttendancesByTime() {
|
||||||
const start = this.handleDateFormatUTC(this.attTime[0])
|
this.dataLoading = true
|
||||||
const end = this.handleDateFormatUTC(this.attTime[1])
|
if (this.attTime.length !== 0) {
|
||||||
request
|
const start = this.handleDateFormatUTC(this.attTime[0])
|
||||||
.get('/attendance/findAttendanceByTime', {
|
const end = this.handleDateFormatUTC(this.attTime[1])
|
||||||
startTime: start,
|
request
|
||||||
endTime: end
|
.get('/attendance/findAttendanceByTime', {
|
||||||
})
|
startTime: start,
|
||||||
.then((response) => {
|
endTime: end
|
||||||
this.tableData = response.data.data
|
|
||||||
ElMessage({
|
|
||||||
message: '查询成功',
|
|
||||||
type: 'success'
|
|
||||||
})
|
})
|
||||||
})
|
.then((response) => {
|
||||||
.catch((reportError) => {
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
console.log(reportError)
|
this.dataLoading = false
|
||||||
ElMessage({
|
this.tableData = response.data.data
|
||||||
message: '查询失败',
|
ElMessage({
|
||||||
type: 'error'
|
message: '查询成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
.catch((reportError) => {
|
||||||
|
this.dataLoading = false
|
||||||
|
ElMessage({
|
||||||
|
message: '查询失败',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.getAttendances()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handleDateFormatUTC(date) {
|
handleDateFormatUTC(date) {
|
||||||
let newFormat = ''
|
let newFormat = ''
|
||||||
@@ -303,12 +315,9 @@ export default {
|
|||||||
request
|
request
|
||||||
.post('/attendance/saveAttendance', formData)
|
.post('/attendance/saveAttendance', formData)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response)
|
|
||||||
this.getAttendances()
|
this.getAttendances()
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {})
|
||||||
console.log(reportError)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 获取更改数据
|
// 获取更改数据
|
||||||
viewUpdate(row) {
|
viewUpdate(row) {
|
||||||
@@ -344,7 +353,6 @@ export default {
|
|||||||
.delete('/attendance/delAttendance/' + id)
|
.delete('/attendance/delAttendance/' + id)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response) {
|
if (response) {
|
||||||
console.log(response)
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '删除成功',
|
message: '删除成功',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@@ -357,9 +365,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {})
|
||||||
console.log(reportError)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 批量删除
|
// 批量删除
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
@@ -384,9 +390,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {})
|
||||||
console.log(reportError)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="dataLoading"
|
||||||
|
element-loading-text="加载中..."
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
:header-cell-style="{ background: 'aliceblue' }"
|
:header-cell-style="{ background: 'aliceblue' }"
|
||||||
@@ -94,7 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { SIZE_ICON_SM, SIZE_ICON_XL } from '@/constants/Common.constants.js'
|
import { DATABASE_SELECT_OK, SIZE_ICON_SM, SIZE_ICON_XL } from '@/constants/Common.constants.js'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import 'element-plus/theme-chalk/el-message.css'
|
import 'element-plus/theme-chalk/el-message.css'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
@@ -108,7 +110,7 @@ export default {
|
|||||||
id: '',
|
id: '',
|
||||||
userId: '',
|
userId: '',
|
||||||
username: '',
|
username: '',
|
||||||
attTime: '',
|
attTime: [],
|
||||||
attTimeB: [],
|
attTimeB: [],
|
||||||
status: '',
|
status: '',
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -116,6 +118,7 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
nowTime: new Date(),
|
nowTime: new Date(),
|
||||||
formLabelWidth: '80px',
|
formLabelWidth: '80px',
|
||||||
|
dataLoading: true,
|
||||||
value1: '',
|
value1: '',
|
||||||
form: {
|
form: {
|
||||||
userId: '',
|
userId: '',
|
||||||
@@ -162,35 +165,49 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getOneAttendancesByTime() {
|
getOneAttendancesByTime() {
|
||||||
const start = this.handleDateFormatUTC(this.attTimeB[0])
|
this.dataLoading = true
|
||||||
const end = this.handleDateFormatUTC(this.attTimeB[1])
|
if (this.attTimeB.length !== 0) {
|
||||||
request
|
const start = this.handleDateFormatUTC(this.attTimeB[0])
|
||||||
.get('/attendance/findOneAttendanceByTime', {
|
const end = this.handleDateFormatUTC(this.attTimeB[1])
|
||||||
startTime: start,
|
request
|
||||||
endTime: end
|
.get('/attendance/findOneAttendanceByTime', {
|
||||||
})
|
startTime: start,
|
||||||
.then((response) => {
|
endTime: end
|
||||||
this.tableData = response.data.data
|
|
||||||
ElMessage({
|
|
||||||
message: '查询成功',
|
|
||||||
type: 'success'
|
|
||||||
})
|
})
|
||||||
})
|
.then((response) => {
|
||||||
.catch((reportError) => {
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
ElMessage({
|
this.dataLoading = false
|
||||||
message: '查询失败',
|
this.tableData = response.data.data
|
||||||
type: 'error'
|
ElMessage({
|
||||||
|
message: '查询成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.getAttendancesByUserId()
|
.catch((reportError) => {
|
||||||
})
|
this.dataLoading = false
|
||||||
|
ElMessage({
|
||||||
|
message: '查询失败',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.getAttendancesByUserId()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getAttendancesByUserId() {
|
getAttendancesByUserId() {
|
||||||
|
this.dataLoading = true
|
||||||
request
|
request
|
||||||
.get('/attendance/selectAttendance')
|
.get('/attendance/selectAttendance')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.tableData = response.data.data
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
|
this.dataLoading = false
|
||||||
|
this.tableData = response.data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((reportError) => {
|
||||||
|
this.dataLoading = false
|
||||||
})
|
})
|
||||||
.catch((reportError) => {})
|
|
||||||
},
|
},
|
||||||
resetForm() {
|
resetForm() {
|
||||||
this.$refs.form.resetFields()
|
this.$refs.form.resetFields()
|
||||||
|
|||||||
Reference in New Issue
Block a user