diff --git a/src/views/School/School.vue b/src/views/School/School.vue
index 765bda8..8cd3f49 100644
--- a/src/views/School/School.vue
+++ b/src/views/School/School.vue
@@ -20,6 +20,20 @@
@click="isShowAdd = true"
>新增
+
+ 批量设为显示
+ 批量设为不显示
+
+
+
+
+
+
+
+ {{ row.is_show === 0 || row.is_show === '0' ? '否' : '是' }}
+
+
+
+
+
+
+
+
+
col.field === key)?.title || key
}else if(key=='type'){
export_fields['type_text'] = tableColumns.find(col => col.field === key)?.title || key
+ }else if(key=='is_show'){
+ export_fields['is_show_text'] = tableColumns.find(col => col.field === key)?.title || key
}else if(key=='is_area_3'||key=='id'){
}else{
@@ -706,6 +757,46 @@ export default {
this.$refs["table"].setEditRow(row);
}
},
+ async batchSetIsShow(isShow) {
+ const $table = this.$refs["table"];
+ if (!$table) {
+ return;
+ }
+ const records = $table.getCheckboxRecords();
+ if (!records.length) {
+ this.$message.warning("请先勾选学校");
+ return;
+ }
+ const text = isShow === 1 ? "显示" : "不显示";
+ try {
+ await this.$confirm(
+ `确定将已选 ${records.length} 所学校批量设为「${text}」吗?`,
+ "提示",
+ {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ }
+ );
+ } catch {
+ return;
+ }
+ this.loading = true;
+ try {
+ await Promise.all(
+ records.map((row) => save({ id: row.id, is_show: isShow }, false))
+ );
+ this.$message.success("设置成功");
+ $table.clearCheckboxRow();
+ await this.getList();
+ } catch (err) {
+ console.error(err);
+ this.$message.error("设置失败,请重试");
+ await this.getList();
+ } finally {
+ this.loading = false;
+ }
+ },
cancelRowEvent(row) {
if (this.$refs["table"]) {
this.$refs["table"].clearEdit().then(() => {
@@ -722,7 +813,13 @@ export default {
this.loading = true;
try {
const res = await index(this.select, false);
- this.tableData = res.data;
+ this.tableData = (res.data || []).map((row) => ({
+ ...row,
+ is_show:
+ row.is_show === 0 || row.is_show === '0' || row.is_show === false
+ ? 0
+ : 1,
+ }));
this.total = res.total;
this.loading = false;
} catch (err) {
diff --git a/src/views/School/components/AddSchool.vue b/src/views/School/components/AddSchool.vue
index f500fbe..9402ac7 100644
--- a/src/views/School/components/AddSchool.vue
+++ b/src/views/School/components/AddSchool.vue
@@ -117,6 +117,17 @@
>
+
+
+
+
+
+
+
+
+ {{ form["is_show"] === 0 || form["is_show"] === "0" ? "否" : "是" }}
+
+
{{ form["introduce"] }}
@@ -120,6 +124,8 @@ export default {
introduce: "",
teacher: "",
+
+ is_show: 1,
},
};
},