257 lines
6.4 KiB
Plaintext
257 lines
6.4 KiB
Plaintext
<template>
|
|
<view class="admin-page ticket-config">
|
|
<view class="admin-sections">
|
|
<view class="admin-card">
|
|
<!-- 搜索和添加 -->
|
|
<view class="header-tools">
|
|
<view class="search-form">
|
|
<view class="form-item">
|
|
<text class="label">打印机名称:</text>
|
|
<input class="search-input" v-model="searchQuery.name" placeholder="请输入打印机名称" />
|
|
</view>
|
|
<view class="form-item ml-20">
|
|
<text class="label">平台选择:</text>
|
|
<picker :range="platforms" @change="onPlatformChange">
|
|
<view class="picker-view">{{ platforms[selectedPlatform] }}</view>
|
|
</picker>
|
|
</view>
|
|
<button class="btn-search ml-20" @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: 1.5;">平台</view>
|
|
<view class="table-cell" style="flex: 1.5;">应用账号</view>
|
|
<view class="table-cell" style="flex: 1;">打印联数</view>
|
|
<view class="table-cell" style="flex: 2;">创建时间</view>
|
|
<view class="table-cell" style="flex: 1;">打印开关</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 printerList" :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: 1.5;">{{ item.platform }}</view>
|
|
<view class="table-cell" style="flex: 1.5;">{{ item.account }}</view>
|
|
<view class="table-cell" style="flex: 1;">{{ item.copies }}</view>
|
|
<view class="table-cell" style="flex: 2;">{{ item.add_time }}</view>
|
|
<view class="table-cell" style="flex: 1;">
|
|
<switch color="#1890ff" :checked="item.status" style="transform: scale(0.7);" />
|
|
</view>
|
|
<view class="table-cell action-cell" style="flex: 2;">
|
|
<text class="action-link" @click="handleDesign(item)">设计</text>
|
|
<text class="action-link ml-10" @click="handleEdit(item)">编辑</text>
|
|
<text class="action-link link-danger ml-10" @click="handleDelete(item)">删除</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 分页 (模拟) -->
|
|
<view class="pagination">
|
|
<text class="total">共 1 条</text>
|
|
<picker :range="['15条/页', '30条/页']">
|
|
<view class="page-size">15条/页</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view></template>
|
|
<script setup lang="uts">
|
|
import { ref } from 'vue'
|
|
|
|
const searchQuery = ref({ name: '' })
|
|
const platforms = ['全部', '易联云', '飞鹅打印机']
|
|
const selectedPlatform = ref(0)
|
|
|
|
const printerList = ref([
|
|
{ id: 1, name: '一号打印', platform: '易联云', account: '222', copies: 1, add_time: '2024-12-11 15:12:58', status: true }
|
|
])
|
|
|
|
function onPlatformChange(e: any) {
|
|
selectedPlatform.value = e.detail.value
|
|
}
|
|
|
|
function handleSearch() {
|
|
uni.showToast({ title: '查询中...', icon: 'none' })
|
|
}
|
|
|
|
function handleAdd() {
|
|
uni.showToast({ title: '添加打印机', icon: 'none' })
|
|
}
|
|
|
|
function handleDesign(item: any) {
|
|
uni.showToast({ title: '打印设计: ' + item.name, icon: 'none' })
|
|
}
|
|
|
|
function handleEdit(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>
|
|
.ticket-config {
|
|
padding: 0;
|
|
background-color: transparent;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.form-item {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
}
|
|
|
|
.label {
|
|
font-size: 14px;
|
|
color: #333;
|
|
}
|
|
|
|
.search-input {
|
|
width: 180px;
|
|
height: 32px;
|
|
border: 1px solid #d9d9d9;
|
|
border-radius: 4px;
|
|
padding: 0 12px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.picker-view {
|
|
width: 120px;
|
|
height: 32px;
|
|
line-height: 32px;
|
|
border: 1px solid #d9d9d9;
|
|
border-radius: 4px;
|
|
padding: 0 12px;
|
|
font-size: 14px;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.btn-search {
|
|
background-color: #1890ff;
|
|
color: #fff;
|
|
height: 32px;
|
|
line-height: 32px;
|
|
padding: 0 15px;
|
|
font-size: 14px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: #1890ff;
|
|
color: #fff;
|
|
height: 32px;
|
|
line-height: 32px;
|
|
padding: 0 15px;
|
|
font-size: 14px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.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 0;
|
|
}
|
|
|
|
.table-row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
padding: 12px 0;
|
|
align-items: center;
|
|
}
|
|
|
|
.table-cell {
|
|
font-size: 13px;
|
|
color: #666;
|
|
padding: 0 10px;
|
|
text-align: center;
|
|
}
|
|
|
|
.action-link {
|
|
color: #1890ff;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.link-danger {
|
|
color: #ff4d4f;
|
|
}
|
|
|
|
.pagination {
|
|
margin-top: 20px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.total {
|
|
font-size: 13px;
|
|
color: #666;
|
|
}
|
|
|
|
.page-size {
|
|
font-size: 13px;
|
|
color: #666;
|
|
border: 1px solid #d9d9d9;
|
|
padding: 2px 10px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.ml-20 {
|
|
margin-left: 20px;
|
|
}
|
|
|
|
.ml-10 {
|
|
margin-left: 10px;
|
|
}
|
|
</style>
|
|
|