695593266@qq.com пре 11 месеци
родитељ
комит
bbeda1f9e9

+ 28 - 2
src/api/produce/workOrder.js

@@ -38,8 +38,34 @@ export async function pickTaskReportPage(data) {
 }
 
 // 查询 工序的工步列表
-export async function listByParam(id) {
-  const res = await request.get('/main/categoryparamstep/listByParamId/' + id);
+export async function listByParam(params) {
+  const res = await request.get('/main/categoryparamstep/listByWorkerOrder',{params: params});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 工步生产时间
+ * @param data
+ * @returns {Promise<*>}
+ */
+export async function addStepWorkTime(data) {
+  const res = await request.post('/main/categoryparamstep/produceStepWorkTime', data)
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 获取工步工时记录
+ * @param produceStepWorkTimeId
+ * @returns {Promise<*>}
+ */
+export async function listStepWorkTimeRecord(produceStepWorkTimeId) {
+  const res = await request.get(`/main/categoryparamstep/listStepWorkTimeRecord/${produceStepWorkTimeId}`)
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 9 - 9
src/views/outsourcing/components/details.vue

@@ -7,8 +7,8 @@
             <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
 
             <el-row :gutter="15">
-               
-            
+
+
                 <el-col :span="8">
                     <el-form-item label="委外单编码:" prop="code">
                         <el-input v-model="row.code" disabled />
@@ -19,7 +19,7 @@
                         <el-input v-model="row.name" disabled />
                     </el-form-item>
                 </el-col>
-     
+
                 <el-col :span="8">
                     <el-form-item label="工单编码:" prop="factoriesName">
                         <el-input v-model="row.workOrderCode" style="width: 100%" disabled>
@@ -43,10 +43,10 @@
                         <el-tag>{{ row.status == 1 ? '已发布' : '未发布' }}</el-tag>
                     </el-form-item>
                 </el-col>
-                
+
 
             </el-row>
-       
+
         </el-form>
 
 
@@ -99,7 +99,7 @@ export default {
     data() {
         return {
             visible: false,
-            detailType: null,
+            detailTitle: null,
             row:{}
         }
     },
@@ -273,12 +273,12 @@ export default {
 
         open(row) {
             this.visible = true
-            if (row.detailType == 1) {
+            if (row.detailTitle == 1) {
                 this.detailType = 1
                 this.$nextTick(() => {
                     this.$refs.table.setData([...row.detailList]);
                 })
-            } else if (row.detailType == 2) {
+            } else if (row.detailTitle == 2) {
                 this.detailType = 2
                 this.$nextTick(() => {
                     this.$refs.table2.setData([...row.detailList]);
@@ -306,4 +306,4 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>

+ 33 - 5
src/views/produce/components/workStep/details.vue

@@ -11,7 +11,7 @@
     @close="handleClose"
   >
     <ele-pro-table
-      v-if="title == '注意事项'"
+      v-if="title === '物品清单'"
       style="min-height: 400px"
       ref="fileTable"
       :columns="columns"
@@ -66,7 +66,28 @@
           {
             label: '编码',
             prop: 'code',
-            width: 110,
+            minWidth: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '名称',
+            prop: 'name',
+            minWidth: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            minWidth: 200,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '型号',
+            prop: 'modelType',
+            minWidth: 120,
             align: 'center',
             showOverflowTooltip: true
           }
@@ -82,9 +103,16 @@
             showOverflowTooltip: true
           },
           {
-            label: '编码',
-            prop: 'code',
-            width: 110,
+            label: '排序',
+            prop: 'sort',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '注意事项',
+            prop: 'content',
+            minWidth: 300,
             align: 'center',
             showOverflowTooltip: true
           }

+ 85 - 61
src/views/produce/components/workStep/index.vue

@@ -1,6 +1,6 @@
 <template>
   <ele-modal
-    title="弹窗示例"
+    title="工序工步列表"
     :maxable="true"
     custom-class="ele-dialog-form long-dialog-form"
     :centered="true"
@@ -18,7 +18,7 @@
     >
       <template v-slot:starttime="{ row, $index }">
         <el-date-picker
-          v-model="row.starttime"
+          v-model="row.startTime"
           type="datetime"
           value-format="yyyy-MM-dd HH:mm:ss"
           placeholder="选择开始日期"
@@ -27,7 +27,7 @@
       </template>
       <template v-slot:endtime="{ row, $index }">
         <el-date-picker
-          v-model="row.endtime"
+          v-model="row.endTime"
           type="datetime"
           value-format="yyyy-MM-dd HH:mm:ss"
           placeholder="选择结束日期"
@@ -35,19 +35,26 @@
         </el-date-picker>
       </template>
       <template v-slot:wuping="{ row }">
-        <el-button type="primary" @click="goDetails(row, 'wuping')"
-          >物品({{ dataLeng(row, 'wuping') }})</el-button
+        <el-button type="primary" @click="goDetails(row, 'toolList')"
+          >物品({{ dataLeng(row, 'toolList') }})</el-button
         >
       </template>
       <template v-slot:zysx="{ row }">
-        <el-button type="primary" @click="goDetails(row, 'zysx')"
-          >注意事项({{ dataLeng(row, 'zysx') }})</el-button
+        <el-button type="primary" @click="goDetails(row, 'postscriptList')"
+          >注意事项({{ dataLeng(row, 'postscriptList') }})</el-button
         >
       </template>
       <template v-slot:action="{ row }">
         <el-link type="primary" @click="saveData(row)" :underline="false"
           >保存</el-link
         >
+        <el-link
+          v-if="row.hasStepWorkTimeRecord"
+          type="primary"
+          @click="showWorkTimeHistoryDialog(row)"
+          :underline="false"
+          >报工记录</el-link
+        >
       </template>
       <!-- 表头工具栏 -->
     </ele-pro-table>
@@ -56,15 +63,22 @@
       :detailsVisible="detailsVisible"
       @close="close"
       :list="list"
+      :title="detailTitle"
     />
+    <WorkTimeHistory
+      :details-visible="stepWorkTimeDialogVisible"
+      :produceStepWorkTimeId="produceStepWorkTimeId"
+      @close="stepWorkDialogClose"/>
   </ele-modal>
 </template>
 
 <script>
   import Details from './details.vue';
-  import { listByParam } from '@/api/produce/workOrder';
+  import WorkTimeHistory from './workTimeHistory.vue';
+  import { listByParam, addStepWorkTime, listStepWorkTimeRecord } from '@/api/produce/workOrder';
+  import dayjs from 'dayjs';
   export default {
-    components: { Details },
+    components: { WorkTimeHistory, Details },
     data() {
       return {
         visible: false,
@@ -100,7 +114,7 @@
           },
           {
             slot: 'wuping',
-            label: '物品',
+            label: '物品清单',
             prop: 'wuping',
             width: 130,
             align: 'center',
@@ -116,8 +130,8 @@
           },
           {
             label: '工时',
-            prop: 'hs',
-            width: 100,
+            prop: 'totalTimeStr',
+            width: 150,
             align: 'center',
             showOverflowTooltip: true
           },
@@ -148,47 +162,13 @@
             showOverflowTooltip: true
           }
         ],
-        workList: [
-          {
-            name: '哈哈哈哈哈哈哈',
-            timeFlag: false
-          },
-          {
-            name: '哈哈哈哈哈哈哈',
-            time: '',
-            timeFlag: true
-          },
-          {
-            name: '哈哈哈哈哈哈哈',
-            wuping: [
-              {
-                code: '物品'
-              }
-            ]
-          },
-          {
-            name: '哈哈哈哈哈哈哈',
-            zysx: [
-              {
-                code: '注意事项'
-              }
-            ]
-          },
-          {
-            name: '哈哈哈哈哈哈哈'
-          },
-          {
-            name: '哈哈哈哈哈哈哈'
-          },
-          {
-            name: '哈哈哈哈哈哈哈'
-          },
-          {
-            name: '哈哈哈哈哈哈哈'
-          }
-        ],
+        workList: [],
         detailsVisible: false,
-        list: []
+        list: [],
+        detailTitle: null,
+        queryParam: {},
+        stepWorkTimeDialogVisible: false,
+        produceStepWorkTimeId: null,
       };
     },
     computed: {
@@ -202,24 +182,64 @@
       }
     },
     methods: {
-      open(id) {
-        console.log(id, 'id ----');
+      open(queryParam) {
+        this.queryParam = queryParam;
         this.visible = true;
-        this.getList(id);
+        this.getList();
       },
-      getList(id) {
-        listByParam(id)
+      getList() {
+        listByParam(this.queryParam)
           .then((res) => {
-            console.log(res, 'res ---');
+            this.workList = res;
           })
           .catch((err) => {
-            console.log(err, 'err');
+            this.$message.error('获取数据失败');
           });
       },
       //   保存
       saveData(row) {
         // 注意判断时间 是否填写
-        console.log('这里做最后的提交', row);
+        if (!row.startTime) {
+          this.$message.warning('请选择开始时间');
+          return;
+        }
+        // 判断结束时间大于开始时间
+        if (row.endTime) {
+          const startTime = dayjs(row.startTime);
+          const endTime = dayjs(row.endTime);
+          const isEndAfterStart = endTime.isAfter(startTime)
+          if (!isEndAfterStart) {
+            this.$message.warning('结束时间必须大于开始时间,请重新选择结束时间')
+            return;
+          }
+        }
+        const formData = {
+          produceStepId: row.stepId, // 工步ID,
+          taskId: row.paramId, // 工艺ID
+          workOrderId: this.queryParam.workOrderId, // 工单ID
+          startTime: row.startTime,
+          endTime: row.endTime
+        };
+        const loading = this.$messageLoading('保存中...');
+        addStepWorkTime(formData)
+          .then((res) => {
+            loading.close();
+            if (res) {
+              this.$message.success('保存成功');
+              this.getList();
+            } else {
+              this.$message.error('保存失败');
+            }
+          })
+          .catch((e) => {
+            loading.close();
+            this.$message.error('保存失败');
+          });
+      },
+      showWorkTimeHistoryDialog(row) {
+        if (!row.produceStepWorkTimeId) return;
+        this.produceStepWorkTimeId = row.produceStepWorkTimeId
+        this.stepWorkTimeDialogVisible = true;
       },
       handleClose() {
         this.visible = false;
@@ -227,11 +247,15 @@
       close() {
         this.detailsVisible = false;
       },
+      stepWorkDialogClose() {
+        this.stepWorkTimeDialogVisible = false;
+      },
       goDetails(row, type) {
-        if (!row[type] || row[type].length == 0) {
+        if (!row[type] || row[type].length === 0) {
           return this.$message.warning('暂无详细数据');
         }
         this.list = row[type];
+        this.detailTitle = type === 'toolList' ? '物品清单' : '注意事项';
         this.detailsVisible = true;
       }
     }

+ 102 - 0
src/views/produce/components/workStep/workTimeHistory.vue

@@ -0,0 +1,102 @@
+<template>
+  <ele-modal
+    title="报工记录"
+    :maxable="true"
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="detailsVisible"
+    :close-on-click-modal="false"
+    width="35%"
+    append-to-body
+    @close="handleClose"
+  >
+    <ele-pro-table
+      style="min-height: 400px"
+      ref="fileTable"
+      :columns="columns"
+      :datasource="datasource"
+    >
+    </ele-pro-table>
+  </ele-modal>
+</template>
+<script>
+  import { listStepWorkTimeRecord } from '@/api/produce/workOrder';
+
+  export default {
+    props: {
+      produceStepWorkTimeId: {
+        type: String,
+        default: () => []
+      },
+      detailsVisible: {
+        type: Boolean,
+        default: false
+      }
+    },
+    watch: {
+      list: {
+        hanlder(newVal) {
+          this.list = newVal;
+        }
+      },
+      produceStepWorkTimeId(newVal) {
+        this.produceStepWorkTimeId = newVal;
+        this.$refs.fileTable.reload();
+      }
+    },
+    data() {
+      return {
+        // 物品列表
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '开始时间',
+            prop: 'startTime',
+            minWidth: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '结束时间',
+            prop: 'endTime',
+            minWidth: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '工时',
+            prop: 'totalTimeStr',
+            minWidth: 200,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '保存时间',
+            prop: 'createTime',
+            minWidth: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ],
+      };
+    },
+    methods: {
+      handleClose() {
+        this.$emit('close');
+      },
+      datasource({ page, where }) {
+        if (!this.produceStepWorkTimeId) {
+          return null;
+        }
+        return listStepWorkTimeRecord(this.produceStepWorkTimeId);
+      }
+    }
+  };
+</script>

+ 9 - 3
src/views/produce/index.vue

@@ -329,8 +329,10 @@
         reportNeedFeed: 0, //生产质检是否需要处置再报工1是0否
         singleReportInspection: null, //获取选中的工单是单个还是批量
         workTaskId: null, //选中的工单工序id
-        workData: {},
-        isDisable: false
+        workStepQueryParam: {
+          taskId: null,
+          workOrderId: null
+        }
       };
     },
 
@@ -496,6 +498,10 @@
       workSelect(data) {
         console.log(11112222, data);
         this.workTaskId = data.list.length > 0 ? data.list[0].taskId : null;
+        this.workStepQueryParam.taskId =
+          data.list.length > 0 ? data.list[0].taskId : null;
+        this.workStepQueryParam.workOrderId =
+          data.list.length > 0 ? data.list[0].id : null;
         this.singleReportInspection =
           data.list.length > 0 ? data.list[0].singleReport : null; //获取选中的工单是单个还是批量
         this.isStep = true;
@@ -564,7 +570,7 @@
           if (this.workListIds.length > 1) {
             return this.$message.warning('工步只能选择一个工单!');
           }
-          this.$refs.workStepRef.open(this.workTaskId);
+          this.$refs.workStepRef.open(this.workStepQueryParam);
           // let req = {
           //   taskId: this.taskObj.id,
           //   workOrderId: this.workListIds[0]