Commit 7f05b1a3 authored by shangtx's avatar shangtx

Merge branch 'dev' of http://git.antaikeji.top/zentao/zentao-view into dev

parents 7376f0d4 5f2ad73b
import {axios} from '@/util/axios/request';
const api = {
staffDailyReport: '/report/staff/daily',
projectCostReport: '/report/project/cost',
};
export function getStaffDailyReport(parameter) {
return axios({
url: api.staffDailyReport,
method: 'post',
data: parameter,
useFullLoading: true
})
}
export function getProjectCostReport(parameter) {
return axios({
url: api.projectCostReport,
method: 'post',
data: parameter,
useFullLoading: true
})
}
\ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
:rowKey="rowKey" :rowKey="rowKey"
:pagination="false" :pagination="false"
bordered bordered
:scroll="{y: clientHeight }"
> >
<div slot="title" slot-scope="data"> <div slot="title" slot-scope="data">
<span class="cust-title"> <span class="cust-title">
...@@ -127,7 +128,8 @@ export default { ...@@ -127,7 +128,8 @@ export default {
total: 0, total: 0,
detailData: {}, detailData: {},
isShow: false, isShow: false,
isEdit: false isEdit: false,
clientHeight: 0
} }
}, },
computed: { computed: {
...@@ -267,6 +269,7 @@ export default { ...@@ -267,6 +269,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.clientHeight = document.body.clientHeight-250;
this.initYears() this.initYears()
this.getHolidayType() this.getHolidayType()
if (this.isFirstLoad == true) { if (this.isFirstLoad == true) {
......
...@@ -249,7 +249,4 @@ export default { ...@@ -249,7 +249,4 @@ export default {
</script> </script>
<style scoped> <style scoped>
.cust-pagination{
margin-top: 5px!important;
}
</style> </style>
\ No newline at end of file
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</a-button-group> </a-button-group>
</div> </div>
</div> </div>
<div v-if="total > 0" id="components-pagination-demo-mini" slot="footer" slot-scope="data"> <div v-if="total > 0" slot="footer" slot-scope="data">
{{ data.none }} {{ data.none }}
<a-pagination <a-pagination
@change="pageChange" @change="pageChange"
...@@ -264,11 +264,4 @@ export default { ...@@ -264,11 +264,4 @@ export default {
</script> </script>
<style scoped> <style scoped>
.warning-red {
color: red;
}
.cust-pagination{
margin-top: 5px!important;
}
</style> </style>
\ No newline at end of file
<template> <template>
<a-card class="cust-list-cart"> <a-card class="cust-list-cart">
<div> <!-- <div>
<a-form layout="horizontal" class="ant-advanced-search-form"> <a-form layout="horizontal" class="ant-advanced-search-form">
<div> <div>
<a-row> <a-row>
<a-col :span="6"> <a-col :span="6">
<a-form-item label="用户名" :labelCol="{span: 8}" :wrapperCol="{span: 16}"> <a-form-item
<a-input @pressEnter="search" style="width: 100%" v-model="query.realname" placeholder="请输入"/> label="用户名"
:labelCol="{ span: 8 }"
:wrapperCol="{ span: 16 }"
>
<a-input
@pressEnter="search"
style="width: 100%"
v-model="query.realname"
placeholder="请输入"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</a-form> </a-form>
</div> </div> -->
<div> <div>
<a-table <a-table
size="middle" size="middle"
@change="sortChange" :columns="columns"
:columns="columns" :dataSource="dataSource"
:dataSource="dataSource" :pagination="false"
:pagination="false" :rowKey="rowKey"
:rowKey="rowKey" :loading="loading"
:loading="loading" bordered
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}"
bordered
> >
<div slot="title" slot-scope="data"> <div slot="title" slot-scope="data">
<span class="cust-title"> <span class="cust-title">
<a-icon type="hdd"/>项目工时成本表{{ data.none }} <a-icon type="hdd" />项目工时成本表{{ data.none }}
</span> </span>
<div class="cust-table-operator"> <div class="cust-table-operator">
<a-button-group> <!-- <a-button-group>
<a-button type="primary" @click="search">查询</a-button> <a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
</a-button-group> </a-button-group> -->
</div> </div>
</div> </div>
<div v-if="total > 0" id="components-pagination-demo-mini" slot="footer" slot-scope="data">
{{ data.none }}
<a-pagination
@change="pageChange"
v-model="query.page"
show-less-items
: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 type="primary" v-if="record.changed" @click="saveOne(index)" size="small"><span style="font-size: 8px">保存</span></a-button>-->
<a-icon type="edit" v-if="record.changed" @click="saveOne(index)"/>
<a-icon v-else type="check-circle" theme="twoTone" two-tone-color="#52c41a"/>
</span>
<span slot="statisticsStatus" slot-scope="text,record,index">
<a-switch
checked-children="是"
un-checked-children="否"
:checked="text ===1"
@click="changeStatisticsStatus(record,index)" default-checked/>
</span>
<span slot="status" slot-scope="text,record">
<a-tag v-if="record.end>new Date()"
:color="text=='wait'?'green':'blue'">{{ text == 'wait' ? '未开始' : '进行中' }}</a-tag>
<a-tag color="red" v-else>已过期</a-tag>
</span>
<span slot="wages" slot-scope="text, record,index" :key="record.id">
<a-input-number
style="width: 200px"
:precision='2'
:formatter="value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
:parser="value => value.replace(/\$\s?|(,*)/g, '')"
@change="e=>handleChange(e, index)"
v-model ='record.charge'
></a-input-number>
</span>
</a-table> </a-table>
</div> </div>
</a-card> </a-card>
</template> </template>
<script> <script>
import {getPage, updateStatus,saveProjectCharge} from "@/api/project/projectCharge"; import { getProjectCostReport } from "@/api/report/report";
import {humpToLine, setOrder} from "@/util/util";
const dataSource = [] const dataSource = [];
const columns = [ const columns = [
{title: '项目名', width: 300, dataIndex: 'name', align: 'left'}, { title: "名称", width: 300, dataIndex: "name", align: "left" },
{title: '代码', width: 180, dataIndex: 'code', align: 'left'}, { title: "工时", width: 100, dataIndex: "hours", align: "right" },
// {title: '描述', dataIndex: 'desc', align: 'center'},
{title: '状态', width: 120, dataIndex: 'status', align: 'center', scopedSlots: {customRender: 'status'}},
{ {
title: '是否统计', title: "标准工时成本",
width: 120, width: 100,
dataIndex: 'statisticsStatus', dataIndex: "baseHoursCost",
align: 'center', align: "right",
scopedSlots: {customRender: 'statisticsStatus'} }
}, ];
{title: '项目款项(RMB)', dataIndex: 'charge', align: 'right', scopedSlots: {customRender: 'wages'}},
{title: '操作', key: 'operation', width: 150, scopedSlots: {customRender: 'action'}, align: 'center'}
]
export default { export default {
name: 'projectCostReportList', name: "projectCostReportList",
data() { data() {
return { return {
isFirstLoad: true, isFirstLoad: true,
page: 1,
query: { query: {
name: "", name: ""
status: "",
order: "",
sort: "",
page: 1,
size: 10,
}, },
rowKey: "key",
total: 0,
rowKey: "id",
index: -1, index: -1,
loading: false, loading: false,
columns: columns, columns: columns,
dataSource: dataSource, dataSource: dataSource
selectedRowKeys: [], };
selectedRows: [],
}
},
computed: {
defaultPageSize: function () {
return this.$defaultPageSize()
}
}, },
methods: { methods: {
search() { search() {
this.query.page = 1
this.loadData(); this.loadData();
}, },
reset() { reset() {
this.query.page = 1
this.query.name = ""; this.query.name = "";
this.query.status = "";
this.loadData(); this.loadData();
}, },
pageChange(page) { loadData() {
this.query.page = page; getProjectCostReport(this.query).then((resp) => {
this.loadData(); if (resp && resp.code == SYS_CONST.REQUEST.SUCCEED) {
}, let list = resp.data;
sizeChange(current, size) { for (var i = 0; i < list.length; i++) {
this.query.size = size; let project = list[i];
this.loadData(); if (project.children.length > 0) {
}, let staffList = project.children;
loadData(pageSize) { for (var j = 0; j < staffList.length; j++) {
if (pageSize && !isNaN(pageSize)) { delete staffList[j].children;
this.query.size = pageSize }
}
getPage(this.query).then(res => {
console.log(11111)
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = res.data
let list = respData.list
for (let i = 0; i < list.length; i++) {
if (!list[i].charge) {
list[i].charge = 0
} }
list[i].orgCharge = respData.list[i].charge
} }
this.dataSource = list; this.dataSource = resp.data;
this.total = respData.total
} }
this.loading = false; this.loading = false;
}) });
}, },
handleChange(value, index) {
const newData = [...this.dataSource];
const target = newData[index];
if (target) {
target.charge = value;
newData[index].changed = target.orgCharge != target.charge
this.dataSource = newData;
}
},
changeStatisticsStatus(record, index) {
updateStatus(record.id).then(response => {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
let a = [...this.dataSource]
a[index].statisticsStatus = response.data
this.dataSource = a;
}
})
},
saveOne(index) {
let a = [...this.dataSource]
let saveData = {
id: a[index].id,
charge: a[index].charge,
}
saveProjectCharge(saveData).then(resp => {
if (resp && resp.code == SYS_CONST.REQUEST.SUCCEED) {
this.$notification.success({message: '系统提示', description: "保存成功", duration: 4,});
this.loadData()
}
})
this.dataSource = a;
},
sortChange(pagination, filters, sorter) {
this.query.sort = humpToLine(sorter.field);
this.query.order = setOrder(sorter.order);
this.loadData();
},
updateSelect(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onCtDateChange(date, dateString) {
this.ctDatePicker = date;
this.query.ctDateBegin = dateString[0]
this.query.ctDateEnd = dateString[1]
this.loadData()
},
},
mounted() {
}, },
mounted() {},
activated() { activated() {
if (this.isFirstLoad == true) { this.loadData();
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> </script>
<style scoped> <style scoped>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<div> <div>
<a-row> <a-row>
<a-col :span="6"> <a-col :span="6">
<a-form-item label="用户名" :labelCol="{span: 8}" :wrapperCol="{span: 16}"> <a-form-item label="日期" :labelCol="{span: 8}" :wrapperCol="{span: 16}">
<a-input @pressEnter="search" style="width: 100%" v-model="query.realname" placeholder="请输入"/> <a-date-picker v-model="query.date" :allowClear="false"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
<div> <div>
<a-table <a-table
size="middle" size="middle"
@change="sortChange"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="false" :pagination="false"
:rowKey="rowKey" :rowKey="rowKey"
:loading="loading" :loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}" :scroll="{ y: tableHeight }"
bordered bordered
> >
<div slot="title" slot-scope="data"> <div slot="title" slot-scope="data">
...@@ -36,49 +35,7 @@ ...@@ -36,49 +35,7 @@
</a-button-group> </a-button-group>
</div> </div>
</div> </div>
<div v-if="total > 0" id="components-pagination-demo-mini" slot="footer" slot-scope="data"> <div slot="detail" slot-scope="text" v-html="text" style="color:blue"> {{ text }}</div>
{{ data.none }}
<a-pagination
@change="pageChange"
v-model="query.page"
show-less-items
: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 type="primary" v-if="record.changed" @click="saveOne(index)" size="small"><span style="font-size: 8px">保存</span></a-button>-->
<a-icon type="edit" v-if="record.changed" @click="saveOne(index)"/>
<a-icon v-else type="check-circle" theme="twoTone" two-tone-color="#52c41a"/>
</span>
<span slot="statisticsStatus" slot-scope="text,record,index">
<a-switch
checked-children="是"
un-checked-children="否"
:checked="text ===1"
@click="changeStatisticsStatus(record,index)" default-checked/>
</span>
<span slot="status" slot-scope="text,record">
<a-tag v-if="record.end>new Date()"
:color="text=='wait'?'green':'blue'">{{ text == 'wait' ? '未开始' : '进行中' }}</a-tag>
<a-tag color="red" v-else>已过期</a-tag>
</span>
<span slot="wages" slot-scope="text, record,index" :key="record.id">
<a-input-number
style="width: 200px"
:precision='2'
:formatter="value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
:parser="value => value.replace(/\$\s?|(,*)/g, '')"
@change="e=>handleChange(e, index)"
v-model ='record.charge'
></a-input-number>
</span>
</a-table> </a-table>
</div> </div>
...@@ -86,163 +43,52 @@ ...@@ -86,163 +43,52 @@
</template> </template>
<script> <script>
import {getPage, updateStatus,saveProjectCharge} from "@/api/project/projectCharge"; import {getStaffDailyReport} from "@/api/report/report";
import {humpToLine, setOrder} from "@/util/util"; import moment from 'moment';
const dataSource = []
const columns = [ const columns = [
{title: '项目名', width: 300, dataIndex: 'name', align: 'left'}, {title: '日期', width: 100, dataIndex: 'date', align: 'center'},
{title: '代码', width: 180, dataIndex: 'code', align: 'left'}, {title: '姓名', width: 180, dataIndex: 'name', align: 'left'},
// {title: '描述', dataIndex: 'desc', align: 'center'}, {title: '登记工时', width: 100, dataIndex: 'hours', align: 'right'},
{title: '状态', width: 120, dataIndex: 'status', align: 'center', scopedSlots: {customRender: 'status'}}, {title: '工作详情', dataIndex: 'detail', align: 'left',scopedSlots: { customRender: 'detail' },},
{ {title: '剩余工时', width: 100,dataIndex: 'leftHours', align: 'right'}
title: '是否统计',
width: 120,
dataIndex: 'statisticsStatus',
align: 'center',
scopedSlots: {customRender: 'statisticsStatus'}
},
{title: '项目款项(RMB)', dataIndex: 'charge', align: 'right', scopedSlots: {customRender: 'wages'}},
{title: '操作', key: 'operation', width: 150, scopedSlots: {customRender: 'action'}, align: 'center'}
] ]
export default { export default {
name: 'StaffDailyReportList', name: 'StaffDailyReportList',
data() { data() {
return { return {
isFirstLoad: true,
page: 1,
query: { query: {
name: "", date: moment()
status: "",
order: "",
sort: "",
page: 1,
size: 10,
}, },
total: 0,
rowKey: "id", rowKey: "id",
index: -1,
loading: false, loading: false,
columns: columns, columns: columns,
dataSource: dataSource, tableHeight: document.documentElement.clientHeight-210,
selectedRowKeys: [], dataSource: []
selectedRows: [],
}
},
computed: {
defaultPageSize: function () {
return this.$defaultPageSize()
} }
}, },
methods: { methods: {
search() { search() {
this.query.page = 1
this.loadData(); this.loadData();
}, },
reset() { reset() {
this.query.page = 1 this.query.date = "";
this.query.name = "";
this.query.status = "";
this.loadData();
},
pageChange(page) {
this.query.page = page;
this.loadData();
},
sizeChange(current, size) {
this.query.size = size;
this.loadData(); this.loadData();
}, },
loadData(pageSize) { loadData() {
if (pageSize && !isNaN(pageSize)) { getStaffDailyReport({date:this.query.date.format("YYYY-MM-DD")}).then(resp=>{
this.query.size = pageSize
}
getPage(this.query).then(res => {
console.log(11111)
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = res.data
let list = respData.list
for (let i = 0; i < list.length; i++) {
if (!list[i].charge) {
list[i].charge = 0
}
list[i].orgCharge = respData.list[i].charge
}
this.dataSource = list;
this.total = respData.total
}
this.loading = false;
})
},
handleChange(value, index) {
const newData = [...this.dataSource];
const target = newData[index];
if (target) {
target.charge = value;
newData[index].changed = target.orgCharge != target.charge
this.dataSource = newData;
}
},
changeStatisticsStatus(record, index) {
updateStatus(record.id).then(response => {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
let a = [...this.dataSource]
a[index].statisticsStatus = response.data
this.dataSource = a;
}
})
},
saveOne(index) {
let a = [...this.dataSource]
let saveData = {
id: a[index].id,
charge: a[index].charge,
}
saveProjectCharge(saveData).then(resp => {
if (resp && resp.code == SYS_CONST.REQUEST.SUCCEED) { if (resp && resp.code == SYS_CONST.REQUEST.SUCCEED) {
this.$notification.success({message: '系统提示', description: "保存成功", duration: 4,}); this.dataSource = resp.data;
this.loadData()
} }
}) })
this.dataSource = a; }
},
sortChange(pagination, filters, sorter) {
this.query.sort = humpToLine(sorter.field);
this.query.order = setOrder(sorter.order);
this.loadData();
},
updateSelect(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onCtDateChange(date, dateString) {
this.ctDatePicker = date;
this.query.ctDateBegin = dateString[0]
this.query.ctDateEnd = dateString[1]
this.loadData()
},
}, },
mounted() { mounted() {
}, },
activated() { activated() {
if (this.isFirstLoad == true) { this.loadData()
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> </script>
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
} }
}, },
activated() { activated() {
this.$form.resetFields() this.form.resetFields()
this.selectedRowKeys = [] this.selectedRowKeys = []
this.initData() this.initData()
}, },
......
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