huang_an 2 лет назад
Родитель
Сommit
7274d68f77

+ 101 - 0
src/api/maintenance/classifyManage.js

@@ -0,0 +1,101 @@
+import request from '@/utils/request';
+
+export async function getSubPage(data) {
+  const res = await request.get('/main/categoryLevel/getSubPage', {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function saveOrUpdate(data) {
+  const res = await request.post('/main/categoryLevel/saveOrUpdate', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据父级id查分类树
+export async function getTreeByPid(parentId) {
+  const res = await request.get(`/main/categoryLevel/getTreeByPid/${parentId}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 查询所有物品分类
+export async function allCategoryLevel() {
+  const res = await request.get(`/main/categoryLevel/allCategoryLevel`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据type查分类树组
+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));
+}
+
+// 根据类型查分类树
+export async function getTreeByType(type) {
+  const res = await request.get(`/main/categoryLevel/getTreeByType/${type}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 删除分类
+export async function deleteCategory(id) {
+  const res = await request.get(`/main/categoryLevel/delete/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//根据ID查询分类详情系信息
+export async function getInfoById(id) {
+  const res = await request.get(`/main/categoryLevel/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 批次明细
+
+export async function getBatchDetails(data) {
+  const res = await request.get(`/wms/outin/getBatchDetails`, { params: data });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function getDetailById(data) {
+  const res = await request.post(`/wms/outin/getDetailById`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 产品列表
+ */
+export async function getProductList(params) {
+  const res = await request.get(`/main/category/getList`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 171 - 0
src/api/maintenance/outin.js

@@ -0,0 +1,171 @@
+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/outin/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;
+    }
+  }
+};

+ 10 - 0
src/api/maintenance/repair.js

@@ -18,6 +18,16 @@ export async function getWorkOrderDetail(code) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 申请备品备件
+
+export async function applySpareParts(data) {
+  const res = await request.post(`/eam/workorder/applySpareParts`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 // // 保存
 // export async function save (data) {
 //   const res = await request.post('/eam/repairrequest/save', data);

+ 104 - 4
src/views/maintenance/repair/components/WorkOrderTab.vue

@@ -60,6 +60,74 @@
           <div> 故障描述:{{ logs['CREATE'].remark }} </div>
         </div>
       </el-step>
+      <el-step v-if="item.type == 'SPARE_PARTS_APPLY'">
+        <span
+          slot="icon"
+          :class="
+            lastStepName == 'SPARE_PARTS_APPLY'
+              ? 'step_icon step_active'
+              : 'step_icon'
+          "
+        ></span>
+        <div slot="title" class="step_title">
+          <span>备品备件申请</span>
+          <span>{{ logs['SPARE_PARTS_APPLY'].createTime }}</span>
+        </div>
+        <div slot="description" class="work_report_desc">
+          <!-- <div slot="description" class="step_description">
+            <span
+              >申领单号:{{
+                logs['SPARE_PARTS_APPLY'].content.sparePartsCode
+              }}</span
+            >
+          </div> -->
+          <div>
+            <div>申领清单:</div>
+            <el-table :data="item.content.infoList" border>
+              <el-table-column
+                label="备件物品编码"
+                align="center"
+                prop="code"
+              />
+              <el-table-column label="备件名称" align="center" prop="name" />
+              <el-table-column label="所属分类" prop="typeName" align="center">
+                <template slot-scope="{ row }">
+                  <div>备品备件</div>
+                </template>
+              </el-table-column>
+              <el-table-column label="型号" align="center" prop="modelType" />
+              <el-table-column
+                label="使用数量"
+                prop="packingCountBase"
+                align="center"
+              />
+            </el-table>
+          </div>
+        </div>
+      </el-step>
+      <el-step v-if="item.type == 'ACCEPTANCE_CHEK'">
+        <span
+          slot="icon"
+          :class="
+            lastStepName == 'ACCEPTANCE_CHEK'
+              ? 'step_icon step_active'
+              : 'step_icon'
+          "
+        ></span>
+        <div slot="title" class="step_title">
+          <span>验收</span>
+          <span>{{ logs['ACCEPTANCE_CHEK'].createTime }}</span>
+        </div>
+        <div slot="description" class="step_description">
+          <span>验收人:{{ logs['ACCEPTANCE_CHEK'].content.userName }}</span>
+          <span
+            >验收结果:{{
+              logs['ACCEPTANCE_CHEK'].content.orderStatus == 4 ? '通过' : '驳回'
+            }}</span
+          >
+          <span>验收说明:{{ logs['ACCEPTANCE_CHEK'].content.remark }}</span>
+        </div>
+      </el-step>
       <el-step v-if="item.type == 'WORK_REPORT'">
         <span
           slot="icon"
@@ -74,9 +142,7 @@
           <span>{{ logs['WORK_REPORT'].createTime }}</span>
         </div>
         <div slot="description" class="work_report_desc">
-          <div>
-            处理说明:{{ logs['WORK_REPORT'].content.repairReportExplain }}
-          </div>
+          <div> 处理说明:{{ logs['WORK_REPORT'].content.reason }} </div>
           <div class="work_report_imgs" style="width: 50px; height: 50px">
             <img
               v-for="(item, index) in logs['WORK_REPORT'].content
@@ -421,6 +487,27 @@
     watch: {
       repairInfoLogList(val) {
         console.log('接收的值', val);
+        // val.forEach((item) => {
+        //   if (item.type !== 'SPARE_PARTS_APPLY') {
+        //     this.logs[item.type] = {
+        //       id: item.id,
+        //       content: item.content,
+        //       createTime: item.createTime,
+        //       remark: item.remark,
+        //       requestUserName: item.requestUserName
+        //     };
+        //   } else {
+        //     if (item.content.infoList && item.content.infoList.length > 0) {
+        //       item.content.infoList = item.content.infoList.map((item) => {
+        //         return {
+        //           ...JSON.parse(item.sparePartsList),
+        //           sparePartsId: item.sparePartsId
+        //         };
+        //       });
+        //       this.useData.push(item.content.infoList);
+        //     }
+        //   }
+        // });
         val.forEach((item) => {
           this.logs[item.type] = {
             id: item.id,
@@ -429,7 +516,20 @@
             remark: item.remark,
             requestUserName: item.requestUserName
           };
+          if (item.type === 'SPARE_PARTS_APPLY') {
+            this.logs[item.type].content.infoList =
+              this.logs[item.type].content.infoList &&
+              this.logs[item.type].content.infoList.length > 0
+                ? this.logs[item.type].content.infoList.map((item) => {
+                    return {
+                      ...JSON.parse(item.sparePartsList),
+                      sparePartsId: item.sparePartsId
+                    };
+                  })
+                : [];
+          }
         });
+        console.log(this.logs);
         this.logsKeys = Object.keys(this.logs);
         this.lastStepName = this.logsKeys[0];
         // val.forEach((item) => {
@@ -523,7 +623,7 @@
     }
     .step_description {
       display: flex;
-      padding: 5px 10px;
+      padding: 5px 0px;
       background-color: #f2f2f2;
       justify-content: space-between;
       color: #7f7f7f;

+ 639 - 0
src/views/maintenance/repair/workOrder/components/AssetsDialog.vue

@@ -0,0 +1,639 @@
+<template>
+  <el-dialog :visible.sync="visible" :title="`${title}信息`" width="80vw">
+    <el-form :model="searchForm" label-width="100px">
+      <el-row>
+        <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.code"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="5">
+          <el-form-item label="物品名称:">
+            <el-input
+              type="text"
+              placeholder="搜索物品名称"
+              v-model="searchForm.assetName"
+            ></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.barcodes"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col v-if="dimension != 2" :span="6">
+          <el-form-item label="质检结果">
+            <el-select
+              clearable
+              v-model="searchForm.qualityResult"
+              placeholder="请选择质检结果"
+            >
+              <el-option
+                v-for="item in qualityResultOption"
+                :label="item.label"
+                :value="item.value"
+                :key="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col style="text-align: right">
+          <el-button type="primary" @click="doSearch">搜索</el-button>
+          <el-button icon="el-icon-refresh-left" @click="reset">重置</el-button>
+        </el-col>
+      </el-row>
+    </el-form>
+    <el-container class="assets-dialog">
+      <el-aside width="200px" class="wrapper-assets">
+        <AssetTree
+          @handleNodeClick="handleNodeClick"
+          id="6"
+          :type="assetType"
+          ref="treeList"
+          :init="true"
+          paramsType="type"
+        />
+      </el-aside>
+      <el-main>
+        <el-table
+          ref="multipleTable"
+          :data="tableData"
+          tooltip-effect="dark"
+          height="50vh"
+          border
+          row-key="oid"
+          style="width: 100%"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+          @selection-change="handleSelectionChange"
+        >
+          <el-table-column
+            type="selection"
+            :reserve-selection="true"
+            width="55"
+            align="center"
+            :selectable="selectable"
+          >
+          </el-table-column>
+          <el-table-column label="序号" type="index" width="50">
+          </el-table-column>
+          <el-table-column
+            prop="assetCode"
+            label="编码"
+            min-width="120"
+            v-if="dimension != 3 || dimension != 4"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="name"
+            width="200"
+            label="名称"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            :width="item.width"
+            :prop="item.prop"
+            :label="item.label"
+            v-for="(item, index) in tableHeader"
+            :key="index"
+          >
+            <template slot-scope="{ row }">
+              <template v-if="item.formatter">{{
+                item.formatter(row)
+              }}</template>
+              <template v-else>{{ row[item.prop] }}</template>
+            </template></el-table-column
+          >
+          <el-table-column
+            prop="manualBatchNo"
+            label="批号"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 2 || dimension == 3 || dimension == 4"
+            prop="batchNo"
+            label="批次号"
+            min-width="80"
+          ></el-table-column>
+          <el-table-column
+            label="发货条码"
+            prop="barcodes"
+            width="80"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            prop="onlyCode"
+            label="包装编码"
+            min-width="120"
+            :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 == 4"
+            prop="meterielCode"
+            label="物料代号"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 4"
+            prop="clientCode"
+            label="客户代号"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 4"
+            prop="engrave"
+            label="刻码"
+            min-width="120"
+          ></el-table-column>
+
+          <el-table-column
+            prop="packingCountBase"
+            label="包装库存数量"
+            width="120"
+            v-if="dimension != 4"
+          ></el-table-column>
+          <el-table-column
+            prop="minUnit"
+            label="包装单位"
+            v-if="dimension != 4"
+            width="90"
+          ></el-table-column>
+          <el-table-column
+            prop="availableCountBase"
+            label="计量库存数量"
+            width="120"
+          ></el-table-column>
+          <el-table-column
+            prop="measuringUnit"
+            label="计量单位"
+            width="90"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 4"
+            prop="weight"
+            label="重量"
+            min-width="120"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 4"
+            prop="weightUnit"
+            label="重量单位"
+            min-width="120"
+          ></el-table-column>
+          <el-table-column
+            prop="expirationTime"
+            label="周期倒计时"
+            min-width="120"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension != 2"
+            prop="weightUnit"
+            label="质检状态"
+            min-width="120"
+          >
+            <template slot-scope="{ row }">
+              <span v-if="row.qualityStatus == 0">未质检</span>
+              <span v-else-if="row.qualityStatus == 1">已质检</span>
+              <span v-else>-</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            v-if="dimension != 2"
+            prop="weightUnit"
+            label="质检结果"
+            min-width="120"
+          >
+            <template slot-scope="{ row }">
+              <span v-if="row.qualityResult == 0">合格</span>
+              <span v-else-if="row.qualityResult == 1">不合格</span>
+              <span v-else>-</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="pathName"
+            label="仓库"
+            min-width="200"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+
+          <!-- <el-table-column prop="pathName" label="仓库"> </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="pages.size"
+            :current-page.sync="pages.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>
+  </el-dialog>
+</template>
+
+<script>
+  import AssetTree from '@/components/AssetTree';
+  // import { detailSelect } from '@/api/stockManagement/stockLedger';
+  import { deepClone } from '@/utils';
+  import { tableHeader } from './common';
+  import outin from '@/api/maintenance/outin';
+  import {
+    getBatchDetails,
+    getDetailById
+  } from '@/api/maintenance/classifyManage';
+  export default {
+    components: { AssetTree },
+    props: {
+      title: String,
+      assetType: {
+        type: [String, Number],
+        default: ''
+      },
+      warehousingMaterialList: {
+        type: Array,
+        default: () => []
+      }
+    },
+    computed: {
+      tableHeader() {
+        return tableHeader(this.assetType);
+      }
+    },
+
+    data() {
+      return {
+        qualityResultOption: [
+          {
+            value: 0,
+            label: '合格'
+          },
+          {
+            value: 1,
+            label: '不合格'
+          }
+        ],
+        qualityStatusOption: [
+          {
+            value: 1,
+            label: '已质检'
+          },
+          {
+            value: 0,
+            label: '未质检'
+          }
+        ],
+        visible: false,
+        tableData: [],
+        total: 0,
+        pages: {
+          pageNum: 1,
+          size: 10
+        },
+        searchForm: {
+          code: '',
+          assetName: '',
+          batchNo: '',
+          engrave: '',
+          barcodes: '',
+          qualityResult: ''
+        },
+        selectionList: [],
+        materialType: '',
+        warehouseList: [],
+        dimension: '4'
+      };
+    },
+    created() {},
+    methods: {
+      changeDimensionHandler(e) {
+        // this.$refs.multipleTable.clearSelection();
+        // this.selectionList = [];
+        this.pages.pageNum = 1;
+        this.changeDimension(e);
+      },
+      async changeDimension(e, is) {
+        // await this.$refs.multipleTable.clearSelection();
+        // this.selectionList = [];
+        console.log('===1', this.warehousingMaterialList);
+        console.log('===2', e);
+        // if (is != 'page') {
+        //   this.$refs.multipleTable.clearSelection();
+        // }
+        this.dimension = e;
+        let res = {};
+        const params = {
+          ...this.pages,
+          ...this.searchForm,
+          dimension: e
+        };
+        if (this.materialType) {
+          params.categoryLevelId = this.materialType;
+        }
+        const loading = this.$loading({
+          target: '.assets-dialog'
+        });
+        if (e == 2) {
+          res = await getBatchDetails(params);
+          this.tableData = res.list.map((item) => {
+            return {
+              ...item,
+              minUnit: item.packingUnit,
+              oid: item.stockBatchId,
+              assetCode: item.code
+            };
+          });
+        } else if (e == 3) {
+          res = await outin.getInventoryDetails(params);
+          this.tableData = res.list.map((item) => {
+            return {
+              ...item,
+              batchNo: item.batchNum,
+              minUnit: item.packingUnit,
+              // availableCountBase: 1,
+              packingCountBase: 1,
+              oid: item.id,
+              assetCode: item.code
+            };
+          });
+        } else if (e == 4) {
+          res = await outin.getMaterielDetails(params);
+          this.tableData = res.list.map((item, index) => {
+            return {
+              ...item,
+              availableCountBase: 1,
+              packingCountBase: 1,
+              minUnit: item.packingUnit,
+              oid: item.id + this.pages.pageNum + (index + 1)
+            };
+          });
+          console.log('===', this.tableData);
+        } else {
+          res = await outin.getRealTimeInventory(params);
+          this.tableData = res.list.map((item) => {
+            return { ...item, oid: item.id, assetCode: item.code };
+          });
+        }
+
+        if (res) {
+          this.total = res.count;
+          // this.selectionList = deepClone(this.warehousingMaterialList);
+
+          this.$nextTick(() => {
+            this.tableData.forEach((item) => {
+              const index = this.warehousingMaterialList.findIndex((i) =>
+                this.dimension == 1 || this.dimension == 3
+                  ? item.id == i.id
+                  : this.dimension == 2
+                  ? item.stockBatchId == i.stockBatchId
+                  : item.oid == i.oid
+              );
+              if (index > -1) {
+                // 删除还给 multipleSelection
+                this.$refs.multipleTable.toggleRowSelection(item, true);
+              }
+            });
+          });
+        }
+        loading.close();
+      },
+      selectable(row, index) {
+        if (row.canUsedCount != 0) {
+          return true;
+        } else {
+          return false;
+        }
+      },
+      open() {
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.treeList.getTreeData();
+          // this.doSearch()
+        });
+      },
+      async handleExit(arr) {
+        console.log('arr=====', arr);
+        console.log('this.dimension', this.dimension);
+        let ids = null;
+        let batchIds = null;
+        let materielIds = null;
+        if (this.dimension == 3) {
+          ids = arr.map((item) => {
+            return item.id;
+          });
+        } else if (this.dimension == 2) {
+          ids = arr.map((item) => {
+            return item.recordId;
+          });
+          batchIds = arr.map((item) => {
+            return item.stockBatchId;
+          });
+        } else if (this.dimension == 4) {
+          materielIds = arr.map((item) => {
+            return item.materielId;
+          });
+          ids = arr.map((item) => {
+            return item.recordId;
+          });
+        } else {
+          ids = arr.map((item) => {
+            return item.recordId;
+          });
+        }
+        let categoryIds = arr.map((item) => {
+          return item.id;
+        });
+        let batchNos = arr.map((item) => {
+          return item.batchNo;
+        });
+        let outInDetailIds = arr.map((item) => {
+          return item.outInDetailId;
+        });
+        const parmas = {
+          categoryLevelId: this.materialType,
+          type: this.dimension,
+          categoryIds,
+          batchNos,
+          batchIds,
+          ids,
+          outInDetailIds,
+          materielIds
+        };
+        console.log(parmas);
+        const data = await getDetailById(parmas);
+        return data;
+      },
+      async confirm() {
+        if (!this.selectionList.length) {
+          this.$message.error('请至少选择一条数据!');
+          return;
+        }
+        const data = await this.handleExit(this.selectionList);
+        let arr = [];
+        if (this.dimension == 4) {
+          arr = this.selectionList.map((item) => {
+            return { ...item, assetName: item.name };
+          });
+        }
+        this.$emit('detailData', { ...data, wlList: arr }, this.dimension);
+
+        // this.$emit('selectTableData', this.selectionList);
+        this.cancel();
+      },
+      cancel() {
+        this.multipleSelection = [];
+        this.$refs.multipleTable.clearSelection();
+        this.visible = false;
+      },
+      handleSelectionChange(val) {
+        for (const key in val) {
+          val[key].categoryId = val[key].id;
+        }
+        this.selectionList = val;
+      },
+      handleNodeClick(data) {
+        this.materialType = data.id === data.originId ? '' : data.id;
+        this.doSearch();
+      },
+      handleCurrentChange() {
+        // this.getList();
+        this.changeDimension(this.dimension, 'page');
+      },
+      reset() {
+        this.searchForm.code = '';
+        this.searchForm.assetName = '';
+        this.searchForm.batchNo = '';
+        this.searchForm.engrave = '';
+        this.searchForm.barcodes = '';
+        this.searchForm.qualityStatus = '';
+        this.doSearch();
+      },
+      doSearch() {
+        this.pages.pageNum = 1;
+        // this.getList();
+        this.changeDimension(this.dimension);
+      },
+      handleSizeChange() {
+        this.pages.pageNum = 1;
+        // this.getList();
+        this.changeDimension(this.dimension, 'page');
+      }
+      // async getList() {
+      //   const params = {
+      //     ...this.pages,
+      //     ...this.searchForm,
+      //     dimension: this.dimension
+      //     // code: 5
+      //   };
+
+      //   if (this.materialType) {
+      //     params.categoryLevelId = this.materialType;
+      //   }
+
+      //   const res = await outin.getMaterielDetails(params);
+
+      //   if (res) {
+      //     this.tableData = res.list.map((item, index) => {
+      //       return {
+      //         ...item,
+      //         oid: index + 1 + (this.pages.pageNum - 1) * this.pages.size
+      //       };
+      //     });
+      //     this.total = res.count;
+      //     // this.selectionList = deepClone(this.warehousingMaterialList);
+      //     console.log(' this.tableData==', this.tableData);
+      //     this.$nextTick(() => {
+      //       this.tableData.forEach((item) => {
+      //         const index = this.warehousingMaterialList.findIndex((i) =>
+      //           this.dimension == 1 || this.dimension == 3
+      //             ? item.id == i.id
+      //             : this.dimension == 2
+      //             ? item.stockBatchId == i.stockBatchId
+      //             : item.meterielId == i.meterielId
+      //         );
+      //         if (index > -1) {
+      //           // 删除还给 multipleSelection
+      //           this.$refs.multipleTable.toggleRowSelection(item, true);
+      //         }
+      //       });
+      //     });
+      //   }
+      // }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .el-dialog__wrapper {
+    ::v-deep .el-aside {
+      background-color: #fff !important;
+      border: 1px solid #ccc;
+    }
+  }
+
+  .wrapper-assets {
+    max-height: 53vh;
+    overflow: auto;
+  }
+</style>

+ 106 - 0
src/views/maintenance/repair/workOrder/components/common.js

@@ -0,0 +1,106 @@
+export const tableHeader = (selectEquiType) => {
+  switch (+selectEquiType) {
+    case 3:
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    case 8:
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    case 4:
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    case 9:
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    case 5: //'周转车'
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' },
+        {
+          label: '材质',
+          prop: 'texture',
+          formatter(row) {
+            if (!row?.extendField) return '';
+            const extendField = JSON.parse(row.extendField);
+            return extendField.texture;
+          }
+        },
+        {
+          label: '长宽高',
+          prop: '',
+          formatter(row) {
+            if (!row?.extendField) return '';
+            const extendField = JSON.parse(row.extendField);
+            return `${extendField.length || '-'}*${extendField.width || '-'}*${
+              extendField.high || '-'
+            }`;
+          }
+        }
+      ];
+    case 2: //'舟皿'
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' },
+        {
+          label: '长宽高',
+          prop: '',
+          formatter(row) {
+            if (!row?.extendField) return '';
+            const extendField = JSON.parse(row.extendField);
+            return `${extendField.length || '-'}*${extendField.width || '-'}*${
+              extendField.high || '-'
+            }`;
+          }
+        }
+      ];
+    case 1: //'设备'
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    case 6: //'模具'
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' },
+        {
+          label: '收缩系数',
+          prop: '',
+          formatter(row) {
+            if (!row?.extendField) return '';
+            const extendField = JSON.parse(row.extendField);
+            return extendField.shrinkageCoefficient;
+          }
+        }
+      ];
+    case 7: //'备品备件'
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+    default:
+      return [
+        { label: '型号', prop: 'modelType', width: '150' },
+        { label: '规格', prop: 'specification', width: '150' },
+        { label: '牌号', prop: 'brandNum', width: '50' }
+      ];
+  }
+
+  return [];
+};

+ 229 - 24
src/views/maintenance/repair/workOrder/index.vue

@@ -22,14 +22,15 @@
         </template> -->
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <!-- <el-link
+          <el-link
+            v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
             type="primary"
             :underline="false"
             icon="el-icon-truck"
-            @click="addSpareItems"
+            @click="addSpareItems(row)"
           >
             申请备品备件
-          </el-link> -->
+          </el-link>
           <el-link
             v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
             type="primary"
@@ -66,31 +67,48 @@
     <!-- 转派弹窗 -->
     <redeployOther ref="redeployOtherRef" @refresh="reload" />
     <!-- 备件弹窗 -->
-    <AddSpareDialog
+    <AssetsDialog
+      ref="assetsDialogRef"
+      title="备品备件"
+      :warehousingMaterialList="selectionList"
+      :assetType="6"
+      @detailData="detailData"
+    />
+    <!-- <AddSpareDialog
       ref="addSpareDialogRef"
       :selectedSpare="selectedSpare"
       @submit="spareItemSelectSubmit"
-    />
+    /> -->
   </div>
 </template>
 
 <script>
   import WorkorderSearch from './components/workorder-search.vue';
   import AddSpareDialog from '@/components/addSpareDialog';
+  import AssetsDialog from './components/AssetsDialog.vue';
   import RepairReportingWork from '../components/repairReportingWork.vue';
   import RepairDetailsDialog from '../components/RepairDetailsDialog.vue';
   import redeployOther from '@/views/maintenance/components/redeployOther.vue';
-  import { getWorkOrderList } from '@/api/maintenance/repair';
+  import { getWorkOrderList, applySpareParts } from '@/api/maintenance/repair';
+  import outin from '@/api/maintenance/outin';
   export default {
     components: {
       WorkorderSearch,
       RepairDetailsDialog,
       redeployOther,
       AddSpareDialog,
-      RepairReportingWork
+      RepairReportingWork,
+      AssetsDialog
     },
     data() {
       return {
+        currentRow: {},
+        warehousingMaterialList: [],
+        batchDetailsVOList: [],
+        materialCodeReqList: [],
+        selectionList: [],
+        wlParams: {},
+        materialObj: {},
         // 表格列配置
         columns: [
           {
@@ -118,49 +136,49 @@
           },
           {
             prop: 'planName',
-            label: '计划名称',
+            label: '维修名称',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'equiCode',
-            label: '设备编号',
+            prop: 'ruleName',
+            label: '规则名称',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'equiName',
-            label: '设备名称',
+            prop: 'createUserName',
+            label: '创建人',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'executeUserName',
-            label: '执行人',
+            prop: 'createTime',
+            label: '创建时间',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'planFinishTime',
-            label: '计划完成时间',
+            prop: 'acceptTime',
+            label: '开始时间',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'acceptTime',
-            label: '开工时间',
+            prop: 'finishTime',
+            label: '结束时间',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'finishTime',
-            label: '报工时间',
+            prop: 'planFinishTime',
+            label: '计划完成时间',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
@@ -192,7 +210,8 @@
                 0: '待接收',
                 1: '已接收',
                 2: '执行中',
-                3: '已完成'
+                3: '已完成',
+                4: '已验收'
               }[row.orderStatus];
             }
           },
@@ -213,11 +232,197 @@
         isBindPlan: false
       };
     },
-    computed: {},
     methods: {
+      async handleNewSave() {
+        let userInfo = JSON.parse(localStorage.getItem('info'));
+        let obj = {
+          fromUser: userInfo.userId,
+          bizType: '4', // 领用出库
+          extInfo: {
+            assetType: 6,
+            verifyDeptCode: userInfo.deptId[0],
+            verifyDeptName: userInfo.deptName
+          },
+          type: 2,
+          fromType: 2
+        };
+        obj = { ...obj, ...this.wlParams };
+        if (this.dimension == 4) {
+          obj.num = this.materialObj.wlList.length;
+        } else {
+          obj.num = this.materialCodeReqList.length;
+        }
+        obj.storageSource = 1;
+        try {
+          const res = await outin.saveNew(obj);
+          if (res.code == 0) {
+            let arr = obj.realTimeInventoryNewPOList.map((item) => {
+              return {
+                sparePartsId: item.id,
+                sparePartsList: JSON.stringify({
+                  ...item,
+                  inventoryDetailsNewPOList: [],
+                  inventoryDetailsVOList: [],
+                  outInIds: res.data
+                })
+              };
+            });
+            applySpareParts({
+              workOrderId: this.currentRow.id,
+              infoList: arr
+            }).then((res) => {
+              this.$message.success('申请成功!');
+            });
+          }
+        } catch (error) {
+          console.log(error);
+        }
+      },
+      detailData(data, dimension) {
+        this.dimension = dimension;
+        console.log('总数居', data);
+        // this.onSelectTableDataVal = data.realTimeInventoryVOList;
+        this.warehousingMaterialList = data.realTimeInventoryVOList.map(
+          (next) => {
+            delete next.updateTime;
+            delete next.createTime;
+            return {
+              ...next,
+              realInventoryAmount: 0,
+              assetType: 6,
+              outInNum: '',
+              assetCode: next.code,
+              assetName: next.name,
+              bizStatus: 2,
+              contactCode: next.contactCode
+            };
+          }
+        );
+        // this.batchDetailsVOList = data.batchDetailsVOList;
+
+        if (dimension == 4) {
+          this.materialCodeReqList = data.wlList;
+          this.selectionList = data.wlList;
+
+          let params = {
+            realTimeInventoryNewPOList: data.realTimeInventoryVOList
+          };
+
+          for (const item of params.realTimeInventoryNewPOList) {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+
+            for (const detail of item.inventoryDetailsNewPOList) {
+              detail.outInMaterialDetailsAddPOList = [];
+
+              for (const wlItem of data.wlList) {
+                if (detail.id === wlItem.recordId) {
+                  detail.outInMaterialDetailsAddPOList.push({
+                    ...wlItem
+                  });
+                }
+              }
+            }
+          }
+          this.wlParams = params;
+          this.materialObj = data;
+        } else if (dimension == 3) {
+          //包装维度出库
+          const list = data.realTimeInventoryVOList;
+          //获取包装维度
+          let packArr = [];
+          for (const item of list) {
+            if (item.inventoryDetailsVOList.length != 0) {
+              for (const iterator of item.inventoryDetailsVOList) {
+                packArr.push({ ...iterator, batchNo: iterator.batchNum });
+              }
+            }
+          }
+          this.batchDetailsVOList = packArr.map((item) => {
+            return {
+              ...item,
+              packingCountBase:
+                dimension == 4 || dimension == 3 ? 1 : item.packingCountBase
+              // weight: 0
+            };
+          });
+          //物料维度数据
+          let meteArr = [];
+          for (const item of packArr) {
+            if (item.materialDetailsVOList.length != 0) {
+              for (const iterator of item.materialDetailsVOList) {
+                meteArr.push({
+                  ...iterator
+                });
+              }
+            }
+          }
+          this.materialCodeReqList = meteArr;
+          //再次打开选择上
+          this.selectionList = list;
+          //send数据
+          this.wlParams = { realTimeInventoryNewPOList: list };
+          this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+            item.inventoryDetailsNewPOList.forEach((ite) => {
+              // ite.weight = 0;
+              ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
+            });
+          });
+        } else {
+          //   else if (dimension == 2) {
+          //   this.batchDetailsVOList = data.wlList;
+          //   this.selectionList = data.wlList;
+          // }
+          //物品维度出库
+          console.log(data);
+          const list = data.realTimeInventoryVOList;
+          //获取包装维度
+          let packArr = [];
+          for (const item of list) {
+            if (item.inventoryDetailsVOList.length != 0) {
+              for (const iterator of item.inventoryDetailsVOList) {
+                packArr.push({ ...iterator, batchNo: iterator.batchNum });
+              }
+            }
+          }
+          this.batchDetailsVOList = packArr.map((item) => {
+            return {
+              ...item,
+              packingCountBase: dimension == 3 ? 1 : item.packingCountBase
+              // weight: 0
+            };
+          });
+          //物料维度数据
+          let meteArr = [];
+          for (const item of packArr) {
+            if (item.materialDetailsVOList.length != 0) {
+              for (const iterator of item.materialDetailsVOList) {
+                meteArr.push({
+                  ...iterator
+                });
+              }
+            }
+          }
+          this.materialCodeReqList = meteArr;
+          //再次打开选择上
+          this.selectionList = list;
+          //send数据
+          this.wlParams = { realTimeInventoryNewPOList: list };
+          this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+            item.inventoryDetailsNewPOList.forEach((ite) => {
+              // ite.weight = 0;
+              ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
+            });
+          });
+        }
+        this.handleNewSave();
+      },
       // 添加备品备件
-      addSpareItems() {
-        this.$refs.addSpareDialogRef.open();
+      addSpareItems(row) {
+        this.currentRow = row;
+        this.$refs.assetsDialogRef.open();
+        // this.$refs.addSpareDialogRef.open();
         // if (!this.clickedTreeNode) {
         //   return this.$message.warning('请选择设备分类!');
         // }