添加修改性格
This commit is contained in:
parent
298967f661
commit
f21e0bb29a
4
admin-client/src/components.d.ts
vendored
4
admin-client/src/components.d.ts
vendored
|
|
@ -22,6 +22,8 @@ declare module 'vue' {
|
|||
ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
|
||||
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
|
||||
ACol: typeof import('ant-design-vue/es')['Col']
|
||||
ACollapse: typeof import('ant-design-vue/es')['Collapse']
|
||||
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
|
||||
ADatePicker: typeof import('ant-design-vue/es')['DatePicker']
|
||||
ADescriptions: typeof import('ant-design-vue/es')['Descriptions']
|
||||
ADescriptionsItem: typeof import('ant-design-vue/es')['DescriptionsItem']
|
||||
|
|
@ -70,6 +72,7 @@ declare module 'vue' {
|
|||
ATimeline: typeof import('ant-design-vue/es')['Timeline']
|
||||
ATimelineItem: typeof import('ant-design-vue/es')['TimelineItem']
|
||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||
ATransfer: typeof import('ant-design-vue/es')['Transfer']
|
||||
ATree: typeof import('ant-design-vue/es')['Tree']
|
||||
ATreeSelect: typeof import('ant-design-vue/es')['TreeSelect']
|
||||
ATypographyLink: typeof import('ant-design-vue/es')['TypographyLink']
|
||||
|
|
@ -108,6 +111,7 @@ declare module 'vue' {
|
|||
TableCurd: typeof import('./core/components/curd/TableCurd.vue')['default']
|
||||
TagCharacters: typeof import('./core/components/characters/tag-characters.vue')['default']
|
||||
TenantSelect: typeof import('./core/components/curd/select-components/TenantSelect.vue')['default']
|
||||
TypesCharacters: typeof import('./core/components/characters/types-characters.vue')['default']
|
||||
WangEditor: typeof import('./core/components/WangEditor.vue')['default']
|
||||
}
|
||||
}
|
||||
|
|
|
|||
146
admin-client/src/core/components/characters/types-characters.vue
Normal file
146
admin-client/src/core/components/characters/types-characters.vue
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
<script setup lang="ts">
|
||||
import AppDictionaryCache from "@/core/utils/AppDictionaryCache";
|
||||
import T_Character_Personality_RelationService from "@/services/apps/T_Character_Personality_Relations/T_Character_Personality_RelationService";
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
record: any;
|
||||
color: string;
|
||||
}>(),
|
||||
{
|
||||
color: "blue",
|
||||
}
|
||||
);
|
||||
const emits = defineEmits<{
|
||||
(e: "del"): void;
|
||||
}>();
|
||||
|
||||
const open = ref<boolean>(false);
|
||||
const showModal = async () => {
|
||||
const _data = await AppDictionaryCache.appDictionaryTypesCache.getDataList();
|
||||
const mData = [];
|
||||
const keys = [];
|
||||
_data.forEach((item, index) => {
|
||||
const data = {
|
||||
key: item.value,
|
||||
title: item.name,
|
||||
description: item.code,
|
||||
};
|
||||
// console.log(props.record.personas.filter(it=> it.value == item.value));
|
||||
|
||||
if (
|
||||
props.record.personas.filter((it) => it.value == item.value).length > 0
|
||||
) {
|
||||
console.log("添加", data);
|
||||
|
||||
keys.push(data.key);
|
||||
}
|
||||
// if()
|
||||
mData.push(data);
|
||||
});
|
||||
console.log(props.record);
|
||||
|
||||
mockData.value = mData;
|
||||
targetKeys.value = keys;
|
||||
console.log(mockData.value, targetKeys.value);
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async (e: MouseEvent) => {
|
||||
console.log(e);
|
||||
console.log(targetKeys.value);
|
||||
await T_Character_Personality_RelationService.setCharacterPersonality(
|
||||
props.record.id,
|
||||
targetKeys.value
|
||||
);
|
||||
props.personas = mockData.value
|
||||
.filter((it) => targetKeys.value.includes(it.value))
|
||||
.map((item) => {
|
||||
return {
|
||||
name: item.title,
|
||||
code: item.description,
|
||||
value: item.key,
|
||||
};
|
||||
});
|
||||
|
||||
// setCharacterPersonality
|
||||
open.value = false;
|
||||
};
|
||||
|
||||
interface MockData {
|
||||
key: number;
|
||||
title: string;
|
||||
description: string;
|
||||
chosen: boolean;
|
||||
}
|
||||
// {
|
||||
// "page": 1,
|
||||
// "size": 50,
|
||||
// "search": {},
|
||||
// "searchSort": []
|
||||
// }
|
||||
// T_Character_Personality_RelationService.findList(1,999,{},{});
|
||||
|
||||
const mockData = ref<MockData[]>([]);
|
||||
|
||||
const targetKeys = ref<number[]>([]);
|
||||
// onMounted(() => {
|
||||
// getMock();
|
||||
// });
|
||||
const getMock = () => {
|
||||
const keys = [];
|
||||
const mData = [];
|
||||
for (let i = 0; i < 20; i++) {
|
||||
const data = {
|
||||
key: i.toString(),
|
||||
title: `content${i + 1}`,
|
||||
description: `description of content${i + 1}`,
|
||||
chosen: Math.random() * 2 > 1,
|
||||
};
|
||||
if (data.chosen) {
|
||||
keys.push(data.key);
|
||||
}
|
||||
mData.push(data);
|
||||
}
|
||||
mockData.value = mData;
|
||||
targetKeys.value = keys;
|
||||
};
|
||||
const handleChange = (
|
||||
keys: number[],
|
||||
direction: string,
|
||||
moveKeys: string[]
|
||||
) => {
|
||||
console.log(keys, direction, moveKeys);
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<a-button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="width: 60px; height: 22px; font-size: 12px"
|
||||
@click="showModal"
|
||||
>添加性格</a-button
|
||||
>
|
||||
<a-modal
|
||||
v-model:open="open"
|
||||
title="性格管理"
|
||||
@ok="handleOk"
|
||||
width="800px"
|
||||
:maskClosable="false"
|
||||
>
|
||||
<a-transfer
|
||||
v-model:target-keys="targetKeys"
|
||||
:data-source="mockData"
|
||||
:list-style="{
|
||||
width: '300px',
|
||||
height: '300px',
|
||||
}"
|
||||
@change="handleChange"
|
||||
>
|
||||
<template #render="item">
|
||||
<span class="custom-item"
|
||||
>{{ item.title }} - {{ item.description }}</span
|
||||
>
|
||||
</template>
|
||||
</a-transfer>
|
||||
</a-modal>
|
||||
</template>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -1,19 +1,17 @@
|
|||
<template>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
||||
|
||||
<a-input
|
||||
v-model:value="props.modelValue"
|
||||
placeholder="请输入"
|
||||
|
||||
placeholder="请选择或者输入图片Id"
|
||||
@change="updateValue"
|
||||
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-select
|
||||
v-model:value="value"
|
||||
show-search
|
||||
placeholder="输入图片名称查找图片"
|
||||
style="width: 200px"
|
||||
:default-active-first-option="false"
|
||||
:show-arrow="false"
|
||||
:filter-option="false"
|
||||
|
|
@ -23,8 +21,18 @@
|
|||
@change="handleChange"
|
||||
></a-select>
|
||||
</a-col>
|
||||
<a-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
|
||||
<a-button type="primary">上传</a-button>
|
||||
|
||||
<a-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4" >
|
||||
<a-button type="primary" @click="fileupload">上传</a-button>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" style="margin-top:10px">
|
||||
<a-collapse>
|
||||
<a-collapse-panel key="1" header="预览图片">
|
||||
<p>
|
||||
<a-image :src="TImageConfigService.getImageUrl(props.modelValue)" />
|
||||
</p>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
|
@ -35,9 +43,7 @@ import type { SelectProps } from "ant-design-vue";
|
|||
import AppDictionaryCache from "@/core/utils/AppDictionaryCache";
|
||||
import type { SelectValue } from "ant-design-vue/lib/select";
|
||||
import TImageConfigService from "@/services/apps/T_Image_Configs/TImageConfigService";
|
||||
// 定义 options
|
||||
const options = ref<SelectProps["options"]>([]);
|
||||
|
||||
import Tools from "@/core/utils/Tools";
|
||||
// 使用 withDefaults 添加默认值
|
||||
const props = defineProps<{
|
||||
modelValue: number;
|
||||
|
|
@ -57,10 +63,24 @@ const emits = defineEmits(["update:modelValue"]);
|
|||
// });
|
||||
|
||||
// 定义方法以触发 update:modelValue 事件
|
||||
function updateValue(value: number) {
|
||||
emits("update:modelValue", value);
|
||||
function updateValue(event: any) {
|
||||
console.log(event);
|
||||
|
||||
emits("update:modelValue", event.target.value);
|
||||
}
|
||||
|
||||
function updateValueNumber(event: number) {
|
||||
|
||||
|
||||
emits("update:modelValue", event);
|
||||
}
|
||||
|
||||
async function fileupload() {
|
||||
const response = await Tools.imageFileUpload(0, 1);
|
||||
console.log(response);
|
||||
updateValueNumber(response.imageId);
|
||||
|
||||
}
|
||||
let timeout: any;
|
||||
let currentValue = "";
|
||||
|
||||
|
|
@ -72,11 +92,6 @@ function fetch(value: string, callback: any) {
|
|||
currentValue = value;
|
||||
|
||||
function fake() {
|
||||
// const params = new URLSearchParams({
|
||||
// code: "utf-8",
|
||||
// q: value,
|
||||
// });
|
||||
|
||||
TImageConfigService.getImageList(value).then((res) => {
|
||||
if (res.data != null) {
|
||||
const data: any[] = [];
|
||||
|
|
@ -90,22 +105,6 @@ function fetch(value: string, callback: any) {
|
|||
callback(data);
|
||||
}
|
||||
});
|
||||
|
||||
// fetch(`https://suggest.taobao.com/sug?${params}`)
|
||||
// .then((response) => response.json())
|
||||
// .then((d) => {
|
||||
// if (currentValue === value) {
|
||||
// const result = d.result;
|
||||
// const data: any[] = [];
|
||||
// result.forEach((r: any) => {
|
||||
// data.push({
|
||||
// value: r[0],
|
||||
// label: r[0],
|
||||
// });
|
||||
// });
|
||||
// callback(data);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
timeout = setTimeout(fake, 300);
|
||||
|
|
@ -119,9 +118,10 @@ const handleSearch = (val: string) => {
|
|||
};
|
||||
const handleChange = (val: number) => {
|
||||
console.log(val);
|
||||
// updateValue(val);
|
||||
// props.modelValue = 1;
|
||||
// value.value = "";
|
||||
updateValueNumber(val);
|
||||
// emits("update:modelValue", val);
|
||||
// props.modelValue = 1;
|
||||
// value.value = "";
|
||||
// fetch(val, (d: any[]) => (data.value = d));
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import AppDictionaryImageCache from "./cache/AppDictionaryImageCache";
|
||||
import { AbstractDictionaryCache } from "./cache/AbstractDictionaryCache";
|
||||
import AppDictionaryTenantCache from "./cache/AppDictionaryTenantCache";
|
||||
|
||||
import AppDictionaryTypesCache from "./cache/AppDictionaryTypesCache";
|
||||
/**
|
||||
* 基础数据缓存类
|
||||
*/
|
||||
|
|
@ -16,6 +16,11 @@ class AppDictionaryCache {
|
|||
* 多租户配置
|
||||
*/
|
||||
static appDictionaryTenantCache: AbstractDictionaryCache = new AppDictionaryTenantCache();
|
||||
|
||||
/**
|
||||
* 类型配置
|
||||
*/
|
||||
static appDictionaryTypesCache: AbstractDictionaryCache = new AppDictionaryTypesCache();
|
||||
}
|
||||
|
||||
export default AppDictionaryCache;
|
||||
|
|
|
|||
41
admin-client/src/core/utils/cache/AppDictionaryTypesCache.ts
vendored
Normal file
41
admin-client/src/core/utils/cache/AppDictionaryTypesCache.ts
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { AbstractDictionaryCache } from './AbstractDictionaryCache'
|
||||
import { DefaultOptionType } from "ant-design-vue/es/select";
|
||||
import T_Character_PersonalityService from "@/services/apps/T_Character_Personalitys/T_Character_PersonalityService";
|
||||
/**
|
||||
* 多租户配置
|
||||
*/
|
||||
class AppDictionaryTypesCache extends AbstractDictionaryCache {
|
||||
protected code: string = "types";
|
||||
public static _lock: Promise<void> | null = null;
|
||||
constructor() {
|
||||
super(AppDictionaryTypesCache._lock);
|
||||
}
|
||||
/**
|
||||
* 获取字典服务
|
||||
* @returns Promise<any>
|
||||
*/
|
||||
protected override async getSysDictionaryService(): Promise<any> {
|
||||
const response = await T_Character_PersonalityService.findList(1, 9999, {}, []);
|
||||
// console.log(response);
|
||||
const _data = response.data.dataSource.map(item => {
|
||||
return {
|
||||
name: item.name,
|
||||
value: item.id,
|
||||
code: item.value
|
||||
// name: item.name, value, code: item.code
|
||||
};
|
||||
});
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
public async getDataListSelect(): Promise<DefaultOptionType[]> {
|
||||
const _data = await this.getDataList();
|
||||
return _data.map((item) => {
|
||||
return { label: item.name, value: item.value, name: item.code, } as DefaultOptionType;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default AppDictionaryTypesCache;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
export default class T_CharacterService {
|
||||
|
||||
static urlPrefix = "/api/v1/admin/T_Character";
|
||||
static url:string = Http.baseURL + "/api/v1/admin/TImageConfig/image/";
|
||||
static url: string = Http.baseURL + "/api/v1/admin/TImageConfig/image/";
|
||||
/**
|
||||
* 获取数据列表
|
||||
* @param current
|
||||
|
|
@ -55,6 +55,18 @@ export default class T_CharacterService {
|
|||
return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param id
|
||||
* @param v
|
||||
* @returns
|
||||
*/
|
||||
static async setVisibility(id: number | undefined, v: boolean | undefined) {
|
||||
return await Http.post(`${this.urlPrefix}/updateState/${id}/${(v == true ? "1" : "0")}`)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出 excel
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
export default class TImageConfigService {
|
||||
static urlPrefix = "/api/v1/admin/TImageConfig";
|
||||
|
||||
static baseUrl = Http.baseURL + this.urlPrefix + "/image/";
|
||||
/**
|
||||
* 获取数据列表
|
||||
* @param current
|
||||
|
|
@ -109,6 +109,19 @@ export default class TImageConfigService {
|
|||
* @returns
|
||||
*/
|
||||
static getImageList(name?: string | undefined) {
|
||||
return Http.get(`${this.urlPrefix}/getImageList?name=${escape(name??"")}`);
|
||||
return Http.get(`${this.urlPrefix}/getImageList?name=${name}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图片数据源
|
||||
*
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
static getImageUrl(imageId?: number | undefined) {
|
||||
if (imageId == null) {
|
||||
return "";
|
||||
}
|
||||
return this.baseUrl + imageId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@ export default class T_Character_Personality_RelationService {
|
|||
return Http.post(`${this.urlPrefix}/deleteList`, ids)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除集合数据
|
||||
*
|
||||
* @param ids
|
||||
* @returns
|
||||
*/
|
||||
static delete(id: number,ids: string[]) {
|
||||
return Http.post(`${this.urlPrefix}/deleteCIdList/${id}`, ids)
|
||||
}
|
||||
/**
|
||||
* 查询表单
|
||||
*
|
||||
|
|
@ -70,5 +79,13 @@ export default class T_Character_Personality_RelationService {
|
|||
searchSort
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量配置角色性格
|
||||
* @param id 角色id
|
||||
* @param ids 性格类型
|
||||
* @returns
|
||||
*/
|
||||
static async setCharacterPersonality(id: number, ids: any[]) {
|
||||
return Http.post(`${this.urlPrefix}/setCharacterPersonality/${id}`, ids)
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import T_Character_Personality_RelationService from "@/services/apps/T_Character
|
|||
import T_Character_Type_IntimacyService from "@/services/apps/T_Character_Type_Intimacys/T_Character_Type_IntimacyService";
|
||||
//标签
|
||||
import T_Character_Label_RelationService from "@/services/apps/T_Character_Label_Relations/T_Character_Label_RelationService";
|
||||
|
||||
|
||||
defineOptions({ name: "T_CharacterIndex" });
|
||||
|
||||
|
|
@ -287,7 +288,7 @@ async function lablesDel(e: any, record: any) {
|
|||
* 删除关联的性格数据
|
||||
*/
|
||||
async function personasDel(e: any, record: any) {
|
||||
const _request = await T_Character_Personality_RelationService.deleteList([
|
||||
const _request = await T_Character_Personality_RelationService.delete(record.id,[
|
||||
e.value,
|
||||
]);
|
||||
if (_request.data) {
|
||||
|
|
@ -298,6 +299,13 @@ async function personasDel(e: any, record: any) {
|
|||
Tools.message.error("删除失败!");
|
||||
}
|
||||
//#endregion
|
||||
|
||||
async function visibilityChange(id:number,visibility:boolean,record:any){
|
||||
var response= await T_CharacterService.setVisibility(id,visibility);
|
||||
console.log(visibility,response);
|
||||
// record.visibility=visibility;
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -532,7 +540,7 @@ async function personasDel(e: any, record: any) {
|
|||
@del="personasDel(item, record)"
|
||||
/>
|
||||
</template>
|
||||
<a-button type="primary" size="small" >添加</a-button>
|
||||
<!-- <types-characters :record="record" /> -->
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
|
|
@ -548,6 +556,7 @@ async function personasDel(e: any, record: any) {
|
|||
v-model:checked="record.visibility"
|
||||
checked-children="上线"
|
||||
un-checked-children="下线"
|
||||
@change="visibilityChange(record.id,record.visibility,record)"
|
||||
/>
|
||||
</template>
|
||||
</a-table-column>
|
||||
|
|
@ -575,6 +584,7 @@ async function personasDel(e: any, record: any) {
|
|||
>
|
||||
<a-tag style="cursor: pointer" color="#f50">删除</a-tag>
|
||||
</a-popconfirm>
|
||||
<types-characters v-if="power.update" :record="record" />
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -140,9 +140,7 @@ function save() {
|
|||
name="bgImg"
|
||||
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
|
||||
>
|
||||
<hm-image v-model:value="state.vm.form.bgImg" />
|
||||
<a-input v-model:value="state.vm.form.bgImg" placeholder="请输入"
|
||||
/>
|
||||
<hm-image v-model="state.vm.form.bgImg" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
|
|
@ -151,18 +149,12 @@ function save() {
|
|||
name="iconImg"
|
||||
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="state.vm.form.iconImg"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
<hm-image v-model="state.vm.form.iconImg" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
||||
<a-form-item
|
||||
label="对话名字(用户的名字)"
|
||||
name="userName"
|
||||
>
|
||||
<a-form-item label="对话名字(用户的名字)" name="userName">
|
||||
<a-input
|
||||
v-model:value="state.vm.form.userName"
|
||||
placeholder="请输入"
|
||||
|
|
@ -172,7 +164,8 @@ function save() {
|
|||
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
||||
<a-form-item label="对话性别(用户的性别)" name="userSex">
|
||||
<a-input
|
||||
v-model:value="state.vm.form.userSex" placeholder="请输入"
|
||||
v-model:value="state.vm.form.userSex"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
|
@ -207,7 +200,10 @@ function save() {
|
|||
</a-col>
|
||||
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<a-form-item label="system最大的token数(非必填,会自定生成)" name="token">
|
||||
<a-form-item
|
||||
label="system最大的token数(非必填,会自定生成)"
|
||||
name="token"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="state.vm.form.token"
|
||||
placeholder="请输入"
|
||||
|
|
|
|||
|
|
@ -65,18 +65,18 @@ public class T_CharacterService(
|
|||
).Select(l => new
|
||||
{
|
||||
Name = l.LabelName,
|
||||
Code = l.LabelValue?? l.LabelName,
|
||||
Code = l.LabelValue ?? l.LabelName,
|
||||
Value = l.Id
|
||||
}).ToList(),
|
||||
//分类
|
||||
Types =
|
||||
Types =
|
||||
T_Character_Type.Select.Where(t =>
|
||||
T_Character_Type_Intimacy.Select.Any(tt => tt.CharacterId == w.Id && tt.TypeId == t.Id)
|
||||
)
|
||||
.Select(t => new
|
||||
{
|
||||
Name = t.Name,
|
||||
Code = t.Name ,
|
||||
Code = t.Name,
|
||||
Value = t.Id
|
||||
}).ToList(),
|
||||
//性格
|
||||
|
|
@ -87,7 +87,7 @@ public class T_CharacterService(
|
|||
.Select(p => new
|
||||
{
|
||||
Name = p.Name,
|
||||
Code =p.Value??p.Name,
|
||||
Code = p.Value ?? p.Name,
|
||||
Value = p.Id
|
||||
}).ToList(),
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public class T_CharacterService(
|
|||
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
|
||||
var imageIds = new List<int>();
|
||||
var characteIds = new List<int>();
|
||||
|
||||
|
||||
result.DataSource.ForEach(it =>
|
||||
{
|
||||
characteIds.Add(int.Parse(it["Id"]?.ToString() ?? "0"));
|
||||
|
|
@ -118,7 +118,7 @@ public class T_CharacterService(
|
|||
|
||||
});
|
||||
var imageList = imageRepository.GetAllList(it => imageIds.Contains(it.ImageId));
|
||||
|
||||
|
||||
|
||||
result.DataSource.ForEach(it =>
|
||||
{
|
||||
|
|
@ -199,6 +199,25 @@ public class T_CharacterService(
|
|||
return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改状态
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<bool> UpdateState(bool state, int id)
|
||||
{
|
||||
var form = await this._defaultRepository.FindByIdAsync(id);
|
||||
if (form == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
form.Visibility = state;
|
||||
await SaveFormAsync(form);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
using IdGen;
|
||||
|
||||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
|
||||
using NPOI.HSSF.Record.Chart;
|
||||
namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -20,20 +24,24 @@ public class T_Character_Personality_RelationService : ApplicationService<IRepos
|
|||
public async Task<PagingView> FindListAsync(PagingSearchInput<T_Character_Personality_Relation> pagingSearchInput)
|
||||
{
|
||||
var query = this._defaultRepository.Select
|
||||
|
||||
//项目
|
||||
.WhereIf(pagingSearchInput.Search?.TenantId!=null,
|
||||
w => w.TenantId==pagingSearchInput.Search.TenantId)
|
||||
|
||||
|
||||
|
||||
//项目
|
||||
.WhereIf(pagingSearchInput.Search?.TenantId != null,
|
||||
w => w.TenantId == pagingSearchInput.Search.TenantId)
|
||||
.WhereIf(pagingSearchInput.Search?.CharacterId != 0,
|
||||
w => w.CharacterId == pagingSearchInput.Search.CharacterId)
|
||||
|
||||
|
||||
.OrderByDescending(w => w.Id)
|
||||
.Select(w => new
|
||||
{
|
||||
w.Id,
|
||||
w.TenantId,w.PersonalityId,w.CharacterId,w.CreateTime,
|
||||
// w.LastModificationTime,
|
||||
// w.CreationTime
|
||||
w.TenantId,
|
||||
w.PersonalityId,
|
||||
w.CharacterId,
|
||||
w.CreateTime,
|
||||
// w.LastModificationTime,
|
||||
// w.CreationTime
|
||||
})
|
||||
;
|
||||
|
||||
|
|
@ -59,12 +67,24 @@ public class T_Character_Personality_RelationService : ApplicationService<IRepos
|
|||
await this._defaultRepository.DeleteByIdsAsync(ids);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据id数组删除
|
||||
/// </summary>
|
||||
/// <param name="ids">ids</param>
|
||||
/// <returns></returns>
|
||||
public async Task DeleteListAsync(int id,List<int> ids)
|
||||
{
|
||||
var list = await this._defaultRepository.Select.Where(it=>it.CharacterId==id&& ids.Contains(it.PersonalityId)).ToListAsync();
|
||||
await this._defaultRepository.DeleteAsync(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询表单数据
|
||||
/// </summary>
|
||||
/// <param name="id">id</param>
|
||||
/// <returns></returns>
|
||||
public async Task<Dictionary<string,object>> FindFormAsync(int id)
|
||||
public async Task<Dictionary<string, object>> FindFormAsync(int id)
|
||||
{
|
||||
var res = new Dictionary<string, object>();
|
||||
var form = await this._defaultRepository.FindByIdAsync(id);
|
||||
|
|
@ -92,6 +112,34 @@ public class T_Character_Personality_RelationService : ApplicationService<IRepos
|
|||
return this._defaultRepository.InsertOrUpdateAsync(form);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="form">form</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> SaveFormAsync(int characterId, List<int> ids)
|
||||
{
|
||||
var list = await this._defaultRepository.Select.Where(it => it.CharacterId == characterId).ToListAsync();
|
||||
await this._defaultRepository.DeleteAsync(list);
|
||||
List<T_Character_Personality_Relation> newList = new List<T_Character_Personality_Relation>();
|
||||
foreach (var personalityId in ids)
|
||||
{
|
||||
var t_Character_Personality_Relation = new T_Character_Personality_Relation
|
||||
{
|
||||
CharacterId = characterId,
|
||||
CreateTime = DateTime.Now,
|
||||
PersonalityId = personalityId,
|
||||
TenantId = Guid.Empty,
|
||||
};
|
||||
//this._defaultRepository.Insert(t_Character_Personality_Relation);
|
||||
newList.Add(t_Character_Personality_Relation);
|
||||
}
|
||||
//var delList = list.Where(it => newList.Any(item => item.CharacterId != it.PersonalityId)).ToList();
|
||||
//await this._defaultRepository.DeleteAsync(delList);
|
||||
|
||||
return await this._defaultRepository.InsertRangeAsync(newList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出Excel
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -24,9 +24,10 @@ public class T_Character_Type_IntimacyService : ApplicationService<IRepository<T
|
|||
//项目
|
||||
.WhereIf(pagingSearchInput.Search?.TenantId!=null,
|
||||
w => w.TenantId==pagingSearchInput.Search.TenantId)
|
||||
|
||||
.WhereIf(pagingSearchInput.Search?.CharacterId != 0,
|
||||
w => w.CharacterId == pagingSearchInput.Search.CharacterId)
|
||||
|
||||
|
||||
|
||||
.OrderByDescending(w => w.Id)
|
||||
.Select(w => new
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
using MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
namespace MiaoYu.Api.Admin.Controllers.Apps;
|
||||
|
||||
|
|
@ -8,12 +8,12 @@ namespace MiaoYu.Api.Admin.Controllers.Apps;
|
|||
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "人物表")]
|
||||
public class T_CharacterController : AdminControllerBase<T_CharacterService>
|
||||
{
|
||||
public T_CharacterController(T_CharacterService defaultService)
|
||||
public T_CharacterController(T_CharacterService defaultService)
|
||||
: base(defaultService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
|
|
@ -94,7 +94,18 @@ public class T_CharacterController : AdminControllerBase<T_CharacterService>
|
|||
base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改角色状态
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="v"></param>
|
||||
/// <returns></returns>
|
||||
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "修改角色状态")]
|
||||
[HttpPost("{id?}/{v?}")]
|
||||
public async Task<bool> UpdateState([FromRoute] int id, [FromRoute] int v)
|
||||
{
|
||||
return await this._defaultService.UpdateState(v == 0 ? false : true, id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
using MiaoYu.Api.Admin.ApplicationServices.Apps;
|
||||
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
|
||||
namespace MiaoYu.Api.Admin.Controllers.Apps;
|
||||
|
||||
|
|
@ -8,12 +8,12 @@ namespace MiaoYu.Api.Admin.Controllers.Apps;
|
|||
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "角色和性格关联表")]
|
||||
public class T_Character_Personality_RelationController : AdminControllerBase<T_Character_Personality_RelationService>
|
||||
{
|
||||
public T_Character_Personality_RelationController(T_Character_Personality_RelationService defaultService)
|
||||
public T_Character_Personality_RelationController(T_Character_Personality_RelationService defaultService)
|
||||
: base(defaultService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
|
|
@ -39,6 +39,19 @@ public class T_Character_Personality_RelationController : AdminControllerBase<T_
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id数组删除
|
||||
/// </summary>
|
||||
/// <param name="ids">ids</param>
|
||||
/// <returns></returns>
|
||||
[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
|
||||
[HttpPost("{id?}")]
|
||||
public async Task<bool> DeleteCIdListAsync([FromRoute] int id,[FromBody] List<int> ids)
|
||||
{
|
||||
await this._defaultService.DeleteListAsync(id,ids);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询表单数据
|
||||
/// </summary>
|
||||
|
|
@ -79,6 +92,22 @@ public class T_Character_Personality_RelationController : AdminControllerBase<T_
|
|||
return this._defaultService.SaveFormAsync(form);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量配置性格
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
|
||||
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "批量配置性格")]
|
||||
[HttpPost(("{id?}"))]
|
||||
[ApiCheckModel]
|
||||
public Task SetCharacterPersonality([FromRoute] int id, [FromBody] List<int> ids)
|
||||
{
|
||||
return this._defaultService.SaveFormAsync(id, ids);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出Excel
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -240,6 +240,14 @@
|
|||
<param name="pagingSearchInput"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.UpdateState(System.Boolean,System.Int32)">
|
||||
<summary>
|
||||
修改状态
|
||||
</summary>
|
||||
<param name="state"></param>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService">
|
||||
<summary>
|
||||
角色标签表 服务 T_Character_LabelService
|
||||
|
|
@ -379,6 +387,13 @@
|
|||
<param name="ids">ids</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_Personality_RelationService.DeleteListAsync(System.Int32,System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
根据id数组删除
|
||||
</summary>
|
||||
<param name="ids">ids</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_Personality_RelationService.FindFormAsync(System.Int32)">
|
||||
<summary>
|
||||
查询表单数据
|
||||
|
|
@ -393,6 +408,13 @@
|
|||
<param name="form">form</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_Personality_RelationService.SaveFormAsync(System.Int32,System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
保存数据
|
||||
</summary>
|
||||
<param name="form">form</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_Personality_RelationService.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Personality_Relation})">
|
||||
<summary>
|
||||
导出Excel
|
||||
|
|
@ -2015,6 +2037,14 @@
|
|||
<param name="pagingSearchInput"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.UpdateState(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
修改角色状态
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="v"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController">
|
||||
<summary>
|
||||
角色标签表 控制器
|
||||
|
|
@ -2175,6 +2205,13 @@
|
|||
<param name="ids">ids</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_Personality_RelationController.DeleteCIdListAsync(System.Int32,System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
根据id数组删除
|
||||
</summary>
|
||||
<param name="ids">ids</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_Personality_RelationController.FindFormAsync(System.Int32)">
|
||||
<summary>
|
||||
查询表单数据
|
||||
|
|
@ -2196,6 +2233,14 @@
|
|||
<param name="form"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_Personality_RelationController.SetCharacterPersonality(System.Int32,System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
批量配置性格
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_Personality_RelationController.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Personality_Relation})">
|
||||
<summary>
|
||||
导出Excel
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user