123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import { CreateCrudOptionsProps, CreateCrudOptionsRet, dict, compute } from '@fast-crud/fast-crud';
- import * as api from '../../api';
- import { ElMessage } from 'element-plus';
- import { Session } from '/@/utils/storage';
- export const createAsideCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const pageRequest = async (query: any) => {
- const params = {
- ...query,
- tenant_id: Session.get('tenant_id'),
- job_id: query.form?.job_id || ''
- };
-
- return api.GetDocumentList(params);
- };
- return {
- crudOptions: {
- request: {
- pageRequest
- },
- actionbar: {
- buttons: {
- add: {
- show: true,
- click: () => {
- // 打开添加问题对话框
- crudExpose.openAdd();
- }
- }
- }
- },
- rowHandle: {
- width: 300,
- buttons: {
- view: {
- size: 'small',
- icon: "View",
- type: 'text',
- click: ({ row }: any) => {
- const event = new CustomEvent('viewDocumentDetail', { detail: row });
- window.dispatchEvent(event);
- }
- },
- uploadVideo: {
- text: '上传视频',
- type: 'text',
- icon: "upload",
- size: 'small',
- click: ({ row }: any) => {
- const event = new CustomEvent('openVideoUploadDialog', { detail: row });
- window.dispatchEvent(event);
- }
- },
- edit: {
- type: 'text',
- icon: "Edit",
- size: 'small',
- },
- remove: {
- type: 'text',
- icon: "Delete",
- size: 'small',
- },
- sort: {
- type: 'text',
- icon: "sort",
- size: 'small',
- text: '修改排序',
- click: ({ row }: any) => {
- const event = new CustomEvent('openSortDialog', { detail: row });
- window.dispatchEvent(event);
- }
- }
- }
- },
- columns: {
- id: {
- title: 'ID',
- column: { show: true, width: 80 },
- search: { show: false },
- form: { show: false },
- },
- question: {
- title: '题目内容',
- search: { show: true },
- column: {
- sortable: 'custom',
- showOverflowTooltip: true,
- width: 300
- },
- form: {
- rules: [{ required: true, message: '题目内容必填' }],
- component: {
- placeholder: '请输入题目内容',
- }
- },
- },
- question_type: {
- title: '问题类型',
- search: { show: true },
- type: 'dict-select',
- column: {
- minWidth: 100,
- },
- dict: dict({
- data: [
- { value: 1, label: '专业技能' },
- { value: 2, label: '通用能力' },
- { value: 3, label: '个人特质' }
- ]
- }),
- form: {
- rules: [{ required: true, message: '问题类型必填' }],
- component: {
- placeholder: '请选择问题类型',
- },
- helper: '选择问题的类型分类'
- },
- },
- difficulty: {
- title: '难度等级',
- search: { show: true },
- type: 'dict-select',
- column: {
- minWidth: 80,
- },
- dict: dict({
- data: [
- { value: 1, label: '初级' },
- { value: 2, label: '中级' },
- { value: 3, label: '高级' }
- ]
- }),
- form: {
- rules: [{ required: true, message: '难度等级必填' }],
- helper: '选择题目的难度级别'
- },
- },
- sequence_number: {
- title: '排序',
- search: { show: false },
- column: { show: true },
- form: { show: true },
- },
- digital_human_video_url: {
- title: '视频链接',
- search: { show: false },
- column: {
- show: true,
- width: 120,
- formatter: ({ row }: any) => {
- return row.digital_human_video_url ? '已上传' : '未上传';
- }
- },
- form: { show: false },
- },
- digital_human_video_subtitle: {
- title: '字幕',
- search: { show: false },
- column: {
- show: true,
- width: 120,
- formatter: ({ row }: any) => {
- return row.digital_human_video_subtitle ? '已上传' : '未上传';
- }
- },
- form: { show: false },
- },
- }
- }
- };
- };
|