提交 692d0f6f authored 作者: matian's avatar matian

updates

上级 64c6fa21
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取分类列表 // 获取分类列表
export function getCategoryList(params: { type: string; category_name?: string }) { export function getCategoryList(params: { type: string }) {
return httpRequest.get('/api/resource/v1/backend/category/list', { params }) return httpRequest.get('/api/resource/v1/backend/category/list', { params })
} }
// 新建分类 // 新建分类
......
...@@ -11,7 +11,6 @@ const dialogVisible = ref(false) ...@@ -11,7 +11,6 @@ const dialogVisible = ref(false)
let form = reactive({ let form = reactive({
category_name: '' category_name: ''
}) })
interface ICategory { interface ICategory {
category_name: number category_name: number
depth: string depth: string
...@@ -19,7 +18,7 @@ interface ICategory { ...@@ -19,7 +18,7 @@ interface ICategory {
lft: string lft: string
need_pass: string need_pass: string
rgt: string rgt: string
status: string status_name: string
children?: ICategory[] children?: ICategory[]
} }
let tableData = $ref<ICategory[]>([]) let tableData = $ref<ICategory[]>([])
...@@ -70,9 +69,7 @@ const handleAddCategory = () => { ...@@ -70,9 +69,7 @@ const handleAddCategory = () => {
const getParent = (node: string, tree: any) => { const getParent = (node: string, tree: any) => {
let result: any = [] let result: any = []
function find(node: string, tree: any) { function find(node: string, tree: any) {
console.log(node, tree[0], 'tree')
tree.children.forEach((item: any) => { tree.children.forEach((item: any) => {
// console.log(item, 'item000')
if (item.id === node) { if (item.id === node) {
result.push(tree) result.push(tree)
} }
...@@ -211,7 +208,7 @@ onMounted(() => { ...@@ -211,7 +208,7 @@ onMounted(() => {
</el-table-column> </el-table-column>
<el-table-column prop="category_name" label="类别名称" align="center" class-name="handle" /> <el-table-column prop="category_name" label="类别名称" align="center" class-name="handle" />
<el-table-column prop="depth" label="层级" align="center" /> <el-table-column prop="depth" label="层级" align="center" />
<el-table-column prop="status" label="状态" align="center"> </el-table-column> <el-table-column prop="status_name" label="状态" align="center"> </el-table-column>
<el-table-column align="center" label="操作" width="300px"> <el-table-column align="center" label="操作" width="300px">
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> <el-button type="primary" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
......
...@@ -26,7 +26,8 @@ const rules = reactive<FormRules>({ ...@@ -26,7 +26,8 @@ const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入讲师姓名', trigger: 'blur' }], name: [{ required: true, message: '请输入讲师姓名', trigger: 'blur' }],
title: [{ required: true, message: ' 请输入职位', trigger: 'blur' }] title: [{ required: true, message: ' 请输入职位', trigger: 'blur' }]
}) })
const listOptions = { const listOptions = $computed(() => {
return {
remote: { remote: {
params: { type: '' } params: { type: '' }
}, },
...@@ -44,6 +45,7 @@ const listOptions = { ...@@ -44,6 +45,7 @@ const listOptions = {
{ label: '操作', slots: 'table-operate', width: 300, align: 'center' } { label: '操作', slots: 'table-operate', width: 300, align: 'center' }
] ]
} }
})
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
console.log('删除', row) console.log('删除', row)
...@@ -82,7 +84,7 @@ onMounted(() => { ...@@ -82,7 +84,7 @@ onMounted(() => {
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="讲师图片:" prop="avatar"> <el-form-item label="讲师图片:" prop="avatar">
<div v-if="isEdit === '1'">暂无照片</div> <div v-if="isEdit === '1'" class="avatar_box">暂无照片</div>
<AppUpload v-model="ruleForm.avatar" v-else /> <AppUpload v-model="ruleForm.avatar" v-else />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -133,4 +135,12 @@ onMounted(() => { ...@@ -133,4 +135,12 @@ onMounted(() => {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
} }
.avatar_box {
width: 150px;
height: 200px;
text-align: center;
line-height: 200px;
color: #ccc;
border: 1px dashed #ccc;
}
</style> </style>
...@@ -3,7 +3,8 @@ import { ElMessage,ElMessageBox } from 'element-plus' ...@@ -3,7 +3,8 @@ import { ElMessage,ElMessageBox } from 'element-plus'
import { getTeacherList, deleteTeacher } from '../api' import { getTeacherList, deleteTeacher } from '../api'
const router = useRouter() const router = useRouter()
const appList = ref() const appList = ref()
const listOptions = { const listOptions = $computed(() => {
return {
remote: { remote: {
httpRequest: getTeacherList, httpRequest: getTeacherList,
params: { type: '' } params: { type: '' }
...@@ -25,6 +26,7 @@ const listOptions = { ...@@ -25,6 +26,7 @@ const listOptions = {
{ label: '操作', slots: 'table-operate', width: 230, align: 'center' } { label: '操作', slots: 'table-operate', width: 230, align: 'center' }
] ]
} }
})
// 删除讲师 // 删除讲师
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
ElMessageBox.confirm('确定要删除吗?', '提示').then(() => { ElMessageBox.confirm('确定要删除吗?', '提示').then(() => {
......
...@@ -4,8 +4,8 @@ import { getVideoList } from '../api' ...@@ -4,8 +4,8 @@ import { getVideoList } from '../api'
const appList = ref() const appList = ref()
const isCard = ref(false) const isCard = ref(false)
const listOptions = $computed(() => {
const listOptions = { return {
remote: { remote: {
httpRequest: getVideoList, httpRequest: getVideoList,
params: { type: '' }, params: { type: '' },
...@@ -33,6 +33,7 @@ const listOptions = { ...@@ -33,6 +33,7 @@ const listOptions = {
{ id: 2, title: '视频标题', type: '视频分类' } { id: 2, title: '视频标题', type: '视频分类' }
] ]
} }
})
</script> </script>
<template> <template>
......
...@@ -7,7 +7,8 @@ const appList = ref() ...@@ -7,7 +7,8 @@ const appList = ref()
const isShowDialog = ref(false) const isShowDialog = ref(false)
const isEdit = ref(false) const isEdit = ref(false)
const editData = ref({}) const editData = ref({})
const listOptions = { const listOptions = $computed(() => {
return {
remote: { remote: {
httpRequest: getCoverList, httpRequest: getCoverList,
params: { type: '' } params: { type: '' }
...@@ -26,6 +27,7 @@ const listOptions = { ...@@ -26,6 +27,7 @@ const listOptions = {
{ label: '操作', slots: 'table-operate', width: 230, align: 'center' } { label: '操作', slots: 'table-operate', width: 230, align: 'center' }
] ]
} }
})
// 删除 // 删除
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
ElMessageBox.confirm('确定要删除吗?', '提示').then(() => { ElMessageBox.confirm('确定要删除吗?', '提示').then(() => {
......
...@@ -3,14 +3,13 @@ import { ElMessage, ElMessageBox } from 'element-plus' ...@@ -3,14 +3,13 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import { getDictionaryList, createDictionary, updateDictionary, delDictionary } from '../api' import { getDictionaryList, createDictionary, updateDictionary, delDictionary } from '../api'
import AddDialog from '../component/AddDialog.vue' import AddDialog from '../component/AddDialog.vue'
const store = useMapStore()
const statusList = store.mapList.filter((item: any) => item.key === 'system_status')[0].values
const router = useRouter() const router = useRouter()
const appList = ref() const appList = ref()
const isShowDialog = ref(false) // 新增字典弹框状态 const isShowDialog = ref(false) // 新增字典弹框状态
const isEdit = ref(false) //是否可编辑 const isEdit = ref(false) //是否可编辑
const rowInfo = ref({}) const rowInfo = ref({})
const store = useMapStore()
// 状态 // 状态
//表单每行数据 //表单每行数据
...@@ -31,7 +30,7 @@ const listOptions = $computed(() => { ...@@ -31,7 +30,7 @@ const listOptions = $computed(() => {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '字典状态:', label: '字典状态:',
options: statusList options: store.mapList?.filter((item: any) => item.key === 'system_status')[0]?.values || []
}, },
{ {
type: 'input', type: 'input',
...@@ -53,20 +52,6 @@ const listOptions = $computed(() => { ...@@ -53,20 +52,6 @@ const listOptions = $computed(() => {
{ label: '备注 ', prop: 'remark', align: 'center' }, { label: '备注 ', prop: 'remark', align: 'center' },
{ label: '创建时间', prop: 'created_time', align: 'center' }, { label: '创建时间', prop: 'created_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 300 } { label: '操作', slots: 'table-operate', align: 'center', width: 300 }
],
data: [
{
key: 1,
name: '用户性别',
type: 'sex',
status: '0',
remark: '用户性别列表',
created_time: '2022-05-30',
rowList: [
{ key: 1, name: '用户性别', type: 'sex', status: '0', remark: '用户性别列表', created_time: '2022-05-30' },
{ key: 2, name: '用户年龄', type: 'age', status: '1', remark: '用户年龄列表', created_time: '2022-05-31' }
]
}
] ]
} }
}) })
...@@ -144,13 +129,7 @@ const handleConfirm = (val: any) => { ...@@ -144,13 +129,7 @@ const handleConfirm = (val: any) => {
</el-space> </el-space>
</template> </template>
<template v-if="isShowDialog === true"> <template v-if="isShowDialog === true">
<AddDialog <AddDialog v-model:isShowDialog="isShowDialog" :isEdit="isEdit" :rowInfo="rowInfo" @confirm="handleConfirm" />
v-model:isShowDialog="isShowDialog"
:isEdit="isEdit"
:rowInfo="rowInfo"
:statusList="statusList"
@confirm="handleConfirm"
/>
</template> </template>
</AppList> </AppList>
</AppCard> </AppCard>
......
...@@ -10,27 +10,28 @@ const title = ref('') ...@@ -10,27 +10,28 @@ const title = ref('')
const type = route.query.type as string const type = route.query.type as string
const isEdit = ref(false) const isEdit = ref(false)
const isListAddDialog = ref(false) const isListAddDialog = ref(false)
const listOptions = $computed(() => {
const listOptions = { return {
remote: { remote: {
httpRequest: getDictionaryItemList, httpRequest: getDictionaryItemList,
params: { data_dictionary_id: route.query.id } params: { data_dictionary_id: route.query.id }
},
columns: [
{ label: '字典编码', prop: 'data_dictionary_id', align: 'center' },
{ label: '字典标签', prop: 'label', align: 'center' },
{ label: '字典键值', prop: 'value', align: 'center' },
{
label: '状态',
prop: 'status_name',
align: 'center'
}, },
{ label: '备注 ', prop: 'remark', align: 'center' },
{ label: '创建时间', prop: 'created_time', align: 'center' }, columns: [
{ label: '操作', slots: 'table-operate', align: 'center', minWidth: 180 } { label: '字典编码', prop: 'data_dictionary_id', align: 'center' },
] { label: '字典标签', prop: 'label', align: 'center' },
} { label: '字典键值', prop: 'value', align: 'center' },
{
label: '状态',
prop: 'status_name',
align: 'center'
},
{ label: '备注 ', prop: 'remark', align: 'center' },
{ label: '创建时间', prop: 'created_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', minWidth: 180 }
]
}
})
const handleAdd = () => { const handleAdd = () => {
isListAddDialog.value = true isListAddDialog.value = true
isEdit.value = false isEdit.value = false
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论