Commit ef80424a authored by youjie's avatar youjie

排序

parent 868f6d1c
......@@ -111,66 +111,77 @@
</li>
</ul>
</div>
<v-table
v-if="isReady"
is-horizontal-resize
column-width-drag
style="width: 100%"
:columns="columns"
:table-data="tableData"
:filter-method="filterMethod"
:total="total"
:pageSize="pageSize"
:pageIndex="pageIndex"
:handleCurrentChange="handleCurrentChanges"
:multiple-sort="multipleSort"
:is-loading="loading"
sort-always
@sort-change="sortChange"
@on-custom-comp="customCompFunc"
></v-table>
<el-table
v-if="isReady"
ref="singleTable"
:data="tableData"
highlight-current-row
style="width: 100%">
<el-table-column
type="index"
label="序号"
width="50">
</el-table-column>
<el-table-column
property="name"
label="名称"
width="80">
</el-table-column>
<el-table-column
property=""
label="销售额"
width="" sortable>
<template slot-scope="scope">
<div class="clickText" @click="goUrl('salesVolumeRankEntryForm',scope.row)">{{scope.row.SumPreferPrice}}</div>
</template>
</el-table-column>
<el-table-column
property=""
label="收款金额"
width="" sortable>
<template slot-scope="scope">
<div class="clickText" @click="goUrl('salesVolumeRankEntryForm',scope.row)">{{scope.row.income}}</div>
</template>
</el-table-column>
<el-table-column
property=""
label="未收金额"
width="" sortable>
<template slot-scope="scope">
<div class="clickText" @click="goUrl('salesVolumeRankEntryForm',scope.row)">{{scope.row.notInCome}}</div>
</template>
</el-table-column>
<el-table-column
property="peopleCount"
label="正常收客数"
width="" sortable>
</el-table-column>
<el-table-column
property="CalcheCount"
label="取消收客数"
width="" sortable>
</el-table-column>
<el-table-column
property="totalGuestNum"
label="单项收客数"
width="">
</el-table-column>
<el-table-column
property="avgPrice"
label="客单价"
width="" sortable>
</el-table-column>
<el-table-column
property="zanBi"
label="销售额占比"
width="">
</el-table-column>
</el-table>
</div>
</template>
<script>
import Vue from "vue";
import moment from 'moment'
// 自定义列组件
Vue.component("table-operation", {
template: `<span>
<a href="" @click.stop.prevent="update(rowData,index)">
<span>{{content}}</span></a></span>
`,
props: {
rowData: {
type: Object,
},
field: {
type: String,
},
index: {
type: Number,
},
},
data() {
return {
content: "",
};
},
mounted() {
if (this.field === "SumPreferPrice") {
this.content = this.rowData["SumPreferPrice"];
} else if (this.field === "income") {
this.content = this.rowData["income"];
} else {
this.content = this.rowData.notInCome.toFixed(2);
}
},
methods: {
update(rowData, index) {
this.$emit('on-custom-comp',rowData);
},
},
});
export default {
data() {
return {
......@@ -239,6 +250,9 @@ export default {
//this.pageSize = this.calcPageSize(40); 此页不需要分页
},
methods: {
goUrl(name,rowData){
if(name=='salesVolumeRankEntryForm') this.customCompFunc(rowData)
},
customCompFunc(rowData) {
this.$router.push({
path: "/salesVolumeRankEntryForm",
......@@ -260,174 +274,6 @@ export default {
});
},
initColumns() {
this.isReady = false;
let that = this;
let no = {
title: this.$t("active.ad_xuhao"),
width: 50,
titleAlign: "center",
columnAlign: "center",
formatter: function (rowData, rowIndex, pagingIndex, field) {
return rowIndex + 1;
},
isResize: false,
};
let account = {
field: "name",
title: this.$t("system.query_airName"),
width: 80,
titleAlign: "left",
columnAlign: "left",
isResize: true,
result: "",
// filterMultiple: false,
// filters: [{}],
// type: "text"
};
let sumMoney = {
field: "SumPreferPrice",
title: this.$t("sm.salemoney"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "desc",
componentName: "table-operation",
formatter: function (rowData, rowIndex, pagingIndex, field) {
// if (that.authority.indexOf("Sales_Volume_Rank_Show") == -1) {
// let content = "";
// for (let i = 0; i < rowData["income"].length; i++) {
// content += "*";
// }
// return content;
// } else {
return `${rowData["SumPreferPrice"].toFixed(2)}`;
//}
},
};
let moneyCount = {
field: "income",
title: this.$t("fnc.skjine"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
componentName: "table-operation",
formatter: function (rowData, rowIndex, pagingIndex, field) {
// if (that.authority.indexOf("Sales_Volume_Rank_Show") == -1) {
// let content = "";
// for (let i = 0; i < rowData["income"].length; i++) {
// content += "*";
// }
// return content;
// } else {
return `${rowData["income"]}`;
//}
},
};
let notIncome = {
field: "notInCome",
title: this.$t("fnc.wsjine"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
componentName: "table-operation",
formatter: function (rowData, rowIndex, pagingIndex, field) {
// if (that.authority.indexOf("Sales_Volume_Rank_Show") == -1) {
// let content = "";
// for (let i = 0; i < rowData["income"].length; i++) {
// content += "*";
// }
// return `<span style='color:red'>${content}</span>`;
// } else {
return `<span style='color:red'>${rowData.notInCome.toFixed(
2
)}</span>`;
//}
},
};
let pCount = {
field: "peopleCount",
title: this.$t("sm.sks"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
};
let cCount = {
field: "CalcheCount",
title: this.$t("sm.exitsks"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
};
let avgPCount = {
field: "avgPeopleCount",
title: this.$t("sm.personsks"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
};
let customerNum = {
field: "totalGuestNum",
title: "单项收客数",
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
};
let unitPrice = {
field: "avgPrice",
title: this.$t("sm.keprice"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
orderBy: "",
formatter: function (rowData, rowIndex, pagingIndex, field) {
// if (that.authority.indexOf("Sales_Volume_Rank_Show") == -1) {
// let content = "";
// for (let i = 0; i < rowData["avgPrice"].length; i++) {
// content += "*";
// }
// return content;
// } else {
return rowData["avgPrice"].toFixed(2);
// }
},
};
let proportion = {
field: "zanBi",
title: this.$t("sm.xiaoshouzb"),
titleAlign: "left",
columnAlign: "left",
isResize: true,
width: 80,
};
this.columns = [];
this.columns.push(no);
this.columns.push(account);
this.columns.push(sumMoney);
this.columns.push(moneyCount);
this.columns.push(notIncome);
this.columns.push(pCount);
this.columns.push(cCount);
if (this.activeName != "first" && this.activeName != "four") {
unitPrice.title = this.$t("sm.renxiaoshou");
this.columns.push(avgPCount);
}
this.columns.push(customerNum);
this.columns.push(unitPrice);
this.columns.push(proportion);
this.isReady = true;
},
initData() {
......@@ -620,4 +466,8 @@ export default {
.el-date-editor .el-range-separator {
font-size: 12px;
}
.clickText{
color: #33B3FF;
cursor: pointer;
}
</style>
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