20260803173356
This commit is contained in:
1 parent
5f67172892
commit
efd5a2bc93
21 files changed
+14314
No files matched your search
@@ -0,0 +1,571 @@
|
||||
<script setup>
|
||||
import g3filter from "@/components/query-conditions/g3filter.vue";
|
||||
|
||||
import { ArrowDown } from "@element-plus/icons-vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { computed, onMounted, reactive, ref } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import axios from "@/utils/axios";
|
||||
import { formatValueByFormat, getAlignByFormat, updateTableFooterData } from "@/utils/column";
|
||||
import { getTablePage, getTableColumns, handleSaveColumn } from "@/utils/dodata";
|
||||
import { confirmDelete, delBefore } from "@/utils/doDel";
|
||||
import { morePermission } from "@/utils/auth";
|
||||
import { ExportVxeTableExcel } from "@/utils/excel";
|
||||
import { handleSs, handleSh, handleBh, handleShowshdetail } from "@/views/shcenter";
|
||||
import { loaddataApi } from "@/utils/doSql";
|
||||
|
||||
defineOptions({
|
||||
name: "InvoiceList",
|
||||
});
|
||||
|
||||
const tableRef = ref(null);
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const moduleid = computed(() => currentModule.value?.b_codemoduleid);
|
||||
const columns = ref([]);
|
||||
const tableData = ref([]);
|
||||
const tableFooterData = computed(() => {
|
||||
return updateTableFooterData(columns.value, tableData.value);
|
||||
});
|
||||
|
||||
const saving = ref(false);
|
||||
const loading = ref(false);
|
||||
const error = ref(null);
|
||||
const searchCondition = ref("");
|
||||
|
||||
// 分页参数
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 列配置
|
||||
async function addColumn() {
|
||||
const result = await getTableColumns(currentModule.value?.b_viewtable);
|
||||
if (result.success) {
|
||||
columns.value = result.data;
|
||||
} else {
|
||||
ElMessage.error(`加载失败: ${result.error}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTableData(whereClause = "") {
|
||||
loading.value = true;
|
||||
try {
|
||||
await getTablePage({
|
||||
tableName: currentModule.value?.b_viewtable,
|
||||
whereClause,
|
||||
page: pagination.currentPage,
|
||||
size: pagination.pageSize,
|
||||
pkColumn: "b_id desc",
|
||||
moduleId: moduleid.value,
|
||||
targetRef: tableData,
|
||||
paginationTarget: pagination,
|
||||
errorRef: error,
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
function handleRowDblClick({ row }) {
|
||||
handleEditClick(row);
|
||||
}
|
||||
function handleEditId(row) {
|
||||
handleEditClick(row);
|
||||
}
|
||||
// 点击行显示详情
|
||||
function handleEditClick(row) {
|
||||
// 导航到详情页
|
||||
router.push({
|
||||
name: "yfdetailinvoice",
|
||||
query: { id: row.b_id, op: "mod" },
|
||||
});
|
||||
}
|
||||
async function deleteRows(rows) {
|
||||
if (!rows || !rows.length) {
|
||||
ElMessage.warning("请选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除前校验
|
||||
for (const row of rows) {
|
||||
const res = await delBefore(moduleid.value, row.b_id);
|
||||
|
||||
if (!res?.success) {
|
||||
ElMessage.error(res?.message || "删除校验执行失败");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(await confirmDelete(rows))) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const row of rows) {
|
||||
const params = {
|
||||
moduleid: moduleid.value,
|
||||
ID: row.b_id,
|
||||
};
|
||||
|
||||
const response = await axios.post("/deleteobject", params);
|
||||
|
||||
if (!response.data.success) {
|
||||
ElMessage.error(response.data.message || "删除失败");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ElMessage.success("删除成功");
|
||||
await loadTableData(buildSqlWhere());
|
||||
}
|
||||
async function handleDelClick(row) {
|
||||
deleteRows([row]);
|
||||
}
|
||||
|
||||
const query_visible = ref(true);
|
||||
function handleSearchVisible() {
|
||||
query_visible.value = !query_visible.value;
|
||||
}
|
||||
function handleAdd() {
|
||||
router.push({
|
||||
name: "yfdetailinvoice",
|
||||
query: { op: "new" },
|
||||
});
|
||||
}
|
||||
|
||||
function buildSqlWhere() {
|
||||
return searchCondition.value;
|
||||
}
|
||||
|
||||
async function handlefilter(filtersql) {
|
||||
pagination.currentPage = 1;
|
||||
|
||||
searchCondition.value = filtersql;
|
||||
await loadTableData(buildSqlWhere());
|
||||
}
|
||||
async function handleSearch() {
|
||||
pagination.currentPage = 1; // 重置到第一页
|
||||
await loadTableData(buildSqlWhere());
|
||||
}
|
||||
|
||||
// 每页条数变化
|
||||
async function handleSizeChange(val) {
|
||||
pagination.pageSize = val;
|
||||
await loadTableData(buildSqlWhere());
|
||||
}
|
||||
|
||||
// 当前页变化
|
||||
async function handleCurrentChange(val) {
|
||||
pagination.currentPage = val;
|
||||
await loadTableData(buildSqlWhere());
|
||||
}
|
||||
|
||||
// --------
|
||||
const moduleList = ref([]);
|
||||
const currentModule = ref(null);
|
||||
|
||||
async function loadModules() {
|
||||
const modules = await loaddataApi(
|
||||
"s_module_config",
|
||||
`b_type = 'cw_invoice' and b_cwtype = '实付' and b_canuse='1'`,
|
||||
);
|
||||
|
||||
moduleList.value = modules;
|
||||
if (modules.length > 0) {
|
||||
currentModule.value = modules[0];
|
||||
} else {
|
||||
currentModule.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleModuleChange(value) {
|
||||
currentModule.value = value;
|
||||
|
||||
await addColumn();
|
||||
|
||||
pagination.currentPage = 1;
|
||||
pagination.pageSize = 50;
|
||||
pagination.total = 0;
|
||||
|
||||
await loadTableData("");
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadModules();
|
||||
await addColumn();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="g3pagecontainer">
|
||||
<div class="g3container">
|
||||
<div class="g3modulebar">
|
||||
<span>业务模块:</span>
|
||||
<el-select
|
||||
v-model="currentModule"
|
||||
placeholder="请选择模块"
|
||||
size="small"
|
||||
value-key="b_id"
|
||||
@change="handleModuleChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in moduleList"
|
||||
:key="item.b_id"
|
||||
:label="item.b_name"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div v-show="query_visible" class="g3query">
|
||||
<g3filter :module-id="moduleid" @update:search="handlefilter" />
|
||||
</div>
|
||||
<div class="g3main">
|
||||
<div class="g3containerheader">
|
||||
<div class="g3flex">
|
||||
<el-button :disabled="morePermission(1)" type="primary" @click="handleAdd">
|
||||
新建
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="g3flex">
|
||||
<div class="g3-svg-query g3mright10" @click="handleSearchVisible">
|
||||
<SvgIcon name="search" />
|
||||
</div>
|
||||
<el-dropdown>
|
||||
<div class="g3-svg-query">
|
||||
<SvgIcon name="more" />
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
:disabled="morePermission(7)"
|
||||
@click="handleSs(tableRef.getCheckboxRecords())"
|
||||
>
|
||||
送审
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:disabled="morePermission(7)"
|
||||
@click="handleSh(tableRef.getCheckboxRecords())"
|
||||
>
|
||||
审核
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:disabled="morePermission(7)"
|
||||
@click="handleBh(tableRef.getCheckboxRecords())"
|
||||
>
|
||||
驳回
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:disabled="morePermission(6)"
|
||||
divided
|
||||
@click="ExportVxeTableExcel(tableRef)"
|
||||
>
|
||||
导出Excel
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
divided
|
||||
:disabled="morePermission(9)"
|
||||
@click="() => handleSaveColumn(tableRef, 'v_cw_yfinvoice')"
|
||||
>
|
||||
栏位设定
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<div class="g3grid">
|
||||
<vxe-table
|
||||
ref="tableRef"
|
||||
border
|
||||
stripe
|
||||
header-align="center"
|
||||
:data="tableData"
|
||||
:show-footer="true"
|
||||
:footer-data="tableFooterData"
|
||||
:loading="loading"
|
||||
:sort-config="{
|
||||
// showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:filter-config="{
|
||||
showIcon: false,
|
||||
}"
|
||||
:column-drag-config="{
|
||||
showIcon: false,
|
||||
trigger: 'cell',
|
||||
}"
|
||||
:row-config="{
|
||||
useKey: true,
|
||||
isCurrent: true,
|
||||
isHover: true,
|
||||
}"
|
||||
size="small"
|
||||
:cell-config="{
|
||||
height: 26,
|
||||
}"
|
||||
:column-config="{
|
||||
resizable: true,
|
||||
drag: true,
|
||||
}"
|
||||
show-overflow
|
||||
show-header-overflow
|
||||
show-footer-overflow
|
||||
height="100%"
|
||||
@cell-dblclick="handleRowDblClick"
|
||||
>
|
||||
<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"
|
||||
:key="column.prop"
|
||||
:field="column.prop"
|
||||
:title="column.label"
|
||||
:width="column.width"
|
||||
:align="getAlignByFormat(column.displayFormat)"
|
||||
:params="column"
|
||||
sortable
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<template v-if="column.edit_type == 'checkbox'">
|
||||
<el-checkbox
|
||||
v-model="row[column.prop]"
|
||||
disabled
|
||||
true-value="1"
|
||||
false-value="0"
|
||||
@change="handleCheckChange(row, column.prop)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="['b_id', 'b_ywno'].includes(column.prop)">
|
||||
<span class="g3-color" @click="handleEditId(row)">
|
||||
{{ row[column.prop] }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatValueByFormat(row[column.prop], column.displayFormat) }}
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.showSummary === '1'" #footer="{ row }">
|
||||
{{ formatValueByFormat(row[column.prop], row.displayFormat) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column width="180" align="center" fixed="right" title="操作">
|
||||
<template #default="{ row }">
|
||||
<div class="tableactions">
|
||||
<el-button
|
||||
:disabled="morePermission(3)"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
style="font-size: 14px"
|
||||
@click="handleEditClick(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="morePermission(4)"
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
style="font-size: 14px"
|
||||
@click="handleDelClick(row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-dropdown>
|
||||
<span class="el-dropdown-link">
|
||||
更多
|
||||
<el-icon class="el-icon--right">
|
||||
<ArrowDown />
|
||||
</el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :disabled="morePermission(7)" @click="handleSs([row])">
|
||||
送审
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :disabled="morePermission(7)" @click="handleSh([row])">
|
||||
审核
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :disabled="morePermission(7)" @click="handleBh([row])">
|
||||
驳回
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:disabled="morePermission(7)"
|
||||
@click="handleShowshdetail(row)"
|
||||
>
|
||||
审核进度
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<div class="g3pagination">
|
||||
<el-pagination
|
||||
:current-page="pagination.currentPage"
|
||||
:page-sizes="[20, 50, 100]"
|
||||
:page-size="pagination.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pagination.total"
|
||||
size="small"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-alert v-if="error" :title="error" type="error" show-icon closable @close="error = ''" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.g3pagecontainer {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
background-color: #f2f3f5;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.g3container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.g3query {
|
||||
padding: 10px 10px 8px 10px;
|
||||
margin-bottom: 6px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 12px #0000000d;
|
||||
}
|
||||
|
||||
.g3main {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 12px #0000000d;
|
||||
box-sizing: border-box;
|
||||
min-height: 0;
|
||||
}
|
||||
.g3containerheader {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 32px;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
.g3flex {
|
||||
display: flex;
|
||||
}
|
||||
.g3mright10 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.g3grid {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.g3pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.g3-svg-query {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
padding: 8px;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
border: 1px solid #dcdfe6;
|
||||
}
|
||||
.g3-svg-query:hover {
|
||||
border-color: #badeff;
|
||||
background-color: #e8f4ff;
|
||||
}
|
||||
|
||||
.tableactions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/**下拉 */
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
color: #409eff;
|
||||
align-items: center;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
/* 查询日期图标 */
|
||||
:deep(.g3-prefix .el-input__prefix) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.el-dropdown .g3-svg-query:focus,
|
||||
.el-dropdown-link:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.g3-color {
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* ---------------添加disabled 修改效果 */
|
||||
:deep(.el-input.is-disabled .el-input__inner) {
|
||||
cursor: default;
|
||||
}
|
||||
:deep(.el-button.is-disabled) {
|
||||
cursor: default;
|
||||
}
|
||||
/* ------------------ */
|
||||
|
||||
/* -------------------- */
|
||||
:deep(.vxe-cell--wrapper) {
|
||||
overflow: hidden;
|
||||
/* 隐藏溢出 */
|
||||
text-overflow: ellipsis;
|
||||
/* 文本溢出显示省略号 */
|
||||
white-space: nowrap;
|
||||
/* 不换行 */
|
||||
}
|
||||
/* -------------------- */
|
||||
|
||||
.g3modulebar {
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.g3modulebar .el-select {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user