ソースを参照

打款列表BUG

lxf 1 年間 前
コミット
7b2d013b29
1 ファイル変更37 行追加83 行削除
  1. 37 83
      src/views/finance/fundManage/accountPayment/index.vue

+ 37 - 83
src/views/finance/fundManage/accountPayment/index.vue

@@ -13,33 +13,17 @@
           select: select,
         }"
         :action-list="[]"
-        @get-list="getList"
-      >
+        @get-list="getList">
         <template #pic="{ item }">
           <div v-if="item.fileList.length > 0">
-            <img
-              :src="item.fileList[0].fileUrl"
-              class="pic"
-              @click="handleClickFile(item.fileList[0])"
-            />
+            <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
           </div>
           <div v-else></div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="modalType == 'add' ? '打款' : '打款'"
-      v-model="dialogVisible"
-      width="500"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="modalType == 'add' ? '打款' : '打款'" v-model="dialogVisible" width="500" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #productPic>
           <div>
             <el-upload
@@ -49,8 +33,7 @@
               list-type="picture-card"
               :on-remove="handleRemove"
               :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload"
-            >
+              :before-upload="handleBeforeUpload">
               <el-icon><Plus /></el-icon>
             </el-upload>
           </div>
@@ -58,46 +41,24 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
-          确 定
-        </el-button>
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      title="Excel导入"
-      v-model="openExcelDialog"
-      width="400"
-      v-loading="loading"
-    >
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="400" v-loading="loading">
       <template #footer>
-        <el-button @click="openExcelDialog = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          @click="submitExcel()"
-          size="large"
-          :loading="submitLoading"
-        >
-          确 定
-        </el-button>
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitExcel()" size="large" :loading="submitLoading"> 确 定 </el-button>
       </template>
     </el-dialog>
   </div>
 </template>
 
 <script setup>
-/* eslint-disable vue/no-unused-components */
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import Cookies from "js-cookie";
-import { computed, defineComponent, ref } from "vue";
+import { computed, ref } from "vue";
+
 const loading = ref(false);
 const submitLoading = ref(false);
 const sourceList = ref({
@@ -114,16 +75,13 @@ const sourceList = ref({
 });
 let dialogVisible = ref(false);
 let openExcelDialog = ref(false);
-
 let modalType = ref("add");
 let rules = ref({
-  productClassifyId: [
-    { required: true, message: "请选择物料分类", trigger: "change" },
-  ],
+  productClassifyId: [{ required: true, message: "请选择物料分类", trigger: "change" }],
   type: [{ required: true, message: "请选择物料类型", trigger: "change" }],
-  // name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
-  // unit: [{ required: true, message: "请选择单位", trigger: "change" }],
 });
+const accountCurrency = ref([]);
+const fundsType = ref([]);
 const { proxy } = getCurrentInstance();
 const selectConfig = computed(() => {
   return [
@@ -154,7 +112,11 @@ const config = computed(() => {
         prop: "type",
       },
       render(type) {
-        return proxy.dictDataEcho(type, dictsData.payment_status);
+        if (type) {
+          return proxy.dictValueLabel(type, fundsType.value);
+        } else {
+          return "采购付款";
+        }
       },
     },
     {
@@ -327,7 +289,7 @@ const formConfig = computed(() => {
       label: "付款金额",
       itemWidth: 60,
       prop: "amount",
-      data: [],
+      data: accountCurrency.value,
       placeholder: "请输入",
       selectPlaceholder: "币种",
       selectProp: "currency",
@@ -373,16 +335,13 @@ const generatePassword = () => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy
-    .post("/accountPayment/page", sourceList.value.pagination)
-    .then((message) => {
-      console.log(message);
-      sourceList.value.data = message.rows;
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+  proxy.post("/accountPayment/page", sourceList.value.pagination).then((message) => {
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 const uploadData = ref({});
 const fileList = ref([]);
@@ -397,19 +356,19 @@ const paymentType = ref([
   },
 ]);
 const fileListCopy = ref([]);
-let dictsData = reactive({
-  payment_status: [],
-  account_currency: [],
-});
-proxy.getDict(["payment_status", "account_currency"]).then((res) => {
-  dictsData = res;
-  formConfig.value[11].data = res.account_currency.map((item) => {
+proxy.getDict(["account_currency", "founds_type"]).then((res) => {
+  accountCurrency.value = res.account_currency.map((item) => {
+    return {
+      label: item.dictValue,
+      value: item.dictKey,
+    };
+  });
+  fundsType.value = res.founds_type.map((item) => {
     return {
       label: item.dictValue,
       value: item.dictKey,
     };
   });
-  console.log(formConfig.value[11].data);
 });
 const openModal = () => {
   dialogVisible.value = true;
@@ -434,12 +393,9 @@ const selection = ref({
 });
 const select = (_selection, row) => {
   selection.value.data = _selection;
-  console.log(_selection.length);
 };
 
 const submitForm = () => {
-  console.log(fileList);
-
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
     proxy.post("/accountPayment/add", formData.data).then(
@@ -502,9 +458,7 @@ const handleSuccess = (res, file, files) => {
 };
 
 const handleRemove = (file) => {
-  const index = fileListCopy.value.findIndex(
-    (x) => x.uid === file.uid || x.id === file.id
-  );
+  const index = fileListCopy.value.findIndex((x) => x.uid === file.uid || x.id === file.id);
   fileListCopy.value.splice(index, 1);
 };