Browse Source

Merge branch 'dev' of http://git.echepei.com/tire-platform/Smart_platform_ui into dev

Qukatie 1 day ago
parent
commit
1fda9673b1

+ 8 - 0
src/api/iosBasicData/accounts.js

@@ -66,3 +66,11 @@ export const balanceCheck = () => {
   })
 }
 
+// 科目入账
+export const accountsPost = () => {
+  return request({
+    url: '/api/blade-los/accounts/post',
+    method: 'get',
+  })
+}
+

+ 13 - 5
src/api/iosBasicData/periodManagement.js

@@ -8,7 +8,7 @@ export const getList = (params) => {
     })
 }
 //清除选定财务账
-export const init = (data) => {
+export const initPeriod = (data) => {
     return request({
         url: '/api/blade-los/finperiod/init',
         method: 'post',
@@ -40,7 +40,7 @@ export const revokeLocking = (data) => {
     })
 }
 //结转
-export const close = (data) => {
+export const closePeriod = (data) => {
     return request({
         url: '/api/blade-los/finperiod/close',
         method: 'post',
@@ -48,7 +48,7 @@ export const close = (data) => {
     })
 }
 //反结转
-export const unclose= (data) => {
+export const unClosePeriod= (data) => {
     return request({
         url: '/api/blade-los/finperiod/unclose',
         method: 'post',
@@ -56,13 +56,21 @@ export const unclose= (data) => {
     })
 }
 //月末结转列表
-export const currentPeriod = (params) => {
+export const getPeriodVouchersTemplate = (params) => {
     return request({
-        url: '/api/blade-los/finperiod/currentPeriod',
+        url: '/api/blade-los/finperiod/getPeriodVouchersTemplate',
         method: 'get',
         params: params
     })
 }
+//月末结转列表
+export const getCurrentPeriod = (params) => {
+  return request({
+    url: '/api/blade-los/finperiod/currentPeriod',
+    method: 'get',
+    params: params
+  })
+}
 //模版新增或修改
 export const submit= (data) => {
     return request({

+ 27 - 19
src/views/iosBasicData/accounts/index.vue

@@ -131,6 +131,7 @@ import {
   getAccountsCode,
   getAccountsLazyTree,
   balanceCheck,
+  accountsPost,
 } from "@/api/iosBasicData/accounts";
 import { mapGetters } from "vuex";
 import accountsDialog from "@/views/iosBasicData/accounts/assembly/accountsDialog.vue";
@@ -162,7 +163,7 @@ export default {
       treeOption: {
         nodeKey: "id",
         lazy: true,
-        iconClassField: 'icon',
+        iconClassField: "icon",
         treeLoad: function (node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
           getAccountsLazyTree(parentId).then((res) => {
@@ -171,7 +172,7 @@ export default {
                 let n = {
                   ...item,
                   leaf: !item.hasChildren,
-                  icon: 'el-icon-document',
+                  icon: "el-icon-document",
                 };
                 return n;
               })
@@ -792,30 +793,38 @@ export default {
         });
     },
     // 平衡检查
-    async handleBalanceCheck (){
+    async handleBalanceCheck() {
       this.loading = true;
-      try{
+      try {
         await balanceCheck().then((res) => {
-          if(res.data.msg==="success"){
-            this.$messsage.success("账户全部符合平衡检查!");
-          }else{
-            this.$alert(
-              "下列问题导致账户不平衡:<br >" + res.data.data.replaceAll("\n", "<br />"),
-              "账户平衡检查",
-              {
-                customClass: 'custom-alert',
-                dangerouslyUseHTMLString: true,
-              }
-            );
+          if (res.data.msg === "success") {
+            this.$message.success("账户全部符合平衡检查!");
+          } else {
+            this.$alert("下列问题导致账户不平衡:<br >" + res.data.data.replaceAll("\n", "<br />"), "账户平衡检查", {
+              customClass: "custom-alert",
+              dangerouslyUseHTMLString: true,
+            });
           }
         });
-      }finally {
+      } finally {
         this.loading = false;
       }
     },
     // 科目入账
-    async handleAccountsPost(){
-
+    async handleAccountsPost() {
+      this.loading = true;
+      try {
+        await accountsPost().then((res) => {
+          let postedAccounts = Array.isArray(res.data.data) ? res.data.data : [];
+          if(postedAccounts.length > 0) {
+            this.$message.success(`本次入账 ${postedAccounts.length} 个科目!`);
+          }else{
+            this.$message.warning("没有入账任何科目!");
+          }
+        });
+      } finally {
+        this.loading = false;
+      }
     },
     // 打开弹窗调用详情接口
     beforeOpen(done, type) {
@@ -975,7 +984,6 @@ export default {
 ::v-deep .el-col-md-8 {
   width: 24.33333%;
 }
-
 </style>
 <style>
 .custom-alert {

+ 39 - 0
src/views/iosBasicData/bfeesdefine/detailsPage.vue

@@ -0,0 +1,39 @@
+<template></template>
+
+<script>
+import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
+import { getToken } from "@/util/auth";
+
+export default {
+  components: {
+    SearchQuery,
+  },
+  props: {
+    detailData: {
+      type: Object,
+    },
+  },
+  data() {
+    return {
+      tenantId: JSON.parse(localStorage.getItem("saber-userInfo")).content.tenant_id,
+      // tab标签
+      activeName: "kgxq",
+      // 远程搜索
+      loading: false,
+      headers: { "Blade-Auth": "Bearer " + getToken() },
+
+      formData: {
+        status: 0,
+        corpsFeesElements: [],
+      },
+      rules: {
+      },
+    };
+  },
+  computed: {},
+  watch: {},
+  created() {},
+};
+</script>
+
+<style scoped></style>

+ 2 - 1
src/views/iosBasicData/bfeesdefine/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-row>
+    <el-row v-show="isShow">
       <el-col :span="4">
         <div class="box">
           <el-scrollbar>
@@ -129,6 +129,7 @@ export default {
   components: { bunits, bfeesdetype, rateManagement, SearchQuery, baccelements },
   data() {
     return {
+      isShow: true,
       // 是否禁用
       searchDisabled: false,
       // 类别弹窗的开启

+ 143 - 84
src/views/iosBasicData/periodManagement/index.vue

@@ -19,10 +19,14 @@
             :page.sync="page"
           >
             <template slot-scope="{ type, size, row, index }" slot="menu">
+              <!--
               <el-button size="small" :type="type" :disabled="row.lockingStatus != 0" @click="lock(row, 1)">锁定</el-button>
               <el-button size="small" :type="type" :disabled="row.lockingStatus != 1 || row.isClosed != 0" @click="lock(row, 2)">撤销锁定</el-button>
               <el-button size="small" :type="type" :disabled="row.lockingStatus != 1 || row.isClosed != 0" @click="inClose(row, 1)">结转</el-button>
               <el-button size="small" :type="type" :disabled="row.isClosed != 1" @click="inClose(row, 2)">反结转</el-button>
+              -->
+              <el-button v-if="row.isClosed == 0" size="small" :type="type" @click="closePeriod(row, 1)">结转</el-button>
+              <el-button v-if="row.isClosed != 0" size="small" :type="type" @click="closePeriod(row, 2)">反结转</el-button>
             </template>
             <template slot-scope="{ type, size, row, $index }" slot="menuLeft">
               <el-button
@@ -32,7 +36,7 @@
                   openDialog = true;
                   title = '开账';
                 "
-                v-if="showBut"
+                v-if="!currentPeriod.isValid"
                 >开 账</el-button
               >
               <el-button
@@ -42,12 +46,14 @@
                   openDialog = true;
                   title = '账套初始化';
                 "
-                v-if="!showBut"
+                v-if="currentPeriod.isValid"
                 >账套初始化</el-button
               >
+              <span v-if="currentPeriod.isValid">当前期间: {{ currentPeriod.period }} 账套开账期间: {{ currentPeriod.openPeriod.period }}</span>
             </template>
           </avue-crud>
         </el-tab-pane>
+        <!--
         <el-tab-pane label="月末结转" name="second">
           <avue-crud
             :option="option2"
@@ -67,12 +73,13 @@
               <el-button size="small" :type="type" @click="editOpen(row)">模板修改</el-button>
               <el-button size="small" :type="type" @click="generate(row)">生成凭证</el-button>
             </template>
-            <!-- <template slot-scope="{type,size,row,$index}" slot="menuLeft">
+            <template slot-scope="{type,size,row,$index}" slot="menuLeft">
                             <el-button icon="el-icon-plus" type="primary" size="small"
                                 @click="detailsOpen = true">新建申请</el-button>
-                        </template> -->
+            </template>
           </avue-crud>
         </el-tab-pane>
+        -->
       </el-tabs>
     </basic-container>
     <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData"> </detailsPage>
@@ -116,7 +123,7 @@
       <span slot="footer" class="dialog-footer">
         <el-button size="mini" @click="openDialog = false">取 消</el-button>
         <el-button v-if="title == '开账'" size="mini" type="primary" @click="openPeriod">确 定</el-button>
-        <el-button v-else-if="title == '账套初始化'" size="mini" type="primary" @click="resetBill">确 定</el-button>
+        <el-button v-else-if="title == '账套初始化'" size="mini" type="primary" @click="resetPeriod">确 定</el-button>
         <el-button v-else-if="title == '汇兑损益汇率'" size="mini" type="primary" @click="inPeriod">确 定</el-button>
         <el-button v-else-if="title == '期间损益汇率'" size="mini" type="primary" @click="inPeriod">确 定</el-button>
       </span>
@@ -146,7 +153,7 @@
 <script>
 import {
   getList,
-  currentPeriod,
+  getCurrentPeriod,
   init,
   locking,
   revokeLocking,
@@ -156,6 +163,9 @@ import {
   submitPeriod,
   getPeriodExchangeRate,
   openPeriod,
+  getPeriodVouchersTemplate,
+  closePeriod,
+  initPeriod,
 } from "@/api/iosBasicData/periodManagement";
 import detailsPage from "./detailsPage";
 import { defaultDate4 } from "@/util/date";
@@ -393,7 +403,9 @@ export default {
         align: "center",
         size: "small",
         menuWidth: 200,
-        searchSpan: 6,
+        searchShow: true,
+        // searchSpan: 4,
+        searchMenuSpan: 6,
         searchIcon: true,
         searchIndex: 3,
         dialogWidth: "70%",
@@ -515,11 +527,24 @@ export default {
           },
         ],
       },
+
+      currentPeriod: {
+        periodYear: 0,
+        periodMonth: 0,
+        period: "",
+        isValid: false,
+        openPeriod: {
+          periodYear: 0,
+          periodMonth: 0,
+          period: "",
+        },
+      },
     };
   },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(366), this.optionList);
     this.option2 = await this.getColumnData(this.getColumnName(367), this.optionList2);
+    this.loadCurrentPeriod();
   },
   methods: {
     exportExcel(type) {
@@ -537,47 +562,90 @@ export default {
         this.handleClose4();
       }
     },
-    lock(row, type) {
+    async loadCurrentPeriod() {
+      await getCurrentPeriod({ type: "open" }).then((res) => {
+        if (res.data.success && res.data.data) {
+          this.currentPeriod = res.data.data;
+          this.currentPeriod.isValid = this.currentPeriod.periodYear > 0;
+          this.currentPeriod.period =
+            this.currentPeriod.periodYear > 0 ? this.currentPeriod.periodYear + " 年 " + this.currentPeriod.periodMonth + " 月" : "";
+          if (this.currentPeriod.isValid) {
+            this.currentPeriod.openPeriod.period =
+              this.currentPeriod.openPeriod.periodYear > 0
+                ? this.currentPeriod.openPeriod.periodYear + " 年 " + this.currentPeriod.openPeriod.periodMonth + " 月"
+                : "";
+          } else {
+            this.currentPeriod.openPeriod = {
+              periodYear: 0,
+              periodMonth: 0,
+              period: "",
+            };
+          }
+        } else {
+          this.currentPeriod = {
+            periodYear: 0,
+            periodMonth: 0,
+            period: "",
+            isValid: false,
+            openPeriod: {
+              periodYear: 0,
+              periodMonth: 0,
+              period: "",
+            },
+          };
+        }
+      });
+    },
+    openPeriod() {
+      if (!this.openDate) {
+        return this.$message.warning("请选择开账月份!");
+      }
+      this.$confirm("确认开账?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.loading = true;
+        openPeriod({ beginDate: this.openDate + "-01 00:00:00" })
+          .then((res) => {
+            this.$message.success("开账成功");
+            this.handleClick(this.activeName);
+            this.handleClose();
+          })
+          .finally(() => {
+            this.loading = false;
+          });
+      });
+    },
+    closePeriod(row, type) {
       if (type == "1") {
-        this.$confirm("是否锁定?", "提示", {
+        this.$confirm("是否结转?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning",
         }).then(() => {
           this.loading = true;
-          locking({ id: row.id })
+          closePeriod({ id: row.id })
             .then((res) => {
-              if (res.data.msg == "审核未通过") {
-                this.loading = false;
-                this.openDialog2 = true;
-                this.itemId = row.id;
-                this.dialogData = res.data.data;
-              } else if (res.data.msg == "凭证未记账") {
-                this.loading = false;
-                this.openDialog3 = true;
-                this.itemId = row.id;
-                this.dialogData2 = res.data.data;
-              } else {
-                this.loading = false;
-                this.$message.success("锁定成功");
-                this.handleClick(this.activeName);
-              }
+              this.loading = false;
+              this.$message.success("结转成功");
+              this.handleClick(this.activeName);
             })
             .finally(() => {
               this.loading = false;
             });
         });
       } else {
-        this.$confirm("是否撤销锁定?", "提示", {
+        this.$confirm("是否反结转?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning",
         }).then(() => {
           this.loading = true;
-          revokeLocking({ id: row.id })
+          unClosePeriod({ id: row.id })
             .then((res) => {
               this.loading = false;
-              this.$message.success("撤销锁定");
+              this.$message.success("反结转成功");
               this.handleClick(this.activeName);
             })
             .finally(() => {
@@ -586,35 +654,70 @@ export default {
         });
       }
     },
-    inClose(row, type) {
+    resetPeriod() {
+      if (!this.openDate) {
+        return this.$message.warning("请选择初始化月份!");
+      }
+
+      this.$confirm("确认账套初始化?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.loading = true;
+        initPeriod({ beginDate: this.openDate + "-01 00:00:00" })
+          .then((res) => {
+            this.loading = false;
+            this.$message.success("初始化成功");
+            this.handleClick(this.activeName);
+            this.handleClose();
+          })
+          .finally(() => {
+            this.loading = false;
+          });
+      });
+    },
+    lock(row, type) {
       if (type == "1") {
-        this.$confirm("是否结转?", "提示", {
+        this.$confirm("是否锁定?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning",
         }).then(() => {
           this.loading = true;
-          close({ id: row.id })
+          locking({ id: row.id })
             .then((res) => {
-              this.loading = false;
-              this.$message.success("结转成功");
-              this.handleClick(this.activeName);
+              if (res.data.msg == "审核未通过") {
+                this.loading = false;
+                this.openDialog2 = true;
+                this.itemId = row.id;
+                this.dialogData = res.data.data;
+              } else if (res.data.msg == "凭证未记账") {
+                this.loading = false;
+                this.openDialog3 = true;
+                this.itemId = row.id;
+                this.dialogData2 = res.data.data;
+              } else {
+                this.loading = false;
+                this.$message.success("锁定成功");
+                this.handleClick(this.activeName);
+              }
             })
             .finally(() => {
               this.loading = false;
             });
         });
       } else {
-        this.$confirm("是否反结转?", "提示", {
+        this.$confirm("是否撤销锁定?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning",
         }).then(() => {
           this.loading = true;
-          unclose({ id: row.id })
+          revokeLocking({ id: row.id })
             .then((res) => {
               this.loading = false;
-              this.$message.success("反结转成功");
+              this.$message.success("撤销锁定");
               this.handleClick(this.activeName);
             })
             .finally(() => {
@@ -623,27 +726,6 @@ export default {
         });
       }
     },
-    openPeriod() {
-      if (!this.openDate) {
-        return this.$message.warning("请选择开账月份!");
-      }
-      this.$confirm("确认开账?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      }).then(() => {
-        this.loading = true;
-        openPeriod({ beginDate: this.openDate + "-01 00:00:00" })
-          .then((res) => {
-            this.$message.success("开账成功");
-            this.handleClick(this.activeName);
-            this.handleClose();
-          })
-          .finally(() => {
-            this.loading = false;
-          });
-      });
-    },
     handleClose() {
       this.itemForm = {};
       this.openDate = null;
@@ -663,29 +745,6 @@ export default {
       this.dialogData2 = [];
       this.openDialog3 = false;
     },
-    resetBill() {
-      if (!this.openDate) {
-        return this.$message.warning("请选择初始化月份!");
-      }
-
-      this.$confirm("确认账套初始化?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      }).then(() => {
-        this.loading = true;
-        init({ beginDate: this.openDate + "-01 00:00:00" })
-          .then((res) => {
-            this.loading = false;
-            this.$message.success("初始化成功");
-            this.handleClick(this.activeName);
-            this.handleClose();
-          })
-          .finally(() => {
-            this.loading = false;
-          });
-      });
-    },
     handleClick(val) {
       if (val == "first") {
         this.onLoad(this.page, this.search);
@@ -758,8 +817,8 @@ export default {
       done();
       this.onLoad(this.page, params);
     },
-    onLoad(page, params = {}) {
-      console.log(params);
+    async onLoad(page, params = {}) {
+      await this.loadCurrentPeriod();
       params = {
         ...Object.assign(params, this.search),
         current: page.currentPage,
@@ -791,7 +850,7 @@ export default {
         ...params,
       };
       this.loading = true;
-      currentPeriod(params)
+      getPeriodVouchersTemplate(params)
         .then((res) => {
           this.dataList2 = res.data.data;
           this.loading = false;