Преглед изворни кода

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

Qukatie пре 6 дана
родитељ
комит
4855a74c8c

+ 23 - 0
src/api/iosBasicData/reports.js

@@ -82,3 +82,26 @@ export const generateMailFile = (row) => {
         data: row
     })
 }
+
+export const getDocumentTypesList = (current, size, params) => {
+    return request({
+        url: '/api/blade-los/bdocumenttypes/list',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+        }
+    })
+}
+
+export const getDocumentTypesListAll = (params) => {
+    return request({
+        url: '/api/blade-los/bdocumenttypes/listAll',
+        method: 'get',
+        params: {
+            ...params,
+        }
+    })
+}
+

+ 215 - 30
src/views/iosBasicData/SeafreightExportF/bills/assembly/DocumentCenter.vue

@@ -82,7 +82,7 @@
                 @refresh-change="PreviewRefreshChange">
                 <template slot-scope="scope" slot="menu">
                     <el-link type="primary" :disabled="scope.row.status == 1"
-                        @click="handleReportPreview(scope.row.url, documentForm)">预览报表</el-link>
+                        @click="handleReportPreview(scope.row, scope.row.url, documentForm)">预览报表</el-link>
                 </template>
             </avue-crud>
         </el-dialog>
@@ -95,7 +95,9 @@ import {
     reportsGetReportData,
     reportsDetail,
     reportsRemove,
-    getList
+    getList,
+    getDocumentTypesList,
+    getDocumentTypesListAll,
 } from "@/api/iosBasicData/reports";
 import { reportslogList, reportslogSubmit } from "@/api/iosBasicData/bills";
 import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
@@ -229,7 +231,7 @@ export default {
             reportTypeData: [
                 {
                     label: '入货通知',
-                    cnName: '入货通知',
+                    // cnName: '入货通知',
                     classifyCode: '单证',
                     groupCode: '入货通知',
                     reportsType: 'RHTZ',
@@ -238,7 +240,7 @@ export default {
                 },
                 {
                     label: '派车通知单',
-                    cnName: '派车通知单',
+                    // cnName: '派车通知单',
                     classifyCode: '单证',
                     groupCode: '派车通知单',
                     reportsType: 'PCTZD',
@@ -247,25 +249,43 @@ export default {
                 },
                 {
                     label: 'HBL BOOKING SHEET',
-                    cnName: '提单详情(H)',
+                    // cnName: '提单详情(H)',
                     classifyCode: '单证',
                     groupCode: '提单详情(H)',
                     reportsType: 'TDXQ',
                     businessType: 'HYCK',
-                    params: "",
+                    params: {
+                        marks:{
+                            lineLength: 22,
+                            lineCount: 18,
+                        },
+                        commodityDescr:{
+                            lineLength: 18,
+                            lineCount: 18,
+                        },
+                    },
                 },
                 {
                     label: 'MBL BOOKING SHEET',
-                    cnName: '提单详情(M)',
+                    // cnName: '提单详情(M)',
                     classifyCode: '单证',
                     groupCode: '提单详情(M)',
                     reportsType: 'MBL BOOKING SHEET',
                     businessType: 'HYCK',
-                    params: "",
+                    params: {
+                        marks:{
+                            lineLength: 22,
+                            lineCount: 18,
+                        },
+                        commodityDescr:{
+                            lineLength: 18,
+                            lineCount: 18,
+                        },
+                    },
                 },
                 {
                     label: 'JMS 提单',
-                    cnName: 'JMS 提单',
+                    // cnName: 'JMS 提单',
                     classifyCode: '单证',
                     groupCode: 'JMS提单',
                     reportsType: 'JMS-BILL',
@@ -279,11 +299,19 @@ export default {
                         marksAddCntrNoSealNoList: true,
                         // 唛头是否添加箱号件重尺
                         marksAddCntrPGVList: true,
+                        marks:{
+                            lineLength: 22,
+                            lineCount: 18,
+                        },
+                        commodityDescr:{
+                            lineLength: 18,
+                            lineCount: 18,
+                        },
                     },
                 },
                 {
                     label: 'CTO',
-                    cnName: 'CTO',
+                    // cnName: 'CTO',
                     classifyCode: '单证',
                     groupCode: 'CTO',
                     reportsType: 'CTO',
@@ -297,11 +325,19 @@ export default {
                         marksAddCntrNoSealNoList: true,
                         // 唛头是否添加箱号件重尺
                         marksAddCntrPGVList: true,
+                        marks:{
+                            lineLength: 22,
+                            lineCount: 18,
+                        },
+                        commodityDescr:{
+                            lineLength: 18,
+                            lineCount: 18,
+                        },
                     },
                 },
                 {
                     label: '订舱委托书',
-                    cnName: '订舱委托书',
+                    // cnName: '订舱委托书',
                     classifyCode: '单证',
                     groupCode: '提单详情',
                     reportsType: 'DCWTS',
@@ -310,7 +346,7 @@ export default {
                 },
                 {
                     label: '运费证明',
-                    cnName: 'FREIGHT NOTE',
+                    // cnName: 'FREIGHT NOTE',
                     classifyCode: '单证',
                     groupCode: 'FREIGHT NOTE',
                     reportsType: 'FREIGHT NOTE',
@@ -395,7 +431,7 @@ export default {
                 this.textareaNumber = res.data.data
             }
         })
-        // this.reportsListfun()
+        this.reportsListfun()
     },
     methods: {
         // 打印预览按钮
@@ -412,7 +448,7 @@ export default {
             });
             this.$nextTick(() => {
                 if (data.length == 1) {
-                    this.handleReportPreview(data[0].url, this.documentForm)
+                    this.handleReportPreview(data[0], data[0].url, this.documentForm)
                 } else {
                     this.previewDialog = true
                     this.documentVisible = false
@@ -512,7 +548,7 @@ export default {
                 this.$message.warning("请先保存数据");
                 return;
             }
-            if (!this.businesstypeData.cnName) {
+            if (!this.businesstypeData.label) {
                 this.$message.warning("请先选择报表类型");
                 return
             }
@@ -539,7 +575,7 @@ export default {
         },
         // 编辑
         printEditing(row) {
-            if (!this.businesstypeData.cnName) {
+            if (!this.businesstypeData.label) {
                 this.$message.warning("请先选择报表类型");
                 return
             }
@@ -649,7 +685,7 @@ export default {
                         }).then(_ => {
                             // 成功操作。。。。
                             this.documenturl = documentaa
-                            this.handleReportPreview(this.documenturl, this.documentForm)
+                            this.handleReportPreview(obj, this.documenturl, this.documentForm)
                             this.reportslogListfun(this.documentPage, { ...this.query, reportsCode: res.data.data.reportsCode });
                             this.editData = {}
                             this.documentForm = {}
@@ -685,16 +721,42 @@ export default {
             this.reportslogListfun(this.documentPage, { reportsType: data.reportsType });
         },
         // 左侧数据获取
-        // reportsListfun(){
-        //     reportsList(1,20,{
-        //         businessType:'HYCK',
-        //         classifyCode:'单证',
-        //         groupCode:'派车通知单,入货通知,提单详情',
-        //         code:'BZRHTZ,TDXQ,PCTZD,'
-        //     }).then(res=>{
-        //         this.reportTypeData = res.data.data.records
-        //     })
-        // },
+        reportsListfun(){
+            // reportsList(1,20,{
+            //     businessType:'HYCK',
+            //     classifyCode:'单证',
+            //     groupCode:'派车通知单,入货通知,提单详情',
+            //     code:'BZRHTZ,TDXQ,PCTZD,'
+            // }).then(res=>{
+            //     this.reportTypeData = res.data.data.records
+            // })
+            /*
+            getDocumentTypesList(1, 100,{
+                businessType:'HYCK',
+            }).then(res=>{
+                console.log("bdocumentTypes.list", res.data.data.records)
+                // this.reportTypeData = res.data.data.records
+            })
+             */
+            getDocumentTypesListAll({
+                businessType:'HYCK',
+            }).then(res=>{
+                res.data.data.forEach(r=>{
+                    r.label = r.typeName
+                    r.cnName = r.typeName
+                    if(r.params){
+                        try {
+                            r.params = JSON.parse(r.params);
+                        }catch (e){
+                            r.params = "";
+                        }
+                    }else
+                        r.params = "";
+                })
+                // console.log("bdocumentTypes.listAll", res.data.data)
+                this.reportTypeData = res.data.data
+            })
+        },
         // 类别弹窗关闭
         corpTypeClose(done) {
             console.log(1111)
@@ -743,9 +805,93 @@ export default {
             })
         },
         // 预览报表
-        handleReportPreview(url, data) {
-            console.log(url, 1670)
-            console.log(data, 1671)
+        //去除首尾空格
+        removeHeadTailSpace(txt) {
+            if(typeof txt=="string"){
+                return txt.replace(/^\s*|\s*$/g, "")
+            }else{
+                return ''
+            }
+        },
+        formatBLText (s, lineLen){
+            let reg = /^[A-Za-z0-9]$/g
+            let lines=[]
+            if(s){
+                // this.removeHeadTailSpace(s)
+                var lns1=s.split(/\r\n|\r|\n/), lns=[]
+                lns1.forEach(ln=>{
+                    // this.removeHeadTailSpace(ln)
+                    var line=ln
+                    // if(line){
+                    lns.push(line)
+                    // }
+                })
+
+                while(lns.length>0){
+                    let ln=lns[0]
+                    let lnLen=ln.length
+
+                    if (lnLen <= lineLen) {
+                        lines.push(ln)
+                        lns.splice(0, 1)
+                    } else {
+                        reg.lastIndex=0
+                        if (reg.test(ln.charAt(lineLen - 1))) {
+                            // 字母和数字,不截断单词
+                            //倒序查
+                            let pos1 = lineLen - 2
+                            let isWord = true
+                            while (pos1 >= 0) {
+                                reg.lastIndex=0
+                                if (reg.test(ln.charAt(pos1))) {
+                                    pos1 -= 1
+                                    continue
+                                } else {
+                                    isWord = false
+                                    break
+                                }
+                            }
+
+                            //不是单词断开了
+                            if (!isWord) {
+                                lines.push(ln.substr(0, pos1 + 1))
+                                ln = ln.substr(pos1 + 1, lnLen - (pos1 + 1))
+                                lnLen = ln.length
+                            }
+                            //最后一直是则直接截取
+                            else {
+                                lines.push(ln.substr(0, lineLen))
+                                ln = ln.substr(lineLen, lnLen - lineLen)
+                                lnLen = ln.length
+                            }
+                        } else {
+                            // 不是字母和数字,直接截取
+                            lines.push(ln.substr(0, lineLen))
+                            ln = ln.substr(lineLen, lnLen - lineLen)
+                            lnLen = ln.length
+                        }
+
+                        if (lnLen > 0) {
+                            if (lns.length > 1) {
+                                // lns[1] = ln + ' ' + lns[1]
+                                // lns.unshift(ln)
+                                lns[0] = ln
+                            } else {
+                                lns.push(ln)
+                                lns.splice(0, 1)
+                            }
+                        }
+                    }
+                }
+            }
+
+            return lines
+        },
+        handleReportPreview(row, url, data) {
+            let rptType = this.reportTypeData.find(r=>r.groupCode == row.groupCode)
+            console.log('rptType', rptType)
+            // console.log(url, 1670)
+            // console.log(data, 1671)
             // 处理时间
             data.end = data.end ? data.end.slice(0, 10) : ''
             data.goodsTime = data.goodsTime ? data.goodsTime.slice(0, 10) : ''
@@ -869,6 +1015,7 @@ export default {
             //     data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
             // }
 
+            /*
             if (data.commodityDescr) {
                 var descriptionIndex2 = data.commodityDescr.indexOf('\n')
                 for (let i = 0; i < 19; i++) {
@@ -883,6 +1030,44 @@ export default {
                     data.extraLongText = extraLongText
                 }
             }
+            */
+            console.log('rptType.params', rptType.params)
+            if(rptType && rptType.params){
+                let m = rptType.params.marks
+                if(m){
+                    console.log('rptType.params.marks', m)
+                    if(m.lineLength && m.lineLength>0){
+                        data.marks = this.formatBLText(data.marks, m.lineLength).join('\n')
+                        console.log('data.marks', data.marks)
+                    }
+                    if(m.lineCount && m.lineCount>0){
+                        var lns1=data.marks.split(/\r\n|\r|\n/)
+                        if(lns1.length>m.lineCount){
+                            data.hasLargeMarks = true
+                            data.largeMarks = data.marks
+                            data.marks = " SEE ATTACHED PAPER"
+                        }
+                        console.log('data.marks.lns1', lns1.Count)
+                    }
+                }
+                m = rptType.params.commodityDescr
+                if(m){
+                    console.log('rptType.params.commodityDescr', m)
+                    if(m.lineLength && m.lineLength>0){
+                        data.commodityDescr = this.formatBLText(data.commodityDescr, m.lineLength).join('\n')
+                        console.log('data.commodityDescr', data.marks)
+                    }
+                    if(m.lineCount && m.lineCount>0){
+                        var lns1=data.commodityDescr.split(/\r\n|\r|\n/)
+                        if(lns1.length>m.lineCount){
+                            data.hasLargeCommodityDescr = true
+                            data.largeCommodityDescr = data.commodityDescr
+                            data.commodityDescr = " SEE ATTACHED PAPER"
+                        }
+                        console.log('data.commodityDescr.lns1', lns1.Count)
+                    }
+                }
+            }
 
             // console.log(data.hshipperDetails, 'hshipperDetails2')
 

+ 2 - 2
src/views/iosBasicData/SeafreightExportF/bills/assembly/feecenter.vue

@@ -3025,11 +3025,11 @@ export default {
             if (this.business == 1) {
                 let similarDataD = similarValues(this.assemblyForm.feeCenterListD, 'feeCnName', 'curCode')
                 if (similarDataD) {
-                    return this.$message.error(`应收费用简称:${similarDataD.feeCnName}的币别不一致,请重新选择`);
+                    // return this.$message.error(`应收费用简称:${similarDataD.feeCnName}的币别不一致,请重新选择`);
                 }
                 let similarDataC = similarValues(this.assemblyForm.feeCenterListC, 'feeCnName', 'curCode')
                 if (similarDataC) {
-                    return this.$message.error(`应付费用简称:${similarDataC.feeCnName}的币别不一致,请重新选择`);
+                    // return this.$message.error(`应付费用简称:${similarDataC.feeCnName}的币别不一致,请重新选择`);
                 }
             }
             // 判断必填项

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

@@ -7,7 +7,8 @@
           <el-scrollbar>
             <basic-container>
               <avue-tree :option="treeOption" :data="feesTypeData" @node-click="nodeClick">
-                <template slot="addBtn">
+<!--                  不需要 -->
+                <template v-if="false" slot="addBtn">
                   <el-tooltip class="item" effect="dark" content="新建分类" placement="top">
                     <i class="el-icon-setting" style="font-size:18px;line-height: 30px;width: 20px;padding: 0 10px;"
                       @click="corpTypeVisible = true"></i>