177 lines
5.7 KiB
Vue
177 lines
5.7 KiB
Vue
<template>
|
|
<div>
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
<suit-search-form :queryParams="queryParams" @query="handleQuery"/>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<slot name="table-operator"/>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="suitList" v-on="$listeners">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<template v-for="column of showColumns">
|
|
<el-table-column
|
|
:key="column.key"
|
|
:label="column.label"
|
|
:prop="column.key"
|
|
:align="column.align"
|
|
:min-width="column.minWidth"
|
|
:width="column.width"
|
|
:show-overflow-tooltip="column.overflow"
|
|
>
|
|
<template slot-scope="d">
|
|
<suit-table-column :column="column" :row="d.row"/>
|
|
</template>
|
|
</el-table-column>
|
|
</template>
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
|
|
<template slot-scope="scope">
|
|
<slot name="row-operator" :row="scope.row"/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total>0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listSuit, getSuit, delSuit, addSuit, updateSuit } from "@/api/ss/suit";
|
|
import DeviceInput from '@/components/Business/Device/DeviceInput.vue'
|
|
import { findLabel, isEmpty } from '@/utils'
|
|
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
|
import UserInput from '@/components/Business/SmUser/UserInput.vue'
|
|
import { $view, $showColumns } from '@/utils/mixins'
|
|
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
|
|
import { SuitFeeMode, SuitFeeType } from '@/utils/constants'
|
|
import SuitEditDialog from '@/views/ss/suit/component/SuitEditDialog.vue'
|
|
import SuitSearchForm from '@/views/ss/suit/component/SuitSearchForm.vue'
|
|
import SuitTableColumn from '@/views/ss/suit/component/SuitTableColumn.vue'
|
|
|
|
export default {
|
|
name: "SuitTable",
|
|
mixins: [$view, $showColumns],
|
|
dicts: ['time_unit', 'suit_fee_mode', 'suit_fee_type'],
|
|
computed: {
|
|
SuitFeeType() {
|
|
return SuitFeeType
|
|
},
|
|
// 时长单位
|
|
suitTimeUnit() {
|
|
return (unit) => {
|
|
return findLabel(this.dict.type.time_unit, unit);
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
SuitEditDialog,
|
|
DeviceLink,
|
|
UserInput,
|
|
UserLink,
|
|
DeviceInput,
|
|
SuitSearchForm,
|
|
SuitTableColumn
|
|
},
|
|
props: {
|
|
query: {
|
|
type: Object,
|
|
default: () => {
|
|
return {}
|
|
}
|
|
},
|
|
listApi: {
|
|
type: Function,
|
|
default: listSuit
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
row: {},
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 套餐表格数据
|
|
suitList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 20,
|
|
deviceId: null,
|
|
name: null,
|
|
feeType: null,
|
|
value: null,
|
|
price: null,
|
|
description: null,
|
|
deleted: null
|
|
},
|
|
// 字段列表
|
|
columns: [
|
|
{key: 'suitId', visible: true, label: 'ID', minWidth: null, overflow: false, align: 'center', width: "80"},
|
|
{key: 'name', visible: true, label: '套餐名称', minWidth: null, overflow: false, align: 'center', width: "100"},
|
|
{key: 'mobileOrUserName', visible: true, label: '所属用户', minWidth: null, overflow: false, align: 'center', width: "100"},
|
|
{key: 'feeMode', visible: true, label: '收费模式', minWidth: null, overflow: false, align: 'center', width: "100"},
|
|
{key: 'feeType', visible: true, label: '收费类型', minWidth: null, overflow: false, align: 'center', width: "120"},
|
|
{key: 'price', visible: true, label: '价格', minWidth: null, overflow: false, align: 'center', width: "180"},
|
|
{key: 'deposit', visible: true, label: '押金', minWidth: null, overflow: false, align: 'center', width: "100"},
|
|
{key: 'description', visible: true, label: '详细说明', minWidth: null, overflow: true, align: 'center', width: null},
|
|
{key: 'deviceList', visible: true, label: '应用设备', minWidth: "200", overflow: false, align: 'center', width: null},
|
|
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, overflow: false, align: 'center', width: "100"},
|
|
],
|
|
};
|
|
},
|
|
created() {
|
|
this.initColumns();
|
|
this.queryParams = {
|
|
...this.queryParams,
|
|
...this.query
|
|
}
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
/** 查询套餐列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
this.listApi(this.queryParams).then(response => {
|
|
this.suitList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
}
|
|
};
|
|
</script>
|