|
@@ -1,29 +1,33 @@
|
|
|
<script setup lang="tsx">
|
|
|
-import {h, ref, onActivated, watch, onUnmounted} from "vue";
|
|
|
-import * as vue from 'vue'
|
|
|
-import {PageHeader, PageJsonObject} from "@/api/reports/report-query-center";
|
|
|
-import {useCompRef} from "@/utils/useCompRef";
|
|
|
-import {ElButton, ElForm, ElOption} from "element-plus";
|
|
|
+import { h, ref, onActivated, watch, onUnmounted } from "vue";
|
|
|
+import * as vue from "vue";
|
|
|
+import { PageHeader, PageJsonObject } from "@/api/reports/report-query-center";
|
|
|
+import { useCompRef } from "@/utils/useCompRef";
|
|
|
+import { ElButton, ElForm, ElOption } from "element-plus";
|
|
|
import PageFormBind from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageFormBind.vue";
|
|
|
-import {ArrowLeft, ArrowRight, DeleteFilled} from "@element-plus/icons-vue";
|
|
|
-import {reportQueryCenterApi} from "@/api/base-data/report-center";
|
|
|
+import { ArrowLeft, ArrowRight, DeleteFilled } from "@element-plus/icons-vue";
|
|
|
+import { reportQueryCenterApi } from "@/api/base-data/report-center";
|
|
|
import XEUtils from "xe-utils";
|
|
|
-import {xcMessage} from "@/utils/xiaochan-element-plus";
|
|
|
+import { xcMessage } from "@/utils/xiaochan-element-plus";
|
|
|
import PageAddComponent from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageAddComponent.vue";
|
|
|
-import {capitalizeFirstLetter, usePageStore, ElAndXc} from "@/views/data-base/page-editor-help-v2/page-help-v2";
|
|
|
-import {shortcutTrigger, xcEvent} from "@/utils/xckeydown";
|
|
|
+import {
|
|
|
+ capitalizeFirstLetter,
|
|
|
+ usePageStore,
|
|
|
+ ElAndXc,
|
|
|
+} from "@/views/data-base/page-editor-help-v2/page-help-v2";
|
|
|
+import { shortcutTrigger, xcEvent } from "@/utils/xckeydown";
|
|
|
import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
|
|
|
import PageHelpTable from "@/views/data-base/page-editor-help-v2/components/PageHelpTable.vue";
|
|
|
-import {useUserStore} from "@/pinia/user-store";
|
|
|
-import {onDeactivated} from "@vue/runtime-core";
|
|
|
+import { useUserStore } from "@/pinia/user-store";
|
|
|
+import { onDeactivated } from "@vue/runtime-core";
|
|
|
|
|
|
interface Columns {
|
|
|
- title: string,
|
|
|
- key: string,
|
|
|
- dataKey: string,
|
|
|
+ title: string;
|
|
|
+ key: string;
|
|
|
+ dataKey: string;
|
|
|
func?: {
|
|
|
- cellRenderer: string
|
|
|
- }
|
|
|
+ cellRenderer: string;
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -38,16 +42,16 @@ const props = defineProps({
|
|
|
},
|
|
|
doTest: {
|
|
|
type: Function,
|
|
|
- default: null
|
|
|
+ default: null,
|
|
|
},
|
|
|
isEditor: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
- }
|
|
|
-})
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+});
|
|
|
|
|
|
-const userStore = useUserStore()
|
|
|
-const store = usePageStore(props)
|
|
|
+const userStore = useUserStore();
|
|
|
+const store = usePageStore(props);
|
|
|
|
|
|
const {
|
|
|
currentClickIndex,
|
|
@@ -56,159 +60,168 @@ const {
|
|
|
tableBind,
|
|
|
handleSavaData,
|
|
|
bindData,
|
|
|
- mutation
|
|
|
-} = store
|
|
|
+ mutation,
|
|
|
+} = store;
|
|
|
|
|
|
-const formRef = useCompRef(ElForm)
|
|
|
-const headerRef = ref<HTMLDivElement>()
|
|
|
-const emits = defineEmits(['changeTabs'])
|
|
|
-const userInfo = XEUtils.clone(userStore.userInfo, true)
|
|
|
+const formRef = useCompRef(ElForm);
|
|
|
+const headerRef = ref<HTMLDivElement>();
|
|
|
+const emits = defineEmits(["changeTabs"]);
|
|
|
+const userInfo = XEUtils.clone(userStore.userInfo, true);
|
|
|
|
|
|
const render = (item: PageHeader) => {
|
|
|
- const modelValue = typeof pageData.value.params[item.key] === 'undefined' ? "" : pageData.value.params[item.key];
|
|
|
+ const modelValue =
|
|
|
+ typeof pageData.value.params[item.key] === "undefined"
|
|
|
+ ? ""
|
|
|
+ : pageData.value.params[item.key];
|
|
|
const tempProps: {
|
|
|
- [key: string]: any
|
|
|
+ [key: string]: any;
|
|
|
} = {
|
|
|
modelValue: modelValue,
|
|
|
"onUpdate:modelValue": (val: any) => {
|
|
|
- pageData.value.params[item.key] = val
|
|
|
+ pageData.value.params[item.key] = val;
|
|
|
},
|
|
|
- ...item.bind
|
|
|
- }
|
|
|
+ ...item.bind,
|
|
|
+ };
|
|
|
|
|
|
if (item.on) {
|
|
|
for (const onKey in item.on) {
|
|
|
- const key = capitalizeFirstLetter(onKey, 'on')
|
|
|
- tempProps[key] = (...val: any) => newFunc(item, val, item.on[onKey])
|
|
|
+ const key = capitalizeFirstLetter(onKey, "on");
|
|
|
+ tempProps[key] = (...val: any) => newFunc(item, val, item.on[onKey]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (item.func) {
|
|
|
for (let funcKey in item.func) {
|
|
|
- tempProps[funcKey] = (...val: any) => newFunc(item, val, item.func[funcKey])
|
|
|
+ tempProps[funcKey] = (...val: any) =>
|
|
|
+ newFunc(item, val, item.func[funcKey]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let child = null
|
|
|
+ let child = null;
|
|
|
|
|
|
if (item.selectOptions) {
|
|
|
- child = []
|
|
|
+ child = [];
|
|
|
item.selectOptions.forEach(cItem => {
|
|
|
// @ts-ignore
|
|
|
- const tempH = h(ElOption, {label: cItem.name, value: cItem.code}, () => null)
|
|
|
- child.push(tempH)
|
|
|
- })
|
|
|
+ const tempH = h(
|
|
|
+ ElOption,
|
|
|
+ { label: cItem.name, value: cItem.code },
|
|
|
+ () => null
|
|
|
+ );
|
|
|
+ child.push(tempH);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- return h(ElAndXc[item.name], tempProps, () => child)
|
|
|
-}
|
|
|
+ return h(ElAndXc[item.name], tempProps, () => child);
|
|
|
+};
|
|
|
|
|
|
const isActive = (index: number) => {
|
|
|
- return index === currentClickIndex.value
|
|
|
-}
|
|
|
+ return index === currentClickIndex.value;
|
|
|
+};
|
|
|
|
|
|
function formItemClick(item: PageHeader, index: number) {
|
|
|
- emits('changeTabs', "属性配置")
|
|
|
+ emits("changeTabs", "属性配置");
|
|
|
if (props.componentAttribute == null) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- currentClickIndex.value = index
|
|
|
- store.changeCurrentBind(item)
|
|
|
+ currentClickIndex.value = index;
|
|
|
+ store.changeCurrentBind(item);
|
|
|
}
|
|
|
|
|
|
function upClick(index: number) {
|
|
|
- if (index === 0) return
|
|
|
- swapItems(pageData.value.header, index, index - 1)
|
|
|
- currentClickIndex.value = index - 1
|
|
|
+ if (index === 0) return;
|
|
|
+ swapItems(pageData.value.header, index, index - 1);
|
|
|
+ currentClickIndex.value = index - 1;
|
|
|
}
|
|
|
|
|
|
function downClick(index: number) {
|
|
|
if (index === pageData.value.header.length - 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- swapItems(pageData.value.header, index, index + 1)
|
|
|
- currentClickIndex.value = index + 1
|
|
|
+ swapItems(pageData.value.header, index, index + 1);
|
|
|
+ currentClickIndex.value = index + 1;
|
|
|
}
|
|
|
|
|
|
function swapItems(arr: any[], currentClickIndex: number, newIndex: number) {
|
|
|
- arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0]
|
|
|
- return arr
|
|
|
+ arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0];
|
|
|
+ return arr;
|
|
|
}
|
|
|
|
|
|
function delClick(index: number) {
|
|
|
- currentClickIndex.value = -1
|
|
|
- store.changeCurrentBind(null)
|
|
|
- pageData.value.header.splice(index, 1)
|
|
|
+ currentClickIndex.value = -1;
|
|
|
+ store.changeCurrentBind(null);
|
|
|
+ pageData.value.header.splice(index, 1);
|
|
|
}
|
|
|
|
|
|
async function queryClick() {
|
|
|
- emits('changeTabs', "表格")
|
|
|
+ emits("changeTabs", "表格");
|
|
|
const tempData = {
|
|
|
- ...pageData.value.params
|
|
|
- }
|
|
|
- await formRef.value!.validate()
|
|
|
- loading.value = true
|
|
|
+ ...pageData.value.params,
|
|
|
+ };
|
|
|
+ await formRef.value!.validate();
|
|
|
+ loading.value = true;
|
|
|
await reportQueryCenterApi(pageData.value.submitUrl, tempData)
|
|
|
- .then(res => {
|
|
|
- setTableData(res)
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- initTable()
|
|
|
- console.error(e)
|
|
|
- xcMessage.error(e.response.data.error)
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- loading.value = false
|
|
|
- })
|
|
|
+ .then(res => {
|
|
|
+ setTableData(res);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ initTable();
|
|
|
+ console.error(e);
|
|
|
+ xcMessage.error(e.response.data.error);
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
type TableBindTs = {
|
|
|
- data: any[],
|
|
|
- columns: any[],
|
|
|
- tableBind: {}
|
|
|
-}
|
|
|
+ data: any[];
|
|
|
+ columns: any[];
|
|
|
+ tableBind: {};
|
|
|
+};
|
|
|
|
|
|
-const rules = ref({})
|
|
|
+const rules = ref({});
|
|
|
|
|
|
const dialogTableData = ref<TableBindTs>({
|
|
|
data: [],
|
|
|
columns: [],
|
|
|
- tableBind: {}
|
|
|
-})
|
|
|
+ tableBind: {},
|
|
|
+});
|
|
|
|
|
|
function initTable() {
|
|
|
- tableBind.value.data = []
|
|
|
+ tableBind.value.data = [];
|
|
|
tableBind.value.columns = [];
|
|
|
- tableBind.value.tableBind = {}
|
|
|
+ tableBind.value.tableBind = {};
|
|
|
|
|
|
- dialogTableData.value.data = []
|
|
|
+ dialogTableData.value.data = [];
|
|
|
dialogTableData.value.columns = [];
|
|
|
- dialogTableData.value.tableBind = {}
|
|
|
+ dialogTableData.value.tableBind = {};
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-const showDialog = ref(false)
|
|
|
-const dialogTitle = ref('详情')
|
|
|
-const loading = ref(false)
|
|
|
+const showDialog = ref(false);
|
|
|
+const dialogTitle = ref("详情");
|
|
|
+const loading = ref(false);
|
|
|
|
|
|
function requiredInit() {
|
|
|
- formRef.value!.resetFields()
|
|
|
- rules.value = []
|
|
|
+ formRef.value!.resetFields();
|
|
|
+ rules.value = [];
|
|
|
pageData.value.header.forEach(item => {
|
|
|
if (item.required) {
|
|
|
- rules.value[item.key] = [{required: true, message: '必填', trigger: 'blur'}]
|
|
|
+ rules.value[item.key] = [
|
|
|
+ { required: true, message: "必填", trigger: "blur" },
|
|
|
+ ];
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
async function handleOnAndFuncEvent(data: PageJsonObject) {
|
|
|
for (let i = 0; i < data.header.length; i++) {
|
|
|
- const item = data.header[i]
|
|
|
+ const item = data.header[i];
|
|
|
if (item.on && item.on.mounted) {
|
|
|
try {
|
|
|
- await newFunc(item, '', item.on.mounted)
|
|
|
+ await newFunc(item, "", item.on.mounted);
|
|
|
} catch (e) {
|
|
|
- console.error("执行初始化函数错误", e)
|
|
|
+ console.error("执行初始化函数错误", e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -216,97 +229,113 @@ async function handleOnAndFuncEvent(data: PageJsonObject) {
|
|
|
|
|
|
async function refresh() {
|
|
|
clearOnAndFunc();
|
|
|
- await setPageData(pageData.value, currentClickIndex.value)
|
|
|
+ await setPageData(pageData.value, currentClickIndex.value);
|
|
|
}
|
|
|
|
|
|
async function setPageData(data: PageJsonObject, currentIndex = -1) {
|
|
|
const temp: PageJsonObject = XEUtils.clone(data, true);
|
|
|
- queryKey.value = {}
|
|
|
+ queryKey.value = {};
|
|
|
temp.header.forEach((item, index) => {
|
|
|
- queryKey.value[item.key] = index
|
|
|
- })
|
|
|
+ queryKey.value[item.key] = index;
|
|
|
+ });
|
|
|
if (!XEUtils.isEmpty(temp.paramsDefaultValue)) {
|
|
|
- temp.params = XEUtils.clone(temp.paramsDefaultValue, true)
|
|
|
+ temp.params = XEUtils.clone(temp.paramsDefaultValue, true);
|
|
|
}
|
|
|
- await handleOnAndFuncEvent(temp)
|
|
|
- pageData.value = temp
|
|
|
+ await handleOnAndFuncEvent(temp);
|
|
|
+ pageData.value = temp;
|
|
|
if (currentIndex > 0) {
|
|
|
- await store.changeCurrentBind(pageData.value.header[currentClickIndex.value])
|
|
|
+ await store.changeCurrentBind(
|
|
|
+ pageData.value.header[currentClickIndex.value]
|
|
|
+ );
|
|
|
} else {
|
|
|
- await store.changeCurrentBind(null)
|
|
|
+ await store.changeCurrentBind(null);
|
|
|
}
|
|
|
- currentClickIndex.value = currentIndex
|
|
|
- initTable()
|
|
|
- requiredInit()
|
|
|
+ currentClickIndex.value = currentIndex;
|
|
|
+ initTable();
|
|
|
+ requiredInit();
|
|
|
}
|
|
|
|
|
|
-mutation.setPageData = setPageData
|
|
|
+mutation.setPageData = setPageData;
|
|
|
|
|
|
function getBindDefaultValue(name: string) {
|
|
|
- const res = {}
|
|
|
+ const res = {};
|
|
|
if (XEUtils.has(bindData.value, name)) {
|
|
|
- const a = bindData.value[name].bind
|
|
|
+ const a = bindData.value[name].bind;
|
|
|
for (let key in a) {
|
|
|
- res[key] = a[key].defaultValue
|
|
|
+ res[key] = a[key].defaultValue;
|
|
|
}
|
|
|
}
|
|
|
- return res
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
-const AsyncFunction = Object.getPrototypeOf(async function () {
|
|
|
-}).constructor;
|
|
|
-
|
|
|
+const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
|
|
|
|
|
|
type QueryKeyTs = {
|
|
|
- [K in PageHeader[][number]['key']]: any
|
|
|
-}
|
|
|
+ [K in PageHeader[][number]["key"]]: any;
|
|
|
+};
|
|
|
|
|
|
-const queryKey = ref<QueryKeyTs>({})
|
|
|
+const queryKey = ref<QueryKeyTs>({});
|
|
|
|
|
|
function newFunc(currentBind: PageHeader, value: any, funcStr: string) {
|
|
|
function updateView() {
|
|
|
- queryKey.value[currentBind.key] += pageData.value.header.length + queryKey.value[currentBind.key]
|
|
|
+ queryKey.value[currentBind.key] +=
|
|
|
+ pageData.value.header.length + queryKey.value[currentBind.key];
|
|
|
}
|
|
|
|
|
|
- const func = new AsyncFunction('pageJson', 'currentBind', 'apiFunc', 'updateView', 'val', 'userInfo', funcStr)
|
|
|
+ const func = new AsyncFunction(
|
|
|
+ "pageJson",
|
|
|
+ "currentBind",
|
|
|
+ "apiFunc",
|
|
|
+ "updateView",
|
|
|
+ "val",
|
|
|
+ "userInfo",
|
|
|
+ funcStr
|
|
|
+ );
|
|
|
try {
|
|
|
- return func(pageData.value, currentBind, reportQueryCenterApi, updateView, value, userInfo)
|
|
|
+ return func(
|
|
|
+ pageData.value,
|
|
|
+ currentBind,
|
|
|
+ reportQueryCenterApi,
|
|
|
+ updateView,
|
|
|
+ value,
|
|
|
+ userInfo
|
|
|
+ );
|
|
|
} catch (e) {
|
|
|
- console.error('脚本错误', e)
|
|
|
+ console.error("脚本错误", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function addComponent(data: PageHeader) {
|
|
|
- const temp = XEUtils.clone(data, true)
|
|
|
- Object.assign(temp.bind, getBindDefaultValue(data.name))
|
|
|
- queryKey.value[temp.key] = pageData.value.header.length
|
|
|
+ const temp = XEUtils.clone(data, true);
|
|
|
+ Object.assign(temp.bind, getBindDefaultValue(data.name));
|
|
|
+ queryKey.value[temp.key] = pageData.value.header.length;
|
|
|
if (temp.on && temp.on.mounted) {
|
|
|
try {
|
|
|
- await newFunc(temp, '', temp.on.mounted)
|
|
|
+ await newFunc(temp, "", temp.on.mounted);
|
|
|
} catch (e) {
|
|
|
- console.error("执行初始化函数错误", e)
|
|
|
+ console.error("执行初始化函数错误", e);
|
|
|
}
|
|
|
}
|
|
|
- pageData.value.header.push(temp)
|
|
|
+ pageData.value.header.push(temp);
|
|
|
}
|
|
|
|
|
|
async function testClick() {
|
|
|
- await formRef.value!.validate()
|
|
|
- const data: QueryKeyTs = {}
|
|
|
+ await formRef.value!.validate();
|
|
|
+ const data: QueryKeyTs = {};
|
|
|
pageData.value.header.forEach(item => {
|
|
|
- data[item.key] = pageData.value.params[item.key]
|
|
|
- })
|
|
|
- props?.doTest(data)
|
|
|
+ data[item.key] = pageData.value.params[item.key];
|
|
|
+ });
|
|
|
+ props?.doTest(data);
|
|
|
}
|
|
|
|
|
|
-function openDialogAndSetData(data: TableBindTs, title: string = '详情') {
|
|
|
- dialogTitle.value = title
|
|
|
- showDialog.value = true
|
|
|
- dialogTableData.value = data
|
|
|
+function openDialogAndSetData(data: TableBindTs, title: string = "详情") {
|
|
|
+ dialogTitle.value = title;
|
|
|
+ showDialog.value = true;
|
|
|
+ dialogTableData.value = data;
|
|
|
}
|
|
|
|
|
|
function dialogTableColumns() {
|
|
|
- store.getColumns(dialogTableData, 'dialogTableRef')
|
|
|
+ store.getColumns(dialogTableData, "dialogTableRef");
|
|
|
}
|
|
|
|
|
|
function setTableData(res: any) {
|
|
@@ -314,19 +343,19 @@ function setTableData(res: any) {
|
|
|
res = {
|
|
|
columns: [],
|
|
|
data: [],
|
|
|
- tableBind: {}
|
|
|
- }
|
|
|
+ tableBind: {},
|
|
|
+ };
|
|
|
}
|
|
|
tableBind.value = res;
|
|
|
- store.getColumns(tableBind, 'mainTableRef', false)
|
|
|
+ store.getColumns(tableBind, "mainTableRef", false);
|
|
|
if (res.details) {
|
|
|
//@ts-ignore
|
|
|
tableBind.value.columns.push({
|
|
|
- field: 'operations',
|
|
|
- title: '详情',
|
|
|
+ field: "operations",
|
|
|
+ title: "详情",
|
|
|
width: 70,
|
|
|
- align: 'center',
|
|
|
- fixed: 'right',
|
|
|
+ align: "center",
|
|
|
+ fixed: "right",
|
|
|
slots: {
|
|
|
default: `
|
|
|
const {h} = vue
|
|
@@ -345,104 +374,137 @@ function setTableData(res: any) {
|
|
|
})
|
|
|
}
|
|
|
}, () => "详情")
|
|
|
- `
|
|
|
- }
|
|
|
- })
|
|
|
+ `,
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getSlotsData(row: any, index: number, code: string) {
|
|
|
- const newFunction = new Function("row", 'rowIndex', "pageData", "apiFunc", "el", "vue", "openDialogAndSetData", code)
|
|
|
- return newFunction(row, index, pageData.value, reportQueryCenterApi, ElAndXc, vue, openDialogAndSetData)
|
|
|
+ const newFunction = new Function(
|
|
|
+ "row",
|
|
|
+ "rowIndex",
|
|
|
+ "pageData",
|
|
|
+ "apiFunc",
|
|
|
+ "el",
|
|
|
+ "vue",
|
|
|
+ "openDialogAndSetData",
|
|
|
+ code
|
|
|
+ );
|
|
|
+ return newFunction(
|
|
|
+ row,
|
|
|
+ index,
|
|
|
+ pageData.value,
|
|
|
+ reportQueryCenterApi,
|
|
|
+ ElAndXc,
|
|
|
+ vue,
|
|
|
+ openDialogAndSetData
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
-function exportExcel(data: { data: any[], columns: Columns[], fileName?: string }, tableRef) {
|
|
|
+function exportExcel(
|
|
|
+ data: { data: any[]; columns: Columns[]; fileName?: string },
|
|
|
+ tableRef
|
|
|
+) {
|
|
|
if (data.data.length === 0) {
|
|
|
- xcMessage.warning("没有可以导出的数据。")
|
|
|
- return
|
|
|
+ xcMessage.warning("没有可以导出的数据。");
|
|
|
+ return;
|
|
|
}
|
|
|
tableRef.value.openExport({
|
|
|
filename: data.fileName,
|
|
|
- types: ['csv', 'html', 'xml', 'txt', 'xlsx'],
|
|
|
- type: 'csv',
|
|
|
+ types: ["csv", "html", "xml", "txt", "xlsx"],
|
|
|
+ type: "csv",
|
|
|
useStyle: true,
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
let shortcutKeyRegistration = {
|
|
|
- ctrl: {s: handleSavaData}
|
|
|
-}
|
|
|
+ ctrl: { s: handleSavaData },
|
|
|
+};
|
|
|
|
|
|
-let keyWatch = XEUtils.noop
|
|
|
+let keyWatch = XEUtils.noop;
|
|
|
|
|
|
onMounted(() => {
|
|
|
- if (!props.isEditor) return
|
|
|
- keyWatch = watch(() => xcEvent.value, () => {
|
|
|
- shortcutTrigger(xcEvent.value, shortcutKeyRegistration)
|
|
|
- })
|
|
|
-})
|
|
|
+ if (!props.isEditor) return;
|
|
|
+ keyWatch = watch(
|
|
|
+ () => xcEvent.value,
|
|
|
+ () => {
|
|
|
+ shortcutTrigger(xcEvent.value, shortcutKeyRegistration);
|
|
|
+ }
|
|
|
+ );
|
|
|
+});
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
- keyWatch()
|
|
|
-})
|
|
|
+ keyWatch();
|
|
|
+});
|
|
|
|
|
|
defineExpose({
|
|
|
setPageData,
|
|
|
setTableData,
|
|
|
setUrl: (val: string) => {
|
|
|
if (pageData.value.submitUrl) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- pageData.value.submitUrl = val
|
|
|
- }
|
|
|
-})
|
|
|
+ pageData.value.submitUrl = val;
|
|
|
+ },
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
-
|
|
|
<div class="layout_container">
|
|
|
<header>
|
|
|
<div class="cy-page_help_v2-header" ref="headerRef">
|
|
|
- <el-form v-bind="pageData.fromConfig"
|
|
|
- :rules="rules"
|
|
|
- ref="formRef"
|
|
|
- :model="pageData.params">
|
|
|
- <div v-for="(item, index) in pageData.header"
|
|
|
- v-if="pageData.header.length > 0"
|
|
|
- :key="queryKey[item.key]"
|
|
|
- class="page-item_div"
|
|
|
- :class="isActive(index) ? 'page-item_active': ''">
|
|
|
+ <el-form
|
|
|
+ v-bind="pageData.fromConfig"
|
|
|
+ :rules="rules"
|
|
|
+ ref="formRef"
|
|
|
+ :model="pageData.params"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in pageData.header"
|
|
|
+ v-if="pageData.header.length > 0"
|
|
|
+ :key="queryKey[item.key]"
|
|
|
+ class="page-item_div"
|
|
|
+ :class="isActive(index) ? 'page-item_active' : ''"
|
|
|
+ >
|
|
|
<div v-if="currentClickIndex === index" class="tool">
|
|
|
<div class="tool_item" @click.stop="upClick(index)">
|
|
|
<el-icon>
|
|
|
- <ArrowLeft/>
|
|
|
+ <ArrowLeft />
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
<div class="tool_item" @click.stop="downClick(index)">
|
|
|
<el-icon>
|
|
|
- <ArrowRight/>
|
|
|
+ <ArrowRight />
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
<div class="tool_item" @click.stop="delClick(index)">
|
|
|
<el-icon>
|
|
|
- <DeleteFilled/>
|
|
|
+ <DeleteFilled />
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-form-item :prop="item.key"
|
|
|
- @click.stop.prevent="formItemClick(item, index)"
|
|
|
- :label="item.label">
|
|
|
- <component :is="render(item)"/>
|
|
|
+ <el-form-item
|
|
|
+ :prop="item.key"
|
|
|
+ @click.stop.prevent="formItemClick(item, index)"
|
|
|
+ :label="item.label"
|
|
|
+ >
|
|
|
+ <component :is="render(item)" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<el-form-item>
|
|
|
<el-button @click="refresh">刷新</el-button>
|
|
|
- <el-button type="warning" v-if="props.doTest" @click="testClick">测试</el-button>
|
|
|
- <el-button type="primary" @click="queryClick" icon="Search">查询</el-button>
|
|
|
+ <el-button type="warning" v-if="props.doTest" @click="testClick"
|
|
|
+ >测试</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="queryClick" icon="Search"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
- @click="exportExcel(tableBind,store.mainTableRef)"
|
|
|
- type="primary"
|
|
|
- icon="Download">
|
|
|
+ @click="exportExcel(tableBind, store.mainTableRef)"
|
|
|
+ type="primary"
|
|
|
+ icon="Download"
|
|
|
+ >
|
|
|
导出Excel
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
@@ -450,52 +512,64 @@ defineExpose({
|
|
|
</div>
|
|
|
</header>
|
|
|
<div class="layout_main">
|
|
|
- <div class="cy-page_help_v2-main"
|
|
|
- style="width: 100%; height: 100%"
|
|
|
- v-loading="loading">
|
|
|
- <PageHelpTable :data="tableBind.data"
|
|
|
- :table-bind="tableBind.tableBind"
|
|
|
- :store="store"
|
|
|
- :getSlotsData="getSlotsData"
|
|
|
- tableRefName="mainTableRef"
|
|
|
- :columns="tableBind.columns"
|
|
|
+ <div
|
|
|
+ class="cy-page_help_v2-main"
|
|
|
+ style="width: 100%; height: 100%"
|
|
|
+ v-loading="loading"
|
|
|
+ >
|
|
|
+ <PageHelpTable
|
|
|
+ :data="tableBind.data"
|
|
|
+ :table-bind="tableBind.tableBind"
|
|
|
+ :store="store"
|
|
|
+ :getSlotsData="getSlotsData"
|
|
|
+ tableRefName="mainTableRef"
|
|
|
+ :columns="tableBind.columns"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog v-model="showDialog"
|
|
|
- :title="dialogTitle"
|
|
|
- width="90%"
|
|
|
- class="page_help-dialog">
|
|
|
+ <el-dialog
|
|
|
+ v-model="showDialog"
|
|
|
+ :title="dialogTitle"
|
|
|
+ width="90%"
|
|
|
+ class="page_help-dialog"
|
|
|
+ >
|
|
|
<div style="height: calc(100vh - 400px)">
|
|
|
<PageHelpTable
|
|
|
- :store="store"
|
|
|
- :getSlotsData="getSlotsData"
|
|
|
- :table-bind="dialogTableData.tableBind"
|
|
|
- table-ref-name="dialogTableRef"
|
|
|
- :data="dialogTableData.data"
|
|
|
- :columns="dialogTableData.columns"
|
|
|
+ :store="store"
|
|
|
+ :getSlotsData="getSlotsData"
|
|
|
+ :table-bind="dialogTableData.tableBind"
|
|
|
+ table-ref-name="dialogTableRef"
|
|
|
+ :data="dialogTableData.data"
|
|
|
+ :columns="dialogTableData.columns"
|
|
|
/>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
- <el-button v-if="props.isEditor" @click="dialogTableColumns">生成表格列</el-button>
|
|
|
- <el-button @click="exportExcel(dialogTableData ,store.dialogTableRef)" type="primary">导出Excel</el-button>
|
|
|
+ <el-button v-if="props.isEditor" @click="dialogTableColumns"
|
|
|
+ >生成表格列</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="exportExcel(dialogTableData, store.dialogTableRef)"
|
|
|
+ type="primary"
|
|
|
+ >导出Excel</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
<PageFormBind
|
|
|
- :store="store"
|
|
|
- @requiredChange="requiredInit"
|
|
|
- :teleport-div="props.componentAttribute"
|
|
|
- v-if="props.componentAttribute"/>
|
|
|
-
|
|
|
- <PageAddComponent :teleportDiv="props.addComponent"
|
|
|
- @addComponent="addComponent"
|
|
|
- :store="store"
|
|
|
- v-if="props.addComponent"/>
|
|
|
-
|
|
|
-
|
|
|
+ :store="store"
|
|
|
+ @requiredChange="requiredInit"
|
|
|
+ :teleport-div="props.componentAttribute"
|
|
|
+ v-if="props.componentAttribute"
|
|
|
+ />
|
|
|
+
|
|
|
+ <PageAddComponent
|
|
|
+ :teleportDiv="props.addComponent"
|
|
|
+ @addComponent="addComponent"
|
|
|
+ :store="store"
|
|
|
+ v-if="props.addComponent"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss">
|