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

updates

上级 47613f2f
......@@ -46,7 +46,7 @@ watch(filterText, 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')
if (!value) return true
return data.category_name.indexOf(value) != -1
......
......@@ -6,7 +6,6 @@ import { getCategoryList, delCategory, createCategory, updateCategory } from '..
import { ElMessage, ElMessageBox } from 'element-plus'
const loading = ref(false)
const prevCategoryName = ref('') // 上层类别
const title = ref('')
const dialogVisible = ref(false)
let form = reactive({
......@@ -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
dialogVisible.value = true
title.value = '新增类别'
if (row) {
editData.value = row
if (row.depth === '0') {
prevCategoryName.value = ''
}
} else {
}
const handleAddCategory = () => {
isEdit.value = false
dialogVisible.value = true
title.value = '新增类别'
editData.value = tableData[0]
}
}
// const sortable = (className: any, targetName: any) => {
......@@ -166,14 +164,14 @@ onMounted(() => {
</el-form-item>
</el-form>
</div>
<el-button type="primary" @click="handleAdd">新增类别</el-button>
<el-button type="primary" @click="handleAddCategory">新增类别</el-button>
<el-table
class="t1"
:data="tableData"
style="width: 100%"
row-key="id"
ref="dragTable"
:tree-props="{ children: 'children', hasChildren: 'hasChildren', draggable: true }"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
highlight-current-row
v-loading="loading"
>
......@@ -186,7 +184,7 @@ onMounted(() => {
<el-table-column align="center" label="操作" width="300px">
<template #default="scope">
<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>
</template>
</el-table-column>
......
......@@ -6,7 +6,6 @@ import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
const router = useRouter()
const formSize = ref('default')
const ruleFormRef = ref<FormInstance>()
let ruleForm = reactive({
id: '',
......@@ -51,14 +50,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
<template>
<AppCard title="添加讲师">
<el-form
ref="ruleFormRef"
:model="ruleForm"
:rules="rules"
label-width="120px"
class="demo-ruleForm"
:size="formSize"
>
<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-row>
<el-col :span="10">
<el-form-item label="讲师姓名:" prop="name">
......
......@@ -14,7 +14,9 @@ const rowInfo = ref({})
// 状态
let statusList = $ref<IMapList[]>([])
//表单每行数据
const listOptions = {
const listOptions = $computed(() => {
return {
remote: {
httpRequest: getDictionaryList,
params: {
......@@ -30,10 +32,7 @@ const listOptions = {
type: 'select',
prop: 'status',
label: '字典状态:',
options: [
{ label: '有效', value: '1' },
{ label: '失效', value: '0' }
]
options: statusList
},
{
type: 'input',
......@@ -70,7 +69,8 @@ const listOptions = {
]
}
]
}
}
})
// 新增弹窗
const handleAdd = () => {
isShowDialog.value = true
......
......@@ -32,3 +32,5 @@ export const useMapStore = defineStore({
}
}
})
useMapStore().getMapList()
......@@ -7,7 +7,8 @@
"paths": {
"@/*": ["./src/*"]
},
"suppressImplicitAnyIndexErrors": true
"suppressImplicitAnyIndexErrors": true,
"types": ["element-plus/global"]
},
"references": [
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论