From 87f07e589fb1c8103513a5fcc8febe3b14f5535f Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期五, 01 十二月 2023 17:30:46 +0800
Subject: [PATCH] feat: 1、图片预览使用半路径 2、部门物品退回详情

---
 admin-web/src/views/stock/scrap/itemScrapping/detail.vue |   91 +++++++++++++++------------------------------
 1 files changed, 30 insertions(+), 61 deletions(-)

diff --git a/admin-web/src/views/stock/scrap/itemScrapping/detail.vue b/admin-web/src/views/stock/scrap/itemScrapping/detail.vue
index c6b0a1e..673d8d0 100644
--- a/admin-web/src/views/stock/scrap/itemScrapping/detail.vue
+++ b/admin-web/src/views/stock/scrap/itemScrapping/detail.vue
@@ -1,12 +1,12 @@
 <template>
-  <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'">
+  <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'" :loading="loading">
     <el-row :gutter="20">
       <el-col :span="8">
         <span>鎶ュ簾鍗曞彿锛�</span>
         <span>{{ detail.businessFormCode }}</span>
       </el-col>
       <el-col :span="8">
-        <span>鎶ュ簾浠撳簱锛�</span>
+        <span>浠撳簱锛�</span>
         <span>{{ detail.warehouseName }}</span>
       </el-col>
       <el-col :span="8">
@@ -16,73 +16,38 @@
     </el-row>
     <el-row :gutter="20" style="margin-top: 20px">
       <el-col :span="8">
-        <span>鐘舵�侊細</span>
-        <span>{{ detail.states == 1 ? '寰呮姤搴�' : '宸叉姤搴�' }}</span>
-      </el-col>
-      <el-col :span="8">
         <span>鍒涘缓浜猴細</span>
-        <span>{{ detail.buyerName }}</span>
+        <span>{{ detail.operatorName }}</span>
       </el-col>
       <el-col :span="8">
         <span>鎶ュ簾鏃堕棿锛�</span>
-        <span>{{ detail.incomeTime | formatTime }}</span>
-      </el-col>
-    </el-row>
-    <el-row :gutter="20" style="margin-top: 20px">
-      <el-col class="img-row" :span="12">
-        <span>鎶ュ簾绫诲瀷锛�</span>
-        <span>{{ detail.buyType == 1 ? '闆嗛噰' : '鑷噰' }}</span>
+        <span>{{ detail.dealTime | formatTime }}</span>
       </el-col>
     </el-row>
     <el-row :gutter="20" style="margin-top: 20px">
       <el-col class="img-row" :span="24">
-        <span>鎶ュ簾鎵嬬画鐓х墖锛�</span>
+        <span>鎶ュ簾鎵嬬画锛�</span>
         <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)">
           <img class="img" :src="getUrl(item.path)" alt="" />
         </div>
       </el-col>
     </el-row>
-    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.procureGoods" :key="goodsIndex">
+    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.scrappedGoods" :key="goodsIndex">
       <el-row :gutter="20">
         <el-col :span="8">
           <span>鐗╁搧鍒嗙被锛�</span>
-          <span>{{ goodsItem.baseCategoryName }}</span>
+          <span>{{ goodsItem.categoryName }}</span>
         </el-col>
         <el-col :span="8">
           <span>鐗╁搧鍚嶇О锛�</span>
-          <span>{{ goodsItem.goodsTemplateName }}</span>
-        </el-col>
-        <el-col :span="8">
-          <span>渚涜揣鍟嗭細</span>
-          <span>{{ goodsItem.supplier }}</span>
+          <span>{{ goodsItem.goodsName }}</span>
         </el-col>
       </el-row>
       <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px">
-        <el-table-column prop="baseGoodsModelsName" label="瑙勬牸鍨嬪彿" align="center">
-          <template slot-scope="scope">
-            {{ scope.row.baseGoodsModelsName }}
-          </template>
-        </el-table-column>
-        <el-table-column label="鍗曚綅" align="center">
-          <template slot-scope="scope">
-            {{ scope.row.unit }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="price" label="鍗曚环" align="center">
-          <template slot-scope="scope">
-            {{ scope.row.price }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="counts" label="鎶ュ簾鏁伴噺" align="center">
-          <template slot-scope="scope">
-            {{ scope.row.counts }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="counts" label="閲戦" align="center">
-          <template slot-scope="scope">
-            {{ (scope.row.price * scope.row.counts).toFixed(2) }}
-          </template>
-        </el-table-column>
+        <el-table-column prop="baseGoodsModelsName" label="瑙勬牸鍨嬪彿" align="center"></el-table-column>
+        <el-table-column label="鍗曚綅" prop="unit" align="center"></el-table-column>
+        <el-table-column prop="counts" label="鎶ュ簾鏁伴噺" align="center"></el-table-column>
+        <el-table-column prop="scrappedName" label="鎶ュ簾鍘熷洜" align="center"></el-table-column>
       </el-table>
     </div>
     <div id="uploadPreviewImages" style="display: none">
@@ -90,7 +55,7 @@
         <img
           v-if="checkImg(src.name)"
           class="v-img"
-          :src="src.url"
+          :src="getUrl(src.path)"
           :alt="src.name"
           style="width: 100px; height: 100px"
         />
@@ -99,12 +64,13 @@
   </win-md>
 </template>
 <script>
-import { procureDetail } from '@/api/stock/procure/purchaseOrder';
+import {scrappedDetail} from '@/api/stock/scrap';
 import winMd from '@/components/win/win-md';
 import * as DateFormatter from '@/utils/DateFormatter';
-import { getDownUrl } from '@/utils/base';
+import {getDownUrl} from '@/utils/base';
 import Viewer from 'viewerjs';
 import 'viewerjs/dist/viewer.css';
+import {getDicts} from '@/api/system/dict/data';
 
 let viewer = null;
 
@@ -119,19 +85,20 @@
   },
   data() {
     return {
+      loading: true,
+      scrapReasonOptions: [],
       fileList: [],
       detail: {
         baseCategoryName: '',
         businessFormCode: '',
         goodsTemplateName: '',
-        procureDoc: '',
+        uploadFiles: '',
         agencyId: '',
         agencyName: '',
         states: '',
         createName: '',
         time: '',
-        procureGoods: [{}, {}],
-        fileKey: Math.random(),
+        scrappedGoods: [],
       },
     };
   },
@@ -142,15 +109,23 @@
     },
   },
   created() {
-    procureDetail({ id: this.setting.id }).then((res) => {
+    scrappedDetail({ id: this.setting.id }).then((res) => {
       this.detail = res;
-      this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : [];
+      this.loading = false
+      this.fileList = this.detail.uploadFiles ? JSON.parse(this.detail.uploadFiles) : [];
       this.$nextTick(() => {
         this.initPreviewImg();
       });
     });
+    getDicts('SCRAP_REASON').then((res) => {
+      this.scrapReasonOptions = res;
+    });
   },
   methods: {
+    getDictName(code) {
+      let item = this.scrapReasonOptions.find(v=>v.dict_value==code)
+      return item ? item.dict_label : ''
+    },
     initPreviewImg() {
       if (viewer != null) {
         viewer.destroy();
@@ -172,12 +147,6 @@
           index++;
         }
       }
-      // this.fileList.forEach((f, i) => {
-      //   if (file.uid == f.uid) {
-      //     index = i
-      //   }
-      // })
-      // document.querySelector('#uploadPreviewImages').children[0].click()
       viewer.view(index);
     },
     checkImg(name) {

--
Gitblit v1.9.1