diff --git a/web/src/components/tableSelector/index.vue b/web/src/components/tableSelector/index.vue new file mode 100644 index 0000000..0fbaa13 --- /dev/null +++ b/web/src/components/tableSelector/index.vue @@ -0,0 +1,117 @@ + + + + + + + 搜索 + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/src/views/system/messageCenter/api.ts b/web/src/views/system/messageCenter/api.ts index b2a2c5d..258527a 100644 --- a/web/src/views/system/messageCenter/api.ts +++ b/web/src/views/system/messageCenter/api.ts @@ -17,11 +17,12 @@ export function GetObj(id: InfoReq) { } export function AddObj(obj: AddReq) { - return request({ - url: apiPrefix, - method: 'post', - data: obj, - }); + console.log(20,obj) + // return request({ + // url: apiPrefix, + // method: 'post', + // data: obj, + // }); } export function UpdateObj(obj: EditReq) { diff --git a/web/src/views/system/messageCenter/crud.tsx b/web/src/views/system/messageCenter/crud.tsx index 365a59c..395ebfd 100644 --- a/web/src/views/system/messageCenter/crud.tsx +++ b/web/src/views/system/messageCenter/crud.tsx @@ -2,7 +2,8 @@ import * as api from "./api"; import {dict, compute, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudOptions,} from "@fast-crud/fast-crud"; import {request} from "/@/utils/service"; import {dictionary} from "/@/utils/dictionary"; - +import tableSelector from "/@/components/tableSelector/index.vue" +import {shallowRef} from "vue"; interface CreateCrudOptionsTypes { crudOptions: CrudOptions; } @@ -30,22 +31,7 @@ export const createCrudOptions = function ({crudExpose}: { crudExpose: CrudExpos delRequest }, columns: { - _index: { - title: '序号', - form: {show: false}, - column: { - //type: 'index', - align: 'center', - width: '70px', - columnSetDisabled: true, //禁止在列设置中选择 - formatter: (context) => { - //计算序号,你可以自定义计算规则,此处为翻页累加 - let index = context.index ?? 1; - let pagination = crudExpose.crudBinding.value.pagination; - return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1; - }, - }, - }, + id: { title: 'id', form: { @@ -117,7 +103,6 @@ export const createCrudOptions = function ({crudExpose}: { crudExpose: CrudExpos disabled: true }, width: 130, - type: 'table-selector', disabled: true, dict: dict({ cache: false, @@ -126,6 +111,24 @@ export const createCrudOptions = function ({crudExpose}: { crudExpose: CrudExpos label: 'name', // 数据字典中label字段的属性名 }), form: { + component:{ + name: shallowRef(tableSelector), + vModel: "modelValue", + label:'name', + value:'date', + tableConfig:{ + isMultiple:true, + data:[{ + date: '2016-05-03', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + },{ + date: '2016-05-01', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + },] + } + }, show:compute(({ form })=>{ return form.target_type === 0 }), @@ -232,7 +235,7 @@ export const createCrudOptions = function ({crudExpose}: { crudExpose: CrudExpos config: {}, uploader: { type: "form", - buildUrl(res) { + buildUrl(res:any) { return res.url; } }