mirror of https://github.com/certd/certd
perf: 切换到不同的分组后再打开创建对话框,会自动选择分组
parent
d613aa8f3e
commit
893dcd4f24
|
@ -5,7 +5,7 @@ export class Cache {
|
||||||
return this.bucket[key];
|
return this.bucket[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
async set(key: string, value: any, ttl: number) {
|
async set(key: string, value: any, ttl?: number) {
|
||||||
this.bucket[key] = value;
|
this.bucket[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { checkPipelineLimit, getAllDomainsFromCrt } from "/@/views/certd/pipelin
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { usePluginStore } from "/@/store/plugin";
|
import { usePluginStore } from "/@/store/plugin";
|
||||||
|
import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
|
||||||
|
|
||||||
export function useCertUpload() {
|
export function useCertUpload() {
|
||||||
const { openCrudFormDialog } = useFormWrapper();
|
const { openCrudFormDialog } = useFormWrapper();
|
||||||
|
@ -136,6 +137,10 @@ export function useCertUpload() {
|
||||||
type: "dict-select",
|
type: "dict-select",
|
||||||
dict: groupDictRef,
|
dict: groupDictRef,
|
||||||
form: {
|
form: {
|
||||||
|
component: {
|
||||||
|
name: GroupSelector,
|
||||||
|
vModel: "modelValue",
|
||||||
|
},
|
||||||
value: req.defaultGroupId || undefined,
|
value: req.defaultGroupId || undefined,
|
||||||
order: 9999,
|
order: 9999,
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { ref } from "vue";
|
||||||
import * as api from "../api";
|
import * as api from "../api";
|
||||||
import { PluginGroup, usePluginStore } from "/@/store/plugin";
|
import { PluginGroup, usePluginStore } from "/@/store/plugin";
|
||||||
import { createNotificationApi } from "/@/views/certd/notification/api";
|
import { createNotificationApi } from "/@/views/certd/notification/api";
|
||||||
|
import GroupSelector from "../group/group-selector.vue";
|
||||||
|
|
||||||
export function setRunnableIds(pipeline: any) {
|
export function setRunnableIds(pipeline: any) {
|
||||||
const idMap: any = {};
|
const idMap: any = {};
|
||||||
|
@ -203,6 +204,10 @@ export function useCertPipelineCreator() {
|
||||||
type: "dict-select",
|
type: "dict-select",
|
||||||
dict: groupDictRef,
|
dict: groupDictRef,
|
||||||
form: {
|
form: {
|
||||||
|
component: {
|
||||||
|
name: GroupSelector,
|
||||||
|
vModel: "modelValue",
|
||||||
|
},
|
||||||
order: 9999,
|
order: 9999,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,6 +15,7 @@ import CertView from "./cert-view.vue";
|
||||||
import { eachStages } from "./utils";
|
import { eachStages } from "./utils";
|
||||||
import { setRunnableIds, useCertPipelineCreator } from "/@/views/certd/pipeline/certd-form/use";
|
import { setRunnableIds, useCertPipelineCreator } from "/@/views/certd/pipeline/certd-form/use";
|
||||||
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
|
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
|
||||||
|
import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
|
||||||
|
|
||||||
export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -116,6 +117,13 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const settingStore = useSettingStore();
|
const settingStore = useSettingStore();
|
||||||
|
|
||||||
|
function onDialogOpen(opt: any) {
|
||||||
|
const searchForm = crudExpose.getSearchValidatedFormData();
|
||||||
|
opt.initialForm = {
|
||||||
|
groupId: searchForm.groupId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
|
@ -193,6 +201,9 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||||
router.push({ path: "/certd/pipeline/detail", query: { id: res.id, editMode: "true" } });
|
router.push({ path: "/certd/pipeline/detail", query: { id: res.id, editMode: "true" } });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
wrapper: {
|
||||||
|
onOpen: onDialogOpen,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
scroll: { x: 1500 },
|
scroll: { x: 1500 },
|
||||||
|
@ -492,6 +503,12 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
dict: groupDictRef,
|
dict: groupDictRef,
|
||||||
|
form: {
|
||||||
|
component: {
|
||||||
|
name: GroupSelector,
|
||||||
|
vModel: "modelValue",
|
||||||
|
},
|
||||||
|
},
|
||||||
column: {
|
column: {
|
||||||
width: 130,
|
width: 130,
|
||||||
align: "center",
|
align: "center",
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
|
||||||
import { pipelineGroupApi } from "./api";
|
import { pipelineGroupApi } from "./api";
|
||||||
|
|
||||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const { t } = useI18n();
|
|
||||||
const api = pipelineGroupApi;
|
const api = pipelineGroupApi;
|
||||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
|
@ -34,32 +33,32 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
mobile: {
|
mobile: {
|
||||||
props: {
|
props: {
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
width: 160
|
width: 160,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
request: {
|
request: {
|
||||||
pageRequest,
|
pageRequest,
|
||||||
addRequest,
|
addRequest,
|
||||||
editRequest,
|
editRequest,
|
||||||
delRequest
|
delRequest,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
labelCol: {
|
labelCol: {
|
||||||
//固定label宽度
|
//固定label宽度
|
||||||
span: null,
|
span: null,
|
||||||
style: {
|
style: {
|
||||||
width: "100px"
|
width: "100px",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
col: {
|
col: {
|
||||||
span: 22
|
span: 22,
|
||||||
},
|
},
|
||||||
wrapper: {
|
wrapper: {
|
||||||
width: 600
|
width: 600,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
width: 200,
|
width: 200,
|
||||||
|
@ -72,12 +71,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
click({ row, index }) {
|
click({ row, index }) {
|
||||||
crudExpose.openEdit({
|
crudExpose.openEdit({
|
||||||
index,
|
index,
|
||||||
row
|
row,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
editable: {
|
editable: {
|
||||||
|
@ -90,8 +89,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
const { row, key, value } = opts;
|
const { row, key, value } = opts;
|
||||||
//如果是添加,需要返回{[rowKey]:xxx},比如:{id:2}
|
//如果是添加,需要返回{[rowKey]:xxx},比如:{id:2}
|
||||||
return await api.UpdateObj({ id: row.id, [key]: value });
|
return await api.UpdateObj({ id: row.id, [key]: value });
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -99,37 +98,37 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
key: "id",
|
key: "id",
|
||||||
type: "number",
|
type: "number",
|
||||||
search: {
|
search: {
|
||||||
show: true
|
show: true,
|
||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
width: 100,
|
width: 100,
|
||||||
editable: {
|
editable: {
|
||||||
disabled: true
|
disabled: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
show: false
|
show: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
title: "分组名称",
|
title: "分组名称",
|
||||||
search: {
|
search: {
|
||||||
show: true
|
show: true,
|
||||||
},
|
},
|
||||||
type: "text",
|
type: "text",
|
||||||
form: {
|
form: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入分组名称"
|
message: "请输入分组名称",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
width: 400
|
width: 400,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
<template>
|
||||||
|
<div class="pi-group-selector flex full-w">
|
||||||
|
<div class="flex-1">
|
||||||
|
<fs-dict-select :value="modelValue" :dict="groupDictRef" @update:value="doUpdate"></fs-dict-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<fs-table-select
|
||||||
|
class="flex-0"
|
||||||
|
:create-crud-options="createCrudOptions"
|
||||||
|
:crud-options-override="{
|
||||||
|
search: { show: false },
|
||||||
|
table: {
|
||||||
|
scroll: {
|
||||||
|
x: 540,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
:model-value="modelValue"
|
||||||
|
:dict="groupDictRef"
|
||||||
|
:show-current="false"
|
||||||
|
:show-select="false"
|
||||||
|
:dialog="{ width: 960 }"
|
||||||
|
:destroy-on-close="false"
|
||||||
|
height="400px"
|
||||||
|
@update:model-value="doUpdate"
|
||||||
|
@dialog-closed="doRefresh"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<fs-button class="ml-5" type="primary" icon="ant-design:edit-outlined" @click="scope.open"></fs-button>
|
||||||
|
</template>
|
||||||
|
</fs-table-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import createCrudOptions from "./crud";
|
||||||
|
import { dict, FsDictSelect } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
modelValue: number;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "GroupSelector",
|
||||||
|
});
|
||||||
|
const groupDictRef = dict({
|
||||||
|
url: "/pi/pipeline/group/all",
|
||||||
|
value: "id",
|
||||||
|
label: "name",
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["refresh", "update:modelValue"]);
|
||||||
|
function doRefresh() {
|
||||||
|
emit("refresh");
|
||||||
|
groupDictRef.reloadDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
function doUpdate(value: any) {
|
||||||
|
emit("update:modelValue", value);
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue