|
@@ -107,7 +107,7 @@
|
|
|
<el-button type="primary" @click="settlementSubmitForm()" size="large">确 定</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog :title="modalType == 'add' ? '添加流水' : '编辑流水'" v-if="dialogVisible" v-model="dialogVisible" width="600">
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加流水' : '编辑流水'" v-if="dialogVisible" v-model="dialogVisible" width="1200">
|
|
|
<byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
|
|
|
<template #transactionTime>
|
|
|
<div>
|
|
@@ -155,6 +155,57 @@
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template #deptMoney>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <div>
|
|
|
+ <el-button type="primary" @click="clickAddDeptMoney()">添加</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="formData.data.deptMoneyList" style="margin-top: 10px">
|
|
|
+ <el-table-column label="部门" width="200">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-select v-model="row.deptId" placeholder="请选择" filterable clearable style="width: 100%">
|
|
|
+ <el-option v-for="item in deptTreeData" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="货币" width="140">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-select v-model="row.currency" placeholder="请选择" filterable clearable style="width: 100%">
|
|
|
+ <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="类型" width="140">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-select v-model="row.status" placeholder="请选择" filterable clearable style="width: 100%">
|
|
|
+ <el-option v-for="item in status" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="金额" width="160">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="row.amount"
|
|
|
+ placeholder="请输入金额"
|
|
|
+ style="width: 100%"
|
|
|
+ :precision="2"
|
|
|
+ :controls="false" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="摘要">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-input v-model="row.remarks" placeholder="请输入" style="width: 100%" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="80">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button type="primary" link @click="handleDeptMoneyRemove($index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</byForm>
|
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
@@ -238,6 +289,7 @@ import useUserStore from "@/store/modules/user";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import moment from "moment";
|
|
|
import ContractPDF from "@/components/PDF/contractPDF.vue";
|
|
|
+import Cookies from "js-cookie";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const accountCurrency = ref([]);
|
|
@@ -245,6 +297,7 @@ const accountList = ref([]);
|
|
|
const contractList = ref([]);
|
|
|
const contractList2 = ref([]);
|
|
|
const corporationList = ref([]);
|
|
|
+const deptTreeData = ref([]);
|
|
|
const status = ref([
|
|
|
{
|
|
|
label: "收入",
|
|
@@ -947,6 +1000,15 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
|
+ title: "部门费用",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "deptMoney",
|
|
|
+ label: "费用明细",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
title: "对方信息",
|
|
|
},
|
|
|
{
|
|
@@ -1073,7 +1135,6 @@ const formConfigOne = computed(() => {
|
|
|
];
|
|
|
});
|
|
|
const validatePass = (rule, value, callback) => {
|
|
|
- console.log(formData2.data.currency);
|
|
|
if (!formData2.data.currency) {
|
|
|
callback(new Error("请输入金额和选择币种"));
|
|
|
} else {
|
|
@@ -1107,7 +1168,6 @@ const rules = ref({
|
|
|
});
|
|
|
|
|
|
const validatePass4 = (rule, value, callback) => {
|
|
|
- console.log(formData3.data.currency);
|
|
|
if (!formData3.data.currency) {
|
|
|
callback(new Error("请输入金额和选择币种"));
|
|
|
} else {
|
|
@@ -1166,16 +1226,60 @@ const rulesOne = ref({
|
|
|
contractId: [{ required: true, message: "请选择合同", trigger: "change" }],
|
|
|
amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
|
|
|
});
|
|
|
-
|
|
|
+const recursive = (data) => {
|
|
|
+ data.map((item) => {
|
|
|
+ item.label = item.deptName;
|
|
|
+ item.id = item.corporationId;
|
|
|
+ if (item.children) {
|
|
|
+ recursive(item.children);
|
|
|
+ } else {
|
|
|
+ item.children = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const getDept = async () => {
|
|
|
+ // 部门树
|
|
|
+ proxy
|
|
|
+ .get("/tenantDept/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ tenantId: Cookies.get("tenantId"),
|
|
|
+ })
|
|
|
+ .then((message) => {
|
|
|
+ recursive(message.data);
|
|
|
+ if (message.data && message.data.length > 0) {
|
|
|
+ message.data = message.data.map((item) => {
|
|
|
+ item.value = item.deptId;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ deptTreeData.value = proxy.handleTree(message.data, "corporationId");
|
|
|
+ console.log(deptTreeData.value);
|
|
|
+ });
|
|
|
+};
|
|
|
+getDept();
|
|
|
const openModal = (val) => {
|
|
|
modalType.value = val;
|
|
|
formData.data = {
|
|
|
isTransaction: "0",
|
|
|
transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
|
|
|
+ deptMoneyList: [],
|
|
|
};
|
|
|
loadingDialog.value = false;
|
|
|
dialogVisible.value = true;
|
|
|
};
|
|
|
+const clickAddDeptMoney = () => {
|
|
|
+ formData.data.deptMoneyList.push({
|
|
|
+ deptId: "",
|
|
|
+ currency: formData.data.currency,
|
|
|
+ amount: undefined,
|
|
|
+ remarks: "",
|
|
|
+ status: "",
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleDeptMoneyRemove = (index) => {
|
|
|
+ formData.data.deptMoneyList.splice(index, 1);
|
|
|
+};
|
|
|
const openModalOne = () => {
|
|
|
modalType.value = "add";
|
|
|
formData.dataOne = {
|
|
@@ -1194,6 +1298,28 @@ const submitForm = () => {
|
|
|
if (!formData.data.amount || Number(formData.data.amount) == 0) {
|
|
|
return ElMessage("交易金额不能为0");
|
|
|
}
|
|
|
+ if (formData.data.deptMoneyList && formData.data.deptMoneyList.length > 0) {
|
|
|
+ let money = 0;
|
|
|
+ for (let i = 0; i < formData.data.deptMoneyList.length; i++) {
|
|
|
+ if (
|
|
|
+ !(
|
|
|
+ formData.data.deptMoneyList[i].deptId &&
|
|
|
+ formData.data.deptMoneyList[i].currency &&
|
|
|
+ formData.data.deptMoneyList[i].amount &&
|
|
|
+ formData.data.deptMoneyList[i].status
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return ElMessage("请填写完整部门费用");
|
|
|
+ }
|
|
|
+ money = money + Number(formData.data.deptMoneyList[i].amount);
|
|
|
+ }
|
|
|
+ if (money > Number(formData.data.amount)) {
|
|
|
+ return ElMessage("部门费用不能大于交易金额");
|
|
|
+ }
|
|
|
+ proxy.post("accountDeptRunningWater/bathAdd", formData.data.deptMoneyList).then(() => {
|
|
|
+ ElMessage({ message: "部门费用添加成功", type: "success" });
|
|
|
+ });
|
|
|
+ }
|
|
|
loadingDialog.value = true;
|
|
|
proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
|
|
|
() => {
|