修改包结构.
This commit is contained in:
@@ -145,7 +145,7 @@
|
|||||||
import { computed, reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { dataColor, objectTruthKeyCount, resetObject } from '@/utils';
|
import { dataColor, objectTruthKeyCount, resetObject } from '@/utils';
|
||||||
import fieldConfig from '../types/card.fields';
|
import fieldConfig from '../types/host.card.fields';
|
||||||
import { deleteHost, getHostPage, HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
import { deleteHost, getHostPage, HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
||||||
import { Message, Modal } from '@arco-design/web-vue';
|
import { Message, Modal } from '@arco-design/web-vue';
|
||||||
import { tagColor } from '@/views/asset/host/types/const';
|
import { tagColor } from '@/views/asset/host/types/const';
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { updateHostConfigStatus, updateHostConfig } from '@/api/asset/host';
|
import { updateHostConfigStatus, updateHostConfig } from '@/api/asset/host';
|
||||||
import { HostSshConfig, AuthTypeEnum } from '@/views/asset/host/types/host-config.types';
|
import { HostSshConfig, AuthTypeEnum } from '@/views/asset/host/types/host-config.types';
|
||||||
import { sshRules } from '@/views/asset/host/types/host-config.rules';
|
import { sshRules } from '@/views/asset/host/types/host-config.form.rules';
|
||||||
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
|
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
|
||||||
import HostIdentitySelector from '@/components/asset/host-identity/host-identity-selector.vue';
|
import HostIdentitySelector from '@/components/asset/host-identity/host-identity-selector.vue';
|
||||||
import { toOptions } from '@/utils/enum';
|
import { toOptions } from '@/utils/enum';
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import useVisible from '@/hooks/visible';
|
import useVisible from '@/hooks/visible';
|
||||||
import formRules from '../types/form.rules';
|
import formRules from '../types/host.form.rules';
|
||||||
import { createHost, updateHost, HostUpdateRequest } from '@/api/asset/host';
|
import { createHost, updateHost, HostUpdateRequest } from '@/api/asset/host';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import TagMultiSelector from '@/components/meta/tag/tag-multi-selector.vue';
|
import TagMultiSelector from '@/components/meta/tag/tag-multi-selector.vue';
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
import { deleteHost, getHostPage, HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
import { deleteHost, getHostPage, HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/host.table.columns';
|
||||||
import { tagColor } from '../types/const';
|
import { tagColor } from '../types/const';
|
||||||
import { usePagination } from '@/types/table';
|
import { usePagination } from '@/types/table';
|
||||||
import useCopy from '@/hooks/copy';
|
import useCopy from '@/hooks/copy';
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const columns = [
|
|||||||
title: '主机地址',
|
title: '主机地址',
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
slotName: 'address',
|
slotName: 'address',
|
||||||
width: 260
|
|
||||||
}, {
|
}, {
|
||||||
title: '主机标签',
|
title: '主机标签',
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal v-model:visible="visible"
|
||||||
|
body-class="modal-form"
|
||||||
|
title-align="start"
|
||||||
|
:title="title"
|
||||||
|
:top="80"
|
||||||
|
:align-center="false"
|
||||||
|
:draggable="true"
|
||||||
|
:mask-closable="false"
|
||||||
|
:unmount-on-close="true"
|
||||||
|
:ok-button-props="{ disabled: loading }"
|
||||||
|
:cancel-button-props="{ disabled: loading }"
|
||||||
|
:on-before-ok="handlerOk"
|
||||||
|
@close="handleClose">
|
||||||
|
<a-spin :loading="loading">
|
||||||
|
<a-form :model="formModel"
|
||||||
|
ref="formRef"
|
||||||
|
label-align="right"
|
||||||
|
:style="{ width: '460px' }"
|
||||||
|
:label-col-props="{ span: 6 }"
|
||||||
|
:wrapper-col-props="{ span: 18 }"
|
||||||
|
:rules="formRules">
|
||||||
|
<!-- 配置项 -->
|
||||||
|
<a-form-item field="keyName" label="配置项">
|
||||||
|
<a-input v-model="formModel.keyName" placeholder="请输入配置项" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
<!-- 配置值定义 -->
|
||||||
|
<a-form-item field="valueType" label="配置值定义">
|
||||||
|
<a-select v-model="formModel.valueType"
|
||||||
|
:options="toOptions(ValueTypeEnum)"
|
||||||
|
placeholder="请选择配置值定义" />
|
||||||
|
</a-form-item>
|
||||||
|
<!-- 额外配置定义 -->
|
||||||
|
<a-form-item field="extraSchema" label="额外配置定义">
|
||||||
|
<a-input v-model="formModel.extraSchema" placeholder="请输入额外配置定义" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
<!-- 配置描述 -->
|
||||||
|
<a-form-item field="description" label="配置描述">
|
||||||
|
<a-input v-model="formModel.description" placeholder="请输入配置描述" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'system-dict-key-form-modal'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import useLoading from '@/hooks/loading';
|
||||||
|
import useVisible from '@/hooks/visible';
|
||||||
|
import formRules from '../types/dict-key.form.rules';
|
||||||
|
import { createDictKey, updateDictKey, DictKeyUpdateRequest } from '@/api/system/dict-key';
|
||||||
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
import {} from '../types/const';
|
||||||
|
import { ValueTypeEnum } from '../types/enum.types';
|
||||||
|
import { toOptions } from '@/utils/enum';
|
||||||
|
|
||||||
|
const { visible, setVisible } = useVisible();
|
||||||
|
const { loading, setLoading } = useLoading();
|
||||||
|
|
||||||
|
const title = ref<string>();
|
||||||
|
const isAddHandle = ref<boolean>(true);
|
||||||
|
|
||||||
|
const defaultForm = (): DictKeyUpdateRequest => {
|
||||||
|
return {
|
||||||
|
id: undefined,
|
||||||
|
keyName: undefined,
|
||||||
|
valueType: undefined,
|
||||||
|
extraSchema: undefined,
|
||||||
|
description: undefined,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const formRef = ref<any>();
|
||||||
|
const formModel = ref<DictKeyUpdateRequest>({});
|
||||||
|
|
||||||
|
const emits = defineEmits(['added', 'updated']);
|
||||||
|
|
||||||
|
// 打开新增
|
||||||
|
const openAdd = () => {
|
||||||
|
title.value = '添加字典配置项';
|
||||||
|
isAddHandle.value = true;
|
||||||
|
renderForm({ ...defaultForm() });
|
||||||
|
setVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开修改
|
||||||
|
const openUpdate = (record: any) => {
|
||||||
|
title.value = '修改字典配置项';
|
||||||
|
isAddHandle.value = false;
|
||||||
|
renderForm({ ...defaultForm(), ...record });
|
||||||
|
setVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 渲染表单
|
||||||
|
const renderForm = (record: any) => {
|
||||||
|
formModel.value = Object.assign({}, record);
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ openAdd, openUpdate });
|
||||||
|
|
||||||
|
// 确定
|
||||||
|
const handlerOk = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
// 验证参数
|
||||||
|
const error = await formRef.value.validate();
|
||||||
|
if (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isAddHandle.value) {
|
||||||
|
// 新增
|
||||||
|
await createDictKey(formModel.value);
|
||||||
|
Message.success('创建成功');
|
||||||
|
emits('added');
|
||||||
|
} else {
|
||||||
|
// 修改
|
||||||
|
await updateDictKey(formModel.value);
|
||||||
|
Message.success('修改成功');
|
||||||
|
emits('updated');
|
||||||
|
}
|
||||||
|
// 清空
|
||||||
|
handlerClear();
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭
|
||||||
|
const handleClose = () => {
|
||||||
|
handlerClear();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 清空
|
||||||
|
const handlerClear = () => {
|
||||||
|
setLoading(false);
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import useVisible from '@/hooks/visible';
|
import useVisible from '@/hooks/visible';
|
||||||
import formRules from '../types/form.rules';
|
import formRules from '../types/dict-value.form.rules';
|
||||||
import { createDictValue, updateDictValue, DictValueUpdateRequest } from '@/api/system/dict-value';
|
import { createDictValue, updateDictValue, DictValueUpdateRequest } from '@/api/system/dict-value';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import {} from '../types/const';
|
import {} from '../types/const';
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
<a-button type="text"
|
<a-button type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-permission="['infra:dict-value:update']"
|
v-permission="['infra:dict-value:update']"
|
||||||
@click="emits('openValueUpdate', record)">
|
@click="emits('openUpdateValue', record)">
|
||||||
修改
|
修改
|
||||||
</a-button>
|
</a-button>
|
||||||
<!-- 历史 -->
|
<!-- 历史 -->
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
import { batchDeleteDictValue, deleteDictValue, getDictValuePage, DictValueQueryRequest, DictValueQueryResponse } from '@/api/system/dict-value';
|
import { batchDeleteDictValue, deleteDictValue, getDictValuePage, DictValueQueryRequest, DictValueQueryResponse } from '@/api/system/dict-value';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/dict-value.table.columns';
|
||||||
import { usePagination, useRowSelection } from '@/types/table';
|
import { usePagination, useRowSelection } from '@/types/table';
|
||||||
import {} from '../types/const';
|
import {} from '../types/const';
|
||||||
import {} from '../types/enum.types';
|
import {} from '../types/enum.types';
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
const tableRenderData = ref<DictValueQueryResponse[]>([]);
|
const tableRenderData = ref<DictValueQueryResponse[]>([]);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const emits = defineEmits(['openAddKey', 'openAddValue', 'openValueUpdate', 'openValueHistory']);
|
const emits = defineEmits(['openAddKey', 'openAddValue', 'openUpdateValue', 'openValueHistory']);
|
||||||
|
|
||||||
const pagination = usePagination();
|
const pagination = usePagination();
|
||||||
const selectedKeys = ref<number[]>([]);
|
const selectedKeys = ref<number[]>([]);
|
||||||
|
|||||||
@@ -2,12 +2,18 @@
|
|||||||
<div class="layout-container">
|
<div class="layout-container">
|
||||||
<!-- 列表-表格 -->
|
<!-- 列表-表格 -->
|
||||||
<dict-value-table ref="table"
|
<dict-value-table ref="table"
|
||||||
@openAdd="() => modal.openAdd()"
|
@openAddKey="() => keyModal.openAdd()"
|
||||||
@openUpdate="(e) => modal.openUpdate(e)" />
|
@openValueHistory="() => keyModal.openAdd()"
|
||||||
<!-- 添加修改模态框 -->
|
@openAddValue="() => valueModal.openAdd()"
|
||||||
<dict-value-form-modal ref="modal"
|
@openUpdateValue="(e) => valueModal.openUpdate(e)" />
|
||||||
@added="modalAddCallback"
|
<!-- 添加修改 配置项模态框 -->
|
||||||
@updated="modalUpdateCallback" />
|
<dict-key-form-modal ref="keyModal"
|
||||||
|
@added="keyModalAddCallback"
|
||||||
|
@updated="keyModalUpdateCallback" />
|
||||||
|
<!-- 添加修改 配置值模态框 -->
|
||||||
|
<dict-value-form-modal ref="valueModal"
|
||||||
|
@added="valueModalAddCallback"
|
||||||
|
@updated="valueModalUpdateCallback" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -20,19 +26,31 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import DictValueTable from './components/dict-value-table.vue';
|
import DictValueTable from './components/dict-value-table.vue';
|
||||||
import DictValueFormModal from './components/dict-value-form-modal.vue';
|
import DictValueFormModal from './components/dict-value-form-modal.vue';
|
||||||
|
import DictKeyFormModal from './components/dict-key-form-modal.vue';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const table = ref();
|
const table = ref();
|
||||||
const modal = ref();
|
const keyModal = ref();
|
||||||
|
const valueModal = ref();
|
||||||
|
|
||||||
// 添加回调
|
// 配置项添加回调
|
||||||
const modalAddCallback = () => {
|
const keyModalAddCallback = () => {
|
||||||
table.value.addedCallback();
|
table.value.addedCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 修改回调
|
// 配置项修改回调
|
||||||
const modalUpdateCallback = () => {
|
const keyModalUpdateCallback = () => {
|
||||||
|
table.value.updatedCallback();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置值添加回调
|
||||||
|
const valueModalAddCallback = () => {
|
||||||
|
table.value.addedCallback();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置值修改回调
|
||||||
|
const valueModalUpdateCallback = () => {
|
||||||
table.value.updatedCallback();
|
table.value.updatedCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { FieldRule } from '@arco-design/web-vue';
|
||||||
|
|
||||||
|
export const keyName = [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入配置项'
|
||||||
|
}, {
|
||||||
|
maxLength: 32,
|
||||||
|
message: '配置项长度不能大于32位'
|
||||||
|
}] as FieldRule[];
|
||||||
|
|
||||||
|
export const valueType = [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入配置值定义'
|
||||||
|
}, {
|
||||||
|
maxLength: 12,
|
||||||
|
message: '配置值定义长度不能大于12位'
|
||||||
|
}] as FieldRule[];
|
||||||
|
|
||||||
|
export const extraSchema = [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入额外配置定义'
|
||||||
|
}] as FieldRule[];
|
||||||
|
|
||||||
|
export const description = [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入配置描述'
|
||||||
|
}, {
|
||||||
|
maxLength: 64,
|
||||||
|
message: '配置描述长度不能大于64位'
|
||||||
|
}] as FieldRule[];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
keyName,
|
||||||
|
valueType,
|
||||||
|
extraSchema,
|
||||||
|
description,
|
||||||
|
} as Record<string, FieldRule | FieldRule[]>;
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||||
|
import { dateFormat } from '@/utils';
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: 'id',
|
||||||
|
dataIndex: 'id',
|
||||||
|
slotName: 'id',
|
||||||
|
width: 70,
|
||||||
|
align: 'left',
|
||||||
|
fixed: 'left',
|
||||||
|
}, {
|
||||||
|
title: '配置项',
|
||||||
|
dataIndex: 'keyName',
|
||||||
|
slotName: 'keyName',
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
}, {
|
||||||
|
title: '配置值定义',
|
||||||
|
dataIndex: 'valueType',
|
||||||
|
slotName: 'valueType',
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
}, {
|
||||||
|
title: '额外配置定义',
|
||||||
|
dataIndex: 'extraSchema',
|
||||||
|
slotName: 'extraSchema',
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
}, {
|
||||||
|
title: '配置描述',
|
||||||
|
dataIndex: 'description',
|
||||||
|
slotName: 'description',
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
}, {
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
slotName: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.createTime));
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
slotName: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.updateTime));
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
title: '创建人',
|
||||||
|
dataIndex: 'creator',
|
||||||
|
slotName: 'creator',
|
||||||
|
}, {
|
||||||
|
title: '修改人',
|
||||||
|
dataIndex: 'updater',
|
||||||
|
slotName: 'updater',
|
||||||
|
}, {
|
||||||
|
title: '操作',
|
||||||
|
slotName: 'handle',
|
||||||
|
width: 130,
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
] as TableColumnData[];
|
||||||
|
|
||||||
|
export default columns;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* 配置值定义
|
||||||
|
*/
|
||||||
|
export const ValueTypeEnum = {
|
||||||
|
STRING: {
|
||||||
|
label: '字符串',
|
||||||
|
value: 'STRING',
|
||||||
|
},
|
||||||
|
INTEGER: {
|
||||||
|
label: '整数',
|
||||||
|
value: 'INTEGER',
|
||||||
|
},
|
||||||
|
DECIMAL: {
|
||||||
|
label: '小数',
|
||||||
|
value: 'DECIMAL',
|
||||||
|
},
|
||||||
|
BOOLEAN: {
|
||||||
|
label: '布尔值',
|
||||||
|
value: 'BOOLEAN',
|
||||||
|
},
|
||||||
|
COLOR: {
|
||||||
|
label: '颜色',
|
||||||
|
value: 'COLOR',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user