Commit 6e429f90 authored by menglingjun's avatar menglingjun

feat: 人员工资管理分页

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