|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div style="width: 100%; padding: 0px 15px">
|
|
|
<el-form
|
|
|
:model="formData.data"
|
|
|
:rules="rules"
|
|
@@ -7,13 +7,12 @@
|
|
|
label-position="top"
|
|
|
>
|
|
|
<div class="_t">基础信息</div>
|
|
|
- <el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="归属公司" prop="supplyId">
|
|
|
+ <el-form-item label="归属公司" prop="corporationId">
|
|
|
<el-select
|
|
|
- v-model="formData.data.supplyId"
|
|
|
+ v-model="formData.data.corporationId"
|
|
|
placeholder="请选择"
|
|
|
- @change="handleChangeSupplier"
|
|
|
filterable
|
|
|
style="width: 100%"
|
|
|
>
|
|
@@ -27,26 +26,34 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="归属部门" prop="purchaseName">
|
|
|
- <el-input v-model="formData.data.purchaseName" placeholder="请输入">
|
|
|
- </el-input>
|
|
|
+ <el-form-item label="归属部门" prop="corporationId">
|
|
|
+ <el-cascader
|
|
|
+ v-model="formData.data.corporationId"
|
|
|
+ :options="deptTreeData"
|
|
|
+ :props="{
|
|
|
+ value: 'id',
|
|
|
+ }"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ @change="handleChangeDept"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="请款类型" prop="supplyId">
|
|
|
+ <el-form-item label="请款类型" prop="type">
|
|
|
<el-select
|
|
|
- v-model="formData.data.supplyId"
|
|
|
+ v-model="formData.data.type"
|
|
|
placeholder="请选择"
|
|
|
- @change="handleChangeSupplier"
|
|
|
filterable
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in companyData"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ v-for="item in fundsType"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictKey"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -57,14 +64,13 @@
|
|
|
<el-select
|
|
|
v-model="formData.data.supplyId"
|
|
|
placeholder="请选择"
|
|
|
- @change="handleChangeSupplier"
|
|
|
filterable
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in companyData"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ v-for="item in currencyType"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictKey"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -73,9 +79,9 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="用款时间" prop="purchaseTime">
|
|
|
+ <el-form-item label="用款时间" prop="paymentTime">
|
|
|
<el-date-picker
|
|
|
- v-model="formData.data.purchaseTime"
|
|
|
+ v-model="formData.data.paymentTime"
|
|
|
type="datetime"
|
|
|
placeholder="请选择"
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
@@ -83,22 +89,43 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-form-item label="用款说明" prop="purchaseContent">
|
|
|
+ <el-form-item label="用款说明" prop="paymentRemarks">
|
|
|
<el-input
|
|
|
- v-model="formData.data.purchaseContent"
|
|
|
+ v-model="formData.data.paymentRemarks"
|
|
|
placeholder="请输入"
|
|
|
type="textarea"
|
|
|
>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="上传附件">
|
|
|
+ <el-upload
|
|
|
+ v-model="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>
|
|
|
+ </el-form-item>
|
|
|
+ <div style="margin-bottom: 15px">
|
|
|
+ <el-tag
|
|
|
+ style="margin-right: 10px"
|
|
|
+ class="ml-2"
|
|
|
+ type="info"
|
|
|
+ v-for="(item, index) in fileList"
|
|
|
+ :key="index"
|
|
|
+ closable
|
|
|
+ @close="handleClose(index)"
|
|
|
+ >{{ item.fileName }}</el-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
<div class="_t">请款明细</div>
|
|
|
<el-form-item>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="openProduct = true"
|
|
|
- style="margin: 10px 0"
|
|
|
- >
|
|
|
- 添加货品
|
|
|
+ <el-button type="primary" @click="handleAddRow" style="margin: 10px 0">
|
|
|
+ 添加行
|
|
|
</el-button>
|
|
|
<el-table :data="formData.data.purchaseDetailList">
|
|
|
<el-table-column prop="count" label="费用类型" min-width="150">
|
|
@@ -115,9 +142,9 @@
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in companyData"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ v-for="item in fundsCostType"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictKey"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -166,23 +193,92 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
- <el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="请款总额" prop="amount">
|
|
|
+ <el-form-item label="请款总额" prop="total">
|
|
|
<el-input
|
|
|
- v-model="formData.data.amount"
|
|
|
+ v-model="formData.data.total"
|
|
|
placeholder="请输入"
|
|
|
disabled
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="单据数量" prop="amount">
|
|
|
- <el-input v-model="formData.data.amount" placeholder="请输入" />
|
|
|
+ <el-form-item label="单据数量" prop="quantity">
|
|
|
+ <el-input v-model="formData.data.quantity" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<div class="_t">收付款信息</div>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="付款方式" prop="paymentMethod">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.data.paymentMethod"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in fundsPaymentMethod"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictKey"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="付款账户" prop="accountManagementId">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.data.accountManagementId"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in accountData"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="户名" prop="name">
|
|
|
+ <el-input v-model="formData.data.name" placeholder="请输入" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="银行账号" prop="accountOpening">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.accountOpening"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="开户银行" prop="openingBank">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.openingBank"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="联行号" prop="interbankNumber">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.interbankNumber"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -195,7 +291,7 @@ const { proxy } = getCurrentInstance();
|
|
|
|
|
|
let formData = reactive({
|
|
|
data: {
|
|
|
- purchaseTime: "",
|
|
|
+ paymentTime: "",
|
|
|
purchaseDetailList: [],
|
|
|
},
|
|
|
});
|
|
@@ -204,7 +300,7 @@ let rules = ref({
|
|
|
purchaseName: [
|
|
|
{ required: true, message: "请输入采购人名称", trigger: "blur" },
|
|
|
],
|
|
|
- purchaseTime: [
|
|
|
+ paymentTime: [
|
|
|
{ required: true, message: "请选择采购时间", trigger: "change" },
|
|
|
],
|
|
|
supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
|
|
@@ -213,75 +309,26 @@ let rules = ref({
|
|
|
remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
|
|
|
});
|
|
|
|
|
|
-let openProduct = ref(false);
|
|
|
-// 物品相应逻辑
|
|
|
-const handleRemove = (index) => {
|
|
|
- formData.data.purchaseDetailList.splice(index, 1);
|
|
|
- return ElMessage({
|
|
|
- message: "删除成功!",
|
|
|
- type: "success",
|
|
|
+const handleAddRow = () => {
|
|
|
+ formData.data.purchaseDetailList.push({
|
|
|
+ aa: "",
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const pushGoods = (goods) => {
|
|
|
- const arr = goods.map((x) => ({
|
|
|
- goodType: x.goodType,
|
|
|
- productCode: x.code,
|
|
|
- productName: x.name,
|
|
|
- productSpec: x.spec,
|
|
|
- productUnit: x.unit,
|
|
|
- count: 0,
|
|
|
- price: 0,
|
|
|
- bussinessId: x.id,
|
|
|
- amount: 0,
|
|
|
- }));
|
|
|
- formData.data.purchaseDetailList =
|
|
|
- formData.data.purchaseDetailList.concat(arr);
|
|
|
- return ElMessage({
|
|
|
- message: "添加成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
+const handleRemove = (index) => {
|
|
|
+ formData.data.purchaseDetailList.splice(index, 1);
|
|
|
};
|
|
|
+
|
|
|
// 提交方法
|
|
|
const formDom = ref(null);
|
|
|
const handleSubmit = async () => {
|
|
|
const vaild = await formDom.value.validate();
|
|
|
if (vaild) {
|
|
|
if (formData.data.purchaseDetailList.length > 0) {
|
|
|
- const list = formData.data.purchaseDetailList;
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- const e = list[i];
|
|
|
- if (ids.value.length > 0) {
|
|
|
- if (Number(e.subscribeCount) - Number(e.purchaseCount) > 0) {
|
|
|
- if (e.count == 0) {
|
|
|
- ElMessage({
|
|
|
- message: "本次采购数量不能为0!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (e.count + Number(e.purchaseCount) > Number(e.subscribeCount)) {
|
|
|
- ElMessage({
|
|
|
- message: "本次采购数量和已采购数量和不可大于申购数量!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (e.count == 0) {
|
|
|
- ElMessage({
|
|
|
- message: "本次采购数量不能为0!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
return true;
|
|
|
}
|
|
|
ElMessage({
|
|
|
- message: "请添加采购明细!",
|
|
|
+ message: "请添加请款明细!",
|
|
|
type: "info",
|
|
|
});
|
|
|
return false;
|
|
@@ -291,45 +338,116 @@ const handleSubmit = async () => {
|
|
|
};
|
|
|
// 获取用户信息并赋默认值
|
|
|
const userInfo = useUserStore().user;
|
|
|
+const tenantId = "@福建宏星!#¥%……&*()";
|
|
|
+// const tenantId = userInfo.tenantId;
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
- formData.data.purchaseTime = proxy.parseTime(new Date());
|
|
|
+ formData.data.paymentTime = proxy.parseTime(new Date());
|
|
|
formData.data.deptName = userInfo.dept.deptName;
|
|
|
formData.data.purchaseName = userInfo.nickName;
|
|
|
- getSupplierList();
|
|
|
- if (props.queryData.ids) {
|
|
|
- ids.value = props.queryData.ids.split(",") || [];
|
|
|
- getDetails();
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-// 接收父组件的传值
|
|
|
-const props = defineProps({
|
|
|
- queryData: String,
|
|
|
+ getDictData();
|
|
|
});
|
|
|
-
|
|
|
-const ids = ref([]);
|
|
|
-const getDetails = () => {
|
|
|
- proxy.post("/subscribeDetail/detail", { ids: ids.value }).then((res) => {
|
|
|
- formData.data.purchaseDetailList = res.map((x) => ({
|
|
|
- ...x,
|
|
|
- subscribeCount: x.count,
|
|
|
- count: 0,
|
|
|
- price: null,
|
|
|
- amount: null,
|
|
|
- }));
|
|
|
- });
|
|
|
-};
|
|
|
-// 获取供应商数据
|
|
|
const companyData = ref([]);
|
|
|
-const getSupplierList = async (req) => {
|
|
|
+const accountData = ref([]);
|
|
|
+const deptTreeData = ref([]);
|
|
|
+const fundsType = ref([]);
|
|
|
+const fundsCostType = ref([]);
|
|
|
+const fundsPaymentMethod = ref([]);
|
|
|
+const currencyType = ref([]);
|
|
|
+
|
|
|
+const getDictData = () => {
|
|
|
+ // 获取归属公司数据
|
|
|
proxy
|
|
|
.post("/corporation/page", { pageNum: 1, pageSize: 9999 })
|
|
|
.then((res) => {
|
|
|
companyData.value = res.rows;
|
|
|
});
|
|
|
+ // 账户数据
|
|
|
+ proxy
|
|
|
+ .post("/accountManagement/page", { pageNum: 1, pageSize: 9999 })
|
|
|
+ .then((res) => {
|
|
|
+ accountData.value = res.rows;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 部门树
|
|
|
+ proxy
|
|
|
+ .get("/tenantDept/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ tenantId: userInfo.tenantId,
|
|
|
+ })
|
|
|
+ .then((message) => {
|
|
|
+ recursive(message.data);
|
|
|
+ deptTreeData.value = proxy.handleTree(message.data, "corporationId");
|
|
|
+ });
|
|
|
+ // 请款类型数据
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ tenantId: tenantId,
|
|
|
+ dictCode: "founds_type",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ fundsType.value = res.rows;
|
|
|
+ });
|
|
|
+ // 请款费用类型数据
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ tenantId: tenantId,
|
|
|
+ dictCode: "funds_cost_type",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ fundsCostType.value = res.rows;
|
|
|
+ });
|
|
|
+ // 请款付款方式数据
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ tenantId: tenantId,
|
|
|
+ dictCode: "funds_payment_method",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ fundsPaymentMethod.value = res.rows;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 币种数据
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ tenantId: tenantId,
|
|
|
+ dictCode: "account_currency",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ currencyType.value = res.rows;
|
|
|
+ });
|
|
|
};
|
|
|
+const recursive = (data) => {
|
|
|
+ data.map((item) => {
|
|
|
+ item.label = item.deptName;
|
|
|
+ item.id = item.corporationId;
|
|
|
+ if (item.children) {
|
|
|
+ recursive(item.children);
|
|
|
+ } else {
|
|
|
+ item.children = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// 接收父组件的传值
|
|
|
+const props = defineProps({
|
|
|
+ queryData: String,
|
|
|
+});
|
|
|
|
|
|
-// 计算采购总金额
|
|
|
+// 部门变更逻辑
|
|
|
+const handleChangeDept = (val) => {
|
|
|
+ formData.data.corporationId = val[val.length - 1];
|
|
|
+};
|
|
|
+// 计算请款总金额
|
|
|
const handleChangeAmount = () => {
|
|
|
let sum = 0;
|
|
|
for (let i = 0; i < formData.data.purchaseDetailList.length; i++) {
|
|
@@ -339,6 +457,23 @@ const handleChangeAmount = () => {
|
|
|
}
|
|
|
formData.data.amount = sum;
|
|
|
};
|
|
|
+// 上传附件
|
|
|
+const uploadData = ref({});
|
|
|
+const fileList = ref([]);
|
|
|
+const handleBeforeUpload = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadData.value = res.uploadBody;
|
|
|
+ fileList.value.push({
|
|
|
+ id: res.id,
|
|
|
+ fileName: res.fileName,
|
|
|
+ path: res.fileUrl,
|
|
|
+ url: res.fileUrl,
|
|
|
+ uid: file.uid,
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleClose = (index) => {
|
|
|
+ fileList.value.splice(index, 1);
|
|
|
+};
|
|
|
// 向父组件暴露
|
|
|
defineExpose({
|
|
|
submitData: formData.data,
|