Commit dbadb4d9 authored by menglingjun's avatar menglingjun

feat: 项目款项管理

parent 77e3ad9d
......@@ -15,9 +15,9 @@ export function getPage(parameter) {
})
}
export function saveUserWages(parameter) {
export function saveProjectCharge(parameter) {
return axios({
url: api.ztUserUrl,
url: api.baseUrl,
method: 'post',
data: parameter,
useFullLoading: true
......
......@@ -56,30 +56,31 @@
: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>
<!-- <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-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 />
<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 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'
: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')"
@change="e=>handleChange(e, index)"
:defaultValue="text"
></a-input-number>
<template v-else> <h1>{{ text}} </h1> </template>
</span>
</a-table>
......@@ -88,8 +89,7 @@
</template>
<script>
import {saveUserWages,updateStatus} from "@/api/personnel/wages";
import {getPage} from "@/api/project/projectCharge";
import {getPage, updateStatus,saveProjectCharge} from "@/api/project/projectCharge";
import {humpToLine, setOrder} from "@/util/util";
const dataSource = []
......@@ -97,8 +97,14 @@ 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: '状态', 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'}
]
......@@ -108,7 +114,7 @@ export default {
data() {
return {
isFirstLoad: true,
page:1,
page: 1,
query: {
name: "",
status: "",
......@@ -157,9 +163,17 @@ export default {
this.query.size = pageSize
}
getPage(this.query).then(res => {
console.log(11111)
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = res.data
this.dataSource = respData.list;
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
}
......@@ -170,25 +184,14 @@ export default {
const newData = [...this.dataSource];
const target = newData[index];
if (target) {
target.wages = value;
target.charge = value;
newData[index].changed = target.orgCharge != target.charge
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){
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;
......@@ -199,18 +202,16 @@ export default {
saveOne(index) {
let a = [...this.dataSource]
let saveData = {
id:a[index].id,
wages:a[index].wages,
id: a[index].id,
charge: a[index].charge,
}
saveUserWages(saveData).then(resp =>{
if (resp &&resp.code == SYS_CONST.REQUEST.SUCCEED){
saveProjectCharge(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);
......@@ -232,6 +233,7 @@ export default {
},
activated() {
this.form.resetFields()
if (this.isFirstLoad == true) {
this.loadData(this.defaultPageSize)
this.isFirstLoad = false
......@@ -249,7 +251,7 @@ export default {
</script>
<style scoped>
.warning-red{
.warning-red {
color: red;
}
}
</style>
\ No newline at end of file
......@@ -119,7 +119,7 @@
}
},
activated() {
this.form.resetFields()
this.$form.resetFields()
this.selectedRowKeys = []
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