|
|
|
|
@ -20,6 +20,20 @@
|
|
|
|
|
@click="isShowAdd = true"
|
|
|
|
|
>新增</el-button
|
|
|
|
|
>
|
|
|
|
|
<template v-if="isHasAuth('edit')">
|
|
|
|
|
<el-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
@click="batchSetIsShow(1)"
|
|
|
|
|
>批量设为显示</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="warning"
|
|
|
|
|
plain
|
|
|
|
|
@click="batchSetIsShow(0)"
|
|
|
|
|
>批量设为不显示</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="isHasAuth('search')">
|
|
|
|
|
<el-input style="width: 120px;" v-model="select['filter[1][value]']" placeholder="学校名称.." size="small"></el-input>
|
|
|
|
|
<el-select
|
|
|
|
|
@ -42,6 +56,16 @@
|
|
|
|
|
<el-option v-for="item in area" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input style="width: 120px;" v-model="select['filter[2][value]']" placeholder="学校星级.." size="small"></el-input>
|
|
|
|
|
<el-select
|
|
|
|
|
style="width: 110px;"
|
|
|
|
|
v-model="select['is_show']"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="是否显示"
|
|
|
|
|
size="small"
|
|
|
|
|
>
|
|
|
|
|
<el-option label="是" :value="1"></el-option>
|
|
|
|
|
<el-option label="否" :value="0"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
@ -221,6 +245,29 @@
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<vxe-column
|
|
|
|
|
align="center"
|
|
|
|
|
field="is_show"
|
|
|
|
|
width="120"
|
|
|
|
|
title="是否显示"
|
|
|
|
|
:edit-render="{}"
|
|
|
|
|
>
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<span>{{ row.is_show === 0 || row.is_show === '0' ? '否' : '是' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="row.is_show"
|
|
|
|
|
size="mini"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
>
|
|
|
|
|
<el-option label="是" :value="1" />
|
|
|
|
|
<el-option label="否" :value="0" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
|
|
|
|
|
<vxe-column
|
|
|
|
|
align="center"
|
|
|
|
|
field="type"
|
|
|
|
|
@ -471,6 +518,7 @@ export default {
|
|
|
|
|
'filter[3][op]': 'eq',
|
|
|
|
|
'filter[3][value]': '',
|
|
|
|
|
'type': [],
|
|
|
|
|
is_show: '',
|
|
|
|
|
},
|
|
|
|
|
total: 0,
|
|
|
|
|
allAlign: null,
|
|
|
|
|
@ -488,7 +536,8 @@ export default {
|
|
|
|
|
build_year: "",
|
|
|
|
|
introduce: "",
|
|
|
|
|
teacher: "",
|
|
|
|
|
from: 1
|
|
|
|
|
from: 1,
|
|
|
|
|
is_show: 1,
|
|
|
|
|
},
|
|
|
|
|
validRules: {
|
|
|
|
|
name: [
|
|
|
|
|
@ -569,6 +618,8 @@ export default {
|
|
|
|
|
export_fields['nature_text'] = tableColumns.find(col => 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) {
|
|
|
|
|
|