|
|
|
@ -1,15 +1,20 @@
|
|
|
|
|
<!--
|
|
|
|
|
* @Description: 费用录入布局组件
|
|
|
|
|
* @Description: 费用录入应收组件
|
|
|
|
|
* @Author: lijj
|
|
|
|
|
* @Date: 2024-05-07 15:19:07
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<a-spin :spinning="loading">
|
|
|
|
|
<div class="cost-entry-receive">
|
|
|
|
|
<div class="flex">
|
|
|
|
|
<h2>应收</h2>
|
|
|
|
|
<h2>{{ tbType == 'receive' ? '应收' : '应付' }}</h2>
|
|
|
|
|
<ActionBar
|
|
|
|
|
:data="list"
|
|
|
|
|
:row="row"
|
|
|
|
|
@save="save"
|
|
|
|
|
@delete="deleteRow"
|
|
|
|
|
@cancel="cancelEdit"
|
|
|
|
|
@refresh="init"
|
|
|
|
|
></ActionBar>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
@ -17,6 +22,7 @@
|
|
|
|
|
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-spin>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { defineProps, ref, watch, watchEffect, computed, unref, defineComponent, onMounted, reactive, nextTick } from 'vue'
|
|
|
|
@ -24,17 +30,25 @@
|
|
|
|
|
import { GetFeeCurrencySelectList, GetFeeCodeSelectList } from '/@/api/common'
|
|
|
|
|
import { HotTable } from '@handsontable/vue3';
|
|
|
|
|
import { registerAllModules } from 'handsontable/registry';
|
|
|
|
|
defineComponent({
|
|
|
|
|
HotTable
|
|
|
|
|
})
|
|
|
|
|
import 'handsontable/dist/handsontable.full.min.css';
|
|
|
|
|
registerAllModules();
|
|
|
|
|
// 操作栏
|
|
|
|
|
import ActionBar from './actionBar.vue'
|
|
|
|
|
// import { columns } from './columns/receive'
|
|
|
|
|
// 引入计费标准字典
|
|
|
|
|
import { feeUnitDict } from '/@/hooks/dict/index'
|
|
|
|
|
import { GetFeeRecordList } from './api'
|
|
|
|
|
import { GetList, SubmitFee, DeleteFee } from './api'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
defineComponent({
|
|
|
|
|
HotTable
|
|
|
|
|
})
|
|
|
|
|
registerAllModules()
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
tbType: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 费用名称字典
|
|
|
|
|
const feeDict = ref([])
|
|
|
|
|
// 费用标准字典
|
|
|
|
@ -45,21 +59,28 @@
|
|
|
|
|
import { getDictOption } from '/@/utils/dictUtil'
|
|
|
|
|
// 表格插件
|
|
|
|
|
const hotTb = ref(null)
|
|
|
|
|
// loading
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
// 需要定义新增的行数据(后台需要)
|
|
|
|
|
const row = {
|
|
|
|
|
selected: false,
|
|
|
|
|
feeStatus: '1',
|
|
|
|
|
feeStatusText: '录入状态',
|
|
|
|
|
id: '',
|
|
|
|
|
businessId: '',
|
|
|
|
|
feeType: '',
|
|
|
|
|
feeCode: '',
|
|
|
|
|
feeName: '',
|
|
|
|
|
feeEnName: ''
|
|
|
|
|
}
|
|
|
|
|
// 表格绑定数据
|
|
|
|
|
const list = ref([])
|
|
|
|
|
// 表格编辑前初始数据
|
|
|
|
|
let oldData = []
|
|
|
|
|
// 全部勾选
|
|
|
|
|
const allCheck = ref(false)
|
|
|
|
|
// 部分勾选
|
|
|
|
|
const someCheck = ref(false)
|
|
|
|
|
const feeStatusList = ['审核通过', '录入状态', '提交审核', '申请修改', '申请删除', '撤销申请', '驳回提交', '驳回申请', '部分结算', '结算完毕']
|
|
|
|
|
// 定义表格所有列
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
@ -81,7 +102,7 @@
|
|
|
|
|
}, {
|
|
|
|
|
title: '费用状态',
|
|
|
|
|
width: 120,
|
|
|
|
|
data: 'feeStatus',
|
|
|
|
|
data: 'feeStatusText',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '应收费用名称',
|
|
|
|
@ -113,7 +134,7 @@
|
|
|
|
|
}, {
|
|
|
|
|
title: '客户类别',
|
|
|
|
|
width: 130,
|
|
|
|
|
data: 'customerTypeName',
|
|
|
|
|
data: 'customerTypeText',
|
|
|
|
|
type: 'dropdown',
|
|
|
|
|
source: async (query, process) => {
|
|
|
|
|
const results = await getDictOption('djy_cust_prop')
|
|
|
|
@ -125,7 +146,7 @@
|
|
|
|
|
}, {
|
|
|
|
|
title: '单位标准',
|
|
|
|
|
width: 130,
|
|
|
|
|
data: 'unitName',
|
|
|
|
|
data: 'unitText',
|
|
|
|
|
type: 'dropdown',
|
|
|
|
|
source: async (query, process) => {
|
|
|
|
|
if (unitDict.value && unitDict.value.length) {
|
|
|
|
@ -186,24 +207,112 @@
|
|
|
|
|
data: 'note'
|
|
|
|
|
}, {
|
|
|
|
|
title: '币别',
|
|
|
|
|
width: 120,
|
|
|
|
|
data: 'currencyName',
|
|
|
|
|
width: 80,
|
|
|
|
|
data: 'currency',
|
|
|
|
|
type: 'dropdown',
|
|
|
|
|
source: async (query, process) => {
|
|
|
|
|
if (currencyDict.value.length) {
|
|
|
|
|
const dict = currencyDict.value?.map(res => {
|
|
|
|
|
return res.name
|
|
|
|
|
})
|
|
|
|
|
process(dict)
|
|
|
|
|
process(currencyDict.value)
|
|
|
|
|
} else {
|
|
|
|
|
const results = await GetFeeCurrencySelectList()
|
|
|
|
|
const dict = results.data?.map(res => {
|
|
|
|
|
return res.name
|
|
|
|
|
return res.codeName
|
|
|
|
|
})
|
|
|
|
|
currencyDict.value = results.data
|
|
|
|
|
currencyDict.value = dict
|
|
|
|
|
process(dict)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
title: '销项税率',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'accTaxRate',
|
|
|
|
|
type: 'numeric'
|
|
|
|
|
}, {
|
|
|
|
|
title: '销项税额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'accTaxAmount',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '销项金额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'accAmount',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '是否机密',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'isOpen',
|
|
|
|
|
type: 'checkbox'
|
|
|
|
|
}, {
|
|
|
|
|
title: '是否垫付',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'isAdvancedPay',
|
|
|
|
|
type: 'checkbox'
|
|
|
|
|
}, {
|
|
|
|
|
title: '是否禁开发票',
|
|
|
|
|
width: 120,
|
|
|
|
|
data: 'isInvoice',
|
|
|
|
|
type: 'checkbox'
|
|
|
|
|
}, {
|
|
|
|
|
title: 'FRT',
|
|
|
|
|
width: 120,
|
|
|
|
|
data: 'feeFrt',
|
|
|
|
|
type: 'dropdown',
|
|
|
|
|
source: ['PP', 'CC']
|
|
|
|
|
}, {
|
|
|
|
|
title: '录入人',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'submitBy',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '录入日期',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'createTime',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '结算金额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'settlementAmount',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '已开票金额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'invoiceAmount',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '对账编号',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'debitNo',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '修改人',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'submitBy',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '修改日期',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'createTime',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '发票申请金额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'orderInvoiceAmount',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '未开票金额',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'debitNo',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '审核人',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'auditOperator',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '审核日期',
|
|
|
|
|
width: 100,
|
|
|
|
|
data: 'auditDate',
|
|
|
|
|
readOnly: true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
// 表格配置项
|
|
|
|
@ -248,16 +357,25 @@
|
|
|
|
|
})
|
|
|
|
|
if (item) dict = item[0]
|
|
|
|
|
list.value[res[0]]['feeEnName'] = dict['enName']
|
|
|
|
|
list.value[res[0]]['currency'] = dict['defaultCurrency']
|
|
|
|
|
list.value[res[0]]['unitText'] = dict['defaultUnitName']
|
|
|
|
|
list.value[res[0]]['unit'] = dict['defaultUnit']
|
|
|
|
|
list.value[res[0]]['customerTypeText'] = dict['defaultDebitName']
|
|
|
|
|
list.value[res[0]]['customerType'] = dict['defaultDebit']
|
|
|
|
|
list.value[res[0]]['isOpen'] = dict['isOpen']
|
|
|
|
|
list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay']
|
|
|
|
|
list.value[res[0]]['isInvoice'] = dict['isInvoice']
|
|
|
|
|
list.value[res[0]]['feeFrt'] = dict['feeFrt']
|
|
|
|
|
list.value[res[0]]['feeCode'] = dict['code']
|
|
|
|
|
list.value[res[0]]['taxRate'] = dict['taxRate']
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 修改费用英文名称
|
|
|
|
|
if (changes[0][1] === 'feeEnName') {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 修改客户类别
|
|
|
|
|
if (changes[0][1] === 'customerTypeName') {
|
|
|
|
|
if (changes[0][1] === 'customerTypeText') {
|
|
|
|
|
getDictOption('djy_cust_prop').then(res => {
|
|
|
|
|
const item = res.filter(item => {
|
|
|
|
|
return item.name === changes[0][3]
|
|
|
|
@ -267,7 +385,7 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 修改单位
|
|
|
|
|
if (changes[0][1] === 'unitName') {
|
|
|
|
|
if (changes[0][1] === 'unitText') {
|
|
|
|
|
const item = unitDict.value.filter(item => {
|
|
|
|
|
return item.name === changes[0][3]
|
|
|
|
|
})
|
|
|
|
@ -319,6 +437,93 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 保存
|
|
|
|
|
const save = () => {
|
|
|
|
|
const postData = {
|
|
|
|
|
BusinessId: '1780891904372772864',
|
|
|
|
|
items: list.value.filter(res => {
|
|
|
|
|
return res.feeStatus == 1
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
SubmitFee(postData).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
createMessage.success(res.message)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 取消编辑
|
|
|
|
|
const cancelEdit = () => {
|
|
|
|
|
const copy = JSON.parse(JSON.stringify(oldData))
|
|
|
|
|
list.value = copy
|
|
|
|
|
hotTb.value.hotInstance.loadData(copy)
|
|
|
|
|
}
|
|
|
|
|
// 删除行
|
|
|
|
|
const deleteRow = async () => {
|
|
|
|
|
const ids = []
|
|
|
|
|
list.value.forEach(item => {
|
|
|
|
|
if (item.selected && item.id) ids.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
if (ids.length) {
|
|
|
|
|
loading.value = true
|
|
|
|
|
const data = await DeleteFee({ ids })
|
|
|
|
|
loading.value = false
|
|
|
|
|
createMessage.success(data.message)
|
|
|
|
|
}
|
|
|
|
|
const res = list.value.filter(item => {
|
|
|
|
|
return !item.selected
|
|
|
|
|
})
|
|
|
|
|
list.value = res
|
|
|
|
|
hotTb.value.hotInstance.loadData(res)
|
|
|
|
|
}
|
|
|
|
|
// 页面初始化
|
|
|
|
|
const init = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
const postData = {
|
|
|
|
|
pageCondition: {
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
pageSize: 1000,
|
|
|
|
|
sortConditions: []
|
|
|
|
|
},
|
|
|
|
|
queryCondition: JSON.stringify([
|
|
|
|
|
{ FieldName: 'BusinessId', FieldValue: '1780891904372772864', ConditionalType: 1 },
|
|
|
|
|
{ FieldName: 'FeeType', FieldValue: props.tbType == 'receive' ? 1 : 2, ConditionalType: 1 }
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
GetList(postData).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
const { data } = res
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
item['feeStatusText'] = feeStatusList[item.feeStatus]
|
|
|
|
|
if (item.createTime) item.createTime = item.createTime.split(' ')[0]
|
|
|
|
|
if (item.auditDate) item.auditDate = item.auditDate.split(' ')[0]
|
|
|
|
|
})
|
|
|
|
|
list.value = data
|
|
|
|
|
// 设置原始数据,取消使用
|
|
|
|
|
oldData = JSON.parse(JSON.stringify(data))
|
|
|
|
|
if (data.length != 0) {
|
|
|
|
|
hotTb.value.hotInstance.updateSettings({
|
|
|
|
|
cells: function(row, col) {
|
|
|
|
|
// 设置费用状态不是录入状态的行为只读
|
|
|
|
|
const props = { readOnly: true }
|
|
|
|
|
if (data[row]?.feeStatus != 1 && col != 0) {
|
|
|
|
|
// 配置不同状态的行颜色
|
|
|
|
|
if (data[row]?.feeStatus == 0) {
|
|
|
|
|
props['className'] = 'hot-green'
|
|
|
|
|
}
|
|
|
|
|
return props
|
|
|
|
|
} else {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
hotTb.value.hotInstance.loadData(data)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
const hot = hotTb.value.hotInstance
|
|
|
|
|
// 定义表格按键处理逻辑
|
|
|
|
@ -334,6 +539,8 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 数据初始化
|
|
|
|
|
init()
|
|
|
|
|
})
|
|
|
|
|
watchEffect(() => {
|
|
|
|
|
// 全选
|
|
|
|
@ -384,6 +591,9 @@
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
.hot-green {
|
|
|
|
|
background: #9ACD32;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.handsontableInput {
|
|
|
|
|
line-height: 30px;
|