Commit 6e429f90 authored by menglingjun's avatar menglingjun

feat: 人员工资管理分页

parent 28e9e342
......@@ -36,16 +36,15 @@
<a-button-group>
<a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="changeBatch">批量修改</a-button>
<!-- <a-button @click="onDeleteBatch" type="danger">批量删除</a-button>-->
</a-button-group>
</div>
</div>
<div slot="footer" slot-scope="data">
<div v-if="total > 0" id="components-pagination-demo-mini" slot="footer" slot-scope="data">
{{ data.none }}
<a-pagination
@change="pageChange"
:current="query.page"
v-model="query.page"
show-less-items
:defaultPageSize="defaultPageSize"
:pageSizeOptions="$pageSizeOptions"
@showSizeChange="sizeChange"
......@@ -57,14 +56,22 @@
: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>
<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="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>
<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>{{ text}} RMB</template>
</span>
</a-table>
......@@ -90,6 +97,7 @@ export default {
data() {
return {
isFirstLoad: true,
page:1,
query: {
realname: "",
order: "",
......@@ -99,7 +107,6 @@ export default {
},
total: 0,
isEdit: false,
rowKey: "id",
index: -1,
loading: false,
......@@ -120,6 +127,7 @@ export default {
this.loadData();
},
reset() {
this.query.page = 1
this.query.realname = "";
this.loadData();
},
......@@ -138,39 +146,36 @@ export default {
this.loading = true;
getWagesPage(this.query).then(res => {
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
this.total = res.data.total;
this.dataSource = res.data.list;
let respData = res.data
this.dataSource = respData.list;
this.total = respData.total;
console.log(this.total)
}
this.loading = false;
})
},
handleChange(value, index) {
console.log(value)
const newData = [...this.dataSource];
const target = newData[index];
console.log(target)
if (target) {
target.wages = value;
this.dataSource = newData;
}
},
changeStatus(record, index) {
console.log("初始化点击编辑", record.disabled)
if (record.disabled) {
let a = [...this.dataSource]
a[index].disabled = false
this.dataSource = a;
console.log("取消后状态", record.disabled)
this.loadData()
} else {
let a = [...this.dataSource]
a[index].disabled = true
this.dataSource = a;
console.log("编辑后状态", record.disabled)
}
},
saveOne(index) {
let a = [...this.dataSource]
let saveData = {
id:a[index].id,
......@@ -191,9 +196,6 @@ export default {
this.query.order = setOrder(sorter.order);
this.loadData();
},
changeBatch() {
this.isEdit = true
},
updateSelect(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
......@@ -206,9 +208,6 @@ export default {
},
},
mounted() {
// 查询系统码表
// this.getSysCode();
//console.log(getWagesPage())
},
activated() {
......
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