Files
tms-erp-web/src/views/settlement/formal-settlement-form.vue
T

98 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<basic-container class="formal-settlement-form-page">
<div class="formal-settlement-form-page__title">{{ pageTitle }}</div>
<!-- 新增来源明细可直接调整计费试算走独立接口调整结果先暂存保存正式结算单时再落库 -->
<formal-settlement-editor
v-model="editorVisible"
page-mode
:record-id="recordId"
:readonly="readonly"
:initial-data="editorInitialData"
/>
</basic-container>
</template>
<script>
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
export default {
name: 'FormalSettlementForm',
components: { FormalSettlementEditor },
data() {
return {
editorVisible: true,
transferPayload: null,
};
},
computed: {
recordId() {
return this.$route.query.id || '';
},
readonly() {
return this.$route.query.mode === 'view';
},
pageTitle() {
return this.readonly ? '查看正式结算' : this.recordId ? '编辑正式结算' : '新增正式结算';
},
editorInitialData() {
const settlementType = this.$route.query.settlementType;
if (!this.transferPayload && !settlementType) return null;
return {
...(this.transferPayload || {}),
...(settlementType ? { settlementType } : {}),
};
},
},
watch: {
editorVisible(value) {
if (!value) this.goBack();
},
},
created() {
this.transferPayload = readSettlementTransfer(this.$route.query.transferToken);
this.syncTagTitle();
},
methods: {
goBack() {
removeSettlementTransfer(this.$route.query.transferToken);
this.$router.push('/settlement/formal-settlement');
},
syncTagTitle() {
this.$nextTick(() => {
this.$store.commit('SET_TAG', {
fullPath: this.$route.fullPath,
name: this.pageTitle,
});
this.$router.$avueRouter.setTitle(this.pageTitle);
});
},
},
};
</script>
<style lang="scss" scoped>
.formal-settlement-form-page {
&__title {
display: flex;
align-items: center;
min-height: 24px;
margin-bottom: 16px;
font-size: 18px;
font-weight: 600;
&::before {
width: 4px;
height: 20px;
margin-right: 8px;
background: #409eff;
content: '';
}
}
}
:deep(.formal-settlement-form-page.basic-container .basic-container__card > .el-card__body) {
padding: 0;
}
</style>