Commit 29f69031 authored by menglingjun's avatar menglingjun

feat: table高度固定

parent 1fc6591e
......@@ -16,6 +16,7 @@
<div>
<a-table
size="middle"
:scroll="{ y: webHeight }"
@change="sortChange"
:columns="columns"
:dataSource="dataSource"
......@@ -56,9 +57,11 @@
: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-icon type="edit" v-if="record.changed" @click="saveOne(index)"/>
<a-icon v-else type="check-circle" theme="twoTone" two-tone-color="#52c41a"/>
<!-- <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>-->
......@@ -67,14 +70,9 @@
<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"
v-model='record.wages'
></a-input-number>
<template v-else> <h1>{{ text}} </h1> </template>
</span>
</a-table>
......@@ -87,6 +85,7 @@ import {getWagesPage,saveUserWages,updateStatus} from "@/api/personnel/wages";
import {humpToLine, setOrder,formatDate} from "@/util/util";
const dataSource = []
const height = document.documentElement.clientHeight
const columns = [
{title: '账号', width: 160, dataIndex: 'account', align: 'center'},
{title: '邮箱', width: 200, dataIndex: 'email', align: 'center'},
......@@ -112,6 +111,7 @@ export default {
},
total: 0,
webHeight: 0,
rowKey: "id",
index: -1,
loading: false,
......@@ -150,8 +150,15 @@ export default {
}
getWagesPage(this.query).then(res => {
if (res && res.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = res.data
this.dataSource = respData.list;
let respData = res.data
let list = respData.list
for (let i = 0; i < list.length; i++) {
if (!list[i].wages) {
list[i].wages = 0
}
list[i].orgWages = respData.list[i].wages
}
this.dataSource = list;
this.total = respData.total
}
......@@ -163,6 +170,7 @@ export default {
const target = newData[index];
if (target) {
target.wages = value;
newData[index].changed = target.orgWages != target.wages
this.dataSource = newData;
}
},
......@@ -221,7 +229,7 @@ export default {
},
},
mounted() {
this.webHeight = height-250
},
activated() {
if (this.isFirstLoad == true) {
......
......@@ -5,8 +5,23 @@
<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 label="项目名" :labelCol="{span: 8}" :wrapperCol="{span: 16}">
<a-input @pressEnter="search" style="width: 100%" v-model="query.name" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="项目状态" :labelCol="{span: 8}" :wrapperCol="{span: 16}">
<a-select placeholder="请选择状态" v-model="query.status" :allowClear="true">
<a-select-option value="wait">
未开始
</a-select-option>
<a-select-option value="doing">
进行中
</a-select-option>
<a-select-option value="overDate">
已延期
</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
......@@ -16,6 +31,7 @@
<div>
<a-table
size="middle"
:scroll="{ y: webHeight }"
@change="sortChange"
:columns="columns"
:dataSource="dataSource"
......@@ -30,7 +46,7 @@
<!-- </template>-->
<div slot="title" slot-scope="data">
<span class="cust-title">
<a-icon type="hdd"/>工资管理列表{{ data.none }}
<a-icon type="hdd"/> 工资管理列表{{ data.none }}
</span>
<div class="cust-table-operator">
<a-button-group>
......@@ -56,8 +72,7 @@
: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 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">
......@@ -70,16 +85,13 @@
<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>
<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'
v-model='record.charge'
></a-input-number>
</span>
</a-table>
......@@ -89,10 +101,11 @@
</template>
<script>
import {getPage, updateStatus,saveProjectCharge} from "@/api/project/projectCharge";
import {getPage, updateStatus, saveProjectCharge} from "@/api/project/projectCharge";
import {humpToLine, setOrder} from "@/util/util";
const dataSource = []
const height = document.documentElement.clientHeight
const columns = [
{title: '项目名', width: 300, dataIndex: 'name', align: 'left'},
{title: '代码', width: 180, dataIndex: 'code', align: 'left'},
......@@ -121,9 +134,9 @@ export default {
order: "",
sort: "",
page: 1,
size: 10,
size: 50,
},
webHeight:0,
total: 0,
rowKey: "id",
index: -1,
......@@ -164,7 +177,6 @@ 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
let list = respData.list
......@@ -231,7 +243,8 @@ export default {
},
},
mounted() {
this.webHeight = height-250
console.log(this.webHeight)
},
activated() {
if (this.isFirstLoad == true) {
......
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