Files
medical-mall/pages/mall/admin/maintain/dev-tools/data-dict.uvue
2026-02-11 19:51:32 +08:00

201 lines
5.4 KiB
Plaintext

<template>
<view class="admin-page data-dictionary">
<view class="admin-sections">
<view class="admin-card">
<!-- 搜索和添加 -->
<view class="header-tools">
<view class="search-form">
<text class="label">字典名称:</text>
<input class="search-input" v-model="searchQuery" placeholder="请输入字典名称" />
<button class="btn-search" @click="handleSearch">查询</button>
</view>
<button class="btn-primary" @click="handleAdd">添加数据字典</button>
</view>
<!-- 数据表格 -->
<view class="table-container">
<view class="table-header">
<view class="table-cell" style="flex: 0 0 60px;">ID</view>
<view class="table-cell" style="flex: 2;">字典名称</view>
<view class="table-cell" style="flex: 2;">数据标识</view>
<view class="table-cell" style="flex: 1;">类型</view>
<view class="table-cell" style="flex: 2;">添加时间</view>
<view class="table-cell action-cell" style="flex: 2;">操作</view>
</view>
<view class="table-body">
<view class="table-row" v-for="(item, index) in dictionaryList" :key="index">
<view class="table-cell" style="flex: 0 0 60px;">{{ item.id }}</view>
<view class="table-cell" style="flex: 2;">{{ item.name }}</view>
<view class="table-cell" style="flex: 2;">{{ item.tag }}</view>
<view class="table-cell" style="flex: 1;">{{ item.type }}</view>
<view class="table-cell" style="flex: 2;">{{ item.add_time }}</view>
<view class="table-cell action-cell" style="flex: 2;">
<text class="action-link" @click="handleEdit(item)">编辑</text>
<text class="action-link ml-10" @click="handleManage(item)">数据管理</text>
<text class="action-link link-danger ml-10" @click="handleDelete(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view></template>
<script setup lang="uts">
import { ref } from 'vue'
const searchQuery = ref('')
const dictionaryList = ref([
{ id: 8, name: '21', tag: '25425', type: '一级', add_time: '2024-08-23 17:37:08' },
{ id: 10, name: '相册', tag: 'xc', type: '多级', add_time: '2024-09-09 15:49:58' },
{ id: 11, name: '品类', tag: 'category', type: '多级', add_time: '2024-09-24 17:47:16' },
{ id: 12, name: '123', tag: '1', type: '一级', add_time: '2024-09-27 15:57:03' },
{ id: 13, name: '企业类型', tag: 'company_type', type: '多级', add_time: '2024-09-27 16:16:21' },
{ id: 14, name: '测试', tag: '343322222222234555343434', type: '多级', add_time: '2024-09-27 16:17:23' },
{ id: 16, name: '用户管理模块', tag: '123', type: '多级', add_time: '2024-10-22 09:30:46' },
{ id: 18, name: '类型', tag: '1', type: '多级', add_time: '2024-12-11 13:48:01' },
{ id: 19, name: '店铺', tag: 'shop', type: '多级', add_time: '2024-12-11 22:23:07' },
{ id: 20, name: 'ce', tag: 'zzz', type: '一级', add_time: '2024-12-14 12:19:17' }
])
function handleSearch() {
uni.showToast({ title: '搜索: ' + searchQuery.value, icon: 'none' })
}
function handleAdd() {
uni.showToast({ title: '添加数据字典', icon: 'none' })
}
function handleEdit(item: any) {
uni.showToast({ title: '编辑: ' + item.name, icon: 'none' })
}
function handleManage(item: any) {
uni.showToast({ title: '数据管理: ' + item.name, icon: 'none' })
}
function handleDelete(item: any) {
uni.showModal({
title: '提示',
content: '确定删除该数据字典吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '已删除', icon: 'success' })
}
}
})
}
</script>
<style scoped>
.admin-page {
padding: 20px;
background-color: #f5f7f9;
min-height: 100vh;
}
.admin-card {
background-color: #fff;
padding: 24px;
border-radius: 8px;
}
.header-tools {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.search-form {
display: flex;
flex-direction: row;
align-items: center;
}
.label {
font-size: 14px;
color: #333;
margin-right: 10px;
}
.search-input {
width: 200px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 0 12px;
font-size: 14px;
margin-right: 10px;
}
.btn-search {
background-color: #1890ff;
color: #fff;
font-size: 14px;
height: 32px;
line-height: 32px;
padding: 0 15px;
border-radius: 4px;
border: none;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
font-size: 14px;
height: 32px;
line-height: 32px;
padding: 0 20px;
border-radius: 4px;
border: none;
}
.table-container {
border: 1px solid #f0f0f0;
border-radius: 4px;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #f8f8f9;
border-bottom: 1px solid #f0f0f0;
padding: 12px 10px;
}
.table-body {
display: flex;
flex-direction: column;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
padding: 12px 10px;
align-items: center;
}
.table-cell {
font-size: 14px;
color: #666;
padding: 0 10px;
}
.action-link {
color: #1890ff;
font-size: 13px;
cursor: pointer;
}
.link-danger {
color: #ff4d4f;
}
.ml-10 {
margin-left: 10px;
}
</style>