Bläddra i källkod

feat(product): fpga flag

Casper Dai 3 år sedan
förälder
incheckning
5748956319
1 ändrade filer med 15 tillägg och 32 borttagningar
  1. 15 32
      src/views/realm/device/Product.vue

+ 15 - 32
src/views/realm/device/Product.vue

@@ -31,6 +31,7 @@
             class="l-flex__auto"
             :min="1"
             :max="999999"
+            :disabled="!isAdd"
             step-strictly
           />
           <span class="has-padding--h">高</span>
@@ -39,9 +40,19 @@
             class="l-flex__auto"
             :min="1"
             :max="999999"
+            :disabled="!isAdd"
             step-strictly
           />
         </div>
+        <span class="c-grid-form__label c-grid-form__auto">分割器:</span>
+        <div class="l-flex--row c-grid-form__option">
+          <el-switch
+            v-model="currObj.fpga"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :disabled="!isAdd"
+          />
+        </div>
         <span class="c-grid-form__label">备注:</span>
         <el-input
           v-model="currObj.remark"
@@ -57,7 +68,6 @@
 
 <script>
 import {
-  getDevices,
   getProducts,
   addProduct,
   deleteProduct,
@@ -87,7 +97,7 @@ export default {
       currObj: {},
       proxy: {
         add: addProduct,
-        update: this.updateProduct,
+        update: updateProduct,
         del: deleteProduct
       },
       typeOptions: [],
@@ -138,6 +148,7 @@ export default {
         productTypeId: this.$refs.table.getCondition().productTypeId,
         wide: 1920,
         high: 1080,
+        fpga: false,
         remark: '',
         tenant: this.tenant
       }
@@ -145,9 +156,9 @@ export default {
     },
     onEdit (product) {
       this.isAdd = false
-      const { id, name, high, wide, productTypeId, productTypeName, remark } = product
+      const { id, name, productTypeId, productTypeName, high, wide, fpga, remark } = product
       this.productTypeSelectSchema.option = { value: productTypeId, label: productTypeName }
-      this.currObj = { id, name, high, wide, productTypeId, remark }
+      this.currObj = { id, name, productTypeId, high, wide, fpga, remark }
       this.$currObj = product
       this.$refs.editDialog.show()
     },
@@ -181,34 +192,6 @@ export default {
       }
       return (this.isAdd ? addProduct : this.updateProduct)(this.currObj).then(done)
     },
-    updateProduct (currObj) {
-      if (this.$currObj.wide !== currObj.wide || this.$currObj.high !== currObj.high) {
-        const loading = this.$showLoading()
-        return getDevices({
-          productId: currObj.id,
-          pageSize: 1,
-          pageNum: 1,
-          tenant: this.tenant
-        }).then(
-          ({ data }) => {
-            if (data.length) {
-              this.$closeLoading(loading)
-              this.$message({
-                type: 'warning',
-                message: '请先删除产品下的设备'
-              })
-              return Promise.reject()
-            }
-            return updateProduct(currObj)
-          },
-          () => {
-            this.$closeLoading(loading)
-            return Promise.reject()
-          }
-        )
-      }
-      return updateProduct(currObj)
-    },
     onDel (product) {
       return deleteProduct(product).then(() => {
         this.$refs.table.decrease(1)