Эх сурвалжийг харах

feat(warehouse): 1. 新增全局防重复点击自定义指令v-click-once并注册
2. 库存调拨页面新增颜色、机型列表列
3. 为提交保存按钮添加防重复点击指令
4. 补全表单提交参数中的机型和分类编码字段

liujt 1 сар өмнө
parent
commit
6b5d431af4

+ 5 - 0
src/main.js

@@ -13,6 +13,8 @@ import DictSelection from '@/components/Dict/DictSelection';
 import HeaderTitle from '@/components/header-title';
 import initParentStore from '../qiankun_config/store';
 import elTableInfiniteScroll from 'el-table-infinite-scroll';
+
+import clickOnce from './utils/clickOnce.js';
 // bpmnProcessDesigner 需要引入
 import MyPD from '@/components/bpmnProcessDesigner/package/index.js';
 Vue.use(MyPD);
@@ -25,6 +27,9 @@ import { create, all } from 'mathjs'; // 引入mathjs工具并初始化
 import authSelection from '@/components/AuthSelection';
 import Print from 'vue-printjs';
 
+// 注册全局自定义指令
+Vue.directive('click-once', clickOnce);
+
 
 import seekPage from '@/components/seekPage';
 Vue.component('seekPage', seekPage);

+ 35 - 0
src/utils/clickOnce.js

@@ -0,0 +1,35 @@
+export default {
+  bind(el, binding, vnode) {
+    // 创建加载指示器元素
+    const loadingIndicator = document.createElement('i');
+    loadingIndicator.classList.add('loading-indicator', 'el-icon-loading'); // 假设使用 Element UI 的加载图标
+    el.appendChild(loadingIndicator);
+
+    // 隐藏加载指示器,默认不显示
+    loadingIndicator.style.display = 'none';
+
+    // 保存加载指示器引用
+    el._loadingIndicator = loadingIndicator;
+
+    // 添加点击事件监听器
+    el.addEventListener('click', () => {
+      // 显示加载指示器
+      loadingIndicator.style.display = 'inline-block';
+
+      // 禁用按钮
+      el.setAttribute('disabled', '');
+
+      // 假设这里有一个异步操作,完成后需要隐藏加载指示器和重新启用按钮
+      setTimeout(() => {
+        loadingIndicator.style.display = 'none';
+        el.removeAttribute('disabled'); // 重新启用按钮
+      }, 2000); // 模拟异步操作耗时2秒
+    });
+
+    // 清理事件监听器,防止内存泄漏
+    vnode.context.$once('hook:beforeDestroy', () => {
+      el.removeEventListener('click', () => {});
+      el.removeChild(loadingIndicator);
+    });
+  }
+};

+ 18 - 2
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -407,8 +407,8 @@
             </template>
           </ele-pro-table>
           <div class="submit_item">
-            <el-button type="primary" @click="submit(0)">保存</el-button
-            ><el-button type="primary" @click="config">提交</el-button></div
+            <el-button v-click-once type="primary" @click="submit(0)">保存</el-button
+            ><el-button v-click-once type="primary" @click="config">提交</el-button></div
           >
         </div>
       </div>
@@ -591,6 +591,13 @@
             minWidth: 130,
             showOverflowTooltip: true,
           },
+          {
+            prop: 'modeKey',
+            label: '机型',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true,
+          },
           ...(this.dimension != '1' ? [{
             prop: 'batchNo',
             label: '批次号',
@@ -758,6 +765,13 @@
             minWidth: 130,
             showOverflowTooltip: true,
           },
+          {
+            prop: 'modeKey',
+            label: '机型',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true,
+          },
           // {
           //   prop: 'batchNo',
           //   label: '批次号',
@@ -1488,7 +1502,9 @@
               allotApplyAddPOBuilders: this.tableData.map((item) => {
                 return {
                   colorKey: item.colorKey,
+                  modeKey: item.modeKey,
                   quantity: item.quantity,
+                  categoryCode: item.categoryCode,
                   categoryId: item.categoryId,
                   warehouseId: item.warehouseId,
                   warehouseName: item.warehouseName,

+ 10 - 0
src/views/warehouseManagement/inventoryAllocation/details.vue

@@ -159,6 +159,16 @@
               prop="specification"
               :show-overflow-tooltip="true"
             ></el-table-column>
+            <el-table-column
+              label="颜色"
+              prop="colorKey"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="机型"
+              prop="modeKey"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
             <el-table-column
               v-if="infoData.inventoryDimension == 3"
               label="包装编码"