Prechádzať zdrojové kódy

bugfix 排产模板编辑

damon227 3 rokov pred
rodič
commit
64e78284c1

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

@@ -302,10 +302,10 @@ export default {
 
     .node-disabled {
       &:hover {
-        cursor: default;
+        cursor: not-allowed;
       }
       &:active {
-        cursor: default;
+        cursor: not-allowed;
       }
     }
   }

+ 2 - 2
src/components/work-flow/node-edit.vue

@@ -45,7 +45,7 @@
           :disabled="disabled || selectOperator"
         ></el-input>
       </el-form-item>
-      <el-form-item label="操作人" v-if="form.operatorName">
+      <el-form-item label="操作人" v-if="form.operatorName && !selectOperator">
         <el-input
           :disabled="disabled && selectOperator"
           v-model="form.operatorName"
@@ -54,7 +54,7 @@
       <el-form-item
         label="操作人"
         prop="operatorId"
-        v-if="!form.operatorName && selectOperator && node.type !== 'end'"
+        v-if="selectOperator && node.type !== 'end'"
       >
         <el-select
           v-model="form.operatorId"

+ 46 - 30
src/views/modules/production/scheduling-mould-details.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="production">
     <el-dialog
-      title="排产模板详情"
+      :title="dialogTitle"
       width="70%"
       :close-on-click-modal="false"
       :visible.sync="visible"
@@ -13,15 +13,18 @@
         ref="dataForm"
         label-width="auto"
       >
-        <el-row class="my-row">
+        <el-row class="my-row" :gutter="20">
           <el-col :span="8">
             <el-form-item label="产品" prop="productId">
+              <el-input v-if="disable && productName" :disabled="disable" v-model="productName"></el-input>
               <el-select
+                v-else
                 v-model="dataForm.productId"
-                :disabled="display"
                 @change="productChange"
                 remote
+                :disabled="disable"
                 placeholder="请选择"
+                style="width:100%"
               >
                 <el-option
                   v-for="item in productList"
@@ -33,7 +36,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="10">
             <el-form-item label="模板名称" prop="mouldName">
               <el-input
                 placeholder="请输入模板名称"
@@ -82,13 +85,15 @@ export default {
     return {
       mouldId: '',
       visible: false,
+      dialogTitle: '',
       dataForm: {
         mouldName: ''
       },
       operatorList: [],
       operatorIds: [],
       productList: [],
-      display: false,
+      disable: false,
+      productName: '',
       datas: {},
       workFlowData: {
         nodeList: [],
@@ -118,12 +123,17 @@ export default {
       })
     },
     // 初始化表单
-    async init (id, disable, productionId) {
-      this.visible = true
-      this.display = disable
+    async init (id, disable, productName) {
+      this.disable = disable
+      this.dialogTitle = disable ? '编辑排产模板' : '新增排产模板'
       this.mouldId = id
+      this.productName = productName
+      this.visible = true
 
-      await this.initProductList()
+      if(!disable)
+      {
+        await this.initProductList()
+      }
 
       if (id > 0) {
         await getMouldDetail(id).then(async ({ data }) => {
@@ -137,31 +147,37 @@ export default {
           }
         })
       }
-      if (productionId && productionId > 0) {
-        this.productChange(productionId)
-      }
+      // if (productionId && productionId > 0) {
+      //   this.productChange(productionId)
+      // }
     },
     // 根据产品ID查询步骤详情
     async productChange (productId) {
-      // this.visible = false
-      // this.$emit('reload', 0, false, productId)
-      // return
-      getMouldDetailByProductId(productId).then(async ({ data }) => {
-        if (data && data.code === '200') {
-          this.dataForm = {
-            ...this.dataForm
-          }
-          // 流程图展示
-          this.workFlowData = {
-            nodeList: data.data.nodeList,
-            lineList: data.data.lineList
+      this.$confirm('选中后不可更改,是否选择该产品?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.disable = true
+        getMouldDetailByProductId(productId).then(async ({ data }) => {
+          if (data && data.code === '200') {
+            this.dataForm = {
+              ...this.dataForm
+            }
+            // 流程图展示
+            this.workFlowData = {
+              nodeList: data.data.nodeList,
+              lineList: data.data.lineList
+            }
+          } else {
+            this.$message({
+              type: 'error',
+              message: data.msg
+            })
           }
-        } else {
-          this.$message({
-            type: 'error',
-            message: data.msg
-          })
-        }
+        })
+      }).catch(() => {
+       this.dataForm.productId = ''
       })
     },
     // 按工种ID查询操作人列表

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

@@ -60,7 +60,7 @@
         width="150"
         label="操作">
         <template slot-scope="scope">
-          <el-button type="text" size="small" @click="detail(scope.row.mouldId, true)">编辑</el-button>
+          <el-button type="text" size="small" @click="detail(scope.row.mouldId, true, scope.row.productName)">编辑</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -74,7 +74,7 @@
       layout="total, sizes, prev, pager, next, jumper">
     </el-pagination>
     <!-- 弹窗, 新增 / 修改 -->
-    <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @reload="reloadDialog"  @refreshDataList="getDataList"/>
+    <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList"/>
   </div>
 </template>
 
@@ -141,22 +141,14 @@
         this.dataListSelections = val
       },
       // 新增 / 修改
-      detail (id, disable) {
+      detail (id, disable, productName) {
         this.detailsVisible = true
         this.$nextTick(() => {
-          this.$refs.details.init(id, disable)
+          this.$refs.details.init(id, disable, productName)
         })
       },
       closeDialogEvent () {
         this.detailsVisible = false
-      },
-      reloadDialog (id, disable, productionId) {
-        console.log('reloadDialog')
-        this.detailsVisible = false
-        this.detailsVisible = true
-        // this.$nextTick(() => {
-        //   this.$refs.details.init(id, disable, productionId)
-        // })
       }
     }
   }