Просмотр исходного кода

feat(库存调拨): 新增销售订单号和客户信息显示,盘点计划仓库显示问题,左边树显示全部

liujt 5 месяцев назад
Родитель
Сommit
f6faaf029a

+ 290 - 0
src/views/warehouseManagement/inventoryAllocation/accountstatement/generateStatement.vue

@@ -0,0 +1,290 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="generateStatementFlag"
+    title="生成对账单"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    :maxable="true"
+    :resizable="true"
+    width="65%"
+    :before-close="cancel"
+  >
+    <div v-loading="loading">
+      <el-form
+        ref="form"
+        :model="form"
+        class="el-form-box"
+        >
+        <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :datasource="form.datasource"
+            row-key="id"
+            @columns-change="handleColumnChange"
+            :cache-key="cacheKeyUrl"
+            height="350"
+            full-height="calc(100vh - 76px)"
+        > 
+            <template v-slot:orderNo="scope">
+                <el-form-item :prop="'datasource.' + scope.$index + '.orderNo'">
+                    <el-input v-model="scope.row.orderNo" @click.native="openOrderDialog(scope.row, scope.$index)"></el-input>
+                <!-- <el-select
+                    v-model="scope.row.batchStockId" 
+                    placeholder="请选择"
+                    @change="batchNoChange(scope.$index, scope.row)"
+                >
+                    <el-option
+                    v-for="item in scope.row.batchNoList || []"
+                    :key="item.id"
+                    :label="item.batchNo"
+                    :value="item.id"
+                    >
+                    </el-option>
+                </el-select> -->
+                </el-form-item>
+            </template>
+        </ele-pro-table>
+        </el-form>
+    </div>
+    <div slot="footer" class="footer">
+      <el-button
+        v-if="dialogType !== 'view'"
+        type="primary"
+        @click="save"
+        v-loading="saveLoading"
+        >生成
+      </el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+    <orderListDialog
+      ref="orderListDialogRef"
+      @changeParent="getOrderInfo"
+    ></orderListDialog>
+  </ele-modal>
+</template>
+
+<script>
+  import InventoryTable from './inventoryTable.vue';
+  import recorpayTableList from './recorpayTableList.vue';
+
+  import saleForm from './saleForm.vue';
+  import {
+    getStatementRecordListAPI,
+    infoAccountStatementAPI,
+    createAccountStatementAPI,
+    updateAccountStatementAPI,
+    accountstatementInfoAPI
+  } from '@/api/saleManage/accountstatement';
+  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import OrderListDialog from './orderListDialog.vue';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+
+  export default {
+    name: 'GenerateStatement',
+    mixins: [tabMixins],
+    components: {
+      processSubmitDialog,
+      InventoryTable,
+      saleForm,
+      recorpayTableList,
+      OrderListDialog
+    },
+    //客户管理数据
+    props: {
+      generateStatementFlag: {
+        type: Boolean,
+        default: false
+      },
+      contactData: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      },
+      saleOrderData: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      }
+    },
+    data() {
+      return {
+        fullscreen: false,
+        loading: false,
+        saveLoading: false,
+        form: {
+          datasource: []
+        },
+        datasource: [],
+        dataForm: {
+          sourceType: 1,
+          dateType: 1,
+          queryDimension: 2,
+          dateValue: '',
+          contactId: '',
+          contactName: '',
+          sourceName: '',
+          sourceId: '',
+          type: '',
+          year: '',
+          quarter: '',
+          month: '',
+          dateTimeRange: [],
+          orderNo: '',
+          orderId: '',
+          id: '',
+          startDate: '',
+          endDate: '',
+          repliedFiles: []
+        },
+        title: '',
+        processSubmitDialogFlag: false,
+        dialogType: '',
+        columns: [
+          {
+            width: 60,
+            label: '序号',
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            minWidth: 120,
+            prop: 'name',
+            label: '调拨名称',
+            slot: 'name',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'allotCode',
+            label: '调拨单号',
+            slot: 'allotCode',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 140,
+            prop: 'orderNo',
+            label: '销售订单号',
+            slot: 'orderNo',
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    computed: {},
+    methods: {
+      open(dialogType, row) {
+        this.dialogType = dialogType;
+        console.log('row~~~', row);
+        this.form.datasource = row || [];
+      },
+      //打开订单弹窗
+      openOrderDialog(row, index) {
+        let item = { id: row.orderId };
+        this.$refs.orderListDialogRef.open(item, index);
+      },
+      //选择订单信息回调
+      getOrderInfo(arr, index) {
+        console.log('arr~~~', arr, index, this.form.datasource[index]);
+        this.form.datasource[index].orderNo = arr.map(item => item.orderNo).join(',');
+        // this.dataForm.sourceType = 3;
+        // let params = Object.assign({}, this.dataForm, {
+        //   orderId: obj.id,
+        //   orderNo: obj.orderNo,
+        //   contactId: obj.partaId,
+        //   contactName: obj.partaName,
+        //   sourceName: obj.orderNo,
+        //   sourceId: obj.id
+        // });
+        // this.$emit('update:dataForm', params);
+        // this.reloadTableData();
+      },
+
+      //关闭弹窗
+      cancel() {
+        this.$emit('update:generateStatementFlag', false);
+      },
+   
+      //保存
+      async save(is) {
+        if (!this.form.datasource.length)
+          return this.$message.warning('暂无对账信息');
+        let api =
+          this.dialogType == 'add'
+            ? createAccountStatementAPI
+            : updateAccountStatementAPI;
+        let params = {
+          ...this.dataForm,
+          orderList: this.form.datasource,
+        };
+        console.log('params~~~', params);
+        this.saveLoading = true;
+        try {
+          let data = await api(params);
+          this.saveLoading = false;
+          if (is == 'sub') {
+            await this.submitApprove(data);
+            return;
+            // await submitAccountStatementApproveAPI({
+            //   businessId: data,
+            //   type: this.dataForm.type
+            // });
+          }
+          this.$message.success('操作成功');
+          this.reload();
+        } catch (error) {
+          this.saveLoading = false;
+        }
+        this.$message.success('操作成功');
+        this.reload();
+      },
+      async submitApprove(res) {
+        let data = await accountstatementInfoAPI(res);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: res,
+            businessKey: 'sales_account_statement_approve',
+            formCreateUserId: data.createUserId,
+            variables: {
+              type: data.type,
+              businessCode: data.statementNo,
+              businessName: data.contactName,
+              businessType: '对账单'
+            }
+            // callBackMethodType : '1',
+            // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
+            // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
+            // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
+            // miniHandle : '',
+            // miniView : '',
+          };
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
+      reload() {
+        this.cancel();
+        //刷新主页面
+        this.$emit('done');
+      }
+    }
+  };
+</script>
+<style scoped lang="scss">
+  ::v-deep.el-divider {
+    margin: 10px;
+    font-weight: bold;
+  }
+  .el-form-item {
+    margin-bottom: 0px;
+  }
+</style>

+ 23 - 9
src/views/warehouseManagement/inventoryAllocation/accountstatement/orderListDialog.vue

@@ -19,6 +19,8 @@
         row-key="id"
         row-key="id"
         height="calc(100vh - 500px)"
         height="calc(100vh - 500px)"
         class="dict-table"
         class="dict-table"
+        :selection.sync="selection"
+        @columns-change="handleColumnChange"
         @cell-click="cellClick"
         @cell-click="cellClick"
       >
       >
         <!-- 表头工具栏 -->
         <!-- 表头工具栏 -->
@@ -42,8 +44,10 @@ import { contactTypeTree } from '@/api/saleManage/contact';
 import searchTable from './components/searchTable.vue';
 import searchTable from './components/searchTable.vue';
 import { getTableList } from '@/api/saleManage/saleorder';
 import { getTableList } from '@/api/saleManage/saleorder';
 import AssetTree from '@/components/AssetTree';
 import AssetTree from '@/components/AssetTree';
+import tabMixins from '@/mixins/tableColumnsMixin';
 
 
 export default {
 export default {
+  mixins: [tabMixins],
   components: {
   components: {
     AssetTree,
     AssetTree,
     searchTable
     searchTable
@@ -60,7 +64,14 @@ export default {
     return {
     return {
       visible: false,
       visible: false,
       currentIndex: null,
       currentIndex: null,
+      selection: [],
       columns: [
       columns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center'
+        },
         {
         {
           columnKey: 'index',
           columnKey: 'index',
           label: '序号',
           label: '序号',
@@ -70,13 +81,12 @@ export default {
           showOverflowTooltip: true,
           showOverflowTooltip: true,
           fixed: 'left'
           fixed: 'left'
         },
         },
-        {
-          action: 'action',
-          slot: 'action',
-          align: 'center',
-          label: '选择'
-        },
-
+        // {
+        //   action: 'action',
+        //   slot: 'action',
+        //   align: 'center',
+        //   label: '选择'
+        // },
         {
         {
           prop: 'orderNo',
           prop: 'orderNo',
           label: '订单编码',
           label: '订单编码',
@@ -214,10 +224,14 @@ export default {
     },
     },
 
 
     selected() {
     selected() {
-      if (!this.current) {
+      if (!this.selection.length) {
         return this.$message.warning('请至少选择一条数据');
         return this.$message.warning('请至少选择一条数据');
       }
       }
-      this.$emit('changeParent', this.current, this.currentIndex);
+      let partaIds = this.selection.map((item) => item.partaId);
+      if (new Set(partaIds).size != 1) {
+        return this.$message.warning('请选择相同客户的订单!');
+      }
+      this.$emit('changeParent', this.selection, this.currentIndex);
       this.handleClose();
       this.handleClose();
     }
     }
   }
   }

+ 24 - 0
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -653,6 +653,26 @@
             label: '物料代号',
             label: '物料代号',
             align: 'center',
             align: 'center',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
+          },
+          {
+            prop: 'saleOrderNos',
+            label: '销售订单号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true,
+            formatter(row) {
+              return row.saleOrderInfo?.saleOrderNos || '';
+            }
+          },
+          {
+            prop: 'customerNames',
+            label: '客户',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            formatter(row) {
+              return row.saleOrderInfo?.customerNames || '';
+            }
           }
           }
         ]
         ]
       },
       },
@@ -1465,6 +1485,8 @@
                   targetWarehouseId: item.targetWarehouseId || this.params.inWarehouseId,
                   targetWarehouseId: item.targetWarehouseId || this.params.inWarehouseId,
                   targetWarehouseName: item.targetWarehouseName || this.params.inWarehouseName,
                   targetWarehouseName: item.targetWarehouseName || this.params.inWarehouseName,
                   targetFactoriesId: this.params.targetFactoriesId,
                   targetFactoriesId: this.params.targetFactoriesId,
+                  saleOrderNos: item.saleOrderNos || '',
+                  customerNames: item.customerNames || '',
                 };
                 };
               }),
               }),
               allotCode: this.params.code,
               allotCode: this.params.code,
@@ -1707,6 +1729,8 @@
                 console.log('this.params---------', this.params);
                 console.log('this.params---------', this.params);
                 return {
                 return {
                   ...item,
                   ...item,
+                  saleOrderNos: item.saleOrderInfo?.saleOrderNos || '',
+                  customerNames: item.saleOrderInfo?.customerNames || '',
                   outInDetailRecordId: item.id,
                   outInDetailRecordId: item.id,
                   quantity: item.quantity || item.measureQuantity,
                   quantity: item.quantity || item.measureQuantity,
                   categoryId: item.categoryId,
                   categoryId: item.categoryId,

+ 33 - 4
src/views/warehouseManagement/inventoryAllocation/index.vue

@@ -22,9 +22,9 @@
           <el-button v-if="$hasPermission('wms:inventoryAllocation:print2')" :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExl2"
           <el-button v-if="$hasPermission('wms:inventoryAllocation:print2')" :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExl2"
             >打印送货单带车</el-button
             >打印送货单带车</el-button
           >
           >
-          <el-button v-if="$hasPermission('wms:inventoryAllocation:statement')" type="primary"  @click="handleAddOrEditAccount('add')"
+          <!-- <el-button v-if="$hasPermission('wms:inventoryAllocation:statement')" :disabled="selection.length == 0" type="primary"  @click="handleGenerateStatement('add')"
             >生成对账单</el-button
             >生成对账单</el-button
-          >
+          > -->
         </template>
         </template>
         <!-- 单号链接 -->
         <!-- 单号链接 -->
         <template v-slot:allotCode="{ row }">
         <template v-slot:allotCode="{ row }">
@@ -80,6 +80,12 @@
       ref="accountDialogRef"
       ref="accountDialogRef"
       @done="reload"
       @done="reload"
     ></add-account-dialog>
     ></add-account-dialog>
+    <generateStatement
+      v-if="generateStatementFlag"
+      :generateStatementFlag.sync="generateStatementFlag"
+      ref="generateStatementRef"
+      @done="reload"
+    ></generateStatement>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -93,16 +99,19 @@
   import { pageRoles } from '@/api/system/role';
   import { pageRoles } from '@/api/system/role';
   import { enterprisePage } from '@/api/bpm/index.js';
   import { enterprisePage } from '@/api/bpm/index.js';
   import addAccountDialog from './accountstatement/addAccountDialog.vue';
   import addAccountDialog from './accountstatement/addAccountDialog.vue';
+  import generateStatement from './accountstatement/generateStatement.vue';
   export default {
   export default {
     components: {
     components: {
       addAccountDialog,
       addAccountDialog,
       InventorySearch,
       InventorySearch,
       printTemplateBs,
       printTemplateBs,
-      printTemplateBsCar 
+      printTemplateBsCar,
+      generateStatement
     },
     },
     data() {
     data() {
       return {
       return {
         addAccountDialogFlag: false,
         addAccountDialogFlag: false,
+        generateStatementFlag: false,
         allocationType,
         allocationType,
         groupName: '',
         groupName: '',
         stutusOptions: {
         stutusOptions: {
@@ -231,7 +240,26 @@
       handleAddOrEditAccount(type, row) {
       handleAddOrEditAccount(type, row) {
         this.addAccountDialogFlag = true;
         this.addAccountDialogFlag = true;
         this.$nextTick(() => {
         this.$nextTick(() => {
-          this.$refs.accountDialogRef.open(type, row, '1');
+          this.$refs.accountDialogRef.open(type, row);
+        });
+      },
+      // 生成对账单
+      handleGenerateStatement(type) {
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择要生成对账单的记录');
+          return;
+        }
+        
+        // 检查选中的记录状态是否为2
+        const invalidRecords = this.selection.filter(item => item.status != 2);
+        if (invalidRecords.length > 0) {
+          this.$message.warning('请选择已完成的调拨单生成对账单');
+          return;
+        }
+        
+        this.generateStatementFlag = true;
+        this.$nextTick(() => {
+          this.$refs.generateStatementRef.open(type, this.selection);
         });
         });
       },
       },
       getCompanyInfo() {
       getCompanyInfo() {
@@ -354,3 +382,4 @@
     }
     }
   }
   }
 </style>
 </style>
+

+ 1 - 1
src/views/warehouseManagement/stocktaking/plan/components/addInventoryDialog.vue

@@ -586,7 +586,7 @@
       async _getWarehouse() {
       async _getWarehouse() {
         const res = await getWarehouseList({});
         const res = await getWarehouseList({});
         this.warehouseList = res.map((item) => {
         this.warehouseList = res.map((item) => {
-          return { ...item, name: item.factoryName + '-' + item.name };
+          return { ...item};
         });
         });
       },
       },
 
 

+ 4 - 4
src/views/warehouseManagement/stocktaking/plan/components/assetTree.vue

@@ -66,11 +66,11 @@
           try {
           try {
             this.treeLoading = true;
             this.treeLoading = true;
             let res = null;
             let res = null;
-            if (this.treeIds.length > 0) {
-              res = await getTreeByIds({ ids: this.treeIds.join(',') });
-            } else {
+            // if (this.treeIds.length > 0) {
+            //   res = await getTreeByIds({ ids: this.treeIds.join(',') });
+            // } else {
               res = await getTreeByGroup({ type: 2 });
               res = await getTreeByGroup({ type: 2 });
-            }
+            // }
             this.treeLoading = false;
             this.treeLoading = false;
             if (res?.code === '0') {
             if (res?.code === '0') {
               this.treeList = res.data;
               this.treeList = res.data;