LAPTOP-16IUEB3P\Lenovo 2 лет назад
Родитель
Сommit
e97f41a23b

+ 30 - 11
src/components/CreatePlan/equipment-dailog.vue

@@ -10,6 +10,7 @@
       <el-input placeholder="请输入" v-model="name"></el-input>
     </div>
     <!-- 数据表格 -->
+	<!-- :highlight-current-row="isSingle" -->
     <ele-pro-table
       ref="table"
       :columns="columns"
@@ -20,10 +21,19 @@
       :selection.sync="selectionList"
       :datasource="datasourceShow"
       :current.sync="current"
-      :highlight-current-row="isSingle"
+	  highlight-current-row
       height="45vh"
-    />
-
+	  @row-click="choose"
+    >
+    <template v-slot:select="{ row }">
+		  <el-radio
+		    class="radio"
+		    v-model="radio"
+		    :label="row.id"
+		    ><i></i
+		  ></el-radio>
+	 </template>
+	</ele-pro-table>
     <div class="footer" slot="footer">
       <el-button @click="cancel">取消</el-button>
       <el-button @click="confirm" type="primary">确定</el-button>
@@ -44,7 +54,8 @@
         memoList: [],
         datasource: [],
         isSingle: false,
-        callback: null
+        callback: null,
+		radio:'',
       };
     },
     computed: {
@@ -85,9 +96,11 @@
 
         if (!this.isSingle) {
           list.push({
-            type: 'selection',
-            align: 'center'
-          });
+		    slot: 'select',
+		    prop: 'select',
+		    label: '选择',
+		    align: 'center'
+		  });
         }
         return list;
       },
@@ -144,18 +157,24 @@
 
           this.callback && this.callback(this.current);
         } else {
-          if (!this.selectionList.length)
+          if (!this.current)
             return this.$message.error('请选择数据');
-
-          this.$emit('success', this.selectionList);
+          this.$emit('success', [this.current]);
         }
 
         this.cancel();
       },
       cancel () {
         this.$refs.table.clearSelection();
+		this.radio = ''
+		this.current = null
         this.visible = false;
-      }
+      },
+	  // 单击获取id
+	  choose (row) {
+	    this.current = row;
+	    this.radio = row.id;
+	  },
     }
   };
 </script>

+ 14 - 7
src/views/materialPlan/components/plan-view.vue

@@ -24,7 +24,7 @@
       <el-button type="primary" plain size="small" @click="addOrder"
         >添加工单</el-button
       >
-      <!-- <el-button type="primary" plain size="small">删除</el-button> -->
+      <!-- <el-button type="danger" plain size="small" @click="remove">删除</el-button> -->
       <div class="items">
         <span class="label">累计工单条数</span>
         {{ tableData.length }}条
@@ -47,7 +47,8 @@
       </div> -->
     </div>
     <el-form :model="{ tableData }" label-width="0" ref="formRef">
-      <el-table :data="tableData">
+      <el-table :data="tableData"
+	  >
         <el-table-column type="index" label="序号"></el-table-column>
         <el-table-column label="工单号" prop="code"></el-table-column>
         <el-table-column label="生产重量" prop="" width="120">
@@ -138,7 +139,7 @@
             <el-link type="danger" @click="handleDelete($index)">删除</el-link>
           </template>
         </el-table-column>
-        <el-table-column type="selection"></el-table-column>
+        <!-- <el-table-column type="selection"></el-table-column> -->
       </el-table>
     </el-form>
     <equipmentDailog
@@ -217,7 +218,8 @@
             value: '',
             list: [{ label: '末单均衡', value: 0 }]
           }
-        ]
+        ],
+		selectionList:[]
       };
     },
     computed: {
@@ -256,6 +258,9 @@
       }
     },
     methods: {
+	 // chooseItem(selection){
+		//  this.selectionList = selection
+	 // },
       // 发布
       handleRelease () {
         this.$refs.formRef.validate((value) => {
@@ -289,8 +294,8 @@
                   console.error(error);
                 }
                 loading.close();
-              }
-            );
+              }).catch(() => {         
+			  });
           }
         });
       },
@@ -314,6 +319,7 @@
         row.executorName = executorName.substring(1);
       },
       addOrder () {
+		if(this.tableData.length>0) return  this.$message.warning('工单只能添加一条!');
         this.$refs.equipmentDailogRef.open();
       },
       editOrder (row) {
@@ -367,7 +373,8 @@
             item.deleted = 1;
             this.deleteList.push(item);
           }
-        });
+        }).catch(() => {         
+		});
       }
     }
   };

+ 1 - 1
src/views/materialPlan/index.vue

@@ -133,7 +133,7 @@
             action: 'code',
             label: '计划编号',
             align: 'center',
-			width: 200
+		    width: 200
           },
           {
             prop: 'materialCode',

+ 7 - 1
src/views/productionPlan/components/plan-view.vue

@@ -63,19 +63,21 @@
               <el-input
                 type="number"
                 v-model.number="row.formingNum"
+				@input="writeNum(row.formingNum,row)"
               ></el-input>
             </el-form-item>
           </template>
         </el-table-column>
         <el-table-column label="成型重量" prop="" width="120">
           <template v-slot="{ row, $index }">
+			  <!-- :prop="`tableData.${$index}.formingWeight`" -->
             <el-form-item
-              :prop="`tableData.${$index}.formingWeight`"
               :rules="rule.formingWeight"
             >
               <el-input
                 type="number"
                 v-model.number="row.formingWeight"
+		        		readonly
               ></el-input>
             </el-form-item>
           </template>
@@ -279,6 +281,9 @@
       }
     },
     methods: {
+	  writeNum(val,row){
+		  this.$set(row,'formingWeight',val*Number(this.infoData.productUnitWeight))
+	  },
       // 发布
       handleRelease () {
         this.$refs.formRef.validate((value) => {
@@ -337,6 +342,7 @@
         row.executorName = executorName.substring(1);
       },
       addOrder () {
+				if(this.tableData.length>0) return  this.$message.warning('工单只能添加一条!');
         this.$refs.equipmentDailogRef.open();
       },
       editOrder (row) {