|
|
@@ -3,30 +3,6 @@
|
|
|
<div class="tagType-box">
|
|
|
<div class="tag-body">
|
|
|
<BasicTable @register="registerTableTagType">
|
|
|
- <!-- <template #toolbar>
|
|
|
- <Button type="primary" @click="openDialog(null)">
|
|
|
- 新增字典
|
|
|
- </Button>
|
|
|
- <Button type="primary" danger :disabled="hasSelected" @click="delAllData">
|
|
|
- 批量删除
|
|
|
- </Button>
|
|
|
- </template> -->
|
|
|
- <!-- <template #action="{ record }">
|
|
|
- <TableAction :actions="[
|
|
|
- {
|
|
|
- label: '',
|
|
|
- tooltip: '编辑',
|
|
|
- icon: 'ant-design:edit-outlined',
|
|
|
- onClick: openDialog.bind(null, record),
|
|
|
- },
|
|
|
- {
|
|
|
- label: '',
|
|
|
- tooltip: '删除',
|
|
|
- icon: 'ant-design:delete-outlined',
|
|
|
- onClick: onDelete.bind(null, record.id),
|
|
|
- },
|
|
|
- ]" />
|
|
|
- </template> -->
|
|
|
<template #action="{ record }">
|
|
|
<TableAction :actions="[
|
|
|
{
|
|
|
@@ -37,46 +13,16 @@
|
|
|
]" />
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
- <!-- <div class="body-header">
|
|
|
- <div class="item-title">字典类型列表</div>
|
|
|
- <div class="table-btns">
|
|
|
- <a-button class="btn" type="primary" @click="openDialog('add', {})">新增</a-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="body-content">
|
|
|
- <a-table :columns="columns" :data-source="tableData" :bordered="true">
|
|
|
- <template #operation="{ record }">
|
|
|
- <a-tooltip title="编辑" color="yellow">
|
|
|
- <a @click="openDialog('edit', record)">
|
|
|
- <EditOutlined />
|
|
|
- </a>
|
|
|
- </a-tooltip>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
- </div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="tag-box">
|
|
|
- <!-- <div class="tag-header">
|
|
|
- <div class="tag-title">字典管理</div>
|
|
|
- <div class="handle-btns">
|
|
|
- <span class="label">查询类型:</span>
|
|
|
- <a-select v-model:value="searchType" style="width: 120px">
|
|
|
- <a-select-option value="name">字典名称</a-select-option>
|
|
|
- <a-select-option value="code">字典编码</a-select-option>
|
|
|
- <a-select-option value="type">字典类型</a-select-option>
|
|
|
- <a-select-option value="time">创建时间</a-select-option>
|
|
|
- </a-select>
|
|
|
- <a-input v-model:value="searchValue" placeholder="输入关键字查询" allow-clear />
|
|
|
- <a-button class="btn" type="primary" @click="searchTable">查询</a-button>
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
<div class="tag-body">
|
|
|
<BasicTable @register="registerTableTag">
|
|
|
<template #toolbar>
|
|
|
<span class="label">字典名称:</span>
|
|
|
<a-input v-model:value="searchValue" placeholder="输入关键字查询" allow-clear style="width: 280px;" />
|
|
|
<a-button class="btn" type="primary" @click="searchTable">查询</a-button>
|
|
|
+ <a-button class="btn" type="primary" @click="resetTable">重置</a-button>
|
|
|
<Button type="primary" @click="openDialog(null)">
|
|
|
新增字典
|
|
|
</Button>
|
|
|
@@ -130,8 +76,8 @@ export default defineComponent({
|
|
|
const data = reactive({
|
|
|
tableData: [],//表格数据
|
|
|
selectedRowKeys: [],//选中的key
|
|
|
- searchType: "name",//查询类型
|
|
|
- searchValue: "",//查询值
|
|
|
+ searchValue: "", //查询值
|
|
|
+ searchType: "", //字典类型
|
|
|
formData: {
|
|
|
id: "",
|
|
|
name: "",
|
|
|
@@ -146,12 +92,23 @@ export default defineComponent({
|
|
|
//获取所有字典
|
|
|
const getTagsData = () => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
+ let paramJson = {
|
|
|
+ name: data.searchValue,
|
|
|
+ type: data.searchType
|
|
|
+ }
|
|
|
+ !data.searchValue && delete paramJson.name
|
|
|
+ !data.searchType && delete paramJson.type
|
|
|
+ let a = JSON.stringify(paramJson)
|
|
|
let param = {
|
|
|
- 1: session.getItem('tokenV2')
|
|
|
+ 1: session.getItem('tokenV2'),
|
|
|
+ 2: 1,
|
|
|
+ 3: 100000000,
|
|
|
+ 4: a
|
|
|
}
|
|
|
getAllTags(param).then(res => {
|
|
|
let resData = JSON.parse(res.result)
|
|
|
- resData.forEach((item, index) => {
|
|
|
+ console.log(resData)
|
|
|
+ resData.items.forEach((item, index) => {
|
|
|
item.time = moment(item.createtime).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
item.state = `状态${index + 1}`
|
|
|
})
|
|
|
@@ -166,69 +123,51 @@ export default defineComponent({
|
|
|
1: session.getItem('tokenV2')
|
|
|
}
|
|
|
getAllTagsType(param).then(res => {
|
|
|
+ console.log(JSON.parse(res.result))
|
|
|
let resData = JSON.parse(res.result)
|
|
|
resolve(resData)
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- //排序与删选数据,用于表格
|
|
|
- const filteredInfo = ref({
|
|
|
- name: null,
|
|
|
- code: null,
|
|
|
- type: null,
|
|
|
- time: null
|
|
|
- });
|
|
|
- //表格列
|
|
|
- const columns = computed(() => {
|
|
|
- const filtered = filteredInfo.value || {};
|
|
|
- return [
|
|
|
- {
|
|
|
- title: '字典名称',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
- filteredValue: filtered.name || null,
|
|
|
- onFilter: (value, record) => record.name.includes(value)
|
|
|
- },
|
|
|
- {
|
|
|
- title: '字典编码',
|
|
|
- dataIndex: 'code',
|
|
|
- key: 'code',
|
|
|
- filteredValue: filtered.code || null,
|
|
|
- onFilter: (value, record) => record.code.includes(value)
|
|
|
- },
|
|
|
- {
|
|
|
- title: '字典类型',
|
|
|
- dataIndex: 'type',
|
|
|
- key: 'type',
|
|
|
- filteredValue: filtered.type || null,
|
|
|
- onFilter: (value, record) => record.type.includes(value)
|
|
|
- },
|
|
|
- // {
|
|
|
- // title: '启用状态',
|
|
|
- // dataIndex: 'state',
|
|
|
- // key: 'state',
|
|
|
- // filteredValue: filtered.state || null,
|
|
|
- // onFilter: (value, record) => record.state.includes(value)
|
|
|
- // },
|
|
|
- {
|
|
|
- title: '创建时间',
|
|
|
- dataIndex: 'time',
|
|
|
- key: 'time',
|
|
|
- filteredValue: filtered.time || null,
|
|
|
- onFilter: (value, record) => record.time.includes(value)
|
|
|
- }
|
|
|
- ];
|
|
|
- });
|
|
|
- //表格查询功能
|
|
|
+ // 表格列
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ title: '字典名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '字典编码',
|
|
|
+ dataIndex: 'code',
|
|
|
+ key: 'code'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '字典类型',
|
|
|
+ dataIndex: 'type',
|
|
|
+ key: 'type'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
+ dataIndex: 'time',
|
|
|
+ key: 'time'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ // 表格查询功能
|
|
|
const searchTable = () => {
|
|
|
- filteredInfo.value['name'] = [data.searchValue]
|
|
|
+ reload()
|
|
|
}
|
|
|
- //判断是否选中数据
|
|
|
+ // 重置查询
|
|
|
+ const resetTable = () => {
|
|
|
+ data.searchValue = ""
|
|
|
+ data.searchType = ""
|
|
|
+ reload()
|
|
|
+ }
|
|
|
+ // 判断是否选中数据
|
|
|
const hasSelected = computed(() => {
|
|
|
const rowSelection = getRowSelection();
|
|
|
return !rowSelection.selectedRowKeys?.length;
|
|
|
});
|
|
|
- //删除所有选中的数据
|
|
|
+ // 删除所有选中的数据
|
|
|
const delAllData = () => {
|
|
|
Modal.confirm({
|
|
|
title: '删除提示',
|
|
|
@@ -253,7 +192,7 @@ export default defineComponent({
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
- //新增或修改数据,打开弹窗
|
|
|
+ // 新增或修改数据,打开弹窗
|
|
|
const openDialog = (record) => {
|
|
|
if (!record) {
|
|
|
data.formData = {
|
|
|
@@ -279,7 +218,7 @@ export default defineComponent({
|
|
|
data.ifShowDialog = true
|
|
|
}
|
|
|
}
|
|
|
- //删除单个数据
|
|
|
+ // 删除单个数据
|
|
|
const onDelete = (id) => {
|
|
|
Modal.confirm({
|
|
|
title: '删除提示',
|
|
|
@@ -302,16 +241,17 @@ export default defineComponent({
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
- //弹窗确认
|
|
|
+ // 弹窗确认
|
|
|
const onSubmit = (e) => {
|
|
|
data.ifShowDialog = false
|
|
|
if (e) {
|
|
|
reload();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // 通过类型查询
|
|
|
const searchTagsByType = (type) => {
|
|
|
- filteredInfo.value.type = [type]
|
|
|
+ data.searchType = type
|
|
|
+ reload()
|
|
|
}
|
|
|
|
|
|
//注册tag表格
|
|
|
@@ -336,14 +276,6 @@ export default defineComponent({
|
|
|
// pageSize: 10,
|
|
|
hideOnSinglePage: false
|
|
|
},
|
|
|
- beforeFetch: () => {
|
|
|
- filteredInfo.value = {
|
|
|
- name: null,
|
|
|
- code: null,
|
|
|
- type: null,
|
|
|
- time: null
|
|
|
- }
|
|
|
- },
|
|
|
rowKey: (record) => record.id,
|
|
|
actionColumn: {
|
|
|
width: 100,
|
|
|
@@ -400,7 +332,6 @@ export default defineComponent({
|
|
|
|
|
|
return {
|
|
|
drawerRef,
|
|
|
- filteredInfo,
|
|
|
columns,
|
|
|
hasSelected,
|
|
|
...toRefs(data),
|
|
|
@@ -409,6 +340,7 @@ export default defineComponent({
|
|
|
registerTableTagType,
|
|
|
getTagsData,
|
|
|
searchTable,
|
|
|
+ resetTable,
|
|
|
delAllData,
|
|
|
onDelete,
|
|
|
openDialog,
|