fix: bug#10455 10451 10448 10446 10449 10452 10488

This commit is contained in:
leiqiaochu 2023-03-16 17:19:46 +08:00
parent ea48417454
commit da755bc13b
5 changed files with 41 additions and 111 deletions

View File

@ -89,6 +89,10 @@ const props: JUploadProps = defineProps({
type: String, type: String,
default: '', default: '',
}, },
accept:{
type:Array,
default:()=>[],
}
}); });
const loading = ref<boolean>(false); const loading = ref<boolean>(false);

View File

@ -1,10 +1,11 @@
<!-- 新增编辑弹窗 --> <!-- 新增编辑弹窗 -->
<template> <template>
<j-modal <j-modal
v-if="visible"
:title="props.title" :title="props.title"
:maskClosable="false" :maskClosable="false"
destroy-on-close destroy-on-close
v-model:visible="visible" visible
@ok="submitData" @ok="submitData"
@cancel="close" @cancel="close"
okText="确定" okText="确定"
@ -117,20 +118,20 @@ const submitData = async () => {
if (props.isChild === 1) { if (props.isChild === 1) {
addParams.value = { addParams.value = {
...formModel.value, ...formModel.value,
// sortIndex: sortIndex:
// childArr.value[childArr.value.length - 1].sortIndex + 1, childArr.value[childArr.value.length - 1].sortIndex + 1,
parentId: addObj.value.id, parentId: addObj.value.id,
}; };
} else if (props.isChild === 2) { } else if (props.isChild === 2) {
addParams.value = { addParams.value = {
parentId: addObj.value.id, parentId: addObj.value.id,
...formModel.value, ...formModel.value,
// sortIndex: 1, sortIndex: 1,
}; };
} else if (props.isChild === 3) { } else if (props.isChild === 3) {
addParams.value = { addParams.value = {
...formModel.value, ...formModel.value,
// sortIndex: arr.value[arr.value.length - 1].sortIndex + 1, sortIndex: arr.value[arr.value.length - 1].sortIndex + 1,
}; };
} }
const res = await saveTree(addParams.value); const res = await saveTree(addParams.value);
@ -163,7 +164,7 @@ const submitData = async () => {
/** /**
* 显示弹窗 * 显示弹窗
*/ */
const show = (row: any) => { const show = async (row: any) => {
// //
if (props.isAdd === 0) { if (props.isAdd === 0) {
if (props.isChild === 1) { if (props.isChild === 1) {
@ -179,6 +180,7 @@ const show = (row: any) => {
visible.value = true; visible.value = true;
} }
} else if (props.isChild === 3) { } else if (props.isChild === 3) {
const res = await getTableData();
arr.value = listData.value.sort(compare('sortIndex')); arr.value = listData.value.sort(compare('sortIndex'));
if (arr.value.length > 0) { if (arr.value.length > 0) {
formModel.value = { formModel.value = {
@ -250,7 +252,6 @@ const close = () => {
visible.value = false; visible.value = false;
resetFields(); resetFields();
}; };
getTableData();
//ID //ID
watch([() => props.isAdd], () => {}, { immediate: false, deep: true }); watch([() => props.isAdd], () => {}, { immediate: false, deep: true });
defineExpose({ defineExpose({

View File

@ -9,8 +9,10 @@
<JProTable <JProTable
ref="tableRef" ref="tableRef"
:columns="table.columns" :columns="table.columns"
:dataSource="dataSource" :request="queryTree"
model="TABLE" model="TABLE"
type="TREE"
:scroll="{ y: 550 }"
:defaultParams="{ :defaultParams="{
paging: false, paging: false,
sorts: [ sorts: [
@ -21,7 +23,7 @@
}, },
], ],
}" }"
:params="query.params" :params="params"
:loading="tableLoading" :loading="tableLoading"
> >
<template #headerTitle> <template #headerTitle>
@ -118,38 +120,13 @@ const query = reactive({
scopedSlots: true, scopedSlots: true,
}, },
], ],
params: {
paging: false,
sorts: [
{ name: 'sortIndex', order: 'asc' },
{
name: 'createTime',
order: 'desc',
},
],
},
}); });
/** let params = ref();
* 查询树形列表
*/
const getTableData = async () => {
tableLoading.value = true;
const res = await queryTree(query.params);
if (res.status === 200) {
dataSource.value = res.result;
}
tableLoading.value = false;
};
getTableData();
/** /**
* 搜索 * 搜索
*/ */
const handleSearch = (e: any) => { const handleSearch = (e: any) => {
query.params = { params.value = e
...query.params,
...e,
};
getTableData();
}; };
/** /**
* 操作栏按钮 * 操作栏按钮
@ -200,6 +177,9 @@ const getActions = (
{ {
key: 'delete', key: 'delete',
text: '删除', text: '删除',
tooltip: {
title: '删除',
},
popConfirm: { popConfirm: {
title: '确认删除?', title: '确认删除?',
okText: ' 确定', okText: ' 确定',
@ -208,7 +188,7 @@ const getActions = (
const resp = await deleteTree(data.id); const resp = await deleteTree(data.id);
if (resp.status === 200) { if (resp.status === 200) {
message.success('操作成功!'); message.success('操作成功!');
getTableData(); tableRef.value.reload();
} else { } else {
message.error('操作失败!'); message.error('操作失败!');
} }
@ -227,20 +207,20 @@ const table = reactive({
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
ellipsis: true, ellipsis: true,
width:600 width: 600,
}, },
{ {
title: '排序', title: '排序',
dataIndex: 'sortIndex', dataIndex: 'sortIndex',
key: 'sortIndex', key: 'sortIndex',
scopedSlots: true, scopedSlots: true,
width:200 width: 200,
}, },
{ {
title: '说明', title: '说明',
dataIndex: 'description', dataIndex: 'description',
key: 'description', key: 'description',
width:700 width: 700,
}, },
{ {
title: '操作', title: '操作',
@ -265,7 +245,7 @@ const table = reactive({
* 刷新表格数据 * 刷新表格数据
*/ */
refresh: () => { refresh: () => {
getTableData(); tableRef.value.reload();
}, },
}); });
const { add, columns, refresh } = toRefs(table); const { add, columns, refresh } = toRefs(table);

View File

@ -23,73 +23,15 @@
<j-row type="flex"> <j-row type="flex">
<j-col flex="180px"> <j-col flex="180px">
<j-form-item name="photoUrl"> <j-form-item name="photoUrl">
<Upload v-model="form.photoUrl" /> <j-pro-upload
</j-form-item> v-model="form.photoUrl"
<!-- <j-form-item>
<div class="upload-image-warp-logo">
<div class="upload-image-border-logo">
<a-upload
name="file"
:action="FILE_UPLOAD"
:headers="headers"
:showUploadList="false"
:beforeUpload="beforeUpload"
@change="handleChange"
:accept=" :accept="
imageTypes && imageTypes.length imageTypes && imageTypes.length
? imageTypes.toString() ? imageTypes.toString()
: '' : ''
" "
>
<div class="upload-image-content-logo">
<div
class="loading-logo"
v-if="logoLoading"
>
<LoadingOutlined
style="font-size: 28px"
/> />
</div> </j-form-item>
<div
class="upload-image"
v-if="photoValue"
:style="
photoValue
? `background-image: url(${photoValue});`
: ''
"
></div>
<div
v-if="photoValue"
class="upload-image-mask"
>
点击修改
</div>
<div v-else>
<div v-if="logoLoading">
<LoadingOutlined
style="font-size: 28px"
/>
</div>
<div v-else>
<PlusOutlined
style="font-size: 28px"
/>
</div>
</div>
</div>
</a-upload>
<div v-if="logoLoading">
<div class="upload-loading-mask">
<LoadingOutlined
v-if="logoLoading"
style="font-size: 28px"
/>
</div>
</div>
</div>
</div>
</j-form-item> -->
</j-col> </j-col>
<j-col flex="auto"> <j-col flex="auto">
<j-form-item name="id"> <j-form-item name="id">
@ -186,8 +128,11 @@
</j-row> </j-row>
</j-radio-group> </j-radio-group>
</j-form-item> </j-form-item>
<j-form-item label="说明" name="describe"> <j-form-item label="说明" name="description">
<j-textarea <j-textarea
:maxlength="200"
showCount
:auto-size="{ minRows: 4, maxRows: 5 }"
v-model:value="form.describe" v-model:value="form.describe"
placeholder="请输入说明" placeholder="请输入说明"
/> />
@ -319,6 +264,9 @@ const rules = reactive({
trigger: 'blur', trigger: 'blur',
}, },
], ],
description: [
{ max: 200, message: '最多可输入200位字符', trigger: 'blur' },
],
}); });
const valueChange = (value: string, label: string) => { const valueChange = (value: string, label: string) => {

View File

@ -123,9 +123,6 @@
:status="statusMap.get(slotProps.state)" :status="statusMap.get(slotProps.state)"
/> />
</template> </template>
<template #id="slotProps">
<a>{{ slotProps.id }}</a>
</template>
<template #action="slotProps"> <template #action="slotProps">
<j-space :size="16"> <j-space :size="16">
<template <template