Explorar o código

提交pdfjs插件与install修改物资盘点界面显示

pm hai 8 meses
pai
achega
74f1e7d092

+ 1 - 0
package.json

@@ -56,6 +56,7 @@
     "konva": "^9.3.15",
     "monaco-editor": "^0.52.0",
     "nprogress": "0.2.0",
+    "pdfjs-dist": "^4.10.38",
     "quill": "1.3.7",
     "screenfull": "5.0.2",
     "sortablejs": "1.10.2",

+ 1 - 0
public/pdf/web/viewer.html

@@ -414,3 +414,4 @@ See https://github.com/adobe-type-tools/cmap-resources
     <input type="file" id="fileInput" class="hidden">
   </body>
 </html>
+

+ 10 - 9
public/pdf/web/viewer.js

@@ -55,6 +55,7 @@ const OptionKind = {
   PREFERENCE: 0x80
 };
 exports.OptionKind = OptionKind;
+
 const defaultOptions = {
   annotationMode: {
     value: 2,
@@ -2171,11 +2172,11 @@ let validateFileURL;
         return;
       }
 
-      const fileOrigin = new URL(file, window.location.href).origin;
+      // const fileOrigin = new URL(file, window.location.href).origin;
 
-      if (fileOrigin !== viewerOrigin) {
-        throw new Error("file origin does not match viewer's");
-      }
+      // if (fileOrigin !== viewerOrigin) {
+      //   throw new Error("file origin does not match viewer's");
+      // }
     } catch (ex) {
       PDFViewerApplication.l10n.get("loading_error").then(msg => {
         PDFViewerApplication._documentError(msg, {
@@ -15376,7 +15377,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
 /************************************************************************/
 /******/ 	// The module cache
 /******/ 	var __webpack_module_cache__ = {};
-/******/ 	
+/******/
 /******/ 	// The require function
 /******/ 	function __webpack_require__(moduleId) {
 /******/ 		// Check if module is in cache
@@ -15390,14 +15391,14 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
 /******/ 			// no module.loaded needed
 /******/ 			exports: {}
 /******/ 		};
-/******/ 	
+/******/
 /******/ 		// Execute the module function
 /******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/ 	
+/******/
 /******/ 		// Return the exports of the module
 /******/ 		return module.exports;
 /******/ 	}
-/******/ 	
+/******/
 /************************************************************************/
 var __webpack_exports__ = {};
 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
@@ -15587,4 +15588,4 @@ if (document.readyState === "interactive" || document.readyState === "complete")
 
 /******/ })()
 ;
-//# sourceMappingURL=viewer.js.map
+//# sourceMappingURL=viewer.js.map

+ 7 - 0
src/api/mes/statisticians/index.js

@@ -69,3 +69,10 @@ export function getMaterialInventory(query){
     }
   })
 }
+//物资判断上方统计总数 /dev-api/iscs/statistics-api/getInventorySum
+export function getInventorySum(){
+  return request({
+    url: '/iscs/statistics-api/getInventorySum',
+    method: 'get',
+  })
+}

+ 2 - 2
src/views/dashboard/LineChart.vue

@@ -115,7 +115,7 @@ export default {
               },
               smooth: true,
               type: 'bar',
-              stack: 'Ad',  // 启用堆叠效果
+
               data: loanCount || [],
               animationDuration: 2800,
               animationEasing: 'cubicInOut'
@@ -124,7 +124,7 @@ export default {
               name: '归还',
               smooth: true,
               type: 'bar',
-              stack: 'Ad',  // 启用堆叠效果
+
               itemStyle: {
                 normal: {
                   color: '#3888fa',

+ 165 - 31
src/views/mes/material/inventory/index.vue

@@ -5,14 +5,23 @@
       <el-radio-button
         v-for="tab in tabs"
         :key="tab.dictValue"
-        :label="tab.dictValue">
-        {{ tab.dictLabel }}
+        :label="tab.dictValue"
+      >
+        <template #default>
+          <span v-if="tab.dictValue=='0'" class="el-icon-menu"></span>
+          <span v-if="tab.dictValue=='1'" class="el-icon-folder-checked"></span>
+          <span v-if="tab.dictValue=='2'" class="el-icon-sort"></span>
+          <span v-if="tab.dictValue=='3'" class="el-icon-circle-check"></span>
+          <span v-if="tab.dictValue=='4'" class="el-icon-question"></span>
+          <span v-if="tab.dictValue=='5'" class="el-icon-warning"></span>
+          {{ tab.dictLabel }} ({{ tab.sum }})
+        </template>
       </el-radio-button>
     </el-radio-group>
 
     <!-- 表格部分 -->
     <div class="table-container">
-      <table>
+      <table v-show="currentTab === '0' || currentTab === '1' || currentTab === '3'">
         <thead>
         <tr>
           <th>物资类型</th>
@@ -21,11 +30,33 @@
         </thead>
         <tbody>
         <tr v-for="(materialType, index) in materialTypes" :key="index">
-          <td>
-            <img :src="materialType.materialsTypeIcon" alt="Material Icon" width="50" height="50" />
+          <td width="150">
+            <img :src="materialType.materialsTypeIcon" alt="Material Icon" width="50" height="50"/><br>
             {{ materialType.materialsTypeName }}
           </td>
-          <td v-for="cabinet in cabinets" :key="cabinet.cabinetId">
+          <td style="font-size: 22px" v-for="cabinet in cabinets" :key="cabinet.cabinetId">
+            {{ getCellData(materialType.materialsTypeId, cabinet.cabinetId) }}
+          </td>
+        </tr>
+        </tbody>
+      </table>
+
+      <table v-show="currentTab === '2' || currentTab === '4' || currentTab === '5'">
+        <thead>
+        <tr>
+          <th>物资类型</th>
+          <th v-for="cabinet in cabinets" :key="cabinet.cabinetId">{{ cabinet.cabinetName }}</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr v-for="(materialType, index) in materialTypes" :key="index">
+          <td width="150">
+            <img :src="materialType.materialsTypeIcon" alt="Material Icon" width="50" height="50"/><br>
+            {{ materialType.materialsTypeName }}
+          </td>
+          <td style="font-size: 22px" v-for="cabinet in cabinets" :key="cabinet.cabinetId"
+              :style="getCellStyle(materialType.materialsTypeId, cabinet.cabinetId)"
+          >
             {{ getCellData(materialType.materialsTypeId, cabinet.cabinetId) }}
           </td>
         </tr>
@@ -34,59 +65,158 @@
     </div>
   </div>
 </template>
-
 <script>
-import { getMaterialInventory } from '@/api/mes/statisticians'
+import { getInventorySum, getMaterialInventory } from '@/api/mes/statisticians'
 import { getDicts } from '@/api/system/dict/data'
 
 export default {
-  dicts:["Inventory_type"],
+  dicts: ['Inventory_type'],
   data() {
     return {
       currentTab: '0', // 当前选中的Tab
       tabs: [],
-      tableData:[],//各个物资柜数据
-    };
+      tableData0: [],//各个物资柜数据
+      tableData1: [],
+      tableData2: [],//各个物资柜数据
+      tableData3: [],
+      tableData4: [],//各个物资柜数据
+      tableData5: []
+    }
+  },
+  watch: {
+    currentTab(newVal) {
+      getMaterialInventory(this.currentTab).then(response => {
+        console.log(response, '物资盘点')
+        switch (newVal) {
+          case '0':
+            this.tableData0 = response.data
+            break;
+          case '1':
+            this.tableData1 = response.data
+            break;
+          case '2':
+            this.tableData2 = response.data
+            break;
+          case '3':
+            this.tableData3 = response.data
+            break;
+          case '4':
+            this.tableData4 = response.data
+            break;
+          case '5':
+            this.tableData5 = response.data
+            break;
+        }
+
+      })
+    }
   },
   computed: {
     cabinets() {
-      return this.tableData;
+      return this.tableData0||this.tableData1||this.tableData2||this.tableData3||this.tableData4||this.tableData5
     },
     materialTypes() {
       // 假设我们只取第一个物资柜的所有物资类型
-      if (this.tableData.length > 0) {
-        return this.tableData[0].materialsTypeVOList;
+      if (this.tableData0.length > 0) {
+        return this.tableData0[0].materialsTypeVOList
+      }else if (this.tableData1.length > 0) {
+        return this.tableData1[0].materialsTypeVOList
+      }else if (this.tableData2.length > 0) {
+        return this.tableData2[0].materialsTypeVOList
+      }else if (this.tableData3.length > 0) {
+        return this.tableData3[0].materialsTypeVOList
+      }else if (this.tableData4.length > 0) {
+        return this.tableData4[0].materialsTypeVOList
+      }else if (this.tableData5.length > 0) {
+        return this.tableData5[0].materialsTypeVOList
       }
-      return [];
+      return []
     }
   },
   mounted() {
-
-    this.getList();
+    this.getList()
   },
   methods: {
-    getList(){
-      getDicts('Inventory_type').then((res) => {
-        this.tabs=res.data
-      })
-      getMaterialInventory(this.currentTab).then(response => {
-        console.log(response,'物资盘点');
-        this.tableData=response.data
+    getList() {
 
+      getMaterialInventory(this.currentTab).then(response => {
+        console.log(response, '物资盘点')
+        // this.tableData = response.data
+        switch (this.currentTab) {
+          case '0':
+            this.tableData0 = response.data
+            break;
+          case '1':
+            this.tableData1 = response.data
+            break;
+          case '2':
+            this.tableData2 = response.data
+            break;
+          case '3':
+            this.tableData3 = response.data
+            break;
+          case '4':
+            this.tableData4 = response.data
+            break;
+          case '5':
+            this.tableData5 = response.data
+            break;
+        }
+      })
+      getInventorySum().then(response => {
+        console.log(response, '总数')
+        this.tabs = response.data
       })
     },
     getCellData(materialTypeId, cabinetId) {
-      const cabinet = this.tableData.find(c => c.cabinetId === cabinetId);
+      let tableData=null
+      switch (this.currentTab) {
+        case '0':
+          tableData = this.tableData0
+          break;
+        case '1':
+          tableData = this.tableData1
+          break;
+        case '2':
+          tableData = this.tableData2
+          break;
+        case '3':
+          tableData = this.tableData3
+          break;
+        case '4':
+          tableData = this.tableData4
+          break;
+        case '5':
+          tableData = this.tableData5
+          break;
+      }
+      const cabinet = tableData.find(c => c.cabinetId === cabinetId)
       if (cabinet) {
-        const materialType = cabinet.materialsTypeVOList.find(m => m.materialsTypeId === materialTypeId);
+        const materialType = cabinet.materialsTypeVOList.find(m => m.materialsTypeId === materialTypeId)
         if (materialType) {
-          return materialType.number;
+          return materialType.number == null || materialType.number == 0 ? '-' : materialType.number
         }
       }
-      return 0;
+      return 0
+    },
+
+    getCellStyle(materialTypeId, cabinetId) {
+      const number = this.getCellData(materialTypeId, cabinetId)
+      if (number === null || number === 0) {
+        return {}
+      }
+
+      if (this.currentTab === '2' && number > 0) {
+        return { backgroundColor: 'yellow', color: 'black' }
+      }
+      if ((this.currentTab === '4' || this.currentTab === '5') && number > 0) {
+        return { backgroundColor: 'red', color: 'black' }
+      }
+
+      return {}
     }
   }
-};
+}
 </script>
 
 <style scoped>
@@ -96,17 +226,21 @@ export default {
 }
 
 table {
-  width: 100%;
+  width: 790px;
   border-collapse: collapse;
+  table-layout: fixed;
 }
 
 th, td {
   border: 1px solid #ddd;
   padding: 8px;
-  text-align: left;
+  text-align: center;
 }
 
+
 th {
+
   background-color: #f2f2f2;
+
 }
 </style>

+ 2 - 2
vue.config.js

@@ -36,14 +36,14 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // http://36.133.174.236:9090  http://192.168.1.127:9090 http://192.168.31.110:9090(动感光波) 192.168.28.97:9090(车总GRKJ)
-        target: `http://36.133.174.236:9190`,
+        target: `http://192.168.28.97:9190`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       '/ureport': {
-        target: 'http://36.133.174.236:9190',
+        target: 'http://192.168.28.97:9190',
         ws:false,
         changeOrigin: true,
         pathRewrite: {