小小儁爺
2025-03-27 768d890a8ecd901cff555ec4c82d107be7905add
1.批量报工 功能新增
已修改6个文件
1586 ■■■■ 文件已修改
src/api/WorkOrder.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicSettings.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 156 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produce/stepReport2.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workOrder/workOrderList.vue 721 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workOrder/workOrderList_back.vue 631 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/WorkOrder.js
@@ -339,3 +339,21 @@
  })
}
// MES工单批量绑定获取工序数据
export function UpdateMesOrderStepListSearch(data) {
  return request({
    url: 'WorkOrder/UpdateMesOrderStepListSearch',
    method: 'post',
    data
  })
}
// MES工单新增、编辑批量绑定提交
export function AddUpdateMesOrderList(data) {
  return request({
    url: 'WorkOrder/AddUpdateMesOrderList?OperType=Update',
    method: 'post',
    data
  })
}
src/api/basicSettings.js
@@ -515,3 +515,21 @@
  })
}
// 产品编码批量查找关联的工艺信息
export function PartSelectRputeList(data) {
  return request({
    url: 'BasicSetting/PartSelectRputeList',
    method: 'post',
    data
  })
}
// 根据工艺信息(工艺路线编码)批量查找关联工序集合
export function RouteSelectStepList(data) {
  return request({
    url: 'BasicSetting/RouteSelectStepList',
    method: 'post',
    data
  })
}
src/router/index.js
@@ -109,40 +109,40 @@
    children: [
      {
        path: 'organizationList',
        name: 'OrganizationList',
        name: 'OrCancleganizationList',
        code: '0101',
        component: () => import('@/views/basicSettings/organizationList'),
        meta: { code: '0101', title: '组织架构', icon: '', keepAlive: true }
      },
      {
        path: 'postList',
        name: 'PersonList',
        name: 'PeCanclersonList',
        code: '0102',
        component: () => import('@/views/basicSettings/postList'),
        meta: { code: '0102', title: '岗位管理', icon: '', keepAlive: true }
      }, {
        path: 'groupList',
        name: 'GroupList',
        name: 'GrCancleoupList',
        code: '0103',
        component: () => import('@/views/basicSettings/groupList'),
        meta: { code: '0103', title: '班组管理', icon: '', keepAlive: true }
      },
      {
        path: 'personList',
        name: 'PersonList',
        name: 'PeCanclersonList',
        code: '0104',
        component: () => import('@/views/basicSettings/personList'),
        meta: { code: '0104', title: '人员管理', icon: '', keepAlive: true }
      }, {
        path: 'roleList',
        name: 'RoleList',
        name: 'RoCancleleList',
        code: '0105',
        component: () => import('@/views/basicSettings/roleList'),
        meta: { code: '0105', title: '角色管理', icon: '', keepAlive: true }
      },
      {
        path: 'powerDivider',
        name: 'PowerDivider',
        name: 'PoCanclewerDivider',
        code: '0110',
        component: () => import('@/views/basicSettings/powerDivider'),
        meta: { code: '0110', title: '权限分配', icon: '', keepAlive: true }
@@ -150,56 +150,56 @@
      {
        path: 'roleDivider',
        name: 'RoleDivider',
        code: '0111',
        code: '01Cancle11',
        hidden: true,
        component: () => import('@/views/basicSettings/roleDivider'),
        meta: { code: '0111', title: '角色分配', icon: '', keepAlive: true }
      }, {
        path: 'contactUnitList',
        name: 'ContactUnitList',
        name: 'CoCanclentactUnitList',
        code: '0106',
        component: () => import('@/views/basicSettings/contactUnitList'),
        meta: { code: '0106', title: '往来单位', icon: '', keepAlive: true }
      }, {
        path: 'warehouseList',
        name: 'WarehouseList',
        name: 'WaCanclerehouseList',
        code: '0107',
        component: () => import('@/views/basicSettings/warehouseList'),
        meta: { code: '0107', title: '仓库设置', icon: '', keepAlive: true }
      }, {
        path: 'storageList',
        name: 'StorageList',
        name: 'StCancleorageList',
        code: '0108',
        component: () => import('@/views/basicSettings/storageList'),
        meta: { code: '0108', title: '库位设置', icon: '', keepAlive: true }
      }, {
        path: 'installLampList',
        name: 'InstallLampList',
        name: 'InCanclestallLampList',
        code: '0109',
        component: () => import('@/views/basicSettings/installLampList'),
        meta: { code: '0109', title: '安灯设置', icon: '', keepAlive: true }
      }, {
        path: 'processList',
        name: 'ProcessList',
        name: 'PrCancleocessList',
        code: '0112',
        component: () => import('@/views/basicSettings/processList'),
        meta: { code: '0112', title: '工序设置', icon: '', keepAlive: true }
      }, {
        path: 'cronTime',
        name: 'CronTime',
        name: 'CrCancleonTime',
        code: '0113',
        component: () => import('@/views/basicSettings/cronTime'),
        meta: { code: '0113', title: '定时任务', icon: '', keepAlive: true }
      }, {
        path: 'processRoute',
        name: 'ProcessRoute',
        name: 'PrCancleocessRoute',
        code: '0114',
        component: () => import('@/views/basicSettings/processRoute'),
        meta: { code: '0114', title: '工艺路线', icon: '', keepAlive: true }
      },
      {
        path: 'meterPrice',
        name: 'MeterPrice',
        name: 'MeCancleterPrice',
        code: '0115',
        component: () => import('@/views/basicSettings/meterPrice'),
        meta: { code: '0115', title: '工价设置', icon: '', keepAlive: true }
@@ -219,32 +219,32 @@
    children: [
      {
        path: 'unitList',
        name: 'UnitList',
        name: 'UnCancleitList',
        code: '0201',
        component: () => import('@/views/materialManager/unitList'),
        meta: { code: '0201', title: '计量单位', icon: '', keepAlive: true }
      },
      {
        path: 'inventoryList',
        name: 'InventoryList',
        name: 'InCancleventoryList',
        code: '0202',
        component: () => import('@/views/materialManager/inventoryList'),
        meta: { code: '0202', title: '存货档案', icon: '', keepAlive: true }
      }, {
        path: 'materialList',
        name: 'MaterialList',
        name: 'MaCancleterialList',
        code: '0203',
        component: () => import('@/views/materialManager/materialList'),
        meta: { code: '0203', title: '物料清单', icon: '', keepAlive: true }
      }, {
        path: 'unitList2',
        name: 'UnitList2',
        name: 'UnCancleitList2',
        code: '0204',
        component: () => import('@/views/materialManager/unitList2'),
        meta: { code: '0204', title: '计量单位', icon: '', keepAlive: true }
      }, {
        path: 'inventoryList2',
        name: 'InventoryList2',
        name: 'InCancleventoryList2',
        code: '0205',
        component: () => import('@/views/materialManager/inventoryList2'),
        meta: { code: '0205', title: '存货档案', icon: '', keepAlive: true }
@@ -264,56 +264,56 @@
    children: [
      {
        path: 'deviceList',
        name: 'DeviceList',
        name: 'DeCancleviceList',
        code: '0301',
        component: () => import('@/views/deviceManager/deviceList'),
        meta: { code: '0301', title: '设备清单', icon: '', keepAlive: true }
      },
      {
        path: 'checkStandard',
        name: 'CheckStandard',
        name: 'ChCancleeckStandard',
        code: '0302',
        component: () => import('@/views/deviceManager/checkStandard'),
        meta: { code: '0302', title: '点检标准', icon: '', keepAlive: true }
      },
      {
        path: 'checkPosition',
        name: 'CheckPosition',
        name: 'ChCancleeckPosition',
        code: '0303',
        component: () => import('@/views/deviceManager/checkPosition'),
        meta: { code: '0303', title: '点检部位', icon: '', keepAlive: true }
      },
      {
        path: 'maintainStandard',
        name: 'MaintainStandard',
        name: 'MaCancleintainStandard',
        code: '0304',
        component: () => import('@/views/deviceManager/maintainStandard'),
        meta: { code: '0304', title: '保养标准', icon: '', keepAlive: true }
      },
      {
        path: 'maintainPosition',
        name: 'MaintainPosition',
        name: 'MaCancleintainPosition',
        code: '0305',
        component: () => import('@/views/deviceManager/maintainPosition'),
        meta: { code: '0305', title: '保养部位', icon: '', keepAlive: true }
      },
      {
        path: 'checkRecord',
        name: 'CheckRecord',
        name: 'ChCancleeckRecord',
        code: '0306',
        component: () => import('@/views/deviceManager/checkRecord'),
        meta: { code: '0306', title: '点检记录', icon: '', keepAlive: true }
      },
      {
        path: 'maintainRecord',
        name: 'MaintainRecord',
        name: 'MaCancleintainRecord',
        code: '0307',
        component: () => import('@/views/deviceManager/maintainRecord'),
        meta: { code: '0307', title: '保养记录', icon: '', keepAlive: true }
      },
      {
        path: 'repairRecord',
        code: '0308',
        code: '03Cancle08',
        name: 'RepairRecord',
        component: () => import('@/views/deviceManager/repairRecord'),
        meta: { code: '0308', title: '维修记录', icon: '', keepAlive: true }
@@ -332,67 +332,67 @@
    children: [
      {
        path: 'mouldList',
        name: 'MouldList',
        name: 'MoCancleuldList',
        code: '0901',
        component: () => import('@/views/mouldManager/mouldList'),
        meta: { code: '0901', title: '模具清单', icon: '', keepAlive: true }
      }, {
        path: 'mouldCheckPos',
        name: 'MouldCheckPos',
        name: 'MouCancleldCheckPos',
        code: '0902',
        component: () => import('@/views/mouldManager/mouldCheck'),
        meta: { code: '0902', title: '模具点检项', icon: '', keepAlive: true }
      }, {
        path: 'mouldCheckStand',
        name: 'MouldCheckStand',
        name: 'MoulCancledCheckStand',
        code: '0903',
        component: () => import('@/views/mouldManager/mouldCheckStand'),
        meta: { code: '0903', title: '模具点检标准', icon: '', keepAlive: true }
      }, {
        path: 'mouldMaintain',
        name: 'MouldMaintain',
        name: 'MouCancleldMaintain',
        code: '0904',
        component: () => import('@/views/mouldManager/mouldMaintain'),
        meta: { code: '0904', title: '模具保养项', icon: '', keepAlive: true }
      }, {
        path: 'mouldMaintainStand',
        name: 'MouldMaintainStand',
        name: 'MoulCancledMaintainStand',
        code: '0905',
        component: () => import('@/views/mouldManager/mouldMaintainStand'),
        meta: { code: '0905', title: '模具保养标准', icon: '', keepAlive: true }
      }, {
        path: 'mouldCheckRecord',
        name: 'mouldCheckRecord',
        name: 'moulCancledCheckRecord',
        code: '0906',
        component: () => import('@/views/mouldManager/mouldCheckRecord'),
        meta: { code: '0906', title: '模具点检记录', icon: '', keepAlive: true }
      }, {
        path: 'mouldMaintainRecord',
        name: 'MouldMaintainRecord',
        name: 'MoulCancledMaintainRecord',
        code: '0907',
        component: () => import('@/views/mouldManager/mouldMaintainRecord'),
        meta: { code: '0907', title: '模具保养记录', icon: '', keepAlive: true }
      }, {
        path: 'mouldRepairRecord',
        name: 'MouldRepairRecord',
        name: 'MoulCancledRepairRecord',
        code: '0908',
        component: () => import('@/views/mouldManager/mouldRepairRecord'),
        meta: { code: '0908', title: '模具维修记录', icon: '', keepAlive: true }
      }, {
        path: 'mouldUpDownRecord',
        name: 'MouldUpDownRecord',
        name: 'MouldCancleUpDownRecord',
        code: '0909',
        component: () => import('@/views/mouldManager/mouldUpDownRecord'),
        meta: { code: '0909', title: '模具上下机记录', icon: '', keepAlive: true }
      }, {
        path: 'mouldOutInRecord',
        name: 'MouldOutInRecord',
        name: 'MouldCancleOutInRecord',
        code: '0910',
        component: () => import('@/views/mouldManager/mouldOutInRecord'),
        meta: { code: '0910', title: '模具出入库记录', icon: '', keepAlive: true }
      }, {
        path: 'mouldCirculateRecord',
        name: 'MouldCirculateRecord',
        name: 'MoulCancledCirculateRecord',
        code: '0911',
        component: () => import('@/views/mouldManager/mouldCirculateRecord'),
        meta: { code: '0911', title: '模具借还记录', icon: '', keepAlive: true }
@@ -411,32 +411,32 @@
    children: [
      {
        path: 'defectDefine',
        name: 'DefectDefine',
        name: 'DeCanclefectDefine',
        code: '0401',
        component: () => import('@/views/qualityManager/defectDefine'),
        meta: { code: '0401', title: '缺陷定义', icon: '', keepAlive: true }
      },
      {
        path: 'processCheckItem',
        name: 'ProcessCheckItem',
        name: 'ProCanclecessCheckItem',
        code: '0402',
        component: () => import('@/views/qualityManager/processCheckItem'),
        meta: { code: '0402', title: '检验项设置', icon: '', keepAlive: true }
      }, {
        path: 'qualityPlaning',
        name: 'QualityPlaning',
        name: 'QuCanclealityPlaning',
        code: '0403',
        component: () => import('@/views/qualityManager/qualityPlaning'),
        meta: { code: '0403', title: '质检方案', icon: '', keepAlive: true }
      }, {
        path: 'processCheck',
        name: 'ProcessCheck',
        name: 'PrCancleocessCheck',
        code: '0404',
        component: () => import('@/views/qualityManager/processCheck'),
        meta: { code: '0404', title: '工序检验', icon: '', keepAlive: true }
      }, {
        path: 'processCheckRecord',
        name: 'ProcessCheckRecord',
        name: 'PrCancleocessCheckRecord',
        code: '0405',
        component: () => import('@/views/qualityManager/processCheckRecord'),
        meta: { code: '0405', title: '工序检验', icon: '', keepAlive: true }
@@ -455,27 +455,27 @@
    children: [
      {
        path: 'produceOrderList',
        name: 'ProduceOrderList',
        name: 'ProCancleduceOrderList',
        code: '0501',
        component: () => import('@/views/workOrder/produceOrderList'),
        meta: { code: '0501', title: 'ERP订单', icon: '', keepAlive: true }
      },
      {
        path: 'workOrderList',
        name: 'WorkOrderList',
        name: 'WorCanclekOrderList',
        code: '0502',
        component: () => import('@/views/workOrder/workOrderList'),
        meta: { code: '0502', title: 'MES工单', icon: '', keepAlive: true }
      },
      {
        path: 'workOrderSend',
        name: 'WorkOrderSend',
        name: 'WoCanclerkOrderSend',
        code: '0503',
        component: () => import('@/views/workOrder/workOrderSend'),
        meta: { code: '0503', title: '工单派发', icon: '', keepAlive: true }
      }, {
        path: 'workOrderClose',
        name: 'WorkOrderClose',
        name: 'WoCanclerkOrderClose',
        code: '0504',
        component: () => import('@/views/workOrder/workOrderClose'),
        meta: { code: '0504', title: '工单关闭', icon: '', keepAlive: true }
@@ -495,39 +495,39 @@
    children: [
      {
        path: 'stepReport',
        name: 'StepReport',
        name: 'StCancleepReport',
        code: '0601',
        component: () => import('@/views/produce/stepReport'),
        meta: { code: '0601', title: '工序报工', icon: '', keepAlive: true }
      },
      {
        path: 'stepReport2',
        name: 'StepReport2',
        name: 'StCancleepReport2',
        code: '0606',
        component: () => import('@/views/produce/stepReport2'),
        meta: { code: '0606', title: '工序报工', icon: '', keepAlive: true }
      },
      {
        path: 'reportCorrect',
        name: 'ReportCorrect',
        name: 'ReCancleportCorrect',
        code: '0602',
        component: () => import('@/views/produce/reportCorrect'),
        meta: { code: '0602', title: '报工调整', icon: '', keepAlive: true }
      }, {
        path: 'reportVerify',
        name: 'ReportVerify',
        name: 'ReCancleportVerify',
        code: '0603',
        component: () => import('@/views/produce/reportVerify'),
        meta: { code: '0603', title: '报工审核', icon: '', keepAlive: true }
      }, {
        path: 'productWarehouse',
        name: 'productWarehouse',
        name: 'prodCancleuctWarehouse',
        code: '0604',
        component: () => import('@/views/produce/productWarehouse'),
        meta: { code: '0604', title: 'T8生产入库', icon: '', keepAlive: true }
      }, {
        path: 'productWarehouse2',
        name: 'productWarehouse2',
        name: 'prodCancleuctWarehouse2',
        code: '0605',
        component: () => import('@/views/produce/productWarehouse2'),
        meta: { code: '0605', title: 'T+生产入库', icon: '', keepAlive: true }
@@ -547,79 +547,79 @@
    children: [
      {
        path: 'reportList',
        name: 'ReportList',
        name: 'ReCancleportList',
        code: '1040',
        component: () => import('@/views/statistic/reportList'),
        meta: { code: '1040', title: '报工记录', icon: '', keepAlive: true }
      },
      {
        path: 'monthReport',
        name: 'MonthReport',
        name: 'MoCanclenthReport',
        code: '1041',
        component: () => import('@/views/statistic/monthReport'),
        meta: { code: '1041', title: '月度统计', icon: '', keepAlive: true }
      }, {
        path: 'workOrderProcess',
        name: 'WorkOrderProcess',
        name: 'WoCanclerkOrderProcess',
        code: '0701',
        component: () => import('@/views/statistic/workOrderProcess'),
        meta: { code: '0701', title: '生产进度', icon: '', keepAlive: true }
      }, {
        path: 'inProcessList',
        name: 'InProcessList',
        name: 'InCancleProcessList',
        code: '1043',
        component: () => import('@/views/statistic/inProcessList'),
        meta: { code: '1043', title: '在制列表', icon: '', keepAlive: true }
      },
      {
        path: 'groupSalaryList',
        name: 'GroupSalaryList',
        name: 'GroupSCanclealaryList',
        code: '0702',
        component: () => import('@/views/statistic/groupSalaryList'),
        meta: { code: '0702', title: '班组工资统计报表', icon: '', keepAlive: true }
      },
      {
        path: 'personSalaryList',
        name: 'PersonSalaryList',
        name: 'PersonCancleSalaryList',
        code: '0703',
        component: () => import('@/views/statistic/personSalaryList'),
        meta: { code: '0703', title: '人员工资统计报表', icon: '', keepAlive: true }
      }, {
        path: 'subcontractingOperation',
        name: 'SubcontractingOperation',
        name: 'SubconCancletractingOperation',
        code: '0704',
        component: () => import('@/views/statistic/subcontractingOperation'),
        meta: { code: '0704', title: '委外工序明细报表', icon: '', keepAlive: true }
      }, {
        path: 'defectDetailList',
        name: 'DefectDetailList',
        name: 'DefeCanclectDetailList',
        code: '0705',
        component: () => import('@/views/statistic/defectDetailList'),
        meta: { code: '0705', title: '不良明细报表', icon: '', keepAlive: true }
      }, {
        path: 'repairDetailList',
        name: 'RepairDetailList',
        name: 'RepaCancleirDetailList',
        code: '0706',
        component: () => import('@/views/statistic/repairDetailList'),
        meta: { code: '0706', title: '维修明细报表', icon: '', keepAlive: true }
      },
      {
        path: 'installationLampList',
        name: 'InstallationLampList',
        name: 'InCanclestallationLampList',
        code: '0707',
        component: () => import('@/views/statistic/installationLampList'),
        meta: { code: '0707', title: '安灯报表', icon: '', keepAlive: true }
      },
      {
        path: 'storageRecord',
        name: 'storageRecord',
        name: 'stCancleorageRecord',
        code: '0708',
        component: () => import('@/views/statistic/storageRecord'),
        meta: { code: '0708', title: '入库记录', icon: '', keepAlive: true }
      },
      {
        path: 'storageRecord2',
        name: 'storageRecord2',
        name: 'stCancleorageRecord2',
        code: '0709',
        component: () => import('@/views/statistic/storageRecord2'),
        meta: { code: '0709', title: '入库记录', icon: '', keepAlive: true }
@@ -639,20 +639,20 @@
    children: [
      {
        path: 'sopDevice',
        name: 'SopDevice',
        name: 'SopCancleDevice',
        code: '1001',
        component: () => import('@/views/sopManager/sopDevice'),
        meta: { code: '1001', title: '设备SOP', icon: '', keepAlive: true }
      },
      {
        path: 'sopRoute',
        name: 'SopRoute',
        name: 'SopCancleRoute',
        code: '1002',
        component: () => import('@/views/sopManager/sopRoute'),
        meta: { code: '1002', title: '工艺SOP', icon: '', keepAlive: true }
      }, {
        path: 'sopWorkOrder',
        name: 'SopWorkOrder',
        name: 'SopCancleWorkOrder',
        code: '1003',
        component: () => import('@/views/sopManager/sopWorkOrder'),
        meta: { code: '1003', title: '单据SOP', icon: '', keepAlive: true }
@@ -672,28 +672,28 @@
    children: [
      {
        path: 'menuList',
        name: 'MenuList',
        name: 'MeCanclenuList',
        code: '0801',
        component: () => import('@/views/systemSetting/menuList'),
        meta: { code: '0801', title: '菜单管理', icon: '', keepAlive: true }
      },
      {
        path: 'reportList',
        name: 'ReportList',
        name: 'ReCancleportList',
        code: '0802',
        component: () => import('@/views/systemSetting/encodingRules'),
        meta: { code: '0802', title: '编码规则', icon: '', keepAlive: true }
      },
      {
        path: 'dataImport',
        name: 'DataImport',
        name: 'DaCancletaImport',
        code: '0803',
        component: () => import('@/views/systemSetting/dataImport'),
        meta: { code: '0803', title: '数据导入', icon: '', keepAlive: true }
      },
      {
        path: 'processSetting',
        name: 'ProcessSetting',
        name: 'PrCancleocessSetting',
        code: '0804',
        component: () => import('@/views/systemSetting/processSetting'),
        meta: { code: '0804', title: '流转设置', icon: '', keepAlive: true }
@@ -712,35 +712,35 @@
    children: [
      {
        path: 'attendanceSettings',
        name: 'AttendanceSettings',
        name: 'AtCancletendanceSettings',
        code: '1101',
        component: () => import('@/views/attendanceModule/attendanceSettings'),
        meta: { code: '1101', title: '考勤设置', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceClockIn',
        name: 'AttendanceClockIn',
        name: 'AtCancletendanceClockIn',
        code: '1102',
        component: () => import('@/views/attendanceModule/attendanceClockIn'),
        meta: { code: '1102', title: '考勤打卡', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceRecord',
        name: 'AttendanceRecord',
        name: 'AtCancletendanceRecord',
        code: '1103',
        component: () => import('@/views/attendanceModule/attendanceRecord'),
        meta: { code: '1103', title: '考勤记录', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceDay',
        name: 'AttendanceDay',
        name: 'AttCancleendanceDay',
        code: '1104',
        component: () => import('@/views/attendanceModule/attendanceDay'),
        meta: { code: '1104', title: '日计时工资', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceMonth',
        name: 'AttendanceMonth',
        name: 'AttCancleendanceMonth',
        code: '1105',
        component: () => import('@/views/attendanceModule/attendanceMonth'),
        meta: { code: '1105', title: '月计时工资', icon: '', keepAlive: true }
src/views/produce/stepReport2.vue
@@ -472,27 +472,27 @@
          <el-input v-model="dialogForm.startqty" oninput="value=value.replace(/[^\d]/g,'')" style="width: 200px" />
        </el-form-item>
        <el-form-item
          v-if="(activeName==='生产列表'||activeName==='外协收料')&&rowData.isend === 'Y'"
          prop="stockcode"
          label="入库仓库"
          class="dialogFormItem"
        >
          <el-select
            v-model="dialogForm.stockcode"
            style="width:200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in WareHouseArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <!--        <el-form-item-->
        <!--          v-if="(activeName==='生产列表'||activeName==='外协收料')&&rowData.isend === 'Y'"-->
        <!--          prop="stockcode"-->
        <!--          label="入库仓库"-->
        <!--          class="dialogFormItem"-->
        <!--        >-->
        <!--          <el-select-->
        <!--            v-model="dialogForm.stockcode"-->
        <!--            style="width:200px"-->
        <!--            placeholder="请选择"-->
        <!--            filterable-->
        <!--            :popper-append-to-body="false"-->
        <!--          >-->
        <!--            <el-option-->
        <!--              v-for="item in WareHouseArr"-->
        <!--              :key="item.code"-->
        <!--              :label="item.name"-->
        <!--              :value="item.code"-->
        <!--            />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <el-form-item v-if="activeName==='外协发料'||activeName==='外协收料'" prop="wxcode" label="外协供方" class="dialogFormItem">
          <el-select
src/views/workOrder/workOrderList.vue
@@ -8,7 +8,11 @@
          <el-button v-waves type="success" icon="el-icon-connection" @click="send">派发</el-button>
        </div>
        <!--        <el-button v-waves icon="el-icon-switch-button" @click="orderClose">关闭工单</el-button>-->
        <el-button v-waves type="primary" @click="batchUpdate"><i
          class="el-icon-edit"
          style="margin-right: 0;"
        /> 批量绑定
        </el-button>
      </div>
      <div class="bodyTopFormGroup">
@@ -175,6 +179,20 @@
              <div v-if="row.status==='SCHED'">已排程</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="isstep"
            label="工艺状态"
            sortable="custom"
            width="110"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <el-tag v-if="row.isstep==='Y'" type="success" size="mini">已绑定</el-tag>
              <el-tag v-if="row.isstep==='N'" type="danger" size="mini">未绑定</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="wo_code"
            label="工单编号"
@@ -267,6 +285,66 @@
            show-tooltip-when-overflow
            width="100"
          />
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc1"-->
          <!--            label="客户名称"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc1 ? row.priuserdefnvc1 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc6"-->
          <!--            label="客户编码"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc6 ? row.priuserdefnvc6 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc2"-->
          <!--            label="对内名称"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc2 ? row.priuserdefnvc2 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc3"-->
          <!--            label="CTP日期"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc3 ? row.priuserdefnvc3 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc4"-->
          <!--            label="钢刀编号"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc4 ? row.priuserdefnvc4 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priuserdefnvc5"-->
          <!--            label="盒型"-->
          <!--            width="110"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              {{ row.priuserdefnvc5 ? row.priuserdefnvc5 : '/' }}-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <el-table-column
            prop="clerkuser"
            label="销售业务员"
@@ -385,7 +463,7 @@
                    :style="{color:$store.state.settings.theme}"
                    class="el-icon-printer"
                    style="cursor: pointer;margin-right: 15px"
                    @click="handlePrint(row.wo_code,row.saleOrderCod)"
                    @click="handlePrint(row.wo_code,row.saleOrderCod,row)"
                  />
                </el-tooltip>
@@ -497,6 +575,11 @@
            label="料废数量"
            show-tooltip-when-overflow
            prop="materielbad_qty"
          />
          <el-table-column
            label="总可报数量"
            show-tooltip-when-overflow
            prop="plan_qty"
          />
          <el-table-column
            label="待产数量"
@@ -647,8 +730,8 @@
            :popper-append-to-body="false"
            style="width: 200px;"
            placeholder="请选择车间"
            @change="getMesOrderNewStepContent"
          >
            <!--            @change="getMesOrderNewStepContent"-->
            <!--            @change="sourceType? getMesOrderNewStepContent():routecodeChange()"-->
            <el-option
              v-for="item in wkshopArr"
@@ -1373,6 +1456,26 @@
                  <el-form-item label="工单数量:" class="formContent">
                    {{ formApprove.plan_qty }}
                  </el-form-item>
                  <!--                  <el-form-item label="客户名称:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc1 }}-->
                  <!--                  </el-form-item>-->
                  <!--                  <el-form-item label="客户编码:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc6 }}-->
                  <!--                  </el-form-item>-->
                  <!--                  <el-form-item label="对内名称:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc2 }}-->
                  <!--                  </el-form-item>-->
                  <!--                  <el-form-item label="CTP日期:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc3 }}-->
                  <!--                  </el-form-item>-->
                  <!--                  <el-form-item label="钢刀编号:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc4 }}-->
                  <!--                  </el-form-item>-->
                  <!--                  <el-form-item label="盒型:" class="formContent">-->
                  <!--                    {{ formApprove.priuserdefnvc5 }}-->
                  <!--                  </el-form-item>-->
                  <!--                <el-form-item label="工艺路线:" class="formContent">-->
                  <!--                  {{ formApprove.routename }}-->
                  <!--                </el-form-item>-->
@@ -2256,6 +2359,255 @@
      </span>
    </el-dialog>
    <!--   批量修改-->
    <el-dialog
      v-el-drag-dialog
      title="批量修改"
      :visible.sync="dialogVisibleBatchUpdate"
      width="1200px"
      top="8vh"
      :close-on-click-modal="false"
      @closed="handleCloseBatchUpdate"
      @close="handleCloseBatchUpdate"
    >
      <div
        v-if="formData3.filter(i => !i.routecode).length>0&&mesSetting.route"
        style="display: flex;align-items: center"
      >
        <div style="height: 34px;width: 80%;margin-bottom: 10px;">
          <el-alert
            :title="'当前选中'+multipleSelection.length+'个工单,有'+(formData3.filter(i => !i.routecode).length)+'个工单未指定工艺路线,请先指定!'"
            type="error"
            :closable="false"
          />
        </div>
        <el-button
          v-waves
          type="text"
          style="margin-left: 20px;"
          @click="dialogVisibleBatchUpdate=false;$router.push('../materialManager/inventoryList2')"
        >点击跳转存货绑定工艺
        </el-button>
      </div>
      <div v-for="(i,index) in formData3" :key="index" class="customDiv">
        <el-form
          ref="dialogForm"
          inline
          :model="i"
          label-width="110px"
        >
          <el-divider content-position="left">基本信息 {{ index + 1 }}</el-divider>
          <el-form-item
            label="工单状态"
            prop="mesorderstus"
          >
            <div style="width: 200px;">{{ erporderstusArr.find(item => item.code === i.mesorderstus).name }}</div>
          </el-form-item>
          <el-form-item label="工单编号" prop="mesordercode">
            <div style="width: 200px;">{{ i.mesordercode }}</div>
          </el-form-item>
          <el-form-item label="工单类型" prop="mesorderstus">
            <div style="width: 200px;">{{ ordertypeArr.find(item => item.code === i.ordertype).name }}</div>
          </el-form-item>
          <el-form-item label="源单单号">
            <div style="width: 200px;">{{ i.sourceorder }}</div>
          </el-form-item>
          <el-form-item label="工单数量" prop="mesqty">
            <div style="width: 200px;">{{ i.mesqty }}</div>
          </el-form-item>
          <el-form-item label="所属车间" prop="wkshopcode">
            <el-select
              v-model="i.wkshopcode"
              filterable
              :popper-append-to-body="false"
              style="width: 200px;"
              placeholder="请选择车间"
            >
              <!--              @change="val=>getMesOrderNewStepContentBatchUpdate(val,index)"-->
              <el-option
                v-for="item in wkshopArr"
                :key="item.torg_code"
                :label="item.torg_name"
                :value="item.torg_code"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            label="产品名称"
            prop="partcode"
          >
            <div style="width: 200px;">{{ partArr.find(item => item.partcode === i.partcode).partname }}</div>
          </el-form-item>
          <el-form-item
            label="产品编码"
            prop="partcode"
          >
            <div style="width: 200px;">{{ i.partcode }}</div>
          </el-form-item>
          <el-form-item label="产品规格" prop="partspec">
            <div style="width: 200px;">{{
              partArr.find(item => item.partcode === i.partcode).partspec ? partArr.find(item => item.partcode === i.partcode).partspec : '/'
            }}
            </div>
          </el-form-item>
          <el-form-item v-if="mesSetting.route" label="工艺路线" prop="wkshopcode">
            <el-select
              v-model="i.routecode"
              filterable
              :popper-append-to-body="false"
              style="width: 200px;"
              placeholder="请选择工艺路线"
              @change="val=>routecodeChangeBatchUpdate(val,index)"
            >
              <el-option
                v-for="item in i.routecodeArr"
                :key="item.route_code"
                :label="item.route_name"
                :value="item.route_code"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="预计交付日期" prop="deliverydate">
            <el-date-picker
              v-model="i.deliverydate"
              type="date"
              size="mini"
              :clearable="false"
              class="dateMini"
              :picker-options="pickerOptions"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              placeholder="选择日期"
            />
          </el-form-item>
          <el-form-item label="工序来源" required>
            <el-switch
              v-model="i.sourceType"
              style="width: 200px;"
              inactive-text="基础设置"
              active-text="历史最新"
              :disabled="!i.wkshopcode"
              @change="val=>sourceTypeChangeBatchUpdate(val,index)"
            />
          </el-form-item>
          <el-divider content-position="left">工序信息 {{ index + 1 }}</el-divider>
          <div style="display: flex;align-items: center">
            <div style="font-weight: bolder">工序选择:</div>
            <el-select
              v-model="i.stepSelectedValue"
              class="stepSelectedValueClass"
              style="width: 930px;"
              multiple
              placeholder="请选择相对应工序"
              @change="val=>stepSelectedValueChangeBatchUpdate(val,index)"
            >
              <el-option
                v-for="item in stepSelectArr"
                :key="item.stepcode"
                :label="item.stepname"
                :value="item.stepcode"
              />
            </el-select>
          </div>
          <el-table
            :ref="'stepTableDataRef'+index"
            :key="index"
            :data="i.stepTableData"
            border
            :row-class-name="tableRowClassName"
            height="300"
            :header-cell-style="{
              background: '#f8f8fa', padding: '0', color: '#000', fontWeight: 500
            }"
            :cell-style="{padding: '5px 0'}"
            style="width: 100%;margin-top: 15px;"
            highlight-current-row
            row-key="stepcode"
          >
            <el-table-column
              type="index"
              label="序号"
              width="50"
            />
            <el-table-column
              prop="stepcode"
              show-tooltip-when-overflow
              label="工序编码"
            />
            <el-table-column
              prop="stepname"
              label="工序名称"
              show-tooltip-when-overflow
            />
            <el-table-column
              prop="stepprice"
              label="生产单价"
              show-tooltip-when-overflow
            >
              <template slot-scope="{row}">
                <el-input
                  v-model="row.stepprice"
                  placeholder="请输入工序单价"
                  oninput="value=value.replace(/[^0-9.]/g,'')"
                  style="width: 100%"
                />
              </template>
            </el-table-column>
            <el-table-column
              label="操作"
              width="120"
            >
              <template slot-scope="scope">
                <div class="operationClass">
                  <!--                   <i-->
                  <!--                    class="el-icon-rank"-->
                  <!--                    :style="{color:$store.state.settings.theme}"-->
                  <!--                    style="cursor: move"-->
                  <!--                  />-->
                  <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                    <i
                      class="el-icon-delete"
                      :style="{color:$store.state.settings.theme}"
                      style="margin-left: 15px;"
                      @click="stepDelBatchUpdate(index,scope.$index)"
                    />
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancelBatchUpdate">取 消</el-button>
          <el-button
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirmBatchUpdate"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -2269,9 +2621,9 @@
import waves from '@/directive/waves'
import {
  AddMesOrderCodeSearch,
  AddUpdateMesOrder, DeleteMesOrder,
  AddUpdateMesOrder, AddUpdateMesOrderList, DeleteMesOrder,
  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent, MesOrderProcessSopSearch,
  MesOrderSearch, MesOrderSopSearch,
  MesOrderSearch, MesOrderSopSearch, UpdateMesOrderStepListSearch,
  UpdateMesOrderStepSearch
} from '@/api/WorkOrder'
import { PartSelect } from '@/api/ProductModel'
@@ -2280,7 +2632,7 @@
import ElDragSelect from '@/components/DragSelect'
import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
import DateType from '@/components/DateType'
import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings'
import { PartSelectRpute, PartSelectRputeList, RouteSelectStep, RouteSelectStepList } from '@/api/basicSettings'
import { DeviceSopSearch } from '@/api/DeviceManager'
export default {
@@ -2439,7 +2791,13 @@
        partspec: '',
        plan_qty: '',
        routename: '',
        lm_date: ''
        lm_date: '',
        priuserdefnvc1: '',
        priuserdefnvc2: '',
        priuserdefnvc3: '',
        priuserdefnvc4: '',
        priuserdefnvc5: '',
        priuserdefnvc6: ''
      },
      number: '',
      dialogVisible2: false,
@@ -2559,7 +2917,10 @@
      },
      sopArr: [],
      routeCode: '', // 工艺路线code
      partCode: ''
      partCode: '',
      dialogVisibleBatchUpdate: false, // 批量修改
      formData3: []
    }
  },
  watch: {
@@ -2568,6 +2929,7 @@
      handler: function(val) {
        // do something with the new and old value of stepSelectedValue
        console.log(val, 1)
        console.log(this.stepTableData, 3)
        const arr = JSON.parse(JSON.stringify(this.stepTableData))
        const arrStepcode = arr.map(i => i.stepcode)
        this.stepTableData = []
@@ -2586,6 +2948,7 @@
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.handleRequest()
  },
  created() {
    this.handleRequest()
@@ -2599,6 +2962,280 @@
    // })
  },
  methods: {
    stepDelBatchUpdate(index, ind) {
      this.formData3[index].stepTableData.splice(ind, 1)
      this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
    },
    // 批量修改
    async batchUpdate() {
      if (this.multipleSelection.length === 0) {
        return this.$message.info('请先勾选相对应的工单!')
      }
      const loading = this.$loading({
        lock: true,
        text: '正在加载数据,请稍等...',
        spinner: 'el-icon-loading',
        customClass: 'osloading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      const data2 = []
      const data3 = []
      this.formData3 = []
      const partcodeArr = []
      this.multipleSelection.forEach(i => {
        partcodeArr.push({
          partcode: i.partcode
        })
        if (this.mesSetting.route) {
          data2.push(
            { partcode: i.partcode, routecode: i.route_code ? i.route_code : i.default_route }
          )
        }
        data3.push({
          sourceid: i.sourceid,
          sourcewo: i.m_po,
          wocode: i.wo_code,
          data_sources: i.data_sources
        })
        this.formData3.push({
          mesorderstus: i.status, // 工单状态码
          mesordercode: i.wo_code, // 工单编号
          ordertype: i.wotype, // 工单类型
          sourceorderid: i.sourceid, // 源单id
          sourceorder: i.m_po, // 源单单号
          partcode: i.partcode, // 产品编码
          partname: i.partname, // 产品名称
          partspec: i.partspec, // 产品规格
          mesqty: i.plan_qty, // 工单数量
          wkshopcode: i.wkshp_code, // 生产车间编码
          wkshopname: i.wkshp_name, // 生产车间名称
          deliverydate: i.saleOrderDeliveryDate.substring(0, 11), // 交付时间
          data_sources: i.data_sources, // 数据来源
          sourceType: this.sourceType, // 工序来源
          routecode: i.route_code ? i.route_code : i.default_route, // 工艺路线
          routecodeArr: [], // 工艺路线数组
          stepSelectedValue: [], // 下拉选中值
          stepTableData: []// 工序表值
        })
      })
      const { data: res3 } = await UpdateMesOrderStepListSearch(data3)
      console.log(res3, 321)
      res3.forEach((i, index) => {
        if (i.stepdata.length > 0) {
          this.formData3[index].stepTableData = i.stepdata
          this.formData3[index].stepSelectedValue = i.stepdata.map(j => j.stepcode)
        }
      })
      const { data: res } = await PartSelectRputeList(partcodeArr)
      if (this.mesSetting.route) {
        res.forEach((i, index) => {
          if (i.routedata.length > 0) {
            this.formData3[index].routecodeArr = i.routedata
          }
        })
      } else {
        this.formData3.forEach((i, index) => {
          if (i.stepTableData.length === 0) {
            i.stepTableData = res[index].stepdata
            i.stepSelectedValue = res[index].stepdata.length > 0 ? res[index].stepdata.map(j => j.stepcode) : []
          }
        })
      }
      if (this.mesSetting.route) {
        const { data: res2 } = await RouteSelectStepList(data2)
        this.formData3.forEach((i, index) => {
          if (i.stepTableData.length === 0) {
            i.stepTableData = res2[index].stepdata
            i.stepSelectedValue = res2[index].stepdata.length > 0 ? res2[index].stepdata.map(j => j.stepcode) : []
          }
        })
      }
      // this.formData3 = this.multipleSelection
      this.dialogVisibleBatchUpdate = true
      loading.close()
    },
    // 对话框关闭
    handleCloseBatchUpdate() {
      this.multipleSelection = []
      this.formData3 = []
      this.$refs.tableDataRef.clearSelection()
    },
    dialogVisibleCancelBatchUpdate() {
      this.dialogVisibleBatchUpdate = false
    },
    async dialogVisibleConfirmBatchUpdate() {
      this.$store.state.app.buttonIsDisabled = true
      let flag = false
      const data = []
      this.formData3.forEach((i, index) => {
        const workListSub = []
        if (i.stepTableData.length > 0) {
          i.stepTableData.forEach((it, j) => {
            workListSub.push(
              {
                stepseq: j + 1,
                stepcode: it.stepcode,
                stepprice: it.stepprice,
                isbott: j === 0 ? 'Y' : 'N',
                isend: j === i.stepTableData.length - 1 ? 'Y' : 'N'
              }
            )
          })
        } else {
          flag = true
        }
        data.push({
          wostatus: i.mesorderstus, // 工单状态
          wocode: i.mesordercode, // 工单号
          wotype: i.ordertype, // 工单类型
          sourceid: i.sourceorderid, // 源单id
          sourcewo: i.sourceorder, // 源单单号
          partcode: i.partcode, // 产品编号
          wkshopcode: i.wkshopcode,
          woqty: i.mesqty, // 工单数量
          deliverydate: i.deliverydate, // 交付时间
          data_sources: i.data_sources, // 数据来源
          isstep: workListSub.length > 0 ? 'Y' : 'N', //
          difference: 0, // 数据差值
          routecode: i.routecode,
          workListSub
        })
      })
      if (flag) {
        this.$store.state.app.buttonIsDisabled = false
        return this.$message.error('数据未维护好,请先检查!')
      }
      const res = await AddUpdateMesOrderList(data)
      if (res.code === '200') {
        this.$message.success('修改操作成功!')
        this.$store.state.app.buttonIsDisabled = false
      }
      await this.getMesOrderSearch()
      this.dialogVisibleBatchUpdate = false
    },
    async sourceTypeChangeBatchUpdate(val, index) {
      if (val) {
        const data = {
          routecode: this.formData3[index].routecode,
          wkshopcode: this.formData3[index].wkshopcode,
          partcode: this.formData3[index].partcode
        }
        const { data: res } = await MesOrderNewStepContent(data)
        this.formData3[index].stepSelectedValue = []
        this.formData3[index].stepTableData = []
        if (res.length > 0) {
          res.forEach(i => {
            this.formData3[index].stepTableData.push(
              {
                stepcode: i.step_code,
                stepname: i.step_name,
                stepprice: i.stepprice
              }
            )
          })
          this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
        }
      } else {
        if (this.mesSetting.route) {
          // this.routecodeChange()
          const data = {
            partcode: this.formData3[index].partcode,
            routecode: this.formData3[index].routecode
          }
          const { data: res } = await RouteSelectStep(data)
          this.formData3[index].stepSelectedValue = []
          this.formData3[index].stepTableData = []
          if (res.length > 0) {
            res.sort((a, b) => a.step_seq - b.step_seq)
            res.forEach(i => {
              this.formData3[index].stepTableData.push(
                {
                  stepcode: i.step_code,
                  stepname: i.step_name,
                  stepprice: i.unprice
                }
              )
            })
            this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
          }
        } else {
          // this.getBasicProcessData()
          const { data: res } = await PartSelectRpute({ partcode: this.formData3[index].partcode })
          res.sort((a, b) => a.step_seq - b.step_seq)
          this.formData3[index].stepSelectedValue = []
          this.formData3[index].stepTableData = []
          res.forEach(i => {
            this.formData3[index].stepTableData.push(
              {
                stepcode: i.step_code,
                stepname: i.step_name,
                stepprice: i.unprice
              }
            )
          })
          this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
        }
      }
    },
    async getMesOrderNewStepContentBatchUpdate(val, index) {
      const data = {
        routecode: this.formData3[index].routecode,
        wkshopcode: this.formData3[index].wkshopcode,
        partcode: this.formData3[index].partcode
      }
      const { data: res } = await MesOrderNewStepContent(data)
      this.formData3[index].stepSelectedValue = []
      this.formData3[index].stepTableData = []
      if (res.length > 0) {
        res.forEach(i => {
          this.formData3[index].stepTableData.push(
            {
              stepcode: i.step_code,
              // stepname: i.stepname,
              stepprice: i.stepprice
            }
          )
        })
        this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
      }
    },
    async routecodeChangeBatchUpdate(val, index) {
      // this.sourceType
      const data = {
        partcode: this.formData3[index].partcode,
        routecode: this.formData3[index].routecode
      }
      const { data: res } = await RouteSelectStep(data)
      this.formData3[index].stepSelectedValue = []
      this.formData3[index].stepTableData = []
      if (res.length > 0) {
        res.sort((a, b) => a.step_seq - b.step_seq)
        res.forEach(i => {
          this.formData3[index].stepTableData.push(
            {
              stepcode: i.step_code,
              stepname: i.step_name,
              stepprice: i.unprice
            }
          )
        })
        this.formData3[index].stepSelectedValue = this.formData3[index].stepTableData.map(i => i.stepcode)
      }
    },
    // 弹出框关闭
    handleSopClose() {
      this.SopDialogVisible = false
@@ -2817,11 +3454,12 @@
      this.dialogVisibleTask = false
    },
    handleSelectionChange(val) {
      this.multipleSelection = val.map(i => i.wo_code)
      this.multipleSelection = val
    },
    selected(row, index) {
      return row.status === 'NEW' && row.isstep === 'Y'
      return row.status === 'NEW'
      // return row.status === 'NEW' && row.isstep === 'Y'
    },
    // 派发
    send() {
@@ -2834,7 +3472,7 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        MesOrderDistribution(this.multipleSelection).then(res => {
        MesOrderDistribution(this.multipleSelection.map(i => i.wo_code)).then(res => {
          if (res.code === '200') {
            this.$notify.success('派发成功!')
            this.getMesOrderSearch()
@@ -2873,7 +3511,14 @@
        this.$notify.info('已取消删除')
      })
    },
    // 超报比例
    rationChange(val, row) {
      row.sumqty = Math.round(parseFloat(this.dialogForm.mesqty) * (1 + (parseFloat(val) > 0 ? parseFloat(val) / 100 : 0)))
    },
    // 批量修改的  超报比例
    rationBatchChange(val, row, index) {
      row.sumqty = Math.round(parseFloat(this.formData3[index].mesqty) * (1 + (parseFloat(val) > 0 ? parseFloat(val) / 100 : 0)))
    },
    // 修改按钮
    async edit(operation, row) {
      this.operation = operation
@@ -2902,13 +3547,17 @@
      }
      const { data: res } = await UpdateMesOrderStepSearch(data)
      this.dialogForm.mesmaxqty = res.canupdate_qty
      if (this.mesSetting.route) { // 按工艺路线走模式
        if (!this.dialogForm.routecode) {
          await this.getPartcodeChangeDialog()
        } else {
          const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
          this.routecodeArr = res
        }
        if (res.stepdata.length > 0) {
          this.stepTableData = []
          this.stepSelectedValue = []
          res.stepdata.forEach(i => {
            this.stepTableData.push(
              {
@@ -2941,6 +3590,7 @@
      } else {
        if (res.stepdata.length > 0) {
          res.stepdata.forEach(i => {
            console.log(i)
            this.stepTableData.push(
              {
                stepcode: i.step_code,
@@ -3128,7 +3778,6 @@
          if (workListSub.length === 0) {
            return this.$message.info('工序不能为空!')
          }
          const data = {
            wostatus: this.dialogForm.mesorderstus, // 工单状态
            wocode: this.dialogForm.mesordercode, // 工单号
@@ -3208,10 +3857,18 @@
      this.dialogVisibleSearch = false
    },
    // 处理打印
    handlePrint(wo_code, saleOrderCode) {
    handlePrint(wo_code, saleOrderCode, row) {
      // const number = Math.random() * Math.random()
      // this.number = number === 0 ? (10 + Math.random()) : number
      // console.log(number)
      this.formApprove.priuserdefnvc1 = row.priuserdefnvc1 ? row.priuserdefnvc1 : '/'
      this.formApprove.priuserdefnvc2 = row.priuserdefnvc2 ? row.priuserdefnvc2 : '/'
      this.formApprove.priuserdefnvc3 = row.priuserdefnvc3 ? row.priuserdefnvc3 : '/'
      this.formApprove.priuserdefnvc4 = row.priuserdefnvc4 ? row.priuserdefnvc4 : '/'
      this.formApprove.priuserdefnvc5 = row.priuserdefnvc5 ? row.priuserdefnvc5 : '/'
      this.formApprove.priuserdefnvc6 = row.priuserdefnvc6 ? row.priuserdefnvc6 : '/'
      this.formApprove.saleOrderCode = this.formApprove.saleOrderCode !== '' ? this.formApprove.saleOrderCode : saleOrderCode
      const data2 = {
        mesordercode: wo_code || this.dialogForm.mesordercode
@@ -3323,6 +3980,12 @@
      this.formApprove.routename = ''
      this.formApprove.lm_date = ''
      this.formApprove.priuserdefnvc1 = ''
      this.formApprove.priuserdefnvc2 = ''
      this.formApprove.priuserdefnvc3 = ''
      this.formApprove.priuserdefnvc4 = ''
      this.formApprove.priuserdefnvc5 = ''
      this.formApprove.priuserdefnvc6 = ''
      // this.$refs.qrCodeDiv0.title = ''
      this.tableDataPrint = []
@@ -3682,6 +4345,18 @@
    stepSelectedValueChange(val) {
      // console.log(val, 123)
    },
    stepSelectedValueChangeBatchUpdate(val, index) {
      console.log(val, index)
      this.formData3[index].stepTableData = []
      val.forEach(i => {
        this.formData3[index].stepTableData.push({
          stepcode: i,
          stepname: this.stepSelectArr.find(j => j.stepcode === i).stepname,
          stepprice: 0
        })
      })
    },
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
@@ -4027,9 +4702,25 @@
    height: 100% !important;
  }
}
.customDiv {
  ::v-deep .el-divider:first-child {
    width: 120%;
    margin-left: -10%;
  }
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
<style>
.sortable-ghost {
  opacity: .8;
  color: #fff !important;
  background: #42b983 !important;
}
</style>
src/views/workOrder/workOrderList_back.vue
@@ -135,6 +135,8 @@
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
          border
          :summary-method="getSummaries"
          show-summary
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px'}"
          highlight-current-row
@@ -155,6 +157,19 @@
            label="序号"
            fixed
          />
          <el-table-column
            prop="isstep"
            label="工单编号"
            show-tooltip-when-overflow
            sortable="custom"
            width="110"
          >
            <template slot-scope="{row}">
              <el-tag v-if="row.isstep==='Y'" size="small" type="success">已绑定</el-tag>
              <el-tag v-if="row.isstep==='N'" size="small" type="danger">未绑定</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="status"
            label="工单状态"
@@ -243,6 +258,21 @@
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            v-if="mesSetting.route"
            prop="route_name"
            label="工艺路线"
            sortable="custom"
            show-tooltip-when-overflow
            width="120"
          >
            <template slot-scope="{row}">
              <div v-if="row.route_name">{{ row.route_name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="plan_qty"
            label="工单数"
@@ -336,16 +366,26 @@
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP预览" placement="top">
                  <i
                    v-if="mesSetting.workOrder"
                    class="el-icon-files"
                    style="cursor: pointer;color:#42b983;margin-right: 15px"
                    @click="pre(row,1)"
                  />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="修改" placement="top">
                  <i
                    class="el-icon-edit-outline"
                    :style="{color:$store.state.settings.theme}"
                    @click.stop="edit('edit',row)"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click.stop="del(row)" />
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="打印工单" placement="top">
@@ -358,7 +398,7 @@
                    :style="{color:$store.state.settings.theme}"
                    class="el-icon-printer"
                    style="cursor: pointer;margin-right: 15px"
                    @click.stop="handlePrint(row.wo_code)"
                    @click="handlePrint(row.wo_code,row.saleOrderCod)"
                  />
                </el-tooltip>
@@ -367,7 +407,7 @@
                    class="el-icon-view"
                    style="cursor: pointer;"
                    :style="{color:$store.state.settings.theme}"
                    @click.stop="edit('view',row)"
                    @click="edit('view',row)"
                  />
                </el-tooltip>
@@ -476,13 +516,21 @@
            show-tooltip-when-overflow
            prop="delive_qty"
          />
          <!--          <el-table-column-->
          <!--            label="操作"-->
          <!--            width="120"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div class="operationClass">-->
          <el-table-column
            label="操作"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP预览" placement="top">
                  <i
                    v-if="mesSetting.tech"
                    class="el-icon-files"
                    style="cursor: pointer;color:#42b983;margin-right: 15px"
                    @click="pre(row,2)"
                  />
                </el-tooltip>
          <!--                <el-tooltip class="item" effect="dark" content="打印工序" placement="top">-->
          <!--                  <i-->
          <!--                    v-if="tableDataDetail.length!==row.seq"-->
@@ -501,9 +549,9 @@
          <!--                    @click="getProductInHouseLabCode(row.wo_code)"-->
          <!--                  />-->
          <!--                </el-tooltip>-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
@@ -604,6 +652,26 @@
          />
          <!--          oninput="value=value.replace(/[^0-9*.{1}0-9*]/g,'')"-->
        </el-form-item>
        <el-form-item label="所属车间" prop="wkshopcode">
          <el-select
            v-model="dialogForm.wkshopcode"
            filterable
            :popper-append-to-body="false"
            style="width: 200px;"
            placeholder="请选择车间"
            @change="getMesOrderNewStepContent"
          >
            <!--            @change="sourceType? getMesOrderNewStepContent():routecodeChange()"-->
            <el-option
              v-for="item in wkshopArr"
              :key="item.torg_code"
              :label="item.torg_name"
              :value="item.torg_code"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          label="产品名称/编码"
          prop="partcode"
@@ -635,23 +703,25 @@
          <el-input v-model="dialogForm.partspec" disabled style="width: 200px" />
        </el-form-item>
        <!--        :disabled="dialogForm.partcode===''"-->
        <el-form-item label="所属车间" prop="wkshopcode">
        <el-form-item v-if="mesSetting.route" label="工艺路线" prop="wkshopcode">
          <el-select
            v-model="dialogForm.wkshopcode"
            v-model="dialogForm.routecode"
            filterable
            :popper-append-to-body="false"
            style="width: 200px;"
            placeholder="请选择车间"
            @change="getMesOrderNewStepContent"
            placeholder="请选择工艺路线"
            @change="sourceType? getMesOrderNewStepContent():routecodeChange()"
          >
            <el-option
              v-for="item in wkshopArr"
              :key="item.torg_code"
              :label="item.torg_name"
              :value="item.torg_code"
              v-for="item in routecodeArr"
              :key="item.route_code"
              :label="item.route_name"
              :value="item.route_code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="预计交付日期" prop="deliverydate">
          <el-date-picker
            v-model="dialogForm.deliverydate"
@@ -666,26 +736,52 @@
          />
          <!--          :disabled="dialogForm.deliverydate"-->
        </el-form-item>
        <el-form-item label="工序来源" required>
          <el-switch
            v-model="sourceType"
            style="width: 200px;"
            inactive-text="基础设置"
            active-text="历史最新"
            :disabled="!dialogForm.wkshopcode"
            @change="sourceTypeChange"
          />
        </el-form-item>
        <el-divider content-position="left">工序信息</el-divider>
        <div style="display: flex;align-items: center">
          <div style="font-weight: bolder">工序选择:</div>
          <el-drag-select
          <el-select
            v-model="stepSelectedValue"
            class="stepSelectedValueClass"
            style="width:930px;"
            multiple
            placeholder="请选择相对应工序"
            @change="stepSelectedValueChange"
          >
            <!--            :disabled="!(dialogForm.mesorderstus==='NEW'||dialogForm.mesorderstus==='ALLO')"-->
            <el-option
              v-for="item in stepSelectArr"
              :key="item.stepcode"
              :label="item.stepname"
              :value="item.stepcode"
            />
          </el-drag-select>
          </el-select>
          <!--          <el-drag-select-->
          <!--            v-model="stepSelectedValue"-->
          <!--            style="width:930px;"-->
          <!--            multiple-->
          <!--            placeholder="请选择相对应工序"-->
          <!--            @change="stepSelectedValueChange"-->
          <!--          >-->
          <!--            <el-option-->
          <!--              v-for="item in stepSelectArr"-->
          <!--              :key="item.stepcode"-->
          <!--              :label="item.stepname"-->
          <!--              :value="item.stepcode"-->
          <!--            />-->
          <!--          </el-drag-select>-->
        </div>
        <el-table
@@ -726,7 +822,7 @@
                placeholder="请输入工序单价"
                oninput="value=value.replace(/[^0-9.]/g,'')"
                style="width: 100%"
                @click.stop=""
                @click=""
              />
            </template>
          </el-table-column>
@@ -1245,6 +1341,7 @@
    <el-dialog
      v-el-drag-dialog
      title=""
      top="7vh"
      :visible.sync="dialogVisibleApprove"
      width="812px"
      class="dialogVisibleConfirmClass"
@@ -1254,6 +1351,8 @@
    >
      <!-- 要打印的区域 -->
      <div id="printMe" style="padding: 30px">
        <!--        <div v-for="(item,index) in tableDataPrint" :key="index">-->
        <div>
        <div style="font-size: 26px; text-align: center">流程单</div>
        <div style="display: flex;justify-content: space-around;margin-top: 20px; position: relative;">
@@ -1266,6 +1365,9 @@
              style="display: flex;justify-content: space-between"
            >
              <div class="elForm">
                  <el-form-item label="销售单号:" class="formContent">
                    {{ formApprove.saleOrderCode ? formApprove.saleOrderCode : '/' }}
                  </el-form-item>
                <el-form-item label="工单编号:" class="formContent">
                  {{ formApprove.mesordercode }}
                </el-form-item>
@@ -1298,14 +1400,14 @@
            </el-form>
          </div>
          <div
            id="qrCode"
              id="qrCode0"
            style="width: 22%;height:90px;
            margin-top: 20px;
            overflow-y: scroll;display: flex;
            justify-content: center;
            position: relative;"
          >
            <div id="qrCode0" ref="qrCodeDiv0" />
              <div id="qrCode00" ref="qrCodeDiv00" />
          </div>
          <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
          <div
@@ -1313,10 +1415,9 @@
          />
        </div>
        <!--          <div style="width:100%;height: 30px;border-bottom: 1px solid #eee;margin-bottom: 20px" />-->
        <el-table
          id="table"
          :data="tableDataPrint"
            :data="tableDataPrint[0]"
          border
          class="tableDataPrint"
          :header-cell-style="{ background: '#c0c0c0',textAlign:'center',color:'#000',borderColor:'#000'}"
@@ -1338,7 +1439,8 @@
            align="center"
          >
            <template slot-scope="{row}">
              <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" class="tableColumn" />
                <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" :key="'qrCodeDiv'+row.seq" class="tableColumn" />
            </template>
          </el-table-column>
          <el-table-column
@@ -1377,6 +1479,137 @@
            label="备注"
          />
        </el-table>
        </div>
        <div v-if="tableDataPrint[1]" style="margin-top: 100px;">
          <div style="font-size: 26px; text-align: center">流程单</div>
          <div style="display: flex;justify-content: space-around;margin-top: 20px; position: relative;">
            <div style="width: 78%">
              <el-form
                ref="formApprove"
                :model="formApprove"
                label-width="80px"
                inline
                style="display: flex;justify-content: space-between"
              >
                <div class="elForm">
                  <el-form-item label="销售单号:" class="formContent">
                    {{ formApprove.saleOrderCode ? formApprove.saleOrderCode : '/' }}
                  </el-form-item>
                  <el-form-item label="工单编号:" class="formContent">
                    {{ formApprove.mesordercode }}
                  </el-form-item>
                  <el-form-item label="源单单号:" class="formContent">
                    {{ formApprove.m_po }}
                  </el-form-item>
                  <el-form-item label="产品编码:" class="formContent">
                    {{ formApprove.partcode }}
                  </el-form-item>
                  <el-form-item label="产品名称:" class="formContent">
                    {{ formApprove.partname }}
                  </el-form-item>
                  <el-form-item label="产品规格:" class="formContent">
                    {{ formApprove.partspec }}
                  </el-form-item>
                  <el-form-item label="工单数量:" class="formContent">
                    {{ formApprove.plan_qty }}
                  </el-form-item>
                  <!--                <el-form-item label="工艺路线:" class="formContent">-->
                  <!--                  {{ formApprove.routename }}-->
                  <!--                </el-form-item>-->
                  <el-form-item label="打印人员:" class="formContent">
                    <!--                  {{ localStorage.getItem('username') }}-->
                    {{ formApprove.routename }}
                  </el-form-item>
                  <el-form-item label="打印时间:" class="formContent">
                    {{ formApprove.lm_date }}
                  </el-form-item>
                </div>
              </el-form>
            </div>
            <div
              id="qrCode1"
              style="width: 22%;height:90px;
                        margin-top: 20px;
                        overflow-y: scroll;display: flex;
                        justify-content: center;
                        position: relative;"
            >
              <div id="qrCode01" ref="qrCodeDiv01" />
            </div>
            <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
            <div
              style="z-index: 10;background-color:transparent;width: 120px;height:120px; position: absolute;right: 21px"
            />
          </div>
          <el-table
            id="table"
            :data="tableDataPrint[1]"
            border
            class="tableDataPrint"
            :header-cell-style="{ background: '#c0c0c0',textAlign:'center',color:'#000',borderColor:'#000'}"
            :cell-style="{textAlign: 'center',color:'#000',borderColor:'#000'}"
            style="width: 100%;margin-top: 20px;text-align: center;border-color: #000"
          >
            <el-table-column
              id="column0"
              prop="seq"
              label="工序号"
              width="70"
              align="center"
            />
            <el-table-column
              id="column1"
              prop="stepqrcode"
              label="工序二维码"
              width="100"
              align="center"
            >
              <template slot-scope="{row}">
                <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" :key="'qrCodeDiv'+row.seq" class="tableColumn" />
              </template>
            </el-table-column>
            <el-table-column
              id="column2"
              prop="stepname"
              label="工序"
              width="120"
              align="center"
            />
            <el-table-column
              id="column3"
              prop="plan_qty"
              label="加工数量"
              width="100"
              align="center"
            />
            <el-table-column
              id="column4"
              prop="good_qty"
              width="100"
              align="center"
              label="合格数量"
            />
            <el-table-column
              id="column5"
              width="100"
              prop="ng_qty"
              align="center"
              label="不良数量"
            />
            <el-table-column
              id="column6"
              prop="desc"
              align="center"
              width="120"
              label="备注"
            />
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
@@ -1977,6 +2210,65 @@
      </span>
    </el-dialog>
    <!--    工单sop/工序sop-->
    <el-dialog
      v-el-drag-dialog
      class="sop"
      title="设备SOP预览"
      :visible.sync="SopDialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleSopClose"
      @close="handleSopClose"
    >
      <el-form inline label-width="110px" style="display:flex">
        <el-form-item label="工单SOP">
          <el-select
            v-model="dialogSopForm.sop"
            style="width:200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
            @change="sopChange"
          >
            <el-option
              v-for="item in sopArr"
              :key="item.filepath"
              :label="item.filename"
              :value="item.filepath"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="Sop版本">
          <el-input v-model="dialogSopForm.v" disabled style="width: 200px" />
        </el-form-item>
      </el-form>
      <el-button
        v-waves
        type="primary"
        style="margin-left: 37px"
        @click="view"
      >预 览/下 载
      </el-button>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="handleSopClose">取 消</el-button>
          <!--          <el-button-->
          <!--            v-waves-->
          <!--            type="primary"-->
          <!--            :loading="$store.state.app.buttonIsDisabled"-->
          <!--            :disabled="$store.state.app.buttonIsDisabled"-->
          <!--            @click="handleSopConfirm"-->
          <!--          >确 定</el-button>-->
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -1991,8 +2283,8 @@
import {
  AddMesOrderCodeSearch,
  AddUpdateMesOrder, DeleteMesOrder,
  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent,
  MesOrderSearch,
  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent, MesOrderProcessSopSearch,
  MesOrderSearch, MesOrderSopSearch,
  UpdateMesOrderStepSearch
} from '@/api/WorkOrder'
import { PartSelect } from '@/api/ProductModel'
@@ -2001,6 +2293,9 @@
import ElDragSelect from '@/components/DragSelect'
import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
import DateType from '@/components/DateType'
import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings'
import { DeviceSopSearch } from '@/api/DeviceManager'
export default {
  name: 'WorkOrderList',
  components: {
@@ -2066,6 +2361,8 @@
        deliverydate: '', // 交付时间
        data_sources: '', // 数据来源
        routecode: '', // 工艺路线
        mesmaxqty: 0, // 工单的最大值
        mesqtyinit: 0// 工单数量初始值
@@ -2260,7 +2557,22 @@
        { code: 'PE', name: '预计完工日期' },
        { code: 'ED', name: '预计交付日期' },
        { code: 'CT', name: '工单创建日期' }
      ]
      ],
      routecodeArr: [], //
      sourceType: false, // 工序的数据来源
      mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
      SopDialogVisible: false,
      dialogSopForm: { // 设备SOP表单
        sop: '',
        v: ''
      },
      sopArr: [],
      routeCode: '', // 工艺路线code
      partCode: ''
    }
  },
  watch: {
@@ -2284,7 +2596,11 @@
      }
    }
  },
  activated() {   window.addEventListener('resize', this.getHeight)   this.getHeight() }, created() {
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  created() {
    this.handleRequest()
  },
  mounted() {
@@ -2296,6 +2612,57 @@
    // })
  },
  methods: {
    // 弹出框关闭
    handleSopClose() {
      this.SopDialogVisible = false
      this.dialogSopForm = { // 设备SOP表单
        sop: '',
        v: ''
      }
    },
    // 预览
    view() {
      window.open(process.env.VUE_APP_BASE_API_FILE + this.dialogSopForm.sop)
    },
    sopChange(val) {
      this.dialogSopForm.v = this.sopArr.find(i => i.filepath === val).version
    },
    async pre(row, type) {
      if (type === 1) {
        const data = {
          wocode: row.wo_code,
          materielcode: row.partcode
        }
        const { data: res } = await MesOrderSopSearch(data)
        this.sopArr = res
      }
      if (type === 2) {
        const data = {
          materielcode: this.partCode,
          routecode: this.routeCode ? this.routeCode : '',
          stepcode: row.step_code
        }
        const { data: res } = await MesOrderProcessSopSearch(data)
        this.sopArr = res
      }
      this.SopDialogVisible = true
    },
    // 工序来源切换
    sourceTypeChange(val) {
      this.stepTableData = []
      if (val) {
        this.getMesOrderNewStepContent()
      } else {
        if (this.mesSetting.route) {
          this.routecodeChange()
        } else {
          this.getBasicProcessData()
        }
      }
    },
    DateTypeChange(value) {
      this.form.datatype = value
    },
@@ -2534,6 +2901,7 @@
      this.dialogForm.partname = row.partname
      this.dialogForm.partspec = row.partspec
      this.dialogForm.wkshopcode = row.wkshp_code
      this.dialogForm.routecode = row.route_code
      this.dialogForm.deliverydate = row.saleOrderDeliveryDate.substring(0, 11)
      this.dialogForm.mesqty = row.plan_qty
@@ -2547,6 +2915,11 @@
      }
      const { data: res } = await UpdateMesOrderStepSearch(data)
      this.dialogForm.mesmaxqty = res.canupdate_qty
      if (this.mesSetting.route) { // 按工艺路线走模式
        if (!this.dialogForm.routecode) {
          await this.getPartcodeChangeDialog()
        }
      if (res.stepdata.length > 0) {
        res.stepdata.forEach(i => {
@@ -2578,11 +2951,43 @@
          this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
        }
      }
      } else {
        if (res.stepdata.length > 0) {
          res.stepdata.forEach(i => {
            this.stepTableData.push(
              {
                stepcode: i.step_code,
                stepname: i.stepname,
                stepprice: i.stepprice
              }
            )
          })
          this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
        } else {
          await this.getBasicProcessData()
        }
      }
      this.dialogVisible = true
      this.$nextTick(() => {
        this.setSort()
      })
    },
    // 按工序模式走的时候  引用基础资料 工艺
    async getBasicProcessData() {
      const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
      res.sort((a, b) => a.step_seq - b.step_seq)
      this.stepTableData = []
      res.forEach(i => {
        this.stepTableData.push(
          {
            stepcode: i.step_code,
            stepname: i.step_name,
            stepprice: i.unprice
          }
        )
      })
      this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
    },
    // 工单关闭事件
    orderClose() {
@@ -2594,12 +2999,64 @@
      this.dialogForm.partname = this.partArr.find(item => item.partcode === val).partname
      this.dialogForm.partcode = this.partArr.find(item => item.partcode === val).partcode
      this.dialogForm.partspec = this.partArr.find(item => item.partcode === val).partspec
      if (this.dialogForm.wkshopcode) {
        this.getMesOrderNewStepContent()
      this.dialogForm.routecode = ''
      if (this.mesSetting.route) {
        this.getPartcodeChangeDialog()
      } else {
        this.getBasicProcessData()
      }
    },
    async  getMesOrderNewStepContent() {
    async getPartcodeChangeDialog() {
      const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
      this.routecodeArr = res
      // if (this.mesSetting.route) { // 按工艺路线走模式
      this.dialogForm.routecode = this.partArr.find(item => item.partcode === this.dialogForm.partcode).default_route
      if (this.dialogForm.routecode && !this.sourceType) {
        await this.routecodeChange()
      } else {
        await this.getMesOrderNewStepContent()
      }
      // }
      // else { // 按工序走模式
      //   await this.getMesOrderNewStepContent()
      // }
    },
    // 工艺路线值改变
    async routecodeChange() {
      const data = {
        partcode: this.dialogForm.partcode,
        routecode: this.dialogForm.routecode
      }
      const { data: res } = await RouteSelectStep(data)
      this.stepSelectedValue = []
      this.stepTableData = []
      if (res.length > 0) {
        res.sort((a, b) => a.step_seq - b.step_seq)
        res.forEach(i => {
          this.stepTableData.push(
            {
              stepcode: i.step_code,
              // stepname: i.stepname,
              stepprice: i.unprice
            }
          )
        })
        this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
      }
    },
    async getMesOrderNewStepContent() {
      // if (!this.mesSetting.route && this.operation === 'edit') {
      //   return
      // }
      const data = {
        routecode: this.dialogForm.routecode,
        wkshopcode: this.dialogForm.wkshopcode,
        partcode: this.dialogForm.partcode
      }
@@ -2641,6 +3098,9 @@
        deliverydate: '', // 交付时间
        data_sources: '' // 数据来源
      }
      this.sourceType = false
      this.stepSelectedValue = []
      this.stepTableData = []
      this.$refs.dialogForm.clearValidate()
@@ -2695,6 +3155,7 @@
            data_sources: this.dialogForm.data_sources, // 数据来源
            isstep: workListSub.length > 0 ? 'Y' : 'N', //
            difference: this.dialogForm.mesqty - this.dialogForm.mesqtyinit, // 数据差值
            routecode: this.dialogForm.routecode,
            workListSub
          }
@@ -2703,11 +3164,11 @@
            if (res.code === '200') {
              this.dialogVisible = false
              // this.handlePrint()
              this.$message.success(this.operation === 'add' ? '添加成功!' : '派发成功!')
              this.$message.success(this.operation === 'add' ? '添加成功!' : '保存成功!')
              this.getMesOrderSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '派发失败!')
              this.$message.error(this.operation === 'add' ? '添加失败!' : '保存失败!')
            }
          })
        }
@@ -2760,19 +3221,22 @@
      this.dialogVisibleSearch = false
    },
    // 处理打印
    handlePrint(wo_code) {
    handlePrint(wo_code, saleOrderCode) {
      // const number = Math.random() * Math.random()
      // this.number = number === 0 ? (10 + Math.random()) : number
      // console.log(number)
      this.formApprove.saleOrderCode = this.formApprove.saleOrderCode !== '' ? this.formApprove.saleOrderCode : saleOrderCode
      const data2 = {
        mesordercode: wo_code || this.dialogForm.mesordercode
      }
      MesOrderPrintSearch(data2).then(res2 => {
        if (res2.code === '200') {
          const res3 = res2.data.recordset
          this.dialogVisibleApprove = true
          this.tableDataPrint = res3
          const res3 = res2.data.recordset
          // this.tableDataPrint = res3
          this.tableDataPrint = this.chunkArray(res3, 8)
          this.formApprove.mesordercode = res3[0].wo_code
          this.formApprove.m_po = res3[0].m_po || '/'
          this.formApprove.partcode = res3[0].partcode
@@ -2783,17 +3247,20 @@
          this.formApprove.lm_date = res3[0].lm_date
          this.$nextTick(() => {
            res3.forEach(i => {
            this.tableDataPrint.forEach((item, index) => {
              item.forEach(i => {
              this.bindQRCode(i.seq, i.stepqrcode, 'small')
            })
            this.bindQRCode('0', this.formApprove.mesordercode, 'big')
            const div = document.getElementById('qrCode')
            // 这么多代码只需要这一句实现我们所需要的功能,定位div滚动条位置在底部,scrollHeight计算出div的高度,再scrollTop 设置滚动条的高度为多少
              this.bindQRCode(index, this.formApprove.mesordercode, 'big')
              const div = document.getElementById('qrCode' + index)
            div.scrollTop = div.scrollHeight // 滚动条位于最底部
            })
            // const div = document.getElementById('qrCode')
            // 这么多代码只需要这一句实现我们所需要的功能,定位div滚动条位置在底部,scrollHeight计算出div的高度,再scrollTop 设置滚动条的高度为多少
            // div.scrollTop = div.scrollHeight // 滚动条位于最底部
            // div.scrollTop = 0 // 滚动条位于最顶部
          })
          this.dialogVisibleApprove = true
        }
      })
    },
@@ -2806,6 +3273,15 @@
    // 返回按钮
    dialogVisibleBackPreview() {
      this.dialogVisibleApprove = false
    },
    chunkArray(array, size) {
      const chunked = []
      let i = 0
      while (i < array.length) {
        chunked.push(array.slice(i, i + size))
        i += size
      }
      return chunked
    },
    // dialogVisibleConfirmPreview(param) {
    //   this.$refs.dialogForm.validate(valid => {
@@ -2826,8 +3302,7 @@
    // 生成二维码    工单报表二维码
    bindQRCode(seq, text, size) {
      if (size === 'big') {
        console.log(text, 1)
        new QRCode(this.$refs.qrCodeDiv0, {
        new QRCode(this.$refs['qrCodeDiv0' + seq], {
          text: text,
          width: size === 'big' ? 90 : 60,
          height: size === 'big' ? 90 : 60,
@@ -2850,6 +3325,7 @@
    },
    dialogVisibleConfirmClose() {
      this.formApprove.saleOrderCode = ''
      // this.dialogForm.mesordercode = ''
      this.formApprove.mesordercode = ''
      this.formApprove.m_po = ''
@@ -3151,6 +3627,9 @@
    },
    //  行点击事件
    async rowClick(row, event, column) {
      this.formApprove.saleOrderCode = row.saleOrderCode
      this.routeCode = row.route_code ? row.route_code : ''
      this.partCode = row.partcode ? row.partcode : ''
      const data = {
        sourceid: row.sourceid,
        sourcewo: row.m_po,
@@ -3215,6 +3694,34 @@
    },
    stepSelectedValueChange(val) {
      // console.log(val, 123)
    },
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      const i = 9
      columns.forEach((column, index) => {
        if (index === i) {
          sums[index] = '总数'
          return
        }
        const values = data.map(item => Number(item[column.property]))
        if (column.property === 'plan_qty') {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr)
            if (!isNaN(value)) {
              return prev + curr
              // return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100
            }
          }, 0)
          sums[index] += ' 单'
        }
      })
      this.$nextTick(() => {
        this.$refs.tableDataRef.doLayout()
      })
      return sums
    }
  }
}
@@ -3228,6 +3735,13 @@
</style>
<style lang="scss" scoped>
$main_color: #42b983;
.stepSelectedValueClass {
  ::v-deep input {
    //min-height: 34px !important;
    height: 68px !important;
  }
}
.dialogVisibleRoute {
  .myCheckboxGroup {
@@ -3308,6 +3822,12 @@
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
.sop {
  ::v-deep .el-dialog__body {
    padding: 50px 80px !important;
  }
}
.dialogVisibleSearch ::v-deep .el-dialog__body {
@@ -3522,14 +4042,7 @@
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
<style>
.sortable-ghost{
  opacity: .8;
  color: #fff!important;
  background: #42b983!important;
}