Commit 3f51b6fd authored by shangtx's avatar shangtx

feat: 工时报表基础功能

parent 0593298d
import {axios} from '@/util/axios/request';
const baseUrl = {
// 工时
taskEstimate: '/task-estimate',
};
export function getPage(parameter) {
return axios({
url: `${baseUrl.taskEstimate}/consumed-page`,
method: 'post',
data: parameter,
useFullLoading: true
})
}
\ No newline at end of file
<template>
<a-card class="cust-list-cart">
<div>
<a-form layout="horizontal" class="ant-advanced-search-form">
<div>
<a-row>
<a-col :span="6">
<a-form-item
label="用户名"
:labelCol="{ span: 8 }"
:wrapperCol="{ span: 16 }"
>
<a-input
@pressEnter="search"
style="width: 100%"
v-model="query.userName"
placeholder="请输入"
/>
</a-form-item>
</a-col>
</a-row>
</div>
</a-form>
</div>
<div>
<a-table
size="middle"
@change="sortChange"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:rowKey="rowKey"
:loading="loading"
bordered
>
<!-- <template v-for="">-->
<!-- </template>-->
<div slot="title" slot-scope="data">
<span class="cust-title">
<a-icon type="hdd" />工时列表{{ data.none }}
</span>
<div class="cust-table-operator">
<a-button-group>
<a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-button-group>
</div>
</div>
<div slot="footer" slot-scope="data">
{{ data.none }}
<a-pagination
@change="pageChange"
:current="query.page"
:defaultPageSize="defaultPageSize"
:pageSizeOptions="$pageSizeOptions"
@showSizeChange="sizeChange"
class="cust-pagination"
size="small"
:total="total"
showSizeChanger
showQuickJumper
:showTotal="$showTotal"
/>
</div>
<span slot="action" slot-scope="text, record, index">
<a-button
size="small"
style="margin-right: 20px"
@click="changeStatus(record, index)"
:disabled="isEdit"
v-if="!record.disabled"
><span style="font-size: 8px">编辑</span></a-button
>
<a-button
size="small"
style="margin-right: 20px"
@click="changeStatus(record, index)"
v-if="record.disabled"
><span style="font-size: 8px">取消</span></a-button
>
</span>
<span slot="wages" slot-scope="text, record, index" :key="record.id">
<a-input-number
style="width: 200px"
v-if="record.disabled || isEdit"
@change="(e) => handleChange(e, index, 'wages')"
:defaultValue="text"
></a-input-number>
<template v-else>{{ text }} RMB</template>
</span>
</a-table>
</div>
</a-card>
</template>
<script>
import { getPage } from "@/api/task/task";
import { humpToLine, setOrder } from "@/util/util";
const dataSource = [];
const columns = [
{
title: "姓名",
dataIndex: "userName",
customRender: (value, row) => {
const obj = {
children: value,
attrs: {},
};
obj.attrs.rowSpan = row.rowspan;
return obj;
},
},
{ title: "项目", dataIndex: "projectName" },
];
const totalCol = { title: "合计", dataIndex: "total",align: 'right' };
// 1日到28日
for (let i = 1; i <= 28; i++) {
columns.push({
title: i,
dataIndex: `d${i}`,
align: 'right'
});
}
// 29到31日
for (let i = 29; i <= 31; i++) {
columns.push({
title: i,
align: 'right',
dataIndex: `d${i}`,
/* customRender: (value) => {
const obj = {
children: value,
attrs: {},
};
return obj;
}, */
});
}
columns.push(totalCol);
export default {
name: "TaskEstimateList",
data() {
return {
isFirstLoad: true,
query: {
userName: "",
month: "",
sort: "",
page: 1,
size: 10,
},
dayOfTheMonth: 31,
total: 0,
isEdit: false,
rowKey: "id",
index: -1,
loading: false,
columns: columns,
dataSource: dataSource,
};
},
computed: {
defaultPageSize: function () {
return this.$defaultPageSize();
},
},
methods: {
search() {
this.query.page = 1;
this.loadData();
},
reset() {
this.query.userName = "";
this.loadData();
},
pageChange(page) {
this.query.page = page;
this.loadData();
},
sizeChange(current, size) {
this.query.size = size;
this.loadData();
},
loadData(pageSize) {
if (pageSize && !isNaN(pageSize)) {
this.query.size = pageSize;
}
this.loading = true;
getPage(this.query).then((res) => {
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
this.total = res.data.total;
this.dataSource = res.data.list;
}
this.loading = false;
});
},
sortChange(pagination, filters, sorter) {
this.query.sort = humpToLine(sorter.field);
this.query.order = setOrder(sorter.order);
this.loadData();
},
changeBatch() {},
onCtDateChange(date, dateString) {
this.ctDatePicker = date;
this.query.ctDateBegin = dateString[0];
this.query.ctDateEnd = dateString[1];
this.loadData();
},
},
mounted() {},
activated() {
if (this.isFirstLoad == true) {
this.loadData(this.defaultPageSize);
this.isFirstLoad = false;
} else {
let isModify = this.$route.query.isModify;
if (isModify == true) {
this.loadData();
} else if (isModify != undefined) {
this.loadData();
}
}
},
};
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<keep-alive v-if="keepAlive">
<router-view />
</keep-alive>
<router-view v-else />
</template>
<script>
export default {
name: "TaskEstimateRouteView",
computed: {
keepAlive () {
return this.$route.meta.keepAlive
}
},
}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment