会计科目菜单

This commit is contained in:
jinbooks_dev
2025-08-01 09:38:06 +08:00
parent 7f469b3138
commit 8cf3cc8014
2 changed files with 26 additions and 63 deletions

View File

@ -73,11 +73,6 @@
<el-tooltip content="编辑"> <el-tooltip content="编辑">
<el-button link icon="Edit" @click="handleUpdate(scope.row)"></el-button> <el-button link icon="Edit" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="关联会计科目">
<el-button plain type="text" @click="showSubjects(scope.row)">
<svg-icon icon-class="menus-huijikemu" size="0.9em"></svg-icon>
</el-button>
</el-tooltip>
<el-tooltip content="移除"> <el-tooltip content="移除">
<el-button link icon="Delete" type="danger" @click="handleDelete(scope.row)"></el-button> <el-button link icon="Delete" type="danger" @click="handleDelete(scope.row)"></el-button>
</el-tooltip> </el-tooltip>
@ -99,8 +94,7 @@
:vat_types="books_vat_type" :vat_types="books_vat_type"
:books_industry="books_industry" :books_industry="books_industry"
@dialogOfClosedMethods="dialogOfClosedMethods"></edit-form> @dialogOfClosedMethods="dialogOfClosedMethods"></edit-form>
<!--会计科目-->
<subjects-related :title="title" :form-id="id" :open="subjectOpen" @hatsDrawerClose="dialogOfClosedMethods"/>
</div> </div>
</template> </template>
@ -108,7 +102,6 @@
import {useI18n} from "vue-i18n"; import {useI18n} from "vue-i18n";
import {getCurrentInstance, reactive, ref, toRefs} from "vue"; import {getCurrentInstance, reactive, ref, toRefs} from "vue";
import editForm from "./edit.vue"; import editForm from "./edit.vue";
import subjectsRelated from "./subject-relate.vue";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import DictTagNumber from "@/components/DIctTagNumber/index.vue"; import DictTagNumber from "@/components/DIctTagNumber/index.vue";
import {listBooksSets, deleteBatch} from "@/api/system/book/book"; import {listBooksSets, deleteBatch} from "@/api/system/book/book";

View File

@ -1,10 +1,6 @@
<template> <template>
<el-drawer v-model="dialogStatus" :close-on-click-modal="false" size="80%" <div class="app-container">
@close="dialogOfClosedMethods(false)"> <el-card class="common-card query-box">
<template #header>
<h4>{{ title }}</h4>
</template>
<template #default>
<div class="queryForm"> <div class="queryForm">
<el-form :model="queryParams" ref="queryRef" :inline="true" <el-form :model="queryParams" ref="queryRef" :inline="true"
@submit.native.prevent> @submit.native.prevent>
@ -47,6 +43,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-card>
<el-card class="common-card">
<div class="button-top"> <div class="button-top">
<el-button <el-button
@click="handleAdd" @click="handleAdd"
@ -87,7 +85,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="direction" :label="t('subjectBalanceDirection')" align="center" min-width="50"> <el-table-column prop="direction" :label="t('subjectBalanceDirection')" align="center" min-width="50">
<template #default="scope"> <template #default="scope">
<el-tag type="warning" v-if="scope.row.direction == 0">{{ t('subjectDirectimonNone') }}</el-tag> <el-tag type="warning" v-if="scope.row.direction == 0">{{ t('subjectDirectionNone') }}</el-tag>
<el-tag type="warning" v-if="scope.row.direction == 1">{{ t('subjectDebit') }}</el-tag> <el-tag type="warning" v-if="scope.row.direction == 1">{{ t('subjectDebit') }}</el-tag>
<el-tag type="success" v-if="scope.row.direction == 2">{{ t('subjectCredit') }}</el-tag> <el-tag type="success" v-if="scope.row.direction == 2">{{ t('subjectCredit') }}</el-tag>
</template> </template>
@ -127,6 +125,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card>
<!-- <pagination--> <!-- <pagination-->
<!-- v-show="total > 0"--> <!-- v-show="total > 0"-->
<!-- :total="total"--> <!-- :total="total"-->
@ -240,13 +239,7 @@
</div> </div>
</template> </template>
</el-drawer> </el-drawer>
</template> </div>
<template #footer>
<div style="flex: auto">
<el-button @click="dialogOfClosedMethods(false)">{{ t('org.cancel') }}</el-button>
</div>
</template>
</el-drawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
@ -267,10 +260,13 @@ import {
reorgDisplayName reorgDisplayName
} from "@/api/system/book/book-subject"; } from "@/api/system/book/book-subject";
import {handleTree} from "@/utils/Jinbooks"; import {handleTree} from "@/utils/Jinbooks";
import bookStore from "@/store/modules/bookStore";
import Template from "@/views/hr/salary-voucher-rules/template.vue"; import Template from "@/views/hr/salary-voucher-rules/template.vue";
const {t} = useI18n() const {t} = useI18n()
const currBookStore = bookStore()
const {proxy} = getCurrentInstance()!; const {proxy} = getCurrentInstance()!;
const {subjects_category, subjects_auxiliary} const {subjects_category, subjects_auxiliary}
@ -287,22 +283,6 @@ const emit: any = defineEmits(['hatsDrawerClose'])
const formRef = ref<InstanceType<typeof ElForm> | null>(null); const formRef = ref<InstanceType<typeof ElForm> | null>(null);
const props: any = defineProps({
title: {
type: String,
default: ""
},
open: {
type: Boolean,
default: false
},
formId: {
type: String,
default: undefined
},
}
)
const data: any = reactive({ const data: any = reactive({
queryParams: { queryParams: {
pageSize: 100000, pageSize: 100000,
@ -345,21 +325,7 @@ const defaultProps: any = ref({
disabled: disabledFilter disabled: disabledFilter
}) })
// open queryParams.value.bookId = currBookStore.bookId;
watch(
() => props.open,
(val: any) => {
if (val && props.formId) {
dialogStatus.value = props.open;
queryParams.value.bookId = props.formId;
getList();
getSetTree();
} else {
reset();
}
},
{immediate: true}
);
function dialogOfClosedMethods(val: any): any { function dialogOfClosedMethods(val: any): any {
dialogStatus.value = false; dialogStatus.value = false;
@ -391,7 +357,7 @@ function handleAdd(): any {
form.value = { form.value = {
direction: "1", direction: "1",
status: 1, status: 1,
bookId: props.formId, bookId: currBookStore.bookId,
auxiliary: [], auxiliary: [],
isCash: 0 isCash: 0
}; };
@ -400,7 +366,7 @@ function handleAdd(): any {
} }
function getOneSetSubject() { function getOneSetSubject() {
getSetSubject({id: id.value, bookId: props.formId}).then((res: any) => { getSetSubject({id: id.value, bookId: currBookStore.bookId}).then((res: any) => {
try { try {
res.data.auxiliary = res.data.auxiliary ? JSON.parse(res.data.auxiliary) : []; res.data.auxiliary = res.data.auxiliary ? JSON.parse(res.data.auxiliary) : [];
res.data.auxiliary.forEach((t: any) => { res.data.auxiliary.forEach((t: any) => {
@ -415,13 +381,13 @@ function getOneSetSubject() {
} }
form.value = res.data; form.value = res.data;
form.value.bookId = props.formId; form.value.bookId = currBookStore.bookId;
}) })
} }
function onDelete(row: any): any { function onDelete(row: any): any {
modal.confirm("是否确认删除名称为\"" + row.name + "\"的会计科目?").then(function () { modal.confirm("是否确认删除名称为\"" + row.name + "\"的会计科目?").then(function () {
return deleteBatch({listIds: [row.id], bookId: props.formId}); return deleteBatch({listIds: [row.id], bookId: currBookStore.bookId});
}).then((res: any) => { }).then((res: any) => {
if (res.code === 0) { if (res.code === 0) {
getList(); getList();
@ -436,7 +402,7 @@ function onDelete(row: any): any {
/** 多选删除操作*/ /** 多选删除操作*/
function handleRemove(): any { function handleRemove(): any {
modal.confirm("是否确认删除这些数据?").then(function () { modal.confirm("是否确认删除这些数据?").then(function () {
return deleteBatch({listIds: ids.value, bookId: props.formId}); return deleteBatch({listIds: ids.value, bookId: currBookStore.bookId});
}).then((res: any) => { }).then((res: any) => {
if (res.code === 0) { if (res.code === 0) {
handleQuery(); handleQuery();
@ -497,17 +463,17 @@ interface TreeNode {
} }
function getSetTree() { function getSetTree() {
getTree({bookId: props.formId}).then((response: { data: TreeNode[] }) => { getTree({bookId: currBookStore.bookId}).then((response: { data: TreeNode[] }) => {
deptOptions.value = response.data; deptOptions.value = response.data;
form.value.parentId = undefined; form.value.parentId = undefined;
}); });
} }
function disabledFilter(data: any, node: any): any { function disabledFilter(data: any, node: any): any {
if (!props.formId) { if (!currBookStore.bookId) {
return false; return false;
} }
return new RegExp(`/${props.formId}(/|$)`).test(data.idPath) return new RegExp(`/${currBookStore.bookId}(/|$)`).test(data.idPath)
} }
function handleUpdate(row: any): any { function handleUpdate(row: any): any {
@ -533,10 +499,10 @@ function submitForm(): any {
formRef?.value?.validate((valid: any) => { formRef?.value?.validate((valid: any) => {
if (valid) { if (valid) {
const operation: any = id.value ? updateSubject : saveSubject; const operation: any = id.value ? updateSubject : saveSubject;
const successMessage: any = props.formId const successMessage: any = currBookStore.bookId
? t('org.success.update') ? t('org.success.update')
: t('org.success.add'); : t('org.success.add');
const formData = {...form.value, bookId: props.formId} const formData = {...form.value, bookId: currBookStore.bookId}
formData.auxiliary = formData.auxiliary && formData.auxiliary instanceof Array formData.auxiliary = formData.auxiliary && formData.auxiliary instanceof Array
? JSON.stringify(formData.auxiliary) : '[]'; ? JSON.stringify(formData.auxiliary) : '[]';
operation(formData).then((res: any) => handleResponse(res, successMessage)); operation(formData).then((res: any) => handleResponse(res, successMessage));
@ -568,6 +534,10 @@ function handle_subjects_category_dicts(item: any) {
} }
} }
getList();
getSetTree();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>