|
|
@ -9,15 +9,22 @@
|
|
|
|
<h2>费用字段</h2>
|
|
|
|
<h2>费用字段</h2>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<a-button type="primary" @click="addRow">添加</a-button>
|
|
|
|
<a-button type="primary" @click="addRow">添加</a-button>
|
|
|
|
<a-button class="ml10" type="error" @click="deleteRow">删除</a-button>
|
|
|
|
<a-popconfirm
|
|
|
|
|
|
|
|
title="确定删除当前选中的费用字段?"
|
|
|
|
|
|
|
|
ok-text="是"
|
|
|
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
|
|
|
@confirm="deleteRow"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-button class="ml10" type="error">删除</a-button>
|
|
|
|
|
|
|
|
</a-popconfirm>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<BasicTable :rowSelection="{ type: 'checkbox' }" @register="registerTable">
|
|
|
|
<BasicTable :rowSelection="{ type: 'checkbox' }" :clickToRowSelect="false" @register="registerTable">
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
<!-- 费用名称 -->
|
|
|
|
<!-- 费用名称 -->
|
|
|
|
<a-select
|
|
|
|
<a-select
|
|
|
|
v-if="column.key === 'name'"
|
|
|
|
v-if="column.key === 'feeName'"
|
|
|
|
v-model:value="record.name"
|
|
|
|
v-model:value="record.feeCode"
|
|
|
|
placeholder="请选择"
|
|
|
|
placeholder="请选择"
|
|
|
|
@change="feeNameChange($event, record)"
|
|
|
|
@change="feeNameChange($event, record)"
|
|
|
|
>
|
|
|
|
>
|
|
|
@ -30,7 +37,7 @@
|
|
|
|
</a-select-option>
|
|
|
|
</a-select-option>
|
|
|
|
</a-select>
|
|
|
|
</a-select>
|
|
|
|
<!-- 费用英文名称 -->
|
|
|
|
<!-- 费用英文名称 -->
|
|
|
|
<a-input v-else-if="column.key === 'enName'" v-model:value="record.enName" placeholder="请输入" />
|
|
|
|
<a-input v-else-if="column.key === 'feeEnName'" v-model:value="record.feeEnName" placeholder="请输入" />
|
|
|
|
<!-- 结算对象类型 -->
|
|
|
|
<!-- 结算对象类型 -->
|
|
|
|
<a-select
|
|
|
|
<a-select
|
|
|
|
v-else-if="column.key === 'customerType'"
|
|
|
|
v-else-if="column.key === 'customerType'"
|
|
|
@ -94,15 +101,16 @@
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'unitPrice'"
|
|
|
|
v-else-if="column.key === 'unitPrice'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.unitPrice"
|
|
|
|
v-model:value="record.unitPrice"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
|
|
|
|
@blur="calcAmount(record, 'price')"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- 汇率 -->
|
|
|
|
<!-- 汇率 -->
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'exchangeRate'"
|
|
|
|
v-else-if="column.key === 'exchangeRate'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.exchangeRate"
|
|
|
|
v-model:value="record.exchangeRate"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -110,23 +118,26 @@
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'taxRate'"
|
|
|
|
v-else-if="column.key === 'taxRate'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.taxRate"
|
|
|
|
v-model:value="record.taxRate"
|
|
|
|
|
|
|
|
@blur="calcAmount(record, 'tax')"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
|
|
|
|
:max="100"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- 含税单价 -->
|
|
|
|
<!-- 含税单价 -->
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'taxUnitPrice'"
|
|
|
|
v-else-if="column.key === 'taxUnitPrice'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.taxUnitPrice"
|
|
|
|
v-model:value="record.taxUnitPrice"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
|
|
|
|
@blur="calcAmount(record, 'taxPrice')"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- 税额 -->
|
|
|
|
<!-- 税额 -->
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'tax'"
|
|
|
|
v-else-if="column.key === 'tax'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.tax"
|
|
|
|
v-model:value="record.tax"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -134,7 +145,7 @@
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'accTaxRate'"
|
|
|
|
v-else-if="column.key === 'accTaxRate'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.accTaxRate"
|
|
|
|
v-model:value="record.accTaxRate"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="2"
|
|
|
|
:precision="2"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -153,15 +164,15 @@
|
|
|
|
<a-input-number
|
|
|
|
<a-input-number
|
|
|
|
v-else-if="column.key === 'orderNo'"
|
|
|
|
v-else-if="column.key === 'orderNo'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.orderNo"
|
|
|
|
v-model:value="record.orderNo"
|
|
|
|
:min="0"
|
|
|
|
:min="0"
|
|
|
|
:precision="0"
|
|
|
|
:precision="0"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- 备注 -->
|
|
|
|
<!-- 备注 -->
|
|
|
|
<a-input-number
|
|
|
|
<a-input
|
|
|
|
v-else-if="column.key === 'note'"
|
|
|
|
v-else-if="column.key === 'note'"
|
|
|
|
placeholder="请输入"
|
|
|
|
placeholder="请输入"
|
|
|
|
v-model:value="column.note"
|
|
|
|
v-model:value="record.note"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- 费用分组 -->
|
|
|
|
<!-- 费用分组 -->
|
|
|
|
<a-select
|
|
|
|
<a-select
|
|
|
@ -182,26 +193,62 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
|
import { ref, onMounted, defineProps, watch } from 'vue'
|
|
|
|
// 下拉框数据接口
|
|
|
|
// 下拉框数据接口
|
|
|
|
import { GetFeeCodeSelectList, GetClientListByCode, GetFeeCurrencySelectList } from '/@/api/common'
|
|
|
|
import { GetFeeCodeSelectList, GetClientListByCode, GetFeeCurrencySelectList } from '/@/api/common'
|
|
|
|
|
|
|
|
import { GetFeeTemplateDetailList, BatchDelFeeTemplateDetail } from '../api'
|
|
|
|
// 引入字典数据
|
|
|
|
// 引入字典数据
|
|
|
|
import { getDictOption } from '/@/utils/dictUtil'
|
|
|
|
import { getDictOption } from '/@/utils/dictUtil'
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
|
|
|
import { BasicTable, useTable } from '/@/components/Table'
|
|
|
|
const [registerTable, { reload, setTableData, getDataSource, insertTableDataRecord, getSelectRowKeys, deleteTableDataRecord, getPaginationRef, getSelectRows }] = useTable({
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
api: async () => {
|
|
|
|
const { createMessage, notification } = useMessage()
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
const props = defineProps({
|
|
|
|
resolve({ data: [{ name: '测试', enName: '' }] })
|
|
|
|
id: {
|
|
|
|
|
|
|
|
type: String
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const [registerTable, { reload, setShowPagination, getDataSource, insertTableDataRecord, deleteTableDataRecord, getPaginationRef, getSelectRows }] = useTable({
|
|
|
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
|
|
|
setShowPagination(false)
|
|
|
|
|
|
|
|
if (props.id) {
|
|
|
|
|
|
|
|
const res: API.DataResult = await GetFeeTemplateDetailList(p)
|
|
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
|
|
resolve({ data: [...res.data], total: res.count })
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
|
|
resolve({ data: [] })
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
immediate: false,
|
|
|
|
|
|
|
|
beforeFetch: () => {
|
|
|
|
|
|
|
|
var currentPageInfo: any = getPaginationRef()
|
|
|
|
|
|
|
|
const postParam: API.PageRequest = {
|
|
|
|
|
|
|
|
queryCondition: '',
|
|
|
|
|
|
|
|
pageCondition: {
|
|
|
|
|
|
|
|
pageIndex: currentPageInfo.current,
|
|
|
|
|
|
|
|
pageSize: 100,
|
|
|
|
|
|
|
|
sortConditions: [],
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let condition: API.ConditionItem[] = []
|
|
|
|
|
|
|
|
condition.push({
|
|
|
|
|
|
|
|
FieldName: 'TemplateId',
|
|
|
|
|
|
|
|
FieldValue: props.id,
|
|
|
|
|
|
|
|
ConditionalType: 1,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
postParam.queryCondition = JSON.stringify(condition)
|
|
|
|
|
|
|
|
return postParam
|
|
|
|
},
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '费用名称',
|
|
|
|
title: '费用名称',
|
|
|
|
dataIndex: 'name',
|
|
|
|
dataIndex: 'feeName',
|
|
|
|
width: 120
|
|
|
|
width: 120
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
title: '费用英文名称',
|
|
|
|
title: '费用英文名称',
|
|
|
|
dataIndex: 'enName',
|
|
|
|
dataIndex: 'feeEnName',
|
|
|
|
width: 120
|
|
|
|
width: 120
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
title: '结算对象类型',
|
|
|
|
title: '结算对象类型',
|
|
|
@ -232,7 +279,7 @@
|
|
|
|
dataIndex: 'exchangeRate',
|
|
|
|
dataIndex: 'exchangeRate',
|
|
|
|
width: 120
|
|
|
|
width: 120
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
title: '税率',
|
|
|
|
title: '税率(%)',
|
|
|
|
dataIndex: 'taxRate',
|
|
|
|
dataIndex: 'taxRate',
|
|
|
|
width: 120
|
|
|
|
width: 120
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
@ -293,6 +340,11 @@
|
|
|
|
// 初始化方法
|
|
|
|
// 初始化方法
|
|
|
|
init()
|
|
|
|
init()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
watch(() => props.id,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
reload()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
// 页面初始化
|
|
|
|
// 页面初始化
|
|
|
|
const init = async () => {
|
|
|
|
const init = async () => {
|
|
|
|
const list = await GetFeeCodeSelectList()
|
|
|
|
const list = await GetFeeCodeSelectList()
|
|
|
@ -308,7 +360,7 @@
|
|
|
|
const res = feeNameDict.value.filter(item => {
|
|
|
|
const res = feeNameDict.value.filter(item => {
|
|
|
|
return item.code == e
|
|
|
|
return item.code == e
|
|
|
|
})[0]
|
|
|
|
})[0]
|
|
|
|
record.enName = res.enName || ''
|
|
|
|
record.feeEnName = res.enName || ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 计算单位字典
|
|
|
|
// 计算单位字典
|
|
|
|
const companyDict = ref([])
|
|
|
|
const companyDict = ref([])
|
|
|
@ -326,14 +378,65 @@
|
|
|
|
// 添加行
|
|
|
|
// 添加行
|
|
|
|
const addRow = () => {
|
|
|
|
const addRow = () => {
|
|
|
|
insertTableDataRecord({
|
|
|
|
insertTableDataRecord({
|
|
|
|
key: new Date().getTime()
|
|
|
|
key: new Date().getTime(),
|
|
|
|
|
|
|
|
feeFrt: '',
|
|
|
|
|
|
|
|
unit: '',
|
|
|
|
|
|
|
|
feeCode: '',
|
|
|
|
|
|
|
|
feeName: '',
|
|
|
|
|
|
|
|
currency: '',
|
|
|
|
|
|
|
|
feeGroup: '',
|
|
|
|
|
|
|
|
feeEnName: '',
|
|
|
|
|
|
|
|
customerName: '',
|
|
|
|
|
|
|
|
customerType: ''
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 删除行
|
|
|
|
// 删除行
|
|
|
|
const deleteRow = () => {
|
|
|
|
const deleteRow = () => {
|
|
|
|
const keys = getSelectRowKeys()
|
|
|
|
const rows = getSelectRows()
|
|
|
|
|
|
|
|
if (rows.length === 0) {
|
|
|
|
|
|
|
|
notification.error({ message: '请选择要删除的费用字段', duration: 3 })
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 走接口删除的数据
|
|
|
|
|
|
|
|
let apiId = []
|
|
|
|
|
|
|
|
// 不走接口删除的数据
|
|
|
|
|
|
|
|
let keys = []
|
|
|
|
|
|
|
|
rows.forEach(item => {
|
|
|
|
|
|
|
|
if (item.id) {
|
|
|
|
|
|
|
|
apiId.push(item.id)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
keys.push(item.key)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
// 删除没id的数据
|
|
|
|
deleteTableDataRecord(keys)
|
|
|
|
deleteTableDataRecord(keys)
|
|
|
|
|
|
|
|
// 通过id删除数据
|
|
|
|
|
|
|
|
BatchDelFeeTemplateDetail({ ids: apiId, id: '' }).then(res => {
|
|
|
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
createMessage.success(res.message)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
createMessage.error(res.message)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 计算金额
|
|
|
|
|
|
|
|
const calcAmount = (row, key) => {
|
|
|
|
|
|
|
|
if (key === 'tax' || key === 'taxPrice') {
|
|
|
|
|
|
|
|
// 通过税率计或含税单价算不含税单价(不含税单价 = 含税单价 ÷ (1 + 税率))
|
|
|
|
|
|
|
|
row.unitPrice = (row.taxUnitPrice / (Number(row.taxRate / 100 ) + 1))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 通过不含税单价计算含税单价(含税价 = 不含税价*(1 + 税率))
|
|
|
|
|
|
|
|
row.taxUnitPrice = row.unitPrice || 0 * (1 + Number(row.taxRate || 0 / 100))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const validate = () => {
|
|
|
|
|
|
|
|
return getDataSource()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 导出接口
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
|
|
validate
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
<style lang="scss">
|
|
|
|