Files
----/后端源码/yifan.action-ai.cn/index/js/index.zGZzNPwc.js

1576 lines
65 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { x as ElFormItem, y as ElInput, aq as ElSelect, ar as ElOption, h as ElButton, t as ElLink, i as ElIcon, ag as arrow_up_default, af as arrow_down_default, w as ElForm, U as ElRow, V as ElCol, m as ElDropdown, n as ElDropdownMenu, o as ElDropdownItem, l as ElTooltip, ax as ElPopover, F as ElScrollbar, aC as ElCheckbox, al as ElTable, am as ElTableColumn, q as ElTag, u as ElEmpty, ao as vLoading, a9 as question_filled_default, T as ElCard, a3 as ElDescriptions, a4 as ElDescriptionsItem, P as ElRadioGroup, Q as ElRadio, av as ElInputNumber, M as ElSwitch, aw as ElDatePicker, aD as ElTimePicker, v as ElDialog, E as ElMessage, D as ElMessageBox } from "./element-plus.CkEW9frc.js";
import { _ as __unplugin_components_19 } from "./index.fgd49PES.js";
import { _ as _sfc_main$1 } from "./UserTableSelect.vue_vue_type_script_setup_true_lang.7Fjc3bJT.js";
import { J as defineComponent, t as onMounted, aP as resolveDirective, S as openBlock, _ as createElementBlock, a6 as withDirectives, ab as vShow, a1 as createBaseVNode, $ as createVNode, a0 as withCtx, T as createBlock, a8 as createCommentVNode, a9 as createTextVNode, aa as toDisplayString, o as unref, aw as withModifiers, H as Fragment, ay as renderList, r as ref, ak as reactive } from "./.pnpm.BW3P1y8f.js";
import { l as httpRequest, R as ResultEnum } from "./index.CMd5bD1r.js";
import { _ as _sfc_main$2 } from "./ImportModal.vue_vue_type_script_setup_true_lang.DYvH1hkB.js";
import { _ as _sfc_main$3 } from "./ExportModal.vue_vue_type_script_setup_true_lang.Bok1HJuH.js";
import { D as DatePicker } from "./index.Cu5O_6Z1.js";
import { f as formatToDateTime } from "./dateUtil.SHphbRyf.js";
import "./_plugin-vue_export-helper.1tPrXgE0.js";
import "./codemirror.CvJAcn2d.js";
import "./exceljs.CkFT-P7Q.js";
const API_PATH = "/example/demo";
const DemoAPI = {
getDemoList(query) {
return httpRequest({
url: `${API_PATH}/list`,
method: "get",
params: query
});
},
getDemoDetail(query) {
return httpRequest({
url: `${API_PATH}/detail/${query}`,
method: "get"
});
},
createDemo(body) {
return httpRequest({
url: `${API_PATH}/create`,
method: "post",
data: body
});
},
updateDemo(id, body) {
return httpRequest({
url: `${API_PATH}/update/${id}`,
method: "put",
data: body
});
},
deleteDemo(body) {
return httpRequest({
url: `${API_PATH}/delete`,
method: "delete",
data: body
});
},
batchDemo(body) {
return httpRequest({
url: `${API_PATH}/available/setting`,
method: "patch",
data: body
});
},
exportDemo(body) {
return httpRequest({
url: `${API_PATH}/export`,
method: "post",
data: body,
responseType: "blob"
});
},
downloadTemplateDemo() {
return httpRequest({
url: `${API_PATH}/download/template`,
method: "post",
responseType: "blob"
});
},
importDemo(body) {
return httpRequest({
url: `${API_PATH}/import`,
method: "post",
data: body,
headers: {
"Content-Type": "multipart/form-data"
}
});
}
};
const _hoisted_1 = { class: "app-container" };
const _hoisted_2 = { class: "search-container" };
const _hoisted_3 = { class: "card-header" };
const _hoisted_4 = { class: "data-table__toolbar" };
const _hoisted_5 = { class: "data-table__toolbar--left" };
const _hoisted_6 = { class: "data-table__toolbar--right" };
const _hoisted_7 = { class: "json-preview" };
const _hoisted_8 = { class: "json-preview" };
const _hoisted_9 = { class: "dialog-footer" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "Demo",
inheritAttrs: false
},
__name: "index",
setup(__props) {
const visible = ref(true);
const queryFormRef = ref();
const dataFormRef = ref();
const total = ref(0);
const selectIds = ref([]);
const selectionRows = ref([]);
const loading = ref(false);
const isExpand = ref(false);
const isExpandable = ref(true);
const pageTableData = ref([]);
const tableColumns = ref([
{ prop: "selection", label: "选择框", show: true },
{ prop: "index", label: "序号", show: true },
{ prop: "name", label: "名称", show: true },
{ prop: "uuid", label: "UUID", show: true },
{ prop: "status", label: "状态", show: true },
{ prop: "a", label: "整数", show: true },
{ prop: "b", label: "大整数", show: true },
{ prop: "c", label: "浮点数", show: true },
{ prop: "d", label: "布尔值", show: true },
{ prop: "e", label: "日期", show: true },
{ prop: "f", label: "时间", show: true },
{ prop: "g", label: "日期时间", show: true },
{ prop: "h", label: "长文本", show: true },
{ prop: "i", label: "元数据", show: true },
{ prop: "description", label: "描述", show: true },
{ prop: "created_time", label: "创建时间", show: true },
{ prop: "updated_time", label: "更新时间", show: true },
{ prop: "created_id", label: "创建人", show: true },
{ prop: "updated_id", label: "更新人", show: true },
{ prop: "operation", label: "操作", show: true }
]);
const exportColumns = [
{ prop: "name", label: "名称" },
{ prop: "uuid", label: "UUID" },
{ prop: "status", label: "状态" },
{ prop: "a", label: "整数" },
{ prop: "b", label: "大整数" },
{ prop: "c", label: "浮点数" },
{ prop: "d", label: "布尔值" },
{ prop: "e", label: "日期" },
{ prop: "f", label: "时间" },
{ prop: "g", label: "日期时间" },
{ prop: "h", label: "长文本" },
{ prop: "i", label: "元数据" },
{ prop: "description", label: "描述" },
{ prop: "created_time", label: "创建时间" },
{ prop: "updated_time", label: "更新时间" }
];
const curdContentConfig = {
permPrefix: "module_example:demo",
cols: exportColumns,
importTemplate: () => DemoAPI.downloadTemplateDemo(),
exportsAction: async (params) => {
var _a, _b, _c, _d;
const query = { ...params };
if (typeof query.status === "string") {
query.status = query.status === "true";
}
query.page_no = 1;
query.page_size = 9999;
const all = [];
while (true) {
const res = await DemoAPI.getDemoList(query);
const items = ((_b = (_a = res.data) == null ? void 0 : _a.data) == null ? void 0 : _b.items) || [];
const total2 = ((_d = (_c = res.data) == null ? void 0 : _c.data) == null ? void 0 : _d.total) || 0;
all.push(...items);
if (all.length >= total2 || items.length === 0) break;
query.page_no += 1;
}
return all;
}
};
const detailFormData = ref({});
const createdDateRange = ref([]);
const updatedDateRange = ref([]);
function handleCreatedDateRangeChange(range) {
createdDateRange.value = range;
if (range && range.length === 2) {
queryFormData.created_time = [formatToDateTime(range[0]), formatToDateTime(range[1])];
} else {
queryFormData.created_time = void 0;
}
}
function handleUpdatedDateRangeChange(range) {
updatedDateRange.value = range;
if (range && range.length === 2) {
queryFormData.updated_time = [formatToDateTime(range[0]), formatToDateTime(range[1])];
} else {
queryFormData.updated_time = void 0;
}
}
const queryFormData = reactive({
page_no: 1,
page_size: 10,
name: void 0,
status: void 0,
created_time: void 0,
updated_time: void 0,
created_id: void 0,
updated_id: void 0
});
const formData = reactive({
id: void 0,
name: "",
status: "0",
description: void 0,
a: void 0,
b: void 0,
c: void 0,
d: true,
e: void 0,
f: void 0,
g: void 0,
h: void 0,
i: void 0
});
const dialogVisible = reactive({
title: "",
visible: false,
type: "create"
});
const rules = reactive({
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
status: [{ required: true, message: "请选择状态", trigger: "blur" }]
});
const importDialogVisible = ref(false);
const exportsDialogVisible = ref(false);
function handleOpenImportDialog() {
importDialogVisible.value = true;
}
function handleOpenExportsModal() {
exportsDialogVisible.value = true;
}
async function handleRefresh() {
await loadingData();
}
async function loadingData() {
loading.value = true;
try {
const response = await DemoAPI.getDemoList(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}
async function handleQuery() {
queryFormData.page_no = 1;
loadingData();
}
function handleConfirm() {
handleQuery();
}
async function handleResetQuery() {
queryFormRef.value.resetFields();
queryFormData.page_no = 1;
createdDateRange.value = [];
updatedDateRange.value = [];
queryFormData.created_time = void 0;
queryFormData.updated_time = void 0;
loadingData();
}
const initialFormData = {
id: void 0,
name: "",
status: "0",
description: void 0,
a: void 0,
b: void 0,
c: void 0,
d: true,
e: void 0,
f: void 0,
g: void 0,
h: void 0,
i: void 0
};
async function resetForm() {
if (dataFormRef.value) {
dataFormRef.value.resetFields();
dataFormRef.value.clearValidate();
}
Object.assign(formData, initialFormData);
}
async function handleSelectionChange(selection) {
selectIds.value = selection.map((item) => item.id);
selectionRows.value = selection;
}
async function handleCloseDialog() {
dialogVisible.visible = false;
resetForm();
}
async function handleOpenDialog(type, id) {
dialogVisible.type = type;
if (id) {
const response = await DemoAPI.getDemoDetail(id);
if (type === "detail") {
dialogVisible.title = "详情";
Object.assign(detailFormData.value, response.data.data);
} else if (type === "update") {
dialogVisible.title = "修改";
Object.assign(formData, response.data.data);
}
} else {
dialogVisible.title = "新增示例";
formData.id = void 0;
}
dialogVisible.visible = true;
}
async function handleSubmit() {
dataFormRef.value.validate(async (valid) => {
if (valid) {
loading.value = true;
const submitData = { ...formData };
if (submitData.i && typeof submitData.i === "string") {
try {
submitData.i = JSON.parse(submitData.i);
} catch (error) {
ElMessage.error("元数据格式错误请输入有效的JSON字符串" + error.message);
loading.value = false;
return;
}
}
const formatDate = (date) => {
if (!date) return void 0;
const d = typeof date === "string" ? new Date(date) : date;
return d.toISOString().split("T")[0];
};
const formatTime = (time) => {
if (!time) return void 0;
const t = typeof time === "string" ? new Date(time) : time;
return t.toTimeString().split(" ")[0];
};
const formatDateTime = (datetime) => {
if (!datetime) return void 0;
const dt = typeof datetime === "string" ? new Date(datetime) : datetime;
const datePart = dt.toISOString().split("T")[0];
const timePart = dt.toTimeString().split(" ")[0];
return `${datePart} ${timePart}`;
};
submitData.e = formatDate(submitData.e);
submitData.f = formatTime(submitData.f);
submitData.g = formatDateTime(submitData.g);
const id = formData.id;
if (id) {
try {
await DemoAPI.updateDemo(id, { id, ...submitData });
dialogVisible.visible = false;
resetForm();
handleCloseDialog();
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
} else {
try {
await DemoAPI.createDemo(submitData);
dialogVisible.visible = false;
resetForm();
handleCloseDialog();
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}
}
});
}
async function handleDelete(ids) {
ElMessageBox.confirm("确认删除该项数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
try {
loading.value = true;
await DemoAPI.deleteDemo(ids);
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}).catch(() => {
ElMessageBox.close();
});
}
async function handleMoreClick(status) {
if (selectIds.value.length) {
ElMessageBox.confirm(`确认${status === "0" ? "启用" : "停用"}该项数据?`, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
try {
loading.value = true;
await DemoAPI.batchDemo({ ids: selectIds.value, status });
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}).catch(() => {
ElMessageBox.close();
});
}
}
const handleUpload = async (formData2) => {
try {
const response = await DemoAPI.importDemo(formData2);
if (response.data.code === ResultEnum.SUCCESS) {
ElMessage.success(`${response.data.msg}${response.data.data}`);
importDialogVisible.value = false;
await handleQuery();
}
} catch (error) {
console.error(error);
}
};
onMounted(() => {
loadingData();
});
return (_ctx, _cache) => {
const _component_el_input = ElInput;
const _component_el_form_item = ElFormItem;
const _component_el_option = ElOption;
const _component_el_select = ElSelect;
const _component_UserTableSelect = _sfc_main$1;
const _component_el_button = ElButton;
const _component_el_icon = ElIcon;
const _component_el_link = ElLink;
const _component_el_form = ElForm;
const _component_el_tooltip = ElTooltip;
const _component_el_col = ElCol;
const _component_el_dropdown_item = ElDropdownItem;
const _component_el_dropdown_menu = ElDropdownMenu;
const _component_el_dropdown = ElDropdown;
const _component_el_row = ElRow;
const _component_el_checkbox = ElCheckbox;
const _component_el_scrollbar = ElScrollbar;
const _component_el_popover = ElPopover;
const _component_el_empty = ElEmpty;
const _component_el_table_column = ElTableColumn;
const _component_el_tag = ElTag;
const _component_el_table = ElTable;
const _component_pagination = __unplugin_components_19;
const _component_el_card = ElCard;
const _component_el_descriptions_item = ElDescriptionsItem;
const _component_el_descriptions = ElDescriptions;
const _component_el_radio = ElRadio;
const _component_el_radio_group = ElRadioGroup;
const _component_el_input_number = ElInputNumber;
const _component_el_switch = ElSwitch;
const _component_el_date_picker = ElDatePicker;
const _component_el_time_picker = ElTimePicker;
const _component_el_dialog = ElDialog;
const _directive_hasPerm = resolveDirective("hasPerm");
const _directive_loading = vLoading;
return openBlock(), createElementBlock("div", _hoisted_1, [
withDirectives(createBaseVNode("div", _hoisted_2, [
createVNode(_component_el_form, {
ref_key: "queryFormRef",
ref: queryFormRef,
model: queryFormData,
"label-suffix": ":",
inline: true,
onSubmit: withModifiers(handleQuery, ["prevent"])
}, {
default: withCtx(() => [
createVNode(_component_el_form_item, {
prop: "name",
label: "名称"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: queryFormData.name,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => queryFormData.name = $event),
placeholder: "请输入名称",
clearable: ""
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
prop: "status",
label: "状态"
}, {
default: withCtx(() => [
createVNode(_component_el_select, {
modelValue: queryFormData.status,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => queryFormData.status = $event),
placeholder: "请选择状态",
style: { "width": "170px" },
clearable: ""
}, {
default: withCtx(() => [
createVNode(_component_el_option, {
value: "0",
label: "启用"
}),
createVNode(_component_el_option, {
value: "1",
label: "停用"
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
isExpand.value ? (openBlock(), createBlock(_component_el_form_item, {
key: 0,
prop: "created_id",
label: "创建人"
}, {
default: withCtx(() => [
createVNode(_component_UserTableSelect, {
modelValue: queryFormData.created_id,
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => queryFormData.created_id = $event),
onConfirmClick: handleConfirm,
onClearClick: handleQuery
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
isExpand.value ? (openBlock(), createBlock(_component_el_form_item, {
key: 1,
prop: "updated_id",
label: "更新人"
}, {
default: withCtx(() => [
createVNode(_component_UserTableSelect, {
modelValue: queryFormData.updated_id,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => queryFormData.updated_id = $event),
onConfirmClick: handleConfirm,
onClearClick: handleQuery
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
isExpand.value ? (openBlock(), createBlock(_component_el_form_item, {
key: 2,
prop: "created_time",
label: "创建时间"
}, {
default: withCtx(() => [
createVNode(DatePicker, {
modelValue: createdDateRange.value,
"onUpdate:modelValue": [
_cache[4] || (_cache[4] = ($event) => createdDateRange.value = $event),
handleCreatedDateRangeChange
]
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
isExpand.value ? (openBlock(), createBlock(_component_el_form_item, {
key: 3,
prop: "updated_time",
label: "更新时间"
}, {
default: withCtx(() => [
createVNode(DatePicker, {
modelValue: updatedDateRange.value,
"onUpdate:modelValue": [
_cache[5] || (_cache[5] = ($event) => updatedDateRange.value = $event),
handleUpdatedDateRangeChange
]
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
createVNode(_component_el_form_item, null, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "primary",
icon: "search",
onClick: handleQuery
}, {
default: withCtx(() => [..._cache[30] || (_cache[30] = [
createTextVNode(" 查询 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_example:demo:query"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
icon: "refresh",
onClick: handleResetQuery
}, {
default: withCtx(() => [..._cache[31] || (_cache[31] = [
createTextVNode(" 重置 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_example:demo:query"]]
]),
isExpandable.value ? (openBlock(), createBlock(_component_el_link, {
key: 0,
class: "ml-3",
type: "primary",
underline: "never",
onClick: _cache[6] || (_cache[6] = ($event) => isExpand.value = !isExpand.value)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(isExpand.value ? "收起" : "展开") + " ", 1),
createVNode(_component_el_icon, null, {
default: withCtx(() => [
isExpand.value ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(arrow_down_default), { key: 1 }))
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true)
]),
_: 1
})
]),
_: 1
}, 8, ["model"])
], 512), [
[vShow, visible.value]
]),
createVNode(_component_el_card, { class: "data-table" }, {
header: withCtx(() => [
createBaseVNode("div", _hoisted_3, [
createBaseVNode("span", null, [
_cache[32] || (_cache[32] = createTextVNode(" 演示示例列表 ", -1)),
createVNode(_component_el_tooltip, { content: "演示示例列表" }, {
default: withCtx(() => [
createVNode(unref(question_filled_default), { class: "w-4 h-4 mx-1" })
]),
_: 1
})
])
])
]),
footer: withCtx(() => [
createVNode(_component_pagination, {
total: total.value,
"onUpdate:total": _cache[12] || (_cache[12] = ($event) => total.value = $event),
page: queryFormData.page_no,
"onUpdate:page": _cache[13] || (_cache[13] = ($event) => queryFormData.page_no = $event),
limit: queryFormData.page_size,
"onUpdate:limit": _cache[14] || (_cache[14] = ($event) => queryFormData.page_size = $event),
onPagination: loadingData
}, null, 8, ["total", "page", "limit"])
]),
default: withCtx(() => [
createBaseVNode("div", _hoisted_4, [
createBaseVNode("div", _hoisted_5, [
createVNode(_component_el_row, { gutter: 10 }, {
default: withCtx(() => [
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "success",
icon: "plus",
onClick: _cache[7] || (_cache[7] = ($event) => handleOpenDialog("create"))
}, {
default: withCtx(() => [..._cache[33] || (_cache[33] = [
createTextVNode(" 新增 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_example:demo:create"]]
])
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "danger",
icon: "delete",
disabled: selectIds.value.length === 0,
onClick: _cache[8] || (_cache[8] = ($event) => handleDelete(selectIds.value))
}, {
default: withCtx(() => [..._cache[34] || (_cache[34] = [
createTextVNode(" 批量删除 ", -1)
])]),
_: 1
}, 8, ["disabled"])), [
[_directive_hasPerm, ["module_example:demo:delete"]]
])
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_dropdown, { trigger: "click" }, {
dropdown: withCtx(() => [
createVNode(_component_el_dropdown_menu, null, {
default: withCtx(() => [
createVNode(_component_el_dropdown_item, {
icon: "Check",
onClick: _cache[9] || (_cache[9] = ($event) => handleMoreClick("0"))
}, {
default: withCtx(() => [..._cache[36] || (_cache[36] = [
createTextVNode(" 批量启用 ", -1)
])]),
_: 1
}),
createVNode(_component_el_dropdown_item, {
icon: "CircleClose",
onClick: _cache[10] || (_cache[10] = ($event) => handleMoreClick("1"))
}, {
default: withCtx(() => [..._cache[37] || (_cache[37] = [
createTextVNode(" 批量停用 ", -1)
])]),
_: 1
})
]),
_: 1
})
]),
default: withCtx(() => [
createVNode(_component_el_button, {
type: "default",
disabled: selectIds.value.length === 0,
icon: "ArrowDown"
}, {
default: withCtx(() => [..._cache[35] || (_cache[35] = [
createTextVNode(" 更多 ", -1)
])]),
_: 1
}, 8, ["disabled"])
]),
_: 1
})), [
[_directive_hasPerm, ["module_example:demo:patch"]]
])
]),
_: 1
})
]),
_: 1
})
]),
createBaseVNode("div", _hoisted_6, [
createVNode(_component_el_row, { gutter: 10 }, {
default: withCtx(() => [
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "导入" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "success",
icon: "upload",
circle: "",
onClick: handleOpenImportDialog
}, null, 512), [
[_directive_hasPerm, ["module_example:demo:import"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "导出" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "warning",
icon: "download",
circle: "",
onClick: handleOpenExportsModal
}, null, 512), [
[_directive_hasPerm, ["module_example:demo:export"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "搜索显示/隐藏" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "info",
icon: "search",
circle: "",
onClick: _cache[11] || (_cache[11] = ($event) => visible.value = !visible.value)
}, null, 512), [
[_directive_hasPerm, ["*:*:*"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "刷新" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "primary",
icon: "refresh",
circle: "",
onClick: handleRefresh
}, null, 512), [
[_directive_hasPerm, ["module_example:demo:query"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_popover, {
placement: "bottom",
trigger: "click"
}, {
reference: withCtx(() => [
createVNode(_component_el_button, {
type: "danger",
icon: "operation",
circle: ""
})
]),
default: withCtx(() => [
createVNode(_component_el_scrollbar, { "max-height": "350px" }, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableColumns.value, (column) => {
return openBlock(), createElementBlock(Fragment, {
key: column.prop
}, [
column.prop ? (openBlock(), createBlock(_component_el_checkbox, {
key: 0,
modelValue: column.show,
"onUpdate:modelValue": ($event) => column.show = $event,
label: column.label
}, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : createCommentVNode("", true)
], 64);
}), 128))
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
])
]),
withDirectives((openBlock(), createBlock(_component_el_table, {
ref: "tableRef",
data: pageTableData.value,
"highlight-current-row": "",
class: "data-table__content",
height: "500",
"max-height": "500",
border: "",
stripe: "",
onSelectionChange: handleSelectionChange
}, {
empty: withCtx(() => [
createVNode(_component_el_empty, {
"image-size": 80,
description: "暂无数据"
})
]),
default: withCtx(() => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
return [
((_a = tableColumns.value.find((col) => col.prop === "selection")) == null ? void 0 : _a.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 0,
type: "selection",
"min-width": "55",
align: "center"
})) : createCommentVNode("", true),
((_b = tableColumns.value.find((col) => col.prop === "index")) == null ? void 0 : _b.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 1,
fixed: "",
label: "序号",
"min-width": "60"
}, {
default: withCtx((scope) => [
createTextVNode(toDisplayString((queryFormData.page_no - 1) * queryFormData.page_size + scope.$index + 1), 1)
]),
_: 1
})) : createCommentVNode("", true),
((_c = tableColumns.value.find((col) => col.prop === "name")) == null ? void 0 : _c.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 2,
label: "名称",
prop: "name",
"min-width": "140"
})) : createCommentVNode("", true),
((_d = tableColumns.value.find((col) => col.prop === "uuid")) == null ? void 0 : _d.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 3,
label: "UUID",
prop: "uuid",
"min-width": "180"
})) : createCommentVNode("", true),
((_e = tableColumns.value.find((col) => col.prop === "status")) == null ? void 0 : _e.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 4,
label: "状态",
prop: "status",
"min-width": "120"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, {
type: scope.row.status ? "success" : "info"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(scope.row.status ? "启用" : "停用"), 1)
]),
_: 2
}, 1032, ["type"])
]),
_: 1
})) : createCommentVNode("", true),
((_f = tableColumns.value.find((col) => col.prop === "a")) == null ? void 0 : _f.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 5,
label: "整数",
prop: "a",
"min-width": "100"
})) : createCommentVNode("", true),
((_g = tableColumns.value.find((col) => col.prop === "b")) == null ? void 0 : _g.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 6,
label: "大整数",
prop: "b",
"min-width": "120"
})) : createCommentVNode("", true),
((_h = tableColumns.value.find((col) => col.prop === "c")) == null ? void 0 : _h.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 7,
label: "浮点数",
prop: "c",
"min-width": "100"
})) : createCommentVNode("", true),
((_i = tableColumns.value.find((col) => col.prop === "d")) == null ? void 0 : _i.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 8,
label: "布尔值",
prop: "d",
"min-width": "100"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, {
type: scope.row.d ? "success" : "danger"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(scope.row.d ? "是" : "否"), 1)
]),
_: 2
}, 1032, ["type"])
]),
_: 1
})) : createCommentVNode("", true),
((_j = tableColumns.value.find((col) => col.prop === "e")) == null ? void 0 : _j.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 9,
label: "日期",
prop: "e",
"min-width": "120"
})) : createCommentVNode("", true),
((_k = tableColumns.value.find((col) => col.prop === "f")) == null ? void 0 : _k.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 10,
label: "时间",
prop: "f",
"min-width": "120"
})) : createCommentVNode("", true),
((_l = tableColumns.value.find((col) => col.prop === "g")) == null ? void 0 : _l.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 11,
label: "日期时间",
prop: "g",
"min-width": "180"
})) : createCommentVNode("", true),
((_m = tableColumns.value.find((col) => col.prop === "h")) == null ? void 0 : _m.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 12,
label: "长文本",
prop: "h",
"min-width": "140"
})) : createCommentVNode("", true),
((_n = tableColumns.value.find((col) => col.prop === "i")) == null ? void 0 : _n.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 13,
label: "元数据",
prop: "i",
"min-width": "140"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tooltip, {
content: JSON.stringify(scope.row.i),
placement: "top"
}, {
default: withCtx(() => [
createBaseVNode("div", _hoisted_7, toDisplayString(JSON.stringify(scope.row.i)), 1)
]),
_: 2
}, 1032, ["content"])
]),
_: 1
})) : createCommentVNode("", true),
((_o = tableColumns.value.find((col) => col.prop === "description")) == null ? void 0 : _o.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 14,
label: "描述",
prop: "description",
"min-width": "140"
})) : createCommentVNode("", true),
((_p = tableColumns.value.find((col) => col.prop === "created_time")) == null ? void 0 : _p.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 15,
label: "创建时间",
prop: "created_time",
"min-width": "180"
})) : createCommentVNode("", true),
((_q = tableColumns.value.find((col) => col.prop === "updated_time")) == null ? void 0 : _q.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 16,
label: "更新时间",
prop: "updated_time",
"min-width": "180"
})) : createCommentVNode("", true),
((_r = tableColumns.value.find((col) => col.prop === "created_id")) == null ? void 0 : _r.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 17,
label: "创建人",
prop: "created_id",
"min-width": "120"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, null, {
default: withCtx(() => {
var _a2;
return [
createTextVNode(toDisplayString((_a2 = scope.row.created_by) == null ? void 0 : _a2.name), 1)
];
}),
_: 2
}, 1024)
]),
_: 1
})) : createCommentVNode("", true),
((_s = tableColumns.value.find((col) => col.prop === "updated_id")) == null ? void 0 : _s.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 18,
label: "更新人",
prop: "updated_id",
"min-width": "120"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, null, {
default: withCtx(() => {
var _a2;
return [
createTextVNode(toDisplayString((_a2 = scope.row.updated_by) == null ? void 0 : _a2.name), 1)
];
}),
_: 2
}, 1024)
]),
_: 1
})) : createCommentVNode("", true),
((_t = tableColumns.value.find((col) => col.prop === "operation")) == null ? void 0 : _t.show) ? (openBlock(), createBlock(_component_el_table_column, {
key: 19,
fixed: "right",
label: "操作",
align: "center",
"min-width": "180"
}, {
default: withCtx((scope) => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "info",
size: "small",
link: "",
icon: "document",
onClick: ($event) => handleOpenDialog("detail", scope.row.id)
}, {
default: withCtx(() => [..._cache[38] || (_cache[38] = [
createTextVNode(" 详情 ", -1)
])]),
_: 1
}, 8, ["onClick"])), [
[_directive_hasPerm, ["module_example:demo:detail"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "primary",
size: "small",
link: "",
icon: "edit",
onClick: ($event) => handleOpenDialog("update", scope.row.id)
}, {
default: withCtx(() => [..._cache[39] || (_cache[39] = [
createTextVNode(" 编辑 ", -1)
])]),
_: 1
}, 8, ["onClick"])), [
[_directive_hasPerm, ["module_example:demo:update"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "danger",
size: "small",
link: "",
icon: "delete",
onClick: ($event) => handleDelete([scope.row.id])
}, {
default: withCtx(() => [..._cache[40] || (_cache[40] = [
createTextVNode(" 删除 ", -1)
])]),
_: 1
}, 8, ["onClick"])), [
[_directive_hasPerm, ["module_example:demo:delete"]]
])
]),
_: 1
})) : createCommentVNode("", true)
];
}),
_: 1
}, 8, ["data"])), [
[_directive_loading, loading.value]
])
]),
_: 1
}),
createVNode(_component_el_dialog, {
modelValue: dialogVisible.visible,
"onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => dialogVisible.visible = $event),
title: dialogVisible.title,
onClose: handleCloseDialog
}, {
footer: withCtx(() => [
createBaseVNode("div", _hoisted_9, [
createVNode(_component_el_button, { onClick: handleCloseDialog }, {
default: withCtx(() => [..._cache[43] || (_cache[43] = [
createTextVNode("取消", -1)
])]),
_: 1
}),
dialogVisible.type !== "detail" ? (openBlock(), createBlock(_component_el_button, {
key: 0,
type: "primary",
onClick: handleSubmit
}, {
default: withCtx(() => [..._cache[44] || (_cache[44] = [
createTextVNode(" 确定 ", -1)
])]),
_: 1
})) : (openBlock(), createBlock(_component_el_button, {
key: 1,
type: "primary",
onClick: handleCloseDialog
}, {
default: withCtx(() => [..._cache[45] || (_cache[45] = [
createTextVNode("确定", -1)
])]),
_: 1
}))
])
]),
default: withCtx(() => [
dialogVisible.type === "detail" ? (openBlock(), createBlock(_component_el_descriptions, {
key: 0,
column: 4,
border: ""
}, {
default: withCtx(() => [
createVNode(_component_el_descriptions_item, {
label: "名称",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.name), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "UUID",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.uuid), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "状态",
span: 2
}, {
default: withCtx(() => [
createVNode(_component_el_tag, {
type: detailFormData.value.status ? "success" : "danger"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.status ? "启用" : "停用"), 1)
]),
_: 1
}, 8, ["type"])
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "整数",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.a), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "大整数",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.b), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "浮点数",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.c), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "布尔值",
span: 2
}, {
default: withCtx(() => [
createVNode(_component_el_tag, {
type: detailFormData.value.d ? "success" : "danger"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.d ? "是" : "否"), 1)
]),
_: 1
}, 8, ["type"])
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "日期",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.e), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.f), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "日期时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.g), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "长文本",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.h), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "元数据",
span: 2
}, {
default: withCtx(() => [
createVNode(_component_el_tooltip, {
content: JSON.stringify(detailFormData.value.i),
placement: "top"
}, {
default: withCtx(() => [
createBaseVNode("div", _hoisted_8, toDisplayString(JSON.stringify(detailFormData.value.i)), 1)
]),
_: 1
}, 8, ["content"])
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "描述",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.description), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "创建人",
span: 2
}, {
default: withCtx(() => {
var _a;
return [
createTextVNode(toDisplayString((_a = detailFormData.value.created_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "更新人",
span: 2
}, {
default: withCtx(() => {
var _a;
return [
createTextVNode(toDisplayString((_a = detailFormData.value.updated_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "创建时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.created_time), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "更新时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(detailFormData.value.updated_time), 1)
]),
_: 1
})
]),
_: 1
})) : (openBlock(), createBlock(_component_el_form, {
key: 1,
ref_key: "dataFormRef",
ref: dataFormRef,
model: formData,
rules,
"label-suffix": ":",
"label-width": "auto",
"label-position": "right"
}, {
default: withCtx(() => [
createVNode(_component_el_form_item, {
label: "名称",
prop: "name"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: formData.name,
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => formData.name = $event),
placeholder: "请输入名称",
maxlength: 50
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "状态",
prop: "status"
}, {
default: withCtx(() => [
createVNode(_component_el_radio_group, {
modelValue: formData.status,
"onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => formData.status = $event)
}, {
default: withCtx(() => [
createVNode(_component_el_radio, { value: "0" }, {
default: withCtx(() => [..._cache[41] || (_cache[41] = [
createTextVNode("启用", -1)
])]),
_: 1
}),
createVNode(_component_el_radio, { value: "1" }, {
default: withCtx(() => [..._cache[42] || (_cache[42] = [
createTextVNode("停用", -1)
])]),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "整数",
prop: "a"
}, {
default: withCtx(() => [
createVNode(_component_el_input_number, {
modelValue: formData.a,
"onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => formData.a = $event),
placeholder: "请输入整数"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "大整数",
prop: "b"
}, {
default: withCtx(() => [
createVNode(_component_el_input_number, {
modelValue: formData.b,
"onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => formData.b = $event),
placeholder: "请输入大整数"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "浮点数",
prop: "c"
}, {
default: withCtx(() => [
createVNode(_component_el_input_number, {
modelValue: formData.c,
"onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => formData.c = $event),
placeholder: "请输入浮点数",
step: 0.01,
precision: 2
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "布尔值",
prop: "d"
}, {
default: withCtx(() => [
createVNode(_component_el_switch, {
modelValue: formData.d,
"onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => formData.d = $event)
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "日期",
prop: "e"
}, {
default: withCtx(() => [
createVNode(_component_el_date_picker, {
modelValue: formData.e,
"onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => formData.e = $event),
type: "date",
placeholder: "请选择日期",
style: { "width": "100%" }
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "时间",
prop: "f"
}, {
default: withCtx(() => [
createVNode(_component_el_time_picker, {
modelValue: formData.f,
"onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => formData.f = $event),
placeholder: "请选择时间",
style: { "width": "100%" }
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "日期时间",
prop: "g"
}, {
default: withCtx(() => [
createVNode(_component_el_date_picker, {
modelValue: formData.g,
"onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => formData.g = $event),
type: "datetime",
placeholder: "请选择日期时间",
style: { "width": "100%" }
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "长文本",
prop: "h"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: formData.h,
"onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => formData.h = $event),
rows: 4,
type: "textarea",
placeholder: "请输入长文本"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "元数据",
prop: "i"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
"model-value": JSON.stringify(formData.i),
rows: 4,
type: "textarea",
placeholder: "请输入JSON格式的元数据",
"onUpdate:modelValue": _cache[25] || (_cache[25] = (val) => formData.i = val ? JSON.parse(val) : void 0)
}, null, 8, ["model-value"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "描述",
prop: "description"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: formData.description,
"onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => formData.description = $event),
rows: 4,
maxlength: 100,
"show-word-limit": "",
type: "textarea",
placeholder: "请输入描述"
}, null, 8, ["modelValue"])
]),
_: 1
})
]),
_: 1
}, 8, ["model", "rules"]))
]),
_: 1
}, 8, ["modelValue", "title"]),
createVNode(_sfc_main$2, {
modelValue: importDialogVisible.value,
"onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => importDialogVisible.value = $event),
"content-config": curdContentConfig,
onUpload: handleUpload
}, null, 8, ["modelValue"]),
createVNode(_sfc_main$3, {
modelValue: exportsDialogVisible.value,
"onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => exportsDialogVisible.value = $event),
"content-config": curdContentConfig,
"query-params": queryFormData,
"page-data": pageTableData.value,
"selection-data": selectionRows.value
}, null, 8, ["modelValue", "query-params", "page-data", "selection-data"])
]);
};
}
});
export {
_sfc_main as default
};