|
@@ -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) {
|