a49498f6 by chentao

隐藏系列

1 parent 830f61f7
......@@ -41,3 +41,35 @@ export function delBuildingBlock(id) {
method: 'DELETE',
})
}
// 显示
export function displayBuildingBlock(id) {
return request({
url: `/core/buildingBlock/display/${id}`,
method: 'put',
})
}
// 批量显示
export function batchDisplayBuildingBlock(ids) {
return request({
url: `/core/buildingBlock/batch/display/${ids}`,
method: 'put',
})
}
// 隐藏
export function hideBuildingBlock(id) {
return request({
url: `/core/buildingBlock/hide/${id}`,
method: 'put',
})
}
// 批量隐藏
export function batchHideBuildingBlock(ids) {
return request({
url: `/core/buildingBlock/batch/hide/${ids}`,
method: 'put',
})
}
......
......@@ -68,12 +68,16 @@ export default {
typeName: '类型',
sortName: '排序',
packName: '是否打包',
visibleName: '状态',
groupName: '套件',
tableControlsName: '操作',
controlsDelName: '删除',
controlsEditName: '编辑',
controlsDisplayName: '显示',
controlsHideName: '隐藏',
controlsAddName: '新增系列',
placeholder: '系列名称搜索',
// 新增
dialogTitleAdd: '新增',
dialogTitleEdit: '修改',
......
......@@ -15,6 +15,12 @@
/>
</el-form-item>
<el-form-item label="">
<el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchHide">批量隐藏</el-button>
</el-form-item>
<el-form-item label="">
<el-button type="primary" icon="Plus" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button>
</el-form-item>
<el-form-item label="">
<el-button type="primary" icon="Search" @click="btn_search">查询</el-button>
</el-form-item>
</el-form>
......@@ -39,7 +45,11 @@
:header-cell-style="{textAlign:'center'}"
:cell-style="{textAlign:'center'}"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection"
width="50"
align="center" />
<el-table-column :label="$t('block.indexName')" type="index" width="80" />
<el-table-column :label="$t('block.blockName')" prop="name" />
<el-table-column :label="$t('block.sortName')" prop="sort" />
......@@ -51,18 +61,33 @@
></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('block.visibleName')" prop="display" />
<el-table-column :label="$t('block.tableControlsName')" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button
link
type="info"
@click="handleEdit(row)"
>{{ $t('course.controlsEditName') }}</el-button>
>{{ $t('block.controlsEditName') }}</el-button>
<el-button
link
type="info"
@click="handleDel(row)"
>{{ $t('course.controlsDelName') }}</el-button>
>{{ $t('block.controlsDelName') }}</el-button>
<el-button
link
type="text"
@click="handleDisplay(row)"
:style="{ color:'#00FF00' }"
v-if="!row.visible"
>{{ $t('block.controlsDisplayName') }}</el-button>
<el-button
link
type="text"
@click="handleHide(row)"
:style="{ color:'#FF0000' }"
v-if="row.visible"
>{{ $t('block.controlsHideName') }}</el-button>
</template>
</el-table-column>
</el-table>
......@@ -125,7 +150,7 @@
<script setup name="ruleManager">
import { useTableHeight } from '@/hooks/useTableHeight'
// 导入api接口
import { getBuildingBlockList, getBuildingBlockLists, addBuildingBlock, editBuildingBlock, delBuildingBlock } from '@/api/legao/block'
import { getBuildingBlockList, getBuildingBlockLists, addBuildingBlock, editBuildingBlock, delBuildingBlock, displayBuildingBlock, batchDisplayBuildingBlock, hideBuildingBlock, batchHideBuildingBlock } from '@/api/legao/block'
import { reactive, toRefs } from 'vue';
const { windowSize } = useTableHeight('max-height')
// 导入字典
......@@ -164,7 +189,9 @@ const data = reactive({
ossId: [{ required: true, message: "图片不能为空", trigger: "blur" }]
}
})
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const { status, queryParams, total, list, showForm, rules, blockLists } = toRefs(data)
......@@ -246,4 +273,56 @@ function closeDialog() {
form: {}
}
}
/** 选择条数 */
function handleSelectionChange (selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
function handleDisplay(row) {
proxy.$modal.confirm(`确认显示该课程吗?`).then(() => {
return displayBuildingBlock(row.id);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
function handleBatchDisplay(row) {
const buildingBlockIds = row.id || ids.value;
proxy.$modal.confirm(`您已选择`+buildingBlockIds.length+`项内容,确认执行批量显示操作吗?`).then(() => {
return batchDisplayBuildingBlock(buildingBlockIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
function handleHide(row) {
proxy.$modal.confirm(`确认隐藏该课程吗?隐藏后APP端将不可见。`).then(() => {
return hideBuildingBlock(row.id);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
function handleBatchHide(row) {
const buildingBlockIds = row.id || ids.value;
proxy.$modal.confirm(`您已选择`+buildingBlockIds.length+`项内容,确认执行批量隐藏操作吗?`).then(() => {
return batchHideBuildingBlock(buildingBlockIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
</script>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!