feat:对接了strapi 接口
This commit is contained in:
@@ -8,12 +8,13 @@ import 'reflect-metadata';
|
||||
import * as api from "@/common/api"
|
||||
// import UmTableForm from '@/components/UmTable/UmTableForm.vue';
|
||||
|
||||
import { UmTableForm,
|
||||
import {
|
||||
UmTableForm,
|
||||
TableColumnPropertyDecorator as tcpd,
|
||||
TableFormColumnPropertyDecorator as tfcpd,
|
||||
TableColumnMethodDecorator as tcmd, TOperateType,
|
||||
TableSearchFormPropertyDecorator as tsfpd
|
||||
} from "funjiaui";
|
||||
} from "funjiaui";
|
||||
// import {
|
||||
// TableColumnPropertyDecorator as tcpd,
|
||||
// TableFormColumnPropertyDecorator as tfcpd,
|
||||
@@ -32,7 +33,9 @@ export default class QA {
|
||||
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
|
||||
id: number = 0;
|
||||
|
||||
@tsfpd({ lang: "", "def": "题目" })
|
||||
@tsfpd({ lang: "", "def": "关键字" })
|
||||
keyword: string = "";
|
||||
|
||||
@tcpd({ "lang": "", "def": "题目", minWidth: 120 })
|
||||
@tfcpd({ "lang": "", "def": "题目", rule: [{ "type": "require", message: "不能为空" }], component: Codemirror })
|
||||
question: string = "";
|
||||
@@ -41,49 +44,47 @@ export default class QA {
|
||||
@tfcpd({ "lang": "", "def": "答案", component: Codemirror, width: 300 })
|
||||
answer: string = "";
|
||||
|
||||
@tcpd({ "lang": "", "def": "标签", minWidth: 120 })
|
||||
@tcpd({
|
||||
"lang": "", "def": "标签", minWidth: 120, columnRender: function (props) {
|
||||
console.log(arguments);
|
||||
const rowData = arguments[2];
|
||||
return rowData.tags.map(item => { return item.name }).join(",")
|
||||
}
|
||||
})
|
||||
@tfcpd({ "lang": "", "def": "标签", component: DynamicTags, width: 300 })
|
||||
@tsfpd({
|
||||
lang: "", "def": "标签", fieldType: "select", async getData() {
|
||||
const params = {
|
||||
page: 1,
|
||||
pageSize: 999
|
||||
}
|
||||
const data = await api.getDynamicList(params, 'tag');
|
||||
console.log(data.data);
|
||||
return {
|
||||
data: [{
|
||||
label: "vue3",
|
||||
value: "vue3"
|
||||
}, {
|
||||
label: "react",
|
||||
value: "react"
|
||||
}, {
|
||||
label: "js",
|
||||
value: "js"
|
||||
}, {
|
||||
label: "html",
|
||||
value: "html"
|
||||
}, {
|
||||
label: "css",
|
||||
value: "css"
|
||||
}, {
|
||||
label: "webpack",
|
||||
value: "webpack"
|
||||
}, {
|
||||
label: "微信小程序",
|
||||
value: "微信小程序"
|
||||
}, {
|
||||
label: "typescript",
|
||||
value: "typescript"
|
||||
}, {
|
||||
label: "boss_vue",
|
||||
value: "boss_vue"
|
||||
}, {
|
||||
label: "高频_css",
|
||||
value: "高频_css"
|
||||
}]
|
||||
data: (data?.data || [])?.map(item => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.documentId
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
tag: string[] = [];
|
||||
tags: string[] = [];
|
||||
|
||||
@tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } })
|
||||
getList = async (params: any) => {
|
||||
const ky = params.keyword || undefined;
|
||||
params.filters = {
|
||||
$or: [
|
||||
{
|
||||
question: {
|
||||
$containsi: ky
|
||||
}
|
||||
},
|
||||
{ tags: { documentId: { $eq: params.tags || undefined } } }
|
||||
]
|
||||
};
|
||||
return await api.getQAList(params);
|
||||
}
|
||||
|
||||
@@ -181,6 +182,20 @@ export default class QA {
|
||||
}
|
||||
}
|
||||
|
||||
@tcmd({ "key": "table:toolbar", "value": { "type": "批量删除", "priority": 5, "es": "onAfter", "dialogContent": "确定要删除选择的数据吗?" } })
|
||||
onMutilDel = async function (ids: any[]) {
|
||||
// console.log(arguments)
|
||||
// return;
|
||||
const { code, msg } = await api.deleteQA({ ids });
|
||||
if (code != 0) {
|
||||
return { code: 1, message: msg };
|
||||
}
|
||||
else {
|
||||
return { code: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @tcmd({
|
||||
// "key": "table:toolbar", "value": {
|
||||
// "type": "添加", "priority": 1, "es": "onAfter", "dialogContent": UmTableForm, "dialogTitle": "增加", "dialogWidth": 650
|
||||
|
||||
Reference in New Issue
Block a user