Commit 77e3ad9d authored by menglingjun's avatar menglingjun

feat: 项目款项管理

parent 642d62e4
import {axios} from '@/util/axios/request'
const api = {
baseUrl:'/project/charge/',
}
export default api
export function getPage(parameter) {
return axios({
url: api.baseUrl+"page",
method: 'post',
data: parameter,
useFullLoading: true
})
}
export function saveUserWages(parameter) {
return axios({
url: api.ztUserUrl,
method: 'post',
data: parameter,
useFullLoading: true
})
}
export function updateStatus(id) {
return axios({
url: api.baseUrl+"statistics/status/"+id,
method: 'get',
useFullLoading: true
})
}
......@@ -74,7 +74,7 @@
@change="e=>handleChange(e, index, 'wages')"
:defaultValue="text"
></a-input-number>
<template v-else> {{ text}} RMB</template>
<template v-else> <h1>{{ text}} </h1> </template>
</span>
</a-table>
......@@ -84,15 +84,16 @@
<script>
import {getWagesPage,saveUserWages,updateStatus} from "@/api/personnel/wages";
import {humpToLine, setOrder} from "@/util/util";
import {humpToLine, setOrder,formatDate} from "@/util/util";
const dataSource = []
const columns = [
{title: '账号', width: 160, dataIndex: 'account', align: 'center'},
{title: '邮箱', width: 200, dataIndex: 'email', align: 'center'},
{title: '真实姓名', width: 120, dataIndex: 'realname', align: 'center'},
{title: '真实姓名', width: 120, dataIndex: 'realname', align: 'center',},
{title: '入职时间', width: 120, dataIndex: 'join', align: 'center',customRender:(text)=>formatDate(new Date(text),"yyyy-MM-dd")},
{title: '是否统计', width: 120, dataIndex: 'statisticsStatus', align: 'center',scopedSlots: {customRender: 'statisticsStatus'}},
{title: '工资', dataIndex: 'wages', align: 'right', scopedSlots: {customRender: 'wages'}},
{title: '工资(RMB)', dataIndex: 'wages', align: 'right', scopedSlots: {customRender: 'wages'}},
{title: '操作', key: 'operation', width: 150, scopedSlots: {customRender: 'action'}, align: 'center'}
]
......
<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.realname" 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"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}"
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 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 size="small" style="margin-right: 20px" @click="changeStatus(record,index)" 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>
<a-button type="primary" v-if="record.disabled" @click="saveOne(index)" size="small"><span style="font-size: 8px">保存</span></a-button>
</span>
<span slot="statisticsStatus" slot-scope="text,record,index">
<!-- <a-button size="small" style="margin-right: 20px" @click="changeStatisticsStatus(record)"><span style="font-size: 8px">{{text==0?"否":"是"}}</span></a-button>-->
<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>
<!-- <span v-if="record.end>new Date()">{{text=='wait'?'未开始':'进行中'}}</span>-->
<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, '')"
v-if="record.disabled"
@change="e=>handleChange(e, index, 'wages')"
:defaultValue="text"
></a-input-number>
<template v-else> <h1>{{ text}} </h1> </template>
</span>
</a-table>
</div>
</a-card>
</template>
<script>
import {saveUserWages,updateStatus} from "@/api/personnel/wages";
import {getPage} from "@/api/project/projectCharge";
import {humpToLine, setOrder} from "@/util/util";
const dataSource = []
const columns = [
{title: '项目名', width: 300, dataIndex: 'name', align: 'left'},
{title: '代码', width: 180, dataIndex: 'code', align: 'left'},
// {title: '描述', dataIndex: 'desc', align: 'center'},
{title: '状态',width: 120,dataIndex: 'status', align: 'center',scopedSlots: {customRender: 'status'}},
{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 {
name: 'projectChargeLsit',
data() {
return {
isFirstLoad: true,
page:1,
query: {
name: "",
status: "",
order: "",
sort: "",
page: 1,
size: 10,
},
total: 0,
rowKey: "id",
index: -1,
loading: false,
columns: columns,
dataSource: dataSource,
selectedRowKeys: [],
selectedRows: [],
}
},
computed: {
defaultPageSize: function () {
return this.$defaultPageSize()
}
},
methods: {
search() {
this.query.page = 1
this.loadData();
},
reset() {
this.query.page = 1
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();
},
loadData(pageSize) {
if (pageSize && !isNaN(pageSize)) {
this.query.size = pageSize
}
getPage(this.query).then(res => {
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = res.data
this.dataSource = respData.list;
this.total = respData.total
}
this.loading = false;
})
},
handleChange(value, index) {
const newData = [...this.dataSource];
const target = newData[index];
if (target) {
target.wages = value;
this.dataSource = newData;
}
},
changeStatus(record, index) {
if (record.disabled) {
let a = [...this.dataSource]
a[index].disabled = false
this.dataSource = a;
this.loadData()
} else {
let a = [...this.dataSource]
a[index].disabled = true
this.dataSource = a;
}
},
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,
wages:a[index].wages,
}
saveUserWages(saveData).then(resp =>{
if (resp &&resp.code == SYS_CONST.REQUEST.SUCCEED){
this.$notification.success({message: '系统提示', description: "保存成功", duration: 4,});
this.loadData()
}
})
a[index].disabled = false
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() {
},
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>
.warning-red{
color: red;
}
</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: "ProjectChargeRouteView",
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