|
@@ -1,20 +1,14 @@
|
|
|
<script setup lang="ts">
|
|
|
import AForm from '@/components/AForm/index.vue'
|
|
|
-import { FormConfigType } from '@/components/AForm/type'
|
|
|
-import { ToolbarConfigType } from '@/components/AToolbar/type'
|
|
|
-import { ColumnConfigType } from '@/components/ATable/type'
|
|
|
-import { StrAnyObj, StrAnyObjArr } from '@/typings'
|
|
|
-import { useHandleData } from '@/utils/useHandleData'
|
|
|
-import {
|
|
|
- getPageApi,
|
|
|
- getDetailApi,
|
|
|
- addApi,
|
|
|
- editApi,
|
|
|
- deleteApi
|
|
|
-} from '@/api/business/payment/requests'
|
|
|
-import { getPageApi as getCorporationPageApi } from '@/api/business/corporation/corporation'
|
|
|
+import {FormConfigType} from '@/components/AForm/type'
|
|
|
+import {ToolbarConfigType} from '@/components/AToolbar/type'
|
|
|
+import {ColumnConfigType} from '@/components/ATable/type'
|
|
|
+import {StrAnyObj, StrAnyObjArr} from '@/typings'
|
|
|
+import {useHandleData} from '@/utils/useHandleData'
|
|
|
+import {addApi, deleteApi, editApi, getDetailApi, getPageApi} from '@/api/business/payment/requests'
|
|
|
+import {getPageApi as getCorporationPageApi} from '@/api/business/corporation/corporation'
|
|
|
import DeptTreeSelect from '@/views/components/DeptTreeSelect/index.vue'
|
|
|
-import { getPageApi as getCapitalAccountPageApi } from '@/api/business/capital/account'
|
|
|
+import {getPageApi as getCapitalAccountPageApi} from '@/api/business/capital/account'
|
|
|
import FileUpload from '@/components/FlieUpload/index.vue'
|
|
|
|
|
|
const queryRef = ref<InstanceType<typeof AForm>>()
|
|
@@ -24,9 +18,9 @@ const showQuery = ref<boolean>(true)
|
|
|
const selectKeys = ref<string[]>([])
|
|
|
const pageTotal = ref<number>(0)
|
|
|
|
|
|
-const queryData = ref<StrAnyObj>({ pageNum: 1, pageSize: 10 })
|
|
|
+const queryData = ref<StrAnyObj>({pageNum: 1, pageSize: 10})
|
|
|
const tableData = ref<StrAnyObjArr>([])
|
|
|
-const formData = ref<StrAnyObj>({ paymentRequestsDetailList: [{}] })
|
|
|
+const formData = ref<StrAnyObj>({paymentRequestsDetailList: [{}]})
|
|
|
|
|
|
const dialogTitle = ref<string>('')
|
|
|
const dialogVisible = ref<boolean>(false)
|
|
@@ -128,15 +122,6 @@ const toolbarConfig: ToolbarConfigType[] = [
|
|
|
dialogTitle.value = '新增'
|
|
|
nextTick(() => deptIdRef.value?.load())
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- common: 'delete',
|
|
|
- disabled() {
|
|
|
- return selectKeys.value.length == 0
|
|
|
- },
|
|
|
- click() {
|
|
|
- handleRemove(selectKeys.value)
|
|
|
- }
|
|
|
}
|
|
|
]
|
|
|
|
|
@@ -186,31 +171,48 @@ const columnConfig: ColumnConfigType[] = [
|
|
|
},
|
|
|
{
|
|
|
prop: 'approvalStatus',
|
|
|
- label: '审批状态'
|
|
|
+ label: '审批状态',
|
|
|
+ formatter(row) {
|
|
|
+ switch (row.approvalStatus) {
|
|
|
+ case 0:
|
|
|
+ return '待发起'
|
|
|
+ case 1:
|
|
|
+ return '进行中'
|
|
|
+ case 2:
|
|
|
+ return '已通过'
|
|
|
+ case 3:
|
|
|
+ return '已驳回'
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
prop: 'paymentStatus',
|
|
|
- label: '放款状态'
|
|
|
+ label: '放款状态',
|
|
|
+ formatter(row) {
|
|
|
+ switch (row.paymentStatus) {
|
|
|
+ case 0:
|
|
|
+ return '未放款'
|
|
|
+ case 1:
|
|
|
+ return '已放款'
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
width: 250,
|
|
|
handleConfig: [
|
|
|
{
|
|
|
- common: 'update',
|
|
|
+ text: '重新发起',
|
|
|
+ if(row) {
|
|
|
+ return row.approvalStatus == 0
|
|
|
+ },
|
|
|
click(row) {
|
|
|
dialogVisible.value = true
|
|
|
dialogTitle.value = '编辑'
|
|
|
- getDetailApi({ id: row.id }).then((resp: StrAnyObj) => {
|
|
|
+ getDetailApi({id: row.id}).then((resp: StrAnyObj) => {
|
|
|
formData.value = resp
|
|
|
})
|
|
|
nextTick(() => deptIdRef.value?.load())
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- common: 'delete',
|
|
|
- click(row) {
|
|
|
- handleRemove([row.id])
|
|
|
- }
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -224,23 +226,23 @@ const formConfig: FormConfigType[] = [
|
|
|
keyName: 'id',
|
|
|
labelName: 'name',
|
|
|
async option() {
|
|
|
- const data = await getCorporationPageApi({ searchAll: true })
|
|
|
+ const data = await getCorporationPageApi({searchAll: true})
|
|
|
return data.records
|
|
|
},
|
|
|
- rule: [{ required: true, message: '归属公司id不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{required: true, message: '归属公司id不能为空', trigger: 'blur'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'slot',
|
|
|
prop: 'deptId',
|
|
|
label: '归属部门',
|
|
|
- rule: [{ required: true, message: '部门id不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{required: true, message: '部门id不能为空', trigger: 'blur'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
|
prop: 'type',
|
|
|
label: '请款类型',
|
|
|
dict: 'payment_requests_type',
|
|
|
- rule: [{ required: true, message: '请款类型不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{required: true, message: '请款类型不能为空', trigger: 'blur'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'datePicker',
|
|
@@ -285,14 +287,14 @@ const formConfig: FormConfigType[] = [
|
|
|
label: '单据数量',
|
|
|
min: 0,
|
|
|
precision: 0,
|
|
|
- rule: [{ required: true, message: '单据数量不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{required: true, message: '单据数量不能为空', trigger: 'blur'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
|
prop: 'payType',
|
|
|
label: '付款方式',
|
|
|
dict: 'pay_type',
|
|
|
- rule: [{ required: true, message: '付款方式不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{required: true, message: '付款方式不能为空', trigger: 'blur'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
@@ -301,7 +303,7 @@ const formConfig: FormConfigType[] = [
|
|
|
keyName: 'id',
|
|
|
labelName: 'accountAlias',
|
|
|
async option() {
|
|
|
- const data = await getCapitalAccountPageApi({ searchAll: true })
|
|
|
+ const data = await getCapitalAccountPageApi({searchAll: true})
|
|
|
return data.records
|
|
|
}
|
|
|
},
|
|
@@ -412,7 +414,7 @@ function formClosed() {
|
|
|
|
|
|
function handleRemove(idList: string[]) {
|
|
|
useHandleData('是否确认删除?', () => {
|
|
|
- deleteApi({ idList }).then(() => {
|
|
|
+ deleteApi({idList}).then(() => {
|
|
|
ElMessage.success('删除成功')
|
|
|
getPage()
|
|
|
})
|
|
@@ -425,86 +427,86 @@ function addPaymentRequestsDetailList() {
|
|
|
|
|
|
function updateDetailRemark() {
|
|
|
formData.value.useRemark = formData.value.paymentRequestsDetailList
|
|
|
- .map((item) => item.remark)
|
|
|
- .filter((item) => item !== '' && item !== null && item !== undefined)
|
|
|
- .join(' - \n')
|
|
|
+ .map((item) => item.remark)
|
|
|
+ .filter((item) => item !== '' && item !== null && item !== undefined)
|
|
|
+ .join(' - \n')
|
|
|
}
|
|
|
|
|
|
function updateAmount() {
|
|
|
formData.value.totalAmount = formData.value.paymentRequestsDetailList
|
|
|
- .map((item) => item.amount)
|
|
|
- .filter((item) => item !== '' && item !== null && item !== undefined)
|
|
|
- .reduce((pre, next) => pre + next, 0)
|
|
|
+ .map((item) => item.amount)
|
|
|
+ .filter((item) => item !== '' && item !== null && item !== undefined)
|
|
|
+ .reduce((pre, next) => pre + next, 0)
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-card v-if="showQuery">
|
|
|
- <a-form ref="queryRef" v-model="queryData" :config="queryConfig" :span="6"> </a-form>
|
|
|
+ <a-form ref="queryRef" v-model="queryData" :config="queryConfig" :span="6"></a-form>
|
|
|
</el-card>
|
|
|
|
|
|
<a-table
|
|
|
- selection
|
|
|
- :data="tableData"
|
|
|
- :page-total="pageTotal"
|
|
|
- :toolbar-config="toolbarConfig"
|
|
|
- :column-config="columnConfig"
|
|
|
- v-model:showQuery="showQuery"
|
|
|
- v-model:page-num="queryData.pageNum"
|
|
|
- v-model:page-size="queryData.pageSize"
|
|
|
- @page-num-change="getPage"
|
|
|
- @page-size-change="getPage"
|
|
|
- @selection-change="tableSelectionChange"
|
|
|
+ selection
|
|
|
+ :data="tableData"
|
|
|
+ :page-total="pageTotal"
|
|
|
+ :toolbar-config="toolbarConfig"
|
|
|
+ :column-config="columnConfig"
|
|
|
+ v-model:showQuery="showQuery"
|
|
|
+ v-model:page-num="queryData.pageNum"
|
|
|
+ v-model:page-size="queryData.pageSize"
|
|
|
+ @page-num-change="getPage"
|
|
|
+ @page-size-change="getPage"
|
|
|
+ @selection-change="tableSelectionChange"
|
|
|
>
|
|
|
</a-table>
|
|
|
|
|
|
<a-dialog
|
|
|
- v-model="dialogVisible"
|
|
|
- :title="dialogTitle"
|
|
|
- @submit="formSubmit"
|
|
|
- @closed="formClosed"
|
|
|
- width="1400px"
|
|
|
- height="200px"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ :title="dialogTitle"
|
|
|
+ @submit="formSubmit"
|
|
|
+ @closed="formClosed"
|
|
|
+ width="1400px"
|
|
|
+ height="200px"
|
|
|
>
|
|
|
<a-form ref="formRef" v-model="formData" :config="formConfig" :span="12">
|
|
|
<template #deptId>
|
|
|
- <dept-tree-select ref="deptIdRef" v-model="formData.deptId" />
|
|
|
+ <dept-tree-select ref="deptIdRef" v-model="formData.deptId"/>
|
|
|
</template>
|
|
|
<template #atts>
|
|
|
- <file-upload v-model="formData.atts" />
|
|
|
+ <file-upload v-model="formData.atts"/>
|
|
|
</template>
|
|
|
<template #detailTable>
|
|
|
<a-table
|
|
|
- :data="formData.paymentRequestsDetailList"
|
|
|
- :columnConfig="detailTableColumnConfig"
|
|
|
- style="width: 100%"
|
|
|
- :card="false"
|
|
|
+ :data="formData.paymentRequestsDetailList"
|
|
|
+ :columnConfig="detailTableColumnConfig"
|
|
|
+ style="width: 100%"
|
|
|
+ :card="false"
|
|
|
>
|
|
|
<template #expenseType="scope">
|
|
|
- <a-select v-model="scope.row.expenseType" dict="expense_type" />
|
|
|
+ <a-select v-model="scope.row.expenseType" dict="expense_type"/>
|
|
|
</template>
|
|
|
<template #remark="scope">
|
|
|
<a-input
|
|
|
- v-model="scope.row.remark"
|
|
|
- type="textarea"
|
|
|
- :rows="2"
|
|
|
- @change="updateDetailRemark"
|
|
|
+ v-model="scope.row.remark"
|
|
|
+ type="textarea"
|
|
|
+ :rows="2"
|
|
|
+ @change="updateDetailRemark"
|
|
|
/>
|
|
|
</template>
|
|
|
<template #amount="scope">
|
|
|
<a-inputNumber
|
|
|
- v-model="scope.row.amount"
|
|
|
- :min="0.01"
|
|
|
- :precision="2"
|
|
|
- @change="updateAmount"
|
|
|
+ v-model="scope.row.amount"
|
|
|
+ :min="0.01"
|
|
|
+ :precision="2"
|
|
|
+ @change="updateAmount"
|
|
|
/>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
<el-button
|
|
|
- style="width: 100%; margin-bottom: 20px"
|
|
|
- type="primary"
|
|
|
- @click="addPaymentRequestsDetailList"
|
|
|
+ style="width: 100%; margin-bottom: 20px"
|
|
|
+ type="primary"
|
|
|
+ @click="addPaymentRequestsDetailList"
|
|
|
>
|
|
|
添加行
|
|
|
</el-button>
|