zhangqing 1 год назад
Родитель
Сommit
3a03faa948

+ 9 - 0
src/api/classifyManage/index.js

@@ -88,3 +88,12 @@ export async function getList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+export async function getTreeByGroup(data) {
+  const res = await request.get(`/main/categoryLevel/getProduceTreeByPid`, {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 106 - 0
src/api/classifyManage/itemInformation.js

@@ -0,0 +1,106 @@
+import request from '@/utils/request';
+// 物品信息列表
+export async function getList(data) {
+  const res = await request.get(
+    `/main/category/getList?categoryLevelId=${data.categoryLevelId}&pageNum=${data.pageNum}&size=${data.size}&searchKey=${data.searchKey}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 物品信息保存
+export async function informationAdd(data) {
+  const res = await request.post('/main/category/add', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 物品信息编辑
+export async function informationEdit(data) {
+  const res = await request.post('/main/category/edit', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 物品信息详情
+export async function getDetails(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));
+}
+
+// 物品信息删除
+export async function removeItem(id) {
+  const res = await request.get(`/main/category/remove/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 物品信息获取编码
+export async function getOrderNo(prefix) {
+  const res = await request.get(`/main/category/createOrderNo/${prefix}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 查询仓库下拉列表
+export async function getWarehouseList() {
+  const res = await request.post(`/wms/warehouse/getWarehouseList`, {});
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 查询库存台账首页列表
+export async function pageeLedgerMain(params) {
+  const res = await request.get(`/wms/inout/pageeLedgerMain`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 库存台账-详情-基本信息
+export async function getCateInfo(id) {
+  const res = await request.get(`/wms/ledger/getCateInfo/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 分页
+export async function ledgerdetailPage(params) {
+  const res = await request.get(`/wms/ledgerdetail/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//库存台账-详情-出库单分页
+export async function ledgerPage(params) {
+  const res = await request.get(`/wms/ledger/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//库存台账详情出入单分页
+export async function inventorybookPage(params) {
+  const res = await request.get(`/wms/inventorybook/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 544 - 0
src/api/warehouseManagement/index.js

@@ -0,0 +1,544 @@
+import request from '@/utils/request';
+
+export default {
+  //根据人员id获取部门
+  getGroupById: async (id) => {
+    const res = await request.get(`/main/user/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  getApplyoutsource: async (params) => {
+    const res = await request.get(`/mes/applyoutsource/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 入库
+  storage: async (data) => {
+    const res = await request.post('/wms/outintwo/inStorage', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 批量获取包装编码
+  getAssetNum: async (data) => {
+    const res = await request.post('/wms/outintwo/getAssetNum', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 提交流程(入库)
+  submitTwo: async (data) => {
+    const res = await request.post('/bpm/outinApprove/submitTwo', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 提交流程(出库)
+  submitInsideTwo: async (data) => {
+    const res = await request.post('/bpm/outApprove/submitInsideTwo', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+
+  // 提交质检流程
+  qualityInspectionTwo: async (data) => {
+    const res = await request.post(
+      '/bpm/outinApprove/qualityInspectionTwo',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取入库列表
+  getList: async (params) => {
+    const res = await request.get(`/wms/outintwo/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取入库详情
+  getInboundList: async (params) => {
+    const res = await request.get(`/wms/outintwo/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取入库详情
+  getInboundDetailsById: async (id) => {
+    const res = await request.get(`/wms/outintwo/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取入库详情
+  getInboundDetailsByBizNo: async (id) => {
+    const res = await request.get(`/wms/outintwo/getInfoByBizNo/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 删除入库详情
+  delete: async (data) => {
+    const res = await request.delete('/wms/outintwo/delete', {
+      data
+    });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 物品维度台账列表
+  getProductList: async (params) => {
+    const res = await request.get(`/wms/outindetailtwo/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 批次维度台账列表
+  getBatchList: async (params) => {
+    const res = await request.get(`/wms/outindetailtwo/batchPage`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 包装维度台账列表
+  getPackingList: async (params) => {
+    const res = await request.get(`/wms/outInDetailRecordTwo/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取物料维度台账列表
+  getMaterialList: async (params) => {
+    const res = await request.get(`/wms/materialDetail/page`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过台账id获取出库物品详情
+  getHierarchyList: async (params) => {
+    const res = await request.get(`/wms/outintwo/getHierarchyList`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  getHierarchyFifo: async (data) => {
+    const res = await request.post('/wms/outintwo/getHierarchyFifo', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 出库
+  outStorage: async (data) => {
+    const res = await request.post('/wms/outintwo/outStorage', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 包装维度流水
+  outInRecordsPage: async (params) => {
+    const res = await request.get(
+      `/wms/outInDetailRecordTwo/outInRecordsPage`, {
+        params
+      }
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 上下架
+  upperLowerShelves: async (data) => {
+    const res = await request.post('/wms/outintwo/listing', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 出入库申请列表
+  getinboundRequestsList: async (data) => {
+    const res = await request.get('/wms/applystorage/page', {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 出入库申请列表通过入库申请单查询详情
+  getApplystoragedetail: async (data) => {
+    const res = await request.get('/wms/applystoragedetail/list', {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 出入库申请列表通过入库申请单查询详情(批量)
+  getApplystoragedetails: async (data) => {
+    const res = await request.post(
+      '/wms/applystoragedetail/listByAppIds',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取物料维度台账列表
+  getInfoBySourceBizNo: async (id) => {
+    const res = await request.get(`/wms/outintwo/getInfoBySourceBizNo/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 质检保存
+  qualityInspection: async (data) => {
+    const res = await request.post(`/wms/outintwo/qualityInspection`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过入库申请单查询详情
+  getApplystorageDetailById: async (id) => {
+    const res = await request.get(`/mes/applystorage/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 动态表头
+  fieldModel: async (params) => {
+    const res = await request.get(`/main/fieldmodel/list`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 单价维护
+  unitPriceMaintenance: async (data) => {
+    const res = await request.put(
+      '/wms/stockpackingtwo/unitPriceMaintenance',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 仓库树
+  getWarehouseTrees: async (data) => {
+    const res = await request.get('/wms/warehouse/getTrees', {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过仓库ID获取仓库区域
+  getListByWarehouseId: async (id) => {
+    const res = await request.get(
+      `/wms/warehousearea/getListByWarehouseId/${id}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 根据物品ID获取包装维度
+  getCategoryPackageDisposition: async (data) => {
+    const res = await request.post(
+      '/main/categoryPackageDisposition/list',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过入库单号获取入库明细
+  getOutInRecordsPage: async (data) => {
+    const res = await request.get(
+      `/wms/outInDetailRecordTwo/outInRecordsPage`, {
+        params: data
+      }
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 合并拆分包装
+  disassemblyPackage: async (data) => {
+    const res = await request.post(
+      '/wms/outInDetailRecordTwo/disassemblyPackage',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过物品id获取供货商列表
+  contactQueryByCategoryIdsAPI: async (data) => {
+    const res = await request.post('/eom/contact/queryByCategoryIds', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过销售发货单获取
+  getBySendRecordNo: async (id) => {
+    const res = await request.get(
+      `/eom/saleordersendrecord/getBySendRecordNo/${id}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 调拨保存
+  allotApplySave: async (data) => {
+    const res = await request.post('/wms/allotApply/save', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 库内调拨列表
+  getAllotApplyPage: async (data) => {
+    const res = await request.get(`/wms/allotApply/page`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 库内调拨详情列表
+  getAllotDetailList: async (data) => {
+    const res = await request.get(`/wms/allotDetail/list`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 库内调拨详情
+  getAllotDetail: async (id) => {
+    const res = await request.get(`/wms/allotApply/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 发起库外调拨流程
+  submitAllot: async (data) => {
+    const res = await request.post('/bpm/outinApprove/submitAllot', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  deleteAllot: async (data) => {
+    const res = await request.delete('/wms/allotApply/delete', {
+      data
+    });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 出入库列表
+  getOutinList: async (data) => {
+    const res = await request.get(`/wms/outintwo/list`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 拆包
+  takeApartPackage: async (data) => {
+    const res = await request.post(
+      '/wms/outInDetailRecordTwo/takeApartPackage',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 打包
+  combinePackage: async (data) => {
+    const res = await request.post(
+      '/wms/outInDetailRecordTwo/combinePackage',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 保存拣货单
+  savePickgoods: async (data) => {
+    const res = await request.post('/wms/pickgoods/save', data);
+    console.log(res);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 修改拣货单
+  updatePickgoods: async (data) => {
+    const res = await request.post('/wms/pickgoods/update', data);
+    console.log(res);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 拣货列表
+  getPickgoodsList: async (data) => {
+    const res = await request.get(`/wms/pickgoods/page`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 获取拣货详情
+  getPickgoodsDetails: async (id) => {
+    const res = await request.get(`/wms/pickgoods/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 删除入库详情
+  deletePickgoods: async (data) => {
+    const res = await request.delete('/wms/pickgoods/delete', {
+      data
+    });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 拣货出库
+  pickGoodsOutIn: async (data) => {
+    const res = await request.post('/wms/outintwo/pickGoodsOutIn', data);
+    console.log(res);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 台账详情调拨列表
+  getAllotDetails: async (data) => {
+    const res = await request.get(`/wms/allotDetail/page`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 台账详情盘点列表
+  getPlandetails: async (data) => {
+    const res = await request.get(`/wms/plandetail/page`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+
+  //江南-仓库入库申请
+
+  //入库申请列表
+  getStoreList: async (data) => {
+    const res = await request.get(`/wms/applystoragejn/page`, {
+      params: data
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //入库申请保存
+  saveStoragejn: async (data) => {
+    const res = await request.post('/wms/applystoragejn/save', data);
+    console.log(res);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //入库申请信息
+  getStoragejnDetails: async (id) => {
+    const res = await request.get(`/wms/applystoragejn/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //入库申请提交
+  submitStoragejn: async (data) => {
+    const res = await request.post('/wms/applystoragejn/submit', data);
+    console.log(res);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+
+};

+ 180 - 0
src/api/warehouseManagement/outin.js

@@ -0,0 +1,180 @@
+import request from '@/utils/request';
+
+export default {
+  //列表
+  list: async (params) => {
+    const res = await request.get('/wms/outin/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //列表
+  getAssetNum: async (data) => {
+    const res = await request.post('/wms/outin/getAssetNum', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //保存
+  save: async (data) => {
+    const res = await request.post('/wms/outin/save', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  //新保存
+  saveNew: async (data) => {
+    const res = await request.post('/wms/outin/saveNew', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  //删除
+  delete: async (data) => {
+    const res = await request.delete('/wms/outintwo/delete', { data });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //出库实时库存
+  getRealTimeInventory: async (params) => {
+    const res = await request.get(`/wms/outin/getRealTimeInventory`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //出库实时库存
+  pageeLedger: async (params) => {
+    const res = await request.get(`/wms/outin/getOutStock`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //出库物品实时库存
+  getoutDetail: async (params) => {
+    const res = await request.get(`/wms/outin/getOutDetail`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  //详情
+  getById: async (id) => {
+    const res = await request.get(`/wms/outin/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //出入库单-新增入库单信息
+  addInOut: async (data) => {
+    const res = await request.post('/wms/inout/addInOut', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  //列表
+  pageWms: async (params) => {
+    const res = await request.get('/wms/inout/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+
+  //入库详情
+  getWms: async (id) => {
+    const res = await request.get(`/wms/inout/getInfoById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //库存台账-基本信息
+  getBasicInformation: async (categoryId) => {
+    const res = await request.get(
+      `/wms/outin/getBasicInformation/${categoryId}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+
+  //库存台账-库存明细
+
+  getInventoryDetails: async (params) => {
+    const res = await request.get(`/wms/outin/getInventoryDetails`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //库存台账-库存明细-物料维度
+
+  getMaterielDetails: async (params) => {
+    const res = await request.get(`/wms/outin/getMaterielDetails`, {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  outApproveQuality: async (params) => {
+    const res = await request.post(
+      `/bpm/outinApprove/qualityInspection`,
+      params
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  outApprove: async (params) => {
+    const res = await request.post(`/bpm/outApprove/submit`, params);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  outApproves: async (params) => {
+    const res = await request.post(`/bpm/outinApprove/submit`, params);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  outApprovesInside: async (params) => {
+    const res = await request.post(`/bpm/outApprove/submitInside`, params);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  update: async (params) => {
+    const res = await request.put(`/wms/outin/update`, params);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  updateOutInRecord: async (params) => {
+    const res = await request.post(`/wms/outin/updateOutInRecord`, params);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  getDetailByCode: async (params) => {
+    const res = await request.post(`/wms/outin/getDetailByCode`, params);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  getListByNameOrModeType: async (data) => {
+    const res = await request.post(
+      `/main/category/getListByNameOrModeType`,
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  }
+};

+ 58 - 0
src/api/warehouseManagement/statisticalReports.js

@@ -0,0 +1,58 @@
+import request from '@/utils/request';
+
+// 获取库存余额列表
+export async function getStatementPage(params) {
+  const res = await request.get(`/wms/statement/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取库存余额列表
+export async function exportStockExcel(params) {
+  const res = await request.post(`/wms/statement/exportStockExcel`, params, {
+    responseType: 'blob'
+  });
+  return res.data;
+}
+
+// 库存余额导出记录表
+export async function getStatementLogPage(params) {
+  const res = await request.get(`/wms/statementLog/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 库存余额筛选列表
+export async function getStockPage(params) {
+  const res = await request.get(`/wms/statistics/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 收发明细表
+export async function sendReceiveExcel(params) {
+  const res = await request.post(`/wms/statement/sendReceiveExcel`, params, {
+    responseType: 'blob'
+  });
+  return res.data;
+}
+
+// 收发汇总表
+export async function sendReceiveGatherExcel(params) {
+  const res = await request.post(`/main/wmsExport/sendReceiveGather`, params, {
+    responseType: 'blob'
+  });
+  return res.data;
+}

+ 184 - 0
src/api/warehouseManagement/warehouseDefinition.js

@@ -0,0 +1,184 @@
+import request from '@/utils/request';
+
+//条件查询工厂
+// export async function getFactoryarea(params) {
+//   const res = await request.get(`/main/factoryarea/page`, {
+//     params
+//   });
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+// // 仓储管理-仓库信息的保存
+// export async function warehouseSave(data) {
+//   return request.post('/warehouseGoodsshelves/newWarehouse/save', data);
+// }
+export default {
+  getTreeByGroup: async (params) => {
+    const res = await request.get('/main/categoryLevel/getProduceTreeByPid', {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //条件查询工厂
+  getFactoryarea: async (params) => {
+    const res = await request.get('/main/factoryarea/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // /wms/warehouse/page
+  //获取部门
+  tree: async () => {
+    // const res = await request.get('/wms/warehouse/getTrees');
+    const res = await request.get('/main/group/getGroupList');
+    // /wms/warehouse/getTrees
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //根据部门获取员工
+  getUserPage: async (params) => {
+    const res = await request.get('/main/user/getUserPage', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //仓库定义列表
+  list: async (params) => {
+    const res = await request.post(
+      '/wms/warehouse/select/warehouseList',
+      params
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //新增和修改
+  save: function (data) {
+    return request.post('/wms/warehouse/saveNew', data);
+  },
+
+  //新增库区
+  warehouseareaSave: async (data) => {
+    const res = await request.post('/wms/warehouse/save', data);
+
+    return res;
+  },
+  //新增仓库
+  saveOrUpdateWarehouse: async (data) => {
+    const res = await request.post(
+      '/wms/warehouse/saveOrUpdateWarehouse',
+      data
+    );
+
+    return res;
+  },
+  //修改货位状态是不是满的
+  warehouseChangeStatus: async (data) => {
+    const res = await request.put(
+      '/wms/warehouseareagoodsshelvesallocation/update',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+  //删除
+  delete: async (id) => {
+    const res = await request.get(`/wms/warehouse/delete/${id}`);
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+  //删除
+  isDelete: async (id) => {
+    const res = await request.get('/wms/warehouse/isDelete/' + id);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //根据ID获取
+  getById: async (params) => {
+    const res = await request.get(`/wms/warehouse/getById/${params.id}`, {});
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //详情
+  info: function (params) {
+    return request.get('/main/org/info/info', { params });
+  },
+  //树
+  // tree: function (params) {
+  //     return http.asyncCall("/main/org/dept/tree", params,'get')
+  // },
+
+  //查询仓库详情
+
+  warehouseDetail: async (warehouseId) => {
+    const res = await request.post(
+      `/wms/warehouse/warehouseDetail/${warehouseId}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //根据仓库查询库区
+  getListByWarehouseId: async (id) => {
+    const res = await request.get(
+      `/wms/warehousearea/getListByWarehouseId/${id}`,
+      {}
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //根据库区查货架
+  getListByAreaId: async (id) => {
+    const res = await request.get(
+      `/wms/warehouseareagoodsshelves/getListByAreaId/${id}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //根据货架查货位
+  getListByGoodId: async (goodId) => {
+    const res = await request.get(
+      `/wms/warehouseareagoodsshelvesallocation/getListByGoodId/${goodId}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  // 批次调拨
+  lotAllot: async (data) => {
+    const res = await request.post(`/wms/outin/lotAllot`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  // 包装调拨
+  packageAllot: async (data) => {
+    const res = await request.post(`/wms/outin/packageAllot`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  // 调拨记录
+  allotRecord: async (data) => {
+    const res = await request.post(`/wms/allotRecord/page`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  }
+};

+ 124 - 0
src/views/inspectionPlan/components/assetTree.vue

@@ -0,0 +1,124 @@
+<template>
+  <div class="tree-wrapper">
+    <el-tree
+      :data="treeList"
+      :props="defaultProps"
+      v-loading="treeLoading"
+      :node-key="nodeKey"
+      ref="tree"
+      :highlight-current="true"
+      :expand-on-click-node="false"
+      @node-click="handleNodeClick"
+      :default-expanded-keys="current && current.id ? [current.id] : []"
+    >
+    </el-tree>
+  </div>
+</template>
+
+<script>
+  import { getTreeByGroup } from '@/api/classifyManage';
+
+  export default {
+    props: {
+      defaultProps: {
+        type: Object,
+        default: function () {
+          return {
+            children: 'children',
+            value: 'id',
+            label: 'name'
+          };
+        }
+      },
+
+      // 初始请求treeList
+      init: {
+        type: Boolean,
+        default: true
+      },
+
+      treeIds: {
+        type: Array,
+        default: []
+      },
+      nodeKey: {
+        type: String,
+        default: 'id'
+      }
+    },
+    data() {
+      return {
+        treeList: [],
+        treeLoading: false,
+        current: {},
+        currentKey: ''
+      };
+    },
+    mounted() {
+      if (this.init) {
+        this.getTreeData();
+      }
+    },
+    methods: {
+      // 获取树结构数据
+      getTreeData() {
+        return new Promise(async (resolve) => {
+          try {
+            this.treeLoading = true;
+
+            const res = await getTreeByGroup({ type: 2 });
+            this.treeLoading = false;
+            if (res?.code === '0') {
+              this.treeList = res.data;
+              this.$emit('setRootId', res.data[0]);
+
+              this.$nextTick(() => {
+                // 默认高亮第一级树节点
+                if (this.treeList[0]) {
+                  this.setCurrentKey(this.treeList[0]);
+                  this.current = this.treeList[0];
+                  // 默认点击加载数据
+                  // const firstNode = document.querySelector('.el-tree-node');
+                  // firstNode.click();
+                  resolve(this.current);
+                }
+              });
+              return this.treeList;
+            }
+          } catch (error) {
+            console.log(error);
+          }
+          this.treeLoading = false;
+        });
+      },
+
+      handleNodeClick(data, node) {
+        this.$emit('handleNodeClick', data, node);
+      },
+      // 设置默认高亮行
+      setCurrentKey(id) {
+        this.currentKey = id;
+        this.$refs.tree.setCurrentKey(this.currentKey);
+      },
+
+      // 获取树的选中状态
+      getSelectList() {
+        const selectList = this.$refs.tree.getCurrentNode();
+        return selectList;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree-wrapper {
+    width: 100%;
+    height: 100%;
+    overflow: auto;
+
+    :deep(.el-tree) {
+      display: inline-block;
+      min-width: 100%;
+    }
+  }
+</style>

+ 115 - 29
src/views/inspectionPlan/components/baseInfo.vue

@@ -3,17 +3,18 @@
   <el-form ref="form1" :model="form" :rules="rules" label-width="120px">
     <el-row>
       <el-col :span="6">
-        <el-form-item label="编码:" prop="code">
-          <el-input clearable v-model="form.code" placeholder="请输入" disabled />
-        </el-form-item>
-      </el-col>
+          <el-form-item label="类型:" prop="type">
+            <DictSelection dictName="质检计划类型" v-model="form.type" clearable @change="typeChange"
+              :disabled="btnType == 'detail' || btnType == 'issued'"></DictSelection>
+          </el-form-item>
+        </el-col>
+      
       <el-col :span="6">
         <el-form-item label="名称:" prop="name">
           <el-input clearable v-model="form.name" placeholder="请输入"
             :disabled="btnType == 'detail' || btnType == 'issued'" />
         </el-form-item>
       </el-col>
-
       <el-col :span="6">
         <el-form-item label="检验方式:" prop="qualityMode">
           <DictSelection dictName="取样类型" v-model="form.qualityMode" clearable
@@ -33,6 +34,11 @@
       </el-col>
     </el-row>
     <el-row>
+      <el-col :span="6">
+        <el-form-item label="编码:" prop="code">
+          <el-input clearable v-model="form.code" placeholder="请输入" disabled />
+        </el-form-item>
+      </el-col>
       <el-col :span="6">
         <el-form-item label="自动派单:" prop="autoOrder">
           <el-select v-model="form.autoOrder" placeholder="请选择" style="width: 100%"
@@ -55,12 +61,7 @@
           </el-select>
         </el-form-item>
       </el-col>
-      <el-col :span="6">
-        <el-form-item label="开始时间:" prop="planStartTime">
-          <el-date-picker :disabled="btnType == 'detail'" class="w100" v-model="form.planStartTime" type="date"
-            value-format="yyyy-MM-dd" placeholder="请输入"></el-date-picker>
-        </el-form-item>
-      </el-col>
+      
     </el-row>
     <div style="text-align: right;margin-bottom: 22px;">
       <div @click="toggleExpand">
@@ -70,18 +71,24 @@
     </div>
     <div v-if="isExpanded">
       <el-row>
+        <el-col :span="6">
+        <el-form-item label="开始时间:" prop="planStartTime">
+          <el-date-picker :disabled="btnType == 'detail'" class="w100" v-model="form.planStartTime" type="date"
+            value-format="yyyy-MM-dd" placeholder="请输入"></el-date-picker>
+        </el-form-item>
+      </el-col>
         <el-col :span="6">
           <el-form-item label="结束时间:" prop="planEndTime">
             <el-date-picker :disabled="btnType == 'detail'" class="w100" v-model="form.planEndTime" type="date"
               value-format="yyyy-MM-dd" placeholder="请输入"></el-date-picker>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <!-- <el-col :span="6">
           <el-form-item label="类型:" prop="type">
             <DictSelection dictName="质检计划类型" v-model="form.type" clearable @change="typeChange"
               :disabled="btnType == 'detail' || btnType == 'issued'"></DictSelection>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="6">
           <el-form-item label="计划来源:" prop="planSource">
             <el-select v-model="form.planSource" placeholder="请选择" style="width: 100%" clearable
@@ -131,8 +138,8 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="数量:" prop="productNumber">
-            <el-input type="number" v-model="form.productNumber" disabled>
-              <template #append>{{ categoryInfo.measuringUnit }}</template>
+            <el-input type="number" v-model="form.productNumber" :disabled="form.planSource == '5' ? false : true">
+              <template #append>{{ form.dimension == 3 ? form.packingUnit : form.dimension == 2 ? form.measureUnit : categoryInfo.measuringUnit }}</template>
             </el-input>
           </el-form-item>
         </el-col>
@@ -171,7 +178,7 @@
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="6" v-if="form.qualityMode == 2">
+        <!-- <el-col :span="6" v-if="form.qualityMode == 2">
           <el-form-item label="取样数量:" prop="sampleNumber" :rules="{
             required: form.qualityMode == 2 ? true : false,
             message: '请输入取样数量',
@@ -185,7 +192,7 @@
               </DictSelection>
             </div>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="6">
           <el-form-item label="抽样比例:" prop="sampleProportion">
             <el-input v-model="form.sampleProportion" :disabled="btnType == 'detail' || btnType == 'issued'">
@@ -193,17 +200,13 @@
             </el-input>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="24">
+        <el-col :span="6">
           <el-form-item label="备注:" prop="remark">
             <el-input type="textarea" v-model="form.remark" placeholder="请输入"
               :disabled="btnType == 'detail' || btnType == 'issued'" />
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item label="附件:" prop="accessory">
             <fileUpload v-model="form.accessory" :type="btnType == 'detail' ? 'view' : ''" />
           </el-form-item>
@@ -215,7 +218,8 @@
     <productionPlan ref="productionPlanRef" @choose="handleChoose" />
     <workOrder ref="workOrderRef" @choose="handleChoose" />
     <produceOrder ref="produceOrderRef" @choose="handleChoose" />
-    <EquipmentDialog ref="equipmentRefs" @choose="handleChoose" :type="1" :treeIds="['9', '1']" />
+    <EquipmentDialog ref="equipmentRefs" @choose="handleMainChoose" :type="2" :treeIds="['9']" />
+    <stokledger ref="stokledgerRef" @choose="handleStokledgerChoose" />
 
   </el-form>
 </template>
@@ -227,7 +231,8 @@ import warehousing from './warehousing';
 import productionPlan from './productionPlan';
 import workOrder from './workOrder';
 import produceOrder from './produceOrder';
-import EquipmentDialog from '@/views/inspectionWork/components/EquipmentDialog';
+import EquipmentDialog from './equipmentDialog';
+import stokledger from './stokledger';
 
 //接口
 import { getUserPage } from '@/api/system/organization';
@@ -244,7 +249,8 @@ export default {
     productionPlan,
     warehousing,
     deptSelect,
-    fileUpload
+    fileUpload,
+    stokledger
   },
   props: {
     form: {
@@ -261,6 +267,18 @@ export default {
     },
   },
   watch: {
+    'form.productNumber': {
+      handler(newVal) {
+        if (newVal && this.form.planSource == '5') { //主数据来源才生效
+          this.$emit('changeProductNumberModel', newVal);
+          this.form.totalWeight = this.categoryInfo.netWeight * newVal || 0;
+        } else {
+          console.log('清空样品清单');
+          this.$emit('table2');
+        }
+      },
+      immediate: false
+    },
     'form.qualityMode': {
       handler(newVal) {
         if (newVal) {
@@ -272,6 +290,17 @@ export default {
       },
       immediate: false
     },
+    'form.inspectionStandards': {
+      handler(newVal) {
+        if (newVal) {
+          this.$emit('getInspectionStandards', newVal);
+        } else {
+          console.log('清空样品清单');
+          this.$emit('table2');
+        }
+      },
+      immediate: false
+    },
     'form.type': {
       handler(newVal) {
         if (!newVal) {
@@ -328,6 +357,9 @@ export default {
         qualityMode: [
           { required: true, message: '请选择检验方式', trigger: 'blur' }
         ],
+        inspectionStandards: [
+          { required: true, message: '请选择检验标准', trigger: 'blur' }
+        ],
         type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
         groupId: [
           { required: true, message: '请选择执行部门', trigger: 'blur' }
@@ -416,9 +448,11 @@ export default {
         this.$refs.workOrderRef.open();
       } else if (this.form.planSource == 4) {
         this.$refs.produceOrderRef.open();
-      } else {
+      } else if (this.form.planSource == 5) { //主数据
         this.$refs.equipmentRefs.open();
-      }
+      } else if (this.form.planSource == 6) { //库存台账
+        this.$refs.stokledgerRef.open();
+      } 
     },
     //根据类型获取计划来源下拉
     typeChange(val) {
@@ -430,10 +464,63 @@ export default {
           { label: '生产订单', value: '3' },
           { label: '生产工单', value: '4' }
         ];
+      } else if (val == 3) {
+        this.sourceList = [
+          { label: '主数据', value: '5' },
+          { label: '库存台账', value: '6' },
+        ];
       }
     },
+
+    //主数据根据来源得到产品
+    handleMainChoose(val) {
+      console.log(val, '主数据根据来源得到产品');
+      if (!val) return;
+      this.form.productName = val.name;//名称
+      this.form.productCode = val.code;//编码
+      this.form.specification = val.specification;//规格
+      this.form.modelType = val.modelType; //型号
+      this.form.brandNo = val.brandNum; //牌号
+      this.form.totalWeight = val.totalWeight; //总重量
+      this.form.inspectionStandards = val.inspectionStandards;//检验标准
+      this.form.isConsumable = val.isConsumable; //0 单件 1 批量
+      this.form.productId = val.id;
+      this.form.netWeight = val.netWeight; //净重
+      this.getProductDetails(this.form.productId)
+      this.$emit('changesMainNumberModal', this.form.productNumber);
+      this.$emit('getQualityTemplate', val.code)
+    },
+
+    //库存台账根据来源得到产品
+    handleStokledgerChoose(list, dimension) {
+      let val = list[0];
+      console.log(val, '库存台账根据来源得到产品');
+      if (!val) return;
+      if (dimension == 3) {
+        this.form.productNumber = val.measureQuantity;//数量
+        this.form.packingUnit = val.packingUnit//包装单位
+      } else {
+        this.form.productNumber = val.outboundNum;//数量
+      }
+      this.form.dimension = dimension;
+      this.form.measureUnit = val.measureUnit//计量单位
+
+      this.form.productName = val.categoryName;//名称
+      this.form.productCode = val.categoryCode;//编码
+      this.form.specification = val.specification;//规格
+      this.form.modelType = val.categoryModel ; //型号
+      this.form.brandNo = val.brandNum; //牌号
+      this.form.inspectionStandards = val.inspectionStandards;//检验标准
+      this.form.productId = val.categoryId;
+      this.form.batchNo = val.batchNo; //批次号
+      this.getProductDetails(this.form.productId);
+      this.$emit('changesStokledgerNumberModal', list, dimension);
+      this.$emit('getQualityTemplate', val.categoryCode)
+    },
+
     //   根据来源得到产品
     handleChoose(val) {
+      console.log(val, '根据来源得到产品');
       if (!val) return;
       this.form.planSourceId = val.id;
       this.form.planSourceCode = val.receiveNo;
@@ -470,7 +557,6 @@ export default {
     async getProductDetails(val) {
       const data = await getDetailInfo(val)
       this.categoryInfo = data.category
-
       this.$emit('getCategoryInfo', data)
     },
     getsampleMeasureUnit(val) {

+ 442 - 115
src/views/inspectionPlan/components/edit.vue

@@ -4,8 +4,9 @@
     :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"
-      @changeModel="changeModel" @getList="getList" @table2="table2" :packingLists="packingList"
-      @getCategoryInfo="getCategoryInfo"></base-info>
+      @changeModel="changeModel" @getList="getList" @table2="table2" @getInspectionStandards="getInspectionStandards" :packingLists="packingList"
+      @getCategoryInfo="getCategoryInfo" @changeProductNumberModel="changeProductNumberModel"
+      @changesStokledgerNumberModal="changesStokledgerNumberModal" @getQualityTemplate="getQualityTemplate"></base-info>
     <el-row>
       <header-title title="质检内容"></header-title>
 
@@ -30,7 +31,7 @@
                   <el-col :span="6" v-if="conditionType == 2">
                     <el-form-item prop="number" label-width="0" style="margin-bottom: 0;">
                       <el-input v-model="formData.number" placeholder="请输入" size="mini"
-                        @change="handleInputNumber"></el-input>
+                        ></el-input>
                     </el-form-item>
                   </el-col>
                   <el-col :span="6" v-if="conditionType == 2">
@@ -42,22 +43,22 @@
                   </el-col>
                   <el-col :span="8" v-if="conditionType == 2">
                     <el-form-item prop="portion" label="数量" style="margin: 0;">
-                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"
+                      <el-input v-model="formData.portion" placeholder="请输入" size="mini"
                         clearable></el-input>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="24" v-if="conditionType == 1 && !isCheck">
+                  <el-col :span="24" v-if="conditionType == 1">
                     <el-form-item prop="portion" label="数量" style="margin: 0;">
-                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"
+                      <el-input v-model="formData.portion" placeholder="请输入" size="mini"
                         clearable></el-input>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 1 && !isCheck">
-                    <el-button type="primary" size="mini" @click="handleSampleSubmit"
+                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 1">
+                    <el-button type="primary" size="mini" @click="handleExtractFull"
                       style="margin-right: 12px;">确认</el-button>
                   </el-col>
                   <el-col :span="4" style="text-align: right;" v-if="conditionType == 2">
-                    <el-button type="primary" size="mini" @click="handleSampleSubmit"
+                    <el-button type="primary" size="mini" @click="handleExtractFull"
                       style="margin-right: 12px;">确认</el-button>
                   </el-col>
                 </el-form>
@@ -279,11 +280,12 @@ export default {
         ]
 
       },
-      isConsumable: '',
+      isConsumable: '',//0 单件 1批量
       netWeight: '',// 净重
       conditionType: null,
 
-      sampleListCode: ''
+      sampleListCode: '',
+      productItem: {}, //产品信息
     };
   },
   computed: {
@@ -384,6 +386,58 @@ export default {
   },
   created() { },
   methods: {
+    //成品检验类型,计划来源主数据,修改数量生成来源清单
+    changeProductNumberModel(num) {
+      this.$refs.table12.setData([])
+      let nums = Number(num)
+      let p = this.productItem
+      console.log(p, 'productItem')
+      let list = []
+      if (this.isConsumable == 0) {
+        for (let i = 0; i < nums; i++) {
+          let obj = {
+            id:p.id,
+            categoryCode: p.code, //编码
+            categoryName: p.name, //名称
+            measureQuantity: 1, //计量数量
+            measureUnit: p.measuringUnit, //计量单位
+            weightUnit: p.weightUnit, //重量单位
+            weight:p.netWeight, //重量
+          }
+          list.push(obj)
+        }
+      } else if (this.isConsumable == 1) {
+        let obj = {
+          id:p.id,
+          categoryCode: p.code, //编码
+          categoryName: p.name, //名称
+          measureQuantity: nums, //计量数量
+          measureUnit: p.measuringUnit, //计量单位
+          weightUnit: p.weightUnit, //重量单位
+          weight: p.netWeight * nums, //重量
+        }
+        list.push(obj)
+      }
+      this.$refs.table12.setData(list)
+    },
+
+    //成品类型检验类型,计划来源库存台账, 生成来源清单
+    changesStokledgerNumberModal(val, dimension) {
+        this.$refs.table12.setData([])
+        if (dimension == 3) return this.$refs.table12.setData(val)
+        let num = Number(val[0].outboundNum)
+        let list = []
+        for (let i = 0; i < num; i++) {
+          list.push({...val[0], id: i + 1, packingQuantity:null, measureQuantity: 1 }); 
+        }
+        this.$refs.table12.setData(list)
+    },
+
+    //获取基本信息中计量方式
+    getInspectionStandards(data) {
+        this.baseForm.inspectionStandards = data;
+        this.handleSampleList()
+    },
     async datasource({ page, limit, where }) {
       const res = await getInventoryListByPlanId({ ...where, page, limit });
       // if (res.list.length > 1) {
@@ -418,7 +472,7 @@ export default {
     },
     async inspectionTemplateSuccess(select){
       let data= await getQualityTemplateByIds({templateIds:select.map(item=>item.id)})
-          this.schemeList.push(...data)
+      this.schemeList.push(...data)
     },
     async handleEditOrDetail(row) {
       console.log('row====', row);
@@ -493,6 +547,7 @@ export default {
       this.schemePagination.total = this.schemeList.length;
     },
     async getList(receiveNo, productCode, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark) {
+ 
       //通过来源和产品 获取来料清单
       await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark);
 
@@ -569,8 +624,8 @@ export default {
     },
     async handleSampleList() {
       let packingList = this.$refs.table12.getData();
-      //全检时
-      if (this.baseForm.qualityMode == 1) {
+      //全检时 计量时
+      if (this.baseForm.qualityMode == 1 && this.baseForm.inspectionStandards == 1) {
         this.sampleList = [];
         console.log(this.baseForm, '---isUnpack---')
         await this.handleUnpackCase(packingList);
@@ -589,10 +644,21 @@ export default {
         //     await this.updatePackingList(packingList);
         //   }
         // }
+        //全检 计重时
+      } else if (this.baseForm.qualityMode == 1 && this.baseForm.inspectionStandards == 2)  {
+        this.sampleList = [];
+        this.getFullInspectionWeight(packingList);
       } else {
         this.sampleList = [];
       }
     },
+
+    //全检 计重时生成样品清单
+    async getFullInspectionWeight(packingList) {
+      this.updatePackingList(packingList);
+    },
+
+
     //拆包处理样品清单数据
     async handleUnpackCase(packingList) {
       const num = Number(this.baseForm.productNumber || 0);
@@ -604,6 +670,8 @@ export default {
     async getSampleCode() {
       return await getCode('sample_code');
     },
+
+    //更新样品清单数据
     async updatePackingList(list) {
       for (let i = 0; i < list.length; i++) {
         list[i].sampleCode = await this.getSampleCode();
@@ -613,6 +681,8 @@ export default {
       this.samplePagination.currentPage = 1;
       this.samplePagination.total = list.length;
     },
+
+
     async getUnpackSamList(list, num) {
       console.log('拆包getUnpackSamList')
       let data = [];
@@ -648,13 +718,11 @@ export default {
 
     },
     async getQualityTemplate(productCode, ids) {
-
       await getQualityTemplateList({
         productCode: productCode,
         qualityQlanId: ids,
       }).then((res) => {
         if (Object.keys(res).length === 0) {
-          this.$message.error('请确认该物品是否配置质检方案!');
           return;
         }
         this.baseForm.sampleProportion = res.checkProportion;
@@ -703,6 +771,7 @@ export default {
         this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
       } else if (this.conditionType == 1) {
         this.baseForm.sampleNumber = this.formData.portion;
+        this.formData.number = 0;
       }
     },
     //取样方式选择
@@ -711,63 +780,61 @@ export default {
       this.conditionType = val;
       //清空样品清单列表
       this.sampleList = []
-      const dataS = this.$refs.table12.getData();
+      // const dataS = this.$refs.table12.getData();
       //取整样
-      if (val == 1) {
-        if (this.selectedList.length == 0) {
-          this.$message.warning('请先选择样品!');
-        } else {
-          if (this.isCheck) {
-            for (let i = 0; i < this.selectedList.length; i++) {
-              for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
-                // this.selectedList[i].sampleCode = await this.getSampleCode();
-                this.sampleList.push({
-                  ...this.selectedList[i],
-                  sampleCode: await this.getSampleCode(),
-                  measureQuantity: 1,
-                  weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
-                });
-              }
-            }
-          } else {
-            for (let i = 0; i < this.selectedList.length; i++) {
-              let forNum = 0;
-              if (this.formData.portion != null && this.formData.portion != '') {
-                forNum = this.formData.portion;
-              } else {
-                forNum = this.selectedList[i].measureQuantity;
-              }
-              for (let j = 0; j < forNum; j++) {
-                // this.selectedList[i].sampleCode = await this.getSampleCode();
-                this.sampleList.push({
-                  ...this.selectedList[i],
-                  sampleCode: await this.getSampleCode(),
-                  measureQuantity: 1,
-                  weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
-                });
-              }
-            }
-
-          }
+      // if (val == 1) {
+      //   if (this.selectedList.length == 0) {
+      //     this.$message.warning('请先选择样品!');
+      //   } else {
+      //     if (this.isCheck) {
+      //       for (let i = 0; i < this.selectedList.length; i++) {
+      //         for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
+      //           // this.selectedList[i].sampleCode = await this.getSampleCode();
+      //           this.sampleList.push({
+      //             ...this.selectedList[i],
+      //             sampleCode: await this.getSampleCode(),
+      //             measureQuantity: 1,
+      //             weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
+      //           });
+      //         }
+      //       }
+      //     } else {
+      //       for (let i = 0; i < this.selectedList.length; i++) {
+      //         let forNum = 0;
+      //         if (this.formData.portion != null && this.formData.portion != '') {
+      //           forNum = this.formData.portion;
+      //         } else {
+      //           forNum = this.selectedList[i].measureQuantity;
+      //         }
+      //         for (let j = 0; j < forNum; j++) {
+      //           // this.selectedList[i].sampleCode = await this.getSampleCode();
+      //           this.sampleList.push({
+      //             ...this.selectedList[i],
+      //             sampleCode: await this.getSampleCode(),
+      //             measureQuantity: 1,
+      //             weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
+      //           });
+      //         }
+      //       }
 
-          // this.sampleList = this.selectedList;
-          this.formData.portion = this.sampleList.length;
-          this.activeName = '2';
-          this.$message.success('取样成功!');
-        }
-      } else if (val == 2) {
-        this.formData.sampleUnit = dataS[0].measureUnit;
+      //     }
+      //     this.formData.portion = this.sampleList.length;
+      //     this.activeName = '2';
+      //     this.$message.success('取样成功!');
+      //   }
+      // } else if (val == 2) {
+      //   this.formData.sampleUnit = dataS[0].measureUnit;
 
-        // this.$refs.table12.clearSelection();
-        //小样
-        if (this.selectedList.length == 0) {
-          this.$message.warning('请先选择样品!');
-        } else {
-          if (this.formData.number == null || this.formData.sampleUnit == '') {
-            this.$message.warning('请先选择取样的数量和单位!');
-          }
-        }
-      }
+      //   this.$refs.table12.clearSelection();
+      //   //小样
+      //   if (this.selectedList.length == 0) {
+      //     this.$message.warning('请先选择样品!');
+      //   } else {
+      //     if (this.formData.number == null || this.formData.sampleUnit == '') {
+      //       this.$message.warning('请先选择取样的数量和单位!');
+      //     }
+      //   }
+      // }
     },
 
     handleInputNumber(val) {
@@ -781,6 +848,8 @@ export default {
         return;
       }
     },
+
+    // 整样输入框事件
     handleInput(val) {
       if (val == 0 || val == '' || val == null) {
         this.$refs.table12.clearSelection();
@@ -832,13 +901,159 @@ export default {
     },
     getCategoryInfo(val) {
       // this.baseForm.isUnpack = val.categoryWms.isUnpack;
-
+      console.log(val, '产品信息')
       this.isConsumable = val.category.isConsumable;
       this.netWeight = val.category.netWeight;
+      this.productItem = val.category; //产品信息
     },
     changeSamUnit(val) {
       this.$refs.baseInfoRefs.getsampleMeasureUnit(val);
     },
+
+    //整样确认按钮-样品列表右上角确认按钮
+    // handleExtractFull() {
+    //   this.$refs.ruleForm.validate((valid) => {
+    //     if (valid) {
+    //       if (!this.selectedList || this.selectedList.length == 0) {
+    //         this.$message.warning('请先选择样品!');
+    //         return;
+    //       }
+    //       this.sampleList = []
+    //       //取样条数
+    //       let safePortion = Number(this.formData.portion);
+    //       //计量数量
+    //       let measureQ = this.formData.number || 1;
+    //       //计量单位
+    //       let unit = this.formData.sampleUnit;
+    //       //抽检计量整样小样或者抽检计重小样
+    //       if ((this.baseForm.inspectionStandards === 1) || (this.baseForm.inspectionStandards === 2 && this.conditionType == 2)) {
+    //         if (this.conditionType == 2) {
+    //           if (measureQ <= 0) {
+    //             this.$message.info('取样计量数量必须大于0');
+    //             return
+    //           }
+    //         }
+    //         // 计算总计量数量
+    //         const totalQuantity = this.selectedList.reduce((sum, item) => sum + item['measureQuantity'], 0);
+    //         // 验证取样总量不超过总计量数量,只有计量单位相同才进行验证
+    //         if (this.selectedList[0].measureUnit == unit || this.conditionType == 1) {
+    //           if (measureQ * safePortion > totalQuantity) {
+    //             this.$message.info('取样计量数量不能大于总计量数量');
+    //             return
+    //           }
+    //           // 验证每条数据的计量数量都大于等于取样计量数量
+    //           for (const item of this.selectedList) {
+    //             if (item['measureQuantity'] < measureQ) {
+    //               this.$message.info(`条目计量数量小于取样计量数量`);
+    //               return
+    //             }
+    //           }
+    //         } 
+
+    //         if (unit === 'KG') {
+    //           let totalMaxPossible = 0;
+    //           this.selectedList.map(item => {
+    //           const maxPossible = item['measureQuantity'] / measureQ;
+    //           totalMaxPossible += maxPossible;});
+    //           if (totalMaxPossible < safePortion) {
+    //             this.formData.portion = totalMaxPossible;
+    //             return this.$message.info(`最大取样条数为${totalMaxPossible}`);
+    //           }
+    //           // 计算总重量
+    //           let totalWeight = this.selectedList.reduce((sum, item) => sum + item['weight'], 0);
+    //           let weightUnit = this.selectedList[0].weightUnit;
+    //           if (weightUnit === 'G') {
+    //             totalWeight = totalWeight / 1000
+    //           }
+    //           if (measureQ * safePortion > totalWeight) {
+    //             this.$message.info('取样计量重量不能大于总计量重量');
+    //             return
+    //           }
+    //           for (const item of this.selectedList) {
+    //             let weight = weightUnit === 'G' ? item.weight / 1000 : item.weight
+    //             if (weight < measureQ) {
+    //               this.$message.info(`勾选条目重量小于取样重量`);
+    //               return
+    //             }
+    //           }
+    //         }
+
+    //         this.getNewFullSampleList(Math.ceil(safePortion), measureQ, unit);
+    //         //抽检计重整样
+    //       } else if (this.baseForm.inspectionStandards === 2 && this.conditionType == 1) {
+    //         for (const item of this.selectedList) {
+    //           if (item['measureQuantity'] < safePortion) {
+    //             this.$message.info(`所选的条目计量数量小于取样计量数量`);
+    //             return
+    //           }
+    //         }
+    //         let list = [];
+    //         for (let i = 0; i < this.selectedList.length; i++) {
+    //           list.push({
+    //             ...this.selectedList[i],
+    //             measureQuantity: safePortion, //作为计量数量
+    //           });
+    //         }
+    //         this.updatePackingList(list);
+    //       }
+    //       this.activeName = '2'
+    //     }
+    //   });
+    // },
+
+    //从来源数组取样到目标数组
+    async getNewFullSampleList(sampleCount, sampleQuantity, sampleUnit) {
+      const sourceArray = this.selectedList;
+      // 检查单位是否匹配
+      const isUnitMismatch = sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
+      // 创建副本并计算初始可取样数量
+      const items = sourceArray.map(item => ({
+        ...item,
+        remainingQuantity: isUnitMismatch ?  Infinity : item['measureQuantity'], // 剩余可取样数量
+        maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
+      }));
+
+      const result = [];
+      let remainingCount = sampleCount;
+
+      // 尽可能均匀地从各条目取样
+      while (remainingCount > 0) {
+        // 按剩余可取样比例排序
+        items.sort((a, b) => (b.remainingQuantity / b['measureQuantity']) - (a.remainingQuantity / a['measureQuantity']));
+
+        let distributed = false;
+
+        for (const item of items) {
+          if ((!isUnitMismatch && remainingCount > 0 ) || item.remainingQuantity >= sampleQuantity && remainingCount > 0) {
+            // 添加到结果数组
+            let sampleCode = await this.getSampleCode()
+            if (this.conditionType == 1 && this.baseForm.inspectionStandards == 1) {
+              result.push({ ...item,measureQuantity: 1, sampleCode});
+            } else if (this.conditionType == 2 && (this.baseForm.inspectionStandards == 1 || this.baseForm.inspectionStandards == 2)) {
+              let weight = (item.weight / item.maxPossible).toFixed(2); 
+              result.push({ ...item, measureQuantity: sampleQuantity, measureUnit: sampleUnit, sampleCode, weight})
+            }
+
+            // 更新剩余数量
+            if (!isUnitMismatch) {
+              item.remainingQuantity -= sampleQuantity;
+            }
+            remainingCount--;
+            distributed = true;
+          }
+        }
+
+        // 如果没有分配任何取样
+        if (!distributed) {
+          break;
+        }
+      }
+      this.sampleList = result;
+      this.baseForm.sampleNumber = this.sampleList.length;
+      this.changeSamUnit(sampleUnit)
+
+    },
+
     //抽样确认按钮事件-样品列表右上角确认按钮
     handleSampleSubmit() {
       this.$refs.ruleForm.validate((valid) => {
@@ -848,9 +1063,9 @@ export default {
           let measureQ = this.formData.number;
           let unit = this.formData.sampleUnit;
           let nums = Number(this.formData.portion);
-
+          
           console.log(measureQ, unit, nums, 'measureQ, unit, nums')
-          this.getNewSampleList(measureQ, unit, nums)
+          this.getNewFullSampleList(nums,measureQ, unit)
           // if (this.conditionType == 1) {
           //   this.sampleList = this.selectedList
           // } else {
@@ -865,51 +1080,46 @@ export default {
         }
       });
     },
+
+
     //更新计量数量、单位后重新生成样品列表数据
-    async getNewSampleList(measureQ, unit, nums) {
-      this.sampleList = [];
-      if (!this.selectedList || this.selectedList.length == 0) {
-        this.$message.warning('请先选择样品!');
-        return;
-      }
+    // async getNewSampleList(measureQ, unit, nums) {
+    //   this.sampleList = [];
+    //   if (!this.selectedList || this.selectedList.length == 0) {
+    //     this.$message.warning('请先选择样品!');
+    //     return;
+    //   }
 
-      if (!this.isCheck) {
-        let measureQuantity = 1;
-        if (this.conditionType == 2) {
-          measureQuantity = this.formData.number;
-        }
-        for (let i = 0; i < nums; i++) {
-          this.sampleList.push({
-            ...this.selectedList[0],
-            sampleCode: await this.getSampleCode(),
-            measureQuantity: measureQuantity,
-            measureUnit: unit,
-            weight: this.netWeight || 0
-          });
-        }
-      } else {
-        if (this.conditionType == 1) {
-          measureQ = 1;
-        }
-        for (let i = 0; i < this.selectedList.length; i++) {
-          this.sampleList.push({
-            ...this.selectedList[i],
-            sampleCode: await this.getSampleCode(),
-            measureQuantity: measureQ,
-            measureUnit: unit,
-            weight: this.netWeight || 0
-          });
-        }
+    //   if (!this.isCheck) {
+    //     let measureQuantity = 1;
+    //     if (this.conditionType == 2) {
+    //       measureQuantity = this.formData.number;
+    //     }
+    //     for (let i = 0; i < nums; i++) {
+    //       this.sampleList.push({
+    //         ...this.selectedList[0],
+    //         sampleCode: await this.getSampleCode(),
+    //         measureQuantity: measureQuantity,
+    //         measureUnit: unit,
+    //         weight: this.netWeight || 0
+    //       });
+    //     }
+    //   } else {
+    //     if (this.conditionType == 1) {
+    //       measureQ = 1;
+    //     }
+    //     for (let i = 0; i < this.selectedList.length; i++) {
+    //       this.sampleList.push({
+    //         ...this.selectedList[i],
+    //         sampleCode: await this.getSampleCode(),
+    //         measureQuantity: measureQ,
+    //         measureUnit: unit,
+    //         weight: this.netWeight || 0
+    //       });
+    //     }
 
-      }
-      // this.sampleList = this.selectedList.map(async oldItem => {
-      //   const newItem = JSON.parse(JSON.stringify(oldItem));
-      //   newItem.sampleCode = await this.getSampleCode();
-      //   newItem.measureQuantity = measureQ;
-      //   newItem.measureUnit = unit;
-      //   return newItem;
-      // });
-    },
+    //   }
+    // },
     //监听类型变化
     resetTable() {
       this.$nextTick(() => {
@@ -1046,7 +1256,124 @@ export default {
       } else {
         this.sampleList = [];
       }
+    },    
+
+    //确定按钮
+    handleExtractFull() {
+      this.$refs.ruleForm.validate(async (valid) => {
+        if (!valid || !this.validateSelection()) return;
+
+        this.sampleList = [];
+        const sampleCount = Number(this.formData.portion);
+        const measureQ = this.formData.number || 1;
+        const unit = this.formData.sampleUnit;
+
+        try {
+          if (this.isStandard1OrWeightSample()) {//抽检计量整样小样或者抽检计重小样
+            if (!this.validateMeasureQuantity(measureQ, unit, sampleCount)) return;
+            if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount)) return; // 若计量单位为重量,还需验证总重量是否足够
+
+            await this.getNewFullSampleList(Math.ceil(sampleCount), measureQ, unit);
+          } else if (this.isWeightStandardFullSample()) { //抽检取计重取整样
+            if (!this.validateSampleCount(sampleCount)) return;
+            await this.handleWeightFullSample(sampleCount);
+          }
+          this.activeName = '2';
+        } catch (error) {
+          console.error('取样处理失败:', error);
+          this.$message.error('取样处理失败');
+        }
+      });
     },
+  validateSelection() {
+    if (!this.selectedList?.length) {
+      this.$message.warning('请先选择样品!');
+      return false;
+    }
+    return true;
+  },
+  
+  isStandard1OrWeightSample() {
+    return (this.baseForm.inspectionStandards === 1) || 
+           (this.baseForm.inspectionStandards === 2 && this.conditionType == 2);
+  },
+  
+  isWeightStandardFullSample() {
+    return this.baseForm.inspectionStandards === 2 && this.conditionType == 1;
+  },
+  
+  validateMeasureQuantity(measureQ, unit, sampleCount) {
+    if (this.conditionType == 2 && measureQ <= 0) {
+      this.$message.info('取样计量数量必须大于0');
+      return false;
+    }
+    
+    const totalQuantity = this.selectedList.reduce((sum, item) => sum + item.measureQuantity, 0);
+    if ((this.selectedList[0].measureUnit === unit || this.conditionType == 1) && 
+        measureQ * sampleCount > totalQuantity) {
+      this.$message.info('取样计量数量不能大于总计量数量');
+      return false;
+    }
+    
+    const invalidItem = this.selectedList.find(item => item.measureQuantity < measureQ);
+    if (invalidItem) {
+      this.$message.info('条目计量数量小于取样计量数量');
+      return false;
+    }
+    
+    return true;
+  },
+  
+  validateWeight(measureQ, sampleCount) {
+    let totalMaxPossible = 0;
+    this.selectedList.forEach(item => {
+      totalMaxPossible += item.measureQuantity / measureQ;
+    });
+    
+    if (totalMaxPossible < sampleCount) {
+      this.formData.portion = totalMaxPossible;
+      this.$message.info(`最大取样条数为${totalMaxPossible}`);
+      return false;
+    }
+    
+    let totalWeight = this.selectedList.reduce((sum, item) => sum + item.weight, 0);
+    const weightUnit = this.selectedList[0].weightUnit;
+    if (weightUnit === 'G') totalWeight /= 1000;
+    
+    if (measureQ * sampleCount > totalWeight) {
+      this.$message.info('取样计量重量不能大于总计量重量');
+      return false;
+    }
+    
+    const invalidItem = this.selectedList.find(item => {
+      const weight = item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
+      return weight < measureQ;
+    });
+    
+    if (invalidItem) {
+      this.$message.info('勾选条目重量小于取样重量');
+      return false;
+    }
+    
+    return true;
+  },
+  
+  validateSampleCount(sampleCount) {
+    const invalidItem = this.selectedList.find(item => item.measureQuantity < sampleCount);
+    if (invalidItem) {
+      this.$message.info('所选的条目计量数量小于取样计量数量');
+      return false;
+    }
+    return true;
+  },
+  
+  async handleWeightFullSample(sampleCount) {
+    const list = this.selectedList.map(item => ({
+      ...item,
+      measureQuantity: sampleCount
+    }));
+    await this.updatePackingList(list);
+  }
   }
 };
 </script>

+ 226 - 0
src/views/inspectionPlan/components/equipmentDialog.vue

@@ -0,0 +1,226 @@
+<template>
+  <el-dialog
+    title="选择"
+    :visible.sync="equipmentdialog"
+    :before-close="handleClose"
+    :close-on-click-modal="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="60%"
+    @onDone="onDone"
+  >
+    <div>
+      <el-row>
+        <el-col :span="24" class="topsearch">
+          <el-form>
+            <el-row>
+              <el-col :span="6">
+                <el-input
+                  v-model="code"
+                  placeholder="请输入编码"
+                  size="small"
+                ></el-input>
+              </el-col>
+              <el-col :span="6" style="margin-left: 10px">
+                <el-button type="primary" size="small" @click="reload"
+                  >搜索</el-button
+                >
+                <el-button size="small" @click="reset">重置</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="6" class="tree_col">
+          <AssetTree
+            @handleNodeClick="handleNodeClick"
+            :treeIds="treeIds"
+            :paramsType="'type'"
+            ref="treeList"
+          />
+        </el-col>
+        <el-col :span="18" class="table_col" v-if="equipmentdialog">
+          <ele-pro-table
+            ref="equiTable"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            :current.sync="current"
+            highlight-current-row
+            cache-key="systemRoleTable3"
+            row-key="id"
+            height="50vh"
+          >
+          </ele-pro-table>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import AssetTree from '@/components/AssetTree/index.vue';
+  import { getList } from '@/api/classifyManage';
+  export default {
+    components: {
+      AssetTree
+    },
+    props: {
+      selectList: Array,
+      type: {
+        default: 2 //1多选 2单选
+      },
+      isAll: {
+        default: false
+      },
+      treeIds: {
+        default: () => {
+          return ['9'];
+        }
+      }
+    },
+    data() {
+      return {
+        equipmentdialog: false,
+        current: null,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true,
+            show: this.type == 1
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          }
+        ],
+        tableList: [],
+        categoryLevelId: null,
+        code: null,
+        selection: [],
+        ids: []
+      };
+    },
+
+    watch: {},
+    methods: {
+      async datasource({ page, limit }) {
+        const params = {
+          code: this.code,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId,
+          isProduct: true
+        };
+        const data = await getList(params);
+        this.tableList = data.list;
+        return data;
+      },
+      open(ids) {
+        this.equipmentdialog = true;
+        if (ids) {
+          this.ids = ids;
+        }
+      },
+      handleNodeClick(data) {
+        this.categoryLevelId = data.id;
+        this.reload();
+      },
+      reload() {
+        this.$refs.equiTable.reload();
+      },
+      handleClose() {
+        this.equipmentdialog = false;
+        this.code = '';
+        this.$refs.equiTable.clearSelection();
+      },
+      reset() {
+        this.code = null;
+        this.reload();
+      },
+      onDone() {
+        this.$nextTick(() => {
+          this.$refs.equiTable.setSelectedRowKeys(this.ids);
+        });
+      },
+      // 选择
+      selected() {
+        this.$emit('choose', this.current);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    max-height: 530px;
+    overflow: auto;
+  }
+  .table_col {
+    padding-left: 10px;
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 467 - 0
src/views/inspectionPlan/components/stokledger.vue

@@ -0,0 +1,467 @@
+<template>
+  <ele-modal :visible.sync="visible" title="物品信息" width="80%" :close-on-click-modal="true"
+    :close-on-press-escape="false"  :maxable="true"
+    append-to-body>
+    <el-form :model="searchForm" label-width="100px">
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-form-item label="列表维度:" prop="dimension">
+            <template>
+              <el-select style="width: 100%" @change="changeDimensionHandler" v-model="dimension" placeholder="请选择">
+                <!-- <el-option label="物料维度" value="4"> </el-option> -->
+                <el-option label="包装维度" value="3"> </el-option>
+                <el-option label="批次维度" value="2"> </el-option>
+                <el-option label="物品维度" value="1"> </el-option>
+              </el-select>
+            </template>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物品编码:">
+            <el-input type="text" placeholder="搜索物品编码" v-model="searchForm.categoryCode"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物品名称:">
+            <el-input type="text" placeholder="搜索物品名称" v-model="searchForm.categoryName"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="批次号:">
+            <el-input type="text" placeholder="搜索批次号" v-model="searchForm.batchNo"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="刻码">
+            <el-input type="text" placeholder="搜索物品刻码" v-model="searchForm.engrave"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物料代号">
+            <el-input type="text" placeholder="搜索物料代号" v-model="searchForm.materielDesignation"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="发货码">
+            <el-input type="text" placeholder="搜索发货码" v-model="searchForm.barcodes"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="牌号">
+            <el-input type="text" placeholder="搜索牌号" v-model="searchForm.brandNum"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="仓库">
+            <el-select clearable style="width: 100%" v-model="searchForm.warehouseId" placeholder="请选择">
+              <el-option v-for="item in warehouseList" :label="item.name" :value="item.id" :key="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="所属工厂" prop="factoryId">
+            <el-select filterable placeholder="请选择" v-model="searchForm.factoryId" clearable class="w100">
+              <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col>
+          <div style="float: right">
+            <el-button type="primary" @click="doSearch">搜索</el-button>
+            <el-button icon="el-icon-refresh-left" @click="reset">重置</el-button>
+          </div>
+        </el-col>
+      </el-row>
+    </el-form>
+    <el-container class="assets-dialog">
+      <el-aside width="200px" class="wrapper-assets">
+        <AssetTree ref="treeList" :treeIds="treeIds" @handleNodeClick="handleNodeClick" />
+      </el-aside>
+      <el-main>
+        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" height="50vh" border row-key="id"
+          style="width: 100%" :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+          @selection-change="handleSelectionChange" :header-cell-class-name="hideHeaderCheckbox">
+          <el-table-column  type="selection":reserve-selection="true" width="55" align="center"
+            fixed="left" :selectable="(row) => dimension != 3 ?  true : checkSelectable(row)">
+          </el-table-column>
+          <el-table-column label="序号" type="index" width="50" fixed="left">
+          </el-table-column>
+          <el-table-column v-if="dimension != 4" label="抽取数量" type="index" width="100">
+            <template slot-scope="{ row }">
+              <el-input type="text" placeholder="请输入" v-model="row.outboundNum" @input="handleInput(row, $event)"
+                :disabled="dimension == '3'"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="categoryCode" label="物品编码" min-width="120" fixed="left"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="categoryName" width="200" label="物品名称" fixed="left"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="brandNum" label="牌号" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="categoryModel" label="型号" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="specification" label="规格" :show-overflow-tooltip="true"></el-table-column>
+          <template v-if="dimension == 1">
+            <el-table-column v-for="(item, index) in newColumns" :label="item.label" :align="item.align"
+              :prop="item.prop" :show-overflow-tooltip="item.showOverflowTooltip"></el-table-column>
+          </template>
+          <el-table-column v-else prop="batchNo" label="批次号" key="batchNo" min-width="80"></el-table-column>
+          <el-table-column prop="level" label="级别"></el-table-column>
+          <el-table-column prop="measureQuantity" label="计量数量" width="120"></el-table-column>
+          <el-table-column prop="measureUnit" label="计量单位" width="90"></el-table-column>
+          <el-table-column prop="weight" label="重量" min-width="120"></el-table-column>
+          <el-table-column prop="weightUnit" label="重量单位" min-width="120"></el-table-column>
+          <el-table-column v-if="dimension == 3" prop="packageNo" label="包装编码" min-width="120"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column v-if="dimension == 3" prop="packingQuantity" label="包装数量" min-width="120"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column v-if="dimension == 3" prop="packingUnit" label="包装单位" min-width="120"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column v-if="dimension == 3 || dimension == 4" label="发货条码" prop="barcodes" width="80"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column v-if="dimension == 4" prop="no" label="物料编码" min-width="120"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column v-if="dimension == 3 || dimension == 4" prop="materielDesignation" label="物料代号"
+            min-width="100"></el-table-column>
+          <el-table-column v-if="dimension == 3 || dimension == 4" prop="clientCode" label="客户代号"
+            min-width="100"></el-table-column>
+          <el-table-column v-if="dimension == 3 || dimension == 4" prop="engrave" label="刻码"
+            min-width="120"></el-table-column>
+          <el-table-column v-if="dimension == 3 || dimension == 4" prop="warehouseName" label="仓库" min-width="200"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="supplierName" label="供应商" min-width="200"
+            :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="supplierCode" label="供应商代号" min-width="200"
+            :show-overflow-tooltip="true"></el-table-column>
+        </el-table>
+        <div style="text-align: right; padding: 10px">
+          <el-pagination background layout="total, sizes, prev, pager, next, jumper" :total="total"
+            :page-sizes="[5, 10, 20, 50]" :page-size.sync="searchForm.size" :current-page.sync="searchForm.pageNum"
+            @current-change="handleCurrentChange" @size-change="handleSizeChange">
+          </el-pagination>
+        </div>
+      </el-main>
+    </el-container>
+
+    <div slot="footer">
+      <el-button type="primary" @click="confirm">确定</el-button>
+      <el-button @click="cancel">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+import storageApi from '@/api/warehouseManagement';
+import AssetTree from './assetTree.vue';
+import { getWarehouseList } from '@/api/classifyManage/itemInformation';
+export default {
+  components: { AssetTree },
+  props: {
+    treeIds: { type: Array, default: () => [] }
+  },
+  data() {
+    return {
+      factoryList: [],
+      newColumns: [], // 动态表头
+      isShowTable: true,
+      qualityResultOption: [
+        {
+          value: 0,
+          label: '合格'
+        },
+        {
+          value: 1,
+          label: '不合格'
+        }
+      ],
+      qualityStatusOption: [
+        {
+          value: 1,
+          label: '已质检'
+        },
+        {
+          value: 0,
+          label: '未质检'
+        }
+      ],
+      visible: false,
+      tableData: [],
+      total: 0,
+      categoryLevelId: '',
+      searchForm: {
+        categoryCode: '',
+        categoryName: '',
+        batchNo: '',
+        factoryId: '',
+        brandNum: '',
+        engrave: '',
+        barcodes: '',
+        categoryLevelId: '',
+        warehouseId: '',
+        pageNum: 1,
+        size: 20
+      },
+      selectionList: [],
+      materialType: '',
+      warehouseList: [],
+      dimension: '1',
+      productLists: []
+    };
+  },
+  created() {
+    this.getFieldModel();
+    this.getWarehouse();
+    this.getFactoryList();
+  },
+  watch: {
+    tableData(val) {
+      this.doLayout();
+    }
+  },
+  methods: {
+    //获取工厂列表
+    async getFactoryList() {
+      const res = await warehouseDefinition.getFactoryarea({
+        pageNum: 1,
+        size: 9999,
+        type: 1
+      });
+      this.factoryList = res.list;
+    },
+    async getWarehouse() {
+      const { data } = await getWarehouseList();
+      this.warehouseList = data;
+    },
+    doLayout() {
+      let that = this;
+      this.$nextTick(() => {
+        that.$refs.multipleTable.doLayout();
+      });
+    },
+    // 获取动态表头
+    getFieldModel() {
+      storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
+        let newRes = res.map((m) => {
+          return {
+            prop: 'extField.' + m.prop,
+            label: m.label,
+            align: 'center',
+            showOverflowTooltip: true
+          };
+        });
+        this.newColumns = [...newRes];
+      });
+    },
+    getRowKeys(row) {
+      return row.id;
+    },
+    // 出库数量限制
+    handleInput(row, value) {
+      if (row.outboundNum <= row.measureQuantity) {
+        // return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
+
+        // 过滤掉非数字和小数点的字符
+        const filteredValue = value.replace(/[^0-9.]/g, '');
+        // 限制只能有一个小数点
+        const singleDotValue = filteredValue.replace(/(\..*)\./g, '$1');
+
+        let finalValue = '';
+        const dotIndex = singleDotValue.indexOf('.');
+        if (dotIndex !== -1) {
+          // 截取小数点后最多两位
+          finalValue = singleDotValue.slice(0, dotIndex + 3);
+        } else {
+          finalValue = singleDotValue;
+        }
+        return row.outboundNum = finalValue;
+      } else {
+        row.outboundNum = row.measureQuantity;
+      }
+    },
+    // 切换维度
+    changeDimensionHandler(e) {
+      this.searchForm.pageNum = 1;
+      this.selectionList = [];
+      this.$refs.multipleTable.clearSelection();
+      this.changeDimension(e);
+    },
+    async changeDimension(e) {
+      this.dimension = e;
+      if (this.dimension == 1) {
+        // 物品维度
+        const data = await storageApi.getProductList(this.searchForm);
+        this.tableData = data.list;
+        this.total = data.count;
+      } else if (this.dimension == 2) {
+        // 批次维度
+        const data = await storageApi.getBatchList(this.searchForm);
+        for (let i = 0; i < data.list.length; i++) {
+          data.list[i].outboundNum = data.list[i].measureQuantity;
+        }
+        this.tableData = data.list;
+        this.total = data.count;
+      } else if (this.dimension == 4) {
+        // 物料维度
+        const data = await storageApi.getMaterialList(this.searchForm);
+        this.tableData = data.list;
+        this.total = data.count;
+      } else {
+        // 包装维度
+        const data = await storageApi.getPackingList(this.searchForm);
+        for (let i = 0; i < data.list.length; i++) {
+          data.list[i].outboundNum = data.list[i].packingQuantity;
+        }
+        this.tableData = data.list;
+        this.total = data.count;
+      }
+      console.log(this.tableData);
+      this.updateProductOutboundNums(this.tableData)
+    },
+    updateProductOutboundNums(list) {
+      console.log(this.productLists, 'this.productLists')
+
+      if (this.dimension == 1) {
+        //物品层
+        for (let i = 0; i < list.length; i++) {
+          const item = list[i];
+          const matchedProduct = this.productLists.find(product => {
+            const isMatch = product.categoryId === item.categoryId;
+            return isMatch;
+          });
+
+          if (matchedProduct) {
+            this.$set(item, 'outboundNum', matchedProduct.measureQuantity);
+          } else {
+            console.warn('No match for item.id:', item.id);
+          }
+        }
+
+      } else {
+        for (let i = 0; i < list.length; i++) {
+          const item = list[i];
+          const matchedProduct = this.productLists.find(product => {
+            const isMatch = product.id === item.id;
+            return isMatch;
+          });
+
+          if (matchedProduct) {
+            this.$set(item, 'outboundNum', matchedProduct.measureQuantity);
+          } else {
+            console.warn('No match for item.id:', item.id);
+          }
+        }
+      }
+
+    },
+    open(val) {
+      this.productLists = val || [];
+      this.visible = true;
+      this.$nextTick(() => {
+        this.$refs.treeList.getTreeData().then((data) => {
+          this.handleNodeClick(data);
+        });
+      });
+    },
+    async confirm() {
+      if (!this.selectionList.length) {
+        this.$message.error('请至少选择一条数据!');
+        return;
+      }
+      if (this.dimension == 1) {
+        let boolen = this.selectionList.every((item) => item.outboundNum > 0);
+        if (!boolen) {
+          this.$message.error('请输入抽取数量!');
+          return;
+        }
+      }
+      
+      this.$emit('choose', this.selectionList, this.dimension);
+      this.cancel();
+    },
+    cancel() {
+      this.selectionList = [];
+      this.$refs.multipleTable.clearSelection();
+      this.visible = false;
+    },
+    handleSelectionChange(selection) {
+      if (this.dimension != 3 && selection.length > 1) {
+        // 单选模式下,如果选了多个,只保留最后一个
+        const lastSelected = selection[selection.length - 1];
+        this.$refs.multipleTable.clearSelection(); // 清空所有选中
+        this.$nextTick(() => {
+          this.$refs.multipleTable.toggleRowSelection(lastSelected, true); // 重新选中最后一个
+        });
+        this.selectionList = [lastSelected];
+      } else {
+        this.selectionList = selection;
+      }
+    },
+    handleNodeClick(data) {
+      console.log(data);
+      this.categoryLevelId = data.id;
+      this.searchForm.categoryLevelId = data.id;
+      this.doSearch();
+    },
+    handleCurrentChange() {
+      this.changeDimension(this.dimension);
+    },
+    reset() {
+      this.searchForm = {
+        categoryCode: '',
+        categoryName: '',
+        batchNo: '',
+        brandNum: '',
+        engrave: '',
+        barcodes: '',
+        warehouseId: '',
+        factoryId: '',
+        categoryLevelId: this.categoryLevelId,
+        pageNum: 1,
+        size: 20
+      };
+      this.doSearch();
+    },
+    doSearch() {
+      this.searchForm.pageNum = 1;
+      this.changeDimension(this.dimension);
+    },
+    handleSizeChange() {
+      this.searchForm.pageNum = 1;
+      this.changeDimension(this.dimension, 'page');
+    },
+
+    checkSelectable(row, index) {
+        if (this.selectionList.length < 1) return true
+        let code = this.selectionList[0].categoryCode
+        return row.categoryCode === code
+    },
+
+    hideHeaderCheckbox({ column }) {
+      if (column.type === "selection") {
+        return "hide-header-checkbox";
+      }
+      return "";
+    },
+  }
+};
+</script>
+
+<style lang="scss" >
+.el-dialog__wrapper {
+  ::v-deep .el-aside {
+    background-color: #fff !important;
+    border: 1px solid #ccc;
+  }
+}
+
+.wrapper-assets {
+  max-height: 53vh;
+  overflow: auto;
+}
+
+/* 隐藏表头的全选复选框 */
+.hide-header-checkbox .el-checkbox {
+  display: none !important;
+}
+</style>

+ 1 - 1
src/views/inspectionPlan/index.vue

@@ -7,7 +7,7 @@
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
           <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')">
-            添加
+            新增
           </el-button>
         </template>
         <template v-slot:code="{ row }">

+ 2 - 0
src/views/inspectionTemplate/AddorUpdate.vue

@@ -168,6 +168,8 @@
             </el-popconfirm>
           </template>
         </ele-pro-table>
+
+        
       </el-row>
     </el-form>
     <span slot="footer" class="dialog-footer">

+ 2 - 2
src/views/inspectionTemplate/components/inspectionTemplateDialog.vue

@@ -22,10 +22,10 @@
         {{ row.status ? '启用' : '停用' }}
       </template>
     </ele-pro-table>
-    <div class="btns">
+    <template v-slot:footer>
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
-    </div>
+    </template>
   </el-dialog>
 </template>
 

+ 36 - 2
src/views/inspectionTemplate/index.vue

@@ -39,6 +39,24 @@
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="updateStatus(row)"
+            v-if="row.status == 1"
+          >
+            不启用
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="updateStatus(row)"
+            v-if="row.status == 0"
+          >
+            启用
+          </el-link>
           <el-link
             type="primary"
             :underline="false"
@@ -72,7 +90,7 @@
 <script>
   import AddOrUpdate from './AddorUpdate';
   import search from './components/search.vue';
-  import { getList, removeItem } from '@/api/inspectionTemplate';
+  import { getList, removeItem, update } from '@/api/inspectionTemplate';
   export default {
     components: {
       AddOrUpdate,
@@ -130,7 +148,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 150,
+            width: 200,
             align: 'center',
             resizable: false,
             slot: 'action',
@@ -188,6 +206,22 @@
           where: where,
           page: 1
         });
+      },
+      //上下架操作
+      updateStatus(row) {
+        let dataForm = {};
+        let status = row.status === 1 ? 0 : 1;
+        dataForm['status'] = status;
+        dataForm['id'] = row.id;
+        update(dataForm).then((res) => {
+          this.loading = false;
+          this.$message.success('操作成功!');
+          this.visible = false;
+          this.getDataList();
+        })
+        .catch((e) => {
+          this.loading = false;
+        });
       }
     }
   };

+ 15 - 16
src/views/inspectionWork/components/QualityContentTabs.vue

@@ -29,7 +29,7 @@
                 <el-col :span="6" v-if="conditionType == 2">
                   <el-form-item prop="number" label-width="0" style="margin-bottom: 0;" >
                     <el-input v-model="formData.number" placeholder="请输入" size="mini"
-                      @change="handleInputNumber"></el-input>
+                     ></el-input>
                   </el-form-item>
                 </el-col>
                 <el-col :span="6" v-if="conditionType == 2">
@@ -41,19 +41,19 @@
                 </el-col>
                 <el-col :span="8" v-if=" conditionType == 2">
                   <el-form-item prop="portion" label="数量" style="margin: 0;">
-                    <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"></el-input>
+                    <el-input v-model="formData.portion" placeholder="请输入" size="mini" ></el-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="20" v-if="form.isUnpack == 2 && conditionType == 1">
+                <el-col :span="20" v-if="conditionType == 1">
                   <el-form-item prop="portion" label="数量" style="margin: 0;">
-                    <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"></el-input>
+                    <el-input v-model="formData.portion" placeholder="请输入" size="mini"></el-input>
                   </el-form-item>
                 </el-col>
                 <el-col :span="4" style="text-align: right;" v-if=" conditionType == 2">
                   <el-button type="primary" size="mini" @click="handleSampleSubmit"
                     style="margin-right: 12px;">确认</el-button>
                 </el-col>
-                <el-col :span="4" style="text-align: right;" v-if="form.isUnpack == 2 && conditionType == 1">
+                <el-col :span="4" style="text-align: right;" v-if="conditionType == 1">
                   <el-button type="primary" size="mini" @click="handleSampleSubmit"
                     style="margin-right: 12px;">确认</el-button>
                 </el-col>
@@ -406,7 +406,6 @@ export default {
       this.$refs.sourceTable.clearSelection();
     },
     handleSelectionChange(selection) {
-      debugger
       if (this.form.conditionType == 2){
         if (this.form.isUnpack == 2){
           this.$set(this.form, 'sampleNumber', this.formData.portion);
@@ -429,25 +428,25 @@ export default {
     },
 
     handleSampleNumber(val) {
-      debugger
       console.log('取样方式选择',this.form.isUnpack)
       console.log(val, 'val')
       this.conditionType = val;
+      this.form.sampleUnit = ''
       this.$emit('getConditionType', val)
-
+   
       //取整样
-      let data = this.$refs.sourceTable.getData()
+      // let data = this.$refs.sourceTable.getData()
       // this.$emit('getSelectedList')
       // if (this.selectedList.length == 0) {
       //   this.$message.warning('请先选择样品!');
       // }
-      if (val == 1) {
-        // this.activeName = '2'
-        this.$emit('handleSample1', val, data)
-      } else if (val == 2) {
-        this.tableSelClear();
-        this.$emit('handleSample1', val, data)
-      }
+      // if (val == 1) {
+      //   // this.activeName = '2'
+      //   this.$emit('handleSample1', val, data)
+      // } else if (val == 2) {
+      //   this.tableSelClear();
+      //   this.$emit('handleSample1', val, data)
+      // }
     },
     handleInputNumber(val) {
       let packingList = this.$refs.sourceTable.getData()

+ 13 - 2
src/views/inspectionWork/components/baseInfo.vue

@@ -128,7 +128,7 @@
           <el-form-item label="检验标准" prop="inspectionStandards">
             <!-- 计量 计重 -->
             <el-select style="width: 100%" v-model="form.inspectionStandards" placeholder="请选择"
-              :disabled="parseInt(qualityType1) == 1">
+              :disabled="parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3">
               <el-option v-for="item in inspectionStandardsList" :label="item.label" :value="item.value"
                 :key="item.value">
               </el-option>
@@ -139,7 +139,7 @@
           <el-form-item label="检验方式:" prop="qualityMode">
             <!-- <DictSelection dictName="取样类型" v-model="form.qualityMode" :disabled="qualityType == 1"></DictSelection> -->
             <el-select style="width: 100%" v-model="form.qualityMode" placeholder="请选择"
-              :disabled="parseInt(qualityType1) == 1">
+              :disabled="parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3">
               <el-option v-for="item in qualityModeList" :label="item.label" :value="item.value" :key="item.value">
               </el-option>
             </el-select>
@@ -257,6 +257,17 @@ export default {
       },
       immediate: false
     },
+    'form.inspectionStandards': {
+      handler(newVal) {
+        if (newVal) {
+          this.$emit('changeInspectionStandardsModel', newVal);
+        } else {
+          console.log('清空样品清单');
+          // this.$emit('table2');
+        }
+     },
+     immediate: false
+    }
   },
   data() {
     return {

+ 22 - 7
src/views/inspectionWork/components/sampleListDialog.vue

@@ -18,6 +18,15 @@
                             <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
                             <el-table-column label="工艺参数" prop="defaultValue" align="center">
                             </el-table-column>
+                            <!-- <el-table-column label="质检工具" prop="" align="center">
+                                <template slot-scope="scope">
+                                    <toolButtom
+                                    v-model="scope.row.toolList"
+                                    :type="'view'"
+                                    :sList="sList"
+                                    />
+                                </template>
+                            </el-table-column> -->
                             <el-table-column label="质检内容" prop="qualityResultContent" align="center" fixed="right"
                                 width="360">
                                 <template slot-scope="scope">
@@ -64,10 +73,10 @@
 </template>
 
 <script>
-
+import toolButtom from './toolButtom.vue';
 export default {
     components: {
-
+        toolButtom
     },
     data() {
 
@@ -129,7 +138,8 @@ export default {
                     value: 3,
                     label: '让步接收'
                 },
-            ]
+            ],
+            sList:[],//质检工具筛选
         };
     },
     computed: {
@@ -137,12 +147,12 @@ export default {
 
     created() { },
     methods: {
-        async openDia(index, row, type, list, isStatus) {
+        async openDia(index, row, type, list, isStatus, sList) {
             this.tableData = [];
             this.rowIndex = index
             this.type = type;
             console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk', list[0].qualityResults);
-
+            debugger
             //如果质检项qualitySampleTemplateList只有一条数据且质检结果是让步接收
             if (list[0].qualitySampleTemplateList.length == 1) {
                 for (let i = 0; i < list[0].qualitySampleTemplateList.length; i++) {
@@ -153,8 +163,8 @@ export default {
 
 
             this.tableData = list;
-
-            this.visible = true;
+            this.visible = true
+            this.sList = sList;
         },
         handleClose() {
             this.visible = false;
@@ -166,6 +176,11 @@ export default {
         handleDispose(index, row, type) {
             this.$emit('handleDispose', index, row, type);
         },
+
+        //选择质检工具
+        openToolList(index, row) {
+            this.$emit('openToolList', index, row);
+        },
     }
 };
 </script>

+ 82 - 0
src/views/inspectionWork/components/toolButtom.vue

@@ -0,0 +1,82 @@
+<template>
+  <div>
+    <el-badge :value="value.length" class="item">
+      <el-button
+        icon="el-icon-plus"
+        v-if="type != 'view'"
+        type="primary"
+        @click="handleUpload"
+      >
+        选择</el-button
+      >
+      <el-button
+        icon="el-icon-view"
+        v-else
+        type="primary"
+        @click="handleUpload"
+      >
+        查看</el-button
+      >
+    </el-badge>
+
+    <ToolList @success="getFiles" ref="toolListRef"></ToolList>
+  </div>
+</template>
+
+<script>
+  import ToolList from './toolList.vue';
+
+  export default {
+    name: 'index',
+    components: { ToolList },
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      type: {
+        type: String,
+        default: ''
+      },
+      value: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
+      
+      sList:{
+        type: Array,
+        default: () => {
+          return []
+        }
+      }
+    },
+    data() {
+      return {
+        selectVal: ''
+      };
+    },
+    watch: {
+      value: {
+        handler(newVal) {
+          console.log(newVal, '=======');
+          this.selectVal = newVal || [];
+        },
+        immediate: true
+      }
+    },
+    created() {},
+    methods: {
+      handleUpload() {
+        console.log(this.sList, '选择质检工具列表======');
+        this.$refs.toolListRef.open(this.selectVal, this.type, this.sList);
+      },
+      getFiles(val = []) {
+        this.$emit('updateVal', val);
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 152 - 0
src/views/inspectionWork/components/toolList.vue

@@ -0,0 +1,152 @@
+<template>
+<ele-modal
+    width="80%"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    :maxable="true"
+    :resizable="true"
+    >
+
+    <div class="ele-body" style="height:60vh;overflow: auto;">
+    <el-card shadow="never" v-loading="loading">
+      <ele-split-layout
+        width="210px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+          <div class="ele-border-lighter sys-organization-list">
+            <el-tree
+              ref="tree"
+              :data="data"
+              highlight-current
+              :draggable="true"
+              node-key="id"
+              :expand-on-click-node="false"
+              :default-expand-all="true"
+              @node-click="onNodeClick"
+            >
+            </el-tree>
+          </div>
+        <template v-slot:content>
+            <ele-pro-table
+                ref="table"
+                :columns="columns"
+                :datasource="datasource"
+                tool-class="ele-toolbar-form"
+                :needPage="false"
+                row-key="id"
+                :selection.sync="selection"
+                :toolbar="false"
+                >
+            </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+  </div>
+      <template v-slot:footer>
+        <el-button @click="fileShow = false">取消</el-button>
+        <el-button type="primary" @click="addTemplate"> 确认 </el-button>
+      </template>
+    </ele-modal>
+    </template>
+
+<script>
+export default {
+    data() {
+        return {
+            loading: false,
+
+            visible: false,
+            datasource:[],
+            columns:[
+                {
+                    width: 45,
+                    type: 'selection',
+                    columnKey: 'selection',
+                    align: 'center'
+                },
+                {
+                    columnKey: 'index',
+                    type: 'index',
+                    width: 50,
+                    align: 'center',
+                    label: '序号',
+                    showOverflowTooltip: true,
+                    fixed: 'left'
+                },
+                {
+                    prop: 'categoryCode',
+                    label: '物品编码',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    slot: 'categoryName',
+                    prop: 'categoryName',
+                    label: '物品名称',
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    minWidth: 200
+                },
+                {
+                    prop: 'brandNum',
+                    label: '牌号',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'categoryModel',
+                    label: '型号',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'specification',
+                    label: '规格',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'measureQuantity',
+                    label: '计量数量',
+                    sortable: 'custom',
+                    showOverflowTooltip: true,
+                    width: 130,
+                    align: 'center'
+                },
+                {
+                    prop: 'measureUnit',
+                    label: '计量单位',
+                    align: 'center'
+                },
+                {
+                    prop: 'weight',
+                    label: '重量',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'weightUnit',
+                    label: '重量单位',
+                    showOverflowTooltip: true
+                },
+            ],
+            data: [],
+
+        }
+    },
+    methods: {
+        open(val, type, sList) {
+            debugger;
+            this.visible = true;
+            this.type = type;
+            this.sList = sList;
+        },
+        onNodeClick() {
+
+        }
+    },
+}
+</script>

+ 210 - 29
src/views/inspectionWork/edit.vue

@@ -7,7 +7,7 @@
         <el-button type="primary" @click="handleReporting" :loading="loading" v-if="type != 'detail'">报工完成</el-button>
       </header-title>
       <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type" :qualityType1="qualityType"
-        @changeModel="changeModel" @changeNumber="changeNumber"></base-info>
+        @changeModel="changeModel" @changeNumber="changeNumber" @changeInspectionStandardsModel="changeInspectionStandardsModel"></base-info>
 
       <quality-content-tabs ref="tabsRef" :type="type" :ids="this.$route.query.id" :sample-list="sampleList" :activeName="activeName"
         :scheme-list="schemeList" :loading="loading" :form="form" @handleSelectionChange="handleSelectionChange1"
@@ -130,19 +130,17 @@ export default {
   methods: {
     //切换检验方式
     changeModel(val, flag) {
-      debugger
-
       this.$refs.tabsRef.tableSelClear()
       this.sampleList = [];
       this.$refs.tabsRef.tabsChange('1')
       this.$refs.tabsRef.tabsConditionType(null)
 
       this.form.qualityMode = val;
+      const sData = this.$refs.tabsRef.$refs.sourceTable.getData()
       //检验方式 全检
       if (this.form.qualityMode == 1) {
         this.activeName = '2';
         this.form.sampleNumber = ''
-        const sData = this.$refs.tabsRef.$refs.sourceTable.getData()
         if (sData.length == 0) {
           for (let i = 0; i < sData.length; i++) {
             this.$set(sData[i], 'qualityStatus', 2)
@@ -300,8 +298,6 @@ export default {
     },
     //来源清单勾选事件
     handleSelectionChange1(selection) {
-debugger
-
       if (this.form.qualityMode === 2) {
         this.selectedList = selection;
         this.activeName = "1";
@@ -393,7 +389,6 @@ debugger
       this.$set(this.form, 'sampleMeasureUnit', val)
     },
     async handleSample1(val, data) {
-      debugger
       this.sampleList = []
       if (this.selectedList == undefined || this.selectedList.length == 0) {
         this.activeName = "1";
@@ -458,34 +453,40 @@ debugger
 
       }
     },
-    handleSampleSubmit(data) {
+    async handleSampleSubmit(data) {
       console.log(data, 'data123确认')
-debugger
-      // if (data.conditionType == 1) {
-      //   this.sampleList = this.selectedList
-      // } else {
-      //   let measureQ = data.measureQ;
-      //   let unit = data.sampleUnit;
-      //   let nums = Number(data.portion);
-      //   console.log(measureQ, '计量数量')
-      //   console.log(unit, '所选单位')
-      //   console.log(nums, '数量')
-      //   this.getNewSampleList(measureQ, unit, nums)
-      // }
-      let measureQ = data.measureQ;
-      let unit = data.sampleUnit;
-      let nums = Number(data.portion);
+      this.sampleList = []
+      if (!this.selectedList || this.selectedList.length == 0) {
+        this.$message.warning('请先选择样品!');
+        return;
+      }
+      const measureQ = data.measureQ || 1;
+      const unit = data.sampleUnit;
+      const sampleCount = Number(data.portion);
       console.log(measureQ, '计量数量')
       console.log(unit, '所选单位')
-      console.log(nums, '数量')
-      this.getNewSampleList(measureQ, unit, nums)
+      console.log(sampleCount, '数量')
+      try {
+          if (this.isStandard1OrWeightSample()) {//抽检计量整样小样或者抽检计重小样
+            if (!this.validateMeasureQuantity(measureQ, unit, sampleCount)) return; //取样数量验证
+            if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount)) return; // 若计量单位为重量,还需验证总重量是否足够
+
+            await this.getNewFullSampleList(Math.ceil(sampleCount), measureQ, unit);
+          } else if (this.isWeightStandardFullSample()) { //抽检取计重取整样
+            if (!this.validateSampleCount(sampleCount)) return;
+            await this.handleWeightFullSample(sampleCount);
+          }
+          this.activeName = '2';
+        } catch (error) {
+          console.error('取样处理失败:', error);
+          this.$message.error('取样处理失败');
+        }
     },
     //获取样品编码
     async getSampleCode() {
       return await getCode('sample_code');
     },
     async getNewSampleList(measureQ, unit, nums) {
-      debugger
       this.sampleList = [];
 
       console.log(this.selectedList, 'this.selectedList')
@@ -566,6 +567,7 @@ debugger
     },
 
     async queryQualitySamplContent() {
+      debugger
       const res = await queryQualitySamplContent({ qualityWorkerId: this.$route.query.id })
       let addStatus = res.list.map((item) => {
         item.isValid = true;
@@ -653,12 +655,12 @@ debugger
       }
       const selectedData = [];
       selectedData.push(this.sampleList[index])
-
-      this.$refs.detailRef.openDia(index, row, type, selectedData, null);
+      this.$refs.detailRef.openDia(index, row, type, selectedData, null, this.schemeList.toolList);
     },
     inputWeight(row, index) {
       console.log(row, index, '输入重量')
 
+      // 计算所有样本的总重量
       const pNum = this.sampleList.reduce((sum, item) => {
         return sum + Number(item.weight || 0);
       }, 0);
@@ -812,12 +814,191 @@ debugger
     },
     // 批量质检
     batchQuality(index, row, type) {
-      this.$refs.detailRef.openDia(null, null, 'report', this.sampleList, null)
+      debugger
+      this.$refs.detailRef.openDia(null, null, 'report', this.sampleList, null, this.schemeList.toolList)
     },
     // 批量处置
     batchDispose() {
       this.$refs.disposeRef.openDispose(null, null, 'dispose', this.qualityType);
     },
+
+    //全检,检验标准改变时,重新获取样品列表
+    async changeInspectionStandardsModel(val) {
+      const sData = this.$refs.tabsRef.$refs.sourceTable.getData()
+      if (sData.length > 0) {
+          for (let i = 0; i < sData.length; i++) {
+            this.$set(sData[i], 'qualityStatus', 2)
+          }
+        }
+        this.form.inspectionStandards = val;
+        this.form.sampleNumber = ''
+        this.$refs.tabsRef.tableSelClear()
+        this.sampleList = [];
+        this.$refs.tabsRef.tabsChange('1')
+        debugger
+      //检验标准 2计重 1计量
+      if (this.form.inspectionStandards == 2 && this.form.qualityMode == 1) {
+        for (let i = 0; i < sData.length; i++) {
+          let qualitySampleTemplateList = []
+          if (sData[i].qualitySampleTemplateList == undefined || sData[i].qualitySampleTemplateList == null || sData[i].qualitySampleTemplateList.length == 0){
+            qualitySampleTemplateList = JSON.parse(JSON.stringify(this.schemeList))
+          } else {
+            qualitySampleTemplateList = sData[i].qualitySampleTemplateList;
+          }
+          this.sampleList.push({
+            ...sData[i],
+            sampleCode: await this.getSampleCode(),
+            qualitySampleTemplateList
+          });
+        }
+      } else if (this.form.inspectionStandards == 1 && this.form.qualityMode == 1) {
+        this.getProSamList(sData)
+      }
+    },
+
+    //从来源数组取样到目标数组
+    async getNewFullSampleList(sampleCount, sampleQuantity, sampleUnit) {
+      const sourceArray = this.selectedList;
+      // 检查单位是否匹配
+      const isUnitMismatch = sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
+
+      // 创建副本并计算初始可取样数量
+      const items = sourceArray.map(item => ({
+        ...item,
+        remainingQuantity: isUnitMismatch ?  Infinity : item['measureQuantity'], // 剩余可取样数量
+        maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
+      }));
+
+      const result = [];
+      let remainingCount = sampleCount;
+
+      // 尽可能均匀地从各条目取样
+      while (remainingCount > 0) {
+        // 按剩余可取样比例排序
+        items.sort((a, b) => (b.remainingQuantity / b['measureQuantity']) - (a.remainingQuantity / a['measureQuantity']));
+
+        let distributed = false;
+
+        for (const item of items) {
+          if (!isUnitMismatch || item.remainingQuantity >= sampleQuantity && remainingCount > 0) {
+            let qualitySampleTemplateList = []
+            if (item.qualitySampleTemplateList == undefined || item.qualitySampleTemplateList == null || item.qualitySampleTemplateList.length == 0){
+              qualitySampleTemplateList = JSON.parse(JSON.stringify(this.schemeList))
+            } else {
+              qualitySampleTemplateList = item.qualitySampleTemplateList;
+            }
+            // 添加到结果数组
+            let sampleCode = await this.getSampleCode()
+            if (this.form.conditionType == 1 && this.form.inspectionStandards == 1) {
+              result.push({ ...item,measureQuantity: 1, sampleCode, qualitySampleTemplateList});
+            } else if (this.form.conditionType == 2 && (this.form.inspectionStandards == 1 || this.form.inspectionStandards == 2)) {
+              let weight = (item.weight / item.maxPossible).toFixed(2); 
+              result.push({ ...item, measureQuantity: sampleQuantity, measureUnit: sampleUnit, sampleCode, weight, qualitySampleTemplateList})
+            }
+            // 更新剩余数量
+            if (!isUnitMismatch) {
+              item.remainingQuantity -= sampleQuantity;
+            }
+            remainingCount--;
+            distributed = true;
+          }
+        }
+
+        // 如果没有分配任何取样
+        if (!distributed) {
+          break;
+        }
+      }
+      this.sampleList = result;
+      this.sampleNumber = this.sampleList.length;
+    },
+    validateWeight(measureQ, sampleCount) {
+      let totalMaxPossible = 0;
+      this.selectedList.forEach(item => {
+        totalMaxPossible += item.measureQuantity / measureQ;
+      });
+      
+      if (totalMaxPossible < sampleCount) {
+        // this.formData.portion = totalMaxPossible;
+        this.$message.info(`最大取样条数为${totalMaxPossible}`);
+        return false;
+      }
+      
+      let totalWeight = this.selectedList.reduce((sum, item) => sum + item.weight, 0);
+      const weightUnit = this.selectedList[0].weightUnit;
+      if (weightUnit === 'G') totalWeight /= 1000;
+      
+      if (measureQ * sampleCount > totalWeight) {
+        this.$message.info('取样计量重量不能大于总计量重量');
+        return false;
+      }
+      
+      const invalidItem = this.selectedList.find(item => {
+        const weight = item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
+        return weight < measureQ;
+      });
+      
+      if (invalidItem) {
+        this.$message.info('勾选条目重量小于取样重量');
+        return false;
+      }
+      
+      return true;
+    },
+
+    isStandard1OrWeightSample() {
+      return (this.form.inspectionStandards === 1) || 
+             (this.form.inspectionStandards === 2 && this.form.conditionType == 2);
+  },
+    validateMeasureQuantity(measureQ, unit, sampleCount) {
+      if (this.form.conditionType == 2 && measureQ <= 0) {
+        this.$message.info('取样计量数量必须大于0');
+        return false;
+      }
+      
+      const totalQuantity = this.selectedList.reduce((sum, item) => sum + item.measureQuantity, 0);
+      if ((this.selectedList[0].measureUnit === unit || this.form.conditionType == 1) && 
+          measureQ * sampleCount > totalQuantity) {
+        this.$message.info('取样计量数量不能大于总计量数量');
+        return false;
+      }
+      
+      const invalidItem = this.selectedList.find(item => item.measureQuantity < measureQ);
+      if (invalidItem) {
+        this.$message.info('条目计量数量小于取样计量数量');
+        return false;
+      }
+      
+      return true;
+    },
+
+    isWeightStandardFullSample() {
+      return this.form.inspectionStandards === 2 && this.form.conditionType == 1;
+    },
+
+    validateSampleCount(sampleCount) {
+      const invalidItem = this.selectedList.find(item => item.measureQuantity < sampleCount);
+      if (invalidItem) {
+        this.$message.info('所选的条目计量数量小于取样计量数量');
+        return false;
+      }
+      return true;
+    },
+
+    async handleWeightFullSample(sampleCount) {
+      for (const item of this.selectedList) {
+          const qualitySampleTemplateList = item.qualitySampleTemplateList?.length 
+            ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
+            : JSON.parse(JSON.stringify(this.schemeList));
+          this.sampleList.push({
+            ...item,
+            measureQuantity: sampleCount, //作为计量数量
+            sampleCode: await this.getSampleCode(),
+            qualitySampleTemplateList,
+          });
+        }
+        this.sampleNumber = this.sampleList.length;
+    }
   }
 };
 </script>

+ 10 - 1
src/views/sample/samplemanagement/components/edit.vue

@@ -17,6 +17,9 @@
             {{ row.categoryCode }}
           </el-link>
         </template>
+        <template v-slot:sampleCode="{ row }">
+          {{ sampleCode }}
+        </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
           <el-link type="primary" :underline="false" @click="handleDispose(row, 'dispose')">
@@ -62,6 +65,7 @@ export default {
       qualitySampleList: [],
       tableColumns: [
         { label: '编码', prop: 'categoryCode', width: '150', align: 'center', showOverflowTooltip: true, slot: 'categoryCode' },
+        { label: '样品编码', prop: 'sampleCode', width: '150', align: 'center', showOverflowTooltip: true, slot: 'sampleCode' },
         { label: '名称', prop: 'categoryName', width: '150', align: 'center', showOverflowTooltip: true },
         { label: '批次号', prop: 'batchNo', align: 'center', showOverflowTooltip: true },
         { label: '发货条码', prop: 'barcodes', align: 'center', showOverflowTooltip: true },
@@ -100,7 +104,9 @@ export default {
         },
         { columnKey: 'action', label: '操作', align: 'center', width: 120, resizable: false, slot: 'action', fixed: 'right' }
       ],
-      tableData: []
+      tableData: [],
+      sampleCode: '',
+
     };
   },
   computed: {
@@ -112,6 +118,9 @@ export default {
     if (this.$route.query.id) {
       this.getDetail();
     }
+    if (this.$route.query.sampleCode) {
+      this.sampleCode = this.$route.query.sampleCode;
+    }
   },
   methods: {
     async datasource({ page, where, limit }) {

+ 3 - 1
src/views/sample/samplemanagement/index.vue

@@ -89,7 +89,9 @@ export default {
                     type: type,
                     qualityWorkOrderId: row.qualityWorkOrderId || '',
                     id: row.id || '',
-                    qualityType: row.qualityType || ''
+                    qualityType: row.qualityType || '',
+                    sampleCode: row.sampleCode || '',
+
                 }
             });
             // this.$refs.edit.open(type, row)