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,
default: '',
},
accept:{
type:Array,
default:()=>[],
}
});
const loading = ref<boolean>(false);

View File

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

View File

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

View File

@ -23,73 +23,15 @@
<j-row type="flex">
<j-col flex="180px">
<j-form-item name="photoUrl">
<Upload v-model="form.photoUrl" />
<j-pro-upload
v-model="form.photoUrl"
:accept="
imageTypes && imageTypes.length
? imageTypes.toString()
: ''
"
/>
</j-form-item>
<!-- <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="
imageTypes && imageTypes.length
? imageTypes.toString()
: ''
"
>
<div class="upload-image-content-logo">
<div
class="loading-logo"
v-if="logoLoading"
>
<LoadingOutlined
style="font-size: 28px"
/>
</div>
<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 flex="auto">
<j-form-item name="id">
@ -186,8 +128,11 @@
</j-row>
</j-radio-group>
</j-form-item>
<j-form-item label="说明" name="describe">
<j-form-item label="说明" name="description">
<j-textarea
:maxlength="200"
showCount
:auto-size="{ minRows: 4, maxRows: 5 }"
v-model:value="form.describe"
placeholder="请输入说明"
/>
@ -319,6 +264,9 @@ const rules = reactive({
trigger: 'blur',
},
],
description: [
{ max: 200, message: '最多可输入200位字符', trigger: 'blur' },
],
});
const valueChange = (value: string, label: string) => {

View File

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