Commit 29f69031 authored by menglingjun's avatar menglingjun

feat: table高度固定

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