|
@@ -742,6 +742,22 @@ const formatExpenseAmount = (val: any): string => {
|
|
|
return String(val)
|
|
return String(val)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 手动添加一行月度费用(名称可编辑,随 contractForm.monthlyExpenses 一并保存/解析) */
|
|
|
|
|
+const addMonthlyExpense = () => {
|
|
|
|
|
+ contractForm.monthlyExpenses.push({
|
|
|
|
|
+ id: `manual-${Date.now()}`,
|
|
|
|
|
+ isManual: true,
|
|
|
|
|
+ itemName: '',
|
|
|
|
|
+ itemCategoryName: '',
|
|
|
|
|
+ actualAmount: ''
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 删除手动添加的月度费用行(仅 isManual 行提供删除入口) */
|
|
|
|
|
+const removeMonthlyExpense = (index: number) => {
|
|
|
|
|
+ contractForm.monthlyExpenses.splice(index, 1)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const isDepositFee = (item: any): boolean => {
|
|
const isDepositFee = (item: any): boolean => {
|
|
|
return (
|
|
return (
|
|
|
item.isDeposit === 1 ||
|
|
item.isDeposit === 1 ||
|
|
@@ -756,13 +772,16 @@ const numberToCircle = (num: number): string => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 费用项显示名称:类别名(项目名)
|
|
// 费用项显示名称:类别名(项目名)
|
|
|
|
|
+// 严谨优先级:类别与项目都存在且不同 → "类别(项目)¥";否则取二者非空者;都为空返回空串
|
|
|
|
|
+// (不能用 `category + '¥' || name + '¥'`,空类别时 `'' + '¥'` 为真值会吞掉项目名)
|
|
|
const displayExpenseName = (item: any): string => {
|
|
const displayExpenseName = (item: any): string => {
|
|
|
const category = item?.itemCategoryName || ''
|
|
const category = item?.itemCategoryName || ''
|
|
|
const name = item?.itemName || ''
|
|
const name = item?.itemName || ''
|
|
|
if (category && name && category !== name) {
|
|
if (category && name && category !== name) {
|
|
|
return `${category}(${name})¥`
|
|
return `${category}(${name})¥`
|
|
|
}
|
|
}
|
|
|
- return category + '¥' || name + '¥' || ''
|
|
|
|
|
|
|
+ const label = category || name
|
|
|
|
|
+ return label ? `${label}¥` : ''
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const bedList = ref<{ chargeName: string; id: string; price: number }[]>([])
|
|
const bedList = ref<{ chargeName: string; id: string; price: number }[]>([])
|
|
@@ -1392,15 +1411,46 @@ watch(
|
|
|
元/月。
|
|
元/月。
|
|
|
</p>
|
|
</p>
|
|
|
<p class="content-text"> 其中: </p>
|
|
<p class="content-text"> 其中: </p>
|
|
|
- <p v-for="item in monthlyExpensesList" :key="item.id" class="content-text">
|
|
|
|
|
- {{ item.itemCategoryName+'¥' || item.itemName+'¥' }}:
|
|
|
|
|
|
|
+ <p
|
|
|
|
|
+ v-for="(item, index) in monthlyExpensesList"
|
|
|
|
|
+ :key="item.id ?? 'manual-' + index"
|
|
|
|
|
+ class="content-text"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template v-if="item.isManual">
|
|
|
|
|
+ <FieldItem
|
|
|
|
|
+ v-model="item.itemName"
|
|
|
|
|
+ :is-text-mode="isTextMode"
|
|
|
|
|
+ width="140px"
|
|
|
|
|
+ placeholder="请输入费用名称"
|
|
|
|
|
+ no-underline
|
|
|
|
|
+ />¥:
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ {{ displayExpenseName(item) }}:
|
|
|
|
|
+ </template>
|
|
|
<FieldItem
|
|
<FieldItem
|
|
|
v-model="item.actualAmount"
|
|
v-model="item.actualAmount"
|
|
|
:is-text-mode="isTextMode"
|
|
:is-text-mode="isTextMode"
|
|
|
width="120px"
|
|
width="120px"
|
|
|
placeholder="0"
|
|
placeholder="0"
|
|
|
|
|
+ no-underline
|
|
|
/>
|
|
/>
|
|
|
元/月;
|
|
元/月;
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="item.isManual && !isTextMode"
|
|
|
|
|
+ link
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ class="expense-del"
|
|
|
|
|
+ @click="removeMonthlyExpense(index)"
|
|
|
|
|
+ >
|
|
|
|
|
+ 删除
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p v-if="!isTextMode" class="content-text">
|
|
|
|
|
+ <el-button link type="primary" size="small" @click="addMonthlyExpense">
|
|
|
|
|
+ + 添加费用
|
|
|
|
|
+ </el-button>
|
|
|
</p>
|
|
</p>
|
|
|
<p class="content-text"> 其他费用: </p>
|
|
<p class="content-text"> 其他费用: </p>
|
|
|
<p class="content-text">
|
|
<p class="content-text">
|
|
@@ -2636,6 +2686,12 @@ watch(
|
|
|
color: #333;
|
|
color: #333;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* 手动费用行的删除按钮:与正文保持对齐、留间距 */
|
|
|
|
|
+.expense-del {
|
|
|
|
|
+ margin-left: 6px;
|
|
|
|
|
+ vertical-align: middle;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/* 违约金百分比内联输入框:融入文档段落样式 */
|
|
/* 违约金百分比内联输入框:融入文档段落样式 */
|
|
|
.percent-input {
|
|
.percent-input {
|
|
|
width: 90px;
|
|
width: 90px;
|