From 02f85f84ce3d2212736e231c376dd084a7153783 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期四, 30 十一月 2023 15:09:15 +0800
Subject: [PATCH] feat: 库存管理 出库管理、采购管理、报废管理 新增时物品查询增加机构限制

---
 admin-web/src/views/stock/transfer/transferApplication/detail.vue |  201 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 130 insertions(+), 71 deletions(-)

diff --git a/admin-web/src/views/stock/transfer/transferApplication/detail.vue b/admin-web/src/views/stock/transfer/transferApplication/detail.vue
index aa1a128..f4c453a 100644
--- a/admin-web/src/views/stock/transfer/transferApplication/detail.vue
+++ b/admin-web/src/views/stock/transfer/transferApplication/detail.vue
@@ -1,76 +1,87 @@
 <template>
   <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'" :loading="loading">
-    <div v-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>{{ detail.outAgencyName }}</span>
-        </el-col>
-        <el-col :span="8">
-          <span>鎺ユ敹鏈烘瀯锛�</span>
-          <span>{{ detail.inAgencyName }}</span>
-        </el-col>
-      </el-row>
-      <el-row :gutter="20" style="margin-top: 20px">
-        <el-col :span="8">
-          <span>鐢宠璋冩嫧鏃堕棿锛�</span>
-          <span>{{ detail.createTime | formatTime }}</span>
-        </el-col>
-        <el-col :span="8">
-          <span>鐘舵�侊細</span>
-          <span>{{ getStatesLabel(detail.states) }}</span>
-        </el-col>
-        <el-col :span="8">
-          <span>璋冩嫧鏃堕棿锛�</span>
-          <span>{{ detail.outputTime | formatTime }}</span>
-        </el-col>
-      </el-row>
-      <el-row v-if="fileList && fileList.length" :gutter="20" style="margin-top: 20px">
-        <el-col class="img-row" :span="24">
-          <span>璋冩嫧鎵嬬画鐓х墖锛�</span>
+
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <span>璋冩嫧鍗曞彿锛�</span>
+        <span>{{ detail.businessFormCode }}</span>
+      </el-col>
+      <el-col :span="8">
+        <span>璋冩嫧鏈烘瀯锛�</span>
+        <span>{{ detail.outAgencyName }}</span>
+      </el-col>
+      <el-col :span="8">
+        <span>鎺ユ敹鏈烘瀯锛�</span>
+        <span>{{ detail.inAgencyName }}</span>
+      </el-col>
+    </el-row>
+    <el-row :gutter="20" style="margin-top: 20px">
+      <el-col :span="8">
+        <span>鐢宠璋冩嫧鏃堕棿锛�</span>
+        <span>{{ detail.createTime | formatTime }}</span>
+      </el-col>
+      <el-col :span="8">
+        <span>鐘舵�侊細</span>
+        <span>{{ getStatesLabel(detail.states) }}</span>
+      </el-col>
+      <el-col :span="8">
+        <span>璋冩嫧鏃堕棿锛�</span>
+        <span>{{ detail.outputTime | formatTime }}</span>
+      </el-col>
+    </el-row>
+    <el-row v-if="fileList && fileList.length" :gutter="20" style="margin-top: 20px">
+      <el-col class="img-row" :span="24">
+        <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="" />
+          <img class="img" :src="getUrl(item.path)" alt=""/>
         </div>
+      </el-col>
+    </el-row>
+    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.formTransferGoods" :key="goodsIndex">
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <span>鐗╁搧鍒嗙被锛�</span>
+          <span>{{ goodsItem.categoryName }}</span>
+        </el-col>
+        <el-col :span="12">
+          <span>鐗╁搧鍚嶇О锛�</span>
+          <span>{{ goodsItem.goodsName }}</span>
         </el-col>
       </el-row>
-      <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.formTransferGoods" :key="goodsIndex">
-        <el-row :gutter="20">
-          <el-col :span="12">
-            <span>鐗╁搧鍒嗙被锛�</span>
-            <span>{{ goodsItem.categoryName }}</span>
-          </el-col>
-          <el-col :span="12">
-            <span>鐗╁搧鍚嶇О锛�</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="counts" label="璋冩嫧鏁伴噺" align="center">
-            <template slot-scope="scope">
-              {{ scope.row.counts }}
-            </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>
-      </div>
+      <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="counts" label="璋冩嫧鏁伴噺" align="center">
+          <template slot-scope="scope">
+            {{ scope.row.counts }}
+          </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>
+    </div>
+
+    <div id="uploadPreviewImages" style="display: none">
+      <span v-for="(src, index) in fileList" :key="index">
+        <img
+            v-if="checkImg(src.name)"
+            class="v-img"
+            :src="src.url"
+            :alt="src.name"
+            style="width: 100px; height: 100px"
+        />
+      </span>
     </div>
   </win-md>
 </template>
@@ -79,21 +90,28 @@
 import * as DateFormatter from '@/utils/DateFormatter';
 import winMd from '@/components/win/win-md';
 import transfer from '../../../mixins/transfer';
+import {getDownUrl} from "@/utils/base";
+import Viewer from 'viewerjs';
+import 'viewerjs/dist/viewer.css';
+
+let viewer = null;
+
 
 export default {
   mixins: [transfer],
-  components: { winMd },
+  components: {winMd},
   props: {
     setting: {
       type: Object,
-      default: () => {},
+      default: () => {
+      },
     },
   },
   data() {
     return {
       loading: true,
       detail: {},
-      fileList:[]
+      fileList: []
     };
   },
   filters: {
@@ -103,13 +121,54 @@
     },
   },
   created() {
-    transferDetail({ id: this.setting.id }).then((res) => {
+    transferDetail({id: this.setting.id}).then((res) => {
       this.detail = res;
       this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : [];
       this.loading = false;
+      this.$nextTick(() => {
+        this.initPreviewImg();
+      });
     });
   },
   methods: {
+    initPreviewImg() {
+      if (viewer != null) {
+        viewer.destroy();
+      }
+      const ViewerDom = document.querySelector('#uploadPreviewImages');
+      viewer = new Viewer(ViewerDom, {});
+    },
+    handlePreview(file) {
+      if (!this.checkImg(file.name)) {
+        return false;
+      }
+      let index = 0;
+      for (let i = 0; i < this.fileList.length; i++) {
+        const f = this.fileList[i];
+        if (this.checkImg(f.name)) {
+          if (file.id == f.id) {
+            break;
+          }
+          index++;
+        }
+      }
+      viewer.view(index);
+    },
+    checkImg(name) {
+      const suffix = name.substring(name.lastIndexOf('.'), name.length);
+      const imgArray = ['.jpg', '.jpeg', '.png', '.bmp'];
+      if (imgArray.indexOf(suffix) < 0) {
+        return false;
+      }
+      return true;
+    },
+    getUrl(path) {
+      if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') {
+        return path;
+      } else {
+        return getDownUrl() + path;
+      }
+    },
     close() {
       this.$emit('close');
     },

--
Gitblit v1.9.1