huangxw vor 1 Woche
Ursprung
Commit
6164ae989d

+ 1 - 1
src/plant/models/pack-card.vue

@@ -31,7 +31,7 @@
                     <span class="c-#333 f-w-5">{{ item?.capacity }}{{ item?.storageUseUnit }}/{{ item?.unit }}</span>
                 </view>
                 <view class="f-s-28 pd2-4-0 hcol-15">
-                    <span class="c-#666">包装总量:</span>
+                    <span class="c-#666">包装总量:</span>
                     <span class="c-#333 f-w-5">{{ item?.storageUseAmount }}{{ item?.storageUseUnit }}</span>
                 </view>
                 <view class="f-s-28 pd2-4-0 hcol-15">

+ 49 - 73
src/plant/packaging/detail/models/relate-info-page.vue

@@ -13,7 +13,7 @@
                     <view class="pd-20"></view>
                 </pack-card>
                 <view class="btn-card-wrapper d-flex a-c j-c">
-                    <view class="btn-bottom-bt pm-style" @click="goPrint({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount }, '/plant/export-print/export/index')">
+                    <view class="btn-bottom-bt pm-style" @click="goRelate({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: +form?.planCount - +form?.actualCount }, '/plant/packaging/batch-link/index')">
                         <image class="w-32 h-32 mr-8" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/btn_plgl_icon.png" mode="widthFix" />
                         <span>批量关联</span>
                     </view>
@@ -28,59 +28,33 @@
             </view>
             <view>
                 <template v-for="(item, index) in list" :key="index">
-                    <template v-if="item?.printType == '1'">
-                        <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
-                            <view class="f-s-28 pd2-4-0">
-                                <span class="c-#666">打印数量:</span>
-                                <span class="c-#333 f-w-5">{{ item?.printCount }}</span>
-                            </view>
-                            <view class="f-s-28 pd2-4-0 d-flex">
-                                <span class="c-#666">打印码值:</span>
-                                <view class="flex1 ov-hd c-#333 f-w-5">
-                                    <view>{{ item?.traceCodeStart }} 至</view>
-                                    <view>{{ item?.traceCodeEnd }}</view>
-                                </view>
-                            </view>
-                            <view class="d-flex f-s-24 c-#666">
-                                <view class="flex1 ov-hd">打印人:{{ item?.createByName || '-' }}</view>
-                                <view class="pr-100">打印时间:{{ item?.createTime || '-' }}</view>
-                            </view>
-                            <view class="pt-20 d-flex">
-                                <view class="flex1"></view>
-                                <view class="d-flex a-c">
-                                    <up-button @click="clickAllPrint(item)" :customStyle="formItemBtnListStyle" class="ml-20" color="#18BECA">全部打印</up-button>
-                                    <up-button @click="$u.route({ url: '/plant/print/print-range/index', params: item })" :customStyle="formItemBtnListStyle" class="ml-20" color="#37A954">区间打印</up-button>
-                                </view>
-                            </view>
+                    <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
+                        <view class="f-s-28 pd2-4-0">
+                            <span class="c-#666">关联码数量:</span>
+                            <span class="c-#333 f-w-5">{{ item?.refrenceCount }}</span>
                         </view>
-                    </template>
-                    <template v-if="item?.printType == '2'">
-                        <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
-                            <view class="f-s-24 c-#333 f-w-5">{{ selectDictLabel(pt_code_export_type, item?.extraInfo?.fileType) }}</view>
-                            <view class="f-s-28 pd2-4-0">
-                                <span class="c-#666">导出数量:</span>
-                                <span class="c-#333 f-w-5">{{ item?.printCount }}</span>
-                            </view>
-                            <view class="f-s-28 pd2-4-0 d-flex">
-                                <span class="c-#666">导出码值:</span>
-                                <view class="flex1 ov-hd c-#333 f-w-5">
-                                    <view>{{ item?.traceCodeStart }} 至</view>
-                                    <view>{{ item?.traceCodeEnd }}</view>
-                                </view>
-                            </view>
-                            <view class="d-flex f-s-24 c-#666">
-                                <view class="flex1 ov-hd">导出人:{{ item?.createByName || '-' }}</view>
-                                <view class="pr-100">导出时间:{{ item?.createTime || '-' }}</view>
+                        <view class="f-s-28 pd2-4-0">
+                            <span class="c-#666">所用追溯码生成批次:</span>
+                            <span class="c-#333 f-w-5">{{ item?.refrenceInfo?.batchSn }}</span>
+                        </view>
+                        <view class="f-s-28 pd2-4-0 d-flex">
+                            <span class="c-#666">关联的追溯码码段:</span>
+                            <view class="flex1 ov-hd c-#333 f-w-5">
+                                <view>{{ item?.refrenceInfo?.startTraceCode }} 至</view>
+                                <view>{{ item?.refrenceInfo?.endTraceCode }}</view>
                             </view>
-                            <view class="pt-20 d-flex">
-                                <view class="flex1"></view>
-                                <view class="d-flex a-c">
-                                    <up-button @click="$u.route({ url: '/plant/export-print/export/index', params: item })" :customStyle="formItemBtnListStyle" color="#18BECA">重新导出</up-button>
-                                </view>
+                        </view>
+                        <view class="d-flex f-s-24 c-#666">
+                            <view class="flex1 ov-hd">关联人:{{ item?.createByName || '-' }}</view>
+                            <view class="pr-100">关联时间:{{ item?.createTime || '-' }}</view>
+                        </view>
+                        <view class="pt-20 d-flex">
+                            <view class="flex1"></view>
+                            <view class="d-flex a-c">
+                                <up-button @click="closeRelate(item)" :customStyle="formItemBtnListStyle" class="ml-20" color="#F4A91A">取消关联</up-button>
                             </view>
                         </view>
-                    </template>
-                    <template></template>
+                    </view>
                 </template>
             </view>
         </view>
@@ -107,12 +81,9 @@ const props = defineProps({
         default: () => null,
     },
 });
-const printType = ref('1');
 const { pt_pack_ref_type, pt_code_export_type } = toRefs(props?.dict);
 const emit = defineEmits(['changeTebs']);
-const tabs = reactive([
-    { label: '关联记录', value: '1' },
-]);
+const tabs = reactive([{ label: '关联记录', value: '1' }]);
 const changeTebs = () => {
     emit('changeTebs', 'pack');
 };
@@ -122,9 +93,8 @@ const query = async (pageNum: number, pageSize: number) => {
         pageNum,
         pageSize,
         packId: props.packId,
-        printType: printType.value,
     };
-    const res = await useClientRequest.get('/plt-api/app/printLog/list', params);
+    const res = await useClientRequest.get('/plt-api/app/packRelation/list', params);
     if (res && res?.rows) {
         const { rows } = res;
         paging.value?.complete(rows);
@@ -137,32 +107,38 @@ const onRefresh = () => {
         console.error('刷新列表失败:', error);
     }
 };
-const clickAllPrint = async (item: any) => {
+const closeRelate = async (item: any) => {
     try {
-        const res = await uni.showModal({
-            title: '全部打印提示',
-            content: '您确认需要再次打印该条记录的全部追溯码吗?',
-            confirmColor: '#37A954',
+        const confirmRes = await uni.showModal({
+            title: '提示',
+            content: '确认要取消关联吗?',
+            confirmColor: '#F4A91A',
         });
-        if (res.confirm) {
-            uni.$u.route({ type: 'navigateTo', url: '/plant/print/print-all/index', params: item });
+        if (!confirmRes.confirm) return;
+
+        const res = await useClientRequest.get(`/plt-api/app/packRelation/cancelRelate/${item?.id}`);
+        if (res && res.code === 200) {
+            uni.showToast({ title: '取消关联成功', icon: 'success' });
+            uni.$emit('refreshPackTaskDetail'); // 取消关联后刷新详情数据
+            uni.$emit('refreshPackTaskList'); // 取消关联后刷新列表数据
         }
     } catch (error) {
-        console.error('全部打印失败:', error);
-    }
+        console.error('取消关联失败:', error);
+        uni.showToast({ title: '取消关联失败', icon: 'error' });
+     }
 };
-const goPrint = async (params: any, url: string) => {
-    if (!params?.printedCount) {
+const goRelate = async (params: any, url: string) => {
+    if (params?.printedCount <= 0) {
         uni.showModal({
             title: '提示',
-            content: '没有可打印的追溯码了哦~',
+            content: '没有可关联的追溯码了哦~',
             showCancel: false,
             confirmColor: '#37A954',
         });
         return;
     }
     try {
-        uni.$u.route({ type: 'navigateTo', url: url || '/plant/print/print-self/index', params });
+        uni.$u.route({ type: 'navigateTo', url: url || '/plant/packaging/batch-link/index', params });
     } catch (error) {
         console.error('跳转打印页面失败:', error);
     }
@@ -223,9 +199,9 @@ onMounted(() => {
     color: #fc8834;
 }
 .pm-style {
-    background-color: #E8FDEE;
-    box-shadow: inset 0 0 10px #D2F3DA;
-    border-color: #9BD4A9;
-    color: #37A954;
+    background-color: #e8fdee;
+    box-shadow: inset 0 0 10px #d2f3da;
+    border-color: #9bd4a9;
+    color: #37a954;
 }
 </style>