zhangjie 2 年之前
父節點
當前提交
595bc17ee2

+ 5 - 2
src/modules/paper/components/QuestionGroupStruct.vue

@@ -69,7 +69,10 @@
             label="数量"
             width="150"
           >
-            <template slot-scope="scope">
+            <template
+              v-if="!(scope.row.isClassify && useProperty)"
+              slot-scope="scope"
+            >
               <el-input-number
                 v-model="scope.row.selectCount"
                 size="mini"
@@ -95,7 +98,7 @@
               v-if="
                 scope.row.difficultDistributeInfo &&
                 scope.row.difficultDistributeInfo.length &&
-                !(scope.row.useClassify && useProperty)
+                !(scope.row.isClassify && useProperty)
               "
               slot-scope="scope"
             >

+ 4 - 0
src/modules/question/components/PropertyTreeSelect.vue

@@ -129,6 +129,7 @@ export default {
       if (val !== oldval) this.initSelected(val);
     },
     courseId(val, oldval) {
+      console.log(val, oldval);
       if (val !== oldval) {
         this.resetData();
         this.emitChange();
@@ -136,6 +137,9 @@ export default {
       }
     },
   },
+  mounted() {
+    this.getList();
+  },
   methods: {
     resetData() {
       this.$refs.PropertyTree.setCheckedKeys([]);

+ 37 - 120
src/modules/questions/views/CourseProperty.vue

@@ -19,21 +19,13 @@
       </el-form>
       <div class="part-box-action">
         <div>
-          <el-button
-            type="success"
-            plain
-            icon="icon icon-play"
-            :disabled="noBatchSelected"
-            @click="openCoursePropertys"
-            >启用</el-button
-          >
           <el-button
             type="danger"
             plain
             icon="icon icon-delete"
             :disabled="noBatchSelected"
-            @click="closeCoursePropertys"
-            >禁用</el-button
+            @click="toBatchDeleteCourseProperty"
+            >删除</el-button
           >
           <el-button
             type="primary"
@@ -110,22 +102,12 @@
                 >详情
               </el-button>
               <el-button
-                v-if="!scope.row.enable"
-                size="mini"
-                type="primary"
-                plain
-                @click="openCourseProperty(scope.row)"
-              >
-                启用
-              </el-button>
-              <el-button
-                v-if="scope.row.enable"
                 size="mini"
                 type="danger"
                 plain
-                @click="closeCourseProperty(scope.row)"
+                @click="toDeleteCourseProperty(scope.row)"
               >
-                禁用
+                删除
               </el-button>
             </div>
           </template>
@@ -514,109 +496,44 @@ export default {
         path: "/questions/property_info/" + row.id,
       });
     },
-    //开启
-    openCourseProperty(row) {
-      this.$confirm("确认开启?", "提示", {
-        type: "success",
-      }).then(() => {
-        this.loading = true;
-        this.$http
-          .put(QUESTION_API + "/courseProperty/open/" + row.id)
-          .then(() => {
-            this.$notify({
-              message: "开启成功",
-              type: "success",
-            });
-            this.searchCourProperty();
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "开启失败",
-            });
-          });
-      });
-    },
-    //批量启用
-    openCoursePropertys() {
-      this.$confirm("是否确认开启?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "error",
-      }).then(() => {
-        this.loading = true;
-        var url = QUESTION_API + "/courseProperty/opens/" + this.selectedIds;
-        this.$http
-          .put(url)
-          .then(() => {
-            this.$notify({
-              type: "success",
-              message: "开启成功!",
-            });
-            this.searchCourProperty();
-            this.selectedList = [];
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "开启失败!",
-            });
-            this.selectedList = [];
-          });
-      });
+    // 删除
+    async deleteCourseProperty(ids) {
+      console.log(ids);
+      if (this.loading) return;
+      this.loading = true;
+
+      const res = this.$http
+        .post(
+          QUESTION_API + "/courseProperty/delete",
+          {},
+          { params: { coursePropertyIdList: ids } }
+        )
+        .catch(() => {});
       this.loading = false;
+      if (!res) return;
+      this.$message.success("操作成功!");
+      this.searchCourProperty();
     },
-    //关闭
-    closeCourseProperty(row) {
-      this.$confirm("确认禁用?", "提示", {
+    async toDeleteCourseProperty(row) {
+      const confirm = await this.$confirm("确认删除?", "提示", {
         type: "warning",
-      }).then(() => {
-        this.loading = true;
-        this.$http
-          .put(QUESTION_API + "/courseProperty/close/" + row.id)
-          .then(() => {
-            this.$notify({
-              message: "禁用成功",
-              type: "success",
-            });
-            this.searchCourProperty();
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "禁用失败",
-            });
-          });
-      });
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await this.deleteCourseProperty(row.id);
     },
     //批量关闭
-    closeCoursePropertys() {
-      this.$confirm("是否确认禁用?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "error",
-      }).then(() => {
-        this.loading = true;
-        var url = QUESTION_API + "/courseProperty/closes/" + this.selectedIds;
-        this.$http
-          .put(url)
-          .then(() => {
-            this.$notify({
-              type: "success",
-              message: "禁用成功!",
-            });
-            this.searchCourProperty();
-            this.selectedList = [];
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "禁用失败!",
-            });
-            this.selectedList = [];
-          });
-      });
-      this.loading = false;
+    async toBatchDeleteCourseProperty() {
+      if (!this.selectedIds.length) {
+        this.$message.error("请选择要删除数据");
+        return;
+      }
+      const confirm = await this.$confirm("确认删除?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await this.deleteCourseProperty(this.selectedIds);
     },
     //分页
     handleCurrentChange(val) {