yijing 1 år sedan
förälder
incheckning
37dee752a5

+ 11 - 0
src/api/inspectionPlan/index.js

@@ -146,3 +146,14 @@ export async function getBatchInfoData(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 详情接口
+
+export async function getDetailInfo(id) {
+  const res = await request.get(`/main/category/info/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 1
src/enum/dict.js

@@ -13,7 +13,7 @@ export default {
   不良品处理类型:'unqualified_products_type',
   质检计划类型:'inspection_plan_type',
   工艺参数单位: 'parameter_code',
-
+  计量单位: 'measuring_uint',
 
 };
 

+ 44 - 26
src/views/inspectionPlan/components/baseInfo.vue

@@ -134,7 +134,9 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="数量:" prop="productNumber">
-            <el-input type="number" v-model="form.productNumber" disabled />
+            <el-input type="number" v-model="form.productNumber" disabled>
+              <template #append>{{ categoryInfo.measuringUnit }}</template>
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -146,15 +148,15 @@
       <el-row>
         <el-col :span="6">
           <el-form-item label="合格品数量:" prop="qualifiedNumber">
-            <el-input type="number" v-model="form.qualifiedNumber" disabled >
-              <template #append>{{form.measureUnit}}</template>
+            <el-input type="number" v-model="form.qualifiedNumber" disabled>
+              <template #append>{{ categoryInfo.measuringUnit }}</template>
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="不合格品数量:" prop="unqualifiedNumber">
-            <el-input type="number" v-model="form.unqualifiedNumber" disabled >
-              <template #append>{{form.measureUnit}}</template>
+            <el-input type="number" v-model="form.unqualifiedNumber" disabled>
+              <template #append>{{ categoryInfo.measuringUnit }}</template>
             </el-input>
           </el-form-item>
         </el-col>
@@ -165,8 +167,8 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="总重量:" prop="totalWeight">
-            <el-input type="number" v-model="form.totalWeight" :disabled="btnType == 'detail' || btnType == 'issued'" >
-              <template #append>{{form.weightUnitZ}}</template>
+            <el-input type="number" v-model="form.totalWeight" :disabled="btnType == 'detail' || btnType == 'issued'">
+              <template #append>{{ categoryInfo.weightUnit }}</template>
             </el-input>
           </el-form-item>
         </el-col>
@@ -178,8 +180,9 @@
             message: '请输入取样数量',
             trigger: 'blur'
           }">
-            <el-input type="number" v-model="form.sampleNumber" @change="handleChangeNumber"
-              :disabled="btnType == 'detail' || btnType == 'issued'" />
+            <el-input type="number" v-model="form.sampleNumber" disabled>
+              <template #append>{{ form.sampleMeasureUnit }}</template>
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -212,6 +215,7 @@
     <workOrder ref="workOrderRef" @choose="handleChoose" />
     <produceOrder ref="produceOrderRef" @choose="handleChoose" />
     <EquipmentDialog ref="equipmentRefs" @choose="handleChoose" :type="1" :treeIds="['9', '1']" />
+
   </el-form>
 </template>
 <script>
@@ -229,6 +233,8 @@ import { getUserPage } from '@/api/system/organization';
 import { getByCode } from '@/api/system/dictionary-data';
 import { rules } from 'eslint-config-prettier';
 
+import { getDetailInfo } from '@/api/inspectionPlan/index.js';
+
 export default {
   components: {
     EquipmentDialog,
@@ -247,7 +253,11 @@ export default {
     btnType: {
       type: String,
       default: ''
-    }
+    },
+    packingLists: {
+      type: Array,
+      default: () => []
+    },
   },
   watch: {
     'form.qualityMode': {
@@ -289,6 +299,7 @@ export default {
           this.form.qualificationRate = '';
           this.form.totalWeight = '';
           this.form.sampleNumber = '';
+          this.form.sampleMeasureUnit = '';
           this.sourceList = [];
           this.$emit('resetTable');
         }
@@ -312,6 +323,7 @@ export default {
           this.form.qualificationRate = '';
           this.form.totalWeight = '';
           this.form.sampleNumber = '';
+          this.form.sampleMeasureUnit = '';
           this.$emit('resetTable');
         }
       },
@@ -336,7 +348,8 @@ export default {
           { required: true, message: '请选择执行人员:', trigger: 'blur' }
         ]
       },
-      isExpanded: false // 控制展开/收起状态
+      isExpanded: false, // 控制展开/收起状态
+      categoryInfo: {},
     };
   },
   created() {
@@ -418,6 +431,17 @@ export default {
         this.$refs.equipmentRefs.open();
       }
     },
+    typeChange(val) {
+      if (val == 1) {
+        this.sourceList = [{ label: '采购收货单', value: '1' }];
+      } else if (val == 2) {
+        this.sourceList = [
+          { label: '生产计划', value: '2' },
+          { label: '生产订单', value: '3' },
+          { label: '生产工单', value: '4' }
+        ];
+      }
+    },
     //   根据来源得到产品
     handleChoose(val) {
       if (!val) return;
@@ -451,25 +475,19 @@ export default {
       let productCategoryId = val.productCategoryId;
       let productCategoryName = val.productCategoryName;
       if (receiveNo && categoryCode && categoryid) {
-        this.$emit('getList', receiveNo, categoryCode, productCategoryId, productCategoryName, categoryid, batchNo,val.supplierName,val.supplierMark);
+        this.$emit('getList', receiveNo, categoryCode, productCategoryId, productCategoryName, categoryid, batchNo, val.supplierName, val.supplierMark);
       }
+      this.getProductDetails(this.form.productId)
     },
 
-    handleChangeNumber(val) {
-      this.form.sampleNumber = val;
-      this.$emit('changeNumber', val);
+    async getProductDetails(val) {
+      const data = await getDetailInfo(val)
+      console.log(data, '产品详情')
+      this.categoryInfo = data.category
+
+      this.$emit('getCategoryInfo', this.categoryInfo)
     },
-    typeChange(val) {
-      if (val == 1) {
-        this.sourceList = [{ label: '采购收货单', value: '1' }];
-      } else if (val == 2) {
-        this.sourceList = [
-          { label: '生产计划', value: '2' },
-          { label: '生产订单', value: '3' },
-          { label: '生产工单', value: '4' }
-        ];
-      }
-    }
+
   }
 };
 </script>

+ 352 - 169
src/views/inspectionPlan/components/edit.vue

@@ -4,70 +4,87 @@
     :close-on-press-escape="false" append-to-body width="80%" :maxable="true">
     <header-title title="基本信息"></header-title>
     <base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType" @resetTable="resetTable"
-      @getList="getList" @changeModel="changeModel" @changeNumber="changeNumber" @table2="table2"></base-info>
+      @getList="getList" @changeModel="changeModel" @table2="table2" :packingLists="packingList"
+      @getCategoryInfo="getCategoryInfo"></base-info>
 
     <el-row>
       <header-title title="质检内容"></header-title>
+
       <el-tabs v-model="activeName" @tab-click="handleClick">
-        <el-tab-pane label="来源清单" name="1"></el-tab-pane>
-        <el-tab-pane label="样品清单" name="2"></el-tab-pane>
-        <el-tab-pane label="质检方案" name="3"></el-tab-pane>
+        <el-tab-pane label="来源清单" name="1">
+          <!-- 来料列表表格 -->
+          <ele-pro-table ref="table12" :columns="tableColumns" :datasource="datasource"
+            @selection-change="handleSelectionChange" :initLoad="false">
+            <template v-slot:toolbar>
+              <el-dropdown trigger="click" @command="handleSampleNumber">
+                <el-link type="primary" icon="el-icon-plus">取样</el-link>
+                <el-dropdown-menu slot="dropdown">
+                  <el-dropdown-item command="1">取整样</el-dropdown-item>
+                  <el-dropdown-item command="2">取小样</el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
+
+            </template>
+            <template v-slot:toolkit>
+              <template v-if="condition == 2">
+                <div style="display: flex;align-items: center;">
+                  <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"
+                    @input="handleSampleSubmit"></el-input>
+                  <DictSelection dictName="计量单位" clearable v-model="formData.sampleUnit" size="mini"
+                    style="width: 120px;margin-left: 12px;" @change="handleSampleSubmit">
+                  </DictSelection>
+                </div>
+              </template>
+              <template>
+                <div style="margin-left: 12px;display: flex;align-items: center;">
+                  <div>数量:</div>
+                  <el-input v-model="formData.portion" style="width: 120px;margin:0 12px;" placeholder="请输入" size="mini"
+                    @change="handleInput"></el-input>
+                  <el-button type="primary" size="mini" @click="handleSampleSubmit"
+                    style="margin-right: 12px;">确认</el-button>
+                </div>
+              </template>
+            </template>
+          </ele-pro-table>
+        </el-tab-pane>
+        <el-tab-pane label="样品清单" name="2">
+          <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
+            :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id">
+            <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
+            <template v-for="column in tableColumns2">
+              <el-table-column label="样品编码" prop="sampleCode"></el-table-column>
+              <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
+                :width="column.width" :align="column.align"></el-table-column>
+            </template>
+          </el-table>
+          <el-pagination v-show="activeName === '2' && sampleList.length > 0" @size-change="handleSampleSizeChange"
+            @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
+            :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
+            layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
+            style="margin-top: 10px"></el-pagination>
+        </el-tab-pane>
+        <el-tab-pane label="质检方案" name="3">
+          <el-table v-show="activeName === '3'" v-if="schemeList.length > 0" ref="showSchemeListTable"
+            :data="paginatedSchemeList" tooltip-effect="dark" :max-height="300" border row-key="id">
+            <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
+            <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
+            </el-table-column>
+            <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName" align="center"></el-table-column>
+            <el-table-column label="质检类型" prop="categoryLevelClassName" align="center"></el-table-column>
+            <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
+            <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
+            <el-table-column label="工艺参数" prop="defaultValue" align="center">
+            </el-table-column>
+          </el-table>
+          <el-pagination v-show="activeName === '3' && schemeList.length > 0" @size-change="handleSchemeSizeChange"
+            @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
+            :page-sizes="[10, 20, 50, 100]" :page-size="schemePagination.pageSize"
+            layout="total, sizes, prev, pager, next, jumper" :total="schemeList.length"
+            style="margin-top: 10px"></el-pagination>
+        </el-tab-pane>
       </el-tabs>
     </el-row>
 
-    <el-row style="margin-top: 24px">
-      <!-- 来料列表表格 -->
-      <el-table v-show="activeName === '1'" v-if="packingList.length > 0" ref="showPackingListTable"
-        :data="paginatedPackingList" tooltip-effect="dark" :max-height="300" border
-        @selection-change="handleSelectionChange" row-key="id">
-        <el-table-column type="selection" width="55" align="center" :reserve-selection="true"
-          :selectable="checkSelectable"></el-table-column>
-        <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
-        <!--  label-class-name="DisabledSelection" -->
-        <template v-for="column in tableColumns">
-          <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true" :width="column.width"
-            :align="column.align"></el-table-column>
-        </template>
-      </el-table>
-      <!-- 分页 -->
-      <el-pagination v-show="activeName === '1' && packingList.length > 0" @size-change="handleSizeChange"
-        @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 20, 50, 100]"
-        :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next" :total="packingList.length"
-        style="margin-top: 16px" />
-      <!-- 样品列表表格 -->
-      <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
-        :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id">
-        <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
-        <template v-for="column in tableColumns">
-          <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true" :width="column.width"
-            :align="column.align"></el-table-column>
-        </template>
-      </el-table>
-      <el-pagination v-show="activeName === '2' && sampleList.length > 0" @size-change="handleSampleSizeChange"
-        @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
-        :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
-        layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
-        style="margin-top: 10px"></el-pagination>
-      <!-- 质检方案 -->
-      <el-table v-show="activeName === '3'" v-if="schemeList.length > 0" ref="showSchemeListTable"
-        :data="paginatedSchemeList" tooltip-effect="dark" :max-height="300" border row-key="id">
-        <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
-        <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
-        </el-table-column>
-        <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName" align="center"></el-table-column>
-        <el-table-column label="质检类型" prop="categoryLevelClassName" align="center"></el-table-column>
-        <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
-        <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
-        <el-table-column label="工艺参数" prop="defaultValue" align="center">
-        </el-table-column>
-      </el-table>
-      <el-pagination v-show="activeName === '3' && schemeList.length > 0" @size-change="handleSchemeSizeChange"
-        @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
-        :page-sizes="[10, 20, 50, 100]" :page-size="schemePagination.pageSize"
-        layout="total, sizes, prev, pager, next, jumper" :total="schemeList.length"
-        style="margin-top: 10px"></el-pagination>
-    </el-row>
-
     <!-- <div class="add-product" @click="addProduct" v-if="btnType != 'detail'">
       <i class="el-icon-circle-plus-outline"></i>
     </div> -->
@@ -82,6 +99,42 @@
         下发
       </el-button>
     </template>
+
+
+    <ele-modal :visible.sync="takeAsampleVisible" title="选择取样信息" width="80vw" append-to-body @close="handleCancel"
+      :maxable="true">
+
+      <el-table ref="showSampleListTable" :data="selectedList" tooltip-effect="dark" :max-height="300" border
+        row-key="id" @selection-change="handleSelectionChange2">
+        <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
+        <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
+        <template v-for="column in tableColumns2">
+          <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true" :width="column.width"
+            :align="column.align">
+            <!-- <template slot-scope="scope">
+              <template v-if="column.prop === 'measureQuantity'">
+                <el-input v-model="scope.row.measureQuantity" type="number"></el-input>
+              </template>
+    <template v-else-if="column.prop === 'measureUnit'">
+                <DictSelection dictName="计量单位" clearable v-model="scope.row.measureUnit">
+                </DictSelection>
+              </template>
+    <template v-else-if="column.prop === 'isUnpack'">
+                <el-switch v-model="scope.row.isUnpack">
+                </el-switch>
+              </template>
+    <template v-else>
+                {{ scope.row[column.prop] }}
+              </template>
+    </template> -->
+          </el-table-column>
+        </template>
+      </el-table>
+      <div style="width: 100%;text-align: right;margin-top: 12px;">
+        <el-button type="primary" @click="handleConfirm">确定</el-button>
+        <el-button @click="handleCancel">取消</el-button>
+      </div>
+    </ele-modal>
   </ele-modal>
 </template>
 
@@ -135,6 +188,7 @@ export default {
         qualificationRate: '',
         totalWeight: '',
         sampleNumber: null,
+        sampleMeasureUnit: '',
         sampleProportion: '',
         supplierMark: '',
         // planReceiveId: '',
@@ -148,6 +202,77 @@ export default {
       // 表单数据
       baseForm: { ...defaultForm() },
       tableColumns: [
+        {
+          columnKey: 'selection',
+          type: 'selection',
+          width: 45,
+          align: 'center',
+          selectable: (row, index) => {
+            // 只有当质检方式为抽检(qualityMode=2)时才可选
+            return this.btnType != 'issued' || this.baseForm.qualityMode === 2;
+          },
+        },
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          label: '编码',
+          prop: 'categoryCode',
+          width: 150,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '名称',
+          prop: 'categoryName',
+          width: '150',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        { label: '批次号', prop: 'batchNo', align: 'center' },
+        { label: '发货条码', prop: 'barcodes', align: 'center' },
+        {
+          label: '包装编码', prop: 'packageNo', align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+        { label: '包装单位', prop: 'packingUnit', align: 'center' },
+        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+        { label: '计量单位', prop: 'measureUnit', align: 'center' },
+        { label: '物料代号', prop: 'materielDesignation', align: 'center' },
+        { label: '客户代号', prop: 'clientCode', align: 'center' },
+        { label: '供应商名称', prop: 'supplierName', align: 'center', width: '120' },
+        { label: '供应商代号', prop: 'supplierCode', align: 'center', width: '120' },
+        { label: '刻码', prop: 'engrave', align: 'center' },
+        { label: '重量', prop: 'weight', align: 'center' },
+        { label: '重量单位', prop: 'weightUnit', align: 'center' },
+        {
+          label: '仓库', prop: 'warehouseName', align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        { label: '货区', prop: 'areaName', align: 'center' },
+        { label: '货架', prop: 'goodsShelfName', align: 'center' },
+        { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+        {
+          label: '生产日期', prop: 'productionDate', align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        {
+          label: '采购日期', prop: 'purchaseDate', align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        }
+      ],
+      tableColumns2: [
         {
           label: '编码',
           prop: 'categoryCode',
@@ -163,14 +288,12 @@ export default {
         { label: '批次号', prop: 'batchNo', align: 'center' },
         { label: '发货条码', prop: 'barcodes', align: 'center' },
         { label: '包装编码', prop: 'packageNo', align: 'center' },
-        // { label: '包装数量', prop: 'packingQuantity', align: 'center' },
-        { label: '包装单位', prop: 'packingUnit', align: 'center' },
         { label: '计量数量', prop: 'measureQuantity', align: 'center' },
         { label: '计量单位', prop: 'measureUnit', align: 'center' },
         { label: '物料代号', prop: 'materielDesignation', align: 'center' },
         { label: '客户代号', prop: 'clientCode', align: 'center' },
-        { label: '供应商名称', prop: 'supplierName', align: 'center' ,width: '120' },
-        { label: '供应商代号', prop: 'supplierCode', align: 'center' ,width: '120'},
+        // { label: '供应商名称', prop: 'supplierName', align: 'center', width: '120' },
+        // { label: '供应商代号', prop: 'supplierCode', align: 'center', width: '120' },
         { label: '刻码', prop: 'engrave', align: 'center' },
         { label: '重量', prop: 'weight', align: 'center' },
         { label: '重量单位', prop: 'weightUnit', align: 'center' },
@@ -182,11 +305,6 @@ export default {
         { label: '采购日期', prop: 'purchaseDate', align: 'center' }
       ],
       packingList: [],
-      pagination: {
-        currentPage: 1,
-        pageSize: 10,
-        total: 0
-      },
 
       sampleList: [],
       samplePagination: {
@@ -211,16 +329,22 @@ export default {
 
       activeName: '1',
       selectedList: [],
-      isCheck: false
+      isCheck: false,
+
+      rowIds: '',
+
+      takeAsampleVisible: false,
+      confirmSampleData: [],
+      formData: {
+        number: 1,
+        sampleUnit: '',
+        portion: null
+      },
+      condition: null,
+      isConsumable: '',
     };
   },
   computed: {
-    paginatedPackingList() {
-      const start =
-        (this.pagination.currentPage - 1) * this.pagination.pageSize;
-      const end = start + this.pagination.pageSize;
-      return this.packingList.slice(start, end);
-    },
     // 分页后的样品列表
     paginatedSampleList() {
       const { currentPage, pageSize } = this.samplePagination;
@@ -239,16 +363,27 @@ export default {
 
   created() { },
   methods: {
+    async datasource({ page, limit, where }) {
+
+      const res = await getInventoryListByPlanId({ ...where, page, limit });
+
+      if (res.list.length > 1) {
+        this.isCheck = true
+      } else {
+        this.isCheck = false
+      }
+      this.packingList = res.list;
+      console.log(this.packingList, '===========================================this.packingList')
+      return res.list;
+    },
     // 切换质检内容
     handleClick(tab) {
       this.activeName = tab.name;
     },
 
-    checkSelectable(row, index) {
-      // 只有当质检方式为抽检(qualityMode=2)时才可选
-      return this.btnType != 'issued' || this.baseForm.qualityMode === 2;
-    },
     async open(type, row) {
+      this.visible = true;
+
       this.activeName = '1';
       this.btnType = type;
       this.title =
@@ -287,41 +422,35 @@ export default {
         }
         // 如果是编辑或者详情,则查询物料清单、质检方案和样品列表
         if (row.id) {
-          // this.getGoodsList(
-          //   this.baseForm?.planSourceCode,
-          //   this.baseForm?.productCode,
-          //   row?.id
-          // );
+          this.rowIds = row.id;
+
           //操作行点击时查询清单
-          await this.getInventoryList(row?.id);
-          //操作行点击时查询质检
-          await this.getTemplateList(row?.id);
+          // await this.getInventoryList();
+          await this.reload({ planId: row.id });
+
+
           //操作行点击时查询样品
           await this.getSampleList(row?.id);
+          //操作行点击时查询质检
+          await this.getTemplateList(row?.id);
 
-          if (this.baseForm.qualityMode == 1) {
-            this.sampleList = this.packingList;
-            this.samplePagination.currentPage = 1;
-            this.samplePagination.total = this.packingList.length;
-          } else {
-            this.sampleList = [];
+          if (this.baseForm.productId) {
+            this.$nextTick(() => {
+              this.$refs.baseInfoRefs.getProductDetails(this.baseForm.productId)
+            })
           }
         }
       } else {
         const code = await getCode('qms_plan_code');
         this.baseForm.code = code;
       }
-      this.visible = true;
-    },
-    async getInventoryList(id) {
-      let res = await getInventoryListByPlanId({
-        planId: id
-      });
-      console.log(res.list, 'yyyyyyyyyyyyyy清单----------------------------');
 
-      this.packingList = res?.list || [];
-      this.pagination.currentPage = 1;
-      this.pagination.total = this.packingList.length;
+    },
+    reload(where) {
+      this.$nextTick(() => {
+        if (this.$refs.table12 && this.$refs.table12.reload)
+          this.$refs.table12.reload({ page: 1, where: where });
+      })
     },
     async getSampleList(id) {
       let res = await getSampleListByPlanId({
@@ -343,14 +472,14 @@ export default {
       this.schemePagination.currentPage = 1;
       this.schemePagination.total = this.schemeList.length;
     },
-    async getList(receiveNo, productCode, productCategoryId, productCategoryName, categoryid, batchNo,supplierName, supplierMark) {
+    async getList(receiveNo, productCode, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark) {
       //通过来源和产品 获取来料清单
-      await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo,supplierName, supplierMark);
+      await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark);
 
       //通过来源和产品 获取质检方案
       this.getQualityTemplate(productCode);
     },
-    async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName, categoryid, batchNo,supplierName, supplierMark) {
+    async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark) {
       let res;
       const res1 = await outInRecordsPage({
         sourceBizNo: receiveNo,
@@ -363,11 +492,6 @@ export default {
       if (res1.list.length > 0) {
         console.log(res1.list[0].status, 'status=2 不赋值')
         if (res1.list[0].status != 2) {
-          // res1.list.forEach(item => ({
-          //   ...item,
-          //   supplierName :supplierName,
-          //   supplierMark :supplierMark,
-          // }))
           res = res1.list
           this.isCheck = true;
         } else {
@@ -385,8 +509,6 @@ export default {
         if (resData) {
           if (resData.qualityControl != 2) {
             this.isCheck = false;
-            // resData.supplierName = supplierName;
-            // resData.supplierMark = supplierMark;
             res = [resData];
           } else {
             res = []
@@ -410,7 +532,7 @@ export default {
         });
         this.packingList = _arr1;
         this.pagination.total = this.packingList.length;
-        console.log(this.packingList, '来料清单');
+
         if (this.packingList.length > 1) {
           this.baseForm.productNumber = this.packingList.length;
         } else {
@@ -527,24 +649,13 @@ export default {
 
     },
     handleSelectionChange(selection) {
-      if (this.baseForm.qualityMode === 2) {
-        this.selectedList = selection;
-
-        this.sampleList = selection;
-        // console.log(this.sampleList, 'sampleList勾选列表')
-        // this.samplePagination.currentPage = 1;
-        // this.samplePagination.total = selection.length;
-        this.baseForm.sampleNumber = selection.length;
-      }
-    },
+      console.log(selection, 'gouxuan')
 
-    // 来料清单列表分页方法
-    handleSizeChange(val) {
-      this.pagination.pageSize = val;
-      this.pagination.currentPage = 1;
-    },
-    handleCurrentChange(val) {
-      this.pagination.currentPage = val;
+      this.selectedList = selection;
+
+      this.formData.portion = selection.length;
+
+      this.baseForm.sampleNumber = selection.length;
     },
 
     // 样品列表分页方法
@@ -566,6 +677,7 @@ export default {
     },
     changeModel(val) {
       this.baseForm.qualityMode = val;
+      this.baseForm.sampleNumber = ''
       console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
       if (this.baseForm.qualityMode == 1) {
         this.aaa()
@@ -574,45 +686,6 @@ export default {
       }
     },
 
-    changeNumber(val) {
-      if (this.baseForm.qualityMode !== 2) {
-        return;
-      }
-      if (val <= 0) {
-        this.$refs.showPackingListTable.clearSelection();
-        return;
-      }
-      console.log('取样数量', val, this.isCheck)
-
-      if (this.isCheck) {
-        if (val > this.packingList.length) {
-          this.$message.warning('取样数量不能大于来源清单数量!');
-          return;
-        }
-        const rows = this.packingList.slice(0, val);
-        rows.forEach((row) => {
-          this.$refs.showPackingListTable.toggleRowSelection(row);
-        });
-        if (this.baseForm.qualityMode == 1) {
-          this.sampleList = this.packingList;
-          this.samplePagination.currentPage = 1;
-          this.samplePagination.total = this.packingList.length;
-        } else {
-          this.sampleList = this.selectedList;
-        }
-
-      } else {
-        if (val > this.packingList[0].measureQuantity) {
-          this.$message.warning('取样数量不能大于计量数量!');
-          return;
-        }
-        const num = Number(val);
-        if (num) {
-          this.getUnpackSamList(this.packingList, num);
-        }
-      }
-    },
-
     resetTable() {
       this.$nextTick(() => {
         this.table1();
@@ -718,7 +791,117 @@ export default {
           });
       });
       this.loading = false;
-    }
+    },
+    handleSampleNumber(val) {
+
+      this.condition = val;
+
+      if (this.selectedList.length == 0) {
+        this.$message.warning('请先选择样品!');
+        return
+      } else {
+        if (val == 1) {
+          this.sampleList = this.selectedList
+          this.activeName = '2'
+          this.$message.success('取样成功!');
+          return;
+        } else {
+          if (this.formData.number == null && this.formData.sampleUnit == '') {
+            this.$message.warning('请先选择取样的数量和单位!');
+            return
+          }
+        }
+      }
+      this.$refs.table.clearSelection();
+    },
+    handleInput() {
+      if (this.formData.portion == null || this.formData.portion == '' || this.formData.portion == 0) {
+        debugger;
+        this.$message.warning('生成取样数量不能为空!');
+        return;
+      }
+
+      console.log(this.isCheck, 'this.isCheck')
+      if (this.isCheck) {
+        if (this.formData.portion > this.packingList.length) {
+          this.$message.warning('取样数量不能大于来源清单数量!');
+          return;
+        }
+        const rows = this.packingList.slice(0, this.formData.portion);
+        rows.forEach((row) => {
+          this.$refs.table.toggleRowSelection(row);
+        });
+      } else {
+        if (this.formData.portion > this.packingList[0].measureQuantity) {
+          this.$message.warning('取样数量不能大于计量数量!');
+          return;
+        }
+      }
+    },
+    getNewSampleList(measureQ, unit, nums) {
+      this.sampleList = [];
+      let data = [];
+
+      this.selectedList.forEach(oldItem => {
+
+        delete oldItem.id;
+
+        for (let i = 0; i < nums; i++) {
+          data.push({
+            ...oldItem,
+            measureQuantity: measureQ,
+            measureUnit: unit
+          });
+        }
+      });
+
+      console.log(data, 'datadatadatadatadatadata', nums)
+
+      this.sampleList = data;
+    },
+    getCategoryInfo(val) {
+      this.isConsumable = val.isConsumable;
+    },
+    handleSampleSubmit() {
+
+      if (this.formData.portion == null || this.formData.portion == 0) {
+        this.$message.warning('生成取样数量不能为空!');
+        return;
+      }
+      this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
+      if (this.condition == 1) {
+        this.sampleList = this.selectedList
+      } else {
+        let measureQ = this.formData.number;
+        let unit = this.formData.sampleUnit;
+        let nums = Number(this.formData.portion);
+
+        this.getNewSampleList(measureQ, unit, nums)
+      }
+      this.activeName = '2'
+
+    },
+    handleCancel() {
+      this.takeAsampleVisible = false;
+    },
+    handleSelectionChange2(selection) {
+      console.log(selection, '123')
+      this.confirmSampleData = selection;
+    },
+    handleConfirm() {
+
+      //赋值取样数量和取样单位
+      // this.baseForm.sampleNumber = this.sampleData[0].measureQuantity
+      // this.baseForm.sampleMeasureUnit = this.sampleData[0].measureUnit
+      if (this.confirmSampleData.length > 0) {
+        this.sampleList = this.confirmSampleData;
+      } else {
+        this.sampleList = this.selectedList;
+      }
+      this.takeAsampleVisible = false;
+
+    },
+
   }
 };
 </script>

+ 25 - 10
src/views/inspectionPlan/index.vue

@@ -2,7 +2,8 @@
   <div class="ele-body">
     <el-card shadow="never">
       <search ref="search" @search="reload"></search>
-      <ele-pro-table ref="tableRef" :columns="columns" :datasource="datasource" :pageSize="20"  :pageSizes="[20, 30, 40, 50, 100]">
+      <ele-pro-table ref="tableRef" :columns="columns" :datasource="datasource" :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]">
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
           <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')">
@@ -76,20 +77,41 @@ export default {
         {
           prop: 'code',
           slot: 'code',
-          label: '编码',
+          label: '质检计划编码',
           width: 160,
           align: 'center',
           showOverflowTooltip: true,
           fixed: 'left'
         },
         {
-          label: '名称',
+          label: '质检计划名称',
           prop: 'name',
           width: 160,
           align: 'center',
           showOverflowTooltip: true,
           fixed: 'left'
         },
+        {
+          label: '来源单据编码',
+          prop: 'planSourceCode',
+          width: 160,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'productCode',
+          width: 120,
+          label: '编码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'productName',
+          width: 120,
+          label: '名称',
+          align: 'center',
+          showOverflowTooltip: true
+        },
         {
           prop: 'batchNo',
           label: '批次号',
@@ -113,13 +135,6 @@ export default {
           align: 'center',
           showOverflowTooltip: true
         },
-        {
-          label: '计划来源编码',
-          prop: 'planSourceCode',
-          width: 160,
-          align: 'center',
-          showOverflowTooltip: true
-        },
         {
           label: '自动派单',
           prop: 'autoOrder',

+ 0 - 4
src/views/inspectionWork/components/QualityContentTabs.vue

@@ -57,10 +57,6 @@
                     {{ scope.row.categoryCode }}
                   </el-link>
                 </template>
-<!--                <template v-else-if="column.prop === 'weight'">-->
-<!--                  <el-input type="number" v-model="scope.row.weight" :min="0"-->
-<!--                    @input="inputWeight(scope.row, scope.$index)"></el-input>-->
-<!--                </template>-->
                 <template v-else>
                   {{ scope.row[column.prop] }}
                 </template>

+ 13 - 14
src/views/inspectionWork/index.vue

@@ -84,7 +84,7 @@ export default {
         },
         {
           prop: 'code',
-          label: '编码',
+          label: '质检工单编码',
           slot: 'code',
           align: 'center',
           width: 180,
@@ -92,28 +92,27 @@ export default {
           fixed: 'left'
         },
         {
-          label: '来源生产工单号',
-          prop: 'workOrderCode',
+          prop: 'qualityPlanName',
+          slot: 'qualityPlanName',
+          width: 120,
+          label: '质检工单名称',
           align: 'center',
-          width: 160,
           showOverflowTooltip: true
         },
         {
-          prop: 'batchNo',
-          label: '批次号',
+          label: '来源单号',
+          prop: 'workOrderCode',
           align: 'center',
-          width: 120,
+          width: 160,
           showOverflowTooltip: true
         },
         {
-          prop: 'qualityPlanName',
-          slot: 'qualityPlanName',
+          prop: 'productCode',
           width: 120,
-          label: '质检计划名称',
+          label: '编码',
           align: 'center',
           showOverflowTooltip: true
         },
-
         {
           prop: 'productName',
           width: 120,
@@ -122,10 +121,10 @@ export default {
           showOverflowTooltip: true
         },
         {
-          prop: 'productCode',
-          width: 120,
-          label: '编码',
+          prop: 'batchNo',
+          label: '批次号',
           align: 'center',
+          width: 120,
           showOverflowTooltip: true
         },
         {