Explorar o código

采购订单组件优化:移除产品列表映射逻辑,简化库存表格显示,添加历史采购价格弹窗功能

yusheng hai 9 meses
pai
achega
b1c8bf4941

+ 6 - 6
src/views/purchasingManage/purchaseOrder/components/addDialog.vue

@@ -1103,12 +1103,12 @@
               sourceTypeName: requireSourceTypeName
             });
             this.getLinkInfo(partaId);
-            info.productList = info.productList.map((item) => {
-              item['purchaseCount'] = item.contractCount;
-              item['purchaseUnit'] = item.contractUnit;
-              item['purchaseUnitId'] = item.contractUnitId;
-              return item;
-            });
+            // info.productList = info.productList.map((item) => {
+            //   item['purchaseCount'] = item.contractCount;
+            //   item['purchaseUnit'] = item.contractUnit;
+            //   item['purchaseUnitId'] = item.contractUnitId;
+            //   return item;
+            // });
             if (info.productList.length > 1) {
               this.$refs.planTableListRef.contractOpen(
                 info.productList,

+ 43 - 28
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -79,7 +79,10 @@
         </el-form-item>
       </template>
       <template v-slot:productName="{ row, $index }">
-        <el-form-item
+        <span @click.native="handParent(row, $index)">
+          {{ row.productName }}
+        </span>
+        <!-- <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + $index + '.productName'"
           :rules="{
@@ -93,24 +96,24 @@
             placeholder="请输入"
             @click.native="handParent(row, $index)"
           ></el-input>
-        </el-form-item>
+        </el-form-item> -->
       </template>
-      <template v-slot:productCode="scope">
+      <!-- <template v-slot:productCode="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.productCode'"
         >
           <el-input v-model="scope.row.productCode" disabled></el-input>
         </el-form-item>
-      </template>
-      <template v-slot:productCategoryName="scope">
+      </template> -->
+      <!-- <template v-slot:productCategoryName="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.productCategoryName'"
         >
           <el-input v-model="scope.row.productCategoryName" disabled></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:taxRate="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -148,23 +151,23 @@
         </el-form-item>
       </template>
 
-      <template v-slot:productBrand="scope">
+      <!-- <template v-slot:productBrand="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.productBrand'"
         >
           <el-input v-model="scope.row.productBrand" disabled></el-input>
         </el-form-item>
-      </template>
+      </template> -->
 
-      <template v-slot:modelType="scope">
+      <!-- <template v-slot:modelType="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.modelType'"
         >
           <el-input v-model="scope.row.modelType" disabled></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:specification="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -173,7 +176,7 @@
           <el-input v-model="scope.row.specification"></el-input>
         </el-form-item>
       </template>
-      <template v-slot:deliveryDays="scope">
+      <!-- <template v-slot:deliveryDays="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.deliveryDays'"
@@ -189,7 +192,7 @@
             placeholder="请输入"
           ></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:guaranteePeriod="scope">
         <div class="period">
           <div class="borderleftnone">
@@ -232,9 +235,10 @@
         >
           <el-input
             v-model="scope.row.measuringUnit"
-            :disabled="!!scope.row.productCode"
+            v-if="!scope.row.productCode"
             placeholder="请输入"
           ></el-input>
+          <span v-else>{{ scope.row.measuringUnit }}</span>
         </el-form-item>
       </template>
       <template v-slot:remark="scope">
@@ -260,29 +264,33 @@
             trigger: 'change'
           }"
         >
-          <el-input
+          <!-- <el-input
             v-model="scope.row.singlePrice"
             placeholder="请输入"
             @input="changeCount(scope.row, scope.$index)"
           >
             <template slot="append">元</template>
-          </el-input>
-          <!-- <el-popover placement="right" width="600" trigger="click">
-            <el-table >
+          </el-input> -->
+          <el-popover
+            placement="right"
+            width="600"
+            trigger="click"
+            @show="getPurchaseSinglePrice(scope.row)"
+          >
+            <el-table :data="purchaseSinglePriceData">
               <el-table-column
                 width="300"
-                property="date"
+                property="supplierName"
                 label="供应商"
               ></el-table-column>
               <el-table-column
-                width="150"
-                property="name"
-                label="最近采购价格"
+                width="160"
+                property="purchaseDate"
+                label="	采购日期"
               ></el-table-column>
               <el-table-column
-                width="150"
-                property="address"
-                label="历史采购价格"
+                property="singlePrice"
+                label="采购价格"
               ></el-table-column>
             </el-table>
             <el-input
@@ -293,7 +301,7 @@
             >
               <template slot="append">元</template>
             </el-input>
-          </el-popover> -->
+          </el-popover>
         </el-form-item>
       </template>
       <template v-slot:goodsPriceType="{ row, $index }">
@@ -594,7 +602,7 @@
   import { levelList } from '@/enum/dict.js';
   import { getGoodsPriceByCondition } from '@/api/goodsManage/index';
   import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
-
+  import { queryHistoricalUnitPrice } from '@/api/purchasingManage/purchaseOrder';
   const dayjs = require('dayjs');
 
   export default {
@@ -615,7 +623,7 @@
       detailType: {
         default: 0
       },
-      cacheKeyUrl:'eos-purchasingManage-purchaseOrder-inventoryTable'
+      cacheKeyUrl: 'eos-purchasingManage-purchaseOrder-inventoryTable'
     },
     components: {
       taskinstanceDialog,
@@ -1047,7 +1055,8 @@
             fixed: 'right',
             showOverflowTooltip: true
           }
-        ]
+        ],
+        purchaseSinglePriceData:[]
       };
     },
     created() {
@@ -1055,6 +1064,12 @@
       this.requestDict('商品价格类型');
     },
     methods: {
+      async getPurchaseSinglePrice(row) {
+        this.purchaseSinglePriceData = [];
+        this.purchaseSinglePriceData = await queryHistoricalUnitPrice(
+          row.productId
+        );
+      },
       handleGetBillDetail(row, type) {
         this.billDetailDialogFlag = true;
         this.$nextTick(() => {

+ 4 - 2
src/views/purchasingManage/purchaseOrder/invoice/components/print-template-wl.vue

@@ -21,7 +21,7 @@
           font-weight: 800;
           text-decoration: underline;
         "
-        >湖南万隆智能科技有限公司采购入库单</div
+        >{{groupName||"湖南万隆智能科技有限公司采购入库单"}}</div
       >
       <div style="display: flex; justify-content: space-between;width: 100%;margin-bottom: 10px;">
         <span style="flex: 3">供应商:{{ formData.supplierName }}</span>
@@ -106,7 +106,9 @@
     computed: {
       ...mapGetters(['user'])
     },
-    props: {},
+    props: {
+      groupName:'',
+    },
     data() {
       return {
         QRvisible: false,

+ 17 - 3
src/views/purchasingManage/purchaseOrder/invoice/index.vue

@@ -160,7 +160,10 @@
       ref="processSubmitDialogRef"
       @reload="reload"
     ></process-submit-dialog>
-    <printTemplateWl ref="printTemplateWlRef"></printTemplateWl>
+    <printTemplateWl
+      ref="printTemplateWlRef"
+      :groupName="groupName"
+    ></printTemplateWl>
   </div>
 </template>
 
@@ -185,6 +188,7 @@
   import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
+  import { enterprisePage } from '@/api/contractManage/contractBook';
 
   export default {
     mixins: [dictMixins, tabMixins],
@@ -206,6 +210,7 @@
         delVisible: false, //批量删除弹框状态
         loading: false, // 加载状态
         processSubmitDialogFlag: false, // 加载状态
+        groupName:'',
         columns: [
           {
             width: 45,
@@ -340,6 +345,16 @@
       };
     },
     computed: {},
+    created() {
+      enterprisePage({
+        pageNum: 1,
+        size: 200
+      }).then((res) => {
+        if (res.list?.length > 0) {
+          this.groupName = res.list[0].name;
+        }
+      });
+    },
 
     methods: {
       /* 表格数据源 */
@@ -364,8 +379,7 @@
       /* 刷新表格 */
       reload(where) {
         this.$refs.table.reload({ page: 1, where });
-        this.$emit('getToDoReminder')
-
+        this.$emit('getToDoReminder');
       },
 
       //新增编辑