Browse Source

风采完成

lisy 1 week ago
parent
commit
979be806f9

+ 16 - 0
pnpm-lock.yaml

@@ -89,6 +89,9 @@ importers:
       vue-i18n:
         specifier: 9.14.5
         version: 9.14.5(vue@3.5.26(typescript@4.9.5))
+      vue-types:
+        specifier: ^6.0.0
+        version: 6.0.0(vue@3.5.26(typescript@4.9.5))
       z-paging:
         specifier: ^2.8.7
         version: 2.8.8
@@ -4654,6 +4657,15 @@ packages:
     peerDependencies:
       typescript: '*'
 
+  vue-types@6.0.0:
+    resolution: {integrity: sha512-fBgCA4nrBrB8SCU/AN40tFq8HUxLGBvU2ds7a5+SEDse6dYc+TJyvy8mWiwwL8oWIC/aGS/8nTqmhwxApgU5eA==}
+    engines: {node: '>=14.0.0'}
+    peerDependencies:
+      vue: ^3.0.0
+    peerDependenciesMeta:
+      vue:
+        optional: true
+
   vue@3.5.26:
     resolution: {integrity: sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==}
     peerDependencies:
@@ -10512,6 +10524,10 @@ snapshots:
       semver: 7.7.3
       typescript: 4.9.5
 
+  vue-types@6.0.0(vue@3.5.26(typescript@4.9.5)):
+    optionalDependencies:
+      vue: 3.5.26(typescript@4.9.5)
+
   vue@3.5.26(typescript@4.9.5):
     dependencies:
       '@vue/compiler-dom': 3.5.26

+ 6 - 25
src/plant/code/code-detail-list/index.vue

@@ -6,7 +6,7 @@
         <view class="pd-24">
             <!-- 头部信息卡片 - 使用 code-item 组件 -->
             <code-item :item="detailData" :show-buttons="false"></code-item>
-            <view class="d-flex a-c pb-20" style="margin-left: -10rpx;">
+            <view class="d-flex a-c pb-20" style="margin-left: -10rpx">
                 <up-tabs :list="list1" lineWidth="60"></up-tabs>
             </view>
             <!-- 使用记录列表 -->
@@ -18,8 +18,7 @@
                 <view class="d-flex a-c pb-10">
                     <span class="f-s-28 c-#666">使用对象:</span>
                     <span class="f-s-28 c-#333">{{ item?.packTask?.proName }}</span>
-                    <span class="ml-10 f-s-22 c-#333" v-if="+item?.packTask?.packTaskType !== 2">
-                        {{ item?.packTask?.proLevel }}</span>
+                    <span class="ml-10 f-s-22 c-#333" v-if="+item?.packTask?.packTaskType !== 2"> {{ item?.packTask?.proLevel }}</span>
                     <span class="ml-10 f-s-22 c-#333" v-else>种子</span>
                 </view>
                 <view class="d-flex a-c pb-10">
@@ -37,8 +36,7 @@
                     </view>
                     <view>
                         <span class="f-s-24 c-#666">打印时间:</span>
-                        <span class="f-s-24 c-#333 f-w-500">{{ formatItemTime(item.updateTime || item?.createTime)
-                            }}</span>
+                        <span class="f-s-24 c-#333 f-w-500">{{ parseTime(item.updateTime || item?.createTime) }}</span>
                     </view>
                 </view>
             </view>
@@ -48,32 +46,15 @@
 
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
-import CodeItem from '../code-list/models/code-item.vue'
+import CodeItem from '../code-list/models/code-item.vue';
+import { parseTime } from '@/utils/ruoyi';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const paging = ref();
 const list = ref<any>([]);
 const id = ref('');
 const title = ref('码详情');
 const detailData = ref<any>({});
-const list1 = reactive([
-    { name: '使用情况', value: '' },
-]);
-
-// 格式化列表项时间
-const formatItemTime = (timeStr: string) => {
-    if (!timeStr) return '-';
-    const date = new Date(timeStr);
-    if (isNaN(date.getTime())) {
-        return String(timeStr);
-    }
-    const year = date.getFullYear();
-    const month = String(date.getMonth() + 1).padStart(2, '0');
-    const day = String(date.getDate()).padStart(2, '0');
-    const hours = String(date.getHours()).padStart(2, '0');
-    const minutes = String(date.getMinutes()).padStart(2, '0');
-    const seconds = String(date.getSeconds()).padStart(2, '0');
-    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-};
+const list1 = reactive([{ name: '使用情况', value: '' }]);
 
 // 获取头部详情数据
 const getDetailData = async () => {

+ 26 - 63
src/plant/code/code-list/models/code-item.vue

@@ -1,48 +1,44 @@
 <template>
     <view class="bg-#fff b-radius-16 pd-24 mb-16 p-rtv b-radius">
         <!-- 状态标签 -->
-        <view class="d-flex a-c j-ed " style="position: absolute;right: 0;top: 0;">
-            <view class="bg-#FAECE9 c-#F74C30 f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx ;"
-                v-if="item.status === '0'">追溯码生成中...</view>
-            <view class="bg-#EBF6EE c-primary f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx ;"
-                v-else-if="item.downloadFlag === '0' && item.status !== '0'">未下载</view>
-            <view class="bg-#E8F0F7 c-#2289E0 f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx ;"
-                v-else-if="item.downloadFlag === '1' && item.status !== '0'">已下载</view>
+        <view class="d-flex a-c j-ed" style="position: absolute; right: 0; top: 0">
+            <view class="bg-#FAECE9 c-#F74C30 f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx" v-if="item.status === '0'">追溯码生成中...</view>
+            <view class="bg-#EBF6EE c-primary f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx" v-else-if="item.downloadFlag === '0' && item.status !== '0'">未下载</view>
+            <view class="bg-#E8F0F7 c-#2289E0 f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 0 16rpx 0 16rpx" v-else-if="item.downloadFlag === '1' && item.status !== '0'">已下载</view>
         </view>
         <!-- 主要内容 -->
         <view class="" @click="handleItemClick">
-            <view class=" d-flex a-c pb-10">
-                <span class="f-s-28 c-#666 ">生成批号:</span>
+            <view class="d-flex a-c pb-10">
+                <span class="f-s-28 c-#666">生成批号:</span>
                 <span class="f-s-28 c-#333 f-w-500">{{ item.batchSn || '-' }}</span>
             </view>
-            <view class=" d-flex a-c pb-10">
-                <span class="f-s-28 c-#666 ">码段:</span>
+            <view class="d-flex pb-10">
+                <span class="f-s-28 c-#666">码段:</span>
                 <span class="f-s-28 c-#333 f-w-500 flex1">{{ formatCodeRange }}</span>
                 <up-icon v-if="showButtons" name="arrow-right" size="26rpx" color="#999"></up-icon>
             </view>
-            <view class=" d-flex a-c pb-10">
+            <view class="d-flex a-c pb-10">
                 <view class="w-50%">
-                    <span class="f-s-28 c-#666 ">生成数量:</span>
+                    <span class="f-s-28 c-#666">生成数量:</span>
                     <span class="f-s-28 c-#333 f-w-500">{{ item.sumCount }}个</span>
                 </view>
                 <view class="w-50%">
-                    <span class="f-s-28 c-#666 ">剩余数量:</span>
+                    <span class="f-s-28 c-#666">剩余数量:</span>
                     <span class="f-s-28 c-#333 f-w-500">{{ getRemainingCount }}个</span>
                 </view>
             </view>
-            <view class=" d-flex a-c pb-10">
-                <span class="f-s-28 c-#666 ">备注:</span>
+            <view class="d-flex a-c pb-10">
+                <span class="f-s-28 c-#666">备注:</span>
                 <span class="f-s-28 c-#333 f-w-500">{{ item.remark || '-' }}</span>
             </view>
-            <view class="d-flex a-c pb-20" style="flex-wrap: nowrap;border-bottom: 1rpx solid #f7f7f7;">
-                <view class="flex1 ov-hd d-flex a-c" style="min-width: 0;">
+            <view class="d-flex a-c pb-20" style="flex-wrap: nowrap; border-bottom: 1rpx solid #f7f7f7">
+                <view class="flex1 ov-hd d-flex a-c" style="min-width: 0">
                     <span class="f-s-24 c-#666 w-s-no">操作人:</span>
-                    <span class="f-s-24 c-#333 f-w-500 ov-hd w-s-no tx-ov" style=" display: inline-block">{{
-                        operatorName }}</span>
+                    <span class="f-s-24 c-#999 f-w-500 ov-hd w-s-no tx-ov" style="display: inline-block">{{ item?.createByName }}</span>
                 </view>
-                <view class="ml-20" style="flex-shrink: 0;">
+                <view class="ml-20" style="flex-shrink: 0">
                     <span class="f-s-24 c-#666 w-s-no">生成时间:</span>
-                    <span class="f-s-24 c-#333 f-w-500" style="white-space: nowrap;">{{ formatTime }}</span>
+                    <span class="f-s-24 c-#999 f-w-500" style="white-space: nowrap">{{ parseTime(item?.createTime) }}</span>
                 </view>
             </view>
         </view>
@@ -51,11 +47,7 @@
         <view class="d-flex a-c j-ed mt-24" v-if="showButtons">
             <!-- 追溯码生成中状态 -->
             <template v-if="item.status === '0'">
-                <up-button type="primary"
-                    customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #37A954; color: #fff;width: 160rpx;"
-                    @click="handleRefresh">
-                    刷新
-                </up-button>
+                <up-button type="primary" customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #37A954; color: #fff;width: 160rpx;" @click="handleRefresh"> 刷新 </up-button>
             </template>
             <!-- 未下载状态 -->
             <view class="d-flex j-ed a-c" v-else-if="item.downloadFlag === '0' && item.status !== '0'">
@@ -64,11 +56,7 @@
                     @click="handleFindAgent">
                     找人代制作
                 </up-button> -->
-                <up-button type="primary"
-                    customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #37A954; color: #fff; width: 160rpx;"
-                    @click="handleDownload">
-                    下载
-                </up-button>
+                <up-button type="primary" customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #37A954; color: #fff; width: 160rpx;" @click="handleDownload"> 下载 </up-button>
             </view>
             <!-- 已下载状态 -->
             <view v-else-if="item.downloadFlag === '1' && item.status !== '0'" class="d-flex j-ed a-c">
@@ -77,17 +65,15 @@
                     @click="handleViewOrder">
                     查看代做订单
                 </up-button> -->
-                <up-button
-                    customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #91C747; color: #fff;"
-                    @click="handleReDownload">
-                    重新下载
-                </up-button>
+                <up-button customStyle="height: 64rpx; font-size: 28rpx; border-radius: 8rpx; background-color: #91C747; color: #fff;" @click="handleReDownload"> 重新下载 </up-button>
             </view>
         </view>
     </view>
 </template>
 
 <script setup lang="ts">
+import { parseTime } from '@/utils/ruoyi';
+
 const props = withDefaults(
     defineProps<{
         item: any;
@@ -96,9 +82,8 @@ const props = withDefaults(
     {
         item: () => ({}),
         showButtons: true,
-    }
+    },
 );
-
 const emit = defineEmits<{
     refresh: [id: number];
     download: [item: any];
@@ -127,29 +112,7 @@ const getRemainingCount = computed(() => {
     return sum - use - voidCount;
 });
 
-// 格式化操作人名称
-const operatorName = computed(() => {
-    // 根据实际情况,可能需要从其他地方获取操作人名称
-    // 这里暂时使用 remark 或其他字段代替,或者显示为"手机用户"
-    return '手机用户' + String(props.item?.appid || '').slice(-4) || '-';
-});
-
 // 格式化时间
-const formatTime = computed(() => {
-    if (!props.item.dateStr) return '-';
-    // dateStr 可能是时间戳或日期字符串,需要根据实际情况格式化
-    const date = new Date(props.item.dateStr);
-    if (isNaN(date.getTime())) {
-        return String(props.item.dateStr);
-    }
-    const year = date.getFullYear();
-    const month = String(date.getMonth() + 1).padStart(2, '0');
-    const day = String(date.getDate()).padStart(2, '0');
-    const hours = String(date.getHours()).padStart(2, '0');
-    const minutes = String(date.getMinutes()).padStart(2, '0');
-    const seconds = String(date.getSeconds()).padStart(2, '0');
-    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-});
 
 // 处理刷新按钮点击
 const handleRefresh = () => {
@@ -184,7 +147,7 @@ const handleItemClick = () => {
     uni.$u.route({
         type: 'navigateTo',
         url: '/plant/code/code-detail-list/index',
-        params: { id: props.item.id }
+        params: { id: props.item.id },
     });
     emit('itemClick', props.item);
 };
@@ -196,7 +159,7 @@ watch(
         // 可以在这里处理 item 变化后的逻辑
         console.log('item 变化:', newVal);
     },
-    { deep: true }
+    { deep: true },
 );
 </script>