Browse Source

货代凭证 2024-2-27

caojunjie 1 year ago
parent
commit
2acf954da1

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

@@ -39,4 +39,11 @@ export const accountsSubmit = (row) => {
     data: row
   })
 }
-
+// 获取编号
+export const getAccountsCode = (params) => {
+  return request({
+    url: '/api/blade-los/accounts/getAccountsCode',
+    method: 'get',
+    params: params
+  })
+}

+ 9 - 0
src/api/vouchertemplate/index.js

@@ -39,4 +39,13 @@ export const vouchertemplateSubmit = (row) => {
     data: row
   })
 }
+// 凭证初始化
+export const initialization = (params) => {
+  return request({
+    url: '/api/blade-los/voucherTemplate/initialization',
+    method: 'get',
+    params: params
+  })
+}
+
 

+ 157 - 48
src/views/iosBasicData/VoucherTemplates/index.vue

@@ -41,27 +41,51 @@
                                @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 328)"
                                @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 328)" >
                         <template slot="menuLeft">
-                            <!--<el-button-->
-                            <!--    type="primary" icon="el-icon-plus"-->
-                            <!--    @click="addfun"-->
-                            <!--    size="small">新增-->
-                            <!--</el-button>-->
-                            <el-button type="danger"
-                                       size="small"
-                                       icon="el-icon-delete"
-                                       plain
-                                       @click="handleDelete">删 除
+                            <el-button
+                                type="primary"
+                                size="small" @click="initializationfun" >初始化
                             </el-button>
+                            <!--<el-button type="danger"-->
+                            <!--           size="small"-->
+                            <!--           icon="el-icon-delete"-->
+                            <!--           plain-->
+                            <!--           @click="handleDelete">删 除-->
+                            <!--</el-button>-->
                         </template>
+                        <!--<template slot-scope="{ row }" slot="currencyCodeForm" >-->
+                        <!--    <search-query :datalist="currencyData"-->
+                        <!--                  :selectValue="form.currencyCode"-->
+                        <!--                  :clearable="true"-->
+                        <!--                  :buttonIf="false"-->
+                        <!--                  placeholder="请选择币种"-->
+                        <!--                  :forParameter="{key:'id',label:'code',value:'code'}"-->
+                        <!--                  @remoteMethod="bcurrencyGetExratefun"-->
+                        <!--                  @corpChange="corpChange($event,'currencyCode')"-->
+                        <!--                  @corpFocus="bcurrencyGetExratefun" >-->
+                        <!--    </search-query>-->
+                        <!--</template>-->
+                        <template slot="subjectCodeForm" slot-scope="{ row }">
+                            <search-query :datalist="subjectData"
+                                          :selectValue="form.subjectCode"
+                                          :filterable="true"
+                                          :clearable="true"
+                                          :remote="true"
+                                          :buttonIf="false"
+                                          :forParameter="{key:'id',label:'code',value:'code'}"
+                                          @corpFocus="accountsListfun"
+                                          @corpChange="corpChange($event,'subjectCode')">
+                            </search-query>
+                        </template>
+
                     </avue-crud>
                 </basic-container>
             </el-col>
         </el-row>
 
         <!--类别弹窗-->
-        <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="60%" :before-close="corpTypeClose">
+        <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="70%" :before-close="corpTypeClose">
             <div>
-                <bvouchertype></bvouchertype>
+                <bbusinesstype></bbusinesstype>
             </div>
             <span slot="footer" class="dialog-footer">
                 <el-button @click="corpTypeVisible = false">取 消</el-button>
@@ -76,9 +100,21 @@
     import bvouchertype from "@/views/iosBasicData/bvouchertype/index.vue";
     import {bvouchertypelist} from "@/api/bvouchertype/index";
     import {mapGetters} from "vuex";
-    import {vouchertemplatelist, vouchertemplateDetail, vouchertemplateSubmit, vouchertemplateRemove} from "@/api/vouchertemplate/index";
+    import {
+        vouchertemplatelist,
+        vouchertemplateDetail,
+        vouchertemplateSubmit,
+        vouchertemplateRemove,
+        initialization
+    } from "@/api/vouchertemplate/index";
+    import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
+    import {bcurrencyGetExrate} from "@/api/iosBasicData/rateManagement";
+    import {getCurrentDate} from "@/util/date";
+    import {accountsList} from "@/api/iosBasicData/accounts";
+    import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
+    import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
     export default {
-        components: {bvouchertype},
+        components: {SearchQuery, bvouchertype,bbusinesstype},
         data() {
             return {
                 treeOption: {
@@ -99,6 +135,8 @@
                 form: {
                     // currencyCode:'RMB', // 币种代码
                 },
+                currencyData:[], // 币种数据
+                subjectData:[], // 科目数据
                 query: {},
                 loading: true,
                 page: {
@@ -120,29 +158,29 @@
                     viewBtn: true,
                     selection: true,
                     dialogClickModal: false,
+                    menuWidth:'100',
                     column: [
                         {
                             label: "币别代码",
                             prop: "currencyCode",
-                            type: 'select',
-                            dicUrl:'/api/blade-los/bcurrency/page?current=1&size=20',
-                            props: {
-                                label: "code",
-                                value: "id",
-                                res:'data.records'
-                            },
+                            // formslot:true,
                             overHidden:true,
+                            display:false,
+                            disabled: true
                         },
                         {
                             label: "币别名称",
                             prop: "currencyName",
                             overHidden:true,
-                            display: true
+                            display:false,
+                            disabled: true
                         },
                         {
                             label: "凭证类型",
                             prop: "voucherType",
                             overHidden:true,
+                            display:false,
+                            disabled: true
                         },
                         {
                             label: "凭证名称",
@@ -153,21 +191,32 @@
                             label: "类型",
                             prop: "dcType",
                             overHidden:true,
+                            display:false,
+                            disabled: true
                         },
                         {
                             label: "科目代码",
                             prop: "subjectCode",
+                            formslot:true,
                             overHidden:true,
                         },
                         {
                             label: "科目名称",
                             prop: "subjectName",
                             overHidden:true,
-                            display: true
+                            disabled: true
                         },
                         {
                             label: "金额方向",
                             prop: "amountDirection",
+                            type: 'select',
+                            dicData: [{
+                                label: '借',
+                                value: 'D'
+                            }, {
+                                label: '贷',
+                                value: 'C'
+                            }],
                             overHidden:true,
                         },
                         {
@@ -176,8 +225,25 @@
                             overHidden:true,
                         },
                         {
+                            label: "状态",
+                            prop: "status",
+                            type: 'select',
+                            overHidden:true,
+                            dicData: [{
+                                label: '启用',
+                                value: 0
+                            }, {
+                                label: '停用',
+                                value: 1
+                            }],
+                            value: 0
+                        },
+                        {
                             label: "附加公式",
                             prop: "additionalFormulas",
+                            type:'textarea',
+                            minRows: 2,
+                            span: 12,
                             overHidden:true,
                         },
                         {
@@ -217,23 +283,12 @@
                             display:false,
                         },
                         {
-                            label: "状态",
-                            prop: "status",
-                            type: 'select',
-                            overHidden:true,
-                            dicData: [{
-                                label: '启用',
-                                value: 0
-                            }, {
-                                label: '停用',
-                                value: 1
-                            }],
-                            value: 0
-                        },
-                        {
                             label: "备注",
                             prop: "remarks",
                             overHidden:true,
+                            type:'textarea',
+                            minRows: 2,
+                            span: 12,
                         },
                     ]
                 },
@@ -244,9 +299,9 @@
             ...mapGetters(["permission"]),
             permissionList() {
                 return {
-                    // addBtn: this.vaildData(this.permission.bvouchertype_add, false),
-                    // viewBtn: this.vaildData(this.permission.bvouchertype_view, false),
-                    // delBtn: this.vaildData(this.permission.bvouchertype_delete, false),
+                    addBtn: this.vaildData(this.permission.bvouchertype_add, false),
+                    viewBtn: this.vaildData(this.permission.bvouchertype_view, false),
+                    delBtn: this.vaildData(this.permission.bvouchertype_delete, false),
                     // editBtn: this.vaildData(this.permission.bvouchertype_edit, false)
                 };
             },
@@ -260,14 +315,46 @@
         },
         async created() {
             this.option = await this.getColumnData(this.getColumnName(328), this.optionBack);
-            this.bvouchertypelistfun()
+            this.bbusinesstypeListfun()
+            this.accountsListfun() // 科目
         },
         methods:{
-            // // 新增
-            // addfun(){
-            //     this.$refs.crud
-            // },
+            // 所属币别
+            corpChange(value,name){
+                if (name == 'currencyCode') {
+                    for(let item of this.currencyData) {
+                        if (item.code == value) {
+                            this.$set(this.form,'currencyCode',item.code)
+                            this.$set(this.form,'currencyName',item.cnName)
+                        }
+                    }
+                }
+                if (name == 'subjectCode') {
+                    for (let item of this.subjectData) {
+                        if (item.code == value) {
+                            this.$set(this.form,'subjectCode',item.code)
+                            this.$set(this.form,'subjectName',item.cnName)
+                        }
+                    }
+                }
+            },
+            // 获取币别数据
+            bcurrencyGetExratefun(){
+                bcurrencyGetExrate({
+                    date:getCurrentDate(), // 当前日期
+                    dc:'C'
+                }).then(res=>{
+                    this.currencyData = res.data.data
+                })
+            },
+            // 获取科目类型数据
+            accountsListfun(){
+                accountsList(1,10,).then(res=>{
+                    this.subjectData = res.data.data.records
+                })
+            },
             rowSave(row, done, loading) {
+                console.log(row,'添加')
                 vouchertemplateSubmit(row).then(() => {
                     this.onLoad(this.page);
                     this.$message({
@@ -281,6 +368,7 @@
                 });
             },
             rowUpdate(row, index, done, loading) {
+                console.log(row,'编辑')
                 vouchertemplateSubmit(row).then(() => {
                     this.onLoad(this.page);
                     this.$message({
@@ -383,10 +471,31 @@
                     this.selectionClear();
                 });
             },
+            // 初始化
+            initializationfun(){
+                if (!this.search.businessTypeId) {
+                    return this.$message.warning('请选择左侧的类型')
+                }
+                this.$confirm('初始化会清空数据', {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                }).then(()=>{
+                    initialization({
+                        businessTypeId:this.search.businessTypeId,
+                        businessType:this.search.businessType
+                    }).then(res=>{
+                        this.page.currentPage = 1;
+                        this.onLoad(this.page, this.search);
+                    })
+                })
+            },
             // 左侧筛选
             nodeClick(data) {
-                console.log(data,64)
                 this.search.businessTypeId = data.id
+                this.search.businessType = data.code
+                this.form.businessTypeId = data.id
+                this.form.businessType = data.code
                 // this.detailData.businessTypeId = data.id
                 // this.detailData.businessTypeCnName = data.cnName
                 // this.detailData.businessTypeEnName = data.enName
@@ -394,8 +503,8 @@
                 this.onLoad(this.page, this.search);
             },
             // 获取左侧业务类别数据
-            bvouchertypelistfun() {
-                bvouchertypelist(1,100,).then(res => {
+            bbusinesstypeListfun() {
+                bbusinesstypeList(1,100,{enableVoucher:'1'}).then(res => {
                     this.feesTypeData = res.data.data.records
                 })
             },

+ 6 - 1
src/views/iosBasicData/accounts/assembly/accountsDialog.vue

@@ -6,7 +6,7 @@
                     <el-col :span="12">
                         <el-form-item label="科目编码:" prop="code">
                             <el-input style="width: 100%;" v-model="form.code"
-                                      size="small" autocomplete="off"
+                                      size="small" autocomplete="off" @input="numinput"
                                       clearable placeholder="请输入科目编码" >
                             </el-input>
                         </el-form-item>
@@ -203,6 +203,7 @@ import {getRateList} from "@/api/iosBasicData/rateManagement";
 import {getBunitsPage} from "@/api/iosBasicData/bunits";
 import {baccitemstypeList} from "@/api/iosBasicData/baccitemstype";
 import {getWorkDicts} from "@/api/system/dictbiz";
+import {regularInteger} from "@/util/regularJudgment";
 
 export default {
     components: {SearchQuery},
@@ -232,6 +233,10 @@ export default {
         }
     },
     methods:{
+        // 科目代码只能输入整数数字
+        numinput(val){
+            this.$set(this.form,'code',regularInteger(val))
+        },
         // 金额计算
         countBlur(){
             this.$set(this.form,'price',this.form.price?Number(this.form.price):0) // 单价

+ 39 - 3
src/views/iosBasicData/accounts/index.vue

@@ -107,7 +107,13 @@
 </template>
 
 <script>
-  import {accountsList, accountsDetail, accountsSubmit, accountsRemove} from "@/api/iosBasicData/accounts";
+import {
+    accountsList,
+    accountsDetail,
+    accountsSubmit,
+    accountsRemove,
+    getAccountsCode
+} from "@/api/iosBasicData/accounts";
   import {mapGetters} from "vuex";
   import accountsDialog from "@/views/iosBasicData/accounts/assembly/accountsDialog.vue";
   import accountsDetails from "@/views/iosBasicData/accounts/accountsDetails.vue";
@@ -465,7 +471,24 @@
         },
         // 添加
       addAccountsfun(){
+          if (this.selectionList.length > 1) {
+              return this.$message.warning('只能选择一条数据')
+          }
           this.form = {}
+          if (this.selectionList.length == 1) {
+              getAccountsCode({code:this.selectionList[0].code}).then(res=>{
+                  this.$set(this.form,'code',res.data.data)
+              })
+          }
+          if (this.selectionList.length == 0) {
+              getAccountsCode({code:0}).then(res=>{
+                  this.$set(this.form,'code',res.data.data)
+              })
+          }
+          // 复制上默认值
+          this.form.isItem = '0'
+          this.form.curCode = 'CNY'
+          // 打开弹窗
           this.accountsVisible = true
           // this.isShow = false
       },
@@ -577,6 +600,13 @@
                 parentCode:row.code,
                 parentCnName:row.cnName,
             }
+            getAccountsCode({code:row.code}).then(res=>{
+                this.$set(this.form,'code',res.data.data)
+            })
+            // 复制上默认值
+            this.form.isItem = '0'
+            this.form.curCode = 'CNY'
+
             this.accountsVisible = true
         },
         // 核算期初
@@ -623,12 +653,18 @@
         this.query = {};
         this.onLoad(this.page);
       },
+        // 搜索按钮点击
       searchChange(params, done) {
-        this.query = params;
+        // this.query = params;
         this.page.currentPage = 1;
-        this.onLoad(this.page, params);
+        this.onLoad(this.page, this.query);
         done();
       },
+        // table 切换
+        handleClick(){
+            this.page.currentPage = 1;
+            this.onLoad(this.page, this.query);
+        },
       selectionChange(list) {
         this.selectionList = list;
       },

+ 14 - 0
src/views/iosBasicData/bbusinesstype/index.vue

@@ -126,6 +126,20 @@ export default {
               value: '1'
           },
           {
+              label: "是否凭证模版",
+              prop: "enableVoucher",
+              type: 'select',
+              overHidden:true,
+              dicData: [{
+                  label: '否',
+                  value: '0'
+              }, {
+                  label: '是',
+                  value: '1'
+              }],
+              value: '1'
+          },
+          {
             label: "创建人",
             prop: "createUserName",
             display: false,

+ 2 - 1
src/views/iosBasicData/finvouchers/assembly/fromtableDetails.vue

@@ -188,8 +188,9 @@
                         return;
                     }
                     const values = data.map(item => Number(item[column.property]));
-                    // 显示列的统计
+                    // 显示列的统计 金额
                     let arr = ['amountDr','amountCr','amountDrUsd','amountCrUsd']
+                    // 判断是否有这个数据
                     if (arr.indexOf(column.property) != -1) {
                         if (!values.every(value => isNaN(value))) {
                             sums[index] = values.reduce((prev, curr) => {