|
|
@@ -1,27 +1,49 @@
|
|
|
<template>
|
|
|
- <a-space>
|
|
|
+ <a-space style="margin-bottom: 8px;">
|
|
|
<label>年份:</label>
|
|
|
- <a-select v-model:value="year" size="small" :options="years" style="width: 100px;" />
|
|
|
- <a-button size="small" :icon="h(SearchOutlined)">查询</a-button>
|
|
|
+ <a-date-picker v-model:value="yearValue" picker="year" size="small" @change="yearChanged" />
|
|
|
+ <a-button size="small" :icon="h(SearchOutlined)" @click="queryByYear">查询</a-button>
|
|
|
<a-button size="small" :icon="h(PayCircleOutlined)" @click="extractModal = true">提取折旧(摊销)</a-button>
|
|
|
</a-space>
|
|
|
- <a-modal v-model:open="extractModal" title="提取折旧(摊销)" width="16%" @ok="saveExtract">
|
|
|
+
|
|
|
+ <a-table
|
|
|
+ :columns="accountColumns" :data-source="accountDatas" :pagination="false" :scroll="{ y: 720 }" bordered
|
|
|
+ size="small" :loading="isLoading"
|
|
|
+ >
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.dataIndex === 'registerAccountDate'">
|
|
|
+ <span v-if="!record.registerAccountDate">未入账</span>
|
|
|
+ <span v-else>已登账,入账日期:{{ record.registerAccountDate }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.dataIndex === 'operation'">
|
|
|
+ <a-button v-if="!record.registerAccountDate" type="link" @click="entryAccount(record)">登账</a-button>
|
|
|
+ <span v-else>已登账</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+
|
|
|
+ <a-modal v-model:open="extractModal" title="提取折旧(摊销)" width="300px" @ok="saveExtract">
|
|
|
选择折旧年月 <a-date-picker v-model:value="depreciationYear" picker="month" :allow-clear="false" />
|
|
|
</a-modal>
|
|
|
- <a-modal v-model:open="voucherModal" title="折旧原始凭证" width="38%">
|
|
|
+ <a-modal v-model:open="voucherModal" title="折旧原始凭证" width="680px" @ok="updateAccount">
|
|
|
<h4 class="title">
|
|
|
计提折旧(摊销)凭证
|
|
|
</h4>
|
|
|
- <a-flex justify="space-between" align="center" style="margin-bottom: 6px;">
|
|
|
- <a-space>
|
|
|
- <div class="ellipsis" title="上海市城市建设档案馆">
|
|
|
- 核算单位 : 上海市城市建设档案馆
|
|
|
+ <a-flex justify="space-between" align="center" style="margin-bottom: 6px;" wrap="wrap">
|
|
|
+ <a-flex align="center" wrap="wrap">
|
|
|
+ <div class="ellipsis" :title="voucherDatas ? voucherDatas.clientName : ''">
|
|
|
+ 核算单位 : {{ voucherDatas ? voucherDatas.clientName : '' }}
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span>登账日期 : </span>
|
|
|
+ <a-date-picker
|
|
|
+ v-model:value="registerAccountDate" size="small" value-format="YYYY-MM-DD"
|
|
|
+ @change="accountDateChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
- <span>登账日期: </span>
|
|
|
- <a-date-picker v-model:value="postingDate" size="small" format="YYYY-MM-DD" />
|
|
|
- </a-space>
|
|
|
+ </a-flex>
|
|
|
<div style="text-align: right;">
|
|
|
- 第 <a-input size="small" style="width: 60%;" /> 号
|
|
|
+ 第 <a-input v-model:value="accountVoucherNo" size="small" style="width: 60%;" /> 号
|
|
|
</div>
|
|
|
</a-flex>
|
|
|
<div class="table-container">
|
|
|
@@ -31,100 +53,159 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<a-flex justify="space-between" align="center" style="margin-top: 12px;">
|
|
|
- <span>操作日期 : 2018-06-12</span>
|
|
|
- <span>计提人 : 陈刚</span>
|
|
|
- <span>上海联物</span>
|
|
|
+ <span>操作日期 : {{ voucherDatas ? voucherDatas.operationDate : '' }}</span>
|
|
|
+ <span>计提人 : {{ voucherDatas ? voucherDatas.operationName : '' }}</span>
|
|
|
+ <!-- <span>上海联物</span> -->
|
|
|
</a-flex>
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import dayjs from 'dayjs';
|
|
|
-import { ref, h } from 'vue';
|
|
|
-import { getCurrentDate } from './util.js';
|
|
|
+import { ref, h, onMounted } from 'vue';
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
+import Common from '../../common/Common.js';
|
|
|
+import { accountColumn, getCurrentDate, getTime } from './util.js';
|
|
|
import { SearchOutlined, PayCircleOutlined } from '@ant-design/icons-vue';
|
|
|
-const year = ref(undefined);
|
|
|
-const years = ref([{ label: '2017', value: '2017' }]);
|
|
|
+import { queryByYearApi, generateVouchApi, queryLineApi, updateAccountApi } from '../../api/assetPeriodDepreciate/index.js';
|
|
|
|
|
|
+const yearStr = ref(new Date().getFullYear());
|
|
|
+const yearValue = ref(dayjs(getCurrentDate(), 'YYYY'));
|
|
|
+
|
|
|
+const dataSource = ref([]);
|
|
|
+const isLoading = ref(false);
|
|
|
+const accountDatas = ref([]);
|
|
|
+const voucherDatas = ref(null);
|
|
|
const extractModal = ref(false);
|
|
|
const voucherModal = ref(false);
|
|
|
-const postingDate = ref(undefined);
|
|
|
+const accountVoucherNo = ref('');
|
|
|
+const accountId = ref(null);
|
|
|
+const registerAccountDate = ref(undefined);
|
|
|
+const accountColumns = ref(accountColumn);
|
|
|
const depreciationYear = ref(dayjs(getCurrentDate(), 'YYYY-MM'));
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ queryByYear();
|
|
|
+});
|
|
|
+
|
|
|
+// 获取提取年份
|
|
|
+const yearChanged = (_, dateString) => {
|
|
|
+ yearStr.value = dateString;
|
|
|
+};
|
|
|
+
|
|
|
+// 获取登账时间(时分秒)
|
|
|
+const accountDateChange = dateStr => {
|
|
|
+ const time = getTime();
|
|
|
+ registerAccountDate.value = `${dateStr} ${time}`;
|
|
|
+};
|
|
|
+
|
|
|
+// 打开提取折旧登账
|
|
|
+const entryAccount = record => {
|
|
|
+ voucherModal.value = true;
|
|
|
+ accountId.value = record.id;
|
|
|
+ queryLine(record.id);
|
|
|
+};
|
|
|
+
|
|
|
+// 根据年份查询记账凭证数据
|
|
|
+const queryByYear = () => {
|
|
|
+ isLoading.value = true;
|
|
|
+ queryByYearApi(yearStr.value).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ accountDatas.value = success.datas;
|
|
|
+ } else {
|
|
|
+ message.warning(success.errorMessage);
|
|
|
+ }
|
|
|
+ isLoading.value = false;
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ isLoading.value = false;
|
|
|
+ },
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 根据年月生成计提折旧信息
|
|
|
const saveExtract = () => {
|
|
|
const date = dayjs(depreciationYear.value).format('YYYY-MM');
|
|
|
- voucherModal.value = true;
|
|
|
+ generateVouchApi(date).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ queryByYear();
|
|
|
+ extractModal.value = false;
|
|
|
+ message.success('提取成功');
|
|
|
+ } else {
|
|
|
+ message.warning(success.errorMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 根据计提凭证id查询计提凭证数据
|
|
|
+const queryLine = id => {
|
|
|
+ queryLineApi(id).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ voucherDatas.value = success.data;
|
|
|
+ dataSource.value = success.data.accountVoucherLineDtos;
|
|
|
+ } else {
|
|
|
+ message.warning(success.errorMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 设置计提折旧登账时间和字号
|
|
|
+const updateAccount = id => {
|
|
|
+ const params = {
|
|
|
+ id: accountId.value,
|
|
|
+ registerAccountDate: registerAccountDate.value,
|
|
|
+ accountVoucherNo: accountVoucherNo.value,
|
|
|
+ };
|
|
|
+ updateAccountApi(params).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ message.success('保存成功');
|
|
|
+ voucherModal.value = false;
|
|
|
+ } else {
|
|
|
+ message.warning(success.errorMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
const columns = ref([
|
|
|
{
|
|
|
title: '摘要',
|
|
|
- dataIndex: 'title',
|
|
|
+ dataIndex: 'name',
|
|
|
width: 200,
|
|
|
},
|
|
|
{
|
|
|
title: '会计科目',
|
|
|
- dataIndex: 'project',
|
|
|
+ dataIndex: 'accountSubjectName',
|
|
|
width: 200,
|
|
|
|
|
|
},
|
|
|
{
|
|
|
title: '借方金额',
|
|
|
- dataIndex: 'money1',
|
|
|
+ dataIndex: 'debitAmount',
|
|
|
width: 80,
|
|
|
},
|
|
|
{
|
|
|
title: '贷方金额',
|
|
|
- dataIndex: 'money2',
|
|
|
+ dataIndex: 'creditAmount',
|
|
|
width: 80,
|
|
|
-
|
|
|
},
|
|
|
].map(item => ({ ...item, align: 'center' })));
|
|
|
-const dataSource = ref([
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- title: '计提2017年11月份折旧额',
|
|
|
- project: '非流动资产基金-固定资产',
|
|
|
- money1: 70000,
|
|
|
- money2: 70000,
|
|
|
- },
|
|
|
-
|
|
|
-]);
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|