提交 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') { }
prevCategoryName.value = '' const handleAddCategory = () => {
} isEdit.value = false
} else { dialogVisible.value = true
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,7 +14,9 @@ const rowInfo = ref({}) ...@@ -14,7 +14,9 @@ const rowInfo = ref({})
// 状态 // 状态
let statusList = $ref<IMapList[]>([]) let statusList = $ref<IMapList[]>([])
//表单每行数据 //表单每行数据
const listOptions = { const listOptions = $computed(() => {
return {
remote: { remote: {
httpRequest: getDictionaryList, httpRequest: getDictionaryList,
params: { params: {
...@@ -30,10 +32,7 @@ const listOptions = { ...@@ -30,10 +32,7 @@ const listOptions = {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '字典状态:', label: '字典状态:',
options: [ options: statusList
{ label: '有效', value: '1' },
{ label: '失效', value: '0' }
]
}, },
{ {
type: 'input', type: 'input',
...@@ -70,7 +69,8 @@ const listOptions = { ...@@ -70,7 +69,8 @@ const listOptions = {
] ]
} }
] ]
} }
})
// 新增弹窗 // 新增弹窗
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论