|
@@ -10,7 +10,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="10">
|
|
|
+ <el-col :span="6">
|
|
|
<el-form-item label="归属部门" prop="departmentId">
|
|
|
<el-tree-select
|
|
|
v-model="formData.data.departmentId"
|
|
@@ -18,22 +18,30 @@
|
|
|
check-strictly
|
|
|
:render-after-expand="false"
|
|
|
node-key="deptId"
|
|
|
+ style="width: 100%"
|
|
|
:props="defaultProps" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
+ <el-form-item label="币种" prop="currency">
|
|
|
+ <el-select v-model="formData.data.currency" placeholder="请选择" filterable style="width: 100%">
|
|
|
+ <el-option v-for="item in currencyType" :label="item.dictValue" :value="item.dictKey"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
<el-form-item label="请款类型" prop="type">
|
|
|
- <el-select v-model="formData.data.type" placeholder="请选择" filterable style="width: 100%">
|
|
|
+ <el-select v-model="formData.data.type" placeholder="请选择" filterable style="width: 100%" @change="changeType">
|
|
|
<el-option v-for="item in fundsType" :label="item.dictValue" :value="item.dictKey"> </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="币种" prop="currency">
|
|
|
- <el-select v-model="formData.data.currency" placeholder="请选择" filterable style="width: 100%">
|
|
|
- <el-option v-for="item in currencyType" :label="item.dictValue" :value="item.dictKey"> </el-option>
|
|
|
+ <el-form-item label="关联预支" prop="advanceId" v-if="formData.data.type === '3'">
|
|
|
+ <el-select v-model="formData.data.advanceId" placeholder="请选择" filterable style="width: 100%" @change="changeAdvanceId">
|
|
|
+ <el-option v-for="item in advanceList" :label="item.createTime.substr(0, 10) + ' ' + item.currency + item.total" :value="item.id"> </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -49,35 +57,22 @@
|
|
|
<el-input v-model="formData.data.paymentRemarks" placeholder="请输入" type="textarea"> </el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="上传附件">
|
|
|
- <el-upload
|
|
|
- v-model="formData.data.fileList"
|
|
|
- :show-file-list="false"
|
|
|
- class="upload-demo"
|
|
|
- action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
- :data="uploadData"
|
|
|
- :on-preview="handlePreview"
|
|
|
- :before-upload="handleBeforeUpload">
|
|
|
- <el-button type="primary">选择</el-button>
|
|
|
- </el-upload>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-preview="onPreviewFile">
|
|
|
+ <el-button>选择</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
- <div style="margin-bottom: 15px">
|
|
|
- <el-tag
|
|
|
- style="margin-right: 10px; margin-top: 8px"
|
|
|
- class="ml-2"
|
|
|
- type="info"
|
|
|
- v-for="(item, index) in formData.data.fileList"
|
|
|
- :key="index"
|
|
|
- :closable="!route.query.processType"
|
|
|
- @close="handleClose(index)"
|
|
|
- @click="handleClickFile(item)"
|
|
|
- >{{ item.fileName }}
|
|
|
- <span style="margin-left: 5px"
|
|
|
- ><el-icon @click.native.stop="handleClickDownload(item)"><Download /></el-icon></span
|
|
|
- ></el-tag>
|
|
|
- </div>
|
|
|
<div class="_t">请款明细</div>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="handleAddRow" style="margin: 10px 0"> 添加行 </el-button>
|
|
|
+ <el-button type="primary" @click="handleAddRow" v-if="formData.data.type !== '3'" style="margin: 10px 0"> 添加行 </el-button>
|
|
|
<el-table :data="formData.data.accountRequestFundsDetailList">
|
|
|
<el-table-column prop="count" label="费用类型" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
@@ -104,7 +99,8 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amount" label="请款金额" min-width="150">
|
|
|
+ <el-table-column prop="advanceAmount" label="预支金额" width="120" v-if="formData.data.type === '3'" />
|
|
|
+ <el-table-column prop="amount" :label="formData.data.type !== '3' ? '请款金额' : '核销金额'" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item :prop="'accountRequestFundsDetailList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
|
|
|
<el-input-number
|
|
@@ -113,11 +109,12 @@
|
|
|
:precision="4"
|
|
|
:controls="false"
|
|
|
:min="0.0001"
|
|
|
+ style="width: 100%"
|
|
|
@change="handleChangeAmount" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="zip" label="操作" width="100">
|
|
|
+ <el-table-column prop="zip" label="操作" width="100" v-if="formData.data.type !== '3'">
|
|
|
<template #default="{ $index }">
|
|
|
<el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
</template>
|
|
@@ -125,8 +122,13 @@
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
<el-row :gutter="10">
|
|
|
+ <el-col :span="6" v-if="formData.data.type === '3'">
|
|
|
+ <el-form-item label="预支总额" prop="advanceAmounts">
|
|
|
+ <el-input v-model="formData.data.advanceAmounts" placeholder="请输入" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="请款总额" prop="total">
|
|
|
+ <el-form-item :label="formData.data.type !== '3' ? '请款总额' : '核销总额'" prop="total">
|
|
|
<el-input v-model="formData.data.total" placeholder="请输入" disabled />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -189,17 +191,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
-import { useRouter, useRoute } from "vue-router";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+
|
|
|
const route = useRoute();
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
-
|
|
|
const defaultProps = {
|
|
|
children: "children",
|
|
|
label: "deptName",
|
|
|
};
|
|
|
-let formData = reactive({
|
|
|
+const formData = reactive({
|
|
|
data: {
|
|
|
paymentTime: "",
|
|
|
accountRequestFundsDetailList: [],
|
|
@@ -210,9 +212,10 @@ let rules = ref({
|
|
|
corporationId: [{ required: true, message: "请选择归属公司", trigger: "change" }],
|
|
|
departmentId: [{ required: true, message: "请选择归属部门", trigger: "change" }],
|
|
|
type: [{ required: true, message: "请选择请款类型", trigger: "change" }],
|
|
|
- paymentTime: [{ required: true, message: "请选择用款时间", trigger: "change" }],
|
|
|
+ // paymentTime: [{ required: true, message: "请选择用款时间", trigger: "change" }],
|
|
|
currency: [{ required: true, message: "请选择币种", trigger: "change" }],
|
|
|
paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
|
|
|
+ advanceId: [{ required: true, message: "请选择关联预支", trigger: "change" }],
|
|
|
// accountManagementId: [
|
|
|
// { required: true, message: "请选择付款账号", trigger: "change" },
|
|
|
// ],
|
|
@@ -237,18 +240,37 @@ const handleRemove = (index) => {
|
|
|
// 提交方法
|
|
|
const formDom = ref(null);
|
|
|
const handleSubmit = async () => {
|
|
|
- const vaild = await formDom.value.validate();
|
|
|
- if (vaild) {
|
|
|
- if (formData.data.accountRequestFundsDetailList.length > 0) {
|
|
|
- return true;
|
|
|
+ let status = await formDom.value.validate();
|
|
|
+ if (status) {
|
|
|
+ if (fileList.value && fileList.value.length > 0) {
|
|
|
+ for (let i = 0; i < fileList.value.length; i++) {
|
|
|
+ if (fileList.value[i].raw.uploadState) {
|
|
|
+ ElMessage("文件上传中,请稍后提交");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.data.fileList = fileList.value.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ uploadState: item.raw.uploadState,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.fileList = [];
|
|
|
}
|
|
|
- ElMessage({
|
|
|
- message: "请添加请款明细!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- return false;
|
|
|
+ if (!(formData.data.accountRequestFundsDetailList.length > 0)) {
|
|
|
+ ElMessage("请添加请款明细!");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ const errorDiv = document.getElementsByClassName("is-error");
|
|
|
+ errorDiv[0].scrollIntoView();
|
|
|
+ }, 0);
|
|
|
}
|
|
|
- return false;
|
|
|
+ return status;
|
|
|
};
|
|
|
// 获取用户信息并赋默认值
|
|
|
const userInfo = useUserStore().user;
|
|
@@ -257,15 +279,11 @@ const tenantId = userInfo.tenantId;
|
|
|
|
|
|
onMounted(() => {
|
|
|
formData.data.paymentTime = proxy.parseTime(new Date());
|
|
|
- getDictData();
|
|
|
- // if (route.query.processType) {
|
|
|
- // console.log(route.query.processType, props.queryData, "adada");
|
|
|
- // }
|
|
|
setTimeout(() => {
|
|
|
if (props.queryData && (route.query.processType == 10 || route.query.processType == 20)) {
|
|
|
formData.data = props.queryData;
|
|
|
}
|
|
|
- }, 2000);
|
|
|
+ }, 500);
|
|
|
});
|
|
|
const companyData = ref([]);
|
|
|
const accountData = ref([]);
|
|
@@ -274,6 +292,7 @@ const fundsType = ref([]);
|
|
|
const fundsCostType = ref([]);
|
|
|
const fundsPaymentMethod = ref([]);
|
|
|
const currencyType = ref([]);
|
|
|
+const advanceList = ref([]);
|
|
|
const contractList = ref([]);
|
|
|
const getDictData = () => {
|
|
|
// 获取归属公司数据
|
|
@@ -340,7 +359,6 @@ const getDictData = () => {
|
|
|
.then((res) => {
|
|
|
fundsPaymentMethod.value = res.rows;
|
|
|
});
|
|
|
-
|
|
|
// 币种数据
|
|
|
proxy
|
|
|
.post("/dictTenantData/page", {
|
|
@@ -352,7 +370,18 @@ const getDictData = () => {
|
|
|
.then((res) => {
|
|
|
currencyType.value = res.rows;
|
|
|
});
|
|
|
+ proxy
|
|
|
+ .post("/accountRequestFunds/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ type: "1",
|
|
|
+ writeOffStatus: "0",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ advanceList.value = res.rows;
|
|
|
+ });
|
|
|
};
|
|
|
+getDictData();
|
|
|
const recursive = (data) => {
|
|
|
data.map((item) => {
|
|
|
item.label = item.deptName;
|
|
@@ -364,12 +393,10 @@ const recursive = (data) => {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
// 接收父组件的传值
|
|
|
const props = defineProps({
|
|
|
queryData: String,
|
|
|
});
|
|
|
-
|
|
|
// 计算请款总金额
|
|
|
const handleChangeAmount = () => {
|
|
|
let sum = 0;
|
|
@@ -381,47 +408,21 @@ const handleChangeAmount = () => {
|
|
|
};
|
|
|
// 上传附件
|
|
|
const uploadData = ref({});
|
|
|
+const fileList = ref([]);
|
|
|
const handleBeforeUpload = async (file) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
|
- formData.data.fileList.push({
|
|
|
- id: res.id,
|
|
|
- fileName: res.fileName,
|
|
|
- path: res.fileUrl,
|
|
|
- url: res.fileUrl,
|
|
|
- uid: file.uid,
|
|
|
- });
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ file.uploadState = true;
|
|
|
+ return true;
|
|
|
};
|
|
|
-const handleClose = (index) => {
|
|
|
- formData.data.fileList.splice(index, 1);
|
|
|
+const handleSuccess = (any, UploadFile) => {
|
|
|
+ UploadFile.raw.uploadState = false;
|
|
|
};
|
|
|
-
|
|
|
-const handleClickFile = (file) => {
|
|
|
- const path = file.path ? file.path : file.url ? file.url : "";
|
|
|
- if (path) {
|
|
|
- window.open(path, "_blank");
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const handleClickDownload = (file) => {
|
|
|
- let xhr = new XMLHttpRequest();
|
|
|
- //域名是华为云的
|
|
|
- xhr.open("GET", `${file.path}`, true);
|
|
|
- xhr.responseType = "blob";
|
|
|
- xhr.send();
|
|
|
- xhr.onreadystatechange = function () {
|
|
|
- if (xhr.readyState === 4 && xhr.status === 200) {
|
|
|
- let url = window.URL.createObjectURL(xhr.response);
|
|
|
- const a = document.createElement("a");
|
|
|
- a.href = url;
|
|
|
- a.download = file.fileName; // 下载后文件名
|
|
|
- a.style.display = "none";
|
|
|
- document.body.appendChild(a);
|
|
|
- a.click(); // 点击下载
|
|
|
- window.URL.revokeObjectURL(a.href);
|
|
|
- document.body.removeChild(a); // 下载完成移除元素
|
|
|
- }
|
|
|
- };
|
|
|
+const onPreviewFile = (file) => {
|
|
|
+ window.open(file.raw.fileUrl, "_blank");
|
|
|
};
|
|
|
// 向父组件暴露
|
|
|
defineExpose({
|
|
@@ -437,6 +438,64 @@ const judgeStatus = () => {
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
+const changeType = () => {
|
|
|
+ for (var text in formData.data) {
|
|
|
+ if (text === "advanceId") {
|
|
|
+ formData.data.advanceId = "";
|
|
|
+ } else if (text === "corporationId") {
|
|
|
+ formData.data.corporationId = proxy.deepClone(formData.data.corporationId);
|
|
|
+ } else if (text === "type") {
|
|
|
+ formData.data.type = proxy.deepClone(formData.data.type);
|
|
|
+ } else if (text === "paymentTime") {
|
|
|
+ formData.data.paymentTime = proxy.deepClone(formData.data.paymentTime);
|
|
|
+ } else if (text === "accountRequestFundsDetailList") {
|
|
|
+ formData.data.accountRequestFundsDetailList = [];
|
|
|
+ } else if (text === "fileList") {
|
|
|
+ formData.data.fileList = [];
|
|
|
+ } else {
|
|
|
+ delete formData.data[text];
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+const changeAdvanceId = (val) => {
|
|
|
+ if (val) {
|
|
|
+ proxy.post("/accountRequestFunds/detail", { id: val }).then((res) => {
|
|
|
+ formData.data.departmentId = res.departmentId;
|
|
|
+ formData.data.currency = res.currency;
|
|
|
+ formData.data.paymentRemarks = res.paymentRemarks;
|
|
|
+ proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((resFile) => {
|
|
|
+ formData.data.fileList = resFile[val] || [];
|
|
|
+ if (formData.data.fileList && formData.data.fileList.length > 0) {
|
|
|
+ fileList.value = formData.data.fileList.map((item) => {
|
|
|
+ return {
|
|
|
+ raw: item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ formData.data.accountRequestFundsDetailList = res.accountRequestFundsDetailList.map((item) => {
|
|
|
+ return {
|
|
|
+ costType: item.costType,
|
|
|
+ amount: item.amount,
|
|
|
+ contractId: item.contractId,
|
|
|
+ advanceAmount: item.amount,
|
|
|
+ remarks: item.remarks,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ handleChangeAmount();
|
|
|
+ formData.data.advanceAmounts = res.total;
|
|
|
+ formData.data.quantity = res.quantity;
|
|
|
+ formData.data.paymentMethod = res.paymentMethod;
|
|
|
+ formData.data.accountManagementId = res.accountManagementId;
|
|
|
+ formData.data.name = res.name;
|
|
|
+ formData.data.accountOpening = res.accountOpening;
|
|
|
+ formData.data.openingBank = res.openingBank;
|
|
|
+ formData.data.interbankNumber = res.interbankNumber;
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|