提交 9d16a6e8 authored 作者: matian's avatar matian

updates

上级 47613f2f
...@@ -46,7 +46,7 @@ watch(filterText, val => { ...@@ -46,7 +46,7 @@ watch(filterText, val => {
treeRef.value?.filter(val) treeRef.value?.filter(val)
}) })
//搜索 //搜索
const filterNode = (value: string, data: ICategory) => { const filterNode = (value: string, data: any) => {
console.log(value, 'value', data.category_name, 'data') console.log(value, 'value', data.category_name, 'data')
if (!value) return true if (!value) return true
return data.category_name.indexOf(value) != -1 return data.category_name.indexOf(value) != -1
......
...@@ -6,7 +6,6 @@ import { getCategoryList, delCategory, createCategory, updateCategory } from '.. ...@@ -6,7 +6,6 @@ import { getCategoryList, delCategory, createCategory, updateCategory } from '..
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
const loading = ref(false) const loading = ref(false)
const prevCategoryName = ref('') // 上层类别
const title = ref('') const title = ref('')
const dialogVisible = ref(false) const dialogVisible = ref(false)
let form = reactive({ let form = reactive({
...@@ -43,18 +42,17 @@ const handleDelete = (index: number, row: ICategory) => { ...@@ -43,18 +42,17 @@ const handleDelete = (index: number, row: ICategory) => {
}) })
} }
// 新增类别 // 新增类别
const handleAdd = (index: number, row: ICategory) => { const handleAddRow = (index: number, row: ICategory) => {
isEdit.value = false isEdit.value = false
dialogVisible.value = true dialogVisible.value = true
title.value = '新增类别' title.value = '新增类别'
if (row) { editData.value = row
editData.value = row }
if (row.depth === '0') { const handleAddCategory = () => {
prevCategoryName.value = '' isEdit.value = false
} dialogVisible.value = true
} else { title.value = '新增类别'
editData.value = tableData[0] editData.value = tableData[0]
}
} }
// const sortable = (className: any, targetName: any) => { // const sortable = (className: any, targetName: any) => {
...@@ -166,14 +164,14 @@ onMounted(() => { ...@@ -166,14 +164,14 @@ onMounted(() => {
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-button type="primary" @click="handleAdd">新增类别</el-button> <el-button type="primary" @click="handleAddCategory">新增类别</el-button>
<el-table <el-table
class="t1" class="t1"
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
row-key="id" row-key="id"
ref="dragTable" ref="dragTable"
:tree-props="{ children: 'children', hasChildren: 'hasChildren', draggable: true }" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
highlight-current-row highlight-current-row
v-loading="loading" v-loading="loading"
> >
...@@ -186,7 +184,7 @@ onMounted(() => { ...@@ -186,7 +184,7 @@ onMounted(() => {
<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>
<el-button @click="handleAdd(scope.$index, scope.row)">新增</el-button> <el-button @click="handleAddRow(scope.$index, scope.row)">新增</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)">删除</el-button> <el-button @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
......
...@@ -6,7 +6,6 @@ import { ElMessage } from 'element-plus' ...@@ -6,7 +6,6 @@ import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
const router = useRouter() const router = useRouter()
const formSize = ref('default')
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
let ruleForm = reactive({ let ruleForm = reactive({
id: '', id: '',
...@@ -51,14 +50,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { ...@@ -51,14 +50,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
<template> <template>
<AppCard title="添加讲师"> <AppCard title="添加讲师">
<el-form <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
ref="ruleFormRef"
:model="ruleForm"
:rules="rules"
label-width="120px"
class="demo-ruleForm"
:size="formSize"
>
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="讲师姓名:" prop="name"> <el-form-item label="讲师姓名:" prop="name">
......
...@@ -14,63 +14,63 @@ const rowInfo = ref({}) ...@@ -14,63 +14,63 @@ const rowInfo = ref({})
// 状态 // 状态
let statusList = $ref<IMapList[]>([]) let statusList = $ref<IMapList[]>([])
//表单每行数据 //表单每行数据
const listOptions = { const listOptions = $computed(() => {
remote: {
httpRequest: getDictionaryList, return {
params: { remote: {
type: '', httpRequest: getDictionaryList,
created_time_start: '', params: {
created_time_end: '' type: '',
} created_time_start: '',
}, created_time_end: ''
filters: [ }
{ type: 'input', prop: 'name', label: '字典名称:' },
{ type: 'input', prop: 'key', label: '字典类型:' },
{
type: 'select',
prop: 'status',
label: '字典状态:',
options: [
{ label: '有效', value: '1' },
{ label: '失效', value: '0' }
]
},
{
type: 'input',
label: '创建时间:',
slots: 'created_time_start',
prop: 'created_time_start'
}, },
{ slots: 'created_time_end', prop: 'created_time_end' } filters: [
], { type: 'input', prop: 'name', label: '字典名称:' },
columns: [ { type: 'input', prop: 'key', label: '字典类型:' },
{ label: '字典主键', prop: 'id', width: 224, align: 'center' }, {
{ label: '字典名称', prop: 'name', align: 'center' }, type: 'select',
{ label: '字典类型', prop: 'key', align: 'center' }, prop: 'status',
{ label: '字典状态:',
label: '状态', options: statusList
prop: 'status_name', },
align: 'center' {
}, type: 'input',
{ label: '备注 ', prop: 'remark', align: 'center' }, label: '创建时间:',
{ label: '创建时间', prop: 'created_time', align: 'center' }, slots: 'created_time_start',
{ label: '操作', slots: 'table-operate', align: 'center', width: 300 } prop: 'created_time_start'
], },
data: [ { slots: 'created_time_end', prop: 'created_time_end' }
{ ],
key: 1, columns: [
name: '用户性别', { label: '字典主键', prop: 'id', width: 224, align: 'center' },
type: 'sex', { label: '字典名称', prop: 'name', align: 'center' },
status: '0', { label: '字典类型', prop: 'key', align: 'center' },
remark: '用户性别列表', {
created_time: '2022-05-30', label: '状态',
rowList: [ prop: 'status_name',
{ key: 1, name: '用户性别', type: 'sex', status: '0', remark: '用户性别列表', created_time: '2022-05-30' }, align: 'center'
{ key: 2, name: '用户年龄', type: 'age', status: '1', remark: '用户年龄列表', created_time: '2022-05-31' } },
] { label: '备注 ', prop: 'remark', align: 'center' },
} { label: '创建时间', prop: 'created_time', align: 'center' },
] { 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' }
]
}
]
}
})
// 新增弹窗 // 新增弹窗
const handleAdd = () => { const handleAdd = () => {
isShowDialog.value = true isShowDialog.value = true
......
...@@ -32,3 +32,5 @@ export const useMapStore = defineStore({ ...@@ -32,3 +32,5 @@ export const useMapStore = defineStore({
} }
} }
}) })
useMapStore().getMapList()
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"]
}, },
"suppressImplicitAnyIndexErrors": true "suppressImplicitAnyIndexErrors": true,
"types": ["element-plus/global"]
}, },
"references": [ "references": [
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论