feat:对接了strapi 接口

This commit is contained in:
2025-05-03 19:51:37 +08:00
parent 3e2aa46ea1
commit f31c30116a
17 changed files with 562 additions and 369 deletions
+2 -1
View File
@@ -23,8 +23,9 @@ declare module '@vue/runtime-core' {
ElLink: typeof import('element-plus/es')['ElLink'] ElLink: typeof import('element-plus/es')['ElLink']
ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
ElTag: typeof import('element-plus/es')['ElTag'] ElSelect: typeof import('element-plus/es')['ElSelect']
ImgPreview: typeof import('./src/components/ImgPreview.vue')['default'] ImgPreview: typeof import('./src/components/ImgPreview.vue')['default']
Layout: typeof import('./src/components/Layout.vue')['default'] Layout: typeof import('./src/components/Layout.vue')['default']
ObjectRect: typeof import('./src/components/ObjectRect.vue')['default'] ObjectRect: typeof import('./src/components/ObjectRect.vue')['default']
+1 -1
View File
@@ -19,7 +19,7 @@
"element-plus": "2.1.10", "element-plus": "2.1.10",
"funjialib": "git+http://git.funjia.top/funjia/FunJiaLib_Package.git", "funjialib": "git+http://git.funjia.top/funjia/FunJiaLib_Package.git",
"funjiaui": "git+http://git.funjia.top/funjia/FunjiaUI_Vue.git#v1.1.2", "funjiaui": "git+http://git.funjia.top/funjia/FunjiaUI_Vue.git#v1.1.2",
"funjia-axios": "git+http://git.funjia.top/funjia/funjia-axios.git", "funjia-axios": "git+http://git.funjia.top/funjia/funjia-axios.git#v1.0.0",
"html-print-element": "^0.0.5", "html-print-element": "^0.0.5",
"html2pdf.js": "^0.10.2", "html2pdf.js": "^0.10.2",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
+6 -5
View File
@@ -1,8 +1,9 @@
path: D:\funjia-server\
db: # 数据库配置 db: # 数据库配置
db: &db E:\sourceCode\2025\funjia-admin-template-vue\server\db\db.json db: &db db.json
resourceDB: &resourceDB E:\sourceCode\2025\funjia-admin-template-vue\server\db\resourceDB.json resourceDB: &resourceDB resourceDB.json
backupDB: &backupDB E:\sourceCode\2025\funjia-admin-template-vue\server\db\backupDB.json backupDB: &backupDB backupDB.json
logDB: &logDB E:\sourceCode\2025\funjia-admin-template-vue\server\db\logDB.json logDB: &logDB logDB.json
dbBak: # 数据库备份配置 dbBak: # 数据库备份配置
- # - #
original: *db original: *db
@@ -19,4 +20,4 @@ dbBak: # 数据库备份配置
- # - #
original: *logDB original: *logDB
dest: F:/sourceCode/2022/compute-cms/bak/logDB dest: F:/sourceCode/2022/compute-cms/bak/logDB
category: logDB category: logDB
+3 -2
View File
@@ -24,9 +24,10 @@
"node-cron": "^3.0.1", "node-cron": "^3.0.1",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"yaml": "^2.1.1", "yaml": "^2.1.1",
"funjia-server":"git+http://git.funjia.top/funjia/funjia-server.git" "funjia-server": "git+http://git.funjia.top/funjia/funjia-server.git",
"qs": "^6.14.0"
}, },
"devDependencies": { "devDependencies": {
"vite": "^6.0.7" "vite": "^6.0.7"
} }
} }
-173
View File
@@ -1,173 +0,0 @@
import cuid from "cuid";
// import getDb from "../dbServer.mjs";
import _ from "lodash";
import { getDb } from "funjia-server/lib/funjia-server.mjs";
const getEmployee = (router) => {
router.post('/api/employee/list', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const db = await getDb();
const body = ctx.request.body;
const data = db.data?.employee?.filter((item) => {
let isMatch = true;
for (let field in body) {
if (["page", "pageSize"].includes(field)) {
continue;
}
if (typeof (item[field]) == "string") {
isMatch = item[field]?.indexOf?.(body[field]) > -1;
} else if (typeof (item[field]) == "number") {
isMatch = item[field] == body[field];
}
if (!isMatch)
break;
}
return isMatch;
});
const {
page,
pageSize
} = body;
let batchData = data;
if (page && pageSize) {
batchData = data.slice((page - 1) * pageSize, page * pageSize);
}
ctx.body = {
code: 0,
data: batchData || [],
total: data.length
};
});
router.get('/api/employee', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const db = await getDb();
const data = db.data.employee;
const query = ctx.request.query;
console.log("参数:", query, ctx.request.body, ctx.query);
let detail = {};
if (query.id && data) {
detail = data.find((item) => {
return item.id == query.id;
});
}
ctx.body = {
code: 0,
data: detail || {}
};
});
router.post('/api/employee/add', async (ctx) => {
ctx.type = 'application/json';
const db = await getDb();
// You can also use this syntax if you prefer
if (!db.data?.employee)
db.data.employee = [];
const {
employee
} = db.data;
const data = ctx.request.body;
console.log("add:", data);
data.id = cuid();
data.createTime = new Date();
employee.push(data)
// Write db.data content to db.json
await db.write()
ctx.body = {
code: 0,
};
});
router.post('/api/employee/upd', async (ctx) => {
ctx.type = 'application/json';
const db = await getDb();
// You can also use this syntax if you prefer
if (!db.data?.employee)
db.data = {
employee: []
}
const {
employee
} = db.data;
const data = ctx.request.body;
const id = data.id;
console.log("数据Id", id);
if (id && employee) {
const currentDetail = employee.find(item => item.id == id);
if (currentDetail) {
_.merge(currentDetail, data);
}
// Write db.data content to db.json
await db.write()
}
ctx.body = {
code: 0,
};
});
router.post('/api/employee/delete', async (ctx) => {
ctx.type = 'application/json';
const db = await getDb();
// You can also use this syntax if you prefer
if (!db.data?.employee)
db.data = {
employee: []
}
let {
employee
} = db.data;
const data = ctx.request.body;
const ids = data.ids;
if (ids?.length > 0 && employee) {
let id = null;
for (let i = 0; i < ids.length; i++) {
id = ids[i];
const idx = employee.findIndex(item => item.id == id);
if (idx != -1) {
employee.splice(idx, 1);
}
}
// Write db.data content to db.json
await db.write()
}
ctx.body = {
code: 0,
};
});
router.post('/api/employee/login', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const db = await getDb();
const data = db.data.employee;
const params = ctx.request.body;
let detail = {};
if (data) {
detail = data.find((item) => {
return item.userName == params.userName && item.pwd == params.pwd;
});
}
const code = detail ? 0 : 1;
ctx.body = {
code,
data: detail || {}
};
});
}
export default getEmployee;
+72 -110
View File
@@ -1,157 +1,119 @@
import cuid from "cuid"; import cuid from "cuid";
// import getDb from "../dbServer.mjs"; // import getDb from "../dbServer.mjs";
import {getDb} from "funjia-server/lib/funjia-server.mjs"; import { ConfigHelper } from "funjia-server";
import _ from "lodash"; import _ from "lodash";
const headers = {
'content-type': 'application/json'
}
const getDynamic = (router) => { const getDynamic = (router) => {
const url = ConfigHelper.config.server.url + "/api";
router.post('/api/dynamic/list/:tableName', async (ctx) => { router.post('/api/dynamic/list/:tableName', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面 // 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json'; ctx.type = 'application/json';
const db = await getDb(); const params = ctx.params,
const body = ctx.request.body; tableName = params.tableName;
const data = db.data[ctx.params.tableName]?.filter((item) => { const res = await fetch(`${url}/${_.kebabCase(tableName)}s`, {
let isMatch = true; headers,
for (let field in body) { // body:JSON.parse({})
if (["page", "pageSize"].includes(field)) { })
continue; const data = await res.json();
} // console.log(data);
if (typeof (item[field]) == "string") {
isMatch = item[field]?.indexOf?.(body[field]) > -1;
} else if (typeof (item[field]) == "number") {
isMatch = item[field] == body[field];
}
if (!isMatch)
break;
}
return isMatch;
});
const {
page,
pageSize
} = body;
let batchData = data;
if (page && pageSize) {
batchData = data.slice((page - 1) * pageSize, page * pageSize);
}
ctx.body = { ctx.body = {
code: 0, code: 0,
data: batchData || [], data: data.data.map(item => {
total: data.length return { ...item, id: item.documentId }
}),
total: data.meta.pagination.total
}; };
}); });
router.get('/api/dynamic/:tableName', async (ctx) => { router.get('/api/dynamic/:tableName', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面 // 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json'; ctx.type = 'application/json';
const db = await getDb(); const params = ctx.params,
const data = db.data[ctx.params.tableName]; tableName = params.tableName,
const query = ctx.request.query; query = ctx.request.query,
console.log("参数:", query, ctx.request.body, ctx.query); id = query.id;
let detail = {}; const res = await fetch(`${url}/${_.kebabCase(tableName)}s/` + id, {
if (query.id && data) { headers,
detail = data.find((item) => { // body:JSON.parse({})
return item.id == query.id; })
}); const data = await res.json();
} data.data.id = data.data.documentId;
ctx.body = { ctx.body = {
code: 0, code: 0,
data: detail || {} data: data.data
}; };
}); });
router.post('/api/dynamic/add/:tableName', async (ctx) => { router.post('/api/dynamic/add/:tableName', async (ctx) => {
ctx.type = 'application/json'; ctx.type = 'application/json';
const tableName=ctx.params.tableName; const tableName = ctx.params.tableName;
const body = ctx.request.body;
delete body.id;
delete body.documentId;
const db = await getDb(); const res = await fetch(`${url}/${_.kebabCase(tableName)}s`, {
method: "post",
headers,
body: JSON.stringify({ data: ctx.request.body })
});
// You can also use this syntax if you prefer const data = await res.json();
if (!db.data[tableName]) // console.log(data);
db.data[tableName] = [];
const dynamic = db.data[tableName];
const data = ctx.request.body;
console.log("add:", data);
data.id = cuid();
data.createTime = new Date();
dynamic.push(data)
// Write db.data content to db.json
await db.write()
ctx.body = { ctx.body = {
code: 0, code: 0,
}; };
}); });
router.post('/api/dynamic/upd/:tableName', async (ctx) => { router.post('/api/dynamic/upd/:tableName', async (ctx) => {
ctx.type = 'application/json'; ctx.type = 'application/json';
const tableName=ctx.params.tableName; const tableName = ctx.params.tableName;
const body = ctx.request.body;
const documentId = body.id;// body.documentId;
delete body.id;
delete body.documentId;
// delete body.jsonValue;
const db = await getDb(); const putData = JSON.stringify({ data: body });
// console.log(putData, documentId, tableName,`${url}/${_.kebabCase(tableName)}s/`);
const res = await fetch(`${url}/${_.kebabCase(tableName)}s/` + documentId, {
method: "PUT",
headers,
body: putData
})
// You can also use this syntax if you prefer await res.text();
if (!db.data[tableName]) // const data = await res.json();
db.data = {
dynamic: []
}
const dynamic = db.data[tableName];
const data = ctx.request.body;
const id = data.id;
console.log("数据Id", id);
if (id && dynamic) {
const currentDetail = dynamic.find(item => item.id == id);
if (currentDetail) {
_.merge(currentDetail, data);
}
// Write db.data content to db.json
await db.write()
}
// console.log(data);
ctx.body = { ctx.body = {
code: 0, code: 0,
}; };
}); });
router.post('/api/dynamic/delete/:tableName', async (ctx) => { router.post('/api/dynamic/delete/:tableName', async (ctx) => {
ctx.type = 'application/json'; ctx.type = 'application/json';
const tableName=ctx.params.tableName; const tableName = ctx.params.tableName;
const db = await getDb();
// You can also use this syntax if you prefer
if (!db.data[tableName])
db.data = {
[tableName]: []
}
const dynamic = db.data[tableName];
const data = ctx.request.body; const data = ctx.request.body;
const ids = data.ids; const ids = data.ids;
if (ids?.length > 0 && dynamic) {
let id = null; for (const id of ids) {
for (let i = 0; i < ids.length; i++) { await deleteData(tableName, id);
id = ids[i];
const idx = dynamic.findIndex(item => item.id == id);
if (idx != -1) {
dynamic.splice(idx, 1);
}
}
// Write db.data content to db.json
await db.write()
} }
ids.forEach((id) => {
deleteData(tableName, id);
})
ctx.body = { ctx.body = {
code: 0, code: 0,
}; };
}); });
} }
const deleteData = async (tableName, id) => {
return fetch(`${url}/${_.kebabCase(tableName)}s/${id}`, {
method: "delete"
})
}
export default getDynamic; export default getDynamic;
+19
View File
@@ -0,0 +1,19 @@
import _ from "lodash";
import { ConfigHelper } from "funjia-server";
const getEmployee = (router) => {
router.post('/api/employee/login', async (ctx) => {
const url = ConfigHelper.config.server.url + "/api";
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const params = ctx.request.body;
const res = await fetch(`${url}/employees?filters[userName][$eq]=${params.userName}&filters[pwd][$eq]=${params.pwd}`, {
method: 'GET'
})
const data = await res.json();
ctx.body = { code: data.data.length > 0 ? 0 : 1, data: data.data?.[0] }
});
}
export default getEmployee;
+142
View File
@@ -0,0 +1,142 @@
import _ from "lodash";
import qs from "qs";
import { ConfigHelper } from "funjia-server";
// https://docs.strapi.io/cms/api/graphql#filters
const headers = {
'content-type': 'application/json'
}
const getQuestionAnswer = (router) => {
const fullUrl = ConfigHelper.config.server.url + "/api";
router.post('/api/questionAnswer/list', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const params = ctx.request.body;
const url = buildUrl(`${fullUrl}/question-answers`, {
pagination: {
page: params.page,
pageSize: params.pageSize,
},
populate: 'tags',
sort: "id:desc",
filters: params.filters
});
const res = await fetch(url, {
method: 'GET',
})
const data = await res.json(),
ctxData = data.data.map(item => {
return { ...item, id: item.documentId }
});
ctx.body = {
code: ctxData.length > 0 ? 0 : 1, data: ctxData,
total: data.meta.pagination.total
}
});
router.get('/api/questionAnswer', async (ctx) => {
// 设置头类型, 如果不设置,会直接下载该页面
ctx.type = 'application/json';
const params = ctx.params,
tableName = params.tableName,
query = ctx.request.query,
id = query.id;
const url = buildUrl(`${fullUrl}/question-answers/${id}`, {
populate: 'tags'
});
const res = await fetch(url, {
// headers,
// body:JSON.parse({})
})
const data = await res.json();
const ctxData = data.data;
ctxData.id = ctxData?.documentId;
// console.log(ctxData.tags);
ctxData.tags = ctxData.tags.map(item => item.documentId);
ctx.body = {
code: 0,
data: ctxData
};
});
router.post('/api/questionAnswer/add', async (ctx) => {
ctx.type = 'application/json';
const body = ctx.request.body;
delete body.id;
delete body.documentId;
const res = await fetch(`${fullUrl}/question-answers`, {
method: "post",
headers,
body: JSON.stringify({ data: ctx.request.body })
});
const data = await res.json();
// console.log(data);
ctx.body = {
code: 0,
};
});
router.post('/api/questionAnswer/upd', async (ctx) => {
ctx.type = 'application/json';
// const tableName = ctx.params.tableName;
const body = ctx.request.body;
const documentId = body.id;// body.documentId;
delete body.id;
delete body.documentId;
// delete body.tags;
const putData = JSON.stringify({ data: body });
// console.log(putData, documentId);
const res = await fetch(`${fullUrl}/question-answers/` + documentId, {
method: "PUT",
headers,
body: putData
})
const data = await res.json();
// console.log(data);
ctx.body = {
code: 0,
};
});
router.post('/api/questionAnswer/delete', async (ctx) => {
ctx.type = 'application/json';
const tableName = 'questionAnswer';
const data = ctx.request.body;
const ids = data.ids;
for (const id of ids) {
await deleteData(tableName, id);
}
ids.forEach((id) => {
deleteData(tableName, id);
})
ctx.body = {
code: 0,
};
});
const deleteData = async (tableName, id) => {
return fetch(`${fullUrl}/${_.kebabCase(tableName)}s/${id}`, {
method: "delete"
})
}
}
export default getQuestionAnswer;
function buildUrl(baseUrl, params) {
return baseUrl + "?" + qs.stringify(params);
}
+133
View File
@@ -562,6 +562,14 @@ cache-content-type@^1.0.0:
mime-types "^2.1.18" mime-types "^2.1.18"
ylru "^1.2.0" ylru "^1.2.0"
call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6"
integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==
dependencies:
es-errors "^1.3.0"
function-bind "^1.1.2"
call-bind@^1.0.0: call-bind@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" resolved "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
@@ -570,6 +578,14 @@ call-bind@^1.0.0:
function-bind "^1.1.1" function-bind "^1.1.1"
get-intrinsic "^1.0.2" get-intrinsic "^1.0.2"
call-bound@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a"
integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==
dependencies:
call-bind-apply-helpers "^1.0.2"
get-intrinsic "^1.3.0"
co-body@^5.1.1: co-body@^5.1.1:
version "5.2.0" version "5.2.0"
resolved "https://registry.npmmirror.com/co-body/-/co-body-5.2.0.tgz#5a0a658c46029131e0e3a306f67647302f71c124" resolved "https://registry.npmmirror.com/co-body/-/co-body-5.2.0.tgz#5a0a658c46029131e0e3a306f67647302f71c124"
@@ -696,6 +712,15 @@ destroy@^1.0.4:
resolved "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" resolved "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
dunder-proto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a"
integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==
dependencies:
call-bind-apply-helpers "^1.0.1"
es-errors "^1.3.0"
gopd "^1.2.0"
ee-first@1.1.1: ee-first@1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
@@ -711,6 +736,23 @@ entities@^4.5.0:
resolved "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" resolved "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
es-define-property@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa"
integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==
es-errors@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
es-object-atoms@^1.0.0, es-object-atoms@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1"
integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==
dependencies:
es-errors "^1.3.0"
esbuild@^0.24.2: esbuild@^0.24.2:
version "0.24.2" version "0.24.2"
resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.24.2.tgz#b5b55bee7de017bff5fb8a4e3e44f2ebe2c3567d" resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.24.2.tgz#b5b55bee7de017bff5fb8a4e3e44f2ebe2c3567d"
@@ -826,6 +868,35 @@ get-intrinsic@^1.0.2:
has "^1.0.3" has "^1.0.3"
has-symbols "^1.0.1" has-symbols "^1.0.1"
get-intrinsic@^1.2.5, get-intrinsic@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01"
integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==
dependencies:
call-bind-apply-helpers "^1.0.2"
es-define-property "^1.0.1"
es-errors "^1.3.0"
es-object-atoms "^1.1.1"
function-bind "^1.1.2"
get-proto "^1.0.1"
gopd "^1.2.0"
has-symbols "^1.1.0"
hasown "^2.0.2"
math-intrinsics "^1.1.0"
get-proto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1"
integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==
dependencies:
dunder-proto "^1.0.1"
es-object-atoms "^1.0.0"
gopd@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1"
integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==
graceful-fs@^4.1.2, graceful-fs@^4.1.6: graceful-fs@^4.1.2, graceful-fs@^4.1.6:
version "4.2.11" version "4.2.11"
resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
@@ -841,6 +912,11 @@ has-symbols@^1.0.1, has-symbols@^1.0.2:
resolved "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" resolved "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
has-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338"
integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==
has-tostringtag@^1.0.0: has-tostringtag@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" resolved "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25"
@@ -1103,6 +1179,11 @@ magic-string@^0.30.17:
dependencies: dependencies:
"@jridgewell/sourcemap-codec" "^1.5.0" "@jridgewell/sourcemap-codec" "^1.5.0"
math-intrinsics@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9"
integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==
media-typer@0.3.0: media-typer@0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" resolved "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
@@ -1209,6 +1290,11 @@ object-assign@^4.1.1:
resolved "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" resolved "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
object-inspect@^1.13.3:
version "1.13.4"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213"
integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==
object-inspect@^1.9.0: object-inspect@^1.9.0:
version "1.12.0" version "1.12.0"
resolved "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" resolved "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0"
@@ -1294,6 +1380,13 @@ punycode@^2.1.0:
resolved "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" resolved "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
qs@^6.14.0:
version "6.14.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.0.tgz#c63fa40680d2c5c941412a0e899c89af60c0a930"
integrity sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==
dependencies:
side-channel "^1.1.0"
qs@^6.4.0: qs@^6.4.0:
version "6.10.3" version "6.10.3"
resolved "https://registry.npmmirror.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" resolved "https://registry.npmmirror.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e"
@@ -1406,6 +1499,35 @@ setprototypeof@1.2.0:
resolved "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" resolved "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
side-channel-list@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad"
integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==
dependencies:
es-errors "^1.3.0"
object-inspect "^1.13.3"
side-channel-map@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42"
integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==
dependencies:
call-bound "^1.0.2"
es-errors "^1.3.0"
get-intrinsic "^1.2.5"
object-inspect "^1.13.3"
side-channel-weakmap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea"
integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==
dependencies:
call-bound "^1.0.2"
es-errors "^1.3.0"
get-intrinsic "^1.2.5"
object-inspect "^1.13.3"
side-channel-map "^1.0.1"
side-channel@^1.0.4: side-channel@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" resolved "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
@@ -1415,6 +1537,17 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2" get-intrinsic "^1.0.2"
object-inspect "^1.9.0" object-inspect "^1.9.0"
side-channel@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9"
integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==
dependencies:
es-errors "^1.3.0"
object-inspect "^1.13.3"
side-channel-list "^1.0.0"
side-channel-map "^1.0.1"
side-channel-weakmap "^1.0.2"
source-map-js@^1.2.0, source-map-js@^1.2.1: source-map-js@^1.2.0, source-map-js@^1.2.1:
version "1.2.1" version "1.2.1"
resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
+5 -5
View File
@@ -210,7 +210,7 @@ export const deleteNotice = (params: any): Promise<any> => {
* 获取QA列表 * 获取QA列表
*/ */
export const getQAList = (params: any): Promise<any> => { export const getQAList = (params: any): Promise<any> => {
return axios.post("/api/QA/list", params); return axios.post("/api/questionAnswer/list", params);
}; };
@@ -218,28 +218,28 @@ export const getQAList = (params: any): Promise<any> => {
* 获取QA详情 * 获取QA详情
*/ */
export const getQA = (params: any): Promise<any> => { export const getQA = (params: any): Promise<any> => {
return axios.get("/api/QA", { params }); return axios.get("/api/questionAnswer", { params });
}; };
/** /**
* 添加QA * 添加QA
*/ */
export const addQA = (params: any): Promise<any> => { export const addQA = (params: any): Promise<any> => {
return axios.post("/api/QA/add", params); return axios.post("/api/questionAnswer/add", params);
}; };
/** /**
* 修改QA * 修改QA
*/ */
export const updateQA = (params: any): Promise<any> => { export const updateQA = (params: any): Promise<any> => {
return axios.post("/api/QA/upd", params); return axios.post("/api/questionAnswer/upd", params);
}; };
/** /**
* 删除QA * 删除QA
*/ */
export const deleteQA = (params: any): Promise<any> => { export const deleteQA = (params: any): Promise<any> => {
return axios.post("/api/QA/delete", params); return axios.post("/api/questionAnswer/delete", params);
}; };
/** /**
+25 -13
View File
@@ -1,13 +1,8 @@
<template> <template>
<el-tag v-for="tag in dynamicTags" :key="tag" class="mx-1" closable :disable-transitions="false" <el-select v-model="dynamicTags" multiple collapse-tags @change="tagsChange" placeholder="Select"
@close="handleClose(tag)"> style="width: 240px">
{{ tag }} <el-option v-for="item in tags" :key="item.id" :label="item.name" :value="item.id" />
</el-tag> </el-select>
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="ml-1 w-20" size="small"
@keyup.enter="handleInputConfirm" @blur="handleInputConfirm" />
<el-button v-else class="button-new-tag ml-1" size="small" @click="showInput">
+ New Tag
</el-button>
</template> </template>
<style scoped> <style scoped>
.mx-1 { .mx-1 {
@@ -15,10 +10,11 @@
margin-right: 0.25rem; margin-right: 0.25rem;
} }
</style> </style>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, ref } from 'vue' import { nextTick, ref, onBeforeMount } from 'vue'
import { ElInput } from 'element-plus' import { ElInput } from 'element-plus'
import * as api from "@/common/api"
const props = defineProps<{ modelValue: [] }>(); const props = defineProps<{ modelValue: [] }>();
const emits = defineEmits<{ const emits = defineEmits<{
@@ -32,7 +28,11 @@ const inputValue = ref('')
const dynamicTags = ref(props.modelValue) const dynamicTags = ref(props.modelValue)
const inputVisible = ref(false) const inputVisible = ref(false)
const InputRef = ref<InstanceType<typeof ElInput>>() const InputRef = ref<InstanceType<typeof ElInput>>()
const tags = ref([]);
onBeforeMount(() => {
getData();
})
const handleClose = (tag: string) => { const handleClose = (tag: string) => {
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1) dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1)
emits('update:modelValue', dynamicTags.value) emits('update:modelValue', dynamicTags.value)
@@ -53,5 +53,17 @@ const handleInputConfirm = () => {
inputVisible.value = false inputVisible.value = false
inputValue.value = '' inputValue.value = ''
} }
</script>
const getData = async () => {
const params = {
page: 1,
pageSize: 999
}
const data = await api.getDynamicList(params, 'tag');
tags.value = data.data;
}
const tagsChange = (value) => {
emits('update:modelValue', value);
}
</script>
+2 -2
View File
@@ -71,9 +71,9 @@ const goTo = (url) => {
const getMenuJson = async () => { const getMenuJson = async () => {
const { data: dataDict } = await api.getDynamic({ id: MENU_JSON }, "dataDict"); const { data: dataDict } = await api.getDynamic({ id: MENU_JSON }, "dataDict");
if (dataDict?.value) { if (dataDict?.jsonValue) {
try { try {
menuJson.value = JSON.parse(dataDict.value); menuJson.value =dataDict.jsonValue;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
+3 -3
View File
@@ -1,6 +1,6 @@
// 接口地址 // 接口地址
export const RECORD_URL = "clyx9ba3a0000qwrb2mjd25sd" export const RECORD_URL = 'ikpro0cj515jl5k3a70gf1en'
// 菜单项 // 菜单项
export const MENU_JSON = "clyzxul91000mqorb1w503q2o" export const MENU_JSON = 'y8gmh2uydvd9a93sza4fsgz7'
// 系统名称 // 系统名称
export const SYSTEM_TITLE = "cm64rpfik0000egrb3x33hbhj" export const SYSTEM_TITLE = 'nrz580ahvnblm3yl85db9uv5'
+29 -9
View File
@@ -1,11 +1,12 @@
import 'reflect-metadata'; import 'reflect-metadata';
import { UmTableForm, import {
UmTableForm,
TableColumnPropertyDecorator as tcpd, TableColumnPropertyDecorator as tcpd,
TableFormColumnPropertyDecorator as tfcpd, TableFormColumnPropertyDecorator as tfcpd,
TableColumnMethodDecorator as tcmd, TableColumnMethodDecorator as tcmd,
TableSearchFormPropertyDecorator as tsfpd TableSearchFormPropertyDecorator as tsfpd
} from "funjiaui"; } from "funjiaui";
import * as api from "@/common/api" import * as api from "@/common/api"
// 数据字典 // 数据字典
const tableName = "dataDict"; const tableName = "dataDict";
@@ -27,18 +28,26 @@ export default class DataDict {
// 操作列宽度 // 操作列宽度
static operateWidth = "140px"; static operateWidth = "140px";
@tcpd({ "lang": "", "def": "数据", minWidth: 120 }) // @tcpd({ "lang": "", "def": "", minWidth: 120 })
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" }) @tfcpd({ "lang": "", "def": "", fieldType: "primaryKey" })
id: number = 0; id: string = "";
@tcpd({ "lang": "", "def": "文档id", minWidth: 120 })
@tfcpd({ "lang": "", "def": "文档id", fieldType: "primaryKey" })
documentId: string = "";
@tcpd({ "lang": "", "def": "唯一标识", minWidth: 120 }) @tcpd({ "lang": "", "def": "唯一标识", minWidth: 120 })
@tfcpd({ "lang": "", "def": "唯一标识", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] }) @tfcpd({ "lang": "", "def": "唯一标识", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
unionKey: string = "" unionKey: string = ""
@tcpd({ "lang": "", "def": "数据", minWidth: 120 }) @tcpd({ "lang": "", "def": "数据", minWidth: 120 })
@tfcpd({ "lang": "", "def": "数据", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] }) @tfcpd({ "lang": "", "def": "数据", fieldType: "string" })
value: string = "" value: string = ""
// @tcpd({ "lang": "", "def": "json数据", minWidth: 120 })
@tfcpd({ "lang": "", "def": "json数据", fieldType: "string" })
jsonValue: string = ""
@tcpd({ "lang": "", "def": "描述", minWidth: 120 }) @tcpd({ "lang": "", "def": "描述", minWidth: 120 })
@tfcpd({ "lang": "", "def": "描述", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] }) @tfcpd({ "lang": "", "def": "描述", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
desc: string = "" desc: string = ""
@@ -67,8 +76,13 @@ export default class DataDict {
* 获取详情数据 * 获取详情数据
*/ */
@tcmd({ "value": { "type": "edit", "es": "onBefore", "dialogContent": UmTableForm, "dialogTitle": "编辑" } }) @tcmd({ "value": { "type": "edit", "es": "onBefore", "dialogContent": UmTableForm, "dialogTitle": "编辑" } })
getDetail = async (rowId: number, r, meta) => { getDetail = async function (rowId: number, r, meta) {
// const rowData = arguments[3].find(item => item.id == rowId);
console.log(arguments);
const { data } = await api.getDynamic({ id: rowId }, tableName); const { data } = await api.getDynamic({ id: rowId }, tableName);
if (data && data.jsonValue) {
data.jsonValue = JSON.stringify(data.jsonValue);
}
return data; return data;
} }
@@ -81,7 +95,11 @@ export default class DataDict {
} }
}) })
onEdit = async (params: any) => { onEdit = async (params: any) => {
const { code, msg } = await api.updateDynamic({ ...params, unionKey: params.unionKey.toUpperCase() }, tableName); const jsonValue = params.jsonValue;
const { code, msg } = await api.updateDynamic({
...params, unionKey: params.unionKey.toUpperCase(),
jsonValue: jsonValue ? JSON.parse(jsonValue) : null
}, tableName);
if (code != 0) { if (code != 0) {
return { code: 1, message: msg }; return { code: 1, message: msg };
} }
@@ -108,7 +126,9 @@ export default class DataDict {
} }
@tcmd({ "key": "table:toolbar", "value": { "type": "批量删除", "priority": 5, "es": "onAfter", "dialogContent": "确定要删除选择的数据吗?" } }) @tcmd({ "key": "table:toolbar", "value": { "type": "批量删除", "priority": 5, "es": "onAfter", "dialogContent": "确定要删除选择的数据吗?" } })
onMutilDel = async (ids: any[]) => { onMutilDel = async function (ids: any[]) {
// console.log(arguments)
// return;
const { code, msg } = await api.deleteDynamic({ ids }, tableName); const { code, msg } = await api.deleteDynamic({ ids }, tableName);
if (code != 0) { if (code != 0) {
return { code: 1, message: msg }; return { code: 1, message: msg };
+67 -7
View File
@@ -11,9 +11,11 @@ import * as api from "@/common/api"
import { h, ref } from 'vue'; import { h, ref } from 'vue';
import SingleUpload from '@/components/SingleUpload.vue'; import SingleUpload from '@/components/SingleUpload.vue';
import axios from 'axios'; import axios from 'axios';
import DataDict from './DataDict';
import { MENU_JSON } from '@/consts/dataDict';
// 插件模块 // 插件模块
const tableName = "plugin"; const tableName = "systemPlugin";
const isShow = (rowData: any) => { const isShow = (rowData: any) => {
if (rowData?.source_add_type == "1") { if (rowData?.source_add_type == "1") {
@@ -32,9 +34,12 @@ export default class Plugin2 {
// 操作列宽度 // 操作列宽度
static operateWidth = "140px"; static operateWidth = "140px";
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" }) // @tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
id: number = 0; id: number = 0;
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
documentId: number = 0;
questionId: string = "" questionId: string = ""
@tcpd({ "lang": "", "def": "名称", minWidth: 120 }) @tcpd({ "lang": "", "def": "名称", minWidth: 120 })
@@ -45,11 +50,22 @@ export default class Plugin2 {
@tfcpd({ "lang": "", "def": "描述", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] }) @tfcpd({ "lang": "", "def": "描述", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
desc: string = "" desc: string = ""
// @tcpd({ "lang": "", "def": "菜单名称", minWidth: 120 })
@tfcpd({ "lang": "", "def": "菜单名称", fieldType: "string" })
menuName: string = ""
@tfcpd({ "lang": "", "def": "路由地址", fieldType: "string" })
menuRoute: string = "/app/dynamicTable/notice/cm9jv4p8q000304nk351t14lj/通知"
@tfcpd({ "lang": "", "def": "菜单排序", fieldType: "string" })
menuSort: number = 9
@tcpd({ "lang": "", "def": "插件脚本绝对地址", minWidth: 120 }) @tcpd({ "lang": "", "def": "插件脚本绝对地址", minWidth: 120 })
@tfcpd({ @tfcpd({
"lang": "", "def": "插件脚本绝对地址", component: function (props) { "lang": "", "def": "插件脚本绝对地址", component: function (props) {
const value = ref<any>(); const value = ref<any>();
const that = this; const that = this;
return h(SingleUpload, { return h(SingleUpload, {
modelValue: value, modelValue: value,
"onFileChange": async (data) => { "onFileChange": async (data) => {
@@ -64,9 +80,9 @@ export default class Plugin2 {
} }
}) })
}, },
rule: [{ "type": "require", message: "不能为空" }] ruless: [{ "type": "require", message: "不能为空" }]
}) })
pluginUrl: string = "" url: string = ""
@tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } }) @tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } })
getList = async (params: any) => { getList = async (params: any) => {
@@ -80,11 +96,55 @@ export default class Plugin2 {
} }
}) })
onAdd = async (data: any) => { onAdd = async (data: any) => {
const { code, msg } = await api.addDynamic({ ...data }, tableName); const formData = {
id: data.id,
documentId: data.documentId,
name: data.name,
desc: data.desc,
url: data.url
};
const { code, msg } = await api.addDynamic({ ...formData }, tableName);
if (code != 0) { if (code != 0) {
return { code: 1, message: msg }; return { code: 1, message: msg };
} }
else { else {
// 更新系统菜单
const menuId = data.id;
const dd = new DataDict();
dd.id = MENU_JSON;
const menuData = await dd.getDetail(dd.id, null, null);
const jsonValueStr = menuData.jsonValue;
const initMenuRoteInfo = (mri) => {
mri.name = data.menuName;
mri.route = data.menuRoute;
mri.sort = data.menuSort;
}
const jsonValue = jsonValueStr ? JSON.parse(jsonValueStr) : [];
// debugger;
let menuInfo = jsonValue.find(item => item.pluginId == menuId)
if (menuInfo) {
// 更新路由信息
initMenuRoteInfo(menuInfo);
}
else {
// 新增路由信息
menuInfo = {};
initMenuRoteInfo(menuInfo);
jsonValue.push(menuInfo);
}
// menuData.jsonValue = JSON.stringify(jsonValue);
const editData = {
jsonValue: JSON.stringify(jsonValue),
desc: menuData.desc,
value: menuData.value,
id: menuData.id,
documentId: menuData.documentId,
unionKey: menuData.unionKey
};
await dd.onEdit(editData);
return { code: 0 }; return { code: 0 };
} }
} }
+51 -36
View File
@@ -8,12 +8,13 @@ import 'reflect-metadata';
import * as api from "@/common/api" import * as api from "@/common/api"
// import UmTableForm from '@/components/UmTable/UmTableForm.vue'; // import UmTableForm from '@/components/UmTable/UmTableForm.vue';
import { UmTableForm, import {
UmTableForm,
TableColumnPropertyDecorator as tcpd, TableColumnPropertyDecorator as tcpd,
TableFormColumnPropertyDecorator as tfcpd, TableFormColumnPropertyDecorator as tfcpd,
TableColumnMethodDecorator as tcmd, TOperateType, TableColumnMethodDecorator as tcmd, TOperateType,
TableSearchFormPropertyDecorator as tsfpd TableSearchFormPropertyDecorator as tsfpd
} from "funjiaui"; } from "funjiaui";
// import { // import {
// TableColumnPropertyDecorator as tcpd, // TableColumnPropertyDecorator as tcpd,
// TableFormColumnPropertyDecorator as tfcpd, // TableFormColumnPropertyDecorator as tfcpd,
@@ -32,7 +33,9 @@ export default class QA {
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" }) @tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
id: number = 0; id: number = 0;
@tsfpd({ lang: "", "def": "题目" }) @tsfpd({ lang: "", "def": "关键字" })
keyword: string = "";
@tcpd({ "lang": "", "def": "题目", minWidth: 120 }) @tcpd({ "lang": "", "def": "题目", minWidth: 120 })
@tfcpd({ "lang": "", "def": "题目", rule: [{ "type": "require", message: "不能为空" }], component: Codemirror }) @tfcpd({ "lang": "", "def": "题目", rule: [{ "type": "require", message: "不能为空" }], component: Codemirror })
question: string = ""; question: string = "";
@@ -41,49 +44,47 @@ export default class QA {
@tfcpd({ "lang": "", "def": "答案", component: Codemirror, width: 300 }) @tfcpd({ "lang": "", "def": "答案", component: Codemirror, width: 300 })
answer: string = ""; 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 }) @tfcpd({ "lang": "", "def": "标签", component: DynamicTags, width: 300 })
@tsfpd({ @tsfpd({
lang: "", "def": "标签", fieldType: "select", async getData() { lang: "", "def": "标签", fieldType: "select", async getData() {
const params = {
page: 1,
pageSize: 999
}
const data = await api.getDynamicList(params, 'tag');
console.log(data.data);
return { return {
data: [{ data: (data?.data || [])?.map(item => {
label: "vue3", return {
value: "vue3" label: item.name,
}, { value: item.documentId
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"
}]
} }
} }
}) })
tag: string[] = []; tags: string[] = [];
@tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } }) @tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } })
getList = async (params: any) => { 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); 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({ // @tcmd({
// "key": "table:toolbar", "value": { // "key": "table:toolbar", "value": {
// "type": "添加", "priority": 1, "es": "onAfter", "dialogContent": UmTableForm, "dialogTitle": "增加", "dialogWidth": 650 // "type": "添加", "priority": 1, "es": "onAfter", "dialogContent": UmTableForm, "dialogTitle": "增加", "dialogWidth": 650
+2 -2
View File
@@ -1273,9 +1273,9 @@ function-bind@^1.1.2:
resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==
"funjia-axios@git+http://git.funjia.top/funjia/funjia-axios.git": "funjia-axios@git+http://git.funjia.top/funjia/funjia-axios.git#v1.0.0":
version "0.0.1" version "0.0.1"
resolved "git+http://git.funjia.top/funjia/funjia-axios.git#b76323800995e88c6fcd3ede5a87ff62f0ff0a9d" resolved "git+http://git.funjia.top/funjia/funjia-axios.git#cde7b6f0c3c83e3d13efb71f1966661c03a8bf70"
dependencies: dependencies:
axios "^0.26.1" axios "^0.26.1"
js-cookie "^3.0.1" js-cookie "^3.0.1"