Reiskuchen 5 лет назад
Родитель
Сommit
aff1780a55
1 измененных файлов с 51 добавлено и 10 удалено
  1. 51 10
      ys_vue/src/views/base/allocation.vue

+ 51 - 10
ys_vue/src/views/base/allocation.vue

@@ -91,7 +91,19 @@
           <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
         <el-form-item label="所属公司">
-          <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
+          <el-select
+            v-model="newAllocation.belongCompanyId"
+            filterable
+            placeholder="请选择"
+            style="width: 202px"
+          >
+            <el-option
+              v-for="item in companies"
+              :key="item.id"
+              :label="item.companyName"
+              :value="item.id"
+            ></el-option>
+          </el-select>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -120,7 +132,19 @@
           <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
         <el-form-item label="所属公司">
-          <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
+          <el-select
+            v-model="newAllocation.belongCompanyId"
+            filterable
+            placeholder="请选择"
+            style="width: 202px"
+          >
+            <el-option
+              v-for="item in companies"
+              :key="item.id"
+              :label="item.companyName"
+              :value="item.id"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="设备名称">
           <el-input v-model="newAllocation.equipmentName" autocomplete="off" placeholder="请填写"></el-input>
@@ -163,12 +187,7 @@ export default {
           state: false
         }
       ],
-      /**
-       * 添加/修改模具设备
-       * 添加参数:equipmentName 设备名称,useLife 使用年限, equipmentNo 设备编号 ,
-       * belongCompanyId 所属公司id ,equipmentName 设备名称
-       * 修改时需多传的参数 id 设备id
-       */
+      companies: {},
       newAllocation: {
         equipmentNo: "", //设备编号
         // power: "",
@@ -267,13 +286,13 @@ export default {
           this.http.post(
             this.port.base.editMould,
             {
+              id: this.newAllocation.id,
               equipmentNo: this.newAllocation.equipmentNo,
               equipmentName: this.newAllocation.equipmentName,
               belongCompanyId: this.newAllocation.belongCompanyId,
               useLife: this.newAllocation.useLife
             },
             res => {
-              console.log(res);
               this.editLoading = false;
               this.editFormVisible = false;
               if (res.code == "ok") {
@@ -338,7 +357,29 @@ export default {
     let height = window.innerHeight;
     this.tableHeight = height - 210;
   },
-  mounted() {}
+  mounted() {
+    this.http.post(
+      this.port.base.comps,
+      {},
+      res => {
+        if (res.code == "ok") {
+          this.companies = res.data;
+          console.log(this.companies);
+        } else {
+          this.$message({
+            message: res.msg,
+            type: "error"
+          });
+        }
+      },
+      error => {
+        this.$message({
+          message: error,
+          type: "error"
+        });
+      }
+    );
+  }
 };
 </script>