diff --git a/lib/client/src/views/system/operation/stats/func/dim-func.vue b/lib/client/src/views/system/operation/stats/func/dim-func.vue
index 5fb44b360..9b669984d 100644
--- a/lib/client/src/views/system/operation/stats/func/dim-func.vue
+++ b/lib/client/src/views/system/operation/stats/func/dim-func.vue
@@ -36,7 +36,8 @@
:label="column.name"
:prop="column.id"
:width="column.width"
- :sortable="column.sortable">
+ :sortable="column.sortable"
+ :show-overflow-tooltip="column.tooltip">
{{row[column.id] | formatCount}}
@@ -72,8 +73,8 @@
limit: 10
},
columns: [
- { id: 'funcName', name: '函数名', width: '360' },
- { id: 'projectName', name: '所属应用', width: '360' },
+ { id: 'funcName', name: '函数名', width: '360', tooltip: true },
+ { id: 'projectName', name: '所属应用', width: '360', tooltip: true },
{ id: 'pageUsedCount', name: '使用页面数', dynamic: true, type: 'number' }
],
filters: {
diff --git a/lib/client/src/views/system/operation/stats/user/dim-user.vue b/lib/client/src/views/system/operation/stats/user/dim-user.vue
index 8bf9c1a5d..fd241d8e8 100644
--- a/lib/client/src/views/system/operation/stats/user/dim-user.vue
+++ b/lib/client/src/views/system/operation/stats/user/dim-user.vue
@@ -37,7 +37,8 @@
:label="column.name"
:prop="column.id"
:width="column.width"
- :sortable="column.sortable">
+ :sortable="column.sortable"
+ :show-overflow-tooltip="column.tooltip">
{{row[column.id] | formatCount}}
@@ -77,8 +78,8 @@
},
orderBy: undefined,
columns: [
- { id: 'username', name: '用户名', width: '360' },
- { id: 'createTime', name: '创建时间', width: '320', sortable: 'custom', type: 'datetime' },
+ { id: 'username', name: '用户名', width: '360', tooltip: true },
+ { id: 'createTime', name: '创建时间', width: '320', sortable: 'custom', type: 'datetime', tooltip: true },
{ id: 'projectCount', name: '应用数', sortable: 'custom', dynamic: true, type: 'number' },
{ id: 'pageCount', name: '页面数', sortable: 'custom', dynamic: true, type: 'number' }
],
diff --git a/lib/client/src/views/system/project-manage/children/list-card.vue b/lib/client/src/views/system/project-manage/children/list-card.vue
index b7a360140..77ed8fa6d 100644
--- a/lib/client/src/views/system/project-manage/children/list-card.vue
+++ b/lib/client/src/views/system/project-manage/children/list-card.vue
@@ -54,7 +54,10 @@
-
{{project.projectName}}
+
{{project.projectName}}
{{getUpdateInfoMessage(project)}}
diff --git a/package.json b/package.json
index 371db187a..2ca2e7f64 100644
--- a/package.json
+++ b/package.json
@@ -94,7 +94,7 @@
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-parameter-decorator": "^1.0.16",
"better-npm-run": "~0.1.1",
- "bk-magic-vue": "2.4.15-beta.15",
+ "bk-magic-vue": "^2.5.3",
"buffer": "^6.0.3",
"caniuse-lite": "~1.0.30000974",
"chalk": "~2.4.2",
From 08b3df2ff32338de7f2466313ef73ef7c7c6cea7 Mon Sep 17 00:00:00 2001
From: terlinhe
Date: Fri, 24 Feb 2023 16:27:56 +0800
Subject: [PATCH 62/80] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9service?=
=?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=B8=8Bid=E4=B8=BAundefined=E7=9A=84?=
=?UTF-8?q?=E6=83=85=E5=86=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/server/model/project.js | 42 +++++++++++-----------
lib/server/service/business/api.js | 4 +--
lib/server/service/business/data-table.js | 4 +--
lib/server/service/business/function.js | 10 +++---
lib/server/service/business/layout.js | 4 +--
lib/server/service/business/nocode-form.js | 4 +--
lib/server/service/business/page.js | 22 ++++++------
lib/server/service/business/route.js | 8 ++---
lib/server/service/business/template.js | 4 +--
lib/server/service/business/variable.js | 8 ++---
10 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/lib/server/model/project.js b/lib/server/model/project.js
index bce5236dd..c6fc2dfcc 100644
--- a/lib/server/model/project.js
+++ b/lib/server/model/project.js
@@ -222,7 +222,7 @@ export default {
}))
const newTemplateCategory = await transactionalEntityManager.save(saveTemplateCategory)
categoryIdList.forEach((id, index) => {
- categoryIdMap[id] = newTemplateCategory[index].id
+ categoryIdMap[id] = newTemplateCategory[index]?.id || 0
})
const copyTemplates = await getRepository(PageTemplate)
@@ -233,7 +233,7 @@ export default {
const saveCopyTemplates = getRepository(PageTemplate).create(copyTemplates.map(item => {
const { id, createTime, updateTime, createUser, ...others } = item
- others.categoryId = categoryIdMap[others.categoryId]
+ others.categoryId = categoryIdMap[others.categoryId] || 0
others.belongProjectId = projectId
return others
}))
@@ -260,19 +260,19 @@ export default {
// 复制出的新函数中的分组id需要与新添加的函数组id对应
const funcGroupIdMap = {}
funcGroupIdList.forEach((id, index) => {
- funcGroupIdMap[id] = newFuncGroupList[index].id
+ funcGroupIdMap[id] = newFuncGroupList[index]?.id || 0
})
// 新建函数主体数据
const saveCopyFuncs = getRepository(Func).create(copyFuncs.map(item => {
const { id, createTime, updateTime, ...others } = item
- others.funcGroupId = funcGroupIdMap[others.funcGroupId]
+ others.funcGroupId = funcGroupIdMap[others.funcGroupId] || 0
others.projectId = projectId
return others
}))
const newFuncList = await transactionalEntityManager.save(saveCopyFuncs)
copyFuncs.forEach((item, index) => {
- funcIdMap[item.id] = newFuncList[index].id
+ funcIdMap[item.id] = newFuncList[index]?.id || 0
})
// 新建函数和函数关联关系
@@ -298,7 +298,7 @@ export default {
}))
const newLayoutList = await transactionalEntityManager.save(saveCopyLayouts)
projectLayoutValues.forEach((item, index) => {
- layoutIdMap[item.id] = newLayoutList[index].id
+ layoutIdMap[item.id] = newLayoutList[index]?.id || 0
})
}
@@ -318,7 +318,7 @@ export default {
const newDataTables = await transactionalEntityManager.save(copyDataTables)
const dataTableIdMap = {}
newDataTables.forEach((newDataTable, index) => {
- dataTableIdMap[projectDataTables[index].id] = newDataTable.id
+ dataTableIdMap[projectDataTables[index]?.id] = newDataTable.id
})
// 新建数据源表变更记录
@@ -360,7 +360,7 @@ export default {
}))
const newForm = await transactionalEntityManager.save(saveForm)
formIdList.forEach((id, index) => {
- formIdMap[id] = newForm[index].id
+ formIdMap[id] = newForm[index]?.id || 0
})
}
}
@@ -403,21 +403,21 @@ export default {
const projectPageValues = getRepository(ProjectPage).create(projectPageCopyValues.map((item, index) => {
const { id, createTime, updateTime, ...others } = item
others.projectId = projectId
- others.pageId = newPageList[index].id
+ others.pageId = newPageList[index]?.id || 0
return others
}))
await transactionalEntityManager.save(projectPageValues)
// 建立新老页面id的映射
pageIdList.forEach((id, index) => {
- pageIdMap[id] = newPageList[index].id
+ pageIdMap[id] = newPageList[index]?.id || 0
})
// 新建页面函数关联记录
if (Object.keys(funcIdMap).length) {
const saveCopyPageFuncs = getRepository(PageFunc).create(copyPageFuncs.map(item => {
const { id, createTime, updateTime, ...others } = item
- others.pageId = pageIdMap[others.pageId]
- others.funcId = funcIdMap[others.funcId]
+ others.pageId = pageIdMap[others.pageId] || 0
+ others.funcId = funcIdMap[others.funcId] || 0
others.projectId = projectId
return others
}))
@@ -431,7 +431,7 @@ export default {
.getMany()
const saveCopyPageComps = getRepository(PageComp).create(copyPageComps.map((item, index) => {
const { id, createTime, updateTime, ...others } = item
- others.pageId = pageIdMap[others.pageId]
+ others.pageId = pageIdMap[others.pageId] || 0
others.projectId = projectId
return others
}))
@@ -453,7 +453,7 @@ export default {
const newRouteList = await transactionalEntityManager.save(saveCopyRoutes)
const routeIdMap = {}
routeIdList.forEach((id, index) => {
- routeIdMap[id] = newRouteList[index].id
+ routeIdMap[id] = newRouteList[index]?.id || 0
})
const saveCopyProjectRoutes = getRepository(PageRoute).create(projectRouteCopyValues.map((item, index) => {
@@ -484,7 +484,7 @@ export default {
const apiCategoryIdList = apiCategoryList.map(category => category.id)
const apiCategoryIdMap = {}
apiCategoryIdList.forEach((id, index) => {
- apiCategoryIdMap[id] = newApiCategoryList[index].id
+ apiCategoryIdMap[id] = newApiCategoryList[index]?.id || 0
})
// 复制 api
@@ -523,7 +523,7 @@ export default {
// 建立新老变量id的映射
const variableIdMap = {}
variableList.forEach(({ id }, index) => {
- variableIdMap[id] = newVariableList[index].id
+ variableIdMap[id] = newVariableList[index]?.id || 0
})
const where = whereWithDefaultVersion
const [pageVariableList, funcVariableList, variableFuncList, variableVariableList] = await Promise.all([
@@ -535,29 +535,29 @@ export default {
const savePageVariableList = getRepository(PageVariable).create(pageVariableList.map(item => {
const { id, createTime, updateTime, variableId, ...others } = item
others.projectId = projectId
- others.variableId = variableIdMap[variableId]
+ others.variableId = variableIdMap[variableId] || 0
return others
}))
await transactionalEntityManager.save(savePageVariableList)
const saveFuncVariableList = getRepository(FuncVariable).create(funcVariableList.map(item => {
const { id, createTime, updateTime, variableId, ...others } = item
others.projectId = projectId
- others.variableId = variableIdMap[variableId]
+ others.variableId = variableIdMap[variableId] || 0
return others
}))
await transactionalEntityManager.save(saveFuncVariableList)
const saveVariableFuncList = getRepository(VariableFunc).create(variableFuncList.map(item => {
const { id, createTime, updateTime, variableId, ...others } = item
others.projectId = projectId
- others.variableId = variableIdMap[variableId]
+ others.variableId = variableIdMap[variableId] || 0
return others
}))
await transactionalEntityManager.save(saveVariableFuncList)
const saveVariableVariableList = getRepository(VariableVariable).create(variableVariableList.map(item => {
const { id, createTime, updateTime, variableId, parentVariableId, ...others } = item
others.projectId = projectId
- others.variableId = variableIdMap[variableId]
- others.parentVariableId = variableIdMap[parentVariableId]
+ others.variableId = variableIdMap[variableId] || 0
+ others.parentVariableId = variableIdMap[parentVariableId] || 0
return others
}))
await transactionalEntityManager.save(saveVariableVariableList)
diff --git a/lib/server/service/business/api.js b/lib/server/service/business/api.js
index 4471c1588..985991776 100644
--- a/lib/server/service/business/api.js
+++ b/lib/server/service/business/api.js
@@ -16,7 +16,7 @@ export const importTask = async (ctx, next) => {
// 新旧分组的id map
const categoryIdMap = {}
apiCategory.forEach((category, index) => {
- categoryIdMap[category.id] = newApiCategoryList[index].id
+ categoryIdMap[category.id] = newApiCategoryList[index]?.id || 0
})
// 新增template
await transactionalEntityHelper.add(
@@ -26,7 +26,7 @@ export const importTask = async (ctx, next) => {
return {
...others,
projectId,
- categoryId: categoryIdMap[id]
+ categoryId: categoryIdMap[id] || 0
}
})
)
diff --git a/lib/server/service/business/data-table.js b/lib/server/service/business/data-table.js
index 33eb9c67d..a989e9483 100644
--- a/lib/server/service/business/data-table.js
+++ b/lib/server/service/business/data-table.js
@@ -25,7 +25,7 @@ export const importTask = async (ctx, next) => {
})
)
dataTable.forEach((table, index) => {
- dataTableIdMap[table.id] = newDataTable[index].id
+ dataTableIdMap[table.id] = newDataTable[index]?.id || 0
})
// modifyRecord记录
const currentTime = +new Date()
@@ -36,7 +36,7 @@ export const importTask = async (ctx, next) => {
others.createTime = tableRecordTime
others.updateTime = tableRecordTime
others.projectId = projectId
- others.tableId = dataTableIdMap[others.tableId]
+ others.tableId = dataTableIdMap[others.tableId] || 0
return others
})
// 执行表变更sql
diff --git a/lib/server/service/business/function.js b/lib/server/service/business/function.js
index a8e828dfb..2cd5cf93e 100644
--- a/lib/server/service/business/function.js
+++ b/lib/server/service/business/function.js
@@ -38,7 +38,7 @@ const commonTask = async ({ projectId, newVersionId }, funcGroupList, funcList,
// 新旧分组的id map
const funcGroupIdMap = {}
funcGroupList.forEach((funcGroup, index) => {
- funcGroupIdMap[funcGroup.id] = newFuncGroupList[index].id
+ funcGroupIdMap[funcGroup.id] = newFuncGroupList[index]?.id || 0
})
// 新增函数
const newFuncList = await transactionalEntityHelper.add(
@@ -48,7 +48,7 @@ const commonTask = async ({ projectId, newVersionId }, funcGroupList, funcList,
...others,
projectId,
versionId: newVersionId,
- funcGroupId: funcGroupIdMap[funcGroupId]
+ funcGroupId: funcGroupIdMap[funcGroupId] || 0
}
})
)
@@ -64,7 +64,7 @@ const commonTask = async ({ projectId, newVersionId }, funcGroupList, funcList,
})
)
funcList.forEach((item, index) => {
- funcIdMap[item.id] = newFuncList[index].id
+ funcIdMap[item.id] = newFuncList[index]?.id || 0
})
})
return funcIdMap
@@ -243,8 +243,8 @@ export const doubleCheckFunction = async (functionData, projectId, versionId) =>
const nameMap = {}
const variableMap = {}
functionList.forEach((functionItem) => {
- codeMap[functionItem.funcCode] = functionItem.id
- nameMap[functionItem.funcName] = functionItem.id
+ codeMap[functionItem.funcCode] = functionItem.id || 0
+ nameMap[functionItem.funcName] = functionItem.id || 0
})
variableList.forEach((variableItem) => {
variableMap[variableItem.variableCode] = true
diff --git a/lib/server/service/business/layout.js b/lib/server/service/business/layout.js
index 80ab0e579..fcc5db352 100644
--- a/lib/server/service/business/layout.js
+++ b/lib/server/service/business/layout.js
@@ -29,7 +29,7 @@ export const versionTask = async (ctx, next) => {
ctx.layoutIdMap = {}
layoutInstList.forEach((item, index) => {
- ctx.layoutIdMap[item.id] = newLayoutInstList[index].id
+ ctx.layoutIdMap[item.id] = newLayoutInstList[index]?.id || 0
})
await next()
}
@@ -60,7 +60,7 @@ export const importTask = async (ctx, next) => {
// layoutId放到ctx中
const layoutIdMap = {}
layoutInst.forEach((item, index) => {
- layoutIdMap[item.id] = newLayoutInst[index].id
+ layoutIdMap[item.id] = newLayoutInst[index]?.id || 0
})
ctx.idMap.layoutIdMap = layoutIdMap
diff --git a/lib/server/service/business/nocode-form.js b/lib/server/service/business/nocode-form.js
index ef387b310..e0f52fafd 100644
--- a/lib/server/service/business/nocode-form.js
+++ b/lib/server/service/business/nocode-form.js
@@ -104,7 +104,7 @@ export const versionTask = async (ctx, next) => {
ctx.formIdMap = {}
formList.forEach((item, index) => {
- ctx.formIdMap[item.id] = newFormList[index].id
+ ctx.formIdMap[item.id] = newFormList[index]?.id || 0
})
await next()
@@ -120,7 +120,7 @@ export const importTask = async (ctx, next) => {
const formIdMap = {}
form.forEach((item, index) => {
- formIdMap[item.id] = newFormList[index].id
+ formIdMap[item.id] = newFormList[index]?.id || 0
})
ctx.idMap.formIdMap = formIdMap
await next()
diff --git a/lib/server/service/business/page.js b/lib/server/service/business/page.js
index 873d190e8..9ad19d08c 100644
--- a/lib/server/service/business/page.js
+++ b/lib/server/service/business/page.js
@@ -20,7 +20,7 @@ const getPageListByIds = async ids => getRepository(Page).find({ where: { id: In
const getNewPageEntities = (list, formIdMap) => getRepository(Page).create(list.map(item => {
const { id, createTime, updateTime, ...others } = item
if (['FORM', 'FORM_MANAGE'].includes(item.nocodeType) && item.formId) {
- others.formId = formIdMap[item.formId]
+ others.formId = formIdMap[item.formId] || 0
}
return others
}))
@@ -28,15 +28,15 @@ const getNewProjectPageEntities = (list, { projectId, newVersionId, pageIdMap })
const { id, createTime, updateTime, ...others } = item
others.projectId = projectId
others.versionId = newVersionId
- others.pageId = pageIdMap[others.pageId]
+ others.pageId = pageIdMap[others.pageId] || 0
return others
}))
const getPageFuncListByIds = async ids => getRepository(PageFunc).find({ where: { pageId: In(ids) } })
const getNewPageFuncEntities = (list, { projectId, newVersionId, pageIdMap, funcIdMap }) => getRepository(PageFunc).create(list.map(item => {
const { id, createTime, updateTime, ...others } = item
- others.pageId = pageIdMap[others.pageId]
- others.funcId = funcIdMap[others.funcId]
+ others.pageId = pageIdMap[others.pageId] || 0
+ others.funcId = funcIdMap[others.funcId] || 0
others.projectId = projectId
others.versionId = newVersionId
return others
@@ -45,7 +45,7 @@ const getNewPageFuncEntities = (list, { projectId, newVersionId, pageIdMap, func
const getPageCompListByIds = async ids => getRepository(PageComp).find({ where: { pageId: In(ids) } })
const getNewPageCompEntities = (list, { projectId, newVersionId, pageIdMap }) => getRepository(PageComp).create(list.map(item => {
const { id, createTime, updateTime, ...others } = item
- others.pageId = pageIdMap[others.pageId]
+ others.pageId = pageIdMap[others.pageId] || 0
others.projectId = projectId
others.projectVersionId = newVersionId
return others
@@ -71,7 +71,7 @@ export const versionTask = async (ctx, next) => {
// 建立新老页面id的映射,在布局与路由等页面关联中使用
const pageIdMap = {}
pageIdList.forEach((id, index) => {
- pageIdMap[id] = newPageList[index].id
+ pageIdMap[id] = newPageList[index]?.id || 0
})
const newProjectPageEntities = getNewProjectPageEntities(projectPageList, { projectId, newVersionId, pageIdMap })
@@ -125,7 +125,7 @@ export const importTask = async (ctx, next) => {
)
page.forEach((item, index) => {
- pageIdMap[item.id] = newPageList[index].id
+ pageIdMap[item.id] = newPageList[index]?.id || 0
})
// 新增projectPage
await transactionalEntityHelper.add(
@@ -135,7 +135,7 @@ export const importTask = async (ctx, next) => {
return {
...others,
projectId,
- pageId: pageIdMap[others.pageId]
+ pageId: pageIdMap[others.pageId] || 0
}
})
)
@@ -149,8 +149,8 @@ export const importTask = async (ctx, next) => {
return {
...others,
projectId,
- pageId: pageIdMap[others.pageId],
- funcId: funcIdMap[others.funcId]
+ pageId: pageIdMap[others.pageId] || 0,
+ funcId: funcIdMap[others.funcId] || 0
}
})
)
@@ -165,7 +165,7 @@ export const importTask = async (ctx, next) => {
return {
...others,
projectId,
- pageId: pageIdMap[others.pageId]
+ pageId: pageIdMap[others.pageId] || 0
}
})
)
diff --git a/lib/server/service/business/route.js b/lib/server/service/business/route.js
index 0d08d0ef6..5a9576b60 100644
--- a/lib/server/service/business/route.js
+++ b/lib/server/service/business/route.js
@@ -25,7 +25,7 @@ const getNewPageRouteEntities = (list, { projectId, newVersionId, routeIdMap, pa
others.routeId = others.routeId !== -1 ? routeIdMap[others.routeId] : -1
others.pageId = others.pageId !== -1 ? pageIdMap[others.pageId] : -1
others.redirect = others.redirect ? routeIdMap[others.redirect] : null
- others.layoutId = layoutIdMap[others.layoutId]
+ others.layoutId = layoutIdMap[others.layoutId] || 0
others.projectId = projectId
others.versionId = newVersionId
return others
@@ -45,7 +45,7 @@ export const versionTask = async (ctx, next) => {
const newRouteList = await ctx.queryRunner.manager.save(getNewRouteEntities(routeList))
const routeIdMap = {}
- routeIdList.forEach((id, index) => (routeIdMap[id] = newRouteList[index].id))
+ routeIdList.forEach((id, index) => (routeIdMap[id] = newRouteList[index]?.id || 0))
await next()
@@ -74,7 +74,7 @@ export const importTask = async (ctx, next) => {
const routeIdMap = {}
route.forEach((item, index) => {
- routeIdMap[item.id] = newRouteList[index].id
+ routeIdMap[item.id] = newRouteList[index]?.id || 0
})
// 新增pageRoute
await transactionalEntityHelper.add(
@@ -87,7 +87,7 @@ export const importTask = async (ctx, next) => {
others.routeId = others.routeId !== -1 ? routeIdMap[others.routeId] : -1
others.pageId = others.pageId !== -1 ? pageIdMap[others.pageId] : -1
others.redirect = others.redirect ? routeIdMap[others.redirect] : null
- others.layoutId = layoutIdMap[others.layoutId]
+ others.layoutId = layoutIdMap[others.layoutId] || 0
others.projectId = projectId
return others
})
diff --git a/lib/server/service/business/template.js b/lib/server/service/business/template.js
index 109cfb30e..2a9e0cea5 100644
--- a/lib/server/service/business/template.js
+++ b/lib/server/service/business/template.js
@@ -16,7 +16,7 @@ export const importTask = async (ctx, next) => {
// 新旧分组的id map
const categoryIdMap = {}
pageTemplateCategory.forEach((category, index) => {
- categoryIdMap[category.id] = newCategoryList[index].id
+ categoryIdMap[category.id] = newCategoryList[index]?.id || 0
})
// 新增template
await transactionalEntityHelper.add(
@@ -28,7 +28,7 @@ export const importTask = async (ctx, next) => {
isOffcial: 0,
parentId: 0,
belongProjectId: projectId,
- categoryId: categoryIdMap[others.categoryId]
+ categoryId: categoryIdMap[others.categoryId] || 0
}
})
)
diff --git a/lib/server/service/business/variable.js b/lib/server/service/business/variable.js
index f45ab6c89..ae3e765ad 100644
--- a/lib/server/service/business/variable.js
+++ b/lib/server/service/business/variable.js
@@ -38,11 +38,11 @@ const buildRelationEntities = ({ projectId, newVersionId, variableIdMap }) => it
const { id, createTime, updateTime, variableId, parentVariableId, ...others } = item
others.projectId = projectId
others.versionId = newVersionId
- others.variableId = variableIdMap[variableId]
+ others.variableId = variableIdMap[variableId] || 0
// 变量引用变更时存在
if (parentVariableId) {
- others.parentVariableId = variableIdMap[parentVariableId]
+ others.parentVariableId = variableIdMap[parentVariableId] || 0
}
return others
@@ -71,7 +71,7 @@ export const versionTask = async (ctx, next) => {
// 建立新老变量id的映射
const variableIdMap = {}
projectVariableList.forEach(({ id }, index) => {
- variableIdMap[id] = newVariableList[index].id
+ variableIdMap[id] = newVariableList[index]?.id || 0
})
const [pageVariableList, funcVariableList, variableFuncList, variableVariableList] = await Promise.all([
@@ -105,7 +105,7 @@ export const importTask = async (ctx, next) => {
// 建立新老变量id的映射
const variableIdMap = {}
variable.forEach((item, index) => {
- variableIdMap[item.id] = newVariableList[index].id
+ variableIdMap[item.id] = newVariableList[index]?.id || 0
})
// 导入更新变量相关的关联表
const extraData = { projectId, newVersionId: null, variableIdMap }
From b5c4ccf6108c57a96c34fc75d79742b9a2f6e76c Mon Sep 17 00:00:00 2001
From: hmohuang <13407923955@163.com>
Date: Mon, 27 Feb 2023 11:45:48 +0800
Subject: [PATCH 63/80] =?UTF-8?q?perf:=E5=8C=85=E7=89=88=E6=9C=AC=E9=80=80?=
=?UTF-8?q?=E5=9B=9E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 2ca2e7f64..371db187a 100644
--- a/package.json
+++ b/package.json
@@ -94,7 +94,7 @@
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-parameter-decorator": "^1.0.16",
"better-npm-run": "~0.1.1",
- "bk-magic-vue": "^2.5.3",
+ "bk-magic-vue": "2.4.15-beta.15",
"buffer": "^6.0.3",
"caniuse-lite": "~1.0.30000974",
"chalk": "~2.4.2",
From b969c47a31ccc4291c1b0f031859684aa220b9f8 Mon Sep 17 00:00:00 2001
From: panyuji
Date: Fri, 24 Feb 2023 16:14:45 +0800
Subject: [PATCH 64/80] =?UTF-8?q?[=E5=B0=86=E6=96=B0=E5=A2=9E=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E7=BB=84=E4=BB=B6=E7=9A=84=E7=9B=B8=E5=85=B3=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E5=90=8C=E6=AD=A5=E5=88=B0=E9=A1=B9=E7=9B=AE=E6=A8=A1?=
=?UTF-8?q?=E6=9D=BF=E4=B8=AD]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../flow-form-comp/form/constants/forms.js | 9 ++-
.../flow-form-comp/form/fieldItem.vue | 2 +
.../flow-form-comp/form/fields/rate.vue | 49 ++++++++++++++++
.../components/flow-form-comp/form/index.vue | 56 +++++++++++++++----
4 files changed, 105 insertions(+), 11 deletions(-)
create mode 100644 lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fields/rate.vue
diff --git a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/constants/forms.js b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/constants/forms.js
index 83c09b19a..e66df2e8d 100644
--- a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/constants/forms.js
+++ b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/constants/forms.js
@@ -130,6 +130,13 @@ export const FIELDS_TYPES = [
name: '分割线',
comp: 'Divider',
icon: 'icon bk-drag-icon bk-drag-fengexian'
+ },
+ {
+ type: 'RATE',
+ name: '评分组件',
+ default: '',
+ comp: 'Rate',
+ icon: 'icon bk-drag-icon bk-drag-rate'
}
]
@@ -167,7 +174,7 @@ export const DATA_SOURCE_FIELD = ['SELECT', 'INPUTSELECT', 'MULTISELECT', 'CHECK
export const NO_VIEWED_FIELD = ['DESC', 'DIVIDER']
// 需要展示默认值的字段类型
-export const FIELDS_SHOW_DEFAULT_VALUE = ['STRING', 'TEXT', 'INT', 'DATE', 'DATETIME', 'SELECT', 'MULTISELECT', 'INPUTSELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS', 'RICHTEXT', 'DESC']
+export const FIELDS_SHOW_DEFAULT_VALUE = ['STRING', 'TEXT', 'INT', 'DATE', 'DATETIME', 'SELECT', 'MULTISELECT', 'INPUTSELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS', 'RICHTEXT', 'DESC', 'RATE']
// 字段数据源配置
export const FIELDS_SOURCE_TYPE = [
diff --git a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fieldItem.vue b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fieldItem.vue
index 9a882e5b2..d72f29634 100644
--- a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fieldItem.vue
+++ b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fieldItem.vue
@@ -43,6 +43,7 @@
import Members from './fields/members.vue'
import MultiSelect from './fields/multiSelect.vue'
import Radio from './fields/radio.vue'
+ import Rate from './fields/rate.vue'
import RichText from './fields/richText.vue'
import Select from './fields/select.vue'
import Table from './fields/table.vue'
@@ -89,6 +90,7 @@
Textarea: Textarea,
Tree: Tree,
Upload: Upload,
+ Rate: Rate,
Divider: Divider
},
props: {
diff --git a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fields/rate.vue b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fields/rate.vue
new file mode 100644
index 000000000..3ae957a0f
--- /dev/null
+++ b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/fields/rate.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
diff --git a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
index fdc65e6a5..e0cc9aad9 100644
--- a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
+++ b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
@@ -76,24 +76,30 @@
this.fields.forEach((item) => {
let value
if (item.key in this.value) {
+ // 复制一份表单字段的值
value = cloneDeep(this.value[item.key])
} else if ('default' in item) {
+ // 默认值
if (['MULTISELECT', 'CHECKBOX', 'MEMBER', 'MEMBERS', 'TABLE', 'IMAGE', 'FILE'].includes(item.type)) {
value = item.default ? item.default.split(',') : []
} else {
value = item.default
}
}
+ // 记录配置有关联规则的字段
if (item.meta.default_val_config) {
fieldsWithRules.push(item)
}
+ // 储存各个字段对应的初始值
fieldsValue[item.key] = value
})
this.localValue = fieldsValue
+ // 遍历配置有关联规则的字段
fieldsWithRules.forEach(async field => {
const { type, rules } = field.meta.default_val_config
if (type === 'currentTable') {
- const rule = this.getFulfillAssociationRule(rules)
+ const rule = this.getFulfillAssociationRule(rules, field.type)
+ // 找到满足条件的规则,那规则赋值初始值
if (rule) {
const value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
this.localValue[field.key] = value
@@ -136,10 +142,24 @@
associatedFields.forEach(async field => {
const { type, rules } = field.meta.default_val_config
if (type === 'currentTable') {
- const rule = this.getFulfillAssociationRule(rules)
+ // 获取每个字段的有效规则
+ const rule = this.getFulfillAssociationRule(rules, field.type)
if (rule) {
- const value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
+ let value = null
+ if (field.type === 'RATE') {
+ // 遍历所有区间,看所绑定的字段值命中那个区间,评分组件的值就是该区间的值
+ rule.intervals.forEach((item) => {
+ const triggerValue = this.localValue[key] * 1
+ if ((item.min <= triggerValue) && triggerValue < item.max) {
+ value = item.value
+ }
+ })
+ } else {
+ value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
+ }
this.localValue[field.key] = value
+ } else if (field.type === 'RATE') {
+ this.localValue[field.key] = 0
}
} else {
const res = await this.getAssociationFilterData(field.key)
@@ -167,18 +187,25 @@
})
},
// 获取当前表单满足联动规则设置的生效规则项
- getFulfillAssociationRule (rules) {
+ getFulfillAssociationRule (rules, fieldType) {
+ // 某个字段所配置的所有规则
let fulfillRule = null
rules.forEach(group => {
+ // 找出最后一条满足所有关联字段所设置条件的规则
const isfullFill = group.relations.every(relation => {
const { field: relFieldKey, type, value } = relation
- if (!(relFieldKey in this.localValue)) {
- return
- }
- if (type === 'CONST') {
- return isEqual(this.localValue[relFieldKey], value)
+ // 如果是评分组件
+ if (fieldType === 'RATE') {
+ return this.getRateSatisfyIntervalRule(group, relation)
} else {
- return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
+ if (!(relFieldKey in this.localValue)) {
+ return
+ }
+ if (type === 'CONST') {
+ return isEqual(this.localValue[relFieldKey], value)
+ } else {
+ return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
+ }
}
})
if (isfullFill) {
@@ -187,6 +214,15 @@
})
return fulfillRule
},
+ // 获取当前满足评分组件的所设区间的规则
+ getRateSatisfyIntervalRule (group, relation) {
+ // 评分组件所绑定的字段默认为变量类型
+ const relationValue = relation.type === 'CONST' ? (relation.value * 1) : this.localValue[relation.value] * 1
+ const isContain = group.intervals.some((item) => {
+ return (item.min <= relationValue) && (relationValue < item.max)
+ })
+ return isContain
+ },
// 获取关联他表字段的筛选数据
getAssociationFilterData (key) {
const field = this.fieldsCopy.find(item => item.key === key)
From 9458a65a9d60d14cfffaa0a968e91217a4c9439a Mon Sep 17 00:00:00 2001
From: 867-Jige
Date: Tue, 28 Feb 2023 16:32:13 +0800
Subject: [PATCH 65/80] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=A1=A8?=
=?UTF-8?q?=E5=8D=95=E8=AF=84=E5=88=86=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../flow-form-comp/form/constants/forms.js | 9 +-
.../flow-form-comp/form/fieldItem.vue | 9 +-
.../flow-form-comp/form/fields/rate.vue | 49 +++++
.../components/flow-form-comp/form/index.vue | 56 +++++-
.../components/project/create-page-dialog.vue | 8 +-
.../render-nocode/data-manage/index.vue | 4 +-
.../components/rateValueRule.vue | 145 +++++++++++++++
.../form-edit/association-value/linkage.vue | 3 +-
.../association-value/relation-rules.vue | 174 ++++++++++--------
.../components/form-edit/default-value.vue | 5 +-
.../form/components/form-edit/fieldEdit.vue | 29 +--
.../components/form-edit/fieldElement.vue | 2 +
.../components/render-nocode/form/index.vue | 3 +
.../src/components/render-nocode/index.vue | 2 +
.../more-actions/data-manage-operate.vue | 1 +
lib/client/src/views/edit-nocode/index.vue | 4 +-
.../action-tool/components/preview.vue | 1 +
lib/client/src/views/index/index.vue | 1 +
lib/client/src/views/project/index.vue | 26 +--
.../src/views/project/page-manage/index.vue | 1 +
.../src/views/system/project-manage/index.vue | 12 +-
lib/shared/no-code/constant.js | 8 +-
lib/shared/no-code/helper.js | 3 +-
23 files changed, 411 insertions(+), 144 deletions(-)
create mode 100644 lib/client/src/components/flow-form-comp/form/fields/rate.vue
create mode 100644 lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
diff --git a/lib/client/src/components/flow-form-comp/form/constants/forms.js b/lib/client/src/components/flow-form-comp/form/constants/forms.js
index 83c09b19a..e66df2e8d 100644
--- a/lib/client/src/components/flow-form-comp/form/constants/forms.js
+++ b/lib/client/src/components/flow-form-comp/form/constants/forms.js
@@ -130,6 +130,13 @@ export const FIELDS_TYPES = [
name: '分割线',
comp: 'Divider',
icon: 'icon bk-drag-icon bk-drag-fengexian'
+ },
+ {
+ type: 'RATE',
+ name: '评分组件',
+ default: '',
+ comp: 'Rate',
+ icon: 'icon bk-drag-icon bk-drag-rate'
}
]
@@ -167,7 +174,7 @@ export const DATA_SOURCE_FIELD = ['SELECT', 'INPUTSELECT', 'MULTISELECT', 'CHECK
export const NO_VIEWED_FIELD = ['DESC', 'DIVIDER']
// 需要展示默认值的字段类型
-export const FIELDS_SHOW_DEFAULT_VALUE = ['STRING', 'TEXT', 'INT', 'DATE', 'DATETIME', 'SELECT', 'MULTISELECT', 'INPUTSELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS', 'RICHTEXT', 'DESC']
+export const FIELDS_SHOW_DEFAULT_VALUE = ['STRING', 'TEXT', 'INT', 'DATE', 'DATETIME', 'SELECT', 'MULTISELECT', 'INPUTSELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS', 'RICHTEXT', 'DESC', 'RATE']
// 字段数据源配置
export const FIELDS_SOURCE_TYPE = [
diff --git a/lib/client/src/components/flow-form-comp/form/fieldItem.vue b/lib/client/src/components/flow-form-comp/form/fieldItem.vue
index 9a882e5b2..b8bec16c3 100644
--- a/lib/client/src/components/flow-form-comp/form/fieldItem.vue
+++ b/lib/client/src/components/flow-form-comp/form/fieldItem.vue
@@ -1,4 +1,5 @@
+
+
+
+
+
+
+
+
+
diff --git a/lib/client/src/components/flow-form-comp/form/index.vue b/lib/client/src/components/flow-form-comp/form/index.vue
index fdc65e6a5..e0cc9aad9 100644
--- a/lib/client/src/components/flow-form-comp/form/index.vue
+++ b/lib/client/src/components/flow-form-comp/form/index.vue
@@ -76,24 +76,30 @@
this.fields.forEach((item) => {
let value
if (item.key in this.value) {
+ // 复制一份表单字段的值
value = cloneDeep(this.value[item.key])
} else if ('default' in item) {
+ // 默认值
if (['MULTISELECT', 'CHECKBOX', 'MEMBER', 'MEMBERS', 'TABLE', 'IMAGE', 'FILE'].includes(item.type)) {
value = item.default ? item.default.split(',') : []
} else {
value = item.default
}
}
+ // 记录配置有关联规则的字段
if (item.meta.default_val_config) {
fieldsWithRules.push(item)
}
+ // 储存各个字段对应的初始值
fieldsValue[item.key] = value
})
this.localValue = fieldsValue
+ // 遍历配置有关联规则的字段
fieldsWithRules.forEach(async field => {
const { type, rules } = field.meta.default_val_config
if (type === 'currentTable') {
- const rule = this.getFulfillAssociationRule(rules)
+ const rule = this.getFulfillAssociationRule(rules, field.type)
+ // 找到满足条件的规则,那规则赋值初始值
if (rule) {
const value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
this.localValue[field.key] = value
@@ -136,10 +142,24 @@
associatedFields.forEach(async field => {
const { type, rules } = field.meta.default_val_config
if (type === 'currentTable') {
- const rule = this.getFulfillAssociationRule(rules)
+ // 获取每个字段的有效规则
+ const rule = this.getFulfillAssociationRule(rules, field.type)
if (rule) {
- const value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
+ let value = null
+ if (field.type === 'RATE') {
+ // 遍历所有区间,看所绑定的字段值命中那个区间,评分组件的值就是该区间的值
+ rule.intervals.forEach((item) => {
+ const triggerValue = this.localValue[key] * 1
+ if ((item.min <= triggerValue) && triggerValue < item.max) {
+ value = item.value
+ }
+ })
+ } else {
+ value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
+ }
this.localValue[field.key] = value
+ } else if (field.type === 'RATE') {
+ this.localValue[field.key] = 0
}
} else {
const res = await this.getAssociationFilterData(field.key)
@@ -167,18 +187,25 @@
})
},
// 获取当前表单满足联动规则设置的生效规则项
- getFulfillAssociationRule (rules) {
+ getFulfillAssociationRule (rules, fieldType) {
+ // 某个字段所配置的所有规则
let fulfillRule = null
rules.forEach(group => {
+ // 找出最后一条满足所有关联字段所设置条件的规则
const isfullFill = group.relations.every(relation => {
const { field: relFieldKey, type, value } = relation
- if (!(relFieldKey in this.localValue)) {
- return
- }
- if (type === 'CONST') {
- return isEqual(this.localValue[relFieldKey], value)
+ // 如果是评分组件
+ if (fieldType === 'RATE') {
+ return this.getRateSatisfyIntervalRule(group, relation)
} else {
- return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
+ if (!(relFieldKey in this.localValue)) {
+ return
+ }
+ if (type === 'CONST') {
+ return isEqual(this.localValue[relFieldKey], value)
+ } else {
+ return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
+ }
}
})
if (isfullFill) {
@@ -187,6 +214,15 @@
})
return fulfillRule
},
+ // 获取当前满足评分组件的所设区间的规则
+ getRateSatisfyIntervalRule (group, relation) {
+ // 评分组件所绑定的字段默认为变量类型
+ const relationValue = relation.type === 'CONST' ? (relation.value * 1) : this.localValue[relation.value] * 1
+ const isContain = group.intervals.some((item) => {
+ return (item.min <= relationValue) && (relationValue < item.max)
+ })
+ return isContain
+ },
// 获取关联他表字段的筛选数据
getAssociationFilterData (key) {
const field = this.fieldsCopy.find(item => item.key === key)
diff --git a/lib/client/src/components/project/create-page-dialog.vue b/lib/client/src/components/project/create-page-dialog.vue
index 57a008c55..380235fb2 100644
--- a/lib/client/src/components/project/create-page-dialog.vue
+++ b/lib/client/src/components/project/create-page-dialog.vue
@@ -242,6 +242,7 @@
}
},
handleConfirmClick () {
+ // 判断是不是流程页面或流程管理页面
if (['FLOW', 'FLOW_MANAGE'].includes(this.nocodeType)) {
this.$emit('save')
} else {
@@ -254,6 +255,7 @@
await this.$refs.templateForm.validate()
let templateFormData = {}
+ // nocodeType为空,且this.pageFrom为'TEMPLATE'
if (this.createFromTemplate) {
const template = this.selectTemplate
if (!template?.id) {
@@ -272,6 +274,7 @@
pageName: this.formData.pageName,
pageCode: this.formData.pageCode
}
+ // 将表单数据提交,
const nameExist = await this.$store.dispatch('page/checkName', {
data: {
...formData,
@@ -280,6 +283,7 @@
from: 'create'
}
})
+ // 判断页面名称是否存在
if (nameExist) return
const payload = {
@@ -290,7 +294,7 @@
formId: this.formId
}
}
-
+ // 查找为默认的布局
const { id, routePath } = this.showLayoutList.find(layout => layout.checked)
payload.data.layout = { id, routePath }
if (this.showAddNavListSwitcher) {
@@ -298,11 +302,13 @@
}
const res = await this.$store.dispatch('page/create', payload)
if (res) {
+ // 页面不是流程页面或流程管理页面
if (!['FLOW', 'FLOW_MANAGE'].includes(this.nocodeType)) {
this.$bkMessage({
theme: 'success',
message: '新建页面成功'
})
+ // 判断this.nocodeType有没有值
const toPageRouteName = this.nocodeType ? 'editNocode' : 'new'
this.$router.push({
name: toPageRouteName,
diff --git a/lib/client/src/components/render-nocode/data-manage/index.vue b/lib/client/src/components/render-nocode/data-manage/index.vue
index 0fe9b1fa8..1106a2e2a 100644
--- a/lib/client/src/components/render-nocode/data-manage/index.vue
+++ b/lib/client/src/components/render-nocode/data-manage/index.vue
@@ -1,8 +1,10 @@
-
+
+
+
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
new file mode 100644
index 000000000..5068f14c9
--- /dev/null
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
@@ -0,0 +1,145 @@
+
+
+
+ 当表单中
+
+
+
+
+ 的值处于
+
+
+
+ ~
+
+ 区间值为
+
+
+
+ 以上条件均不满足时值为:
+
+
+
+
+
+
+
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
index 9de42e7ec..7ec0068e5 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
@@ -115,6 +115,7 @@
},
created () {
this.getFormList()
+ console.log(this.field)
},
methods: {
async getFormList () {
@@ -251,7 +252,7 @@
looped = true
return true
}
- const { type: relType, rules: relRules } = relField.meta.default_val_config || {}
+ const { type: relType, rules: relRules } = relField?.meta.default_val_config || {}
if (relType === 'currentTable' && Array.isArray(relRules)) {
looped = this.checkLoopReference(relField.meta.default_val_config.rules, key)
}
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
index 7bdcbd4d1..47a4c7350 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
@@ -13,98 +13,106 @@
{{ `规则${groupIndex + 1}` }}
-
-
- 当
-
-
-
-
- 等于
+
+
+
+
+
+
+
+ 当
+
+
+
+
+ 等于
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
值为
+ @change="handleTargetVarValTypeChange(rule.target, $event)">
-
+
+
+ @change="handleTargetVarValChange(rule.target, $event)">
-
-
-
-
-
-
-
-
值为
-
-
-
-
-
-
-
-
-
-
-
-
-
+
item.type === type)
} else if (!MULTIPLE_VALUE_TYPES.includes(type)) {
- return fields.filter(item => COMPARABLE_VALUE_TYPES.includes(item.type) && !MULTIPLE_VALUE_TYPES.includes(item.type))
+ return fields.filter(item => {
+ const bool = COMPARABLE_VALUE_TYPES.includes(item.type) && !MULTIPLE_VALUE_TYPES.includes(item.type)
+ return type === 'RATE' ? item.type === 'RATE' && bool : bool
+ })
}
return fields.filter(item => COMPARABLE_VALUE_TYPES.includes(item.type))
}
@@ -194,7 +207,16 @@
},
// 规则字段可选列表
getRelFieldList () {
- return this.isCurrentTable ? this.fieldsList.filter(item => item.key !== this.field.key) : this.otherTableFields
+ const relFieldList = this.isCurrentTable ? this.fieldsList.filter(item => {
+ let optionBool = item.key !== this.field.key
+ // 评分组件只能选择数字类型的字段
+ if (optionBool && this.field.type === 'RATE') {
+ optionBool = item.type === 'INT'
+ }
+ return optionBool
+ }) : this.otherTableFields
+
+ return relFieldList
},
// 规则字段值为变量时只能选本表字段
// 字段可选列表只能是可比较值类型的字段,并排除已选中字段
@@ -273,7 +295,7 @@
target.value = val
this.change()
},
- change () {
+ change (e) {
this.$emit('change', this.localVal)
}
}
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/default-value.vue b/lib/client/src/components/render-nocode/form/components/form-edit/default-value.vue
index c1fea9838..e2620a766 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/default-value.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/default-value.vue
@@ -6,6 +6,7 @@
:disabled="disabled"
@change="update">
+
+
@@ -36,12 +37,10 @@
-
+ desc-icon="bk-icon icon-question-circle">
@@ -50,7 +49,7 @@
整行
-
+
点击上传
@@ -65,7 +64,7 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
@@ -371,7 +360,7 @@
import { REGX_CHIOCE_LIST } from '../../../../../../../shared/no-code/constant'
import { mapGetters } from 'vuex'
import { transSchemeToArrayTypeTree } from '../../../common/apiScheme'
-
+
export default {
name: 'formEdit',
components: {
@@ -491,6 +480,7 @@
}
},
methods: {
+
getRegexList (val) {
const result = REGX_CHIOCE_LIST.filter(item => item.type === val.type
|| (Array.isArray(val.type) && item.type.includes(val.type)) // 主要是为了区分text 和 string 类型的正则规则 同时去除DATE DATETIME 的影响
@@ -624,10 +614,9 @@
this.resArrayTreeData = transSchemeToArrayTypeTree(this.apiDetail.response)
},
handleDefaultValChange (val) {
- const formattedValue = ['MULTISELECT', 'CHECKBOX', 'MEMBER', 'MEMBERS'].includes(this.fieldData.type)
+ this.fieldData.default = ['MULTISELECT', 'CHECKBOX', 'MEMBER', 'MEMBERS'].includes(this.fieldData.type)
? val.join(',')
: val
- this.fieldData.default = formattedValue
this.change()
},
// 设置描述组件的值
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/fieldElement.vue b/lib/client/src/components/render-nocode/form/components/form-edit/fieldElement.vue
index cf7185bdd..1a7e556ec 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/fieldElement.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/fieldElement.vue
@@ -1,4 +1,5 @@
+
diff --git a/lib/client/src/components/render-nocode/form/index.vue b/lib/client/src/components/render-nocode/form/index.vue
index 4ba49bda2..436d1394a 100644
--- a/lib/client/src/components/render-nocode/form/index.vue
+++ b/lib/client/src/components/render-nocode/form/index.vue
@@ -3,8 +3,10 @@
class="lesscode-editor-page-content"
:page-type="pageType"
v-bkloading="{ isLoading }">
+
+
+
diff --git a/lib/client/src/components/render-nocode/index.vue b/lib/client/src/components/render-nocode/index.vue
index 6720bb390..2ead2f8e7 100644
--- a/lib/client/src/components/render-nocode/index.vue
+++ b/lib/client/src/components/render-nocode/index.vue
@@ -1,7 +1,9 @@
+
+
diff --git a/lib/client/src/views/edit-nocode/components/more-actions/data-manage-operate.vue b/lib/client/src/views/edit-nocode/components/more-actions/data-manage-operate.vue
index 368366b25..5633206d0 100644
--- a/lib/client/src/views/edit-nocode/components/more-actions/data-manage-operate.vue
+++ b/lib/client/src/views/edit-nocode/components/more-actions/data-manage-operate.vue
@@ -50,6 +50,7 @@
methods: {
// 获取表单数据管理页关联的表单页
async getFormPage () {
+ // console.log(this.pageDetail)
const res = await this.$store.dispatch('nocode/form/getFormRelatedPages', {
formId: this.pageDetail.formId,
type: 'FORM'
diff --git a/lib/client/src/views/edit-nocode/index.vue b/lib/client/src/views/edit-nocode/index.vue
index ffb3bd4a7..14828a54d 100644
--- a/lib/client/src/views/edit-nocode/index.vue
+++ b/lib/client/src/views/edit-nocode/index.vue
@@ -10,6 +10,7 @@
-->
+
+
diff --git a/lib/client/src/views/project/index.vue b/lib/client/src/views/project/index.vue
index 97dfdbc90..f52a7e6dc 100644
--- a/lib/client/src/views/project/index.vue
+++ b/lib/client/src/views/project/index.vue
@@ -1,5 +1,6 @@
+
+
-
+
取消
-
+
e)
},
handleGotoPage (projectId) {
+ // 开发应用和页面管理时调用跳到@/views/project/page-manage
this.$router.push({
name: 'pageList',
params: {
diff --git a/lib/shared/no-code/constant.js b/lib/shared/no-code/constant.js
index e8d32c58f..dfed43921 100644
--- a/lib/shared/no-code/constant.js
+++ b/lib/shared/no-code/constant.js
@@ -105,13 +105,19 @@ export const FIELDS_TYPES = [
type: 'DIVIDER',
name: '分割线',
comp: 'Divider'
+ },
+ {
+ type: 'RATE',
+ name: '评分',
+ default: '',
+ comp: 'Rate'
}
]
// 可以比较值是否相等的字段类型
export const COMPARABLE_VALUE_TYPES = [
'STRING', 'TEXT', 'INT', 'DATE', 'DATETIME', 'LINK', 'SELECT', 'INPUTSELECT',
- 'MULTISELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS'
+ 'MULTISELECT', 'CHECKBOX', 'RADIO', 'MEMBER', 'MEMBERS', 'RATE'
]
// 值可能为多个的字段类型
export const MULTIPLE_VALUE_TYPES = ['MULTISELECT', 'CHECKBOX', 'MEMBERS', 'FILE', 'TABLE']
diff --git a/lib/shared/no-code/helper.js b/lib/shared/no-code/helper.js
index ed6e7b83a..69cf48fa2 100644
--- a/lib/shared/no-code/helper.js
+++ b/lib/shared/no-code/helper.js
@@ -27,7 +27,8 @@ export const transformNCJson2LCJson = (ncJson) => {
FILE: 'json',
TABLE: 'json',
DESC: 'varchar',
- IMAGE: 'varchar'
+ IMAGE: 'varchar',
+ RATE: 'int'
}
return ncJson.reduce((acc, cur) => {
From 91c4edc7bceb72fcd686d8bbef1eac29fc86d273 Mon Sep 17 00:00:00 2001
From: terlinhe
Date: Wed, 1 Mar 2023 12:33:22 +0800
Subject: [PATCH 66/80] =?UTF-8?q?feat:=20=E8=A1=A8=E5=8D=95=E5=AE=B9?=
=?UTF-8?q?=E5=99=A8=E6=8C=89=E9=92=AE=E6=94=AF=E6=8C=81=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E9=9A=90=E8=97=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/render/pc/widget/form.vue | 9 +-
.../materials/bk/form/index.js | 15 +-
.../form/components/form-button-setting.vue | 66 +++++
.../modifier/component/form/index.vue | 236 ++++++++++++------
4 files changed, 237 insertions(+), 89 deletions(-)
create mode 100644 lib/client/src/element-materials/modifier/component/form/components/form-button-setting.vue
diff --git a/lib/client/src/components/render/pc/widget/form.vue b/lib/client/src/components/render/pc/widget/form.vue
index 70bfeb8f0..6771d015c 100644
--- a/lib/client/src/components/render/pc/widget/form.vue
+++ b/lib/client/src/components/render/pc/widget/form.vue
@@ -13,10 +13,10 @@
item.prop.property) || []
+ }
}
}
diff --git a/lib/client/src/element-materials/materials/bk/form/index.js b/lib/client/src/element-materials/materials/bk/form/index.js
index 7a0245b26..676f7d81b 100644
--- a/lib/client/src/element-materials/materials/bk/form/index.js
+++ b/lib/client/src/element-materials/materials/bk/form/index.js
@@ -29,14 +29,6 @@ export default {
'pointer',
'opacity'
],
- directives: [
- // {
- // type: 'v-bind',
- // prop: 'model',
- // format: 'variable',
- // valueTypeInclude: ['object']
- // }
- ],
props: {
model: {
type: 'object',
@@ -60,6 +52,13 @@ export default {
'label-width': {
type: 'number',
val: 150
+ },
+ 'btnSetting': {
+ type: 'hidden',
+ val: {
+ SHOW_SUBMIT_BTN: true,
+ SHOW_CANCEL_BTN: true
+ }
}
},
slots: {
diff --git a/lib/client/src/element-materials/modifier/component/form/components/form-button-setting.vue b/lib/client/src/element-materials/modifier/component/form/components/form-button-setting.vue
new file mode 100644
index 000000000..abe822b97
--- /dev/null
+++ b/lib/client/src/element-materials/modifier/component/form/components/form-button-setting.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
diff --git a/lib/client/src/element-materials/modifier/component/form/index.vue b/lib/client/src/element-materials/modifier/component/form/index.vue
index 6afc8ce98..43593a5c6 100644
--- a/lib/client/src/element-materials/modifier/component/form/index.vue
+++ b/lib/client/src/element-materials/modifier/component/form/index.vue
@@ -66,6 +66,9 @@
继续添加表单项
+
+
+
{
@@ -121,6 +125,7 @@
name: '',
components: {
formItemEdit,
+ formButtonSetting,
initForm
},
inheritAttrs: false,
@@ -128,7 +133,10 @@
return {
isShow: false,
isShowOperation: false,
- editFormItemData: {}
+ editFormItemData: {},
+ initPayload: {},
+ submitBtnNode: null,
+ cancelBtnNode: null
}
},
@@ -202,6 +210,145 @@
this.editFormItemNode = formItemNode
this.isShowOperation = true
},
+
+ setSubmitBtn () {
+ if (this.submitBtnNode) return _.cloneDeep(this.submitBtnNode)
+ const payload = this.initPayload || {}
+ // 提交按钮
+ const submitBtnNode = LC.createNode('bk-button')
+ submitBtnNode.setRenderSlots({
+ format: 'value',
+ component: 'text',
+ code: '提交',
+ valueType: 'text',
+ renderValue: '提交'
+ })
+
+ submitBtnNode.setProp('theme', LC.utils.genPropFormatValue({
+ format: 'value',
+ code: 'primary',
+ renderValue: 'primary'
+ }))
+ submitBtnNode.setStyle({
+ width: '88px'
+ })
+
+ // 绑定click事件并生成事件模板
+ submitBtnNode.setRenderEvents({
+ click: {
+ enable: true,
+ methodCode: '',
+ params: [],
+ eventTemplates: [
+ {
+ funcName: 'submitFormData',
+ funcParams: [],
+ funcBody: getSubmitFormDataFunc({
+ '{ref}': this.componentNode.prop.ref,
+ '{formmodel}': this.formModelKey,
+ '{posturl}': payload.initType === 'table-data-source' ? `/data-source/user/tableName/${payload.tableData.tableName}` : '/api/data/postMockData',
+ '{urlTips}': payload.initType === 'table-data-source' ? `此地址会将数据提交到lesscode创建的数据表,${payload.tableData.tableName}为选择的表名称,若需提交到其它接口请作相应修改` : '示例链接/api/data/postMockData需要更换为具体的接口API地址'
+ })
+ }
+ ]
+ }
+ })
+ return submitBtnNode
+ },
+
+ setCancelBtn () {
+ if (this.cancelBtnNode) return _.cloneDeep(this.cancelBtnNode)
+ // 取消按钮
+ const cancelBtnNode = LC.createNode('bk-button')
+ cancelBtnNode.setRenderSlots({
+ format: 'value',
+ component: 'text',
+ code: '取消',
+ valueType: 'text',
+ renderValue: '取消'
+ })
+ cancelBtnNode.setStyle({
+ width: '88px',
+ 'marginLeft': '8px'
+ })
+ // 绑定click事件并生成事件模板
+ cancelBtnNode.setRenderEvents({
+ click: {
+ enable: true,
+ methodCode: '',
+ params: [],
+ eventTemplates: [
+ {
+ funcName: 'resetFormData',
+ funcParams: [],
+ funcBody: getResetFormValueFunc(this.formModelKey)
+ }
+ ]
+ }
+ })
+ return cancelBtnNode
+ },
+
+ // 设置操作按钮
+ handleSetBtnItem () {
+ // 记录设置前是否已有按钮
+ let hasBtnItem = true
+
+ let btnItemNode = _.find(this.componentNode.children, node => !node.prop.property)
+ const btnSetting = this.componentNode.prop?.btnSetting
+
+ if (!btnItemNode) {
+ hasBtnItem = false
+ btnItemNode = LC.createNode('widget-form-item')
+ }
+ // 找出提交按钮跟取消按钮
+ let submitItem = null
+ let cancelItem = null
+ if (btnItemNode.children.length > 1) {
+ submitItem = btnItemNode.children[0]
+ cancelItem = btnItemNode.children[1]
+ } else if (btnItemNode.children.length === 1) {
+ const item = btnItemNode.children[0]
+ // 如果只有一个,目前只能根据主题是否为default粗略判断
+ if (item?.prop?.theme === 'default') {
+ cancelItem = item
+ } else {
+ submitItem = item
+ }
+ }
+
+ // 增加或删除提交按钮
+ if (submitItem && btnSetting?.SHOW_SUBMIT_BTN === false) {
+ this.submitBtnNode = _.cloneDeep(submitItem)
+ btnItemNode.removeChild(submitItem)
+ } else if (!submitItem && btnSetting?.SHOW_SUBMIT_BTN !== false) {
+ btnItemNode.renderSlots.default?.splice(0, 0, this.setSubmitBtn())
+ }
+ // 增加或删除取消按钮
+ if (cancelItem && btnSetting?.SHOW_CANCEL_BTN === false) {
+ this.cancelBtnNode = _.cloneDeep(cancelItem)
+ btnItemNode.removeChild(cancelItem)
+ } else if (!cancelItem && btnSetting?.SHOW_CANCEL_BTN !== false) {
+ btnItemNode.appendChild(this.setCancelBtn())
+ }
+
+ if (btnItemNode.children.length) {
+ !hasBtnItem && this.componentNode.appendChild(btnItemNode)
+ return btnItemNode
+ } else {
+ hasBtnItem && this.componentNode.removeChild(btnItemNode)
+ return null
+ }
+ },
+
+ handleUpdateBtn (btnSetting) {
+ this.componentNode.setProp('btnSetting', LC.utils.genPropFormatValue({
+ format: 'value',
+ code: btnSetting,
+ renderValue: btnSetting
+ }))
+ this.handleSetBtnItem()
+ },
/**
* @desc 提交表单项
*/
@@ -252,82 +399,9 @@
])
}
- const setBtnFormItem = () => {
- // 提交按钮
- const submitBtnNode = LC.createNode('bk-button')
- submitBtnNode.setRenderSlots({
- format: 'value',
- component: 'text',
- code: '提交',
- valueType: 'text',
- renderValue: '提交'
- })
-
- submitBtnNode.setProp('theme', LC.utils.genPropFormatValue({
- format: 'value',
- code: 'primary',
- renderValue: 'primary'
- }))
- submitBtnNode.setStyle({
- width: '88px'
- })
-
- // 绑定click事件并生成事件模板
- submitBtnNode.setRenderEvents({
- click: {
- enable: true,
- methodCode: '',
- params: [],
- eventTemplates: [
- {
- funcName: 'submitFormData',
- funcParams: [],
- funcBody: getSubmitFormDataFunc({
- '{ref}': this.componentNode.prop.ref,
- '{formmodel}': this.formModelKey,
- '{posturl}': payload.initType === 'table-data-source' ? `/data-source/user/tableName/${payload.tableData.tableName}` : '/api/data/postMockData',
- '{urlTips}': payload.initType === 'table-data-source' ? `此地址会将数据提交到lesscode创建的数据表,${payload.tableData.tableName}为选择的表名称,若需提交到其它接口请作相应修改` : '示例链接/api/data/postMockData需要更换为具体的接口API地址'
- })
- }
- ]
- }
- })
- // 取消按钮
- const cancelBtnNode = LC.createNode('bk-button')
- cancelBtnNode.setRenderSlots({
- format: 'value',
- component: 'text',
- code: '取消',
- valueType: 'text',
- renderValue: '取消'
- })
- cancelBtnNode.setStyle({
- width: '88px',
- 'marginLeft': '8px'
- })
- // 绑定click事件并生成事件模板
- cancelBtnNode.setRenderEvents({
- click: {
- enable: true,
- methodCode: '',
- params: [],
- eventTemplates: [
- {
- funcName: 'resetFormData',
- funcParams: [],
- funcBody: getResetFormValueFunc(this.formModelKey)
- }
- ]
- }
- })
- let actionFormItemNode = null
- actionFormItemNode = LC.createNode('widget-form-item')
- actionFormItemNode.appendChild(submitBtnNode)
- actionFormItemNode.appendChild(cancelBtnNode)
- this.componentNode.appendChild(actionFormItemNode)
- return actionFormItemNode
+ if (payload?.initType) {
+ this.initPayload = payload
}
-
if (this.editFormItemNode) {
// 编辑
// const editFormItemDataProp = this.editFormItemNode.prop
@@ -356,11 +430,15 @@
// 新建表单的操作按钮
// prop.property 为空表示为 form 的操作项
let actionFormItemNode = _.find(this.componentNode.children, node => !node.prop.property)
+ // 如果为空,则设置一次按钮
+ !actionFormItemNode && (actionFormItemNode = this.handleSetBtnItem())
if (!actionFormItemNode) {
- actionFormItemNode = setBtnFormItem()
+ // 没有操作按钮,放到最后
+ this.componentNode.appendChild(formItemNode)
+ } else {
+ // 新建的表单项放在操作按钮的前面
+ this.componentNode.insertBefore(formItemNode, actionFormItemNode)
}
- // 新建的表单项放在操作按钮的前面
- this.componentNode.insertBefore(formItemNode, actionFormItemNode)
}
// 更新model和rules
From 90324a283e209dcd998a9de29ce0ac6a1b7dd948 Mon Sep 17 00:00:00 2001
From: xuzhan
Date: Wed, 1 Mar 2023 15:15:05 +0800
Subject: [PATCH 67/80] =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=A0=87=E8=AF=86=E8=BF=9B=E8=A1=8C=E6=90=9C?=
=?UTF-8?q?=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/client/src/components/methods/choose-function/index.vue | 4 +---
.../variable/variable-select/components/variable.vue | 4 ++--
lib/client/src/components/variable/variable-table.vue | 4 ++--
lib/client/src/views/project/variable-manage.vue | 6 +++---
4 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/client/src/components/methods/choose-function/index.vue b/lib/client/src/components/methods/choose-function/index.vue
index c5d148118..2e047f730 100644
--- a/lib/client/src/components/methods/choose-function/index.vue
+++ b/lib/client/src/components/methods/choose-function/index.vue
@@ -304,9 +304,7 @@
},
triggleUpdate () {
- if (window.event.sourceCapabilities) {
- this.$emit('change', JSON.parse(JSON.stringify(this.renderChoosenFunction)))
- }
+ this.$emit('change', JSON.parse(JSON.stringify(this.renderChoosenFunction)))
},
handleChooseFunction (functionData) {
diff --git a/lib/client/src/components/variable/variable-select/components/variable.vue b/lib/client/src/components/variable/variable-select/components/variable.vue
index 69c561532..da30bf9fb 100644
--- a/lib/client/src/components/variable/variable-select/components/variable.vue
+++ b/lib/client/src/components/variable/variable-select/components/variable.vue
@@ -32,7 +32,7 @@
{
- if (variable.variableName.includes(this.searchText)) {
+ if (variable.variableName.includes(this.searchText) || variable.variableCode.includes(this.searchText)) {
result.push(variable)
}
return result
diff --git a/lib/client/src/components/variable/variable-table.vue b/lib/client/src/components/variable/variable-table.vue
index a9e1b3346..440ce909c 100644
--- a/lib/client/src/components/variable/variable-table.vue
+++ b/lib/client/src/components/variable/variable-table.vue
@@ -97,7 +97,7 @@
type: Boolean,
default: false
},
- variableName: {
+ searchTxt: {
type: String,
default: ''
}
@@ -131,7 +131,7 @@
filterVariableList () {
return (this.variableList || []).filter((variable) => {
- return (variable.variableName || '').includes(this.variableName)
+ return (variable.variableName || '').includes(this.searchTxt) || (variable.variableCode || '').includes(this.searchTxt)
})
},
diff --git a/lib/client/src/views/project/variable-manage.vue b/lib/client/src/views/project/variable-manage.vue
index 4397715a0..c3bd31eaa 100644
--- a/lib/client/src/views/project/variable-manage.vue
+++ b/lib/client/src/views/project/variable-manage.vue
@@ -2,9 +2,9 @@
-
+
提示:
1. 可以在组件属性和指令的配置面板中使用该变量
@@ -35,7 +35,7 @@
data () {
return {
isLoading: false,
- variableName: '',
+ searchTxt: '',
variableFormData: {
isShow: false,
formData: {}
From 04f066286f5929fbdbfc4186f1236682c2a018a0 Mon Sep 17 00:00:00 2001
From: 867-Jige
Date: Wed, 1 Mar 2023 18:18:09 +0800
Subject: [PATCH 68/80] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=80=BC=E5=92=8C?=
=?UTF-8?q?=E5=85=B3=E8=81=94=E5=AD=97=E6=AE=B5=E7=9A=84=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../flow-form-comp/form/constants/forms.js | 2 +-
.../flow-form-comp/form/fieldItem.vue | 4 ++--
.../flow-form-comp/form/fields/rate.vue | 11 +--------
.../components/flow-form-comp/form/index.vue | 5 +---
.../flow-form-comp/form/util/index.js | 7 ++++++
.../components/rateValueRule.vue | 4 +---
.../form-edit/association-value/linkage.vue | 1 -
.../association-value/relation-rules.vue | 5 ++--
lib/client/src/views/project/index.vue | 23 +++++++++++++++++++
.../flow-form-comp/form/constants/forms.js | 2 +-
.../flow-form-comp/form/fields/rate.vue | 12 ++--------
.../components/flow-form-comp/form/index.vue | 5 +---
lib/shared/no-code/constant.js | 2 +-
13 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/lib/client/src/components/flow-form-comp/form/constants/forms.js b/lib/client/src/components/flow-form-comp/form/constants/forms.js
index e66df2e8d..6550d5fed 100644
--- a/lib/client/src/components/flow-form-comp/form/constants/forms.js
+++ b/lib/client/src/components/flow-form-comp/form/constants/forms.js
@@ -134,7 +134,7 @@ export const FIELDS_TYPES = [
{
type: 'RATE',
name: '评分组件',
- default: '',
+ default: 0,
comp: 'Rate',
icon: 'icon bk-drag-icon bk-drag-rate'
}
diff --git a/lib/client/src/components/flow-form-comp/form/fieldItem.vue b/lib/client/src/components/flow-form-comp/form/fieldItem.vue
index b8bec16c3..0c180651f 100644
--- a/lib/client/src/components/flow-form-comp/form/fieldItem.vue
+++ b/lib/client/src/components/flow-form-comp/form/fieldItem.vue
@@ -26,7 +26,7 @@
-
-
diff --git a/lib/client/src/components/flow-form-comp/form/index.vue b/lib/client/src/components/flow-form-comp/form/index.vue
index e0cc9aad9..2d6aad665 100644
--- a/lib/client/src/components/flow-form-comp/form/index.vue
+++ b/lib/client/src/components/flow-form-comp/form/index.vue
@@ -158,8 +158,6 @@
value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
}
this.localValue[field.key] = value
- } else if (field.type === 'RATE') {
- this.localValue[field.key] = 0
}
} else {
const res = await this.getAssociationFilterData(field.key)
@@ -203,9 +201,8 @@
}
if (type === 'CONST') {
return isEqual(this.localValue[relFieldKey], value)
- } else {
- return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
}
+ return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
}
})
if (isfullFill) {
diff --git a/lib/client/src/components/flow-form-comp/form/util/index.js b/lib/client/src/components/flow-form-comp/form/util/index.js
index 06137aada..999b1c93e 100644
--- a/lib/client/src/components/flow-form-comp/form/util/index.js
+++ b/lib/client/src/components/flow-form-comp/form/util/index.js
@@ -15,3 +15,10 @@ export function deepClone (obj) {
}
return clone
}
+export function getComBaseDefault (fieldesType, type) {
+ const fielde = fieldesType.find(item => item.type === type) || {}
+ if (fielde.hasOwnProperty('default')) {
+ return fielde.default
+ }
+ return ''
+}
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
index 5068f14c9..ca675ad79 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
@@ -97,8 +97,6 @@
immediate: true
}
},
- created () {},
- mounted () {},
methods: {
changeTargetValue () {
let interval = {}
@@ -108,7 +106,6 @@
interval = item
}
})
- this.rule.relations[0].type = 'VAR'
this.rule.target.value = interval?.value || 0
this.rule.target.type = 'CONST'
this.ruleChange()
@@ -120,6 +117,7 @@
},
ruleChange () {
this.rule.relations[0].value = this.rule.relations[0].field
+ this.rule.relations[0].type = 'VAR'
this.changeBindField()
this.$emit('change', this.rule)
}
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
index 7ec0068e5..2ae402edb 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/linkage.vue
@@ -115,7 +115,6 @@
},
created () {
this.getFormList()
- console.log(this.field)
},
methods: {
async getFormList () {
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
index 47a4c7350..353498cfa 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/relation-rules.vue
@@ -185,12 +185,11 @@
targetValVarList () {
const fields = this.isCurrentTable ? this.fieldsList.filter(item => item.key !== this.field.key) : this.otherTableFields
const type = this.field.type
- if (['INT', 'DATE', 'DATETIME', 'MEMBER', 'MEMBERS'].includes(type)) {
+ if (['INT', 'DATE', 'DATETIME', 'MEMBER', 'MEMBERS', 'RATE'].includes(type)) {
return fields.filter(item => item.type === type)
} else if (!MULTIPLE_VALUE_TYPES.includes(type)) {
return fields.filter(item => {
- const bool = COMPARABLE_VALUE_TYPES.includes(item.type) && !MULTIPLE_VALUE_TYPES.includes(item.type)
- return type === 'RATE' ? item.type === 'RATE' && bool : bool
+ return COMPARABLE_VALUE_TYPES.includes(item.type) && !MULTIPLE_VALUE_TYPES.includes(item.type)
})
}
return fields.filter(item => COMPARABLE_VALUE_TYPES.includes(item.type))
diff --git a/lib/client/src/views/project/index.vue b/lib/client/src/views/project/index.vue
index f52a7e6dc..2602bcd15 100644
--- a/lib/client/src/views/project/index.vue
+++ b/lib/client/src/views/project/index.vue
@@ -15,6 +15,11 @@
+
+
+
+
+
-
-
diff --git a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
index e0cc9aad9..2d6aad665 100644
--- a/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
+++ b/lib/server/project-template/project-init-code/lib/client/src/components/flow-form-comp/form/index.vue
@@ -158,8 +158,6 @@
value = rule.target.type === 'CONST' ? rule.target.value : this.localValue[rule.target.value]
}
this.localValue[field.key] = value
- } else if (field.type === 'RATE') {
- this.localValue[field.key] = 0
}
} else {
const res = await this.getAssociationFilterData(field.key)
@@ -203,9 +201,8 @@
}
if (type === 'CONST') {
return isEqual(this.localValue[relFieldKey], value)
- } else {
- return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
}
+ return value in this.localValue && isEqual(this.localValue[relFieldKey], this.localValue[value])
}
})
if (isfullFill) {
diff --git a/lib/shared/no-code/constant.js b/lib/shared/no-code/constant.js
index dfed43921..403f38b41 100644
--- a/lib/shared/no-code/constant.js
+++ b/lib/shared/no-code/constant.js
@@ -109,7 +109,7 @@ export const FIELDS_TYPES = [
{
type: 'RATE',
name: '评分',
- default: '',
+ default: 0,
comp: 'Rate'
}
]
From 38de5a17e9abc212d335655c2e6aaf9adb5371bb Mon Sep 17 00:00:00 2001
From: 867-Jige
Date: Fri, 3 Mar 2023 11:04:57 +0800
Subject: [PATCH 69/80] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E7=BB=84=E4=BB=B6=E6=8F=90=E4=BA=A4=E5=80=BC=E8=A7=84?=
=?UTF-8?q?=E5=88=99=E4=B8=8D=E9=80=9A=E8=BF=87=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../association-value/components/rateValueRule.vue | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
index ca675ad79..b5ca5d822 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
@@ -28,9 +28,6 @@
区间值为
-
- 以上条件均不满足时值为:
-
@@ -107,7 +104,6 @@
}
})
this.rule.target.value = interval?.value || 0
- this.rule.target.type = 'CONST'
this.ruleChange()
},
changeBindField () {
@@ -118,6 +114,7 @@
ruleChange () {
this.rule.relations[0].value = this.rule.relations[0].field
this.rule.relations[0].type = 'VAR'
+ this.rule.target.type = 'CONST'
this.changeBindField()
this.$emit('change', this.rule)
}
@@ -134,10 +131,4 @@
.interval-row{
margin-top: 8px;
}
-.tips-box{
- display: flex;
- align-items: center;
- padding-left: 8px;
- margin: 8px auto;
-}
From 98f15b7a8021c7e4b5209c2744df404f9cb90f91 Mon Sep 17 00:00:00 2001
From: 867-Jige
Date: Fri, 3 Mar 2023 11:54:09 +0800
Subject: [PATCH 70/80] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=92=8C?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95=E7=BB=84=E4=BB=B6=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/client/src/components/flow-form-comp/form/fields/rate.vue | 2 +-
.../form-edit/association-value/components/rateValueRule.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/client/src/components/flow-form-comp/form/fields/rate.vue b/lib/client/src/components/flow-form-comp/form/fields/rate.vue
index 6cac7b446..edf323627 100644
--- a/lib/client/src/components/flow-form-comp/form/fields/rate.vue
+++ b/lib/client/src/components/flow-form-comp/form/fields/rate.vue
@@ -9,7 +9,7 @@
name: 'Rate',
props: {
value: {
- type: [Number, String],
+ type: Number,
default: 0
},
disabled: {
diff --git a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
index b5ca5d822..b3ac2d2ac 100644
--- a/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
+++ b/lib/client/src/components/render-nocode/form/components/form-edit/association-value/components/rateValueRule.vue
@@ -98,7 +98,7 @@
changeTargetValue () {
let interval = {}
this.rule.intervals.forEach((item) => {
- const defValue = this.bindField.default * 1
+ const defValue = this.bindField?.default * 1
if (item.min <= defValue && defValue < item.max) {
interval = item
}
From 665d6e43b575d2d8e3e7d68e025143deacf3e418 Mon Sep 17 00:00:00 2001
From: hmohuang <13407923955@163.com>
Date: Mon, 6 Mar 2023 16:14:25 +0800
Subject: [PATCH 71/80] =?UTF-8?q?feat:=E7=A9=BA=E7=8A=B6=E6=80=81=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/filelib/list-card.vue | 17 ++--
.../src/components/filelib/list-table.vue | 20 +++--
.../src/components/filelib/use-upload-list.js | 9 ++-
.../src/components/project/empty-status.vue | 77 +++++++++++++++++++
.../components/project/page-from-template.vue | 13 +++-
.../components/variable/variable-table.vue | 12 +++
lib/client/src/main.js | 2 +
.../project/api-manage/children/category.vue | 19 +++--
.../project/api-manage/children/list.vue | 11 +++
.../all/components/render-category.vue | 11 +++
.../all/components/render-list.vue | 9 +--
.../project/component-manage/useing/index.vue | 9 ++-
.../data-operation/children/query-history.vue | 1 +
.../data-table/data-manage/index.vue | 19 ++++-
.../data-table/data-manage/render-data.vue | 1 +
.../table-design/table-list/list/index.vue | 1 +
.../src/views/project/file-manage/index.vue | 17 ++--
.../project/flow-manage/archived-list.vue | 11 ++-
.../views/project/flow-manage/flow-list.vue | 11 ++-
.../function-manage/children/group.vue | 19 +++--
.../project/function-manage/children/list.vue | 12 ++-
lib/client/src/views/project/logs.vue | 15 +++-
.../page-manage/children/list-card.vue | 15 ++--
.../page-manage/children/list-table.vue | 20 +++--
.../src/views/project/page-manage/index.vue | 16 ++--
.../src/views/project/release/history.vue | 1 +
.../components/render-category.vue | 11 +++
.../components/render-template.vue | 17 ++--
.../src/views/project/variable-manage.vue | 6 +-
.../views/project/version-manage/index.vue | 19 +++--
.../system/components/template-dialog.vue | 15 +++-
.../src/views/system/function-market.vue | 17 ++--
.../system/operation/stats/comp/dim-comp.vue | 15 +++-
.../system/operation/stats/func/dim-func.vue | 15 +++-
.../operation/stats/project/dim-project.vue | 15 +++-
.../system/operation/stats/user/dim-user.vue | 15 +++-
.../project-manage/children/list-card.vue | 30 +++-----
.../project-manage/children/list-table.vue | 38 ++++-----
.../src/views/system/project-manage/index.vue | 13 +++-
.../src/views/system/template-market.vue | 35 ++++++---
40 files changed, 462 insertions(+), 167 deletions(-)
create mode 100644 lib/client/src/components/project/empty-status.vue
diff --git a/lib/client/src/components/filelib/list-card.vue b/lib/client/src/components/filelib/list-card.vue
index 60fd8925b..d3040249f 100644
--- a/lib/client/src/components/filelib/list-card.vue
+++ b/lib/client/src/components/filelib/list-card.vue
@@ -24,7 +24,10 @@
type: Array,
default: () => []
},
- isSearch: Boolean,
+ emptyType: {
+ type: String,
+ default: 'noData'
+ },
previewEnabled: Boolean,
cardWidth: Number,
cardHeight: Number,
@@ -54,6 +57,10 @@
const handleRemove = (file: UploadFile) => {
emit('remove', file)
}
+ const handlerClearSearch = (searchName) => {
+ emit('clear-search', searchName)
+ emit('search')
+ }
return {
UPLOAD_STATUS,
@@ -62,7 +69,8 @@
getFileUrl,
handleCopyLink,
handleRemove,
- handlePreview
+ handlePreview,
+ handlerClearSearch
}
}
})
@@ -122,10 +130,7 @@
-
- 未找到文件
- 暂无文件
-
+
diff --git a/lib/client/src/components/filelib/list-table.vue b/lib/client/src/components/filelib/list-table.vue
index 17ca21b40..612cd96b9 100644
--- a/lib/client/src/components/filelib/list-table.vue
+++ b/lib/client/src/components/filelib/list-table.vue
@@ -31,7 +31,10 @@
type: Array,
default: () => []
},
- isSearch: Boolean
+ emptyType: {
+ type: String,
+ default: 'noData'
+ }
},
setup (props, { emit }) {
const handleCopyLink = (file: UploadFile) => {
@@ -41,12 +44,17 @@
const handleRemove = (file: UploadFile) => {
emit('remove', file)
}
+ const handlerClearSearch = (searchName) => {
+ emit('clear-search', searchName)
+ emit('search')
+ }
return {
UPLOAD_STATUS,
getFileUrl,
formatSize,
handleCopyLink,
- handleRemove
+ handleRemove,
+ handlerClearSearch
}
}
})
@@ -116,10 +124,7 @@