Browse Source

bugfix 排产

damon227 3 năm trước cách đây
mục cha
commit
64aedaade2

+ 0 - 1
src/components/work-flow/config/methods.js

@@ -46,7 +46,6 @@ const methods = {
     this.jsPlumb.unbind('connection') // 取消连接事件
     for (let i = 0; i < this.data.lineList.length; i++) {
       let line = this.data.lineList[i]
-      debugger
       this.jsPlumb.connect(
         {
           source: line.from,

+ 6 - 2
src/components/work-flow/home.vue

@@ -87,6 +87,7 @@
 </template>
 
 <script>
+import cloneDeep from 'lodash/cloneDeep'
 import { jsPlumb } from 'jsplumb'
 import { nodeTypeList } from './config/init'
 import {
@@ -174,6 +175,7 @@ export default {
     }
   },
   mounted () {
+    console.log("mounted")
     this.jsPlumb = jsPlumb.getInstance()
     this.initNodeTypeObj()
     this.initNode()
@@ -199,9 +201,11 @@ export default {
     initNode () {
       this.resetNodeData()
 
-      this.data.lineList.push(...this.nodeData.lineList)
+      let tempData = cloneDeep(this.nodeData)
+
+      this.data.lineList.push(...tempData.lineList)
       this.data.nodeList = []
-      this.nodeData.nodeList.map(v => {
+      tempData.nodeList.map(v => {
         v.logImg = this.nodeTypeObj[v.type].logImg
         v.log_bg_color = this.nodeTypeObj[v.type].log_bg_color
         this.data.nodeList.push(v)

+ 4 - 19
src/views/modules/production/scheduling-mould-details.vue

@@ -94,8 +94,6 @@ export default {
         nodeList: [],
         lineList: []
       },
-      // 是否点击了流程图保存按钮
-      clickFlowSave: false,
       dataRule: {
         mouldName: [
           { required: true, message: '请输入模板名称', trigger: 'blur' }
@@ -161,18 +159,9 @@ export default {
       })
     },
     dataFormSubmit () {
-      if (!this.clickFlowSave) {
-        this.$message.error('请先点击流程图保存按钮!')
-        return
-      }
-
-      if (
-        !this.workFlowData ||
-        this.workFlowData.nodeList.length === 0 ||
-        this.workFlowData.lineList.length === 0
-      ) {
+      let flowData = this.$refs.workFlow.getFlowData()
+      if (!flowData) {
         this.$message.error('请先完成流程图!')
-        this.clickFlowSave = false
         return
       }
 
@@ -182,10 +171,10 @@ export default {
           let productionPlanNodes = []
           for (
             let index = 0;
-            index < this.workFlowData.nodeList.length;
+            index < flowData.nodeList.length;
             index++
           ) {
-            const node = this.workFlowData.nodeList[index]
+            const node = flowData.nodeList[index]
             if (node.type !== 'end' && node.operatorId === '') {
               this.$message.error(`请选择 ${node.nodeName} 的操作人员!`)
               this.clickFlowSave = false
@@ -218,12 +207,10 @@ export default {
                     }
                   })
                 } else {
-                  this.clickFlowSave = false
                   this.$message.error(data.msg)
                 }
               })
               .catch(() => {
-                this.clickFlowSave = false
               })
           } else {
             // 更新
@@ -241,12 +228,10 @@ export default {
                     }
                   })
                 } else {
-                  this.clickFlowSave = false
                   this.$message.error(data.msg)
                 }
               })
               .catch(() => {
-                this.clickFlowSave = false
               })
           }
         }

+ 9 - 1
src/views/modules/tech/crafts-detail.vue

@@ -4,6 +4,7 @@
     width="70%"
     :close-on-click-modal="false"
     :visible.sync="visible"
+    :before-close="handleClose"
   >
     <div style="margin-left: 20px;margin-right: 20px">
       <!-- 工作流 -->
@@ -51,7 +52,7 @@
       </el-row>
     </div>
     <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">返回</el-button>
+      <el-button @click="handleClose">返回</el-button>
     </span>
   </el-dialog>
 </template>
@@ -91,6 +92,9 @@ export default {
       }
     }
   },
+  destroyed () {
+    console.log("destroyed")
+  },
   methods: {
     async init (id, businessType, productName) {
       this.visible = true
@@ -150,6 +154,10 @@ export default {
     approveFinished () {
       this.visible = false
       this.$emit('approveFinished')
+    },
+    handleClose () {
+      //this.visible = false
+      this.$emit("closeDialogEvent")
     }
   }
 }

+ 5 - 1
src/views/modules/tech/crafts-management.vue

@@ -157,7 +157,7 @@
     </el-pagination>
     <!-- 弹窗, 新增 / 修改 -->
     <ctafts-add-or-detail v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getTechnology" />
-    <detail v-if="detailVisible" ref="detail"/>
+    <detail v-if="detailVisible" ref="detail" @closeDialogEvent = "closeDetailDialogEvent"/>
   </div>
 </template>
 
@@ -282,6 +282,10 @@
         this.$nextTick(() => {
           this.$refs.detail.init(id, '', productName)
         })
+      },
+      // 关闭详情dialog事件
+      closeDetailDialogEvent () {
+        this.detailVisible = false
       }
     }
   }

+ 6 - 6
src/views/modules/works/work.vue

@@ -103,7 +103,7 @@
           <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == null || scope.row.nodeType == 'start' || scope.row.nodeType == 'produce')" type="text" size="small" @click="completeTask(scope.row.taskId)">完成</el-button>
           <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == 'check' || scope.row.nodeType == 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 1)">通过</el-button>
           <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == 'check' || scope.row.nodeType == 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 2)">不通过</el-button>
-          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == null || scope.row.nodeType == 'produce')" type="text" size="small" @click="damageTask(scope.row.taskId)">操作损坏</el-button>
+          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == null || scope.row.nodeType == 'produce')" type="text" size="small" @click="damageTask(scope.row.nodeId, scope.row.productionId)">操作损坏</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -169,7 +169,7 @@
     </el-dialog>
 
     <el-dialog title="操作损坏" width="30%" :visible.sync="damageDialogFormVisible">
-      <el-form :model="damageDialogForm" :rules="damageDialogFormRules" ref="checkDialogForm">
+      <el-form :model="damageDialogForm" :rules="damageDialogFormRules" ref="damageDialogForm">
         <el-form-item label="损坏原因" prop="damageReason" label-width="80px">
           <el-input v-model="damageDialogForm.damageReason" type="textarea" :rows="2" placeholder="请输入"></el-input>
         </el-form-item>
@@ -436,23 +436,23 @@ export default {
       })
     },
       // 操作损坏
-    damageTask (taskId, productionId) {
+    damageTask (nodeId, productionId) {
       this.damageDialogFormVisible = true
-      this.damageDialogForm.taskId = taskId
+      this.damageDialogForm.nodeId = nodeId
       this.damageDialogForm.productionId = productionId
     },
       // 确认操作损坏
     damageSubmit () {
       this.$refs['damageDialogForm'].validate((valid) => {
         if (valid) {
-          let submitData = this.checkDialogForm
+          let submitData = this.damageDialogForm
           damageTask(submitData).then(({data}) => {
             if (data && data.code === '200') {
               this.$message({
                 type: 'success',
                 message: '操作成功!'
               })
-              this.checkDialogFormVisible = false
+              this.damageDialogFormVisible = false
               this.getDataList()
             } else {
               this.$message({