Pārlūkot izejas kodu

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

sunyadv 5 gadi atpakaļ
vecāks
revīzija
9b8088f7f2
2 mainītis faili ar 78 papildinājumiem un 28 dzēšanām
  1. 1 1
      ys_vue/src/routes.js
  2. 77 27
      ys_vue/src/views/base/allocation.vue

+ 1 - 1
ys_vue/src/routes.js

@@ -86,7 +86,7 @@ let routes = [
             // { path: '/role', component: role, name: '角色管理' },
             { path: '/comp', component: comp, name: '公司管理' },
             { path: '/factory', component: factory, name: '工厂管理' },
-            { path: '/allocation', component: allocation, name: '分配云模' }
+            { path: '/allocation', component: allocation, name: '云模盒管理' }
         ]
     },
     {

+ 77 - 27
ys_vue/src/views/base/allocation.vue

@@ -24,9 +24,15 @@
     </el-col>
 
     <!--列表-->
-    <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" style="width: 100%;">
+    <el-table
+      :data="allocations"
+      :height="tableHeight"
+      highlight-current-row
+      v-loading="listLoading"
+      style="width: 100%;"
+    >
       <el-table-column type="index" width="60"></el-table-column>
-      <el-table-column prop="id" label="云模设备号" width="120" sortable></el-table-column>
+      <el-table-column prop="id" label="云模盒编号" width="120" sortable></el-table-column>
       <el-table-column prop="power" label="电量" width="80" sortable></el-table-column>
       <el-table-column prop="useLife" label="倒计时" width="100" sortable></el-table-column>
       <el-table-column prop="equipmentName" label="模具名称" width="100" sortable></el-table-column>
@@ -46,7 +52,7 @@
             @click="enable(scope.$index)"
             :disabled="scope.row.state == true"
           >启用</el-button>
-          <el-button size="small">修改</el-button>
+          <el-button size="small" @click="showEdit(5)">修改</el-button>
           <el-button type="danger" size="small">删除</el-button>
         </template>
       </el-table-column>
@@ -81,16 +87,16 @@
         :inline="true"
         class="demo-form-inline"
       >
-        <el-form-item label="设备号" prop="typeNumber">
+        <el-form-item label="设备号">
           <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
-        <el-form-item label="所属公司" prop="name">
+        <el-form-item label="所属公司">
           <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click.native="addFormVisible = false">取消</el-button>
-        <el-button type="primary" @click="addMould">提交</el-button>
+        <el-button type="primary" @click="addMould()">提交</el-button>
       </div>
     </el-dialog>
 
@@ -110,17 +116,22 @@
         :inline="true"
         class="demo-form-inline"
       >
-        <el-form-item label="设备号" prop="typeNumber">
+        <el-form-item label="设备号">
           <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
-        <el-form-item label="所属公司" prop="name">
+        <el-form-item label="所属公司">
           <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
+        <el-form-item label="设备名称">
+          <el-input v-model="newAllocation.equipmentName" autocomplete="off" placeholder="请填写"></el-input>
+        </el-form-item>
+        <el-form-item label="使用年限">
+          <el-input v-model="newAllocation.useLife" autocomplete="off" placeholder="请填写"></el-input>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click.native="editFormVisible = false">取消</el-button>
-        <!-- 这里少了几个属性别忘了加上了 -->
-        <el-button type="primary">提交</el-button>
+        <el-button type="primary" @click="editMould">提交</el-button>
       </div>
     </el-dialog>
   </section>
@@ -192,37 +203,77 @@ export default {
     showAllocation() {
       this.addFormVisible = true;
       this.newAllocation = {
-        id: "", //设备编号
-        useLife: "", //使用年限
-        equipmentName: "", //设备名称
-        equipmentNo: "", //设备id
-        belongCompanyId: "" //所属公司ID
+        id: "",
+        useLife: "",
+        equipmentName: "",
+        equipmentNo: "",
+        belongCompanyId: ""
       };
     },
     //修改界面
-    showEdit() {
+    showEdit(equipmentId) {
       this.editFormVisible = true;
       this.newAllocation = {
-        id: "", //设备编号
-        useLife: "", //使用年限
-        equipmentName: "", //设备名称
-        equipmentNo: "", //设备id
-        belongCompanyId: "" //所属公司ID
+        id: equipmentId,
+        useLife: "",
+        equipmentName: "",
+        equipmentNo: "",
+        belongCompanyId: ""
       };
     },
     //添加模具
-    addMould(){
-      //添加模具调用
-      this.$refs.addForm.validate(valid => {
+    addMould() {
+      this.$refs.newAllocation.validate(valid => {
+        if (valid) {
+          this.editLoading = true;
+          this.http.post(
+            this.port.base.editMould,
+            {
+              equipmentNo: this.newAllocation.equipmentNo,
+              belongCompanyId: this.newAllocation.belongCompanyId
+            },
+            res => {
+              this.editLoading = false;
+              this.editFormVisible = false;
+              if (res.code == "ok") {
+                this.$message({
+                  message: "添加成功",
+                  type: "success"
+                });
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error"
+                });
+              }
+            },
+            error => {
+              this.editLoading = false;
+              this.editFormVisible = false;
+              this.$message({
+                message: error,
+                type: "error"
+              });
+            }
+          );
+        }
+      });
+    },
+    //编辑模具
+    editMould() {
+      this.$refs.newAllocation.validate(valid => {
         if (valid) {
           this.editLoading = true;
           this.http.post(
             this.port.base.editMould,
             {
-              id: this.newAllocation.id,
-              belongCompanyId: this.newAllocation,belongCompanyId
+              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") {
@@ -230,7 +281,6 @@ export default {
                   message: "添加成功",
                   type: "success"
                 });
-                this.getRoles();
               } else {
                 this.$message({
                   message: res.msg,