695593266@qq.com před 3 měsíci
rodič
revize
a4244b8ff0

+ 42 - 0
src/views/materialPlan/components/saleOrderPop.vue

@@ -18,8 +18,11 @@
         :columns="columns"
         :datasource="datasource"
         :selection.sync="selection"
+        :class="{ 'single-select-table': !isMultiple }"
         row-key="id"
         :initLoad="false"
+        @select="handleSelect"
+        @select-all="handleSelectAll"
       >
       </ele-pro-table>
     </el-card>
@@ -38,6 +41,12 @@
   export default {
     components: { saleOrderSearch },
     mixins: [dictMixins],
+    props: {
+      isMultiple: {
+        type: Boolean,
+        default: true
+      }
+    },
     data() {
       return {
         visible: false,
@@ -317,11 +326,40 @@
         this.$refs.table.setSelectedRows([]);
         this.selection = [];
       },
+      setSingleSelection(row) {
+        this.$refs.table.clearSelection();
+        this.$nextTick(() => {
+          if (row) {
+            this.$refs.table.toggleRowSelection(row, true);
+            this.selection = [row];
+          } else {
+            this.selection = [];
+          }
+        });
+      },
+      handleSelect(selection, row) {
+        if (!this.isMultiple) {
+          const currentRow = selection.find((item) => item.id === row.id);
+          this.setSingleSelection(currentRow || null);
+          return;
+        }
+        this.selection = selection;
+      },
+      handleSelectAll(selection) {
+        if (!this.isMultiple) {
+          this.setSingleSelection(selection[0] || null);
+          return;
+        }
+        this.selection = selection;
+      },
       selected() {
         if (!this.selection.length) {
           this.$message.error('请至少选择一条数据');
           return;
         }
+        if (!this.isMultiple && this.selection.length > 1) {
+          this.selection = [this.selection[this.selection.length - 1]];
+        }
         const selectedIds = new Set(this.selection.map((item) => item.code));
         const hasIds = this.tableData.some((item) =>
           selectedIds.has(item.code)
@@ -350,4 +388,8 @@
     text-align: center;
     padding: 10px 0;
   }
+
+  ::v-deep .single-select-table .el-table__header-wrapper .el-checkbox {
+    display: none;
+  }
 </style>

+ 3 - 3
src/views/materialPlan/returnPlan.vue

@@ -3,11 +3,11 @@
     <el-card shadow="never" class="tabs_box">
       <seek-page :seekList="seekList" @search="reload"></seek-page>
 
-      <div class="btn_box">
+      <!-- <div class="btn_box">
         <el-button type="success" size="mini" @click="borrowOrder">
           新增领用单
         </el-button>
-      </div>
+      </div> -->
 
       <ele-pro-table
         ref="table"
@@ -88,7 +88,7 @@
           },
           {
             prop: 'code',
-            label: '退料单号',
+            label: '归还单号',
             width: 150,
             align: 'center',
             showOverflowTooltip: true,

+ 65 - 1
src/views/productionPlan/components/factoryAdd/index.vue

@@ -72,6 +72,28 @@
         </el-row>
 
         <el-row :gutter="24">
+          <!-- <el-col :span="6">
+            <el-form-item label="销售订单号:" prop="saleOrder">
+              <div class="sale-order-select">
+                <el-input
+                  v-model="form.saleOrder"
+                  size="mini"
+                  type="text"
+                  style="width: calc(100% - 54px)"
+                  placeholder="请选择销售订单号"
+                  readonly
+                ></el-input>
+                <el-button
+                  size="mini"
+                  type="primary"
+                  @click="openSaleOrderDialog"
+                >
+                  选择
+                </el-button>
+              </div>
+            </el-form-item>
+          </el-col> -->
+
           <el-col :span="6">
             <el-form-item
               label="生产编号:"
@@ -143,6 +165,26 @@
           </el-col>
         </el-row>
 
+        <!-- <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item
+              label="要求完成日期:"
+              label-width="110px"
+              prop="reqMoldTime"
+            >
+              <el-date-picker
+                style="width: 100%"
+                size="mini"
+                v-model="form.reqMoldTime"
+                type="datetime"
+                placeholder="选择日期"
+                value-format="yyyy-MM-dd HH:mm:ss"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row> -->
+
         <headerTitle title="产品信息"> </headerTitle>
 
         <el-row :gutter="24">
@@ -344,7 +386,7 @@
                 v-model="row.factoriesId"
                 :key="row.factoriesId"
                 @change="(e) => selectFactory(e, row)"
-                :disabled="factoriesId"
+                :disabled="!!factoriesId"
               >
                 <el-option
                   v-for="item of factoryList"
@@ -441,6 +483,11 @@
         ref="equipmentRefs"
       >
       </EquipmentDialog>
+      <saleOrderPop
+        ref="saleOrderRef"
+        :isMultiple="false"
+        @chooseOrder="chooseSaleOrder"
+      />
     </div>
 
     <template v-slot:footer>
@@ -464,6 +511,7 @@
 <script>
   import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   import EquipmentDialog from '@/views/saleOrder/components/EquipmentDialog';
+  import saleOrderPop from '@/views/materialPlan/components/saleOrderPop.vue';
   import { getCode } from '@/api/codeManagement';
   import ProcessRoute from '@/components/selectionDialog/processRoute.vue';
   import { parameterGetByCode } from '@/api/mainData/index';
@@ -483,6 +531,7 @@
   export default {
     components: {
       EquipmentDialog,
+      saleOrderPop,
       ProcessRoute,
       contactDialog
     },
@@ -788,6 +837,7 @@
           categoryId: '',
           productName: '',
           planType: '',
+          saleOrder: '',
 
           moCount: '', // 模具数量
           blockCount: 0, // 块数
@@ -1255,6 +1305,7 @@
           categoryId: '',
           productName: '',
           planType: '',
+          saleOrder: '',
           moCount: '', // 模具数量
           blockCount: 0, // 块数
           noWordCount: '', // 无字数量
@@ -1324,6 +1375,13 @@
         this.form.serialNo = data.serialNo;
         this.$set(this.form, 'customerName', data.name);
       },
+      openSaleOrderDialog() {
+        this.$refs.saleOrderRef.open([]);
+      },
+      chooseSaleOrder(list) {
+        const currentRow = list[0] || {};
+        this.$set(this.form, 'saleOrder', currentRow.code || '');
+      },
       // 清空BOM 跟工艺路线
       wipeData(index) {
         this.$set(this.form.productInfoList[index], 'bomCategoryId', '');
@@ -1796,6 +1854,12 @@
     margin-bottom: 14px !important;
   }
 
+  .sale-order-select {
+    display: flex;
+    align-items: center;
+    gap: 4px;
+  }
+
   .add-product {
     width: 100%;
     display: flex;

+ 1 - 0
src/views/requirementListPlan/components/borrowList.vue

@@ -353,6 +353,7 @@
       open(item) {
         this.visible = true;
         this.title = '新增领用单';
+        this.borrowList = [];
         this.form = item;
       },