After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
@ -0,0 +1,10 @@ |
|||||
|
package io.sc.engine.rule.core.enums; |
||||
|
|
||||
|
/** |
||||
|
* 定性指标补录附件类型 |
||||
|
*/ |
||||
|
public enum QualitativeAdditionAttachmentMode { |
||||
|
NONE, // 无
|
||||
|
OPTION, // 可选
|
||||
|
FORCE; // 必须
|
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package io.sc.engine.rule.core.enums; |
||||
|
|
||||
|
/** |
||||
|
* 定性指标补录组件类型 |
||||
|
*/ |
||||
|
public enum QualitativeAdditionComponentType { |
||||
|
SINGLE_LINE_TEXT, // 当行文本
|
||||
|
MULTI_LINE_TEXT, // 多行文本
|
||||
|
NUMBER, // 数值
|
||||
|
INTEGER; // 整数
|
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package io.sc.engine.rule.core.enums; |
||||
|
|
||||
|
/** |
||||
|
* 定性指标补录模式 |
||||
|
*/ |
||||
|
public enum QualitativeAdditionMode { |
||||
|
NONE, // 无
|
||||
|
OPTION, // 可选
|
||||
|
FORCE; // 必须
|
||||
|
} |
After Width: | Height: | Size: 970 B |
@ -1,14 +1,68 @@ |
|||||
package io.sc.engine.rule.server.model.vo.parameter; |
package io.sc.engine.rule.server.model.vo.parameter; |
||||
|
|
||||
import io.sc.engine.rule.core.enums.ParameterType; |
import io.sc.engine.rule.core.enums.ParameterType; |
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionAttachmentMode; |
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionMode; |
||||
import io.sc.engine.rule.server.model.vo.ParameterVo; |
import io.sc.engine.rule.server.model.vo.ParameterVo; |
||||
|
|
||||
/** |
/** |
||||
* 模型参数(输入选项) Vo 类 |
* 模型参数(输入选项) Vo 类 |
||||
*/ |
*/ |
||||
public class InOptionParameterVo extends ParameterVo { |
public class InOptionParameterVo extends ParameterVo { |
||||
|
//补录模式
|
||||
|
protected QualitativeAdditionMode additionMode; |
||||
|
//补录标题
|
||||
|
protected String additionTitle; |
||||
|
//补录描述
|
||||
|
protected String additionDescription; |
||||
|
//补录组件类型
|
||||
|
protected QualitativeAdditionComponentType additionComponentType; |
||||
|
//补录附件模式
|
||||
|
protected QualitativeAdditionAttachmentMode additionAttachmentMode; |
||||
|
|
||||
@Override |
@Override |
||||
public ParameterType getType() { |
public ParameterType getType() { |
||||
return ParameterType.IN_OPTION; |
return ParameterType.IN_OPTION; |
||||
} |
} |
||||
|
|
||||
|
public QualitativeAdditionMode getAdditionMode() { |
||||
|
return additionMode; |
||||
|
} |
||||
|
|
||||
|
public void setAdditionMode(QualitativeAdditionMode additionMode) { |
||||
|
this.additionMode = additionMode; |
||||
|
} |
||||
|
|
||||
|
public String getAdditionTitle() { |
||||
|
return additionTitle; |
||||
|
} |
||||
|
|
||||
|
public void setAdditionTitle(String additionTitle) { |
||||
|
this.additionTitle = additionTitle; |
||||
|
} |
||||
|
|
||||
|
public String getAdditionDescription() { |
||||
|
return additionDescription; |
||||
|
} |
||||
|
|
||||
|
public void setAdditionDescription(String additionDescription) { |
||||
|
this.additionDescription = additionDescription; |
||||
|
} |
||||
|
|
||||
|
public QualitativeAdditionComponentType getAdditionComponentType() { |
||||
|
return additionComponentType; |
||||
|
} |
||||
|
|
||||
|
public void setAdditionComponentType(QualitativeAdditionComponentType additionComponentType) { |
||||
|
this.additionComponentType = additionComponentType; |
||||
|
} |
||||
|
|
||||
|
public QualitativeAdditionAttachmentMode getAdditionAttachmentMode() { |
||||
|
return additionAttachmentMode; |
||||
|
} |
||||
|
|
||||
|
public void setAdditionAttachmentMode(QualitativeAdditionAttachmentMode additionAttachmentMode) { |
||||
|
this.additionAttachmentMode = additionAttachmentMode; |
||||
|
} |
||||
} |
} |
||||
|
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
@ -1,7 +1,127 @@ |
|||||
package io.sc.platform.ai.provider.anythingllm.support.workspace.streamchat.response; |
package io.sc.platform.ai.provider.anythingllm.support.workspace.streamchat.response; |
||||
|
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
|
||||
@JsonIgnoreProperties(ignoreUnknown=true) |
@JsonIgnoreProperties(ignoreUnknown=true) |
||||
public class Source { |
public class Source { |
||||
|
private String id; |
||||
|
private String url; |
||||
|
private String title; |
||||
|
private String docAuthor; |
||||
|
private String description; |
||||
|
private String docSource; |
||||
|
private String chunkSource; |
||||
|
private String published; |
||||
|
private int wordCount; |
||||
|
@JsonProperty("token_count_estimate") |
||||
|
private int tokenCountEstimate; |
||||
|
private String text; |
||||
|
@JsonProperty("_distance") |
||||
|
private double distance; |
||||
|
private double score; |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getUrl() { |
||||
|
return url; |
||||
|
} |
||||
|
|
||||
|
public void setUrl(String url) { |
||||
|
this.url = url; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() { |
||||
|
return title; |
||||
|
} |
||||
|
|
||||
|
public void setTitle(String title) { |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public String getDocAuthor() { |
||||
|
return docAuthor; |
||||
|
} |
||||
|
|
||||
|
public void setDocAuthor(String docAuthor) { |
||||
|
this.docAuthor = docAuthor; |
||||
|
} |
||||
|
|
||||
|
public String getDescription() { |
||||
|
return description; |
||||
|
} |
||||
|
|
||||
|
public void setDescription(String description) { |
||||
|
this.description = description; |
||||
|
} |
||||
|
|
||||
|
public String getDocSource() { |
||||
|
return docSource; |
||||
|
} |
||||
|
|
||||
|
public void setDocSource(String docSource) { |
||||
|
this.docSource = docSource; |
||||
|
} |
||||
|
|
||||
|
public String getChunkSource() { |
||||
|
return chunkSource; |
||||
|
} |
||||
|
|
||||
|
public void setChunkSource(String chunkSource) { |
||||
|
this.chunkSource = chunkSource; |
||||
|
} |
||||
|
|
||||
|
public String getPublished() { |
||||
|
return published; |
||||
|
} |
||||
|
|
||||
|
public void setPublished(String published) { |
||||
|
this.published = published; |
||||
|
} |
||||
|
|
||||
|
public int getWordCount() { |
||||
|
return wordCount; |
||||
|
} |
||||
|
|
||||
|
public void setWordCount(int wordCount) { |
||||
|
this.wordCount = wordCount; |
||||
|
} |
||||
|
|
||||
|
public int getTokenCountEstimate() { |
||||
|
return tokenCountEstimate; |
||||
|
} |
||||
|
|
||||
|
public void setTokenCountEstimate(int tokenCountEstimate) { |
||||
|
this.tokenCountEstimate = tokenCountEstimate; |
||||
|
} |
||||
|
|
||||
|
public String getText() { |
||||
|
return text; |
||||
|
} |
||||
|
|
||||
|
public void setText(String text) { |
||||
|
this.text = text; |
||||
|
} |
||||
|
|
||||
|
public double getDistance() { |
||||
|
return distance; |
||||
|
} |
||||
|
|
||||
|
public void setDistance(double distance) { |
||||
|
this.distance = distance; |
||||
|
} |
||||
|
|
||||
|
public double getScore() { |
||||
|
return score; |
||||
|
} |
||||
|
|
||||
|
public void setScore(double score) { |
||||
|
this.score = score; |
||||
|
} |
||||
} |
} |
||||
|
@ -0,0 +1,10 @@ |
|||||
|
package io.sc.platform.ai.util; |
||||
|
|
||||
|
import okhttp3.Call; |
||||
|
import okhttp3.Request; |
||||
|
|
||||
|
public class CallUtil { |
||||
|
public static Call newCall(Request request){ |
||||
|
return OkHttpClientUtil.build().newCall(request); |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package io.sc.platform.ai.util; |
||||
|
|
||||
|
import okhttp3.Headers; |
||||
|
|
||||
|
public class HeadersUtil { |
||||
|
|
||||
|
public static Headers stream(){ |
||||
|
Headers headers = new Headers.Builder() |
||||
|
.add("Content-Type: application/json") |
||||
|
.add("Accept: text/event-stream") |
||||
|
.build(); |
||||
|
return headers; |
||||
|
} |
||||
|
|
||||
|
public static Headers authorization(String authorization){ |
||||
|
Headers headers = new Headers.Builder() |
||||
|
.add("Content-Type: application/json") |
||||
|
.add("Authorization: Bearer " + authorization) |
||||
|
.build(); |
||||
|
return headers; |
||||
|
} |
||||
|
|
||||
|
public static Headers streamWithAuthorization(String authorization){ |
||||
|
Headers headers = new Headers.Builder() |
||||
|
.add("Content-Type: application/json") |
||||
|
.add("Accept: text/event-stream") |
||||
|
.add("Authorization: Bearer " + authorization) |
||||
|
.build(); |
||||
|
return headers; |
||||
|
} |
||||
|
|
||||
|
public static Headers json(){ |
||||
|
Headers headers = new Headers.Builder() |
||||
|
.add("Content-Type: application/json") |
||||
|
.build(); |
||||
|
return headers; |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package io.sc.platform.ai.util; |
||||
|
|
||||
|
import okhttp3.OkHttpClient; |
||||
|
|
||||
|
import java.time.Duration; |
||||
|
|
||||
|
public class OkHttpClientUtil { |
||||
|
public static OkHttpClient build(){ |
||||
|
OkHttpClient client = new OkHttpClient.Builder() |
||||
|
.connectTimeout(Duration.ofSeconds(60)) |
||||
|
.readTimeout(Duration.ofSeconds(60)) |
||||
|
.writeTimeout(Duration.ofSeconds(60)) |
||||
|
.build(); |
||||
|
client.dispatcher().setMaxRequests(64); |
||||
|
client.dispatcher().setMaxRequestsPerHost(6); |
||||
|
return client; |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package io.sc.platform.ai.util; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import io.sc.platform.util.ObjectMapperUtil; |
||||
|
import okhttp3.MediaType; |
||||
|
import okhttp3.RequestBody; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
public class RequestBodyUtil { |
||||
|
private static final Logger log = LoggerFactory.getLogger(RequestBodyUtil.class); |
||||
|
|
||||
|
public static RequestBody json(Object data){ |
||||
|
try { |
||||
|
String json = ObjectMapperUtil.json().writeValueAsString(data); |
||||
|
RequestBody body = RequestBody.create(json, MediaType.parse("application/json; charset=utf-8")); |
||||
|
return body; |
||||
|
} catch (JsonProcessingException e){ |
||||
|
log.error("",e); |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package io.sc.platform.ai.util; |
||||
|
|
||||
|
import okhttp3.Headers; |
||||
|
import okhttp3.Request; |
||||
|
import okhttp3.RequestBody; |
||||
|
|
||||
|
public class RequestUtil { |
||||
|
public static Request get(String url, Headers headers){ |
||||
|
return new okhttp3.Request.Builder() |
||||
|
.url(url) |
||||
|
.headers(headers) |
||||
|
.get() |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
public static Request post(String url, Headers headers, RequestBody body){ |
||||
|
return new okhttp3.Request.Builder() |
||||
|
.url(url) |
||||
|
.headers(headers) |
||||
|
.post(body) |
||||
|
.build(); |
||||
|
} |
||||
|
} |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
@ -1,21 +1,227 @@ |
|||||
<template> |
<template> |
||||
<w-grid |
<q-splitter :model-value="60" class="w-full" style="height: 100%"> |
||||
title="用户列表" |
<template #before> |
||||
:checkbox-selection="false" |
<div class="pr-1" style="height: 100%"> |
||||
:fetch-data-url="Environment.apiContextPath('/api/system/user')" |
<w-grid |
||||
:pageable="false" |
ref="roleGridRef" |
||||
:toolbar-actions="['query', 'reset']" |
:title="$t('system.role.grid.title')" |
||||
:query-form-fields="[{ name: 'lastModifyDate', label: $t('lastModifyDate'), type: 'w-date-range' }]" |
:config-button="true" |
||||
:columns="[ |
selection="multiple" |
||||
{ name: 'loginName', label: $t('loginName') }, |
db-click-operation="edit" |
||||
{ name: 'userName', label: $t('userName') }, |
:checkbox-selection="true" |
||||
{ |
:data-url="Environment.apiContextPath('/api/system/role')" |
||||
name: 'lastModifyDate', |
:pagination="{ |
||||
label: $t('lastModifyDate'), |
sortBy: 'name', |
||||
}, |
descending: false, |
||||
]" |
}" |
||||
></w-grid> |
:query-form-cols-num="3" |
||||
|
:query-form-fields="[ |
||||
|
{ name: 'code', label: $t('code'), type: 'w-text' }, |
||||
|
{ name: 'name', label: $t('name'), type: 'w-text' }, |
||||
|
{ name: 'enable', label: $t('isEnable'), type: 'w-select', options: Options.yesNo() }, |
||||
|
]" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
||||
|
:columns="[ |
||||
|
{ width: 200, name: 'code', label: $t('code') }, |
||||
|
{ width: '100%', name: 'name', label: $t('name') }, |
||||
|
{ width: 70, name: 'enable', label: $t('status'), align: 'center', format: Formater.enableTag() }, |
||||
|
{ |
||||
|
width: 200, |
||||
|
name: 'corporationCode', |
||||
|
label: $t('corporation'), |
||||
|
showIf: SessionManager.isPrimaryCorporation(), |
||||
|
format: (value) => { |
||||
|
return corporationMapRef[value]; |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'code', label: $t('code'), type: 'w-text', requiredIf: true }, |
||||
|
{ name: 'name', label: $t('name'), type: 'w-text', requiredIf: true }, |
||||
|
{ name: 'description', label: $t('description'), type: 'w-textarea', rows: 1 }, |
||||
|
{ |
||||
|
name: 'corporationCode', |
||||
|
label: $t('corporation'), |
||||
|
type: 'w-select', |
||||
|
options: corporationOptionRef, |
||||
|
showIf: () => { |
||||
|
return SessionManager.isPrimaryCorporation(); |
||||
|
}, |
||||
|
}, |
||||
|
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'code', label: $t('code') }, |
||||
|
{ name: 'name', label: $t('name') }, |
||||
|
{ name: 'description', label: $t('description') }, |
||||
|
{ name: 'enable', label: $t('enable'), format: Formater.none() }, |
||||
|
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
||||
|
{ name: 'creator', label: $t('creator') }, |
||||
|
{ name: 'createDate', label: $t('createDate') }, |
||||
|
{ name: 'lastModifier', label: $t('lastModifier') }, |
||||
|
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
@row-click=" |
||||
|
(args) => { |
||||
|
refreshRelationshipComponents(args.row.id); |
||||
|
} |
||||
|
" |
||||
|
@before-request-data=" |
||||
|
() => { |
||||
|
menuTreeGridRef?.clear(); |
||||
|
userGridRef?.clear(); |
||||
|
} |
||||
|
" |
||||
|
> |
||||
|
</w-grid> |
||||
|
</div> |
||||
|
</template> |
||||
|
<template #after> |
||||
|
<div class="pl-1" style="height: 100%"> |
||||
|
<q-tabs v-model="selectedTabRef" inline-label align="left" :breakpoint="0" no-caps> |
||||
|
<q-tab name="menu" icon="bi-menu-app" :label="$t('menu')" /> |
||||
|
<q-tab name="user" icon="bi-person" :label="$t('user')" /> |
||||
|
</q-tabs> |
||||
|
|
||||
|
<q-tab-panels v-model="selectedTabRef" animated swipeable keep-alive style="height: calc(100% - 48px)"> |
||||
|
<q-tab-panel name="menu" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
||||
|
<SelectMenuTreeGrid |
||||
|
ref="menuTreeGridRef" |
||||
|
:fetch-data-url="Environment.apiContextPath('/api/system/menu/listAllMenusWithSelectedStatusByRole')" |
||||
|
foreign-key="roleId" |
||||
|
:foreign-value="currentSelectedRoleId" |
||||
|
@update="update" |
||||
|
></SelectMenuTreeGrid> |
||||
|
</q-tab-panel> |
||||
|
|
||||
|
<q-tab-panel name="user" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
||||
|
<SelectUserGrid |
||||
|
ref="userGridRef" |
||||
|
:fetch-data-url="Environment.apiContextPath('/api/system/user/queryUsersByRole')" |
||||
|
:fetch-other-data-url="Environment.apiContextPath('/api/system/user/queryOtherUsersByRole')" |
||||
|
foreign-key="roleId" |
||||
|
:foreign-value="currentSelectedRoleId" |
||||
|
@select-in="selectIn" |
||||
|
@select-out="selectOut" |
||||
|
@select-all-in="selectAllIn" |
||||
|
@select-all-out="selectAllOut" |
||||
|
> |
||||
|
</SelectUserGrid> |
||||
|
</q-tab-panel> |
||||
|
</q-tab-panels> |
||||
|
</div> |
||||
|
</template> |
||||
|
</q-splitter> |
||||
</template> |
</template> |
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import { Environment, Formater, $t } from '@/platform'; |
import { ref, onActivated } from 'vue'; |
||||
|
import { Environment, axios, Options, Formater, SessionManager } from '@/platform'; |
||||
|
import SelectUserGrid from './SelectUserGrid.vue'; |
||||
|
import SelectMenuTreeGrid from './SelectMenuTreeGrid.vue'; |
||||
|
|
||||
|
const corporationMapRef = ref({}); |
||||
|
const corporationOptionRef = ref([]); |
||||
|
const roleGridRef = ref(); |
||||
|
const userGridRef = ref(); |
||||
|
const menuTreeGridRef = ref(); |
||||
|
|
||||
|
const selectedTabRef = ref('menu'); |
||||
|
const currentSelectedRoleId = ref(''); |
||||
|
|
||||
|
const refreshRelationshipComponents = (id) => { |
||||
|
currentSelectedRoleId.value = id; |
||||
|
menuTreeGridRef.value?.refresh(); |
||||
|
userGridRef.value?.refresh(); |
||||
|
}; |
||||
|
|
||||
|
const selectIn = (ids: string[], gridComponent, dialogComponent) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/role/addUsers'), { |
||||
|
one: roleGridRef.value.getSelectedRows()[0].id, |
||||
|
many: ids, |
||||
|
}) |
||||
|
.then(() => { |
||||
|
gridComponent?.refresh(); |
||||
|
dialogComponent?.close(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const selectOut = (ids, gridComponent) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/role/removeUsers'), { |
||||
|
one: roleGridRef.value.getSelectedRows()[0].id, |
||||
|
many: ids, |
||||
|
}) |
||||
|
.then(() => { |
||||
|
gridComponent?.refresh(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const selectAllIn = (gridComponent) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/role/addAllUsers'), { |
||||
|
one: roleGridRef.value.getSelectedRows()[0].id, |
||||
|
many: [], |
||||
|
}) |
||||
|
.then(() => { |
||||
|
gridComponent?.refresh(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const selectAllOut = (gridComponent) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/role/removeAllUsers'), { |
||||
|
one: roleGridRef.value.getSelectedRows()[0].id, |
||||
|
many: [], |
||||
|
}) |
||||
|
.then(() => { |
||||
|
gridComponent?.refresh(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const update = (ids, gridComponent) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/role/updateMenus'), { |
||||
|
one: roleGridRef.value.getSelectedRows()[0].id, |
||||
|
many: ids, |
||||
|
}) |
||||
|
.then(() => { |
||||
|
gridComponent.refresh(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
onActivated(() => { |
||||
|
menuTreeGridRef.value?.refresh(); |
||||
|
userGridRef.value?.refresh(); |
||||
|
if (SessionManager.isPrimaryCorporation()) { |
||||
|
axios.get(Environment.apiContextPath('/api/system/corporation?pageable=false')).then((response) => { |
||||
|
const options = []; |
||||
|
const corporationMap = {}; |
||||
|
if (response.data?.content && response.data?.content.length > 0) { |
||||
|
for (const item of response.data.content) { |
||||
|
options.push({ label: item.name, value: item.code }); |
||||
|
corporationMap[item.code] = item.name; |
||||
|
} |
||||
|
} |
||||
|
corporationOptionRef.value = options; |
||||
|
corporationMapRef.value = corporationMap; |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
</script> |
</script> |
||||
|
@ -0,0 +1,125 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="treeGridRef" |
||||
|
:title="$t('system.shared.selectMenu.grid.title')" |
||||
|
hide-bottom |
||||
|
:config-button="false" |
||||
|
:tree="true" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="true" |
||||
|
tree-tick-strategy="strict" |
||||
|
:tree-icon=" |
||||
|
(row) => { |
||||
|
if (row.type === 'SEPARATOR') { |
||||
|
return { name: 'bi-dash-lg' }; |
||||
|
} else if (row.type === 'ROUTE_ACTION') { |
||||
|
return { name: 'sym_o_crop_16_9' }; |
||||
|
} else { |
||||
|
return { name: row.icon }; |
||||
|
} |
||||
|
} |
||||
|
" |
||||
|
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue" |
||||
|
:auto-fetch-data="true" |
||||
|
:pageable="false" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
{ |
||||
|
extend: 'expand', |
||||
|
enableIf: () => { |
||||
|
return foreignValue && treeGridRef?.getRows()?.length > 0; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'save', |
||||
|
label: $t('save'), |
||||
|
icon: 'bi-floppy', |
||||
|
enableIf: () => { |
||||
|
return foreignValue && treeGridRef?.getRows()?.length > 0; |
||||
|
}, |
||||
|
click: (arg) => { |
||||
|
DialogManager.confirm($t('system.shared.selectMenu.grid.toolbar.save.tip'), () => { |
||||
|
const ids = Tools.extractProperties(treeGridRef.getTickedRows(true), 'id'); |
||||
|
emit('update', ids, treeGridRef); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
'separator', |
||||
|
'view', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ |
||||
|
width: '100%', |
||||
|
name: 'titleI18nKey', |
||||
|
label: $t('name'), |
||||
|
sortable: false, |
||||
|
format: (value, row) => { |
||||
|
if (row.type === 'SEPARATOR') { |
||||
|
return `<hr style='width:100px'/>`; |
||||
|
} else if (row.type === 'ROUTE_ACTION') { |
||||
|
return $t(row.i18nKey); |
||||
|
} else { |
||||
|
return $t(value); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ width: 70, name: 'enable', label: $t('status'), format: Formater.enableTag(), sortable: false }, |
||||
|
]" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'type', label: $t('type') }, |
||||
|
{ name: 'name', label: $t('name') }, |
||||
|
{ name: 'titleI18nKey', label: $t('titleI18nKey') }, |
||||
|
{ name: 'icon', label: $t('icon') }, |
||||
|
{ name: 'enable', label: $t('enable') }, |
||||
|
{ name: 'order', label: $t('order') }, |
||||
|
{ name: 'javaScript', label: $t('javaScript') }, |
||||
|
{ name: 'url', label: $t('url') }, |
||||
|
{ name: 'urlOpenType', label: $t('urlOpenType') }, |
||||
|
{ name: 'routeName', label: $t('routeName') }, |
||||
|
{ name: 'routeQuery', label: $t('routeQuery') }, |
||||
|
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
||||
|
{ name: 'creator', label: $t('creator') }, |
||||
|
{ name: 'createDate', label: $t('createDate') }, |
||||
|
{ name: 'lastModifier', label: $t('lastModifier') }, |
||||
|
{ name: 'lastModifyDate', label: $t('lastModifyDate') }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
></w-grid> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { DialogManager, Formater, Tools } from '@/platform'; |
||||
|
|
||||
|
defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
foreignKey: { type: String, default: '' }, |
||||
|
foreignValue: { type: String, default: '' }, |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'update', ids: string[], gridComponent: any): void; |
||||
|
}>(); |
||||
|
|
||||
|
const treeGridRef = ref(); |
||||
|
|
||||
|
const refresh = () => { |
||||
|
treeGridRef.value?.refresh(); |
||||
|
}; |
||||
|
|
||||
|
const clear = () => { |
||||
|
treeGridRef.value?.setLocalData([]); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
clear, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,165 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
:title="$t('system.shared.selectUser.grid.title')" |
||||
|
:config-button="false" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="true" |
||||
|
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue" |
||||
|
:auto-fetch-data="true" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
{ |
||||
|
name: 'selectIn', |
||||
|
label: $t('system.shared.selectUser.grid.toolbar.selectIn'), |
||||
|
icon: 'bi-download', |
||||
|
enableIf: () => { |
||||
|
return foreignValue ? true : false; |
||||
|
}, |
||||
|
click: () => { |
||||
|
dialogRef.open(foreignValue); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'selectOut', |
||||
|
label: $t('system.shared.selectUser.grid.toolbar.selectOut'), |
||||
|
icon: 'bi-upload', |
||||
|
enableIf: () => { |
||||
|
return foreignValue && gridRef?.getSelectedRows()?.length > 0; |
||||
|
}, |
||||
|
click: (arg) => { |
||||
|
const ids = Tools.extractProperties(arg.selecteds, 'id'); |
||||
|
DialogManager.confirm($t('system.shared.selectUser.grid.toolbar.selectOut.tip'), () => { |
||||
|
emit('selectOut', ids, gridRef); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
'separator', |
||||
|
{ |
||||
|
name: 'selectAllIn', |
||||
|
label: $t('system.shared.selectUser.grid.toolbar.selectAllIn'), |
||||
|
icon: 'bi-box-arrow-in-down', |
||||
|
enableIf: () => { |
||||
|
return foreignValue ? true : false; |
||||
|
}, |
||||
|
click: () => { |
||||
|
DialogManager.confirm($t('system.shared.selectUser.grid.toolbar.selectAllIn.tip'), () => { |
||||
|
emit('selectAllIn', gridRef); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'selectAllOut', |
||||
|
label: $t('system.shared.selectUser.grid.toolbar.selectAllOut'), |
||||
|
icon: 'bi-box-arrow-up', |
||||
|
enableIf: () => { |
||||
|
return foreignValue && gridRef?.getRows()?.length > 0; |
||||
|
}, |
||||
|
click: () => { |
||||
|
DialogManager.confirm($t('system.shared.selectUser.grid.toolbar.selectAllOut.tip'), () => { |
||||
|
emit('selectAllOut', gridRef); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
'separator', |
||||
|
'view', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ width: 150, name: 'loginName', label: $t('loginName') }, |
||||
|
{ width: '100%', name: 'userName', label: $t('userName') }, |
||||
|
{ |
||||
|
width: 150, |
||||
|
name: 'enable', |
||||
|
label: $t('status'), |
||||
|
format: (value, row) => { |
||||
|
return { |
||||
|
componentType: UserStatusTag, |
||||
|
attrs: row, |
||||
|
}; |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'loginName', label: $t('loginName') }, |
||||
|
{ name: 'userName', label: $t('userName') }, |
||||
|
{ name: 'description', label: $t('description') }, |
||||
|
{ |
||||
|
name: 'enable', |
||||
|
label: $t('enable'), |
||||
|
format: (value) => { |
||||
|
return value; |
||||
|
}, |
||||
|
}, |
||||
|
{ name: 'accountExpired', label: $t('accountExpired') }, |
||||
|
{ name: 'accountLocked', label: $t('accountLocked') }, |
||||
|
{ name: 'credentialsExpired', label: $t('credentialsExpired') }, |
||||
|
{ name: 'email', label: $t('email') }, |
||||
|
{ name: 'phone', label: $t('phone') }, |
||||
|
{ name: 'mobile', label: $t('mobile') }, |
||||
|
{ name: 'weixin', label: $t('weixin') }, |
||||
|
{ name: 'qq', label: $t('qq') }, |
||||
|
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
||||
|
{ name: 'creator', label: $t('creator') }, |
||||
|
{ name: 'createDate', label: $t('createDate') }, |
||||
|
{ name: 'lastModifier', label: $t('lastModifier') }, |
||||
|
{ name: 'lastModifyDate', label: $t('lastModifyDate') }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
></w-grid> |
||||
|
<SelectUserDialog |
||||
|
ref="dialogRef" |
||||
|
:opener="gridRef" |
||||
|
:fetch-data-url="fetchOtherDataUrl" |
||||
|
:foreign-key="foreignKey" |
||||
|
:foreign-value="foreignValue" |
||||
|
@after-selected=" |
||||
|
(ids: string[]) => { |
||||
|
emit('selectIn', ids, gridRef, dialogRef); |
||||
|
} |
||||
|
" |
||||
|
></SelectUserDialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { DialogManager, Tools } from '@/platform'; |
||||
|
import SelectUserDialog from './SelectUserDialog.vue'; |
||||
|
import UserStatusTag from './UserStatusTag.vue'; |
||||
|
|
||||
|
defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
fetchOtherDataUrl: { type: String, default: '' }, |
||||
|
foreignKey: { type: String, default: '' }, |
||||
|
foreignValue: { type: String, default: '' }, |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'selectIn', ids: string[], gridComponent: any, dialogComponent: any): void; |
||||
|
(e: 'selectOut', ids: string[], gridComponent: any): void; |
||||
|
(e: 'selectAllIn', gridComponent: any): void; |
||||
|
(e: 'selectAllOut', gridComponent: any): void; |
||||
|
}>(); |
||||
|
|
||||
|
const gridRef = ref(); |
||||
|
const dialogRef = ref(); |
||||
|
|
||||
|
const refresh = () => { |
||||
|
gridRef.value?.refresh(); |
||||
|
}; |
||||
|
|
||||
|
const clear = () => { |
||||
|
gridRef.value?.setLocalData([]); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
clear, |
||||
|
}); |
||||
|
</script> |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
After Width: | Height: | Size: 970 B |
@ -0,0 +1,10 @@ |
|||||
|
package io.sc.platform.util; |
||||
|
|
||||
|
/** |
||||
|
* 三元操作辅助类 |
||||
|
*/ |
||||
|
public class TernaryUtil { |
||||
|
public static <T> T nullValue(T value, T nullValue){ |
||||
|
return value==null?nullValue:value; |
||||
|
} |
||||
|
} |
After Width: | Height: | Size: 970 B |