瀏覽代碼

资金流水添加移到汇款明细

cz 9 月之前
父節點
當前提交
64eefbf622
共有 1 個文件被更改,包括 217 次插入102 次删除
  1. 217 102
      src/views/report/remittanceDetails/index.vue

+ 217 - 102
src/views/report/remittanceDetails/index.vue

@@ -7,7 +7,11 @@
         text: '导出Excel',
         action: () => exportExcel(),
         disabled: false,
-        }
+        },
+        {
+            text: '添加流水',
+            action: () => openModal('add'),
+          }
         ]" @get-list="getList">
 
         <template #code="{item}">
@@ -43,9 +47,54 @@
       </byTable>
     </div>
 
-    <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="60%">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
+    <el-dialog :title="modalType == 'add' ? '添加流水' : '编辑流水'" v-if="dialogVisible" v-model="dialogVisible" width="1000" v-loading="loadingDialog">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
 
+        <template #money>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="10">
+                <el-form-item prop="currency" class="margin-b-0">
+                  <el-select v-model="formData.data.currency" placeholder="请选择" style="width: 100%" @change="changeAmount" disabled>
+                    <el-option v-for="item in accountCurrency" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="14">
+                <el-form-item prop="amount" class="margin-b-0">
+                  <el-input-number onmousewheel="return false;" v-model="formData.data.amount" placeholder="请输入金额" style="width: 100%" :precision="2"
+                                   :controls="false" :min="0" @change="changeAmount" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+        <template #amountCny>
+          <div style="width: 100%">
+            <el-row :gutter="10" style="width:100%">
+              <el-col :span="14">
+                <el-form-item prop="amountCny" class="margin-b-0">
+                  <el-input-number onmousewheel="return false;" v-model="formData.data.amountCny" placeholder="请输入汇算人民币金额" style="width: 100%"
+                                   :precision="2" :controls="false" :min="0" />
+                </el-form-item>
+              </el-col>
+              <span v-if="formData.data.amount && formData.data.amountCny">汇率是:{{
+                    parseFloat(
+                      formData.data.amountCny / formData.data.amount
+                    ).toFixed(2)
+                  }}</span>
+            </el-row>
+          </div>
+        </template>
+        <template #received>
+          <div style="width: 100%">
+            <el-form-item prop="received" class="margin-b-0">
+              <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="default">取 消</el-button>
@@ -59,12 +108,19 @@
 import { computed, ref } from "vue";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
+import moment from "moment";
+import { ElMessage, ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const sealType = computed(() => proxy.useUserStore().allDict["seal_type"]);
 const costCategory = computed(
   () => proxy.useUserStore().allDict["cost_category"]
 );
+const accountCurrency = computed(
+  () => proxy.useUserStore().allDict["account_currency"]
+);
+
+const accountList = ref([]);
 const userList = ref([]);
 const deptData = ref([]);
 const typeData = ref([
@@ -465,6 +521,16 @@ const config = computed(() => {
     // },
   ];
 });
+const status = ref([
+  {
+    label: "收入",
+    value: "10",
+  },
+  {
+    label: "支出",
+    value: "20",
+  },
+]);
 const corporationList = ref([]);
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
@@ -522,6 +588,10 @@ const formOption = reactive({
   itemWidth: 100,
   rules: [],
 });
+const formData = reactive({
+  data: {},
+  settleData: {},
+});
 const formConfig = computed(() => {
   return [
     {
@@ -529,83 +599,113 @@ const formConfig = computed(() => {
       title: "基本信息",
     },
     {
-      type: "input",
-      prop: "name",
-      label: "印章名称",
-      required: true,
+      type: "select",
+      prop: "accountManagementId",
+      label: "选择账户",
+      data: accountList.value,
       itemWidth: 50,
-      itemType: "text",
     },
     {
-      type: "select",
-      prop: "sealType",
-      label: "印章类型",
-      data: sealType.value,
+      type: "date",
+      prop: "transactionTime",
+      itemType: "datetime",
+      label: "交易时间",
       itemWidth: 50,
     },
     {
       type: "select",
-      prop: "applyUserId",
-      label: "存管人员",
-      required: true,
-      filterable: true,
-      data: userList.value,
-      itemWidth: 50,
-      fn: (val) => {
-        let current = userList.value.find((x) => x.value == val);
-        console.log(current, "ada");
-        if (current) {
-          formData.data.deptId = current.deptId;
-        }
+      prop: "status",
+      label: "交易类型",
+      data: status.value,
+      fn: () => {
+        // changeStatus();
       },
+      itemWidth: 50,
     },
+    // formData.data.status == "10"
+    //   ? {
+    //       type: "slot",
+    //       prop: "received",
+    //       slotName: "received",
+    //       label: "合同到账",
+    //       itemWidth: 49,
+    //     }
+    //   : {},
     {
-      type: "treeSelect",
-      prop: "deptId",
-      label: "存管部门",
-      data: deptData.value,
-      propsTreeLabel: "deptName",
-      propsTreeValue: "deptId",
+      type: "slot",
+      prop: "money",
+      slotName: "money",
+      label: "交易金额",
       itemWidth: 50,
-      disabled: 50,
+    },
+    // {
+    //   type: "slot",
+    //   prop: "amountCny",
+    //   slotName: "amountCny",
+    //   label: "汇算人民币",
+    //   itemWidth: 50,
+    // },
+
+    {
+      type: "title1",
+      title: "对方信息",
+    },
+
+    {
+      type: "input",
+      prop: "name",
+      label: "账户名称",
+      itemType: "text",
     },
     {
       type: "input",
-      prop: "accountNumber",
-      label: "印章用途",
-      itemWidth: 100,
+      prop: "openingBank",
+      label: "开户银行",
+      itemType: "text",
+    },
+    {
+      type: "input",
+      prop: "accountOpening",
+      label: "银行账号",
+      itemType: "text",
+    },
+    {
+      type: "title1",
+      title: "其他",
+    },
+    {
+      type: "input",
+      prop: "remarks",
+      label: "摘要",
       itemType: "textarea",
     },
+    {
+      type: "upload",
+      listType: "text",
+      accept: "",
+      prop: "fileList",
+      label: "凭证上传",
+    },
   ];
 });
 const rules = ref({
-  name: [{ required: true, message: "请输入承包商", trigger: "blur" }],
-  taxPoints: [{ required: true, message: "请输入税点", trigger: "blur" }],
-  accountBank: [{ required: true, message: "请输入开户行", trigger: "blur" }],
-  accountName: [{ required: true, message: "请输入开户名", trigger: "blur" }],
-  accountNumber: [{ required: true, message: "请输入账号", trigger: "blur" }],
+  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" },
+  ],
+  amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
+  // name: [{ required: true, message: "请输入账户名称", trigger: "blur" }],
+  // openingBank: [{ required: true, message: "请输入开户银行", trigger: "blur" }],
+  // accountOpening: [{ required: true, message: "请输入银行账号", trigger: "blur" }],
 });
-const formData = reactive({
-  data: {
-    accountRemainderList: [{ currency: "", remainder: undefined }],
-  },
-});
-const openModal = (val) => {
-  // modalType.value = val;
-  // formData.data = {
-  //   accountRemainderList: [{ currency: "", remainder: undefined }],
-  // };
-  // loadingDialog.value = false;
-  // dialogVisible.value = true;
-  proxy.$router.replace({
-    path: "/platform_manage/process/processApproval",
-    query: {
-      flowKey: "education_subsidy_flow",
-      flowName: "学历补贴发起流程",
-      random: proxy.random(),
-    },
-  });
-};
+
 const clickBalance = () => {
   if (
     formData.data.accountRemainderList &&
@@ -632,48 +732,6 @@ const isRepeat = (arr) => {
   }
   return false;
 };
-const submitForm = () => {
-  submit.value.handleSubmit(() => {
-    loadingDialog.value = true;
-    proxy.post("/contractor/" + modalType.value, formData.data).then(
-      () => {
-        proxy.msgTip("操作成功", 1);
-        dialogVisible.value = false;
-        getList();
-      },
-      (err) => {
-        console.log(err);
-        loadingDialog.value = false;
-      }
-    );
-    // if (
-    //   formData.data.accountRemainderList &&
-    //   formData.data.accountRemainderList.length > 0
-    // ) {
-    //   if (isRepeat(formData.data.accountRemainderList)) {
-    //     return ElMessage("请勿重复添加货币余额");
-    //   } else {
-    //     loadingDialog.value = true;
-    //     proxy.post("/accountManagement/" + modalType.value, formData.data).then(
-    //       () => {
-    //         ElMessage({
-    //           message: modalType.value == "add" ? "添加成功" : "编辑成功",
-    //           type: "success",
-    //         });
-    //         dialogVisible.value = false;
-    //         getList();
-    //       },
-    //       (err) => {
-    //         console.log(err);
-    //         loadingDialog.value = false;
-    //       }
-    //     );
-    //   }
-    // } else {
-    //   return ElMessage("请添加至少一条类型余额");
-    // }
-  });
-};
 
 const update = (row) => {
   loadingDialog.value = false;
@@ -694,6 +752,22 @@ const clickUpdate = (row) => {
   });
 };
 
+const getDict = () => {
+  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,
+          };
+        });
+      }
+    });
+};
+getDict();
+
 const getDtl = (row) => {
   proxy.$router.push({
     path: "/platform_manage/process/processApproval",
@@ -739,6 +813,47 @@ const changeData = (item) => {
   };
   proxy.post("/report/finance/remitDetail/edit", data).then((res) => {});
 };
+
+const openModal = (val) => {
+  modalType.value = val;
+  formData.data = {
+    transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
+    fileList: [],
+    currency: "CNY",
+  };
+  loadingDialog.value = false;
+  dialogVisible.value = true;
+};
+
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    if (!formData.data.amount || Number(formData.data.amount) == 0) {
+      return ElMessage("交易金额不能为0");
+    }
+    proxy
+      .msgConfirm()
+      .then((res) => {
+        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;
+            }
+          );
+      })
+      .catch((err) => {});
+  });
+};
 </script>
 
 <style lang="scss" scoped>