mirror of
https://github.com/TangSengDaoDao/TangSengDaoDaoManager
synced 2025-06-03 23:58:10 +00:00
feat: ✨新增应用删除
This commit is contained in:
parent
dddc30c718
commit
d857c1a953
@ -5,9 +5,6 @@
|
|||||||
<div class="bd-title-left"></div>
|
<div class="bd-title-left"></div>
|
||||||
<div class="flex items-center h-50px">
|
<div class="flex items-center h-50px">
|
||||||
<el-form inline>
|
<el-form inline>
|
||||||
<el-form-item class="mb-0 !mr-16px">
|
|
||||||
<el-input v-model="queryFrom.keyword" placeholder="轮播名称" clearable />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item class="mb-0 !mr-0">
|
<el-form-item class="mb-0 !mr-0">
|
||||||
<el-button type="primary" @click="onBannerDialogValue">新增轮播</el-button>
|
<el-button type="primary" @click="onBannerDialogValue">新增轮播</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -30,29 +27,21 @@
|
|||||||
<template v-else-if="item.formatter">
|
<template v-else-if="item.formatter">
|
||||||
<slot :name="item.prop" :row="scope.row">{{ item.formatter(scope.row) }}</slot>
|
<slot :name="item.prop" :row="scope.row">{{ item.formatter(scope.row) }}</slot>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else-if="item.prop">
|
||||||
<slot :name="item.prop" :row="scope.row">{{ scope.row[item.prop] }}</slot>
|
<slot :name="item.prop" :row="scope.row">{{ scope.row[item.prop!] }}</slot>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="bd-card-footer pl-12px pr-12px mb-12px flex items-center justify-between">
|
|
||||||
<div></div>
|
|
||||||
<el-pagination
|
|
||||||
v-model:current-page="queryFrom.page_index"
|
|
||||||
v-model:page-size="queryFrom.page_size"
|
|
||||||
:page-sizes="[15, 20, 30, 50, 100]"
|
|
||||||
:background="true"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
:total="total"
|
|
||||||
@size-change="onSizeChange"
|
|
||||||
@current-change="onCurrentChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 轮播 -->
|
<!-- 轮播 -->
|
||||||
<BannerDialog v-model:value="bannerDialogValue" />
|
<BannerDialog
|
||||||
|
v-model:value="bannerDialogValue"
|
||||||
|
:title="bannerDialogTitle"
|
||||||
|
:type="bannerDialogType"
|
||||||
|
:data="bannerDialogData"
|
||||||
|
/>
|
||||||
</bd-page>
|
</bd-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -63,6 +52,7 @@ import { BU_DOU_CONFIG } from '@/config';
|
|||||||
|
|
||||||
// API接口
|
// API接口
|
||||||
import { bannerGet, bannerDelete } from '@/api/workplace/banner';
|
import { bannerGet, bannerDelete } from '@/api/workplace/banner';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@ -105,12 +95,17 @@ const column = reactive<Column.ColumnOptions[]>([
|
|||||||
{
|
{
|
||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
|
width: 150,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (scope: any) => {
|
render: (scope: any) => {
|
||||||
return (
|
return (
|
||||||
<ElSpace>
|
<ElSpace>
|
||||||
<ElButton type="primary">编辑</ElButton>
|
<ElButton type="primary" onClick={() => onBannerEidt(scope.row)}>
|
||||||
<ElButton onClick={() => onDelBanner(scope.row)}>删除</ElButton>
|
编辑
|
||||||
|
</ElButton>
|
||||||
|
<ElButton type="danger" onClick={() => onDelBanner(scope.row)}>
|
||||||
|
删除
|
||||||
|
</ElButton>
|
||||||
</ElSpace>
|
</ElSpace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -118,8 +113,6 @@ const column = reactive<Column.ColumnOptions[]>([
|
|||||||
]);
|
]);
|
||||||
const tableData = ref<any[]>([]);
|
const tableData = ref<any[]>([]);
|
||||||
const loadTable = ref<boolean>(false);
|
const loadTable = ref<boolean>(false);
|
||||||
// 分页
|
|
||||||
const total = ref(0);
|
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const queryFrom = reactive({
|
const queryFrom = reactive({
|
||||||
@ -135,21 +128,23 @@ const getTableList = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 分页page-size
|
|
||||||
const onSizeChange = (size: number) => {
|
|
||||||
queryFrom.page_size = size;
|
|
||||||
getTableList();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 分页page-size
|
|
||||||
const onCurrentChange = (current: number) => {
|
|
||||||
queryFrom.page_index = current;
|
|
||||||
getTableList();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增轮播
|
// 新增轮播
|
||||||
const bannerDialogValue = ref(false);
|
const bannerDialogValue = ref(false);
|
||||||
|
const bannerDialogTitle = ref('新增轮播');
|
||||||
|
const bannerDialogType = ref<'add' | 'edit'>('add');
|
||||||
const onBannerDialogValue = () => {
|
const onBannerDialogValue = () => {
|
||||||
|
bannerDialogTitle.value = `新增轮播`;
|
||||||
|
bannerDialogType.value = 'add';
|
||||||
|
bannerDialogValue.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑轮播
|
||||||
|
|
||||||
|
const bannerDialogData = ref({});
|
||||||
|
const onBannerEidt = (item: any) => {
|
||||||
|
bannerDialogTitle.value = `编辑${item.title}`;
|
||||||
|
bannerDialogData.value = item;
|
||||||
|
bannerDialogType.value = 'edit';
|
||||||
bannerDialogValue.value = true;
|
bannerDialogValue.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,7 +165,7 @@ const onDelBanner = (item: any) => {
|
|||||||
getTableList();
|
getTableList();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: `轮播群组成功!`
|
message: `轮播删除成功!`
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:draggable="true"
|
:draggable="true"
|
||||||
:z-index="99"
|
:z-index="99"
|
||||||
title="新增轮播"
|
:title="title"
|
||||||
@close="onClose"
|
@close="onClose"
|
||||||
>
|
>
|
||||||
<el-form :model="formData" label-width="96px">
|
<el-form :model="formData" label-width="96px">
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<el-space>
|
<el-space>
|
||||||
<el-button @click="onClose">取消</el-button>
|
<el-button @click="onClose">取消</el-button>
|
||||||
<el-button type="primary" :loading="loaging" @click="onSend">保存</el-button>
|
<el-button type="primary" :loading="loaging" @click="onConfirm">保存</el-button>
|
||||||
</el-space>
|
</el-space>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -62,23 +62,28 @@ import { ElMessage } from 'element-plus';
|
|||||||
import { Plus } from '@element-plus/icons-vue';
|
import { Plus } from '@element-plus/icons-vue';
|
||||||
import { useUserStore } from '@/stores/modules/user';
|
import { useUserStore } from '@/stores/modules/user';
|
||||||
// API 接口
|
// API 接口
|
||||||
import { bannerPost } from '@/api/workplace/banner';
|
import { bannerPost, bannerPut } from '@/api/workplace/banner';
|
||||||
import { feileGet } from '@/api/file';
|
import { feileGet } from '@/api/file';
|
||||||
|
|
||||||
import { BU_DOU_CONFIG } from '@/config';
|
import { BU_DOU_CONFIG } from '@/config';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
title: string;
|
||||||
|
type: 'add' | 'edit';
|
||||||
|
data: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const props = withDefaults(defineProps<IProps>(), {
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
value: false
|
value: false,
|
||||||
|
title: '新增轮播',
|
||||||
|
type: 'add'
|
||||||
});
|
});
|
||||||
|
|
||||||
const content = ref('');
|
const content = ref('');
|
||||||
const loaging = ref<boolean>(false);
|
const loaging = ref<boolean>(false);
|
||||||
const formData = reactive({
|
const formData = ref({
|
||||||
cover: '',
|
cover: '',
|
||||||
title: '',
|
title: '',
|
||||||
description: '',
|
description: '',
|
||||||
@ -94,7 +99,18 @@ const emits = defineEmits<{
|
|||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
(n, _o) => {
|
(n, _o) => {
|
||||||
props.value = n;
|
if (n && props.type === 'edit') {
|
||||||
|
formData.value = props.data as any;
|
||||||
|
}
|
||||||
|
if (!n) {
|
||||||
|
formData.value = {
|
||||||
|
cover: '',
|
||||||
|
title: '',
|
||||||
|
description: '',
|
||||||
|
route: '',
|
||||||
|
jump_type: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 上传图片
|
// 上传图片
|
||||||
@ -116,17 +132,17 @@ const beforeAvatarUpload = async (rawFile: any) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleAvatarSuccess = (response: any, _uploadFile: any) => {
|
const handleAvatarSuccess = (response: any, _uploadFile: any) => {
|
||||||
console.log(response);
|
formData.value.cover = response.path;
|
||||||
formData.cover = response.path;
|
|
||||||
};
|
};
|
||||||
// 取消
|
// 取消
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
emits('update:value', false);
|
emits('update:value', false);
|
||||||
};
|
};
|
||||||
// 发送
|
|
||||||
const onSend = () => {
|
// 新增轮播
|
||||||
|
const addBanner = () => {
|
||||||
loaging.value = true;
|
loaging.value = true;
|
||||||
bannerPost(formData)
|
bannerPost(formData.value)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
loaging.value = false;
|
loaging.value = false;
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
@ -143,6 +159,36 @@ const onSend = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 编辑轮播
|
||||||
|
const editBanner = () => {
|
||||||
|
loaging.value = true;
|
||||||
|
bannerPut(formData.value)
|
||||||
|
.then((res: any) => {
|
||||||
|
loaging.value = false;
|
||||||
|
if (res.status == 200) {
|
||||||
|
ElMessage.success('编辑成功!');
|
||||||
|
content.value = '';
|
||||||
|
onClose();
|
||||||
|
emits('ok', true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
loaging.value = false;
|
||||||
|
if (err.status == 400) {
|
||||||
|
ElMessage.error(err.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 发送
|
||||||
|
const onConfirm = () => {
|
||||||
|
if (props.type === 'add') {
|
||||||
|
addBanner();
|
||||||
|
}
|
||||||
|
if (props.type === 'edit') {
|
||||||
|
editBanner();
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -187,7 +187,7 @@ const editApp = () => {
|
|||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
loaging.value = false;
|
loaging.value = false;
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
ElMessage.success('新增成功!');
|
ElMessage.success('编辑成功!');
|
||||||
content.value = '';
|
content.value = '';
|
||||||
onClose();
|
onClose();
|
||||||
emits('ok', true);
|
emits('ok', true);
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
<el-form-item class="mb-0 !mr-16px">
|
<el-form-item class="mb-0 !mr-16px">
|
||||||
<el-input v-model="queryFrom.keyword" placeholder="应用名称/APP ID" clearable />
|
<el-input v-model="queryFrom.keyword" placeholder="应用名称/APP ID" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item class="mb-0 !mr-16px">
|
||||||
|
<el-button type="primary" @click="getTableList">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item class="mb-0 !mr-0">
|
<el-form-item class="mb-0 !mr-0">
|
||||||
<el-button type="primary" @click="onAppVersionAdd">新增应用</el-button>
|
<el-button type="primary" @click="onAppVersionAdd">新增应用</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -65,12 +68,12 @@ meta:
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { ElButton, ElSpace, ElImage } from 'element-plus';
|
import { ElButton, ElMessageBox, ElMessage, ElSpace, ElImage } from 'element-plus';
|
||||||
import Apply from './components/Apply.vue';
|
import Apply from './components/Apply.vue';
|
||||||
import { BU_DOU_CONFIG } from '@/config';
|
import { BU_DOU_CONFIG } from '@/config';
|
||||||
|
|
||||||
// API接口
|
// API接口
|
||||||
import { appGet } from '@/api/workplace/app';
|
import { appGet, appDelete } from '@/api/workplace/app';
|
||||||
/**
|
/**
|
||||||
* 新增应用
|
* 新增应用
|
||||||
*/
|
*/
|
||||||
@ -139,7 +142,9 @@ const column = reactive<Column.ColumnOptions[]>([
|
|||||||
<ElButton type="primary" onClick={() => oApplyEidt(scope.row)}>
|
<ElButton type="primary" onClick={() => oApplyEidt(scope.row)}>
|
||||||
编辑
|
编辑
|
||||||
</ElButton>
|
</ElButton>
|
||||||
<ElButton>删除</ElButton>
|
<ElButton type="danger" onClick={() => onDelApply(scope.row)}>
|
||||||
|
删除
|
||||||
|
</ElButton>
|
||||||
</ElSpace>
|
</ElSpace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -173,6 +178,40 @@ const oApplyEidt = (item: any) => {
|
|||||||
applyAddValue.value = true;
|
applyAddValue.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 删除应用
|
||||||
|
const onDelApply = (item: any) => {
|
||||||
|
ElMessageBox.confirm(`确定要对该应用吗?`, `操作提示`, {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
closeOnClickModal: false,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const fromLiftban = {
|
||||||
|
banner_no: item.banner_no
|
||||||
|
};
|
||||||
|
appDelete(fromLiftban)
|
||||||
|
.then((_res: any) => {
|
||||||
|
getTableList();
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: `应用删除成功!`
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err.status == 400) {
|
||||||
|
ElMessage.error(err.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '取消成功!'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 分页page-size
|
// 分页page-size
|
||||||
const onSizeChange = (size: number) => {
|
const onSizeChange = (size: number) => {
|
||||||
queryFrom.page_size = size;
|
queryFrom.page_size = size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user