隐藏系列
Showing
3 changed files
with
120 additions
and
5 deletions
| ... | @@ -41,3 +41,35 @@ export function delBuildingBlock(id) { | ... | @@ -41,3 +41,35 @@ export function delBuildingBlock(id) { |
| 41 | method: 'DELETE', | 41 | method: 'DELETE', |
| 42 | }) | 42 | }) |
| 43 | } | 43 | } |
| 44 | |||
| 45 | // 显示 | ||
| 46 | export function displayBuildingBlock(id) { | ||
| 47 | return request({ | ||
| 48 | url: `/core/buildingBlock/display/${id}`, | ||
| 49 | method: 'put', | ||
| 50 | }) | ||
| 51 | } | ||
| 52 | |||
| 53 | // 批量显示 | ||
| 54 | export function batchDisplayBuildingBlock(ids) { | ||
| 55 | return request({ | ||
| 56 | url: `/core/buildingBlock/batch/display/${ids}`, | ||
| 57 | method: 'put', | ||
| 58 | }) | ||
| 59 | } | ||
| 60 | |||
| 61 | // 隐藏 | ||
| 62 | export function hideBuildingBlock(id) { | ||
| 63 | return request({ | ||
| 64 | url: `/core/buildingBlock/hide/${id}`, | ||
| 65 | method: 'put', | ||
| 66 | }) | ||
| 67 | } | ||
| 68 | |||
| 69 | // 批量隐藏 | ||
| 70 | export function batchHideBuildingBlock(ids) { | ||
| 71 | return request({ | ||
| 72 | url: `/core/buildingBlock/batch/hide/${ids}`, | ||
| 73 | method: 'put', | ||
| 74 | }) | ||
| 75 | } | ... | ... |
| ... | @@ -68,12 +68,16 @@ export default { | ... | @@ -68,12 +68,16 @@ export default { |
| 68 | typeName: '类型', | 68 | typeName: '类型', |
| 69 | sortName: '排序', | 69 | sortName: '排序', |
| 70 | packName: '是否打包', | 70 | packName: '是否打包', |
| 71 | visibleName: '状态', | ||
| 71 | groupName: '套件', | 72 | groupName: '套件', |
| 72 | tableControlsName: '操作', | 73 | tableControlsName: '操作', |
| 73 | controlsDelName: '删除', | 74 | controlsDelName: '删除', |
| 74 | controlsEditName: '编辑', | 75 | controlsEditName: '编辑', |
| 76 | controlsDisplayName: '显示', | ||
| 77 | controlsHideName: '隐藏', | ||
| 75 | controlsAddName: '新增系列', | 78 | controlsAddName: '新增系列', |
| 76 | placeholder: '系列名称搜索', | 79 | placeholder: '系列名称搜索', |
| 80 | |||
| 77 | // 新增 | 81 | // 新增 |
| 78 | dialogTitleAdd: '新增', | 82 | dialogTitleAdd: '新增', |
| 79 | dialogTitleEdit: '修改', | 83 | dialogTitleEdit: '修改', |
| ... | @@ -100,7 +104,7 @@ export default { | ... | @@ -100,7 +104,7 @@ export default { |
| 100 | controlsEditName: '编辑', | 104 | controlsEditName: '编辑', |
| 101 | controlsDelName: '删除', | 105 | controlsDelName: '删除', |
| 102 | controlsDisplayName: '显示', | 106 | controlsDisplayName: '显示', |
| 103 | controlsHideName: '隐藏', | 107 | controlsHideName: '隐藏', |
| 104 | controlsAddName: '新增课程', | 108 | controlsAddName: '新增课程', |
| 105 | placeholder: '课程、套件、系列名称搜索', | 109 | placeholder: '课程、套件、系列名称搜索', |
| 106 | // 新增 | 110 | // 新增 | ... | ... |
| ... | @@ -15,6 +15,12 @@ | ... | @@ -15,6 +15,12 @@ |
| 15 | /> | 15 | /> |
| 16 | </el-form-item> | 16 | </el-form-item> |
| 17 | <el-form-item label=""> | 17 | <el-form-item label=""> |
| 18 | <el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchHide">批量隐藏</el-button> | ||
| 19 | </el-form-item> | ||
| 20 | <el-form-item label=""> | ||
| 21 | <el-button type="primary" icon="Plus" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button> | ||
| 22 | </el-form-item> | ||
| 23 | <el-form-item label=""> | ||
| 18 | <el-button type="primary" icon="Search" @click="btn_search">查询</el-button> | 24 | <el-button type="primary" icon="Search" @click="btn_search">查询</el-button> |
| 19 | </el-form-item> | 25 | </el-form-item> |
| 20 | </el-form> | 26 | </el-form> |
| ... | @@ -39,7 +45,11 @@ | ... | @@ -39,7 +45,11 @@ |
| 39 | :header-cell-style="{textAlign:'center'}" | 45 | :header-cell-style="{textAlign:'center'}" |
| 40 | :cell-style="{textAlign:'center'}" | 46 | :cell-style="{textAlign:'center'}" |
| 41 | border | 47 | border |
| 48 | @selection-change="handleSelectionChange" | ||
| 42 | > | 49 | > |
| 50 | <el-table-column type="selection" | ||
| 51 | width="50" | ||
| 52 | align="center" /> | ||
| 43 | <el-table-column :label="$t('block.indexName')" type="index" width="80" /> | 53 | <el-table-column :label="$t('block.indexName')" type="index" width="80" /> |
| 44 | <el-table-column :label="$t('block.blockName')" prop="name" /> | 54 | <el-table-column :label="$t('block.blockName')" prop="name" /> |
| 45 | <el-table-column :label="$t('block.sortName')" prop="sort" /> | 55 | <el-table-column :label="$t('block.sortName')" prop="sort" /> |
| ... | @@ -51,18 +61,33 @@ | ... | @@ -51,18 +61,33 @@ |
| 51 | ></dict-tag> | 61 | ></dict-tag> |
| 52 | </template> | 62 | </template> |
| 53 | </el-table-column> | 63 | </el-table-column> |
| 64 | <el-table-column :label="$t('block.visibleName')" prop="display" /> | ||
| 54 | <el-table-column :label="$t('block.tableControlsName')" class-name="small-padding fixed-width"> | 65 | <el-table-column :label="$t('block.tableControlsName')" class-name="small-padding fixed-width"> |
| 55 | <template #default="{ row }"> | 66 | <template #default="{ row }"> |
| 56 | <el-button | 67 | <el-button |
| 57 | link | 68 | link |
| 58 | type="info" | 69 | type="info" |
| 59 | @click="handleEdit(row)" | 70 | @click="handleEdit(row)" |
| 60 | >{{ $t('course.controlsEditName') }}</el-button> | 71 | >{{ $t('block.controlsEditName') }}</el-button> |
| 61 | <el-button | 72 | <el-button |
| 62 | link | 73 | link |
| 63 | type="info" | 74 | type="info" |
| 64 | @click="handleDel(row)" | 75 | @click="handleDel(row)" |
| 65 | >{{ $t('course.controlsDelName') }}</el-button> | 76 | >{{ $t('block.controlsDelName') }}</el-button> |
| 77 | <el-button | ||
| 78 | link | ||
| 79 | type="text" | ||
| 80 | @click="handleDisplay(row)" | ||
| 81 | :style="{ color:'#00FF00' }" | ||
| 82 | v-if="!row.visible" | ||
| 83 | >{{ $t('block.controlsDisplayName') }}</el-button> | ||
| 84 | <el-button | ||
| 85 | link | ||
| 86 | type="text" | ||
| 87 | @click="handleHide(row)" | ||
| 88 | :style="{ color:'#FF0000' }" | ||
| 89 | v-if="row.visible" | ||
| 90 | >{{ $t('block.controlsHideName') }}</el-button> | ||
| 66 | </template> | 91 | </template> |
| 67 | </el-table-column> | 92 | </el-table-column> |
| 68 | </el-table> | 93 | </el-table> |
| ... | @@ -125,7 +150,7 @@ | ... | @@ -125,7 +150,7 @@ |
| 125 | <script setup name="ruleManager"> | 150 | <script setup name="ruleManager"> |
| 126 | import { useTableHeight } from '@/hooks/useTableHeight' | 151 | import { useTableHeight } from '@/hooks/useTableHeight' |
| 127 | // 导入api接口 | 152 | // 导入api接口 |
| 128 | import { getBuildingBlockList, getBuildingBlockLists, addBuildingBlock, editBuildingBlock, delBuildingBlock } from '@/api/legao/block' | 153 | import { getBuildingBlockList, getBuildingBlockLists, addBuildingBlock, editBuildingBlock, delBuildingBlock, displayBuildingBlock, batchDisplayBuildingBlock, hideBuildingBlock, batchHideBuildingBlock } from '@/api/legao/block' |
| 129 | import { reactive, toRefs } from 'vue'; | 154 | import { reactive, toRefs } from 'vue'; |
| 130 | const { windowSize } = useTableHeight('max-height') | 155 | const { windowSize } = useTableHeight('max-height') |
| 131 | // 导入字典 | 156 | // 导入字典 |
| ... | @@ -164,7 +189,9 @@ const data = reactive({ | ... | @@ -164,7 +189,9 @@ const data = reactive({ |
| 164 | ossId: [{ required: true, message: "图片不能为空", trigger: "blur" }] | 189 | ossId: [{ required: true, message: "图片不能为空", trigger: "blur" }] |
| 165 | } | 190 | } |
| 166 | }) | 191 | }) |
| 167 | 192 | const ids = ref([]); | |
| 193 | const single = ref(true); | ||
| 194 | const multiple = ref(true); | ||
| 168 | const { status, queryParams, total, list, showForm, rules, blockLists } = toRefs(data) | 195 | const { status, queryParams, total, list, showForm, rules, blockLists } = toRefs(data) |
| 169 | 196 | ||
| 170 | 197 | ||
| ... | @@ -246,4 +273,56 @@ function closeDialog() { | ... | @@ -246,4 +273,56 @@ function closeDialog() { |
| 246 | form: {} | 273 | form: {} |
| 247 | } | 274 | } |
| 248 | } | 275 | } |
| 276 | /** 选择条数 */ | ||
| 277 | function handleSelectionChange (selection) { | ||
| 278 | ids.value = selection.map(item => item.id); | ||
| 279 | single.value = selection.length != 1; | ||
| 280 | multiple.value = !selection.length; | ||
| 281 | } | ||
| 282 | |||
| 283 | function handleDisplay(row) { | ||
| 284 | proxy.$modal.confirm(`确认显示该课程吗?`).then(() => { | ||
| 285 | return displayBuildingBlock(row.id); | ||
| 286 | }).then(() => { | ||
| 287 | getList(); | ||
| 288 | proxy.$modal.msgSuccess(res.msg); | ||
| 289 | }).finally(() => { | ||
| 290 | |||
| 291 | }); | ||
| 292 | } | ||
| 293 | |||
| 294 | function handleBatchDisplay(row) { | ||
| 295 | const buildingBlockIds = row.id || ids.value; | ||
| 296 | proxy.$modal.confirm(`您已选择`+buildingBlockIds.length+`项内容,确认执行批量显示操作吗?`).then(() => { | ||
| 297 | return batchDisplayBuildingBlock(buildingBlockIds); | ||
| 298 | }).then(() => { | ||
| 299 | getList(); | ||
| 300 | proxy.$modal.msgSuccess(res.msg); | ||
| 301 | }).finally(() => { | ||
| 302 | |||
| 303 | }); | ||
| 304 | } | ||
| 305 | |||
| 306 | function handleHide(row) { | ||
| 307 | proxy.$modal.confirm(`确认隐藏该课程吗?隐藏后APP端将不可见。`).then(() => { | ||
| 308 | return hideBuildingBlock(row.id); | ||
| 309 | }).then(() => { | ||
| 310 | getList(); | ||
| 311 | proxy.$modal.msgSuccess(res.msg); | ||
| 312 | }).finally(() => { | ||
| 313 | |||
| 314 | }); | ||
| 315 | } | ||
| 316 | |||
| 317 | function handleBatchHide(row) { | ||
| 318 | const buildingBlockIds = row.id || ids.value; | ||
| 319 | proxy.$modal.confirm(`您已选择`+buildingBlockIds.length+`项内容,确认执行批量隐藏操作吗?`).then(() => { | ||
| 320 | return batchHideBuildingBlock(buildingBlockIds); | ||
| 321 | }).then(() => { | ||
| 322 | getList(); | ||
| 323 | proxy.$modal.msgSuccess(res.msg); | ||
| 324 | }).finally(() => { | ||
| 325 | |||
| 326 | }); | ||
| 327 | } | ||
| 249 | </script> | 328 | </script> | ... | ... |
-
Please register or sign in to post a comment