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

View File

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

View File

@ -80,17 +80,35 @@
</j-table> </j-table>
</j-form> </j-form>
<j-pagination <div
:pageSize="requestBody.pageSize" class="pager"
v-model:current="requestBody.pageNum" v-if="
:total="requestBody.params.paramsTable.length" requestBody.params.paramsTable.length &&
hideOnSinglePage requestBody.pageSize
style="text-align: center" "
/> >
<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"
:total="requestBody.params.paramsTable.length"
hideOnSinglePage
style="text-align: center"
/>
</div>
<j-button <j-button
type="dashed" type="dashed"
@click="requestBody.addRow" @click="requestBody.addRow"
style="width: 100%; text-align: center; margin-top: 5px;" style="width: 100%; text-align: center; margin-top: 5px"
> >
<AIcon type="PlusOutlined" />新增 <AIcon type="PlusOutlined" />新增
</j-button> </j-button>
@ -251,6 +269,12 @@ type requestObj = {
name: string; name: string;
value: string; value: string;
}; };
const pageArr = computed(() => {
const maxPageNum = Math.ceil(
requestBody.params.paramsTable.length / requestBody.pageSize,
);
return new Array(maxPageNum).fill(1);
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -311,6 +335,17 @@ type requestObj = {
padding: 0 8px; padding: 0 8px;
height: 56px; 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) { :deep(.ant-form-item) {
margin-bottom: 0; margin-bottom: 0;

View File

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

View File

@ -1,15 +1,20 @@
<template> <template>
<j-tree <j-spin :spinning="spinning">
:tree-data="treeData" <template #indicator>
@select="clickSelectItem" <AIcon type="LoadingOutlined" />
v-model:selected-keys="selectedKeys"
showLine
class="left-tree-container"
>
<template #title="{ name }">
{{ name }}
</template> </template>
</j-tree> <j-tree
:tree-data="treeData"
@select="clickSelectItem"
v-model:selected-keys="selectedKeys"
showLine
class="left-tree-container"
>
<template #title="{ name }">
{{ name }}
</template>
</j-tree>
</j-spin>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -32,8 +37,10 @@ const props = defineProps<{
const treeData = ref<TreeProps['treeData']>([]); const treeData = ref<TreeProps['treeData']>([]);
const selectedKeys = ref<string[]>([]); const selectedKeys = ref<string[]>([]);
const spinning = ref(false);
const getTreeData = () => { const getTreeData = () => {
let tree: treeNodeTpye[] = []; let tree: treeNodeTpye[] = [];
spinning.value = true;
getTreeOne_api().then((resp: any) => { getTreeOne_api().then((resp: any) => {
tree = resp.urls.map((item: any) => ({ tree = resp.urls.map((item: any) => ({
...item, ...item,
@ -44,32 +51,36 @@ const getTreeData = () => {
if (props.mode === 'appManger') allPromise.push(apiOperations_api()); if (props.mode === 'appManger') allPromise.push(apiOperations_api());
else if (props.mode === 'home') else if (props.mode === 'home')
allPromise.push(getApiGranted_api(props.code as string)); allPromise.push(getApiGranted_api(props.code as string));
Promise.all(allPromise).then((values) => { Promise.all(allPromise)
values.forEach((item: any, i) => { .then((values) => {
if (props.mode === 'api') { values.forEach((item: any, i) => {
tree[i].schemas = item.components.schemas; if (props.mode === 'api') {
tree[i].children = combData(item.paths); tree[i].schemas = item.components.schemas;
} else if (i < values.length - 2) { tree[i].children = combData(item.paths);
const paths = filterPath( } else if (i < values.length - 2) {
item.paths, const paths = filterPath(
values[values.length - 1].result as string[], item.paths,
); values[values.length - 1].result as string[],
tree[i].children = combData(paths); );
tree[i].schemas = item.components.schemas; tree[i].children = combData(paths);
} tree[i].schemas = item.components.schemas;
}); }
if (props.hasHome) {
tree.unshift({
key: 'home',
name: '首页',
schemas: {},
children: [],
}); });
selectedKeys.value = ['home']; if (props.hasHome) {
} tree.unshift({
key: 'home',
name: '首页',
schemas: {},
children: [],
});
selectedKeys.value = ['home'];
}
treeData.value = tree; treeData.value = tree;
}); })
.finally(() => {
spinning.value = false;
});
}); });
}; };
const clickSelectItem: TreeProps['onSelect'] = (key: any[], node: any) => { const clickSelectItem: TreeProps['onSelect'] = (key: any[], node: any) => {

View File

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