180 lines
5.1 KiB
Vue
180 lines
5.1 KiB
Vue
<template>
|
|
<!-- 搜索 -->
|
|
<ContentWrap>
|
|
<el-form
|
|
class="-mb-15px"
|
|
:model="queryParams"
|
|
ref="queryFormRef"
|
|
:inline="true"
|
|
label-width="68px"
|
|
>
|
|
<el-form-item label="套餐名" prop="name">
|
|
<el-input
|
|
v-model="queryParams.name"
|
|
placeholder="请输入套餐名"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="状态" prop="status">
|
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
|
<el-option
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="创建时间" prop="createTime">
|
|
<el-date-picker
|
|
v-model="queryParams.createTime"
|
|
style="width: 240px"
|
|
type="daterange"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button @click="handleQuery">
|
|
<Icon icon="ep:search" class="mr-5px" />
|
|
搜索
|
|
</el-button>
|
|
<el-button @click="resetQuery">
|
|
<Icon icon="ep:refresh" class="mr-5px" />
|
|
重置
|
|
</el-button>
|
|
<el-button
|
|
type="primary"
|
|
@click="handleCreate('create')"
|
|
v-hasPermi="['system:tenant-package:create']"
|
|
>
|
|
<Icon icon="ep:plus" class="mr-5px" />
|
|
新增
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</ContentWrap>
|
|
|
|
<!-- 列表 -->
|
|
<ContentWrap>
|
|
<el-table v-loading="loading" :data="list" align="center">
|
|
<el-table-column label="套餐编号" align="center" prop="id" width="120" />
|
|
<el-table-column label="套餐名" align="center" prop="name" />
|
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
|
<template #default="scope">
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
<template #default="scope">
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template #default="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate('update', scope.row.id)"
|
|
v-hasPermi="['system:tenant-package:update']"
|
|
>修改
|
|
</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row.id)"
|
|
v-hasPermi="['system:tenant-package:delete']"
|
|
>删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<Pagination
|
|
:total="total"
|
|
v-model:page="queryParams.pageNo"
|
|
v-model:limit="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</ContentWrap>
|
|
<TenantPackageForm ref="formRef" @success="getList" />
|
|
</template>
|
|
<script setup lang="ts" name="TenantPackage">
|
|
import TenantPackageForm from './form.vue'
|
|
// 业务相关的 import
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
import { parseTime } from '@/utils/formatTime'
|
|
import * as TenantPackageApi from '@/api/system/tenantPackage'
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
const total = ref(0) // 列表的总页数
|
|
const list = ref([]) // 列表的数据
|
|
const queryParams: Record<string, any> = ref<Record<string, any>>({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
name: null,
|
|
status: null,
|
|
remark: null,
|
|
createTime: []
|
|
})
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
/** 查询列表 */
|
|
const getList = () => {
|
|
loading.value = true
|
|
// 执行查询
|
|
TenantPackageApi.getTenantPackageTypePage(queryParams.value).then((response) => {
|
|
list.value = response.list
|
|
total.value = response.total
|
|
loading.value = false
|
|
})
|
|
}
|
|
|
|
/** 搜索按钮操作 */
|
|
const handleQuery = () => {
|
|
queryParams.pageNo = 1
|
|
getList()
|
|
}
|
|
|
|
/** 重置按钮操作 */
|
|
const resetQuery = () => {
|
|
// 表单重置
|
|
queryFormRef.value?.resetFields()
|
|
getList()
|
|
}
|
|
|
|
// 新增操作
|
|
const handleCreate = (type: string) => {
|
|
formRef.value.open(type)
|
|
}
|
|
|
|
// 修改操作
|
|
const handleUpdate = async (type: string, id?: number) => {
|
|
formRef.value.open(type, id)
|
|
}
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (id: number) => {
|
|
try {
|
|
// 删除的二次确认
|
|
await message.delConfirm()
|
|
// 发起删除
|
|
await TenantPackageApi.deleteTenantPackageType(id)
|
|
message.success(t('common.delSuccess'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch {}
|
|
}
|
|
getList()
|
|
</script>
|