Files
cmanager/src/views/manage/station/account.vue

233 lines
5.7 KiB
Vue
Raw Normal View History

2024-03-17 15:19:08 +08:00
<template>
<basic-container>
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
ref="crud"
v-model="form"
:permission="permissionList"
:before-open="beforeOpen"
:before-close="beforeClose"
@search-change="searchChange"
@search-reset="searchReset"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template slot="menuLeft"></template>
<template slot-scope="scope" slot="menu">
<el-button
type="text"
size="small"
@click.stop="handleView(scope.row,scope.index)"
v-if="vaildData(permission.manage_station_account_view, false)"
>详情</el-button>
<el-button
type="text"
size="small"
@click.stop="handleAccount(scope.row,scope.index)"
v-if="vaildData(permission.manage_station_account_account, false) && scope.row.status === 0"
>结算</el-button>
</template>
<template slot="userNum" slot-scope="{row}">
<span>{{row.userNum}} </span>
</template>
<template slot="totalSys" slot-scope="{row}">
<span v-if="!row.totalSys && row.totalSys!== 0">-</span>
<span v-else>{{moneyFormat(row.totalSys)}}</span>
</template>
</avue-crud>
<account-detail ref="detail"></account-detail>
</basic-container>
</template>
<script>
import { getList } from "@/api/manage/account";
import { mapGetters } from "vuex";
import { moneyFormat } from "@/util/money";
import accountDetail from "./accountDetail";
export default {
components: { accountDetail },
name: "manage_station_account",
data() {
return {
form: {},
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
drawer: true,
option: {
height: "auto",
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
menuWidth: 150,
dialogClickModal: false,
dialogType: "drawer",
dialogFullscreen: true,
addBtn: false,
editBtn: false,
delBtn: false,
index: true,
indexLabel: "序号",
column: [
{
label: "工作站主体",
prop: "companyName",
display: false,
search: true,
searchLabelWidth: 89,
},
{
label: "工作站",
prop: "stationName",
display: false,
search: true,
},
{
label: "结算人数",
prop: "userNum",
display: false,
slot: true,
},
{
label: "结算金额",
prop: "totalSys",
display: false,
slot: true,
},
{
label: "结算比例",
prop: "ratio",
display: false,
},
{
label: "结算月份",
prop: "month",
display: false,
},
{
label: "结算状态",
type: "select",
prop: "status",
display: false,
search: true,
searchSpan: 4,
dicData: [
{ label: "未结算", value: 0 },
{ label: "已结算", value: 1 },
],
},
{
label: "结算日期",
prop: "accountTime",
display: false,
width: 145,
},
],
},
data: [],
};
},
computed: {
...mapGetters(["userInfo", "permission"]),
permissionList() {
return {};
},
},
methods: {
initData() {
this.onLoad(this.page, this.query);
},
handleView(row) {
this.$refs.detail.open(row.id);
},
handleAccount(row) {
row;
let h = this.$createElement;
this.$prompt(
h("p", { style: "color: #F56C6C" }, "一旦确定则无法修改"),
"您确定已经结算费用了?",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
inputPlaceholder: "结算金额",
inputValidator(val) {
if (isNaN(parseFloat(val))) {
return "输入的金额格式不正确";
}
return true;
},
}
)
.then(() => {
this.$message({
type: "success",
message: "操作成功!",
});
})
.catch(() => {});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
beforeOpen(done, type) {
if (["add", "edit"].includes(type)) {
this.initData();
}
if (["edit", "view"].includes(type)) {
// getStation(this.form.id).then(res => {
// this.form = res.data.data;
// });
}
done();
},
beforeClose(done) {
done();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
getList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params)
).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
});
},
moneyFormat,
},
};
</script>
<style>
</style>