修改测试问题

This commit is contained in:
guanj
2026-06-30 08:38:05 +08:00
parent 490b52b525
commit 536f22584d
103 changed files with 3220 additions and 2394 deletions

View File

@@ -33,7 +33,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确定</el-button>
</span>
</template>
</el-dialog>
@@ -52,6 +52,7 @@ const emit = defineEmits(['cancel', 'submit'])
const dialogVisible = ref(false)
const title = ref('')
const formRef = ref()
const loading = ref(false)
// 注意不要和表单ref的命名冲突
const form = ref<anyObj>({
name: '',
@@ -118,6 +119,7 @@ function deletePathNotNull(data: any) {
const submit = () => {
formRef.value.validate(async (valid: boolean) => {
if (valid) {
loading.value = true
if (title.value == '新增树') {
await componentAdd({
...form.value,
@@ -127,6 +129,8 @@ const submit = () => {
ElMessage.success('新增成功!')
emit('submit')
cancel()
}).finally(() => {
loading.value = false
})
} else {
await componentEdit({
@@ -137,6 +141,8 @@ const submit = () => {
ElMessage.success('修改成功!')
emit('submit')
cancel()
}).finally(() => {
loading.value = false
})
}
}

View File

@@ -190,7 +190,6 @@ const tableStore = new TableStore({
}
})
const changeTab = (e: any) => {
console.log('🚀 ~ changeTab ~ e:', e)
tableName1.value = tableStore.table.data.filter(item => item.name == e)[0].children[0].name
}
const tree2List = (list: any, id: any) => {

View File

@@ -118,7 +118,7 @@ const tableStore = new TableStore({
provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
tableStore.table.params.searchState = 0
tableStore.table.params.searchState = ''
onMounted(() => {
tableStore.index()
})

View File

@@ -53,7 +53,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确定</el-button>
</span>
</template>
</el-dialog>
@@ -73,6 +73,7 @@ defineOptions({
const adminInfo = useAdminInfo()
const tableStore = inject('tableStore') as TableStore
const formRef = ref()
const loading = ref(false)
// do not use same name with ref
const form = reactive({
algoDescribe: '',
@@ -128,6 +129,7 @@ const open = (text: string, data: anyObj) => {
}
const submit = async () => {
await formRef.value.validate()
loading.value = true
if (form.id) {
await dictDataUpdate(form)
} else {
@@ -136,6 +138,7 @@ const submit = async () => {
ElMessage.success('保存成功')
tableStore.index()
dialogVisible.value = false
loading.value = false
}
defineExpose({ open })

View File

@@ -36,7 +36,7 @@
<template #footer>
<span class='dialog-footer'>
<el-button @click='dialogVisible = false'>取消</el-button>
<el-button type='primary' @click='submit'></el-button>
<el-button type='primary' @click='submit' :loading="loading"></el-button>
</span>
</template>
</el-dialog>
@@ -51,6 +51,7 @@ import { dictTypeAdd, dictTypeUpdate } from '@/api/system-boot/dictType'
const adminInfo = useAdminInfo()
const tableStore = inject('tableStore') as TableStore
const loading = ref(false)
const OpenLevel = [
{ value: 0, label: '不开启' },
{ value: 1, label: '开启' }
@@ -96,6 +97,7 @@ const open = (text: string, data?: anyObj) => {
const submit = async () => {
formRef.value.validate(async (valid: boolean) => {
if (valid) {
loading.value = true
if (form.id) {
await dictTypeUpdate(form)
} else {
@@ -104,6 +106,7 @@ const submit = async () => {
ElMessage.success('保存成功')
tableStore.index()
dialogVisible.value = false
loading.value = false
}
})
}

View File

@@ -1,16 +1,22 @@
<template>
<div class='default-main'>
<div class='custom-table-header'>
<div class="title">字典树列表</div>
<el-button :icon='Plus' type='primary' @click='addMenu'>新增字典类型</el-button>
<div>
关键字筛选
<el-input maxlength="32" show-word-limit class="ml10" v-model="searchValue" placeholder="请输入字典名称"
clearable style="width: 240px" @input="inpChaange" />
</div>
<div style="margin-left: auto;"> <el-button :icon='Plus' type='primary' @click='addMenu'>新增字典类型</el-button>
</div>
</div>
<Table ref='tableRef' />
<Table ref='tableRef' :tree-config="{ childrenField: 'children', rowField: 'id' }" />
<PopupForm ref='popupFormRef'></PopupForm>
</div>
</template>
<script setup lang='ts'>
import { Plus } from '@element-plus/icons-vue'
import { ref, onMounted, provide } from 'vue'
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { ElMessage } from 'element-plus'
@@ -20,10 +26,54 @@ import { dicDelete } from '@/api/system-boot/dic'
defineOptions({
name: 'setting/dictionary/tree'
})
const searchValue = ref('')
const rawList = ref<any[]>([])
const tableRef = ref()
const popupFormRef = ref()
/** 父级命中保留全部子级;仅子级命中则保留父级及匹配子级 */
function filterTreeByName(nodes: any[], keyword: string): any[] {
if (!keyword) return nodes
const result: any[] = []
nodes.forEach(node => {
const selfMatch = node.name?.includes(keyword)
if (selfMatch) {
result.push(node)
return
}
const filteredChildren = node.children?.length ? filterTreeByName(node.children, keyword) : []
if (filteredChildren.length > 0) {
result.push({ ...node, children: filteredChildren })
}
})
return result
}
function expandFirstTreeNode() {
nextTick(() => {
const treeInstance = tableRef.value?.getRef()
if (!treeInstance) return
treeInstance.setAllTreeExpand(false)
const firstNode = tableStore.table.data[0]
if (firstNode) {
treeInstance.setTreeExpand([firstNode], true)
treeInstance.setCurrentRow(firstNode)
}
})
}
function applyTreeData() {
tableStore.table.data = filterTreeByName(rawList.value, searchValue.value)
expandFirstTreeNode()
}
const inpChaange = () => {
applyTreeData()
}
const tableStore = new TableStore({
showPage:false,
showPage: false,
url: '/system-boot/dictTree/queryTree',
method: 'GET',
publicHeight: 60,
@@ -52,7 +102,7 @@ const tableStore = new TableStore({
title: '操作', fixed: 'right',
width: '180',
render: 'buttons',
buttons: [
{
title: '新增',
@@ -100,7 +150,11 @@ const tableStore = new TableStore({
}
]
}
]
],
loadCallback: () => {
rawList.value = JSON.parse(JSON.stringify(tableStore.table.data))
applyTreeData()
}
})
provide('tableStore', tableStore)

View File

@@ -1,7 +1,7 @@
<template>
<el-dialog class="cn-operate-dialog" width="500px" v-model.trim="dialogVisible" :title="title">
<el-scrollbar>
<el-form :inline="false" :model="form" ref="formRef" label-width="auto" :rules="rules">
<el-form :inline="false" :model="form" ref="formRef" label-width="auto" :rules="rules" class="form-one">
<el-form-item label="字典名称" prop="name">
<el-input maxlength="32" show-word-limit
@@ -44,7 +44,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确定</el-button>
</span>
</template>
</el-dialog>
@@ -59,6 +59,7 @@ import { dicAdd, dicUpdate } from '@/api/system-boot/dic'
const adminInfo = useAdminInfo()
const tableStore = inject('tableStore') as TableStore
const loading = ref(false)
// do not use same name with ref
const form = reactive({
name: '',
@@ -97,6 +98,7 @@ const open = (text: string, data?: anyObj) => {
const submit = async () => {
formRef.value.validate(async (valid: any) => {
if (valid) {
loading.value = true
if (form.id) {
await dicUpdate(form)
} else {
@@ -105,6 +107,7 @@ const submit = async () => {
ElMessage.success('保存成功')
tableStore.index()
dialogVisible.value = false
loading.value = false
}
})
}

View File

@@ -13,13 +13,13 @@
</TableHeader>
<Table ref="tableRef">
<template v-slot:columns>
<vxe-column field="androidPath" title="Android路径" width="250px"
<vxe-column field="androidPath" title="Android路径" minWidth="250px"
v-if="tableStore.table.params.versionType == 'APP'"></vxe-column>
<vxe-column field="iosPath" title="IOS路径" width="250px"
<vxe-column field="iosPath" title="IOS路径" minWidth="250px"
v-if="tableStore.table.params.versionType == 'APP'"></vxe-column>
</template>
</Table>
<el-dialog width="500px" v-model.trim="dialogVisible" title="新增版本">
<el-dialog width="500px" v-model.trim="dialogVisible" :title="dialogTitle">
<el-form :inline="false" :model="form" ref="formRef" label-width="auto" class="form-one" :rules="rules">
<el-form-item label="版本号" prop="appVersion">
<el-input maxlength="32" show-word-limit v-model.trim="form.appVersion" placeholder="请输入版本号" />
@@ -41,18 +41,17 @@
</el-select>
</el-form-item>
<el-form-item label="Android路径" prop="androidPath" v-if="form.versionType == 'APP'">
<el-input v-model.trim="form.androidPath"
placeholder="请输入Android路径" />
<el-input v-model.trim="form.androidPath" placeholder="请输入Android路径" />
</el-form-item>
<el-form-item label="IOS路径" prop="iosPath" v-if="form.versionType == 'APP'">
<el-input v-model.trim="form.iosPath" placeholder="请输入IOS路径" />
<el-input v-model.trim="form.iosPath" placeholder="请输入IOS路径" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit"></el-button>
<el-button type="primary" @click="submit"></el-button>
</span>
</template>
</el-dialog>
@@ -63,12 +62,14 @@ import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage } from 'element-plus'
import { addVersion } from '@/api/systerm'
import { addVersion, updateVersion, deleteVersion } from '@/api/systerm'
import router from '@/router/index'
const dialogVisible = ref(false)
const dialogTitle = ref('新增版本')
const isEdit = ref(false)
const form = ref({
id: '',
appVersion: '',
content: '',
versionType: '',
@@ -105,7 +106,45 @@ const tableStore = new TableStore({
},
width: '150'
},
{ title: '整改内容', field: 'content' }
{ title: '整改内容', field: 'content', minWidth: '250' },
{
title: '操作',
fixed: 'right',
align: 'center',
width: '180',
render: 'buttons',
buttons: [
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
editMenu(row)
}
},
// {
// name: 'del',
// title: '删除',
// type: 'danger',
// icon: 'el-icon-Delete',
// render: 'confirmButton',
// popconfirm: {
// confirmButtonText: '确认',
// cancelButtonText: '取消',
// confirmButtonType: 'danger',
// title: '确定删除版本信息吗?'
// },
// click: row => {
// deleteVersion({ id: row.id }).then(() => {
// ElMessage.success('删除成功')
// tableStore.index()
// })
// }
// }
]
}
],
beforeSearchFun: () => {
// console.log("🚀 ~ tableStore.table.params", tableStore.table)
@@ -127,21 +166,38 @@ onMounted(async () => {
})
const submit = async () => {
await formRef.value.validate()
console.log(123)
addVersion(form.value).then(res => {
ElMessage.success('新增成功')
const request = isEdit.value ? updateVersion(form.value) : addVersion(form.value)
request.then(() => {
ElMessage.success(isEdit.value ? '修改成功' : '新增成功')
tableStore.index()
dialogVisible.value = false
router.go(0)
if (!isEdit.value) {
router.go(0)
}
})
}
const addMenu = async () => {
const addMenu = () => {
isEdit.value = false
dialogTitle.value = '新增版本'
dialogVisible.value = true
form.value.appVersion = tableStore.table.data[0].versionName || ''
form.value.id = ''
form.value.appVersion = tableStore.table.data[0]?.versionName || ''
form.value.content = ''
form.value.iosPath = ''
form.value.androidPath = ''
form.value.sev = tableStore.table.data[0].sev || 0
form.value.versionType = tableStore.table.data[0].versionType || 'WEB'
form.value.sev = tableStore.table.data[0]?.sev ?? 0
form.value.versionType = tableStore.table.data[0]?.versionType || tableStore.table.params.versionType || 'WEB'
}
const editMenu = (row: any) => {
isEdit.value = true
dialogTitle.value = '编辑版本'
dialogVisible.value = true
form.value.id = row.id
form.value.appVersion = row.versionName || ''
form.value.content = row.content || ''
form.value.sev = row.sev ?? 0
form.value.versionType = row.versionType || 'WEB'
form.value.androidPath = row.androidPath || ''
form.value.iosPath = row.iosPath || ''
}
</script>