|
@@ -104,14 +104,14 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
show: auth('role:Create'),
|
|
show: auth('role:Create'),
|
|
},
|
|
},
|
|
// 添加批量绑定标签按钮
|
|
// 添加批量绑定标签按钮
|
|
- /* batchBindTags: {
|
|
|
|
|
|
+ batchBindTags: {
|
|
text: '批量绑定标签',
|
|
text: '批量绑定标签',
|
|
type: 'primary',
|
|
type: 'primary',
|
|
show: true,
|
|
show: true,
|
|
order: 2,
|
|
order: 2,
|
|
click: () => {
|
|
click: () => {
|
|
- // 尝试不同的方式获取选中行
|
|
|
|
- const selection = crudExpose.getSelection?.() || crudExpose.selectedRows || [];
|
|
|
|
|
|
+ // 使用存储的选中行
|
|
|
|
+ const selection = context.selectedRows || [];
|
|
console.log('选中的行:', selection);
|
|
console.log('选中的行:', selection);
|
|
|
|
|
|
if (!selection || selection.length === 0) {
|
|
if (!selection || selection.length === 0) {
|
|
@@ -121,22 +121,25 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
// 打开批量绑定标签对话框
|
|
// 打开批量绑定标签对话框
|
|
context.openBatchTagsDialog(selection);
|
|
context.openBatchTagsDialog(selection);
|
|
},
|
|
},
|
|
- }, */
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
rowHandle: {
|
|
rowHandle: {
|
|
//固定右侧
|
|
//固定右侧
|
|
fixed: 'right',
|
|
fixed: 'right',
|
|
- width: 320,
|
|
|
|
|
|
+ width: 230,
|
|
buttons: {
|
|
buttons: {
|
|
view: {
|
|
view: {
|
|
show: true,
|
|
show: true,
|
|
|
|
+ size: 'small',
|
|
},
|
|
},
|
|
edit: {
|
|
edit: {
|
|
show: auth('role:Update'),
|
|
show: auth('role:Update'),
|
|
|
|
+ size: 'small',
|
|
},
|
|
},
|
|
remove: {
|
|
remove: {
|
|
show: auth('role:Delete'),
|
|
show: auth('role:Delete'),
|
|
|
|
+ size: 'small',
|
|
},
|
|
},
|
|
/* permission: {
|
|
/* permission: {
|
|
type: 'primary',
|
|
type: 'primary',
|
|
@@ -278,6 +281,101 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
helper: '选择题目适用的职位类型,可多选'
|
|
helper: '选择题目适用的职位类型,可多选'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ category: {
|
|
|
|
+ title: '分类',
|
|
|
|
+ search: { show: true },
|
|
|
|
+ type: 'dict-select',
|
|
|
|
+ column: {
|
|
|
|
+ minWidth: 120,
|
|
|
|
+ component: {
|
|
|
|
+ // 自定义渲染组件,显示彩色标签
|
|
|
|
+ // name: 'fs-component',
|
|
|
|
+ render: ({ row }: { row: any }) => {
|
|
|
|
+ if (!row.category || row.category.length === 0) return <span>-</span>;
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <el-tag
|
|
|
|
+ key={row.category.id}
|
|
|
|
+ type="warning"
|
|
|
|
+ effect="plain"
|
|
|
|
+ size="mini"
|
|
|
|
+ >
|
|
|
|
+ {row.category.name}
|
|
|
|
+ </el-tag>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ dict: dict({
|
|
|
|
+ // 使用API方式获取数据
|
|
|
|
+ getData: async () => {
|
|
|
|
+ const res = await api.GetcategoryList({page:1, limit:1000, tenant_id:1});
|
|
|
|
+ return res.data.items;
|
|
|
|
+ },
|
|
|
|
+ label: 'name',
|
|
|
|
+ value: 'id'
|
|
|
|
+ }),
|
|
|
|
+ form: {
|
|
|
|
+ rules: [{ required: true, message: '题目分类必填' }],
|
|
|
|
+ component: {
|
|
|
|
+ placeholder: '请选择题目分类',
|
|
|
|
+ /* onChange: ({ value }: { value: number }) => {
|
|
|
|
+ // 当分类变化时,重新获取对应的标签
|
|
|
|
+ fetchTags(value);
|
|
|
|
+ } */
|
|
|
|
+ },
|
|
|
|
+ helper: '选择所属的分类'
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ tags: {
|
|
|
|
+ title: '标签',
|
|
|
|
+ search: { show: true },
|
|
|
|
+ type: 'dict-select',
|
|
|
|
+ column: {
|
|
|
|
+ minWidth: 150,
|
|
|
|
+ component: {
|
|
|
|
+ // 自定义渲染组件,显示彩色标签
|
|
|
|
+ name: 'fs-component',
|
|
|
|
+ render: ({ row }: { row: any }) => {
|
|
|
|
+ if (!row.tags || row.tags.length === 0) return <span>-</span>;
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <div style="display: flex; flex-wrap: wrap; gap: 4px;">
|
|
|
|
+ {row.tags.map((tag: any) => (
|
|
|
|
+ <el-tag
|
|
|
|
+ key={tag.id}
|
|
|
|
+ type="warning"
|
|
|
|
+ effect="plain"
|
|
|
|
+ size="mini"
|
|
|
|
+ >
|
|
|
|
+ {tag.name}
|
|
|
|
+ </el-tag>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ dict: dict({
|
|
|
|
+ // 使用API方式获取数据
|
|
|
|
+ getData: async () => {
|
|
|
|
+ const res = await api.GetTagList({page:1, limit:1000, tenant_id:1});
|
|
|
|
+ return res.data.items;
|
|
|
|
+ },
|
|
|
|
+ label: 'name',
|
|
|
|
+ value: 'id'
|
|
|
|
+ }),
|
|
|
|
+ form: {
|
|
|
|
+ component: {
|
|
|
|
+ props: {
|
|
|
|
+ multiple: true,
|
|
|
|
+ filterable: true,
|
|
|
|
+ placeholder: '请选择标签'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ helper: '选择题目关联的标签,可多选'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
recommended_duration: {
|
|
recommended_duration: {
|
|
title: '建议时长(秒)',
|
|
title: '建议时长(秒)',
|
|
search: { show: false },
|
|
search: { show: false },
|
|
@@ -285,6 +383,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
minWidth: 100,
|
|
minWidth: 100,
|
|
},
|
|
},
|
|
form: {
|
|
form: {
|
|
|
|
+ value: 60,
|
|
component: {
|
|
component: {
|
|
name: 'el-input-number',
|
|
name: 'el-input-number',
|
|
props: {
|
|
props: {
|
|
@@ -296,7 +395,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
helper: '建议回答此题目的时长,单位为秒'
|
|
helper: '建议回答此题目的时长,单位为秒'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- difficulty: {
|
|
|
|
|
|
+ /* difficulty: {
|
|
title: '难度等级',
|
|
title: '难度等级',
|
|
search: { show: true },
|
|
search: { show: true },
|
|
type: 'dict-select',
|
|
type: 'dict-select',
|
|
@@ -314,23 +413,32 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
rules: [{ required: true, message: '难度等级必填' }],
|
|
rules: [{ required: true, message: '难度等级必填' }],
|
|
helper: '选择题目的难度级别'
|
|
helper: '选择题目的难度级别'
|
|
},
|
|
},
|
|
- },
|
|
|
|
|
|
+ }, */
|
|
is_system: {
|
|
is_system: {
|
|
title: '系统题目',
|
|
title: '系统题目',
|
|
- search: { show: true },
|
|
|
|
|
|
+ search: { show: false },
|
|
|
|
+ type: 'dict-select',
|
|
column: {
|
|
column: {
|
|
- width: 80,
|
|
|
|
- component: {
|
|
|
|
- name: 'el-switch'
|
|
|
|
- }
|
|
|
|
|
|
+ width: 100,
|
|
|
|
+ /* component: {
|
|
|
|
+ name: 'fs-component',
|
|
|
|
+ render: ({ row }: { row: any }) => {
|
|
|
|
+ return row.is_system ?
|
|
|
|
+ <el-tag type="success" size="small">是</el-tag> :
|
|
|
|
+ <el-tag type="info" size="small">否</el-tag>;
|
|
|
|
+ }
|
|
|
|
+ } */
|
|
},
|
|
},
|
|
|
|
+ dict: dict({
|
|
|
|
+ data: [
|
|
|
|
+ { value: true, label: '是' },
|
|
|
|
+ { value: false, label: '否' }
|
|
|
|
+ ]
|
|
|
|
+ }),
|
|
form: {
|
|
form: {
|
|
|
|
+ value: false,
|
|
component: {
|
|
component: {
|
|
- name: 'el-switch',
|
|
|
|
- props: {
|
|
|
|
- activeText: '是',
|
|
|
|
- inactiveText: '否'
|
|
|
|
- }
|
|
|
|
|
|
+ placeholder: '请选择是否为系统题目'
|
|
},
|
|
},
|
|
helper: '是否为系统预设题目'
|
|
helper: '是否为系统预设题目'
|
|
}
|
|
}
|
|
@@ -341,17 +449,6 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
type: 'dict-select',
|
|
type: 'dict-select',
|
|
column: {
|
|
column: {
|
|
width: 80,
|
|
width: 80,
|
|
- /* component: {
|
|
|
|
- name: 'fs-dict-label',
|
|
|
|
- props: {
|
|
|
|
- dict: dict({
|
|
|
|
- data: [
|
|
|
|
- { value: 0, label: '停用' },
|
|
|
|
- { value: 1, label: '启用' }
|
|
|
|
- ]
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- } */
|
|
|
|
},
|
|
},
|
|
dict: dict({
|
|
dict: dict({
|
|
data: [
|
|
data: [
|
|
@@ -360,6 +457,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
]
|
|
]
|
|
}),
|
|
}),
|
|
form: {
|
|
form: {
|
|
|
|
+ value: 1,
|
|
rules: [{ required: true, message: '状态必填' }],
|
|
rules: [{ required: true, message: '状态必填' }],
|
|
component: {
|
|
component: {
|
|
placeholder: '请选择状态',
|
|
placeholder: '请选择状态',
|
|
@@ -505,71 +603,15 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- category_id: {
|
|
|
|
- title: '题目分类',
|
|
|
|
- search: { show: true },
|
|
|
|
- type: 'dict-select',
|
|
|
|
- column: {
|
|
|
|
- minWidth: 120,
|
|
|
|
- },
|
|
|
|
- dict: dict({
|
|
|
|
- // 使用API方式获取数据
|
|
|
|
- getData: async () => {
|
|
|
|
- const res = await api.GetcategoryList({page:1, limit:1000, tenant_id:1});
|
|
|
|
- return res.data.items;
|
|
|
|
- },
|
|
|
|
- label: 'name',
|
|
|
|
- value: 'id'
|
|
|
|
- }),
|
|
|
|
- form: {
|
|
|
|
- rules: [{ required: true, message: '题目分类必填' }],
|
|
|
|
- component: {
|
|
|
|
- placeholder: '请选择题目分类',
|
|
|
|
- /* onChange: ({ value }: { value: number }) => {
|
|
|
|
- // 当分类变化时,重新获取对应的标签
|
|
|
|
- fetchTags(value);
|
|
|
|
- } */
|
|
|
|
- },
|
|
|
|
- helper: '选择题目所属的分类'
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- tag_ids: {
|
|
|
|
- title: '题目标签',
|
|
|
|
- search: { show: true },
|
|
|
|
- type: 'dict-select',
|
|
|
|
- column: {
|
|
|
|
- minWidth: 150,
|
|
|
|
- component: {
|
|
|
|
- name: 'fs-dict-label',
|
|
|
|
- props: {
|
|
|
|
- multiple: true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- dict: dict({
|
|
|
|
- // 使用API方式获取数据
|
|
|
|
- getData: async () => {
|
|
|
|
- const res = await api.GetTagList({page:1, limit:1000, tenant_id:1});
|
|
|
|
- return res.data.items;
|
|
|
|
- },
|
|
|
|
- label: 'name',
|
|
|
|
- value: 'id'
|
|
|
|
- }),
|
|
|
|
- form: {
|
|
|
|
- component: {
|
|
|
|
- props: {
|
|
|
|
- multiple: true,
|
|
|
|
- filterable: true,
|
|
|
|
- placeholder: '请选择题目标签'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- helper: '选择题目关联的标签,可多选'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
// 确保表格配置正确
|
|
// 确保表格配置正确
|
|
table: {
|
|
table: {
|
|
selection: true,
|
|
selection: true,
|
|
|
|
+ onSelectionChange: (selection: any[]) => {
|
|
|
|
+ // 存储选中的行到一个全局变量中
|
|
|
|
+ context.selectedRows = selection;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|