|
|
@@ -11,12 +11,13 @@
|
|
|
<a-col flex="auto" class="table_box" style="width: 0;">
|
|
|
<div class="operation_box">
|
|
|
<a-input-search
|
|
|
- v-model:value="searchParams.name" size="small"
|
|
|
- style="width: 300px;margin:0 0 8px 0;" enter-button @search="searchChange"
|
|
|
+ v-model:value="searchParams.name" size="small" style="width: 300px;margin:0 0 8px 0;"
|
|
|
+ enter-button @search="searchChange(true)"
|
|
|
/>
|
|
|
<a-pagination
|
|
|
- v-model:current="current" simple size="small" :total="infoTotal"
|
|
|
- :default-page-size="20" @change="getPageParams"
|
|
|
+ v-model:current="current" size="small" :total="infoTotal" show-quick-jumper
|
|
|
+ :show-size-changer="true" :page-size-options="pageSizeOptions" :default-page-size="20"
|
|
|
+ @change="getPageParams" @show-size-change="showSizeChange"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
@@ -37,6 +38,9 @@
|
|
|
<a-button size="small" :icon="h(PercentageOutlined)" @click="operation('设置残值率')">
|
|
|
设置残值率
|
|
|
</a-button>
|
|
|
+ <a-button size="small" :icon="h(FileProtectOutlined)" @click="operation('设置累计折旧')">
|
|
|
+ 设置累计折旧
|
|
|
+ </a-button>
|
|
|
</a-space>
|
|
|
<a-space>
|
|
|
<!-- <a-button size="small" :icon="h(DownloadOutlined)">导出</a-button> -->
|
|
|
@@ -70,6 +74,12 @@
|
|
|
:field-names="{ label: 'text', value: 'id' }"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
+ <a-form-item v-if="modalTitle === '设置累计折旧'" label="请选择" style="margin-top: 24px;">
|
|
|
+ <a-select
|
|
|
+ v-model:value="subject" style="width: 90%" allow-clear option-filter-prop="label" show-search
|
|
|
+ :options="subjects"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
<a-form-item v-if="modalTitle === '设置残值率'" label="请输入" style="margin-top: 24px;">
|
|
|
<a-input-number
|
|
|
v-model:value="reservedRate" :controls="false" :step="0.01" :min="0" :max="100"
|
|
|
@@ -80,16 +90,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, h } from 'vue';
|
|
|
+import { ref, reactive, onMounted, h } from 'vue';
|
|
|
import Common from '../../common/Common';
|
|
|
import CommonTable from '../../common/CommonTable.vue';
|
|
|
-import { FieldTimeOutlined, MoneyCollectOutlined, PayCircleOutlined, DownloadOutlined, ProfileOutlined, PercentageOutlined } from '@ant-design/icons-vue';
|
|
|
+import { FieldTimeOutlined, MoneyCollectOutlined, PayCircleOutlined, DownloadOutlined, ProfileOutlined, PercentageOutlined, FileProtectOutlined } from '@ant-design/icons-vue';
|
|
|
import {
|
|
|
- queryCategoriesApi, queryByNameApi, queryByIdApi, updateYearApi, updateExtractApi, getMethodsApi, updateMethodApi,
|
|
|
- updateReservedRateApi,
|
|
|
+ queryCategoriesApi, queryByNameApi, updateYearApi, updateExtractApi, getMethodsApi, updateMethodApi,
|
|
|
+ updateReservedRateApi, updateSubjectApi,
|
|
|
} from '../../api/assetPeriodDepreciate';
|
|
|
import { infoColumns, debounce } from './util.js';
|
|
|
import { message, Modal } from 'ant-design-vue';
|
|
|
+import { SqlApi } from 'pc-component-v3';
|
|
|
|
|
|
// 表格配置
|
|
|
const commonTable = ref();
|
|
|
@@ -110,13 +121,15 @@ const visible = ref(false);
|
|
|
const modalTitle = ref('');
|
|
|
const yearLimit = ref(null); // 折旧年限
|
|
|
const reservedRate = ref(null); // 残值率
|
|
|
+const subject = ref(undefined); // 会计科目
|
|
|
+const subjects = ref([]); // 会计科目
|
|
|
const isLoading = ref(false);
|
|
|
const isAllSearch = ref(true);
|
|
|
-const selectCategory = ref(null);
|
|
|
-const selectCategoryId = ref([]);
|
|
|
+const pageSizeOptions = ref(['20', '50', '100', '200', '500']);
|
|
|
|
|
|
// 查询参数
|
|
|
const searchParams = reactive({
|
|
|
+ id: null,
|
|
|
name: '',
|
|
|
range: {
|
|
|
start: 0,
|
|
|
@@ -124,6 +137,10 @@ const searchParams = reactive({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ getSubjects();
|
|
|
+});
|
|
|
+
|
|
|
const clearDatas = () => {
|
|
|
modalTitle.value = '';
|
|
|
yearLimit.value = null;
|
|
|
@@ -158,6 +175,12 @@ const setDepreciationInfo = () => {
|
|
|
assetCategoryIds: selectedIds.value,
|
|
|
};
|
|
|
setMethod(params);
|
|
|
+ } else if (modalTitle.value === '设置累计折旧') {
|
|
|
+ const params = {
|
|
|
+ accountSubjectId: subject.value,
|
|
|
+ assetCategoryIds: selectedIds.value,
|
|
|
+ };
|
|
|
+ updateSubject(params);
|
|
|
} else {
|
|
|
const params = {
|
|
|
reservedRate: reservedRate.value,
|
|
|
@@ -172,16 +195,16 @@ const setYearLimit = params => {
|
|
|
updateYearApi(params).then(
|
|
|
success => {
|
|
|
if (success.errorCode === 0) {
|
|
|
+ clearDatas();
|
|
|
+ if (!searchParams.id) {
|
|
|
+ searchChange(true);
|
|
|
+ } else {
|
|
|
+ searchChange(false);
|
|
|
+ }
|
|
|
message.success('设置折旧年限成功。');
|
|
|
} else {
|
|
|
message.warning(success.errorMessage);
|
|
|
}
|
|
|
- clearDatas();
|
|
|
- if (isAllSearch.value) {
|
|
|
- searchChange();
|
|
|
- } else {
|
|
|
- categoriesSelected();
|
|
|
- }
|
|
|
},
|
|
|
error => {
|
|
|
Common.processException(error);
|
|
|
@@ -194,16 +217,16 @@ const setMethod = params => {
|
|
|
updateMethodApi(params).then(
|
|
|
success => {
|
|
|
if (success.errorCode === 0) {
|
|
|
+ clearDatas();
|
|
|
+ if (!searchParams.id) {
|
|
|
+ searchChange(true);
|
|
|
+ } else {
|
|
|
+ searchChange(false);
|
|
|
+ }
|
|
|
message.success('设置折旧方法成功。');
|
|
|
} else {
|
|
|
message.warning(success.errorMessage);
|
|
|
}
|
|
|
- clearDatas();
|
|
|
- if (isAllSearch.value) {
|
|
|
- searchChange();
|
|
|
- } else {
|
|
|
- categoriesSelected();
|
|
|
- }
|
|
|
},
|
|
|
error => {
|
|
|
Common.processException(error);
|
|
|
@@ -216,15 +239,37 @@ const setReservedRate = params => {
|
|
|
updateReservedRateApi(params).then(
|
|
|
success => {
|
|
|
if (success.errorCode === 0) {
|
|
|
+ clearDatas();
|
|
|
+ if (!searchParams.id) {
|
|
|
+ searchChange(true);
|
|
|
+ } else {
|
|
|
+ searchChange(false);
|
|
|
+ }
|
|
|
message.success('设置残值率成功。');
|
|
|
} else {
|
|
|
message.warning(success.errorMessage);
|
|
|
}
|
|
|
- clearDatas();
|
|
|
- if (isAllSearch.value) {
|
|
|
- searchChange();
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 设置累计折旧科目
|
|
|
+const updateSubject = params => {
|
|
|
+ updateSubjectApi(params).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ clearDatas();
|
|
|
+ if (!searchParams.id) {
|
|
|
+ searchChange(true);
|
|
|
+ } else {
|
|
|
+ searchChange(false);
|
|
|
+ }
|
|
|
+ message.success(success.errorMessage);
|
|
|
} else {
|
|
|
- categoriesSelected();
|
|
|
+ message.warning(success.errorMessage);
|
|
|
}
|
|
|
},
|
|
|
error => {
|
|
|
@@ -262,36 +307,10 @@ const cancelDepreciation = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-// 根据分类ID查询折旧信息(处理刷新情况,避免点击父类资产时刷新无效)
|
|
|
-const categoriesSelected = (key, selected) => {
|
|
|
- let nowKey;
|
|
|
- let nowCategory;
|
|
|
- if (selected) {
|
|
|
- if (!selected.node.dataRef.children) {
|
|
|
- selectCategoryId.value = nowKey = key;
|
|
|
- selectCategory.value = nowCategory = selected;
|
|
|
- }
|
|
|
- } else {
|
|
|
- nowKey = [...selectCategoryId.value];
|
|
|
- nowCategory = { ...selectCategory.value };
|
|
|
- }
|
|
|
- if (nowKey && nowKey.length) {
|
|
|
- if (!nowCategory.node.dataRef.children) {
|
|
|
- queryByIdApi(nowKey[0]).then(
|
|
|
- success => {
|
|
|
- if (success.name) {
|
|
|
- dataSource.value = [{ ...success }];
|
|
|
- infoTotal.value = 1;
|
|
|
- }
|
|
|
- isAllSearch.value = false;
|
|
|
- },
|
|
|
- error => {
|
|
|
- Common.processException(error);
|
|
|
- },
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+// 根据分类ID查询折旧信息
|
|
|
+const categoriesSelected = key => {
|
|
|
+ searchParams.id = key[0];
|
|
|
+ searchChange(false);
|
|
|
};
|
|
|
|
|
|
// 获取的分页参数并查询
|
|
|
@@ -302,9 +321,24 @@ const getPageParams = (start, length) => {
|
|
|
getInfo();
|
|
|
};
|
|
|
|
|
|
+// 分页每页条数变化查询
|
|
|
+const showSizeChange = (_, size) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ current.value = 1;
|
|
|
+ searchParams.range.start = 0;
|
|
|
+ searchParams.range.length = size;
|
|
|
+ getInfo();
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
// 查询回到第一页
|
|
|
-const searchChange = debounce(() => {
|
|
|
- getPageParams(1, 20);
|
|
|
+const searchChange = debounce(isAll => {
|
|
|
+ if (isAll[0]) {
|
|
|
+ isAllSearch.value = true;
|
|
|
+ } else {
|
|
|
+ isAllSearch.value = false;
|
|
|
+ }
|
|
|
+ getPageParams(1, searchParams.range.length);
|
|
|
}, 500);
|
|
|
|
|
|
// 获取所选项的数据
|
|
|
@@ -329,16 +363,22 @@ const getCategories = () => {
|
|
|
|
|
|
// 根据分类名字查询信息
|
|
|
const getInfo = () => {
|
|
|
+ if (isAllSearch.value) {
|
|
|
+ searchParams.id = null;
|
|
|
+ } else {
|
|
|
+ searchParams.name = '';
|
|
|
+ }
|
|
|
isLoading.value = true;
|
|
|
const params = JSON.parse(JSON.stringify(searchParams));
|
|
|
queryByNameApi(params).then(
|
|
|
success => {
|
|
|
- if (success.dataList && success.dataList.length) {
|
|
|
+ if (success.dataList) {
|
|
|
dataSource.value = success.dataList;
|
|
|
+ } else {
|
|
|
+ dataSource.value = [];
|
|
|
}
|
|
|
infoTotal.value = success.totalSize;
|
|
|
isLoading.value = false;
|
|
|
- isAllSearch.value = true;
|
|
|
},
|
|
|
error => {
|
|
|
isLoading.value = false;
|
|
|
@@ -379,10 +419,33 @@ const updateExtractDepreciation = flag => {
|
|
|
message.success('设置不提折旧成功。');
|
|
|
}
|
|
|
clearDatas();
|
|
|
- if (isAllSearch.value) {
|
|
|
- searchChange();
|
|
|
+ if (!searchParams.id) {
|
|
|
+ searchChange(true);
|
|
|
} else {
|
|
|
- categoriesSelected();
|
|
|
+ searchChange(false);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ message.warning(success.errorMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ Common.processException(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 获取所有累计折旧会计科目
|
|
|
+const getSubjects = () => {
|
|
|
+ SqlApi.execute('20241120_175411').then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode == 0) {
|
|
|
+ if (success.results) {
|
|
|
+ success.results.forEach(item => {
|
|
|
+ item.label = `${item.name}-${item.no}`;
|
|
|
+ item.value = item.id;
|
|
|
+ });
|
|
|
+ subjects.value = success.results;
|
|
|
+ subject.value = success.results[0].id;
|
|
|
}
|
|
|
} else {
|
|
|
message.warning(success.errorMessage);
|
|
|
@@ -402,34 +465,40 @@ getCategories();
|
|
|
|
|
|
<style scoped>
|
|
|
.tree_box {
|
|
|
- height: 86vh;
|
|
|
- overflow: auto;
|
|
|
- border: 1px solid #dddddd;
|
|
|
- margin-right: 4px;
|
|
|
- border-bottom: none;
|
|
|
+ height: 86vh;
|
|
|
+ overflow: auto;
|
|
|
+ border: 1px solid #dddddd;
|
|
|
+ margin-right: 4px;
|
|
|
+ border-bottom: none;
|
|
|
}
|
|
|
|
|
|
.table_box {
|
|
|
- padding: 6px;
|
|
|
- border: 1px solid #dddddd;
|
|
|
- border-bottom: none;
|
|
|
+ padding: 6px;
|
|
|
+ border: 1px solid #dddddd;
|
|
|
+ border-bottom: none;
|
|
|
}
|
|
|
|
|
|
.operation_box {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
.ant-btn>span {
|
|
|
- color: #267fcf;
|
|
|
+ color: #267fcf;
|
|
|
}
|
|
|
|
|
|
.footer_box {
|
|
|
- background-color: #fafafa;
|
|
|
+ background-color: #fafafa;
|
|
|
}
|
|
|
-p{
|
|
|
- margin: 0 !important;
|
|
|
- padding: 0 !important;
|
|
|
+
|
|
|
+p {
|
|
|
+ margin: 0 !important;
|
|
|
+ padding: 0 !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.ant-form-item-label > label) {
|
|
|
+ font-size: 14px !important;
|
|
|
+ font-weight: 500 !important;
|
|
|
}
|
|
|
</style>
|