|
@@ -5,16 +5,7 @@ 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,
|
|
|
- excelExportApi,
|
|
|
- getDetailApi,
|
|
|
- getPageApi,
|
|
|
- getReceiveCountListApi,
|
|
|
- retrieveApi
|
|
|
-} from '@/api/business/payment/requests'
|
|
|
+import { addApi, deleteApi, editApi, excelExportApi, getDetailApi, getPageApi, getReceiveCountListApi, retrieveApi } 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'
|
|
@@ -22,7 +13,7 @@ import { getDictByCode } from '@/utils/dict'
|
|
|
import MoneyPDF from '@/components/PDF/moneyPDF.vue'
|
|
|
import { getPdf } from '@/utils/getPdf.js'
|
|
|
import { getPageApi as getContractPageApi } from '@/api/business/contract/info'
|
|
|
-import {getPageApi as getShopApi} from "@/api/business/corporation/shop";
|
|
|
+import { getPageApi as getShopApi } from '@/api/business/corporation/shop'
|
|
|
|
|
|
const queryRef = ref<InstanceType<typeof AForm>>()
|
|
|
const formRef = ref<InstanceType<typeof AForm>>()
|
|
@@ -326,7 +317,19 @@ const formConfig: FormConfigType[] = [
|
|
|
const data = await getCorporationPageApi({ searchAll: true })
|
|
|
return data.records
|
|
|
},
|
|
|
- rule: [{ required: true, message: '归属公司id不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{ required: true, message: '归属公司id不能为空', trigger: 'blur' }],
|
|
|
+ change: (val, options) => {
|
|
|
+ if (val) {
|
|
|
+ let list = options.filter((item) => item.id === val)
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ formData.value.corporationName = list[0].name
|
|
|
+ } else {
|
|
|
+ formData.value.corporationName = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formData.value.corporationName = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
@@ -334,13 +337,37 @@ const formConfig: FormConfigType[] = [
|
|
|
label: '归属店铺',
|
|
|
option: async () => (await getShopApi({ searchAll: true })).records,
|
|
|
keyName: 'id',
|
|
|
- labelName: 'name'
|
|
|
+ labelName: 'name',
|
|
|
+ change: (val, options) => {
|
|
|
+ if (val) {
|
|
|
+ let list = options.filter((item) => item.id === val)
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ formData.value.corporationShopName = list[0].name
|
|
|
+ } else {
|
|
|
+ formData.value.corporationShopName = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formData.value.corporationShopName = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
type: 'slot',
|
|
|
prop: 'deptId',
|
|
|
label: '归属部门',
|
|
|
- rule: [{ required: true, message: '部门id不能为空', trigger: 'blur' }]
|
|
|
+ rule: [{ required: true, message: '部门id不能为空', trigger: 'blur' }],
|
|
|
+ change: (val, options) => {
|
|
|
+ if (val) {
|
|
|
+ let list = options.filter((item) => item.id === val)
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ formData.value.deptName = list[0].name
|
|
|
+ } else {
|
|
|
+ formData.value.deptName = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formData.value.deptName = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
@@ -410,6 +437,18 @@ const formConfig: FormConfigType[] = [
|
|
|
async option() {
|
|
|
const data = await getCapitalAccountPageApi({ searchAll: true })
|
|
|
return data.records
|
|
|
+ },
|
|
|
+ change: (val, options) => {
|
|
|
+ if (val) {
|
|
|
+ let list = options.filter((item) => item.id === val)
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ formData.value.capitalAccountName = list[0].accountAlias
|
|
|
+ } else {
|
|
|
+ formData.value.capitalAccountName = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formData.value.capitalAccountName = ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -564,11 +603,20 @@ async function updateDetailRemark() {
|
|
|
for (const item of contractList.value) {
|
|
|
contract.set(item.value, item.label)
|
|
|
}
|
|
|
+ formData.value.paymentRequestsDetailList = formData.value.paymentRequestsDetailList.map((item) => {
|
|
|
+ if (item.contractId) {
|
|
|
+ let list = contractList.value.filter((contractItem) => contractItem.value === item.contractId)
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ item.contractNo = list[0].label
|
|
|
+ } else {
|
|
|
+ item.contractNo = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ console.log(formData.value.paymentRequestsDetailList)
|
|
|
formData.value.useRemark = formData.value.paymentRequestsDetailList
|
|
|
- .map(
|
|
|
- (item) =>
|
|
|
- `【${expenseMap.get(item.expenseType) ?? ''}】 - 【${contract.get(item.contractId) ?? ''}】 - ${item.remark ?? ''} - ${item.amount ?? ''}`
|
|
|
- )
|
|
|
+ .map((item) => `【${expenseMap.get(item.expenseType) ?? ''}】 - 【${contract.get(item.contractId) ?? ''}】 - ${item.remark ?? ''} - ${item.amount ?? ''}`)
|
|
|
.join('\n')
|
|
|
}
|
|
|
|
|
@@ -584,8 +632,7 @@ function updateAmount() {
|
|
|
const printObj = ref({
|
|
|
id: 'pdfDom',
|
|
|
popTitle: '',
|
|
|
- extraCss:
|
|
|
- 'https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css',
|
|
|
+ extraCss: 'https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css',
|
|
|
extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>'
|
|
|
})
|
|
|
const clickDownload = () => {
|
|
@@ -617,15 +664,7 @@ const clickDownload = () => {
|
|
|
>
|
|
|
</a-table>
|
|
|
|
|
|
- <a-dialog
|
|
|
- v-model="dialogVisible"
|
|
|
- :title="dialogTitle"
|
|
|
- :footer="!disabled"
|
|
|
- @submit="formSubmit"
|
|
|
- @closed="formClosed"
|
|
|
- width="1400px"
|
|
|
- height="200px"
|
|
|
- >
|
|
|
+ <a-dialog v-model="dialogVisible" :title="dialogTitle" :footer="!disabled" @submit="formSubmit" @closed="formClosed" width="1400px" height="200px">
|
|
|
<a-form ref="formRef" v-model="formData" :config="formConfig" :span="12" :disabled="disabled">
|
|
|
<template #accountName>
|
|
|
<el-input v-model="formData.accountName" :disabled="disabled" placeholder="请输入户名">
|
|
@@ -646,62 +685,23 @@ const clickDownload = () => {
|
|
|
<dept-tree-select ref="deptIdRef" v-model="formData.deptId" :disabled="disabled" />
|
|
|
</template>
|
|
|
<template #detailTable>
|
|
|
- <a-table
|
|
|
- :data="formData.paymentRequestsDetailList"
|
|
|
- :columnConfig="detailTableColumnConfig"
|
|
|
- style="width: 100%"
|
|
|
- :card="false"
|
|
|
- >
|
|
|
+ <a-table :data="formData.paymentRequestsDetailList" :columnConfig="detailTableColumnConfig" style="width: 100%" :card="false">
|
|
|
<template #expenseType="scope">
|
|
|
- <a-select
|
|
|
- v-model="scope.row.expenseType"
|
|
|
- dict="expense_type"
|
|
|
- :disabled="disabled"
|
|
|
- @change="updateDetailRemark"
|
|
|
- />
|
|
|
+ <a-select v-model="scope.row.expenseType" dict="expense_type" :disabled="disabled" @change="updateDetailRemark" />
|
|
|
</template>
|
|
|
<template #contractId="scope">
|
|
|
- <el-select
|
|
|
- v-model="scope.row.contractId"
|
|
|
- :disabled="disabled"
|
|
|
- @change="updateDetailRemark"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in contractList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
+ <el-select v-model="scope.row.contractId" :disabled="disabled" @change="updateDetailRemark">
|
|
|
+ <el-option v-for="item in contractList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
<template #remark="scope">
|
|
|
- <a-input
|
|
|
- v-model="scope.row.remark"
|
|
|
- type="textarea"
|
|
|
- :rows="2"
|
|
|
- @change="updateDetailRemark"
|
|
|
- :disabled="disabled"
|
|
|
- />
|
|
|
+ <a-input v-model="scope.row.remark" type="textarea" :rows="2" @change="updateDetailRemark" :disabled="disabled" />
|
|
|
</template>
|
|
|
<template #amount="scope">
|
|
|
- <a-inputNumber
|
|
|
- v-model="scope.row.amount"
|
|
|
- :min="0.01"
|
|
|
- :precision="2"
|
|
|
- @change="updateAmount"
|
|
|
- :disabled="disabled"
|
|
|
- />
|
|
|
+ <a-inputNumber v-model="scope.row.amount" :min="0.01" :precision="2" @change="updateAmount" :disabled="disabled" />
|
|
|
</template>
|
|
|
</a-table>
|
|
|
- <el-button
|
|
|
- v-if="!disabled"
|
|
|
- style="width: 100%; margin-bottom: 20px"
|
|
|
- type="primary"
|
|
|
- @click="addPaymentRequestsDetailList"
|
|
|
- >
|
|
|
- 添加行
|
|
|
- </el-button>
|
|
|
+ <el-button v-if="!disabled" style="width: 100%; margin-bottom: 20px" type="primary" @click="addPaymentRequestsDetailList"> 添加行 </el-button>
|
|
|
</template>
|
|
|
</a-form>
|
|
|
</a-dialog>
|