Переглянути джерело

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

5 роки тому
батько
коміт
c2d85d8327
2 змінених файлів з 151 додано та 25 видалено
  1. 4 1
      ys_vue/src/port.js
  2. 147 24
      ys_vue/src/views/base/allocation.vue

+ 4 - 1
ys_vue/src/port.js

@@ -29,6 +29,9 @@ export default {
 
         addFactory: '/factory/add',  //(工厂)
         factoryList: '/factory/list', 
-        delFactory: '/factory/delete', 
+        delFactory: '/factory/delete',
+
+        editMould: '/mouldequipment/addOrUpdate', //添加或修改模具
+        enableMould: '/mouldequipment/use', //使用模具
     }
 }

+ 147 - 24
ys_vue/src/views/base/allocation.vue

@@ -33,12 +33,12 @@
       style="width: 100%;"
     >
       <el-table-column type="index" width="60"></el-table-column>
-      <el-table-column prop="deviceNumber" 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="countdown" label="倒计时" width="100" sortable></el-table-column>
-      <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>
-      <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>
-      <el-table-column prop="assets" label="资产方" width="120" 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>
+      <el-table-column prop="equipmentNo" label="模具编号" width="120" sortable></el-table-column>
+      <el-table-column prop="belongCompanyId" label="资产方" width="120" sortable></el-table-column>
       <el-table-column prop="state" label="模具状态" width="100" sortable>
         <template slot-scope="scope">
           <span v-if="scope.row.state == false">未启用</span>
@@ -89,14 +89,43 @@
         class="demo-form-inline"
       >
         <el-form-item label="设备号" prop="typeNumber">
-          <el-input v-model="newAllocation.deviceNumber" autocomplete="off" placeholder="请填写"></el-input>
+          <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
         </el-form-item>
         <el-form-item label="所属公司" prop="name">
-          <el-input v-model="newAllocation.company" autocomplete="off" placeholder="请填写"></el-input>
+          <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>
+      </div>
+    </el-dialog>
+
+    <!--修改界面-->
+    <el-dialog
+      title="修改模具"
+      v-if="editFormVisible"
+      :visible.sync="editFormVisible"
+      :close-on-click-modal="false"
+      customClass="customWidth"
+    >
+      <el-form
+        :model="newAllocation"
+        label-width="100px"
+        :rules="formRules"
+        ref="newAllocation"
+        :inline="true"
+        class="demo-form-inline"
+      >
+        <el-form-item label="设备号" prop="typeNumber">
+          <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
+        </el-form-item>
+        <el-form-item label="所属公司" prop="name">
+          <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="editFormVisible = false">取消</el-button>
         <!-- 这里少了几个属性别忘了加上了 -->
         <el-button type="primary">提交</el-button>
       </div>
@@ -112,27 +141,37 @@ export default {
       allocations: [
         //临时数据
         {
-          deviceNumber: "0123456",
-          power: "50%",
-          countdown: "400天",
-          name: "墨盒",
-          mouldNumber: "MUJU123456",
-          assets: "南京火石闪信",
+          id: "1234567",
+          power: "N/A",
+          useLife: "400天",
+          equipmentName: "墨盒",
+          equipmentNo: "MUJU123456",
+          belongCompanyId: "南京火石闪信",
           state: true
         },
         {
-          deviceNumber: "7891011",
-          power: "20%",
-          countdown: "100天",
-          name: "墨盒2",
-          mouldNumber: "MUJU654321",
-          assets: "南京火石闪信",
+          id: "7891011",
+          power: "N/A",
+          useLife: "100天",
+          equipmentName: "墨盒2",
+          equipmentNo: "MUJU654321",
+          belongCompanyId: "南京火石闪信",
           state: false
         }
       ],
+      /**
+       * 添加/修改模具设备
+       * 添加参数:equipmentName 设备名称,useLife 使用年限, equipmentNo 设备编号 ,
+       * belongCompanyId 所属公司id ,equipmentName 设备名称
+       * 修改时需多传的参数 id 设备id
+       */
       newAllocation: {
-        deviceNumber: "",
-        company: ""
+        equipmentNo: "", //设备编号
+        // power: "",
+        useLife: "", //使用年限
+        equipmentName: "", //设备名称
+        id: "", //设备id
+        belongCompanyId: "" //所属公司ID
       },
       filters: {
         name: "",
@@ -142,7 +181,8 @@ export default {
       listLoading: false,
       total: 0,
       tableHeight: 0,
-      addFormVisible: false
+      addFormVisible: false,
+      editFormVisible: false
     };
   },
   methods: {
@@ -159,13 +199,96 @@ export default {
     showAllocation() {
       this.addFormVisible = true;
       this.newAllocation = {
-        deviceNumber: "",
-        company: ""
+        id: "", //设备编号
+        useLife: "", //使用年限
+        equipmentName: "", //设备名称
+        equipmentNo: "", //设备id
+        belongCompanyId: "" //所属公司ID
       };
     },
+    //修改界面
+    showEdit() {
+      this.editFormVisible = true;
+      this.newAllocation = {
+        id: "", //设备编号
+        useLife: "", //使用年限
+        equipmentName: "", //设备名称
+        equipmentNo: "", //设备id
+        belongCompanyId: "" //所属公司ID
+      };
+    },
+    //添加模具
+    addMould(){
+      //添加模具调用
+      this.$refs.addForm.validate(valid => {
+        if (valid) {
+          this.editLoading = true;
+          this.http.post(
+            this.port.base.editMould,
+            {
+              id: this.newAllocation.id,
+              belongCompanyId: this.newAllocation,belongCompanyId
+            },
+            res => {
+              this.editLoading = false;
+              this.editFormVisible = false;
+              if (res.code == "ok") {
+                this.$message({
+                  message: "添加成功",
+                  type: "success"
+                });
+                this.getRoles();
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error"
+                });
+              }
+            },
+            error => {
+              this.editLoading = false;
+              this.editFormVisible = false;
+              this.$message({
+                message: error,
+                type: "error"
+              });
+            }
+          );
+        }
+      });
+    },
     //启用设备
     enable(index) {
       this.allocations[index].state = true;
+      //启用设备调用
+      this.http.post(
+        this.port.base.enableMould,
+        {
+          //数是瞎写的
+          id: 1,
+          isUse: 1
+        },
+        res => {
+          if (res.code == "ok") {
+            this.$message({
+              message: "修改成功",
+              type: "success"
+            });
+            this.getRoles();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
     }
   },
   created() {