Explorar o código

feat(create): 添加生产计划详情展示功能

xieyong hai 4 días
pai
achega
c515ab3cf0
Modificáronse 2 ficheiros con 69 adicións e 1 borrados
  1. 12 0
      src/api/entrust/index.js
  2. 57 1
      src/views/entrust/components/create.vue

+ 12 - 0
src/api/entrust/index.js

@@ -92,6 +92,18 @@ export async function pleaseEntrustGoodsDetail(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//根据请托单查生产计划详情
+export async function productionPlanDetails(applyId) {
+  const res = await request.get(
+    '/mes/please_entrust_management/productionPlanDetails',
+    { params: { applyId } }
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 //获取工单的所有物品清单
 export async function pleaseEntrustAllGoodsDetail(data) {
   const res = await request.post(

+ 57 - 1
src/views/entrust/components/create.vue

@@ -263,6 +263,45 @@
           </el-date-picker>
         </template>
       </ele-pro-table>
+
+      <headerTitle
+        title="生产计划详情"
+        style="margin-top: 15px"
+        v-if="type == 'detail'"
+      ></headerTitle>
+
+      <el-table
+        v-if="type == 'detail'"
+        :data="productionPlanList"
+        border
+        stripe
+        style="width: 100%; margin-top: 10px"
+      >
+        <el-table-column
+          prop="code"
+          label="计划编号"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="createUserName"
+          label="创建人"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="measuringUnit"
+          label="单位"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="requiredFormingNum"
+          label="数量"
+          align="center"
+          show-overflow-tooltip
+        />
+      </el-table>
     </el-form>
 
     <template v-slot:footer v-if="type != 'detail'">
@@ -286,7 +325,8 @@
     save,
     addSubmit,
     pleaseEntrustDetail,
-    update
+    update,
+    productionPlanDetails
   } from '@/api/entrust/index';
   import produceOrder from './produceOrder.vue';
   import detail from '@/views/bpm/processInstance/detail.vue';
@@ -376,6 +416,7 @@
         produceTaskList: [],
         factoryList: [],
         orderList: [],
+        productionPlanList: [],
         selection: [],
         current: null,
         columns: [
@@ -603,6 +644,7 @@
       open(type, row) {
         this.visible = true;
         this.orderList = [];
+        this.productionPlanList = [];
         if (type == 'add') {
           this.form.pleaseEntrustDeptName =
             this.$store.state.user.info.groupName;
@@ -625,6 +667,10 @@
         this.type = type;
 
         this.title = type == 'add' ? '新增' : type == 'edit' ? '修改' : '详情';
+
+        if (type == 'detail') {
+          this.getProductionPlanDetails(row.id);
+        }
       },
 
       addOder() {
@@ -729,6 +775,7 @@
       cancel() {
         this.form = { ...defaultForm() };
         this.produceTaskList = [];
+        this.productionPlanList = [];
         this.visible = false;
       },
       choose(list) {
@@ -942,6 +989,15 @@
       async getUserList(groupId) {
         const { list } = await getUserPage({ pageNum: 1, size: -1, groupId });
         this.userList = list || [];
+      },
+      async getProductionPlanDetails(applyId) {
+        try {
+          const list = await productionPlanDetails(applyId);
+          this.productionPlanList = list || [];
+        } catch (error) {
+          console.error('加载生产计划详情失败:', error);
+          this.productionPlanList = [];
+        }
       }
     }
   };