123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <div class="tableBox">
- <div class="table" ref="tableRef">
- <el-table
- stripe
- :data="dataSource"
- style="width: 100%; height: 100%"
- :style="{ height: tableHeight + 'px' }"
- v-loading="loading"
- :header-cell-style="{
- background: '#E5F0FB',
- color: '#233755',
- height: '50px'
- }"
- >
- <el-table-column label="序号" width="60" align="center">
- <template #default="scope">{{ scope.$index + 1 }}</template>
- </el-table-column>
- <el-table-column prop="nickName" label="人员" width="120" />
- <el-table-column :show-overflow-tooltip="true" prop="deptName" label="部门" width="200" />
- <el-table-column :show-overflow-tooltip="true" prop="xmmc" label="项目名称" />
- <el-table-column prop="xmbh" label="项目编号" width="250" />
- <el-table-column prop="workTime" label="项目工时(小时)" width="180" align="center" />
- </el-table>
- </div>
- <div class="pageBox">
- <el-pagination
- :page-size="20"
- background
- layout="total, prev, pager, next"
- :total="pageTotal"
- :current-page="pageNo"
- @current-change="currentChange"
- />
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import moment from 'moment'
- import request from '@/config/axios'
- import PubsubService from '@/utils/PubsubService'
- const loading = ref(false)
- const dataSource = ref([])
- const pageNo = ref(1)
- const pageTotal = ref(0)
- const tableRef: any = ref(null)
- const tableHeight: any = ref(0)
- onMounted(() => {
- tableHeight.value = tableRef.value.clientHeight
- // 接收查询事件
- PubsubService.subscribe('xmgstj-form-onSearch', (params) => {
- getDataSource(params)
- })
- getDataSource()
- })
- const { push } = useRouter()
- // 查看详情
- const jumpToDetail = (row: any) => {
- push(`/customerDetail`)
- }
- // 获取数据
- const getDataSource = (params?) => {
- loading.value = true
- request
- .get({
- url: '/adm/reportWorkloadStatistics/query-workload-statistics',
- params: {
- year: params?.year ?? moment().format('YYYY'),
- month: params?.month ?? moment().format('M'),
- userId: params?.userId ?? '',
- deptId: params?.deptId ? [params.deptId] : [],
- projectName: params?.projectName ?? '',
- pageNo: pageNo.value,
- pageSize: 20
- }
- })
- .then((res) => {
- ElMessage.success(`数据查询成功`)
- loading.value = false
- const { list, total } = res
- dataSource.value = list
- pageTotal.value = total
- pageNo.value = 1
- })
- .catch(() => {
- ElMessage.error('查询失败,请稍后重试!')
- loading.value = false
- })
- }
- // 切换页面
- const currentChange = (page) => {
- pageNo.value = page
- getDataSource()
- }
- </script>
- <style scoped lang="scss">
- .titleBox {
- display: flex;
- justify-content: space-between;
- line-height: 60px;
- }
- .tableBox {
- margin-top: 0;
- }
- </style>
|