style:模具类型-字段调整、添加复制按钮

master
黄伟杰 2 weeks ago
parent 7b5b45d8f8
commit 38ab4c77b2

@ -66,7 +66,7 @@
"mqtt": "4.1.0",
"pinia": "2.0.17",
"tslib": "^2.6.2",
"uview-plus": "^3.1.45",
"uview-plus": "^3.7.36",
"vue": "3.4.23",
"vue-i18n": "9.10.2"
},

@ -89,8 +89,8 @@ importers:
specifier: ^2.6.2
version: 2.6.2
uview-plus:
specifier: ^3.1.45
version: 3.1.45
specifier: ^3.7.36
version: 3.7.36
vue:
specifier: 3.4.23
version: 3.4.23(typescript@4.9.5)
@ -3938,9 +3938,9 @@ packages:
resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
engines: {node: '>= 0.4.0'}
uview-plus@3.1.45:
resolution: {integrity: sha512-JHgLp2heaMciLdGimO/v4tMM8iwb2vTEOk6sXqn5X198AHjM5A/IGzH84GZPvUISFTEJbxGEHiGPxpv2K26AGw==}
engines: {HBuilderX: ^3.1.0}
uview-plus@3.7.36:
resolution: {integrity: sha512-44pW0oKKatYxCHhXPljaNv5E+CESSJlhsz0FRZRNpMv1ms02m5Agk+CNpgDnv/XNHt9YxHdYSYerN+xnNP5orw==}
engines: {HBuilderX: ^3.1.0, uni-app: ^4.66, uni-app-x: ''}
v8-to-istanbul@8.1.1:
resolution: {integrity: sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==}
@ -9185,10 +9185,7 @@ snapshots:
utils-merge@1.0.1: {}
uview-plus@3.1.45:
dependencies:
clipboard: 2.0.11
dayjs: 1.11.9
uview-plus@3.7.36: {}
v8-to-istanbul@8.1.1:
dependencies:

@ -0,0 +1,109 @@
<template>
<view class="copy-btn" :class="sizeClass" @click.stop="handleCopy">
<text :class="iconClass">📋</text>
</view>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
content: {
type: [String, Number],
required: true,
default: ''
},
size: {
type: String,
default: 'small',
validator: (value) => ['small', 'medium', 'large'].includes(value)
},
successMessage: {
type: String,
default: '复制成功'
},
failMessage: {
type: String,
default: '复制失败'
},
emptyMessage: {
type: String,
default: '没有可复制的内容'
}
})
const emit = defineEmits(['copy', 'error'])
const sizeClass = computed(() => {
return `copy-btn-${props.size}`
})
const iconClass = computed(() => {
return `copy-icon-${props.size}`
})
function handleCopy() {
const content = String(props.content || '').trim()
if (!content) {
uni.showToast({ title: props.emptyMessage, icon: 'none' })
emit('error', { type: 'empty', content: props.content })
return
}
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({ title: props.successMessage, icon: 'success' })
emit('copy', { content })
},
fail: (err) => {
uni.showToast({ title: props.failMessage, icon: 'none' })
emit('error', { type: 'fail', error: err, content: props.content })
}
})
}
</script>
<style lang="scss" scoped>
.copy-btn {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
border-radius: 8rpx;
background: rgba(26, 58, 92, 0.08);
transition: background-color 0.2s;
&:active {
background: rgba(26, 58, 92, 0.15);
}
}
.copy-btn-small {
width: 48rpx;
height: 48rpx;
}
.copy-btn-medium {
width: 56rpx;
height: 56rpx;
}
.copy-btn-large {
width: 64rpx;
height: 64rpx;
}
.copy-icon-small {
font-size: 24rpx;
}
.copy-icon-medium {
font-size: 28rpx;
}
.copy-icon-large {
font-size: 32rpx;
}
</style>

@ -53,14 +53,6 @@
</view>
</view>
<view class="card-body">
<view class="row">
<text class="label">模具型号</text>
<text class="value">{{ textValue(item.brandName) }}</text>
</view>
<view class="row">
<text class="label">使用设备</text>
<text class="value">{{ textValue(item.machineName || item.machineId) }}</text>
</view>
<view class="row">
<text class="label">使用次数</text>
<text class="value">{{ textValue(item.useTime) }}</text>

@ -38,10 +38,6 @@
<text class="info-label">维保周期</text>
<text class="info-value">{{ fieldValue('maintainTime') }}</text>
</view>
<view class="info-row">
<text class="info-label">产品ID</text>
<text class="info-value">{{ fieldValue('productId') }}</text>
</view>
<view class="info-row">
<text class="info-label">是否启用</text>
<text class="info-value">{{ enableText }}</text>

@ -37,7 +37,10 @@
<view class="card-header">
<view class="header-left">
<text class="type-name">{{ textValue(item.name) }}</text>
<text class="type-code">编码: {{ textValue(item.code) }}</text>
<view class="code-wrapper">
<text class="type-code">编码{{ textValue(item.code) }}</text>
<CopyButton :content="item.code" />
</view>
</view>
</view>
<view class="card-body">
@ -121,10 +124,6 @@
<text class="form-label">模穴数 <text class="required-star">*</text></text>
<input v-model="formData.moldSize" class="form-input" type="number" placeholder="请输入模穴数" />
</view>
<view class="form-item">
<text class="form-label">产品ID <text class="required-star">*</text></text>
<input v-model="formData.productId" class="form-input" type="number" placeholder="请输入产品ID" />
</view>
<view class="form-item">
<text class="form-label">备注</text>
<textarea v-model="formData.remark" class="form-textarea" placeholder="请输入备注" :maxlength="200" />
@ -148,6 +147,7 @@
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import AppTitleHeader from '@/components/common/AppTitleHeader.vue'
import CopyButton from '@/components/common/CopyButton.vue'
import { createMoldBrand, deleteMoldBrand, getMoldBrandDetail, getMoldBrandPage, updateMoldBrand } from '@/api/mes/mold'
import { DICT_TYPE, getDictLabel, initAllDict } from '@/utils/dict'
@ -171,7 +171,6 @@ const formData = reactive({
orgType: '',
useTime: '',
moldSize: '',
productId: '',
remark: ''
})
@ -322,7 +321,6 @@ async function openEdit(item) {
formData.orgType = textValueForInput(detail?.orgType)
formData.useTime = textValueForInput(detail?.useTime)
formData.moldSize = textValueForInput(detail?.moldSize)
formData.productId = textValueForInput(detail?.productId)
formData.remark = textValueForInput(detail?.remark)
formPopupRef.value?.open()
} catch (e) {
@ -361,8 +359,8 @@ async function submitForm() {
uni.showToast({ title: '编码、名称、规格必填', icon: 'none' })
return
}
if (String(formData.productId).trim() === '' || String(formData.moldSize).trim() === '') {
uni.showToast({ title: '产品ID、模穴数必填', icon: 'none' })
if (String(formData.moldSize).trim() === '') {
uni.showToast({ title: '模穴数必填', icon: 'none' })
return
}
const payload = {
@ -373,7 +371,6 @@ async function submitForm() {
orgType: formData.orgType.trim() || undefined,
useTime: toNumberOrUndefined(formData.useTime),
moldSize: toNumberOrUndefined(formData.moldSize),
productId: toNumberOrUndefined(formData.productId),
remark: formData.remark.trim() || undefined,
isEnable: true
}
@ -400,7 +397,6 @@ function resetForm() {
formData.orgType = ''
formData.useTime = ''
formData.moldSize = ''
formData.productId = ''
formData.remark = ''
}
@ -576,6 +572,12 @@ function openDetail(item) {
color: #8a9099;
}
.code-wrapper {
display: flex;
align-items: center;
gap: 8rpx;
}
.arrow {
font-size: 44rpx;
color: #a1a8b0;

Loading…
Cancel
Save