创建列表设置页面

szh-new
lijingjia 8 months ago
parent 39877e9d3f
commit 72aa79f2f5

@ -99,8 +99,8 @@
"@types/qs": "^6.9.7",
"@types/showdown": "^1.9.4",
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@vitejs/plugin-legacy": "^1.8.1",
"@vitejs/plugin-vue": "^2.3.1",
"@vitejs/plugin-vue-jsx": "^1.3.10",

@ -35,6 +35,9 @@
<a-button size="small" type="link" @click="reset">
{{ t('common.resetText') }}
</a-button>
<a-button size="small" type="link" @click="editTable">
{{ t('common.editText') }}
</a-button>
</div>
</template>
@ -211,6 +214,20 @@
return ret
}
/**
* @description: 根据路由path获取当前表格的id
*/
const getPermissionId = () => {
var pid: string = ''
usePermissionStore().getWrouteList.forEach((item: any) => {
item.children[0].children?.forEach((item2) => {
if (fullPath.value.indexOf(item2.path) != -1) {
pid = item2.id
}
})
})
return pid
}
async function init() {
const Wcolumns = getColumns()
let columns = []
@ -218,7 +235,7 @@
let Apidata = {
permissionId: '',
}
usePermissionStore().getWrouteList.forEach((item) => {
usePermissionStore().getWrouteList.forEach((item: any) => {
item.children[0].children?.forEach((item2) => {
if (fullPath.value.indexOf(item2.path) != -1) {
Apidata.permissionId = item2.id
@ -345,6 +362,11 @@
let sortable: Sortable
let sortableOrder: string[] = []
//
const editTable = () => {
const pid = getPermissionId()
console.log(pid)
}
// reset columns
function reset() {
state.checkedList = [...state.defaultCheckList]
@ -354,6 +376,10 @@
setColumns(table.getCacheColumns())
sortable.sort(sortableOrder)
}
/**
* @description: 将表格添加至列表设置
* @param: { id: 表格id }
*/
// Open the pop-up window for drag and drop initialization
function handleVisibleChange() {
@ -474,6 +500,7 @@
showIndexColumn: table.getBindValues.value.showIndexColumn,
}),
}
console.log(usePermissionStore().getWrouteList)
usePermissionStore().getWrouteList.forEach((item) => {
item.children[0].children?.forEach((item2) => {
if (fullPath.value.indexOf(item2.path) != -1) {
@ -481,7 +508,6 @@
}
})
})
const res: API.DataResult = await UpdateUserFieldSet(Apidata)
if (res.succeeded) {
emit('columns-change', data)
@ -505,6 +531,7 @@
onChange,
plainOptions,
reset,
editTable,
prefixCls,
columnListRef,
handleVisibleChange,

@ -6,6 +6,7 @@ export default {
saveText: 'Save',
delText: 'Delete',
resetText: 'Reset',
editText: 'Edit',
searchText: 'Search',
queryText: 'Search',

@ -6,6 +6,7 @@ export default {
saveText: '保存',
delText: '删除',
resetText: '重置',
editText: '编辑',
searchText: '搜索',
queryText: '查询',

@ -0,0 +1,18 @@
/*
* @Description: ->
* @Author: lijj
* @Date: 2024-04-16 14:44:08
*/
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/mainApi/ColumnSet/GetColumnSetList',
}
// 列表数据
export function getColumnSetList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data,
})
}

@ -0,0 +1,50 @@
<!--
* @Description: 基础配置 -> 列表设置
* @Author: lijj
* @Date: 2024-04-16 10:33:31
-->
<template>
<div class="table-set">222</div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
onClick: handleAudit.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
</template>
<script lang="ts" setup>
import { BasicTable, useTable, TableAction, SorterResult } from '/@/components/Table'
import { onMounted } from 'vue'
import { getColumnSetList } from './api'
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '表单设置列表',
api: async (p) => {
console.log(p, 11)
const res: API.DataResult = await getColumnSetList(p)
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
},
})
//
// const init = () => {
// getColumnSetList()
// }
onMounted(() => {
console.log(1111)
})
</script>

@ -1,3 +1,8 @@
<!--
* @Description: 基础配置 -> 表单设置
* @Author: lijj
* @Date: 2024-04-15 17:08:08
-->
<template>
<div>
<BasicTable @register="registerTable">

Loading…
Cancel
Save