From 62c8502ec65cee7da6cb3e651bf351932d920733 Mon Sep 17 00:00:00 2001 From: lilu Date: Thu, 17 Nov 2022 19:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E8=88=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/modules/goodsTable.vue | 365 ++++++++++++++---- .../detail/modules/rightContent.vue | 238 ++++-------- 2 files changed, 362 insertions(+), 241 deletions(-) diff --git a/src/views/main/BookingLedger/detail/modules/goodsTable.vue b/src/views/main/BookingLedger/detail/modules/goodsTable.vue index ffddde0..9dec206 100644 --- a/src/views/main/BookingLedger/detail/modules/goodsTable.vue +++ b/src/views/main/BookingLedger/detail/modules/goodsTable.vue @@ -38,38 +38,30 @@ @ok="handleModelSubmit" @cancel="handleModelCancel" > -
-
-
- 箱型 - 箱量 - 箱号 - 封号 - 件数 - 包装 - 重量 - 尺码 - 箱皮重 - 称重方式 - 称重重量 -
- - -
- {{ pitem.ctnall }} - {{ pitem.ctnnum }} - {{ pitem.cntrno }} - {{ pitem.sealno }} - {{ pitem.pkgs }} - {{ pitem.kindpkgs }} - {{ pitem.kgs }} - {{ pitem.cbm }} - {{ pitem.tareweight }} - {{ pitem.weightype }} - {{ pitem.weighkgs }} -
-
-
+
+ +
+ 新增 + 删除 + 保存 +
+
+
@@ -259,6 +251,153 @@ export default { edit: true }, ], + modelColumns: [ + { + field: '', + key: 'radio', + type: 'radio', + title: '', + width: 40, + operationColumn: true, + align: 'center', + }, + { + field: 'ctnall', + key: 'ctnall', + title: '箱型', + align: 'left', + width: 80, + }, + { + field: 'ctnnum', + key: 'ctnnum ', + title: '箱量', + align: 'left', + }, + { + field: 'cntrno', + key: 'cntrno', + title: '箱号', + align: 'left', + }, + { + field: 'sealno', + key: 'sealno', + title: '封号', + align: 'left', + }, + { + field: 'pkgs', + key: 'pkgs', + title: '件数', + align: 'left', + }, + { + field: 'kindpkgs', + key: 'kindpkgs', + title: '包装', + align: 'left', + width: 130 + }, + { + field: 'weighkgs', + key: 'weighkgs', + title: '毛重', + align: 'left', + }, + { + field: 'cbm', + key: 'cbm', + title: '尺码', + align: 'left', + }, + ], + childColumns: [ + { + field: '', + key: 'checkbox', + type: 'checkbox', + title: '', + width: 40, + operationColumn: true, + align: 'center', + }, + { + field: 'pkgs', + key: 'pkgs', + title: '件数', + align: 'left', + edit: true, + }, + { + field: 'kindpkgs', + key: 'kindpkgs', + title: '包装', + align: 'left', + edit: false, + width: 130, + renderBodyCell: ({ row, column, rowIndex }, h) => { + return ( + { + const data = this.packageList[val] + row['kindpkgs'] = data.name + this.childTableData[rowIndex].kindpkgs = data.name + this.details.ctnInputs[this.childModelSelectIndex].ctnDetailInputs[rowIndex].kindpkgs = data.name + console.log(this.childTableData[rowIndex]) + this.$forceUpdate() + }} + > + { + this.packageList.map((item, index) => { + return ({item.name}) + }) + } + + ) + } + }, + { + field: 'weighkgs', + key: 'weighkgs', + title: '毛重', + align: 'left', + edit: true + }, + { + field: 'cbm', + key: 'cbm', + title: '尺码', + align: 'left', + edit: true, + }, + { + field: 'hscode', + key: 'hscode', + title: 'HS代码', + align: 'left', + edit: true, + }, + { + field: 'marks', + key: 'marks', + title: '唛头', + align: 'left', + edit: true, + }, + { + field: 'description', + key: 'description', + title: '货描', + align: 'left', + edit: true, + }, + ], tableData: [], editOption: { beforeCellValueChange: ({ row, column, changeValue }) => { @@ -313,6 +452,69 @@ export default { console.log('编辑', row, column) }, }, + editChildOption: { + beforeCellValueChange: ({ row, column, changeValue }) => { + console.log('beforeCellValueChange') + console.log('row::', row) + console.log('column::', column) + console.log('changeValue::', changeValue) + if (['pkgs', 'kgs', 'cbm'].includes(column.field) && !/^\d+$/.test(changeValue)) { + const height = document.body.clientHeight - 100 + this.$message.config({ + top: `${height}px`, + duration: 2, + maxCount: 3 + }); + this.$message.error(`输入的${this.enmuErrorLabel(column.field)}不符合规则`) + row['cntrno'] = '' + setTimeout(() => { + this.$message.destroy() + }, 2000) + return false + } + }, + afterCellValueChange: ({ row, column, changeValue }) => { + console.log('afterCellValueChange') + console.log('row::', row) + console.log('column::', column) + console.log('changeValue::', changeValue) + let num = null + this.childTableData.map((item, index) => { + if (row.rowKey === item.rowKey) { + // eslint-disable-next-line no-const-assign + num = index + } + }) + this.childTableData[num][column.field] = changeValue + this.details.ctnInputs[this.childModelSelectIndex].ctnDetailInputs[num][column.field] = changeValue + this.$forceUpdate() + // if (column.field === 'pkgs') { + // let num = 0 + // this.tableData.map((item, index) => { + // num += Number(item.pkgs) + // }) + // this.totalPkgs = num + // } + // if (column.field === 'kgs') { + // let num = 0 + // this.tableData.map((item, index) => { + // num += Number(item.kgs) + // }) + // this.totalKgs = num + // } + // if (column.field === 'cbm') { + // let num = 0 + // this.tableData.map((item, index) => { + // num += Number(item.cbm) + // }) + // this.totalCbm = num + // } + console.log('---') + }, + cellValueChange: ({ row, column }) => { + console.log('编辑', row, column) + }, + }, // 可控单元格编辑 rowStyleOption: { clickHighlight: false, @@ -336,6 +538,23 @@ export default { console.log('全选', isSelected, selectedRowKeys) }, }, + checkChildboxOption: { + hideSelectAll: false, + // 行选择改变事件 + selectedRowChange: ({ row, isSelected, selectedRowKeys }) => { + console.log('行选择', row, isSelected, selectedRowKeys) + this.selectChildArr = selectedRowKeys + }, + // 全选改变事件 + selectedAllChange: ({ isSelected, selectedRowKeys }) => { + if (isSelected) { + this.selectChildArr = selectedRowKeys + } else { + this.selectChildArr = [] + } + console.log('全选', isSelected, selectedRowKeys) + }, + }, tableLoaded: false, ctnList: [], packageList: [], @@ -346,14 +565,24 @@ export default { totalCbm: 0, moreVisible: false, moreModelconfirm: false, - radioStyle: { - display: 'block', - height: '40px', - lineHeight: '40px', - marginBottom: '10px', - width: '1200px', - padding: '0' + radioOption: { + // 行选择改变事件 + selectedRowChange: ({ row }) => { + console.log(row); + this.childModelSelect = row + this.tableData.map((item, index) => { + if (item.rowKey === row.rowKey) { + this.childModelSelectIndex = index + } + }) + this.childTableData = this.tableData[this.childModelSelectIndex].ctnDetailInputs || [] + // 写到这里了,有个报错 + }, }, + childTableData: [], + childModelSelect: null, + childModelSelectIndex: null, + selectChildArr: [] } }, watch: { @@ -451,7 +680,7 @@ export default { tareweight: '', weightype: '', weighkgs: '', - rowKey: Number(this.tableData[this.tableData.length - 1].rowKey) + 1 + rowKey: this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0 } this.tableData.push(data) }, @@ -467,10 +696,33 @@ export default { openDialog() { this.moreVisible = true }, + // 多品名维护保存 handleModelSubmit() { }, handleModelCancel() { + this.moreVisible = false + }, + addChildData() { + if (!this.childModelSelect) { + this.$message.error('请选择数据') + } + const data = { + rowKey: this.childTableData.length > 0 ? Number(this.childTableData[this.childTableData.length - 1].rowKey) + 1 : 0, + pkgs: '', + kindpkgs: '', + weighkgs: '', + cbm: '', + hscode: this.details.hscode, + marks: this.details.marks, + description: this.details.marks + } + this.childTableData.push(data) + }, + removeChildData() { + + }, + saveChildData() { } }, @@ -498,34 +750,11 @@ export default { } } -.parent-table{ - display: flex; - span{ - display: inline-block; - flex:1; - border-right: 1px solid #eee; - text-align: center; - &:nth-last-child(1){ - border: none; - } - } -} -.parent-table-title{ - display: block; - height: 40px; - line-height: 40px; - margin-bottom: 10px; - width: 1200px; - display: flex; - background: #f4f4f4; - margin-bottom: 0; - span{ - display: inline-block; - flex:1; - border-right: 1px solid #eee; - text-align: center; - &:nth-last-child(1){ - border: none; +.model-content{ + .model-botton-box{ + margin: 40px 0; + .btn{ + margin-right: 10px; } } } diff --git a/src/views/main/BookingLedger/detail/modules/rightContent.vue b/src/views/main/BookingLedger/detail/modules/rightContent.vue index d2605e7..168d79f 100644 --- a/src/views/main/BookingLedger/detail/modules/rightContent.vue +++ b/src/views/main/BookingLedger/detail/modules/rightContent.vue @@ -13,7 +13,7 @@
服务项目
-
{{ serive.fieldLabel }}
+
{{ serive.name }}
@@ -121,25 +121,24 @@ title="添加附件" :width="900" :visible="fileModelvisible" - :confirmLoading="fileModelconfirm" + :confirmLoading="uploading" cancelText="关闭" okText="保存" - @ok="fileModelSubmit" + @ok="handleUpload" @cancel="fileModelCancel" >
选择文件 - - {{ uploading ? '上传中' : '确定' }} - +
+
附件类型:
+ + + {{ attach.name }} + + +
@@ -147,7 +146,7 @@ @@ -747,4 +629,14 @@ export default { } } } +.uplad-type{ + display: flex; + margin-top: 20px; + .upload-label{ + height: 30px; + line-height: 30px; + font-size: 14px; + color: #666; + } +}