fix: bug#10841、10838、10835、10834、10828、10827

This commit is contained in:
JiangQiming 2023-03-23 18:02:27 +08:00
parent 6d0e50a203
commit f00d69d30e
6 changed files with 147 additions and 59 deletions

View File

@ -11,6 +11,7 @@
{
required: true,
message: '请上传图标',
trigger: 'change',
},
]"
style="flex: 0 0 186px"
@ -45,11 +46,22 @@
label="名称"
name="name"
:rules="[
{ required: true, message: '请输入名称',trigger: 'change', },
{ max: 64, message: '最多可输入64个字符', trigger: 'change', },
{
required: true,
message: '请输入名称',
trigger: 'change',
},
{
max: 64,
message: '最多可输入64个字符',
trigger: 'change',
},
]"
>
<j-input v-model:value="form.data.name" />
<j-input
v-model:value="form.data.name"
placeholder="请输入名称"
/>
</j-form-item>
</j-col>
<j-col :span="12">
@ -57,15 +69,26 @@
label="编码"
name="code"
:rules="[
{ required: true, message: '请输入编码', trigger: 'change', },
{ max: 64, message: '最多可输入64个字符', trigger: 'change', },
{
required: true,
message: '请输入编码',
trigger: 'change',
},
{
max: 64,
message: '最多可输入64个字符',
trigger: 'change',
},
{
validator: form.checkCode,
trigger: 'blur',
},
]"
>
<j-input v-model:value="form.data.code" />
<j-input
v-model:value="form.data.code"
placeholder="请输入编码"
/>
</j-form-item>
</j-col>
<j-col :span="12">
@ -80,7 +103,10 @@
{ max: 128, message: '最多可输入128字符' },
]"
>
<j-input v-model:value="form.data.url" />
<j-input
v-model:value="form.data.url"
placeholder="请输入页面地址"
/>
</j-form-item>
</j-col>
<j-col :span="12">
@ -94,7 +120,11 @@
},
]"
>
<j-input v-model:value="form.data.sortIndex" />
<j-input-number
v-model:value="form.data.sortIndex"
placeholder="请输入排序"
style="width: 100%"
/>
</j-form-item>
</j-col>
</j-row>
@ -104,6 +134,8 @@
<j-textarea
v-model:value="form.data.describe"
:rows="4"
show-count
:maxlength="200"
placeholder="请输入说明"
/>
</j-form-item>
@ -277,7 +309,7 @@ const form = reactive({
accessSupport:
resp.result?.accessSupport?.value || 'unsupported',
};
form.sourceCode = resp.result.code
form.sourceCode = resp.result.code;
});
//
getMenuTree_api({ paging: false }).then((resp: any) => {
@ -292,10 +324,11 @@ const form = reactive({
});
},
checkCode: async (_rule: Rule, value: string): Promise<any> => {
if (!value) return Promise.reject('请输入编码');
if (!value) return Promise.reject('');
else if (value.length > 64) return Promise.reject('最多可输入64个字符');
//
else if (routeParams.id && value === form.sourceCode) return Promise.resolve('');
else if (routeParams.id && value === form.sourceCode)
return Promise.resolve('');
else {
const resp: any = await validCode_api({
code: value,
@ -372,6 +405,13 @@ type assetType = {
label: string;
value: string;
};
watch(
() => form.data.icon,
() => {
basicFormRef.value?.validate();
},
);
</script>
<style lang="less" scoped>

View File

@ -32,9 +32,7 @@
</template>
<template #createTime="slotProps">
{{
moment(slotProps.createTime).format(
'YYYY-MM-DD HH:mm:ss',
)
dayjs(slotProps.createTime).format('YYYY-MM-DD HH:mm:ss')
}}
</template>
<template #action="slotProps">
@ -81,7 +79,7 @@ import PermissionButton from '@/components/PermissionButton/index.vue';
import { getMenuTree_api, delMenuInfo_api } from '@/api/system/menu';
import { message } from 'jetlinks-ui-components';
import moment from 'moment';
import dayjs from 'dayjs';
const permission = 'system/Menu';
@ -143,6 +141,7 @@ const columns = [
type: 'date',
},
width: 180,
scopedSlots: true,
},
{
title: '操作',

View File

@ -80,6 +80,23 @@
</j-table>
</j-form>
<div
class="pager"
v-if="
requestBody.params.paramsTable.length &&
requestBody.pageSize
"
>
<j-select
v-model:value="requestBody.pageNum"
style="width: 60px"
>
<j-select-option
v-for="(val, i) in pageArr"
:value="i + 1"
>{{ i + 1 }}</j-select-option
>
</j-select>
<j-pagination
:pageSize="requestBody.pageSize"
v-model:current="requestBody.pageNum"
@ -87,10 +104,11 @@
hideOnSinglePage
style="text-align: center"
/>
</div>
<j-button
type="dashed"
@click="requestBody.addRow"
style="width: 100%; text-align: center; margin-top: 5px;"
style="width: 100%; text-align: center; margin-top: 5px"
>
<AIcon type="PlusOutlined" />新增
</j-button>
@ -251,6 +269,12 @@ type requestObj = {
name: string;
value: string;
};
const pageArr = computed(() => {
const maxPageNum = Math.ceil(
requestBody.params.paramsTable.length / requestBody.pageSize,
);
return new Array(maxPageNum).fill(1);
});
</script>
<style lang="less" scoped>
@ -311,6 +335,17 @@ type requestObj = {
padding: 0 8px;
height: 56px;
}
.pager {
display: flex;
justify-content: center;
margin: 8px 0;
.ant-pagination {
margin-left: 8px;
:deep(.ant-pagination-item) {
display: none;
}
}
}
}
:deep(.ant-form-item) {
margin-bottom: 0;

View File

@ -77,6 +77,9 @@ const rowSelection = {
});
}
},
onChange: (keys: string[]) => {
rowSelection.selectedRowKeys.value = keys;
},
selectedRowKeys: ref<string[]>([]),
};
const save = async () => {

View File

@ -1,4 +1,8 @@
<template>
<j-spin :spinning="spinning">
<template #indicator>
<AIcon type="LoadingOutlined" />
</template>
<j-tree
:tree-data="treeData"
@select="clickSelectItem"
@ -10,6 +14,7 @@
{{ name }}
</template>
</j-tree>
</j-spin>
</template>
<script setup lang="ts">
@ -32,8 +37,10 @@ const props = defineProps<{
const treeData = ref<TreeProps['treeData']>([]);
const selectedKeys = ref<string[]>([]);
const spinning = ref(false);
const getTreeData = () => {
let tree: treeNodeTpye[] = [];
spinning.value = true;
getTreeOne_api().then((resp: any) => {
tree = resp.urls.map((item: any) => ({
...item,
@ -44,7 +51,8 @@ const getTreeData = () => {
if (props.mode === 'appManger') allPromise.push(apiOperations_api());
else if (props.mode === 'home')
allPromise.push(getApiGranted_api(props.code as string));
Promise.all(allPromise).then((values) => {
Promise.all(allPromise)
.then((values) => {
values.forEach((item: any, i) => {
if (props.mode === 'api') {
tree[i].schemas = item.components.schemas;
@ -69,6 +77,9 @@ const getTreeData = () => {
}
treeData.value = tree;
})
.finally(() => {
spinning.value = false;
});
});
};

View File

@ -92,8 +92,8 @@ export default defineConfig(({ mode}) => {
[env.VITE_APP_BASE_API]: {
// target: 'http://192.168.33.22:8800',
// target: 'http://192.168.32.244:8881',
target: 'http://120.77.179.54:8844', // 120测试
// target: 'http://192.168.33.46:8844', // 本地开发环境
// target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境
ws: 'ws://192.168.33.46:8844',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')