瀏覽代碼

启动不允许删除

wangzhuo 1 年之前
父節點
當前提交
b8c1169b12
共有 1 個文件被更改,包括 49 次插入12 次删除
  1. 49 12
      src/views/iosBasicData/bvessels/index.vue

+ 49 - 12
src/views/iosBasicData/bvessels/index.vue

@@ -20,6 +20,9 @@
                @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 293)"
                @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 293)"
                @on-load="onLoad">
+      <!-- <template slot-scope="scope" slot="status">
+        <el-checkbox v-model="scope.row.status" :true-label="0" :false-label="1" @change="putStatus(scope.row)">启用</el-checkbox>
+      </template> -->
       <template slot="menuLeft">
         <el-button type="danger"
                    size="small"
@@ -381,35 +384,69 @@
           window.console.log(error);
         });
       },
-      rowUpdate(row, index, done, loading) {
+      putStatus(row) {
+        console.log(row.status);
+        if (row.status == 0) {
+          row.status = 1
+        } else if (row.status == 1) {
+          row.status = 0
+        }
         updateBvessels(row).then(() => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          done();
         }, error => {
           loading();
           console.log(error);
         });
+        // this.$forceUpdate
+
       },
-      rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return removeBvessels(row.id);
-          })
-          .then(() => {
+      rowUpdate(row, index, done, loading) {
+        // if (row.status === 1) {
+          updateBvessels(row).then(() => {
             this.onLoad(this.page);
             this.$message({
               type: "success",
               message: "操作成功!"
             });
+            done();
+          }, error => {
+            loading();
+            console.log(error);
+          });
+        // } else {
+        //   this.$message({
+        //     message: '非禁用状态无法修改',
+        //     type: 'warning'
+        //   });
+        // }
+      },
+      rowDel(row) {
+        if (row.status === 1) {
+          this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+            .then(() => {
+              return removeBvessels(row.id);
+            })
+            .then(() => {
+              this.onLoad(this.page);
+              this.$message({
+                type: "success",
+                message: "操作成功!"
+              });
+            });
+        } else {
+          this.$message({
+            message: '非禁用状态无法删除',
+            type: 'warning'
           });
+        }
       },
       handleDelete() {
         if (this.selectionList.length === 0) {