-
+
-
费用明细
+ 费用明细
@@ -111,13 +118,10 @@
const visible = ref(false)
// 费用信息已选项
const state = reactive({
- historyRowKeys: ['1780891904372772864']
+ historyRowKeys: []
})
// 费用表格数据
const feeData = ref([])
- const afterOpenChange = () => {
-
- }
const init = () => {
visible.value = true
}
@@ -127,7 +131,13 @@
const feeTabel = ref(null)
// 确定引入数据
const handleOk = () => {
- emits('submit', feeTabel.value.list)
+ let data = []
+ if (feeTabel.value.list.length) {
+ data = feeTabel.value.list
+ } else {
+ data = feeTabel.value.feeData
+ }
+ emits('submit', data)
}
const historyChange = (v) => {
if (v.length == 1) {
@@ -136,8 +146,19 @@
state.historyRowKeys = [v[v.length - 1]]
}
}
+ // 行点击事件
+ const onRowClick = (record, index) => {
+ // 更新选中状态
+ const newSelectedRowKeys = [...state.historyRowKeys];
+ if (newSelectedRowKeys.includes(record.id)) {
+ newSelectedRowKeys.splice(newSelectedRowKeys.indexOf(record.id), 1);
+ } else {
+ newSelectedRowKeys.push(record.id);
+ }
+ state.historyRowKeys = newSelectedRowKeys
+ }
watch(() => state.historyRowKeys, (v) => {
- feeTabel.value.init(v, 'history')
+ if (v.length == 1) feeTabel.value.init(v, 'history')
})
defineExpose({
init,
@@ -146,7 +167,7 @@
\ No newline at end of file
diff --git a/src/components/CostEntry/feeTable.vue b/src/components/CostEntry/feeTable.vue
index 434646ef..022239cf 100644
--- a/src/components/CostEntry/feeTable.vue
+++ b/src/components/CostEntry/feeTable.vue
@@ -18,6 +18,8 @@
@refresh="init"
@history="history"
@selectInsert="selectInsert"
+ @revoke="revoke"
+ @submit="submit"
>
@@ -31,15 +33,15 @@
import { defineProps, defineEmits, ref, watch, watchEffect, computed, unref, defineComponent, onMounted, reactive, nextTick, provide } from 'vue'
// 下拉框数据接口
import { GetFeeCurrencySelectList, GetFeeCodeSelectList } from '/@/api/common'
- import { HotTable } from '@handsontable/vue3';
- import { registerAllModules } from 'handsontable/registry';
- import 'handsontable/dist/handsontable.full.min.css';
+ import { HotTable } from '@handsontable/vue3'
+ import { registerAllModules } from 'handsontable/registry'
+ import 'handsontable/dist/handsontable.full.min.css'
// 操作栏
import ActionBar from './actionBar.vue'
import { feeStatusList } from './columns'
// 引入计费标准字典
import { feeUnitDict } from '/@/hooks/dict/index'
- import { GetList, SubmitFee, DeleteFee } from './api'
+ import { GetList, SubmitFee, DeleteFee, ApplyAudit, Withdraw } from './api'
import { useMessage } from '/@/hooks/web/useMessage'
const { createMessage } = useMessage()
defineComponent({
@@ -83,6 +85,7 @@
feeCode: '',
feeName: '',
feeEnName: '',
+ quantity: 1,
feeType: props.tbType == 'receive' ? 1 : 2
}
// 表格绑定数据
@@ -274,7 +277,7 @@
}, {
title: '录入人',
width: 100,
- data: 'submitBy',
+ data: 'createByName',
readOnly: true
}, {
title: '录入日期',
@@ -299,12 +302,12 @@
}, {
title: '修改人',
width: 100,
- data: 'submitBy',
+ data: 'updateByName',
readOnly: true
}, {
title: '修改日期',
width: 100,
- data: 'createTime',
+ data: 'updateTime',
readOnly: true
}, {
title: '发票申请金额',
@@ -339,7 +342,7 @@
fixedColumnsLeft: 1,
// 需要隐藏的列
hiddenColumns: {
- columns: [1],
+ columns: [1, 2],
indicators: true
},
// 控制回车移动
@@ -469,11 +472,58 @@
loading.value = true
SubmitFee(postData).then(res => {
loading.value = false
+ init()
createMessage.success(res.message)
}).catch(() => {
loading.value = false
})
}
+ // 提交审核
+ const submit = (arr) => {
+ loading.value = true
+ const ids = []
+ arr.forEach(res => {
+ if (res.id) ids.push(res.id)
+ })
+ if (ids.length == arr.length) {
+ ApplyAudit({ id: '', ids }).then(res => {
+ loading.value = false
+ createMessage.success(res.message)
+ init()
+ }).catch(() => {
+ loading.value = false
+ })
+ } else {
+ const postData = {
+ BusinessId: '1780891904372772864',
+ items: arr
+ }
+ SubmitFee(postData).then(res => {
+ const { data } = res
+ const ids = data.map(item => {
+ return item.id
+ })
+ ApplyAudit({ ids }).then(res => {
+ loading.value = false
+ createMessage.success(res.message)
+ init()
+ }).catch(() => {
+ loading.value = false
+ })
+ })
+ }
+ }
+ // 撤销提交
+ const revoke = (ids) => {
+ loading.value = true
+ Withdraw(ids).then(res => {
+ loading.value = false
+ createMessage.success(res.message)
+ init()
+ }).catch(() => {
+ loading.value = false
+ })
+ }
// 取消编辑
const cancelEdit = () => {
const copy = JSON.parse(JSON.stringify(oldData))
@@ -554,6 +604,7 @@
item['feeStatusText'] = feeStatusList[item.feeStatus]
if (item.createTime) item.createTime = item.createTime.split(' ')[0]
if (item.auditDate) item.auditDate = item.auditDate.split(' ')[0]
+ if (item.updateTime) item.updateTime = item.updateTime.split(' ')[0]
})
list.value = data
// 设置原始数据,取消使用
@@ -563,11 +614,24 @@
cells: function(row, col) {
// 设置费用状态不是录入状态的行为只读
const props = { readOnly: true }
+ // 审核通过(STATUS=0)
+ // 录入状态(STATUS=1)
+ // 提交审核(STATUS=2)
+ // 申请修改 (STATUS=3)
+ // 申请删除 (STATUS=4)
+ // 撤销申请 (STATUS=5)
+ // 驳回提交(STATUS=6)
+ // 驳回申请(STATUS=7)
+ // 部分结算(STATUS=8)
+ // 结算完毕(STATUS=9)
if (data[row]?.feeStatus != 1 && col != 0) {
// 配置不同状态的行颜色
if (data[row]?.feeStatus == 0) {
props['className'] = 'hot-green'
}
+ if (data[row]?.feeStatus == 2) {
+ props['className'] = 'hot-yellow'
+ }
return props
} else {
return
@@ -586,7 +650,7 @@
hot.addHook('beforeKeyDown', function(event) {
// 检查按下的是否是特定的键(例如 'Enter')
if (event.key === 'ArrowDown') {
- if (hot.getSelected()[0][0] == list.value.length - 1) {
+ if (hot.getSelected()[0][0] == list.value.length - 1 && !hot.getActiveEditor()?._opened) {
list.value.push(JSON.parse(JSON.stringify(row)))
nextTick(() => {
hot.selectCell(list.value.length - 1, 3)
@@ -653,6 +717,14 @@
.hot-green {
background: #9ACD32;
}
+ .hot-yellow {
+ background: #FFE37E;
+ }
+ .hot-green, .hot-yellow {
+ .htAutocompleteArrow {
+ display: none;
+ }
+ }
}
.handsontableInput {
line-height: 30px;
diff --git a/src/views/fee/template/components/feeField.vue b/src/views/fee/template/components/feeField.vue
index 76f6122e..e4996568 100644
--- a/src/views/fee/template/components/feeField.vue
+++ b/src/views/fee/template/components/feeField.vue
@@ -386,7 +386,7 @@
hot.addHook('beforeKeyDown', function(event) {
// 检查按下的是否是特定的键(例如 'Enter')
if (event.key === 'ArrowDown') {
- if (hot.getSelected()[0][0] == list.value.length - 1) {
+ if (hot.getSelected()[0][0] == list.value.length - 1 && !hot.getActiveEditor()?._opened) {
list.value.push(JSON.parse(JSON.stringify(row)))
nextTick(() => {
hot.selectCell(list.value.length - 1, 3)