u
This commit is contained in:
1 parent
a4e59dd5d1
commit
c7240ea7c9
16 files changed
+598
-476
No files matched your search
@@ -56,7 +56,9 @@ const viewName = "v_container";
|
||||
const showPreview = ref(false);
|
||||
const previewIndex = ref(-1);
|
||||
const previewImageList = computed(() => {
|
||||
return tableData.value.map((item) => item.b_container_img).filter((img) => img);
|
||||
return tableData.value
|
||||
.map((item) => item.b_container_img)
|
||||
.filter((img) => img);
|
||||
});
|
||||
|
||||
const currentRow = ref({});
|
||||
@@ -189,9 +191,12 @@ async function deleteRows(rows = []) {
|
||||
const safeDeleteIds = deleteIds.map((id) => Number(id));
|
||||
|
||||
// 使用安全的 SQL 查询
|
||||
const fileRes = await loadDataApi("bf_file", `father IN (${safeDeleteIds.join(",")})`, "", [
|
||||
"subid",
|
||||
]);
|
||||
const fileRes = await loadDataApi(
|
||||
"bf_file",
|
||||
`father IN (${safeDeleteIds.join(",")})`,
|
||||
"",
|
||||
["subid"],
|
||||
);
|
||||
|
||||
if (!fileRes.success) {
|
||||
return;
|
||||
@@ -267,7 +272,11 @@ async function handleDownloadOne(data) {
|
||||
});
|
||||
|
||||
try {
|
||||
const fileRes = await loadDataApi("bf_file", `father = ${data.b_id}`, "mx_xh asc");
|
||||
const fileRes = await loadDataApi(
|
||||
"bf_file",
|
||||
`father = ${data.b_id}`,
|
||||
"mx_xh asc",
|
||||
);
|
||||
|
||||
if (!fileRes.success) {
|
||||
ElMessage.error("获取附件失败");
|
||||
@@ -275,7 +284,11 @@ async function handleDownloadOne(data) {
|
||||
}
|
||||
|
||||
const downloadFiles = fileRes.data.map((item, index) => ({
|
||||
mx_filename: buildFileName(data.b_container_no, index + 1, item.mx_filename),
|
||||
mx_filename: buildFileName(
|
||||
data.b_container_no,
|
||||
index + 1,
|
||||
item.mx_filename,
|
||||
),
|
||||
mx_mapfilename: item.mx_mapfilename,
|
||||
}));
|
||||
|
||||
@@ -338,7 +351,11 @@ async function handleDownloadBatch() {
|
||||
|
||||
// 👉 先统计总文件数(用于进度)
|
||||
for (const item of records) {
|
||||
const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, "");
|
||||
const fileRes = await loadDataApi(
|
||||
"bf_file",
|
||||
`father = '${item.b_id}'`,
|
||||
"",
|
||||
);
|
||||
if (fileRes.success) {
|
||||
total += (fileRes.data || []).length;
|
||||
}
|
||||
@@ -350,7 +367,11 @@ async function handleDownloadBatch() {
|
||||
|
||||
const folder = zip.folder(folderName);
|
||||
|
||||
const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, "mx_xh asc");
|
||||
const fileRes = await loadDataApi(
|
||||
"bf_file",
|
||||
`father = '${item.b_id}'`,
|
||||
"mx_xh asc",
|
||||
);
|
||||
|
||||
if (!fileRes.success) {
|
||||
ElMessage.error("获取附件失败");
|
||||
@@ -367,7 +388,8 @@ async function handleDownloadBatch() {
|
||||
const blob = await res.blob();
|
||||
|
||||
const fileName =
|
||||
buildFileName(item.b_container_no, index + 1, file.mx_filename) || "未命名文件";
|
||||
buildFileName(item.b_container_no, index + 1, file.mx_filename) ||
|
||||
"未命名文件";
|
||||
|
||||
folder.file(fileName, blob);
|
||||
} catch (e) {
|
||||
@@ -432,7 +454,15 @@ function buildFileName(containerNo, index, fileName) {
|
||||
</G3GridItem>
|
||||
|
||||
<G3GridItem label="操作员">
|
||||
<el-input v-model="searchForm.username" />
|
||||
<G3Select
|
||||
v-model="searchForm.username"
|
||||
v-model:label="searchForm.username"
|
||||
search-condition="b_id <> 'g3soft'"
|
||||
view-name="b_user"
|
||||
value-key="b_name"
|
||||
label-key="b_name"
|
||||
keep-input
|
||||
/>
|
||||
</G3GridItem>
|
||||
</G3GridGroup>
|
||||
</G3Grid>
|
||||
@@ -470,7 +500,7 @@ function buildFileName(containerNo, index, fileName) {
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="handleDeleteRows"
|
||||
:disabled="!permissionStore.hasActionPermission(2)"
|
||||
:disabled="!permissionStore.hasActionPermission(2)"
|
||||
>
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:trash-2" />
|
||||
@@ -534,7 +564,14 @@ function buildFileName(containerNo, index, fileName) {
|
||||
}"
|
||||
height="100%"
|
||||
>
|
||||
<vxe-column field="seq" type="seq" width="50" align="center" title=" " fixed="left" />
|
||||
<vxe-column
|
||||
field="seq"
|
||||
type="seq"
|
||||
width="50"
|
||||
align="center"
|
||||
title=" "
|
||||
fixed="left"
|
||||
/>
|
||||
<vxe-column type="checkbox" width="50" align="center" fixed="left" />
|
||||
<vxe-column
|
||||
v-for="column in columns"
|
||||
@@ -555,7 +592,12 @@ function buildFileName(containerNo, index, fileName) {
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatValueByFormat(row[column.col_FieldName], column.col_DisplayFormat) }}
|
||||
{{
|
||||
formatValueByFormat(
|
||||
row[column.col_FieldName],
|
||||
column.col_DisplayFormat,
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
@@ -9,7 +9,11 @@ const dialogData = ref({});
|
||||
const showFile = ref(false);
|
||||
|
||||
onMounted(async () => {
|
||||
const loadRes = await loadDataApi("oa_notices", ` b_visible='1'`, "b_inputdate desc");
|
||||
const loadRes = await loadDataApi(
|
||||
"v_oa_notices",
|
||||
` b_visible='1'`,
|
||||
"b_inputdatetime desc",
|
||||
);
|
||||
|
||||
if (loadRes.success) {
|
||||
dataList.value = loadRes.data;
|
||||
@@ -31,10 +35,18 @@ function handleShowDialog(data) {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-for="item in dataList" class="notice-item" @click="handleShowDialog(item)">
|
||||
<div
|
||||
v-if="dataList.length > 0"
|
||||
v-for="item in dataList"
|
||||
class="notice-item"
|
||||
@click="handleShowDialog(item)"
|
||||
>
|
||||
{{ item.b_subject }}
|
||||
</div>
|
||||
|
||||
<el-result v-else icon="primary" title="空空如也" sub-title="快去发布公告吧">
|
||||
</el-result>
|
||||
|
||||
<el-dialog v-model="showDialog" :title="dialogData.b_subject" :width="800">
|
||||
<div class="section">
|
||||
<div class="section-title">发布人</div>
|
||||
@@ -45,7 +57,11 @@ function handleShowDialog(data) {
|
||||
<div class="section">
|
||||
<div class="section-title">发布时间</div>
|
||||
<div class="section-value">
|
||||
{{ formatToDateTime(dialogData.b_updatedatetime || dialogData.b_inputdatetime) }}
|
||||
{{
|
||||
formatToDateTime(
|
||||
dialogData.b_updatedatetime || dialogData.b_inputdatetime,
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -69,7 +85,12 @@ function handleShowDialog(data) {
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<G3File v-model="showFile" :father="dialogData.b_id" module-id="oa_notices" readonly />
|
||||
<G3File
|
||||
v-model="showFile"
|
||||
:father="dialogData.b_id"
|
||||
module-id="oa_notices"
|
||||
readonly
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<script setup lang="js">
|
||||
import { saveAs } from "file-saver";
|
||||
import JSZip from "jszip";
|
||||
|
||||
// 假设这些是文件数据和它们的路径
|
||||
const files = [
|
||||
{ name: "file1.txt", folder: "folder1", content: "This is file 1 content" },
|
||||
{ name: "file2.txt", folder: "folder2", content: "This is file 2 content" },
|
||||
{ name: "file3.txt", folder: "folder1", content: "This is file 3 content" },
|
||||
{ name: "file4.txt", folder: "folder3", content: "This is file 4 content" },
|
||||
];
|
||||
|
||||
async function createZip() {
|
||||
const zip = new JSZip();
|
||||
|
||||
// 遍历文件列表,将文件按文件夹添加到 ZIP 文件中
|
||||
files.forEach((file) => {
|
||||
// 创建文件夹并将文件添加到对应的文件夹下
|
||||
zip.folder(file.folder).file(file.name, file.content);
|
||||
});
|
||||
|
||||
// 生成并下载 ZIP 文件
|
||||
const content = await zip.generateAsync({ type: "blob" });
|
||||
saveAs(content, "files.zip");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-button @click="createZip">测试</el-button>
|
||||
</template>
|
||||
@@ -2,7 +2,12 @@
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import EditDrawer from "./edit-drawer.vue";
|
||||
import CategoryDialog from "./category-dialog.vue";
|
||||
import { loadDataBySqlApi, saveObjectApi } from "@/request/api";
|
||||
import {
|
||||
loadDataApi,
|
||||
loadDataBySqlApi,
|
||||
loadPageDataApi,
|
||||
saveObjectApi,
|
||||
} from "@/request/api";
|
||||
|
||||
const tableRef = ref(null);
|
||||
|
||||
@@ -15,7 +20,7 @@ const columnData = ref([
|
||||
{ prop: "v_inputuser_name", label: "发布人", width: 120 },
|
||||
{ prop: "b_inputdate", label: "发布日期", width: 140 },
|
||||
]);
|
||||
const treeId = ref("");
|
||||
const treeId = ref(-1);
|
||||
const tableData = ref([]);
|
||||
const loading = reactive({
|
||||
table: false,
|
||||
@@ -24,12 +29,27 @@ const loading = reactive({
|
||||
error: "",
|
||||
});
|
||||
|
||||
const searchForm = ref({
|
||||
username: "",
|
||||
subject: "",
|
||||
});
|
||||
|
||||
const pagination = reactive({
|
||||
page: 0,
|
||||
size: 20,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const defaultProps = {
|
||||
children: "children",
|
||||
label: "label",
|
||||
isLeaf: "leaf",
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadTableDatas();
|
||||
});
|
||||
|
||||
async function handleNodeClick(node) {
|
||||
if (!node.id) {
|
||||
return;
|
||||
@@ -122,7 +142,8 @@ async function handleEditRow(row) {
|
||||
|
||||
function handleEditChange() {
|
||||
drawerVisible.value = false;
|
||||
loadNodeData(treeId.value, "10");
|
||||
// loadNodeData(treeId.value, "10");
|
||||
loadTableDatas();
|
||||
}
|
||||
|
||||
function handleEditClosed() {
|
||||
@@ -130,6 +151,58 @@ function handleEditClosed() {
|
||||
}
|
||||
// -----------------------------------
|
||||
|
||||
function loadTableDatas() {
|
||||
loading.table = true;
|
||||
|
||||
let searchCondition = "";
|
||||
|
||||
if (searchForm.value.subject) {
|
||||
searchCondition += `b_subject LIKE '%${searchForm.value.subject}%' AND `;
|
||||
}
|
||||
|
||||
if (searchForm.value.username) {
|
||||
searchCondition += `v_inputuser_name LIKE '%${searchForm.value.username}%' AND `;
|
||||
}
|
||||
|
||||
if (searchCondition.endsWith(" AND ")) {
|
||||
searchCondition = searchCondition.slice(0, -4);
|
||||
}
|
||||
|
||||
loadPageDataApi({
|
||||
viewName: "v_oa_notices",
|
||||
page: pagination.page,
|
||||
size: pagination.size,
|
||||
orderField: "b_updatedatetime desc",
|
||||
searchCondition,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
tableData.value = res.data.rows;
|
||||
pagination.total = res.data.total;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.table = false;
|
||||
});
|
||||
}
|
||||
|
||||
const handleSizeChange = (val) => {
|
||||
pagination.size = val;
|
||||
|
||||
loadTableDatas();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
pagination.page = val;
|
||||
|
||||
loadTableDatas();
|
||||
};
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1;
|
||||
|
||||
loadTableDatas();
|
||||
}
|
||||
|
||||
// 删除单行
|
||||
async function handleDeleteRow(row) {
|
||||
if (!row) return;
|
||||
@@ -182,7 +255,8 @@ async function deleteRows(rows = []) {
|
||||
if (res.success) {
|
||||
ElMessage.success("删除成功");
|
||||
|
||||
loadNodeData(treeId.value, "10");
|
||||
// loadNodeData(treeId.value, "10");
|
||||
loadTableDatas()
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -190,16 +264,16 @@ async function deleteRows(rows = []) {
|
||||
|
||||
<template>
|
||||
<div class="g3-flex-container">
|
||||
<div class="g3-header">
|
||||
<!-- <div class="g3-header">
|
||||
<el-button type="primary" @click="showCategory = true">
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:settings" />
|
||||
</el-icon>
|
||||
分类设置
|
||||
</el-button>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="g3-container">
|
||||
<el-splitter>
|
||||
<!-- <el-splitter>
|
||||
<el-splitter-panel size="220">
|
||||
<div class="g3-container-left">
|
||||
<div class="g3-title">
|
||||
@@ -217,104 +291,150 @@ async function deleteRows(rows = []) {
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-splitter-panel>
|
||||
</el-splitter-panel> -->
|
||||
|
||||
<el-splitter-panel>
|
||||
<div class="g3-container-right">
|
||||
<div style="width: 100%">
|
||||
<div style="display: flex; height: 32px; margin-bottom: 8px">
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:plus" />
|
||||
</el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button type="danger" @click="handleDeleteRows">
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:trash-2" />
|
||||
</el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="g3-table">
|
||||
<vxe-table
|
||||
ref="tableRef"
|
||||
border
|
||||
stripe
|
||||
header-align="center"
|
||||
:data="tableData"
|
||||
:sort-config="{
|
||||
// showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:filter-config="{
|
||||
showIcon: false,
|
||||
}"
|
||||
:column-drag-config="{
|
||||
showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:row-config="{
|
||||
useKey: true,
|
||||
keyField: 'b_id',
|
||||
isCurrent: true,
|
||||
isHover: true,
|
||||
}"
|
||||
:column-config="{
|
||||
resizable: true,
|
||||
drag: true,
|
||||
}"
|
||||
show-overflow
|
||||
show-header-overflow
|
||||
height="100%"
|
||||
>
|
||||
<vxe-column type="checkbox" width="50" align="center" />
|
||||
<vxe-column
|
||||
v-for="column in columnData"
|
||||
:key="column.prop"
|
||||
:field="column.prop"
|
||||
:title="column.label"
|
||||
:width="column.width"
|
||||
sortable
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<template v-if="['b_visible'].includes(column.prop)">
|
||||
<el-checkbox
|
||||
v-model="row[column.prop]"
|
||||
disabled
|
||||
true-value="1"
|
||||
false-value="0"
|
||||
@change="handleCheckChange(row, column.prop)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ row[column.prop] }}
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column
|
||||
width="200"
|
||||
align="center"
|
||||
fixed="right"
|
||||
title="操作"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleEditRow(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
|
||||
<el-button type="danger" link @click="handleDeleteRow(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<!-- <el-splitter-panel> -->
|
||||
<div class="g3-container-right">
|
||||
<div
|
||||
style="
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
"
|
||||
>
|
||||
<div style="display: flex">
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:plus" />
|
||||
</el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button type="danger" @click="handleDeleteRows">
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:trash-2" />
|
||||
</el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
</el-splitter-panel>
|
||||
</el-splitter>
|
||||
|
||||
<div style="display: flex; align-items: center">
|
||||
<G3Grid style="width: 400px">
|
||||
<G3GridGroup :label-width="60" :column="2">
|
||||
<G3GridItem label="主题">
|
||||
<el-input v-model="searchForm.subject" />
|
||||
</G3GridItem>
|
||||
<G3GridItem label="发布人">
|
||||
<G3Select
|
||||
v-model="searchForm.username"
|
||||
v-model:label="searchForm.username"
|
||||
search-condition="b_id <> 'g3soft'"
|
||||
view-name="b_user"
|
||||
value-key="b_name"
|
||||
label-key="b_name"
|
||||
keep-input
|
||||
/>
|
||||
</G3GridItem>
|
||||
</G3GridGroup>
|
||||
</G3Grid>
|
||||
<el-button
|
||||
type="primary"
|
||||
style="margin-left: 8px"
|
||||
@click="handleSearch"
|
||||
>
|
||||
<el-icon class="el-icon--left">
|
||||
<G3Icon icon="lucide:search" />
|
||||
</el-icon>
|
||||
搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="g3-table">
|
||||
<vxe-table
|
||||
ref="tableRef"
|
||||
border
|
||||
stripe
|
||||
header-align="center"
|
||||
:data="tableData"
|
||||
:sort-config="{
|
||||
// showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:filter-config="{
|
||||
showIcon: false,
|
||||
}"
|
||||
:column-drag-config="{
|
||||
showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:row-config="{
|
||||
useKey: true,
|
||||
keyField: 'b_id',
|
||||
isCurrent: true,
|
||||
isHover: true,
|
||||
}"
|
||||
:column-config="{
|
||||
resizable: true,
|
||||
drag: true,
|
||||
}"
|
||||
show-overflow
|
||||
show-header-overflow
|
||||
height="100%"
|
||||
>
|
||||
<vxe-column type="checkbox" width="50" align="center" />
|
||||
<vxe-column
|
||||
v-for="column in columnData"
|
||||
:key="column.prop"
|
||||
:field="column.prop"
|
||||
:title="column.label"
|
||||
:width="column.width"
|
||||
sortable
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<template v-if="['b_visible'].includes(column.prop)">
|
||||
<el-checkbox
|
||||
v-model="row[column.prop]"
|
||||
disabled
|
||||
true-value="1"
|
||||
false-value="0"
|
||||
@change="handleCheckChange(row, column.prop)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ row[column.prop] }}
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column width="200" align="center" fixed="right" title="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleEditRow(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
|
||||
<el-button type="danger" link @click="handleDeleteRow(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
|
||||
<div class="g3-pagination">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.size"
|
||||
:page-sizes="[20, 50, 100, 200]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pagination.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </el-splitter-panel> -->
|
||||
<!-- </el-splitter> -->
|
||||
</div>
|
||||
|
||||
<EditDrawer
|
||||
@@ -390,6 +510,15 @@ async function deleteRows(rows = []) {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.g3-pagination {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.g3-footer {
|
||||
padding-top: 8px;
|
||||
display: flex;
|
||||
|
||||
Reference in new issue
Block a user