feat: 增加了一些视图模型
This commit is contained in:
+2
-2
@@ -17,8 +17,8 @@
|
|||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"dayjs": "^1.10.7",
|
"dayjs": "^1.10.7",
|
||||||
"element-plus": "2.1.10",
|
"element-plus": "2.1.10",
|
||||||
"funjialib": "git+http://git.funjia.top/funjia/FunJiaLib_Package.git#v1.1.0",
|
"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.3",
|
||||||
"funjia-axios": "git+http://git.funjia.top/funjia/funjia-axios.git#v1.0.0",
|
"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",
|
||||||
|
|||||||
@@ -0,0 +1,183 @@
|
|||||||
|
|
||||||
|
import 'reflect-metadata';
|
||||||
|
import {
|
||||||
|
TableColumnPropertyDecorator as tcpd,
|
||||||
|
TableFormColumnPropertyDecorator as tfcpd,
|
||||||
|
TableColumnMethodDecorator as tcmd, TOperateType,
|
||||||
|
TableSearchFormPropertyDecorator as tsfpd
|
||||||
|
} from "@/components/UmTable";
|
||||||
|
import * as api from "@/common/api"
|
||||||
|
import UmTableForm from '@/components/UmTable/UmTableForm.vue';
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { isEmpty } from 'marsLib/is';
|
||||||
|
import { fDT } from 'marsLib/date';
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { RECORD_URL } from "@/consts/dataDict";
|
||||||
|
import { env } from 'process';
|
||||||
|
|
||||||
|
const tableName = "record";
|
||||||
|
|
||||||
|
const isShow = (rowData: any) => {
|
||||||
|
if (rowData?.source_add_type == "1") {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Record {
|
||||||
|
// 侵入性事件注入
|
||||||
|
static singleListen: any = null
|
||||||
|
|
||||||
|
static isEdit = false;
|
||||||
|
|
||||||
|
// 操作列宽度
|
||||||
|
static operateWidth = "140px";
|
||||||
|
|
||||||
|
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
|
||||||
|
id: number = 0;
|
||||||
|
|
||||||
|
questionId: string = ""
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "问题", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "问题", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
|
||||||
|
question: string = ""
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "回答", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "回答", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
|
||||||
|
answer: string = ""
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "提交者", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "提交者", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
|
||||||
|
submit: string = ""
|
||||||
|
|
||||||
|
@tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } })
|
||||||
|
getList = async (params: any) => {
|
||||||
|
return await api.getDynamicList(params, tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"key": "table:toolbar", "value": {
|
||||||
|
"type": "添加", "priority": 1, "es": "onAfter", "dialogContent": UmTableForm, "dialogTitle": "增加", "dialogWidth": 650
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onAdd = async (data: any) => {
|
||||||
|
const { code, msg } = await api.addDynamic({ ...data }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情数据
|
||||||
|
*/
|
||||||
|
@tcmd({ "value": { "type": "edit", "es": "onBefore", "dialogContent": UmTableForm, "dialogTitle": "编辑" } })
|
||||||
|
getDetail = async (rowId: number, r, meta) => {
|
||||||
|
const { data } = await api.getDynamic({ id: rowId }, tableName);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"value": {
|
||||||
|
"type": "edit", "es": "onAfter",
|
||||||
|
sort: 2,
|
||||||
|
// isShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onEdit = async (params: any) => {
|
||||||
|
const { code, msg } = await api.updateDynamic({ ...params }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"value": {
|
||||||
|
"type": "del", "es": "onAfter", "dialogContent": "确定要删除该条数据吗?",
|
||||||
|
sort: 3,
|
||||||
|
// isShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
delByIds = async (rowId: number) => {
|
||||||
|
const { code, msg } = await api.deleteDynamic({ ids: [rowId] }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({ "key": "table:toolbar", "value": { "type": "批量删除", "priority": 5, "es": "onAfter", "dialogContent": "确定要删除选择的数据吗?" } })
|
||||||
|
onMutilDel = async (ids: any[]) => {
|
||||||
|
const { code, msg } = await api.deleteDynamic({ ids }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exportText(filename, text) {
|
||||||
|
var element = document.createElement('a');
|
||||||
|
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||||
|
element.setAttribute('download', filename);
|
||||||
|
|
||||||
|
element.style.display = 'none';
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
document.body.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"key": "table:toolbar", "value": {
|
||||||
|
"type": "自定义", id: "anki", "priority": 1, "es": "onAfter", title: "导出anki脚本"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onExport = async (params: any) => {
|
||||||
|
const { data } = await api.getQAList({ ...params, page: 1, pageSize: 10000 });
|
||||||
|
const { data: dataDict } = await api.getDynamic({ id: RECORD_URL }, "dataDict");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const head = `#separator:tab
|
||||||
|
#html:true
|
||||||
|
#tags column:3
|
||||||
|
`
|
||||||
|
const style = `<style>iframe{width:100%;height:90vh;}</style>`;
|
||||||
|
|
||||||
|
const content = data.map(item => {
|
||||||
|
return `"${style}<iframe src=""${dataDict?.value}/#/question?id=${item.id}"" frameborder=""0""></iframe><br>" "${style}<iframe src=""http://192.168.6.130:5176/#/answer?id=${item.id}"" frameborder=""0""></iframe><br>"`;
|
||||||
|
}).join("\n")
|
||||||
|
|
||||||
|
this.exportText("anki脚本.txt", head + content);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @tcmd({
|
||||||
|
// "value": {
|
||||||
|
// "id": 1, "type": "customOperateEvent", "title": "详情",
|
||||||
|
// sort: 1,
|
||||||
|
// isShow: (rowData) => {
|
||||||
|
// if (rowData?.snaper_image > 0) {
|
||||||
|
// return true;
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// jumpEmployee = (rowId: number) => {
|
||||||
|
// return rowId;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
|
||||||
|
import 'reflect-metadata';
|
||||||
|
import {
|
||||||
|
TableColumnPropertyDecorator as tcpd,
|
||||||
|
TableFormColumnPropertyDecorator as tfcpd,
|
||||||
|
TableColumnMethodDecorator as tcmd, TOperateType,
|
||||||
|
TableSearchFormPropertyDecorator as tsfpd
|
||||||
|
} from "@/components/UmTable";
|
||||||
|
import * as api from "@/common/api"
|
||||||
|
import UmTableForm from '@/components/UmTable/UmTableForm.vue';
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { isEmpty } from 'marsLib/is';
|
||||||
|
import { fDT } from 'marsLib/date';
|
||||||
|
import { h } from 'vue';
|
||||||
|
|
||||||
|
const tableName = "recordUser";
|
||||||
|
|
||||||
|
const isShow = (rowData: any) => {
|
||||||
|
if (rowData?.source_add_type == "1") {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class RecordUser {
|
||||||
|
// 侵入性事件注入
|
||||||
|
static singleListen: any = null
|
||||||
|
|
||||||
|
static isEdit = false;
|
||||||
|
|
||||||
|
// 操作列宽度
|
||||||
|
static operateWidth = "140px";
|
||||||
|
|
||||||
|
@tfcpd({ "lang": "", "def": "id", fieldType: "primaryKey" })
|
||||||
|
id: number = 0;
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "名称", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "名称", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
|
||||||
|
name: string = ""
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "指纹", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "指纹", fieldType: "string", rule: [{ "type": "require", message: "不能为空" }] })
|
||||||
|
fingerprint: string = ""
|
||||||
|
|
||||||
|
@tcpd({ "lang": "", "def": "设备", minWidth: 120 })
|
||||||
|
@tfcpd({ "lang": "", "def": "设备", fieldType: "string"})
|
||||||
|
device: string = ""
|
||||||
|
|
||||||
|
@tcmd({ "key": "table:searchFormMethod", "value": { "type": "getList", "es": "onAfter" } })
|
||||||
|
getList = async (params: any) => {
|
||||||
|
return await api.getDynamicList(params, tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"key": "table:toolbar", "value": {
|
||||||
|
"type": "添加", "priority": 1, "es": "onAfter", "dialogContent": UmTableForm, "dialogTitle": "增加", "dialogWidth": 650
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onAdd = async (data: any) => {
|
||||||
|
const { code, msg } = await api.addDynamic({ ...data }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情数据
|
||||||
|
*/
|
||||||
|
@tcmd({ "value": { "type": "edit", "es": "onBefore", "dialogContent": UmTableForm, "dialogTitle": "编辑" } })
|
||||||
|
getDetail = async (rowId: number, r, meta) => {
|
||||||
|
const { data } = await api.getDynamic({ id: rowId }, tableName);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"value": {
|
||||||
|
"type": "edit", "es": "onAfter",
|
||||||
|
sort: 2,
|
||||||
|
// isShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onEdit = async (params: any) => {
|
||||||
|
const { code, msg } = await api.updateDynamic({ ...params }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@tcmd({
|
||||||
|
"value": {
|
||||||
|
"type": "del", "es": "onAfter", "dialogContent": "确定要删除该条数据吗?",
|
||||||
|
sort: 3,
|
||||||
|
// isShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
delByIds = async (rowId: number) => {
|
||||||
|
const { code, msg } = await api.deleteDynamic({ ids: [rowId] }, tableName);
|
||||||
|
if (code != 0) {
|
||||||
|
return { code: 1, message: msg };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return { code: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @tcmd({
|
||||||
|
// "value": {
|
||||||
|
// "id": 1, "type": "customOperateEvent", "title": "详情",
|
||||||
|
// sort: 1,
|
||||||
|
// isShow: (rowData) => {
|
||||||
|
// if (rowData?.snaper_image > 0) {
|
||||||
|
// return true;
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// jumpEmployee = (rowId: number) => {
|
||||||
|
// return rowId;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ import { UmByClassEnhance as UmTableClassEnhance } from "funjiaui";
|
|||||||
import Record from "@/containers/viewModel/DataDict";
|
import Record from "@/containers/viewModel/DataDict";
|
||||||
import ImgPreview from "@/components/ImgPreview.vue";
|
import ImgPreview from "@/components/ImgPreview.vue";
|
||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch } from "vue";
|
||||||
import CaptureList from "@/containers/CaptureList.vue";
|
// import CaptureList from "@/containers/CaptureList.vue";
|
||||||
import { useAppStore } from "@/store/app";
|
import { useAppStore } from "@/store/app";
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import ImgPreview from "@/components/ImgPreview.vue";
|
|||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch } from "vue";
|
||||||
import * as api from "@/common/api";
|
import * as api from "@/common/api";
|
||||||
// import { fDT } from "marsLib/date";
|
// import { fDT } from "marsLib/date";
|
||||||
import CaptureList from "@/containers/CaptureList.vue";
|
// import CaptureList from "@/containers/CaptureList.vue";
|
||||||
import { useAppStore } from "@/store/app";
|
import { useAppStore } from "@/store/app";
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import QA from "@/containers/viewModel/QA";
|
|||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch } from "vue";
|
||||||
import * as api from "@/common/api";
|
import * as api from "@/common/api";
|
||||||
// import { fDT } from "marsLib/date";
|
// import { fDT } from "marsLib/date";
|
||||||
import CaptureList from "@/containers/CaptureList.vue";
|
// import CaptureList from "@/containers/CaptureList.vue";
|
||||||
// import "funjiaui/style.css";
|
// import "funjiaui/style.css";
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ export default defineConfig({
|
|||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
proxy: {
|
proxy: {
|
||||||
"^/api": {
|
"^/api": {
|
||||||
target: "http://localhost:4873/",
|
// target: "http://localhost:4873/",
|
||||||
|
target: "http://all.funjia.top/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"^/static": {
|
"^/static": {
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -1284,9 +1284,9 @@ function-bind@^1.1.2:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "git+http://git.funjia.top/funjia/FunJiaLib_Package.git#07908bb596bb21750d0298460df12ba963a70fa6"
|
resolved "git+http://git.funjia.top/funjia/FunJiaLib_Package.git#07908bb596bb21750d0298460df12ba963a70fa6"
|
||||||
|
|
||||||
"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.3":
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "git+http://git.funjia.top/funjia/FunjiaUI_Vue.git#503af87b2b4d35728f8a8f8aeb7029c2cbf246c5"
|
resolved "git+http://git.funjia.top/funjia/FunjiaUI_Vue.git#bb50f43c9c224f93d99ecfb240f08237e1fe7f58"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@codemirror/lang-javascript" "^6.1.7"
|
"@codemirror/lang-javascript" "^6.1.7"
|
||||||
"@kousum/vue3-window" "^0.0.3"
|
"@kousum/vue3-window" "^0.0.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user