fix(系统设置&公共): 修改组织id&联调级联接口请求options

This commit is contained in:
xinxin.wu 2023-11-02 16:06:23 +08:00 committed by rubylliu
parent eb9e4253e7
commit d1ec8d00bc
32 changed files with 282 additions and 110 deletions

View File

@ -11,18 +11,30 @@ import {
GetOrganizeTemplateUrl,
GetProjectTemplateDetailUrl,
isEnableTemplateUrl,
OrdCreateFlowStatusUrl,
OrdDeleteFlowStatusUrl,
OrdSetStateUrl,
OrdStateSortUrl,
OrdUpdateFlowStatusUrl,
OrdUpdateStateFlowUrl,
OrdWorkFlowUrl,
SetOrganizeTemplateUrl,
UpdateFieldUrl,
UpdateOrganizeTemplateUrl,
UpdateProjectTemplateUrl,
} from '@/api/requrls/setting/template';
import { CommonList, TableQueryParams } from '@/models/common';
import { TableQueryParams } from '@/models/common';
import type {
ActionTemplateManage,
AddOrUpdateField,
DefinedFieldItem,
OrdWorkStatus,
OrganizeTemplateItem,
SeneType,
SetStateType,
UpdateWorkFlowSetting,
WorkFlowType,
} from '@/models/setting/template';
/** *
@ -80,4 +92,35 @@ export function getOrdFieldDetail(id: string) {
return MSR.get({ url: GetFieldDetailUrl, params: id });
}
// 组织模板-工作流
// 获取组织下边模板工作流
export function getWorkFlowList(organizationId: string, scene: SeneType) {
return MSR.get<WorkFlowType[]>({ url: `${OrdWorkFlowUrl}/${organizationId}/${scene}` });
}
// 创建工作流状态
export function createWorkFlowStatus(data: OrdWorkStatus) {
return MSR.post<WorkFlowType[]>({ url: OrdCreateFlowStatusUrl, data });
}
// 更新工作流状态
export function updateWorkFlowStatus(data: OrdWorkStatus) {
return MSR.post<WorkFlowType[]>({ url: OrdUpdateFlowStatusUrl, data });
}
// 删除工作流状态
export function deleteOrdWorkState(id: string) {
return MSR.get({ url: OrdDeleteFlowStatusUrl, params: id });
}
// 设置工作流状态初始态 || 结束态
export function setOrdWorkState(data: SetStateType) {
return MSR.post({ url: OrdSetStateUrl, data });
}
// 设置工作流状态排序
export function setOrdWorkStateSort(organizationId: string, scene: SeneType, data: string[]) {
return MSR.post({ url: `${OrdStateSortUrl}/${organizationId}/${scene}`, data });
}
// 更新工作流流转状态
export function updateOrdWorkStateFlow(data: UpdateWorkFlowSetting) {
return MSR.post({ url: `${OrdUpdateStateFlowUrl}`, data });
}
export default {};

View File

@ -44,3 +44,20 @@ export const UpdateFieldUrl = '/organization/custom/field/update';
export const GetFieldDetailUrl = '/organization/custom/field/get';
// 删除自定义字段
export const DeleteFieldDetailUrl = '/organization/custom/field/delete';
// 系统设置-组织-获取工作流列表
export const OrdWorkFlowUrl = '/organization/status/flow/setting/get';
// 状态流更新
export const OrdWorkFlowSetting = '/organization/status/flow/setting/status/update';
// 创建工作流状态
export const OrdCreateFlowStatusUrl = '/organization/status/flow/setting/status/add';
// 更新工作流状态
export const OrdUpdateFlowStatusUrl = '/organization/status/flow/setting/status/update';
// 删除工作流状态
export const OrdDeleteFlowStatusUrl = '/organization/status/flow/setting/status/delete';
// 设置工作流状态为初始态或者标记结束状态
export const OrdSetStateUrl = '/organization/status/flow/setting/status/definition/update';
// 设置选项排序
export const OrdStateSortUrl = '/organization/status/flow/setting/status/sort';
// 更新状态流转
export const OrdUpdateStateFlowUrl = '/organization/status/flow/setting/status/flow/update';

View File

@ -24,11 +24,7 @@
<a-spin :loading="bottomLoading"></a-spin>
</div>
</div>
<a-empty
v-if="!topLoading && !bottomLoading && (remoteList.length === 0 || props.list?.length === 0)"
:description="t('common.noData')"
class="h-[200px] justify-center"
/>
<a-empty v-if="isShow" :description="t('common.noData')" class="h-[200px] justify-center" />
</div>
</template>
@ -208,6 +204,13 @@
}, 300)
);
const isShow = computed(() => {
if (props.mode === 'static') {
return props.list?.length === 0;
}
return !topLoading.value && !bottomLoading.value && (remoteList.value.length === 0 || props.list?.length === 0);
});
onMounted(async () => {
if (props.mode === 'remote') {
await computedListSize();

View File

@ -2,6 +2,7 @@
<a-input
:value="props.modelValue"
:placeholder="t('project.menu.pleaseInputJiraKey')"
v-bind="attrs"
@change="(v: string) => emit('update:modelValue', v)"
/>
<div class="flex flex-row items-center gap-[10px] text-[12px] leading-[20px]">
@ -21,6 +22,8 @@
<script setup lang="ts">
import { useI18n } from '@/hooks/useI18n';
const attrs = useAttrs();
const props = defineProps<{
modelValue: string;
instructionsIcon: string;
@ -28,6 +31,7 @@
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
}>();
const { t } = useI18n();
</script>

View File

@ -1,5 +1,8 @@
import { useI18n } from '@/hooks/useI18n';
import { FormRule } from '@form-create/arco-design';
const { t } = useI18n();
// 表单字段使用
export const INPUT = {
type: 'input',
@ -7,7 +10,7 @@ export const INPUT = {
field: 'fieldName',
value: '',
props: {
placeholder: '请输入',
placeholder: t('formCreate.PleaseEnter'),
},
};
export const SELECT = {
@ -18,7 +21,7 @@ export const SELECT = {
options: [],
props: {
multiple: false,
placeholder: '请选择',
placeholder: t('formCreate.PleaseSelect'),
options: [],
modelValue: '',
},
@ -32,7 +35,7 @@ export const MULTIPLE_SELECT = {
options: [],
props: {
multiple: true,
placeholder: '请选择',
placeholder: t('formCreate.PleaseSelect'),
options: [],
modelValue: [],
},
@ -62,7 +65,7 @@ export const MEMBER = {
options: [],
props: {
multiple: false,
placeholder: '请选择',
placeholder: t('formCreate.PleaseSelect'),
modelValue: '',
},
};
@ -75,7 +78,7 @@ export const MULTIPLE_MEMBER = {
options: [],
props: {
multiple: true,
placeholder: '请选择',
placeholder: t('formCreate.PleaseSelect'),
options: [],
modelValue: [],
},
@ -87,7 +90,7 @@ export const DATE = {
title: '',
value: '',
props: {
'placeholder': '请选择',
'placeholder': t('formCreate.PleaseSelect'),
'format': 'YYYY/MM/DD',
'show-time': false,
},
@ -99,7 +102,7 @@ export const DATETIME = {
title: '',
value: '',
props: {
'placeholder': '请选择',
'placeholder': t('formCreate.PleaseSelect'),
'format': 'YYYY/MM/DD HH:mm:ss',
'show-time': true,
},
@ -111,7 +114,7 @@ export const FLOAT = {
title: '',
value: 0,
props: {
placeholder: '请输入',
placeholder: t('formCreate.PleaseEnter'),
},
};
@ -122,7 +125,7 @@ export const INT = {
value: 0,
props: {
precision: 0,
placeholder: '请输入',
placeholder: t('formCreate.PleaseEnter'),
},
};
@ -132,7 +135,7 @@ export const MULTIPLE_INPUT = {
title: '',
value: [],
props: {
placeholder: '请选择',
placeholder: t('formCreate.PleaseSelect'),
},
};
@ -142,7 +145,7 @@ export const TEXTAREA = {
title: '',
value: '',
props: {
'placeholder': '请输入',
'placeholder': t('formCreate.PleaseEnter'),
'auto-size': {
minRows: 1,
maxRows: 3,
@ -156,7 +159,7 @@ export const JIRAKEY = {
value: '',
props: {
moduleValue: '',
placeholder: '请输入',
placeholder: t('formCreate.PleaseEnter'),
instructionsIcon: '',
},
};

View File

@ -86,9 +86,9 @@
(val) => {
// options
if (val) {
val.forEach((item) => {
val.forEach(async (item) => {
if (item.value) {
getOptionsRequest(item);
await getOptionsRequest(item);
}
});
}
@ -96,12 +96,6 @@
{ deep: true, immediate: false }
);
watchEffect(() => {
// formRules.value = cloneDeep(props.formRule);
// formCreateStore.setInitFormCreate(props.formCreateKey, props.formRule);
// formCreateStore.initFormCreateFormRules(props.formCreateKey);
});
const formRuleList = ref<FormRuleItem[]>([]); //
const formRules = ref<FormItem[]>([]);
watch(
@ -142,8 +136,7 @@
instructionsIcon: item.props.instructionsIcon || '',
optionMethod: item.props.optionMethod || '',
couplingConfig: {
type: item.props.couplingConfig.type,
cascade: item.link,
...item.props.couplingConfig,
},
};
return formItemRule;

View File

@ -0,0 +1,4 @@
export default {
'formCreate.PleaseEnter': 'Please enter',
'formCreate.PleaseSelect': 'Please select',
};

View File

@ -0,0 +1,4 @@
export default {
'formCreate.PleaseEnter': '请输入',
'formCreate.PleaseSelect': '请选择',
};

View File

@ -23,6 +23,7 @@
import { FormCreateKeyEnum } from '@/enums/formCreateEnum';
const appStore = useAppStore();
const organizationId = computed(() => appStore.currentOrgId);
const attrs = useAttrs();
const formCreateStore = useFormCreateStore();
@ -51,19 +52,17 @@
const optionsList = ref<{ label: string; value: string }[]>([]);
const params = ref<OptionsParams>();
const pluginId = (sessionStorage.getItem('platformKey') as string) || 'jira';
async function getLinksItem() {
const { formKey } = attrs;
const formRulesList = formCreateStore.formRuleMap.get(formKey as FormCreateKeyEnum[keyof FormCreateKeyEnum]);
if (formRulesList && props.optionMethod) {
params.value = {
pluginId: props.keyword as string,
organizationId: appStore.currentOrgId,
projectConfig: formRulesList,
pluginId,
organizationId: organizationId.value,
projectConfig: JSON.stringify(props.formValue) as string,
optionMethod: props.optionMethod,
};
//
// console.log(selectValue.value, props.keyword, props.modelValue);
try {
const res = await getPluginOptions(params.value);
optionsList.value = res.map((item) => {
@ -107,9 +106,9 @@
watch(
() => selectValue.value,
async (val) => {
(val) => {
selectValue.value = val;
await emit('update:model-value', val);
emit('update:model-value', val);
}
);

View File

@ -6,7 +6,9 @@
<template #content>
<template v-for="item of props.list">
<a-divider v-if="item.isDivider" :key="`${item.label}-divider`" margin="4px" />
<a-doption v-else :key="item.label" :class="item.danger ? 'error-6' : ''">{{ t(item.label || '') }}</a-doption>
<a-doption v-else :key="item.label" :class="item.danger ? 'error-6' : ''" :disabled="item.disabled">{{
t(item.label || '')
}}</a-doption>
</template>
</template>
</a-dropdown>

View File

@ -3,6 +3,7 @@ export interface ActionsItem {
eventTag?: string; // 事件标识
isDivider?: boolean; // 是否分割线true 的话只展示分割线,没有其他内容
danger?: boolean; // 是否危险操作true 的话会显示红色按钮
disabled?: boolean; // 是否禁用
}
export type SelectedValue = string | number | Record<string, any> | undefined;

View File

@ -2,7 +2,6 @@
export enum TemplateIconEnum {
INPUT = 'icon-icon_input', // 输入框
TEXTAREA = 'icon-icon_style_one', // 文本
RICH_TEXT = 'icon-icon_rich_text', // 富文本
SELECT = 'icon-icon_single_choice', // 单选下拉框
MULTIPLE_SELECT = 'icon-icon_multiple_choice', // 多选下拉框
RADIO = 'icon-icon_radio', // 单选框

View File

@ -57,6 +57,7 @@ export default {
'menu.settings.organization.templateManagementList': 'Template list',
'menu.settings.organization.templateManagementEdit': 'Update Template',
'menu.settings.organization.templateManagementDetail': 'Create Template',
'menu.settings.organization.templateManagementWorkFlow': 'WorkFlow',
'menu.settings.organization.serviceIntegration': 'Service Integration',
'menu.settings.organization.log': 'Log',
'navbar.action.locale': 'Switch to English',

View File

@ -58,6 +58,7 @@ export default {
'menu.settings.organization.templateManagementDetail': '创建模版',
'menu.settings.organization.templateManagementCopy': '复制模版',
'menu.settings.organization.templateManagementEdit': '更新模板',
'menu.settings.organization.templateManagementWorkFlow': '工作流',
'menu.settings.organization.log': '日志',
'navbar.action.locale': '切换为中文',
...sys,

View File

@ -100,5 +100,5 @@ export interface OptionsParams {
pluginId: string;
organizationId: string;
optionMethod: string;
projectConfig: Record<string, any>[] | FormItem[];
projectConfig: string;
}

View File

@ -112,3 +112,48 @@ export interface ActionTemplateManage {
scene?: SeneType;
customFields?: CustomField[];
}
// 工作流列表字段
export interface WorkFlowType {
id: string;
name: string;
scene: string;
remark: string;
internal: true; // 是否是内置字段
scopeType: string; // 组织或项目级别字段PROJECT, ORGANIZATION)
refId: string; // 项目状态所关联的组织状态ID
scopeId: string;
pos: number; // 排序字段
statusDefinitions: string[]; // 设置初始状态
statusFlowTargets: string[]; // 可流转状态
[key: string]: any;
}
// 创建组织工作流状态
export interface OrdWorkStatus {
scopeId: string;
id: string;
name: string;
scene: SeneType;
remark: string;
allTransferTo: boolean; // 是否允许所有状态流转到该状态
}
// 状态列表
export type StateList = {
statusId: string;
definitionId: string;
};
// 设置工作流状态初始或结束
export interface SetStateType {
scopeId: string;
scene: string;
statusDefinitions: StateList[];
}
// 更新流转状态
export interface UpdateWorkFlowSetting {
scopeId: string;
scene: string;
statusFlows: { fromId: string; toId: string }[];
}

View File

@ -3,8 +3,12 @@ import { defineStore } from 'pinia';
import { FieldTypeFormRules } from '@/components/pure/ms-form-create/form-create';
import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types';
import { useI18n } from '@/hooks/useI18n';
import { FormCreateKeyEnum } from '@/enums/formCreateEnum';
const { t } = useI18n();
const useFormCreateStore = defineStore('form-create', {
persist: false,
state: (): {
@ -27,6 +31,7 @@ const useFormCreateStore = defineStore('form-create', {
const result = currentFormRule?.map((item: FormItem) => {
// 当前类型
let fieldType;
// 从总form类型里边配置参考form-create.ts里边配置
const currentTypeForm = Object.keys(FieldTypeFormRules).find(
(formItemType: any) => item.type?.toUpperCase() === formItemType
);
@ -42,14 +47,13 @@ const useFormCreateStore = defineStore('form-create', {
const ruleItem = {
type: fieldType, // 表单类型
field: item.name, // 字段
title: item.label, // label 表单标签
title: t(item.label), // label 表单标签
value: item.value || FieldTypeFormRules[currentTypeForm].value, // 目前的值
effect: {
required: item.required, // 是否必填
},
// 级联关联到某一个form上 可能存在多个级联
options: !item.optionMethod ? currentOptions : [],
// link: item.couplingConfig?.map((cascadeItem: any) => cascadeItem.cascade),
link: item.couplingConfig?.cascade,
rule: item.validate || [],
// 梳理表单所需要属性
@ -65,10 +69,10 @@ const useFormCreateStore = defineStore('form-create', {
'optionMethod': item.inputSearch && item.optionMethod ? item.optionMethod : '',
'inputSearch': item.inputSearch,
'allow-search': item.inputSearch,
'keyword': '',
'keyword': '', // SearchSelect组件变化值
'modelValue': item.value,
'options': currentOptions,
'formKey': key,
'options': currentOptions, // 当前已经存在的options
'formKey': key, // 对应pinia-form-create里边初始化的KEY
},
};
// 如果不存在关联name删除link关联属性

View File

@ -42,6 +42,8 @@
const { t } = useI18n();
const appStore = useAppStore();
const currentOrgId = computed(() => appStore.currentOrgId);
const emits = defineEmits<{
(e: 'update:visible', visible: boolean): void;
(e: 'success'): void;
@ -90,7 +92,7 @@
id,
name,
description,
organizationId: appStore.currentOrgId,
organizationId: currentOrgId.value,
};
};

View File

@ -64,6 +64,8 @@
const { t } = useI18n();
const appStore = useAppStore();
const currentProjectId = computed(() => appStore.currentProjectId);
const updateLoading = inject('reload', (flag: boolean) => {});
const projectDetail = ref<ProjectBasicInfoModel>();
@ -71,7 +73,7 @@
const getProjectDetail = async () => {
updateLoading(true);
try {
projectDetail.value = await getProjectInfo(appStore.currentProjectId);
projectDetail.value = await getProjectInfo(currentProjectId.value);
} catch (error) {
console.log(error);
} finally {

View File

@ -55,7 +55,7 @@
const { t } = useI18n();
const appStore = useAppStore();
const lastProjectId = appStore.currentProjectId;
const lastProjectId = computed(() => appStore.currentProjectId);
const props = defineProps<{
userGroupOptions: ProjectUserOption[];
@ -71,7 +71,7 @@
const initFormValue: AddProjectMember = {
roleIds: ['project_member'],
userIds: [],
projectId: lastProjectId as string,
projectId: lastProjectId.value,
};
const form = ref<AddProjectMember>({ ...initFormValue });
@ -108,7 +108,7 @@
const initProjectMemberOptions = async () => {
try {
if (lastProjectId) {
const result = await getProjectMemberOptions(lastProjectId);
const result = await getProjectMemberOptions(lastProjectId.value);
memberList.value = result;
}
} catch (error) {

View File

@ -124,7 +124,7 @@
const appStore = useAppStore();
const tableStore = useTableStore();
const lastProjectId = appStore.getCurrentProjectId;
const lastProjectId = computed(() => appStore.getCurrentProjectId);
const columns: MsTableColumn = [
{
@ -203,7 +203,7 @@
filter: {
roleIds: [],
},
projectId: lastProjectId as string,
projectId: lastProjectId.value,
keyword: '',
});
@ -239,7 +239,7 @@
onBeforeOk: async () => {
try {
const params: ActionProjectMember = {
projectId: lastProjectId,
projectId: lastProjectId.value,
userIds: selectData.value,
};
await batchRemoveMember(params);
@ -261,7 +261,7 @@
deleteLoading.value = true;
try {
if (lastProjectId && record.id) {
await removeProjectMember(lastProjectId, record.id);
await removeProjectMember(lastProjectId.value, record.id);
Message.success(t('project.member.deleteMemberSuccess'));
loadList();
resetSelector();
@ -319,7 +319,7 @@
//
const editProjectMember = async (record: ProjectMemberItem) => {
const params: ActionProjectMember = {
projectId: lastProjectId,
projectId: lastProjectId.value,
userId: record.id,
roleIds: record.selectUserList,
};
@ -355,9 +355,9 @@
const userGroupAll = ref<ProjectUserOption[]>([]);
onBeforeMount(async () => {
onMounted(async () => {
initData();
userGroupOptions.value = await getProjectUserGroup(lastProjectId as string);
userGroupOptions.value = await getProjectUserGroup(lastProjectId.value);
userGroupAll.value = [
{
id: '',

View File

@ -76,13 +76,13 @@
import { addOrUpdate } from '@/api/modules/setting/member';
import { useI18n } from '@/hooks/useI18n';
import { useUserStore } from '@/store';
import { useAppStore } from '@/store';
import type { LinkList, MemberItem } from '@/models/setting/member';
const { t } = useI18n();
const userStore = useUserStore();
const lastOrganizationId = userStore.$state?.lastOrganizationId as string;
const appStore = useAppStore();
const lastOrganizationId = computed(() => appStore.currentOrgId);
const props = defineProps<{
visible: boolean;
userGroupOptions: LinkList;
@ -105,7 +105,7 @@
}
const initFormValue: InitFromType = {
organizationId: userStore.$state?.lastOrganizationId,
organizationId: lastOrganizationId.value,
userRoleIds: ['org_member'],
memberIds: [],
projectIds: [],

View File

@ -131,16 +131,16 @@
getProjectList,
} from '@/api/modules/setting/member';
import { useI18n } from '@/hooks/useI18n';
import { useTableStore, useUserStore } from '@/store';
import { useAppStore, useTableStore } from '@/store';
import { characterLimit } from '@/utils';
import type { AddorUpdateMemberModel, BatchAddProjectModel, LinkList, MemberItem } from '@/models/setting/member';
import { TableKeyEnum } from '@/enums/tableEnum';
const tableStore = useTableStore();
const appStore = useAppStore();
const { t } = useI18n();
const userStore = useUserStore();
const lastOrganizationId = userStore.$state?.lastOrganizationId;
const lastOrganizationId = computed(() => appStore.currentOrgId);
const columns: MsTableColumn = [
{
@ -231,7 +231,7 @@
const selectedData = ref<string[] | undefined>([]);
const initData = async () => {
setLoadListParams({ keyword: keyword.value, organizationId: lastOrganizationId });
setLoadListParams({ keyword: keyword.value, organizationId: lastOrganizationId.value });
await loadList();
};
const searchHandler = () => {
@ -253,7 +253,7 @@
const deleteMember = async (record: MemberItem) => {
deleteLoading.value = true;
try {
if (lastOrganizationId) await deleteMemberReq(lastOrganizationId, record.id);
if (lastOrganizationId.value) await deleteMemberReq(lastOrganizationId.value, record.id);
Message.success(t('organization.member.deleteMemberSuccess'));
initData();
resetSelector();
@ -270,7 +270,7 @@
const batchModalRef = ref();
const getData = (callBack: any) => {
batchModalRef.value.getTreeList(callBack, lastOrganizationId);
batchModalRef.value.getTreeList(callBack, lastOrganizationId.value);
};
const showBatchModal = ref(false);
@ -292,7 +292,7 @@
const addProjectOrAddUserGroup = async (target: string[], type: string) => {
const currentType = batchList.find((item) => item.type === type);
const params: BatchAddProjectModel = {
organizationId: lastOrganizationId,
organizationId: lastOrganizationId.value,
memberIds: selectedData.value,
};
if (type === 'project') {
@ -317,7 +317,7 @@
const updateUserOrProject = async (record: MemberItem) => {
try {
const params = {
organizationId: lastOrganizationId,
organizationId: lastOrganizationId.value,
projectIds: [...record.selectProjectList],
userRoleIds: [...record.selectUserList],
memberId: record.id,
@ -371,8 +371,8 @@
const projectOptions = ref<LinkList>([]);
const getLinkList = async () => {
if (lastOrganizationId) {
userGroupOptions.value = await getGlobalUserGroup(lastOrganizationId);
projectOptions.value = await getProjectList(lastOrganizationId);
userGroupOptions.value = await getGlobalUserGroup(lastOrganizationId.value);
projectOptions.value = await getProjectList(lastOrganizationId.value);
}
};
onBeforeMount(() => {

View File

@ -45,15 +45,15 @@
import { addOrUpdate, configScript, postValidate } from '@/api/modules/setting/serviceIntegration';
import { useI18n } from '@/hooks/useI18n';
import useLoading from '@/hooks/useLoading';
import { useUserStore } from '@/store';
import { useAppStore } from '@/store';
import type { AddOrUpdateServiceModel, ServiceItem } from '@/models/setting/serviceIntegration';
import { FormRule } from '@form-create/arco-design';
const { t } = useI18n();
const userStore = useUserStore();
const lastOrganizationId = userStore.$state?.lastOrganizationId;
const appStore = useAppStore();
const lastOrganizationId = appStore.currentOrgId;
const emits = defineEmits<{
(event: 'update:visible', visible: boolean): void;

View File

@ -110,7 +110,7 @@
import { addOrUpdate, getServiceList, getValidate, resetService } from '@/api/modules/setting/serviceIntegration';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import { useUserStore } from '@/store';
import { useAppStore } from '@/store';
import { characterLimit } from '@/utils';
import type { ServiceItem, ServiceList } from '@/models/setting/serviceIntegration';
@ -120,8 +120,8 @@
const { t } = useI18n();
const { openModal } = useModal();
const userStore = useUserStore();
const lastOrganizationId = userStore.$state?.lastOrganizationId as string;
const appStore = useAppStore();
const lastOrganizationId = appStore.currentOrgId;
defineProps<{
collapseHeight: string;

View File

@ -137,6 +137,7 @@
const { t } = useI18n();
const route = useRoute();
const appStore = useAppStore();
const currentOrgId = computed(() => appStore.currentOrgId);
const sceneType = route.query.type;
const props = defineProps<{
visible: boolean;
@ -239,7 +240,7 @@
const formCopy = cloneDeep(fieldForm.value);
formCopy.scene = route.query.type;
formCopy.scopeId = appStore.currentOrgId;
formCopy.scopeId = currentOrgId.value;
//
if (selectFormat.value) {

View File

@ -89,7 +89,7 @@
const route = useRoute();
const { openModal } = useModal();
const currentOrd = appStore.currentOrgId;
const currentOrd = computed(() => appStore.currentOrgId);
const fieldColumns: MsTableColumn = [
{
@ -148,7 +148,7 @@
//
const searchFiled = async () => {
try {
totalData.value = await getFieldList({ organizationId: currentOrd, scene: route.query.type });
totalData.value = await getFieldList({ organizationId: currentOrd.value, scene: route.query.type });
const filterData = totalData.value.filter((item: AddOrUpdateField) => item.name.includes(keyword.value));
setProps({ data: filterData });
} catch (error) {
@ -160,9 +160,9 @@
//
const fetchData = async () => {
scene.value = route.query.type;
setLoadListParams({ organizationId: currentOrd, scene });
setLoadListParams({ organizationId: currentOrd.value, scene });
await loadList();
totalData.value = await getFieldList({ organizationId: currentOrd, scene: route.query.type });
totalData.value = await getFieldList({ organizationId: currentOrd.value, scene: route.query.type });
};
const isDisabled = computed(() => {
@ -178,11 +178,9 @@
const isEnableOperation = () => {
if (isEnable.value) {
const noOperationColumn = fieldColumns.slice(0, -1);
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING, noOperationColumn, 'drawer');
tableRef.value.initColumn();
tableRef.value.initColumn(noOperationColumn);
} else {
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING, fieldColumns, 'drawer');
tableRef.value.initColumn();
tableRef.value.initColumn(fieldColumns);
}
};
@ -199,16 +197,16 @@
openModal({
type: 'error',
title: t('system.orgTemplate.deleteTitle', { name: characterLimit(record.name) }),
content: t('system.userGroup.beforeDeleteUserGroup'),
okText: t('system.userGroup.confirmDelete'),
cancelText: t('system.userGroup.cancel'),
content: t('system.orgTemplate.deleteFiledContent'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
onBeforeOk: async () => {
try {
if (record.id) await deleteOrdField(record.id);
Message.success(t('system.user.deleteUserSuccess'));
Message.success(t('system.orgTemplate.deleteSuccess'));
fetchData();
} catch (error) {
console.log(error);

View File

@ -93,6 +93,7 @@
const route = useRoute();
const router = useRouter();
const appStore = useAppStore();
const currentOrgId = computed(() => appStore.currentOrgId);
// useLeaveUnSaveTip();
const title = ref('');
@ -102,7 +103,7 @@
id: '',
name: '',
remark: '',
scopeId: appStore.currentOrgId,
scopeId: currentOrgId.value,
enableThirdPart: false,
};
@ -114,7 +115,7 @@
const formRef = ref<FormInstance>();
const totalTemplateField = ref<DefinedFieldItem[]>([]);
const isEdit = computed(() => !!route.query.id);
const currentOrd = appStore.currentOrgId;
const currentOrd = currentOrgId.value;
const isEditField = ref<boolean>(false);
//
@ -240,7 +241,7 @@
remark,
enableThirdPart,
customFields: result as CustomField[],
scopeId: appStore.currentOrgId,
scopeId: currentOrgId.value,
scene: route.query.type,
};
}

View File

@ -74,7 +74,7 @@
const { openModal } = useModal();
const keyword = ref('');
const currentOrd = appStore.currentOrgId;
const currentOrd = computed(() => appStore.currentOrgId);
const fieldColumns: MsTableColumn = [
{
@ -125,7 +125,7 @@
//
const searchFiled = async () => {
try {
totalList.value = await getOrganizeTemplateList({ organizationId: currentOrd, scene });
totalList.value = await getOrganizeTemplateList({ organizationId: currentOrd.value, scene });
const filterData = totalList.value.filter((item: OrdTemplateManagement) => item.name.includes(keyword.value));
setProps({ data: filterData });
} catch (error) {
@ -172,7 +172,7 @@
};
const fetchData = async () => {
setLoadListParams({ organizationId: currentOrd, scene: route.query.type });
setLoadListParams({ organizationId: currentOrd.value, scene: route.query.type });
await loadList();
};
@ -231,11 +231,9 @@
function updateColumns() {
if (isEnable) {
const result = fieldColumns.slice(0, fieldColumns.length - 1);
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT, result, 'drawer');
tableRef.value.initColumn();
tableRef.value.initColumn(result);
} else {
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT, fieldColumns, 'drawer');
tableRef.value.initColumn();
tableRef.value.initColumn(fieldColumns);
}
}

View File

@ -84,7 +84,7 @@
const emit = defineEmits(['update:select-data', 'update']);
const columns = ref<MsTableColumn>([
const columns: MsTableColumn = [
{
title: 'system.orgTemplate.name',
slotName: 'name',
@ -126,7 +126,7 @@
showInTable: true,
showDrag: false,
},
]);
];
function getApiColumns() {
return {
@ -139,7 +139,9 @@
};
}
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, columns.value, 'drawer');
const tableRef = ref();
tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, columns, 'drawer');
const { propsRes, propsEvent, setProps } = useTable(undefined, {
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD,
scroll: { x: '1800px' },
@ -234,19 +236,16 @@
totalData.value = val;
}
);
const tableRef = ref();
// API
watch(
() => props.enableThirdPart,
() => {
if (props.enableThirdPart) {
const result = [...columns.value.slice(0, 1), getApiColumns(), ...columns.value.slice(1)];
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, result, 'drawer');
tableRef.value.initColumn();
(val) => {
if (val) {
const result = [...columns.slice(0, 1), getApiColumns(), ...columns.slice(1)];
tableRef.value.initColumn(result);
} else {
tableStore.setColumns(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, columns.value, 'drawer');
tableRef.value.initColumn();
tableRef.value.initColumn(columns);
}
}
);

View File

@ -103,4 +103,31 @@ export default {
'system.orgTemplate.apiInputPlaceholder': 'Please enter a third-party API',
'system.orgTemplate.apiFieldId': 'API field',
'system.orgTemplate.copyTemplate': 'Copy Template',
'system.orgTemplate.workFlowTip':
'Change the properties or workflow configuration of the event will take effect immediately on the related project. Exercise caution when performing this operation',
'system.orgTemplate.workFlowToolTip':
'List the status of the defect, and "click +" in the column to add the flow status ',
'system.orgTemplate.workFlowToolTipHover':
'hover can replace the initial state, and the operation column can select the end state',
'system.orgTemplate.addWorkFlowStatus': 'Add State',
'system.orgTemplate.StateName': 'State name',
'system.orgTemplate.stateNameDescription':
'Please enter the status name, in order to display complete, try to be less than 8 characters',
'system.orgTemplate.stateNameNotNull': 'The status name cannot be empty',
'system.orgTemplate.stateColor': 'Color state',
'system.orgTemplate.addSuccessState': 'Add successfully',
'system.orgTemplate.setInitState': 'Set initial',
'system.orgTemplate.deleteStateTitle': 'Are you sure about the delete {name} state?',
'system.orgTemplate.deleteStateContent':
'After delete, will be effective in the project and delete irrevocable, please careful operation.',
'system.orgTemplate.deleteFiledContent':
'After deleting fields will be removed from the field list, please careful operation.',
'system.orgTemplate.deleteSuccess': 'Delete Successfully',
'system.orgTemplate.setInitStateSuccess': 'Set the initial state successfully',
'system.orgTemplate.setEndStateSuccess': 'Setting the end status succeeded',
'system.orgTemplate.noAllowDeleteInitState': 'The initial status cannot be deleted',
'system.orgTemplate.deleteStateStepTitle': 'Are you sure about the delete {name} step?',
'system.orgTemplate.deleteStateStepContent':
'After delete, will be effective in the project and delete irrevocable, please careful operation.',
'system.orgTemplate.stateDetail': '{name} State detail',
};

View File

@ -105,4 +105,25 @@ export default {
'system.orgTemplate.apiInputPlaceholder': '请输入第三方 API',
'system.orgTemplate.apiFieldId': 'API 字段',
'system.orgTemplate.copyTemplate': '复制模板',
'system.orgTemplate.workFlowTip': '更改事项的属性或工作流配置,会在相关项目立即生效,请谨慎操作',
'system.orgTemplate.workFlowToolTip': '列为缺陷所在状态,在列内“点击+”,可添加流转状态',
'system.orgTemplate.workFlowToolTipHover': 'hover 可更换初始状态,操作列可选择结束状态',
'system.orgTemplate.addWorkFlowStatus': '添加状态',
'system.orgTemplate.updateWorkFlowStatus': '更新状态',
'system.orgTemplate.stateName': '状态名称',
'system.orgTemplate.stateNameDescription': '请输入状态名称为了展示完全尽量在8个字符以内',
'system.orgTemplate.stateNameNotNull': '状态名称不能为空',
'system.orgTemplate.stateColor': '颜色状态',
'system.orgTemplate.addSuccessState': '添加成功',
'system.orgTemplate.setInitState': '设为初始态',
'system.orgTemplate.deleteStateTitle': '确定删除 {name} 状态吗?',
'system.orgTemplate.deleteStateContent': '删除后,会在项目中立即生效且删除不可撤回,请谨慎操作!',
'system.orgTemplate.deleteFiledContent': '删除后,字段将从字段列表移除,请谨慎操作!',
'system.orgTemplate.deleteSuccess': '删除成功',
'system.orgTemplate.setInitStateSuccess': '设置初始态成功',
'system.orgTemplate.setEndStateSuccess': '设置结束状态成功',
'system.orgTemplate.noAllowDeleteInitState': '初始状态不可删除',
'system.orgTemplate.deleteStateStepTitle': '确定删除 {name} 步骤吗?',
'system.orgTemplate.deleteStateStepContent': '删除后,会在项目中立即生效且删除不可撤回,请谨慎操作!',
'system.orgTemplate.stateDetail': '{name} 状态',
};