fix: bug#18550、18545、
This commit is contained in:
parent
351a399135
commit
7943a4108f
|
@ -14,7 +14,6 @@
|
|||
>
|
||||
新增字典
|
||||
</PermissionButton>
|
||||
<!-- <j-button type="primary" @click="showSave" style="width: 60%;">新增字典</j-button> -->
|
||||
<PermissionButton
|
||||
type="text"
|
||||
hasPermission="system/Dictionary:down"
|
||||
|
@ -22,7 +21,6 @@
|
|||
>
|
||||
下载
|
||||
</PermissionButton>
|
||||
<!-- <j-button type="text" @click="downVisible=true">下载</j-button> -->
|
||||
<j-upload
|
||||
:before-upload="beforeUpload"
|
||||
accept=".json"
|
||||
|
@ -44,10 +42,10 @@
|
|||
<div class="itemText"><Ellipsis style="width: calc(100%-100px)">{{ item.name }}</Ellipsis></div>
|
||||
<div @click="(e) => e.stopPropagation()">
|
||||
<j-popconfirm v-if="hasPermission('system/Dictionary:action')" :title="item.data.status === 1 ? '确定禁用?' : '确定启用?'" @confirm="()=>updateDic(item.data)">
|
||||
<j-switch v-model:checked="item.status" :disabled="!hasPermission('system/Dictionary:action')" :checkedValue="1" :unCheckedValue="0"></j-switch>
|
||||
<j-switch :checked="item.status" :disabled="!hasPermission('system/Dictionary:action')" :checkedValue="1" :unCheckedValue="0"></j-switch>
|
||||
</j-popconfirm>
|
||||
<j-tooltip v-else placement="top" title="暂无权限,请联系管理员">
|
||||
<j-switch v-model:checked="item.status" :disabled="!hasPermission('system/Dictionary:action')" :checkedValue="1" :unCheckedValue="0"></j-switch>
|
||||
<j-switch :checked="item.status" :disabled="!hasPermission('system/Dictionary:action')" :checkedValue="1" :unCheckedValue="0"></j-switch>
|
||||
</j-tooltip>
|
||||
<PermissionButton
|
||||
type="text"
|
||||
|
@ -59,9 +57,6 @@
|
|||
>
|
||||
删除
|
||||
</PermissionButton>
|
||||
<!-- <j-popconfirm title="确认删除?" @confirm="()=>deleteDic(item.id)">
|
||||
<j-button type="text">删除</j-button>
|
||||
</j-popconfirm> -->
|
||||
<PermissionButton
|
||||
type="text"
|
||||
hasPermission="system/Dictionary:update"
|
||||
|
@ -69,7 +64,6 @@
|
|||
>
|
||||
编辑
|
||||
</PermissionButton>
|
||||
<!-- <j-button type="text" @click="()=>showEdit(item.data)">编辑</j-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,73 +1,57 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="des_head">
|
||||
<div>字典ID:<span>{{ data.id }}</span></div>
|
||||
<div>说明:<span>{{ data.describe }}</span></div>
|
||||
<div>创建日期:<span>{{ data.name }}</span></div>
|
||||
</div>
|
||||
<div class="contain">
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
<JProTable :columns="columns"
|
||||
model="TABLE"
|
||||
:request="queryItem"
|
||||
:params="params"
|
||||
ref="tableRef"
|
||||
>
|
||||
<template #headerTitle>
|
||||
<PermissionButton
|
||||
type="primary"
|
||||
@click="add"
|
||||
hasPermission="system/Dictionary:add"
|
||||
>
|
||||
<div>
|
||||
<div class="des_head">
|
||||
<div>字典ID:<span>{{ data.id }}</span></div>
|
||||
<div>说明:<span>{{ data.describe }}</span></div>
|
||||
<div>创建日期:<span> {{
|
||||
dayjs(
|
||||
data?.createTime,
|
||||
).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)
|
||||
}}</span></div>
|
||||
</div>
|
||||
<div class="contain">
|
||||
<pro-search :columns="columns" @search="handleSearch" />
|
||||
<JProTable :columns="columns" model="TABLE" :request="queryItem" :params="params" ref="tableRef">
|
||||
<template #headerTitle>
|
||||
<PermissionButton type="primary" @click="add" hasPermission="system/Dictionary:add">
|
||||
新增
|
||||
</PermissionButton>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
<j-space>
|
||||
<template
|
||||
v-for="i in getActions(slotProps, 'table')"
|
||||
:key="i.key"
|
||||
>
|
||||
<PermissionButton
|
||||
:disabled="i.disabled"
|
||||
:popConfirm="i.popConfirm"
|
||||
:tooltip="{
|
||||
...i.tooltip,
|
||||
}"
|
||||
@click="i.onClick"
|
||||
type="link"
|
||||
style="padding: 0 5px"
|
||||
:danger="i.key === 'delete'"
|
||||
:hasPermission="
|
||||
'system/Dictionary:' + i.key
|
||||
"
|
||||
>
|
||||
<template #icon
|
||||
><AIcon :type="i.icon"
|
||||
/></template>
|
||||
<template v-for="i in getActions(slotProps, 'table')" :key="i.key">
|
||||
<PermissionButton :disabled="i.disabled" :popConfirm="i.popConfirm" :tooltip="{
|
||||
...i.tooltip,
|
||||
}" @click="i.onClick" type="link" style="padding: 0 5px" :danger="i.key === 'delete'"
|
||||
:hasPermission="'system/Dictionary:' + i.key
|
||||
">
|
||||
<template #icon>
|
||||
<AIcon :type="i.icon" />
|
||||
</template>
|
||||
</PermissionButton>
|
||||
</template>
|
||||
</j-space>
|
||||
</template>
|
||||
</JProTable>
|
||||
</JProTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Save v-if="saveVisible" :dicId='data.id' :type="modalType" :data="current" :sort=sort @closeModal="closeModal" @refresh="refresh"/>
|
||||
<Save v-if="saveVisible" :dicId='data.id' :type="modalType" :data="current" :sort=sort @closeModal="closeModal"
|
||||
@refresh="refresh" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { queryDicItem ,deleteDicItem } from '@/api/system/dictionary'
|
||||
import { queryDicItem, deleteDicItem } from '@/api/system/dictionary'
|
||||
import Save from './Save/index.vue'
|
||||
import type { ActionsType } from './typings';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import dayjs from 'dayjs';
|
||||
const props = defineProps({
|
||||
data:{
|
||||
type:Object,
|
||||
default:{}
|
||||
data: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
})
|
||||
const params = ref()
|
||||
|
@ -78,20 +62,20 @@ const modalType = ref('add')
|
|||
const current = ref()
|
||||
const columns = [
|
||||
{
|
||||
title:'序号',
|
||||
dataIndex:'ordinal',
|
||||
key:'ordinal',
|
||||
search:{
|
||||
type:'number'
|
||||
title: '序号',
|
||||
dataIndex: 'ordinal',
|
||||
key: 'ordinal',
|
||||
search: {
|
||||
type: 'number'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'name',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true,
|
||||
search:{
|
||||
type:'string'
|
||||
search: {
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -99,8 +83,8 @@ const columns = [
|
|||
dataIndex: 'value',
|
||||
key: 'value',
|
||||
ellipsis: true,
|
||||
search:{
|
||||
type:'string'
|
||||
search: {
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -108,13 +92,13 @@ const columns = [
|
|||
dataIndex: 'text',
|
||||
key: 'text',
|
||||
ellipsis: true,
|
||||
search:{
|
||||
type:'string'
|
||||
search: {
|
||||
type: 'string'
|
||||
}
|
||||
},{
|
||||
title:'操作',
|
||||
dataIndex:'action',
|
||||
key:'action',
|
||||
}, {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
scopedSlots: true,
|
||||
}
|
||||
];
|
||||
|
@ -142,18 +126,18 @@ const getActions = (
|
|||
key: 'delete',
|
||||
text: '删除',
|
||||
tooltip: {
|
||||
title:'删除',
|
||||
title: '删除',
|
||||
},
|
||||
popConfirm: {
|
||||
title: '确认删除?',
|
||||
onConfirm: async () => {
|
||||
const res = await deleteDicItem(data.id)
|
||||
if(res.status ===200){
|
||||
onlyMessage('操作成功!')
|
||||
tableRef.value.reload()
|
||||
}else{
|
||||
onlyMessage('操作失败!','error')
|
||||
}
|
||||
const res = await deleteDicItem(data.id)
|
||||
if (res.status === 200) {
|
||||
onlyMessage('操作成功!')
|
||||
tableRef.value.reload()
|
||||
} else {
|
||||
onlyMessage('操作失败!', 'error')
|
||||
}
|
||||
},
|
||||
},
|
||||
icon: 'DeleteOutlined',
|
||||
|
@ -163,73 +147,74 @@ const getActions = (
|
|||
return actions.filter((i: ActionsType) => i.key !== 'view');
|
||||
return actions;
|
||||
};
|
||||
const add = () =>{
|
||||
const add = () => {
|
||||
modalType.value = 'add'
|
||||
current.value = {}
|
||||
saveVisible.value = true
|
||||
}
|
||||
|
||||
const closeModal = () =>{
|
||||
const closeModal = () => {
|
||||
saveVisible.value = false
|
||||
}
|
||||
const handleSearch = (i:any)=>{
|
||||
const handleSearch = (i: any) => {
|
||||
params.value = i
|
||||
}
|
||||
const refresh = () =>{
|
||||
const refresh = () => {
|
||||
saveVisible.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
const queryItem =async(_params:any)=>{
|
||||
const queryItem = async (_params: any) => {
|
||||
if (props.data?.id) {
|
||||
const params = {
|
||||
..._params,
|
||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||
terms: [
|
||||
..._params.terms,
|
||||
{
|
||||
column: 'dictId',
|
||||
termType: 'eq',
|
||||
value: props.data?.id
|
||||
},
|
||||
],
|
||||
};
|
||||
const resp: any = await queryDicItem(params);
|
||||
if(resp.status===200){
|
||||
const arr = cloneDeep(resp.result.data)
|
||||
arr?.sort((a:any,b:any)=>{
|
||||
return b.ordinal - a.ordinal
|
||||
})
|
||||
sort.value =arr.length ? arr[0].ordinal + 1 : 1
|
||||
return {
|
||||
const params = {
|
||||
..._params,
|
||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||
terms: [
|
||||
..._params.terms,
|
||||
{
|
||||
column: 'dictId',
|
||||
termType: 'eq',
|
||||
value: props.data?.id
|
||||
},
|
||||
],
|
||||
};
|
||||
const resp: any = await queryDicItem(params);
|
||||
if (resp.status === 200) {
|
||||
const arr = cloneDeep(resp.result.data)
|
||||
arr?.sort((a: any, b: any) => {
|
||||
return b.ordinal - a.ordinal
|
||||
})
|
||||
sort.value = arr.length ? arr[0].ordinal + 1 : 1
|
||||
return {
|
||||
code: resp.status,
|
||||
result: resp.result,
|
||||
status: resp.status,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
sort.value= 1
|
||||
return {
|
||||
code: 200,
|
||||
result: {
|
||||
data: [],
|
||||
pageIndex: 0,
|
||||
pageSize: 0,
|
||||
total: 0,
|
||||
},
|
||||
status: 200,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
sort.value = 1
|
||||
return {
|
||||
code: 200,
|
||||
result: {
|
||||
data: [],
|
||||
pageIndex: 0,
|
||||
pageSize: 0,
|
||||
total: 0,
|
||||
},
|
||||
status: 200,
|
||||
};
|
||||
}
|
||||
watch(()=>props?.data?.id,()=>{
|
||||
}
|
||||
watch(() => props?.data?.id, () => {
|
||||
tableRef.value.reload()
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.des_head{
|
||||
.des_head {
|
||||
padding: 10px 20px;
|
||||
background-color: rgb(242, 242, 242);
|
||||
span{
|
||||
color:rgb(127, 127, 127)
|
||||
|
||||
span {
|
||||
color: rgb(127, 127, 127)
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -94,10 +94,11 @@
|
|||
: '删除',
|
||||
}"
|
||||
:popConfirm="{
|
||||
title: `确认删除`,
|
||||
title:slotProps?.type?.id === 'application' ? '此操作将同步删除对应的第三方配置,确认删除?':'确认删除',
|
||||
onConfirm: () =>
|
||||
table.clickDel(slotProps.id),
|
||||
}"
|
||||
|
||||
:disabled="slotProps.status"
|
||||
>
|
||||
<AIcon type="DeleteOutlined" />
|
||||
|
@ -215,7 +216,7 @@ const columns = [
|
|||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
width: 150,
|
||||
width: 200,
|
||||
scopedSlots: true,
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue