1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612 |
- <template>
- <div class="tenant">
- <div class="content">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :selectConfig="selectConfig"
- highlight-current-row
- :action-list="[
- {
- text: '导出Excel',
- action: () => deriveExcel(),
- },
- {
- text: '添加借款',
- action: () => addloan(),
- },
-
- {
- text: '添加流水',
- action: () => openModal('add'),
- },
- {
- text: '内部转账',
- action: () => openTransferMoney('add'),
- },
- {
- text: '结汇',
- action: () => openSettlementModal('add'),
- },
- ]"
- @moreSearch="moreSearch"
- @get-list="getList"
- >
- <template #amount="{ item }">
- <div
- :style="'color: ' + (item.status === '10' ? '#04cb04;' : 'red;')"
- >
- <span style="padding-right: 4px" v-if="item.currency">{{
- item.currency
- }}</span>
- <span style="padding-right: 4px" v-else>
- {{ accountCurrency[0].value }}
- </span>
- <span v-if="item.status === '20'">-</span>
- <span>{{ moneyFormat(item.amount, 2) }}</span>
- </div>
- </template>
- <template #contractCodes="{ item }">
- <div style="width: 100%">
- <div v-if="item.contractCodes">
- <div
- v-for="(contract, index) in item.contractCodes.split(',')"
- :key="index"
- >
- <a
- style="color: #409eff; cursor: pointer; word-break: break-all"
- @click="openDetails(contract)"
- >{{ contract }}</a
- >
- </div>
- </div>
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog
- :title="modalType == 'add' ? '添加流水' : '编辑流水'"
- v-if="dialogVisible"
- v-model="dialogVisible"
- width="600"
- v-loading="loadingDialog"
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="submit"
- >
- <template #transactionTime>
- <div>
- <el-date-picker
- v-model="formData.data.transactionTime"
- type="datetime"
- placeholder="请选择交易时间"
- value-format="YYYY-MM-DD HH:mm:ss"
- />
- </div>
- </template>
- <template #money>
- <div style="width: 100%">
- <el-row :gutter="10">
- <el-col :span="6">
- <el-form-item prop="status">
- <el-select
- v-model="formData.data.status"
- placeholder="请选择"
- style="width: 100%"
- @change="changeStatus()"
- >
- <el-option
- v-for="item in status"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item prop="currency">
- <el-select
- v-model="formData.data.currency"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in accountCurrency"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item prop="amount">
- <el-input-number
- onmousewheel="return false;"
- v-model="formData.data.amount"
- placeholder="请输入金额"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #received>
- <div>
- <el-form-item prop="received">
- <el-radio-group v-model="formData.data.received">
- <el-radio
- v-for="item in received"
- :key="item.value"
- :label="item.value"
- border
- >{{ item.label }}</el-radio
- >
- </el-radio-group>
- </el-form-item>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
- <el-button type="primary" @click="submitForm()" size="large"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- title="内部转账"
- v-if="transferMoneyModal"
- v-model="transferMoneyModal"
- width="600"
- v-loading="loadingDialog"
- >
- <byForm
- :formConfig="transferMoneyConfig"
- :formOption="formOption"
- v-model="formData2.data"
- :rules="rules2"
- ref="transferMoneySubmit"
- >
- </byForm>
- <template #footer>
- <el-button @click="transferMoneyModal = false" size="large"
- >取 消</el-button
- >
- <el-button type="primary" @click="submitForm2()" size="large"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- title="高级检索"
- v-if="openSearch"
- v-model="openSearch"
- width="600"
- :before-close="cancelSearch"
- >
- <byForm
- :formConfig="formSearchConfig"
- :formOption="formOption"
- v-model="sourceList.pagination"
- >
- <template #money>
- <div style="width: 100%">
- <el-row :gutter="10">
- <el-col :span="11">
- <el-input-number
- onmousewheel="return false;"
- v-model="sourceList.pagination.beginAmount"
- placeholder="请输入"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- />
- </el-col>
- <el-col :span="2" style="text-align: center">到</el-col>
- <el-col :span="11">
- <el-input-number
- onmousewheel="return false;"
- v-model="sourceList.pagination.endAmount"
- placeholder="请输入"
- style="width: 100%"
- :precision="2"
- :controls="false"
- :min="0"
- />
- </el-col>
- </el-row>
- </div>
- </template>
- <template #time>
- <div style="width: 100%">
- <el-row :gutter="10">
- <el-col :span="11">
- <el-date-picker
- v-model="sourceList.pagination.startTime"
- type="datetime"
- placeholder="请选择"
- style="width: 100%"
- value-format="YYYY-MM-DD HH:mm:ss"
- />
- </el-col>
- <el-col :span="2" style="text-align: center">到</el-col>
- <el-col :span="11">
- <el-date-picker
- v-model="sourceList.pagination.stopTime"
- type="datetime"
- placeholder="请选择"
- style="width: 100%"
- value-format="YYYY-MM-DD HH:mm:ss"
- />
- </el-col>
- </el-row>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="cancelSearch()" size="large">取 消</el-button>
- <el-button type="primary" @click="submitSearch()" size="large"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="860">
- <ContractPDF :rowData="rowData"></ContractPDF>
- <template #footer>
- <el-button @click="openPrint = false" size="large">取消</el-button>
- <el-button v-print="printObj" size="large">打印</el-button>
- <el-button type="primary" @click="clickDownload()" size="large"
- >下载PDF</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- :title="submitType == 'add' ? '添加借款' : '还款'"
- v-if="openLoanDialog"
- v-model="openLoanDialog"
- width="500"
- destroy-on-close
- >
- <byForm
- :formConfig="loanFormConfig"
- :formOption="formOption"
- :rules="loanRules"
- v-model="formData.loanData"
- ref="byform"
- >
- <template #loanUserName>
- <div style="width: 100%">
- <el-autocomplete
- v-model="formData.loanData.loanUserName"
- value-key="loanUserName"
- :fetch-suggestions="querySearch"
- :disabled="submitType == 'edit'"
- clearable
- class="inline-input w-50"
- placeholder="请输入"
- />
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openLoanDialog = false" size="large"
- >取 消</el-button
- >
- <el-button
- type="primary"
- @click="handleSubmitLoan()"
- size="large"
- :loading="submitLoading"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- <!-- 结汇 -->
- <el-dialog
- title="结汇"
- v-if="settlementModal"
- v-model="settlementModal"
- width="600"
- v-loading="loadingDialog"
- >
- <byForm
- :formConfig="settlementFormConfig"
- :formOption="formOption"
- v-model="formData3.data"
- :rules="rules3"
- ref="submit3"
- >
- </byForm>
- <template #footer>
- <el-button @click="settlementModal = false" size="large">取 消</el-button>
- <el-button type="primary" @click="settlementSubmitForm()" size="large"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { computed, ref } from "vue";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import useUserStore from "@/store/modules/user";
- import { ElMessage, ElMessageBox } from "element-plus";
- import moment from "moment";
- import ContractPDF from "@/components/PDF/contractPDF.vue";
- const { proxy } = getCurrentInstance();
- const accountCurrency = ref([]);
- const accountList = ref([]);
- const corporationList = ref([]);
- const status = ref([
- {
- label: "收入",
- value: "10",
- },
- {
- label: "支出",
- value: "20",
- },
- ]);
- const received = ref([
- {
- label: "是",
- value: "10",
- },
- {
- label: "否",
- value: "20",
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- accountManagementId: "",
- currency: "",
- status: "",
- received: "",
- beginAmount: undefined,
- endAmount: undefined,
- startTime: "",
- stopTime: "",
- remarks: "",
- },
- });
- //结汇
- const contractList2 = ref([])
- const settlementModal = ref(false);
- const openSettlementModal = (type, row) => {
- formData3.data = {
- accountManagementId:null,
- amount:null,
- currency:null,
- inAccountManagementId:null,
- inAmount:null,
- inCurrency:"CNY",
- rate:null,
- commissionAmount:null,
- commissionCurrency:null,
- remarks:null,
- businessId:null,
- };
- settlementModal.value = true;
- };
- const validatePass4 = (rule, value, callback) => {
- console.log(formData3.data.currency);
- if (!formData3.data.currency) {
- callback(new Error("请输入金额和选择币种"));
- } else {
- callback();
- }
- };
- const validatePass3 = (rule, value, callback) => {
- if (!formData3.data.inCurrency) {
- callback(new Error("请输入金额和选择币种"));
- } else {
- callback();
- }
- };
- const rules3 = ref({
- accountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- received: [
- { required: true, message: "请选择合同是否到账", trigger: "change" },
- ],
- amount:[
- { required: true, message: "请输入金额和选择币种", trigger: "blur" },
- { required: true, validator: validatePass4, trigger: "blur" },
- ],
- inAccountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- inAmount: [
- { required: true, message: "请输入金额和选择币种", trigger: "blur" },
- { required: true, validator: validatePass3, trigger: "blur" },
- ],
- businessId:[
- { required: true, message: "请选择合同", trigger: "change" },
- ],
- });
- const formData3 = reactive({
- data: {
- accountManagementId:null,
- amount:null,
- currency:null,
- inAccountManagementId:null,
- inAmount:null,
- inCurrency:"CNY",
- rate:null,
- commissionAmount:null,
- commissionCurrency:null,
- remarks:null,
- businessId:null,
- },
- });
- const submit3 = ref(null);
- const settlementSubmitForm = () => {
- submit3.value.handleSubmit(() => {
- //汇出汇入账号不能相同
- if(formData3.data.accountManagementId === formData3.data.inAccountManagementId) {
- ElMessage({
- message:"汇出汇入账号不能相同",
- type: "error",
- });
- return
- }
- loadingDialog.value = true;
- proxy.post("/accountRunningWater/exchangeSettlement", formData3.data).then(
- () => {
- ElMessage({
- message:"结汇成功",
- type: "success",
- });
- settlementModal.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingDialog.value = false;
- }
- );
- });
- };
- const settlementFormConfig = computed(() => {
- return [
- {
- type: "title",
- title: "结汇信息",
- },
- {
- type: "select",
- prop: "accountManagementId",
- label: "汇出账户",
- data: accountList.value,
- },
- {
- type: "selectInput",
- label: "汇出金额",
- prop: "amount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectProp: "currency",
- fn: (value) => {
- console.log(formData3.data)
- //判断value的类型
- if (isNaN(value)) {
- formData3.data.commissionCurrency = formData3.data.currency;
- } else {
- if (value != "") {
- if (value.indexOf(".") > -1) {
- formData3.data.amount = value.slice(0, value.indexOf(".") + 3);
- } else {
- formData3.data.amount = value;
- }
- }
- formData3.data.inAmount = formData3.data.amount;
- }
- if(formData3.data.amount && formData3.data.inAmount) {
- formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
- }
- },
- },
- {
- type: "select",
- prop: "inAccountManagementId",
- label: "汇入账户",
- data: accountList.value,
- },
- {
- type: "selectInput",
- label: "汇入金额",
- prop: "inAmount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectDisabled:true,
- selectProp: "inCurrency",
- fn: (value) => {
- //判断value的类型
- if (isNaN(value)) {
- formData2.data.commissionCurrency = formData2.data.currency;
-
- } else {
- if (value != "") {
- if (value.indexOf(".") > -1) {
- formData2.data.amount = value.slice(0, value.indexOf(".") + 3);
- } else {
- formData2.data.amount = value;
- }
- }
- formData2.data.inAmount = formData2.data.amount;
- }
- if(formData3.data.amount && formData3.data.inAmount) {
- formData3.data.rate = (formData3.data.inAmount / formData3.data.amount).toFixed(4)
- }
- },
- },
- {
- type: "input",
- prop: "rate",
- label: "汇率",
- itemType: "text",
- disabled: true,
- },
- {
- type: "selectInput",
- label: "手续费",
- prop: "commissionAmount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectProp: "commissionCurrency",
- },
- {
- type: "input",
- prop: "remarks",
- label: "摘要",
- itemType: "textarea",
- },
- //关联合同
- {
- type: "title",
- title: "关联合同",
- },
- {
- type: "select",
- prop: "businessId",
- label: "选择合同",
- filterable:true,
- data: contractList2.value,
- },
- ];
- });
- const loading = ref(false);
- const selectConfig = computed(() => {
- return [
- {
- label: "收支类型",
- prop: "status",
- data: status.value,
- },
- {
- label: "资金账户",
- prop: "accountManagementId",
- data: accountList.value,
- },
- {
- label: "币种",
- prop: "currency",
- data: accountCurrency.value,
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "归属公司",
- prop: "corporationName",
- width: 160,
- },
- },
- {
- attrs: {
- label: "关联销售合同",
- slot: "contractCodes",
- width: 160,
- },
- },
- {
- attrs: {
- label: "资金账户",
- prop: "accountManagementName",
- width: 200,
- },
- },
- {
- attrs: {
- label: "交易时间",
- prop: "transactionTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "交易金额",
- slot: "amount",
- width: 200,
- },
- },
- {
- attrs: {
- label: "对方账户",
- prop: "name",
- width: 200,
- },
- },
- {
- attrs: {
- label: "对方银行",
- prop: "openingBank",
- width: 200,
- },
- },
- {
- attrs: {
- label: "对方账号",
- prop: "accountOpening",
- width: 240,
- },
- },
- {
- attrs: {
- label: "摘要",
- prop: "remarks",
- },
- },
- {
- attrs: {
- label: "操作",
- width: "120",
- align: "center",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "修改",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- update(row);
- },
- },
- {
- attrs: {
- label: "删除",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- ElMessageBox.confirm(
- "此操作将永久删除该数据, 是否继续?",
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- proxy
- .post("/accountRunningWater/delete", {
- id: row.id,
- })
- .then(() => {
- ElMessage({
- message: "删除成功",
- type: "success",
- });
- getList();
- });
- });
- },
- },
- ];
- },
- },
- ];
- });
- const getDict = () => {
- proxy
- .post("/dictTenantData/page", {
- pageNum: 1,
- pageSize: 999,
- dictCode: "account_currency",
- tenantId: useUserStore().user.tenantId,
- })
- .then((res) => {
- if (res.rows && res.rows.length > 0) {
- accountCurrency.value = res.rows.map((item) => {
- return {
- label: item.dictValue,
- value: item.dictKey,
- };
- });
- }
- });
- proxy
- .post("/contract/page1", { pageNum: 1, pageSize: 9999, isExchangeSettlement: 0 })
- .then((res) => {
- contractList2.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.code,
- value: item.id,
- };
- });
- });
- proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- corporationList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- }
- });
- proxy
- .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
- .then((res) => {
- if (res.rows && res.rows.length > 0) {
- accountList.value = res.rows.map((item) => {
- return {
- label: item.alias,
- value: item.id,
- };
- });
- }
- });
- };
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/accountRunningWater/page", sourceList.value.pagination)
- .then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getDict();
- getList();
- let transferMoneyModal = ref(false);
- const openTransferMoney = () => {
- formData2.data = {
- transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
- isTransaction: "0",
- };
- transferMoneyModal.value = true;
- };
- const modalType = ref("add");
- const dialogVisible = ref(false);
- const loadingDialog = ref(false);
- const submit = ref(null);
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const formData = reactive({
- data: {
- isTransaction: "1",
- },
- loanData: {},
- });
- const formData2 = reactive({
- data: {},
- });
- const transferMoneyConfig = computed(() => {
- return [
- {
- label: "转出信息",
- },
- {
- type: "select",
- prop: "accountManagementId",
- label: "转出账户",
- data: accountList.value,
- },
- {
- type: "selectInput",
- label: "转出金额",
- prop: "amount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectProp: "currency",
- fn: (value) => {
- //判断value的类型
- if (isNaN(value)) {
- formData2.data.inCurrency = formData2.data.currency;
- formData2.data.commissionCurrency = formData2.data.currency;
- } else {
- if (value != "") {
- if (value.indexOf(".") > -1) {
- formData2.data.amount = value.slice(0, value.indexOf(".") + 3);
- } else {
- formData2.data.amount = value;
- }
- }
- formData2.data.inAmount = formData2.data.amount;
- }
- },
- },
- {
- type: "date",
- prop: "transactionTime",
- label: "转出时间",
- itemType: "datetime",
- },
- {
- label: "转入信息",
- },
- {
- type: "select",
- prop: "inAccountManagementId",
- label: "转入账户",
- data: accountList.value,
- },
- {
- type: "selectInput",
- label: "转入金额",
- prop: "inAmount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectProp: "inCurrency",
- },
- {
- label: "其他信息",
- },
- {
- type: "radio",
- prop: "isTransaction",
- label: "是否往来",
- border: true,
- data: [
- {
- label: "是",
- value: "1",
- },
- {
- label: "否",
- value: "0",
- },
- ],
- },
- {
- type: "selectInput",
- label: "手续费",
- prop: "commissionAmount",
- itemWidth: 60,
- data: accountCurrency.value,
- placeholder: "请输入",
- selectPlaceholder: "币种",
- selectProp: "commissionCurrency",
- },
- {
- type: "input",
- prop: "remarks",
- label: "摘要",
- itemType: "textarea",
- },
- ];
- });
- const formConfig = computed(() => {
- return [
- {
- label: "账户信息",
- },
- {
- type: "select",
- prop: "accountManagementId",
- label: "选择账户",
- data: accountList.value,
- },
- {
- label: "交易信息",
- },
- {
- type: "slot",
- prop: "transactionTime",
- slotName: "transactionTime",
- label: "交易时间",
- },
- {
- type: "slot",
- prop: "money",
- slotName: "money",
- label: "交易金额",
- },
- formData.data.status == "10"
- ? {
- type: "slot",
- prop: "received",
- slotName: "received",
- label: "合同到账",
- }
- : {},
- // sysUserMenu/list
- //单选框
- {
- type: "radio",
- prop: "isTransaction",
- label: "是否往来",
- border: true,
- data: [
- {
- label: "是",
- value: 1,
- },
- {
- label: "否",
- value: 0,
- },
- ],
- fn: (val) => {
- formData.data.transactionDeptId = "";
- formData.data.deptType = "";
- formConfig.value[7].data = transactionDepartmentData.value;
- },
- },
- {
- type: "select",
- prop: "transactionDeptId",
- label: "往来单位",
- data: [],
- isShow: formData.data.isTransaction == 1,
- fn: (val) => {
- if (val) {
- console.log(transactionDepartmentData.value);
- let list = transactionDepartmentData.value.filter((item) => {
- if (item.value == val) return item;
- });
- console.log(list);
- if (list && list.length > 0) {
- formData.data.deptType = list[0].deptType;
- } else {
- formData.data.deptType = "";
- }
- } else {
- formData.data.deptType = "";
- }
- },
- },
- {
- type: "input",
- prop: "name",
- label: "账户名称",
- itemType: "text",
- },
- {
- type: "input",
- prop: "openingBank",
- label: "开户银行",
- itemType: "text",
- },
- {
- type: "input",
- prop: "accountOpening",
- label: "银行账号",
- itemType: "text",
- },
- {
- label: "对方信息",
- },
- {
- type: "select",
- prop: "otherId",
- label: "对方名称",
- data: [
- {
- label: "客户",
- value: "10",
- },
- {
- label: "供应商",
- value: "20",
- },
- {
- label: "其他",
- value: "30",
- },
- ],
- },
- {
- type: "input",
- prop: "name",
- label: "账户名称",
- itemType: "text",
- },
- {
- type: "input",
- prop: "openingBank",
- label: "开户银行",
- itemType: "text",
- },
- {
- type: "input",
- prop: "accountOpening",
- label: "银行账号",
- itemType: "text",
- },
- {
- label: "其他信息",
- },
- {
- type: "input",
- prop: "remarks",
- label: "摘要",
- itemType: "textarea",
- },
- ];
- });
- const validatePass = (rule, value, callback) => {
- console.log(formData2.data.currency);
- if (!formData2.data.currency) {
- callback(new Error("请输入金额和选择币种"));
- } else {
- callback();
- }
- };
- const validatePass2 = (rule, value, callback) => {
- if (!formData2.data.inCurrency) {
- callback(new Error("请输入金额和选择币种"));
- } else {
- callback();
- }
- };
- const rules = ref({
- accountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- transactionTime: [
- { required: true, message: "请选择交易时间", trigger: "change" },
- ],
- status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- received: [
- { required: true, message: "请选择合同是否到账", trigger: "change" },
- ],
- inAccountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- inAmount: [
- { required: true, message: "请输入金额和选择币种", trigger: "blur" },
- { required: true, validator: validatePass2, trigger: "blur" },
- ],
- isTransaction: [
- { required: true, message: "请选择是否往来", trigger: "change" },
- ],
- transactionDeptId: [
- { required: true, message: "请选择往来单位", trigger: "change" },
- ],
- amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
- });
- const rules2 = ref({
- accountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- transactionTime: [
- { required: true, message: "请选择交易时间", trigger: "change" },
- ],
- status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- received: [
- { required: true, message: "请选择合同是否到账", trigger: "change" },
- ],
- inAccountManagementId: [
- { required: true, message: "请选择账户", trigger: "change" },
- ],
- inAmount: [
- { required: true, message: "请输入金额和选择币种", trigger: "blur" },
- { required: true, validator: validatePass2, trigger: "blur" },
- ],
- isTransaction: [
- { required: true, message: "请选择是否往来", trigger: "change" },
- ],
- transactionDeptId: [
- { required: true, message: "请选择往来单位", trigger: "change" },
- ],
- amount: [
- { required: true, message: "请输入金额和选择币种", trigger: "blur" },
- { required: true, validator: validatePass, trigger: "blur" },
- ],
- });
- const openModal = (val) => {
- modalType.value = val;
- formData.data = {
- transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
- };
- console.log(formConfig.value);
- loadingDialog.value = false;
- dialogVisible.value = true;
- };
- const transactionDepartmentData = ref([]);
- const getTransactionDepartment = () => {
- return proxy
- .get("transactionDepartment/list?pageNum=1&pageSize=999", {})
- .then((res) => {
- transactionDepartmentData.value = res.data.map((item) => {
- return {
- label: item.name,
- value: item.id,
- deptType: item.deptType,
- };
- });
- formConfig.value[7].data = transactionDepartmentData.value;
- formConfig.value = { ...formConfig.value };
- });
- };
- getTransactionDepartment();
- const changeStatus = () => {
- formData.data.received = "";
- };
- const transferMoneySubmit = ref(null);
- const submitForm2 = () => {
- transferMoneySubmit.value.handleSubmit(() => {
- console.log(formData2.data);
- loadingDialog.value = true;
- proxy
- .post("/accountRunningWater/internalTransfer", { ...formData2.data })
- .then(
- () => {
- ElMessage({
- message: modalType.value == "add" ? "转账成功" : "转账成功",
- type: "success",
- });
- transferMoneyModal.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingDialog.value = false;
- }
- );
- });
- };
- const submitForm = () => {
- submit.value.handleSubmit(() => {
- if (!formData.data.amount || Number(formData.data.amount) == 0) {
- return ElMessage("交易金额不能为0");
- }
- loadingDialog.value = true;
- proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
- () => {
- ElMessage({
- message: modalType.value == "add" ? "添加成功" : "编辑成功",
- type: "success",
- });
- dialogVisible.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingDialog.value = false;
- }
- );
- });
- };
- const update = (row) => {
- modalType.value = "edit";
- loadingDialog.value = true;
- proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
- formData.data = res;
- loadingDialog.value = false;
- getTransactionDepartment();
- });
- dialogVisible.value = true;
- };
- const deriveExcel = () => {
- let queryParams = proxy.deepClone(sourceList.value.pagination);
- queryParams.pageNum = 1;
- queryParams.pageSize = 9999;
- proxy.postTwo("/accountRunningWater/exportExcel", queryParams).then((res) => {
- exportData(res, "资金流水.xlsx");
- });
- };
- const exportData = (res, name) => {
- const content = res;
- const blob = new Blob([content], { type: "application/ms-excel" });
- const fileName = name;
- if ("download" in document.createElement("a")) {
- // 非IE下载
- const elink = document.createElement("a");
- elink.download = fileName;
- elink.style.display = "none";
- elink.href = URL.createObjectURL(blob);
- document.body.appendChild(elink);
- elink.click();
- URL.revokeObjectURL(elink.href); // 释放URL 对象
- document.body.removeChild(elink);
- } else {
- navigator.msSaveBlob(blob, fileName);
- }
- };
- const openSearch = ref(false);
- const formSearchConfig = computed(() => {
- return [
- {
- type: "select",
- prop: "accountManagementId",
- label: "资金账户",
- data: accountList.value,
- clearable: true,
- },
- {
- type: "select",
- prop: "status",
- label: "交易类型",
- data: status.value,
- itemWidth: 50,
- clearable: true,
- },
- {
- type: "select",
- prop: "received",
- label: "是否合同到账",
- data: received.value,
- itemWidth: 50,
- clearable: true,
- },
- {
- type: "select",
- prop: "currency",
- label: "币种",
- data: accountCurrency.value,
- clearable: true,
- },
- {
- type: "slot",
- slotName: "money",
- label: "交易金额",
- },
- {
- type: "slot",
- slotName: "time",
- label: "交易时间",
- },
- {
- type: "input",
- prop: "remarks",
- label: "摘要",
- itemType: "text",
- },
- ];
- });
- let copySearch = ref({});
- const moreSearch = () => {
- copySearch.value = proxy.deepClone(sourceList.value.pagination);
- openSearch.value = true;
- };
- const cancelSearch = () => {
- sourceList.value.pagination = copySearch.value;
- openSearch.value = false;
- };
- const submitSearch = () => {
- if (
- sourceList.value.pagination.beginAmount &&
- sourceList.value.pagination.endAmount &&
- Number(sourceList.value.pagination.beginAmount) >
- Number(sourceList.value.pagination.endAmount)
- ) {
- return ElMessage("交易金额输入错误");
- }
- if (
- sourceList.value.pagination.startTime &&
- sourceList.value.pagination.stopTime &&
- sourceList.value.pagination.startTime > sourceList.value.pagination.stopTime
- ) {
- return ElMessage("开始时间不能大于结束时间");
- }
- openSearch.value = false;
- sourceList.value.pagination.keyword = "";
- sourceList.value.pagination.pageNum = 1;
- getList();
- };
- const openPrint = ref(false);
- const rowData = ref({});
- const openDetails = (val) => {
- rowData.value = {
- code: val,
- };
- openPrint.value = true;
- };
- const printObj = ref({
- id: "printMe",
- 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",
- extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
- });
- const clickDownload = () => {
- proxy.getPdf("外销合同PDF文件");
- };
- const loanRules = ref({
- corporationId: [
- { required: true, message: "请选择归属公司", trigger: "change" },
- ],
- loanUserName: [{ required: true, message: "请输入借款人", trigger: "blur" }],
- loanTime: [{ required: true, message: "请选择借款时间", trigger: "change" }],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- amount: [{ required: true, message: "请输入借款金额", trigger: "blur" }],
- loanAccountId: [
- { required: true, message: "请选择付款账户", trigger: "change" },
- ],
- repaymentAccountId: [
- { required: true, message: "请选择收款账户", trigger: "change" },
- ],
- amountOne: [{ required: true, message: "请输入还款金额", trigger: "blur" }],
- repaymentTime: [
- { required: true, message: "请选择还款时间", trigger: "change" },
- ],
- });
- const loanFormConfig = computed(() => {
- return [
- {
- type: "select",
- prop: "corporationId",
- label: "归属公司",
- data: corporationList.value,
- clearable: true,
- disabled: submitType.value != "add",
- itemWidth: 100,
- style: {
- width: "100%",
- },
- },
- {
- type: "slot",
- prop: "loanUserName",
- label: "借款人",
- slotName: "loanUserName",
- disabled: submitType.value != "add",
- itemWidth: 100,
- style: {
- width: "50%",
- },
- },
- {
- type: "date",
- itemType: "datetime",
- prop: "loanTime",
- label: "借款时间",
- disabled: submitType.value != "add",
- itemWidth: 100,
- style: {
- width: "50%",
- },
- },
- {
- type: "select",
- prop: "currency",
- label: "借款金额",
- data: accountCurrency.value,
- clearable: true,
- disabled: submitType.value != "add",
- itemWidth: 25,
- style: {
- width: "100%",
- },
- },
- {
- type: "number",
- prop: "amount",
- label: " ",
- precision: 2,
- min: 0,
- controls: false,
- disabled: submitType.value != "add",
- itemWidth: 30,
- style: {
- width: "100%",
- },
- },
- {
- type: "select",
- prop: "loanAccountId",
- label: "付款账户",
- data: accountList.value,
- disabled: submitType.value != "add",
- itemWidth: 100,
- clearable: true,
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "remarks",
- label: "备注",
- disabled: submitType.value != "add",
- },
- submitType.value != "add"
- ? {
- type: "title",
- title: "还款信息",
- }
- : {},
- {
- type: "select",
- prop: "repaymentAccountId",
- label: "收款账户",
- data: accountList.value,
- itemWidth: 100,
- clearable: true,
- isShow: submitType.value != "add",
- style: {
- width: "100%",
- },
- },
- {
- type: "select",
- prop: "currency",
- label: "还款金额",
- data: accountCurrency.value,
- clearable: true,
- itemWidth: 25,
- isShow: submitType.value != "add",
- disabled: true,
- style: {
- width: "100%",
- },
- },
- {
- type: "number",
- prop: "amountOne",
- label: " ",
- precision: 2,
- min: 0,
- controls: false,
- itemWidth: 30,
- isShow: submitType.value != "add",
- style: {
- width: "100%",
- },
- },
- {
- type: "date",
- itemType: "datetime",
- prop: "repaymentTime",
- label: "还款时间",
- itemWidth: 100,
- isShow: submitType.value != "add",
- style: {
- width: "50%",
- },
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "remarksOne",
- label: "备注",
- isShow: submitType.value != "add",
- },
- ];
- });
- const openLoanDialog = ref(false);
- const byform = ref(null);
- const submitLoading = ref(false);
- const submitType = ref("add");
- const historyData = ref([]);
- const addloan = () => {
- proxy.get("/loanInfo/getLoanUserList").then((res) => {
- historyData.value = res.data;
- });
- formData.loanData = {};
- openLoanDialog.value = true;
- };
- const querySearch = (queryString, cb) => {
- const results = queryString
- ? historyData.value.filter(createFilter(queryString))
- : historyData.value;
- cb(results);
- };
- const createFilter = (queryString) => {
- return (restaurant) => {
- return (
- restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
- );
- };
- };
- const handleSubmitLoan = () => {
- byform.value.handleSubmit(() => {
- submitLoading.value = true;
- let requestUrl = "/loanInfo/add";
- proxy.post(requestUrl, formData.loanData).then(
- () => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- getList();
- openLoanDialog.value = false;
- submitLoading.value = false;
- },
- () => {
- submitLoading.value = false;
- }
- );
- });
- };
- </script>
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- </style>
|