achao 3 éve
szülő
commit
1588627ff5

+ 14 - 4
unimall-admin/src/api/MaritimeAdministration.js

@@ -46,14 +46,24 @@ export function deleteMaritimeAdministration(id) {
     }
   })
 }
+export function deleteMaritimeAdministrationLi(id) {
+  return request({
+    method: 'post',
+    params: {
+      _gp: 'admin.maritimedetail',
+      _mt: 'delete',
+      id: id
+    }
+  })
+}
 
-export function exportXlsx(data) {
+export function exportXlsx(query) {
   return request({
     method: 'post',
     data: Qs.stringify({
       _gp: 'admin.maritimeadministration',
       _mt: 'export',
-      MaritimeAdministrationDTO: JSON.stringify(data),
+      MaritimeAdministrationDTO: JSON.stringify(query.type),
       response: 'blob'
     })
   })
@@ -63,9 +73,9 @@ export function importWord(data) {
   return request({
     method: 'post',
     data: Qs.stringify({
-      _gp: 'admin.foreignexchange',
+      _gp: 'admin.maritimeadministration',
       _mt: 'createAll',
-      ForeignExchangeDTO: JSON.stringify(data)
+      MaritimeAdministrationDTO: JSON.stringify(data)
     })
   })
 }

+ 230 - 107
unimall-admin/src/views/maritimeAdministration/MaritimeAdministration.vue

@@ -7,7 +7,7 @@
         clearable
         class="filter-item"
         size="small"
-        style="width: 200px;"
+        style="width: 200px"
         placeholder="请输入集装箱柜号"
       />
       <el-input
@@ -15,7 +15,7 @@
         clearable
         class="filter-item"
         size="small"
-        style="width: 200px;"
+        style="width: 200px"
         placeholder="请输入客户编号"
       />
       <el-button
@@ -24,33 +24,40 @@
         size="mini"
         icon="el-icon-search"
         @click="handleFilter"
-      >查找</el-button>
+      >查找</el-button
+      >
       <el-button
         class="filter-item"
         type="primary"
         size="mini"
         icon="el-icon-edit"
         @click="handleCreate"
-      >添加</el-button>
+      >添加</el-button
+      >
       <el-button
         class="filter-item"
         type="primary"
         size="mini"
         icon="el-icon-edit"
-        @click="exportlist">导出</el-button>
+        @click="exportlist"
+      >导出</el-button
+      >
 
       <el-upload
         :on-change="importClick"
         :show-file-list="false"
         :auto-upload="false"
-        style="margin-left: 8px;margin-bottom:0"
+        style="margin-left: 8px; margin-bottom: 0"
         class="filter-item"
         action=""
-        accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
+        accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
+      >
         <el-button
           class="filter-item"
           type="primary"
-          icon="el-icon-edit">导入</el-button>
+          icon="el-icon-edit"
+        >导入</el-button
+        >
       </el-upload>
     </div>
 
@@ -64,11 +71,15 @@
       border
       fit
       highlight-current-row
-      @selection-change="handleSelectionChange">
-      <el-table-column :selectable="selectInit" type="selection"/>
-      <el-table-column align="center" label="快递公司" prop="courierServicesCompany" />
-      <el-table-column align="center" label="集装箱柜号" prop="containerNo" />
+    >
+      <!-- <el-table-column :selectable="selectInit" type="selection"/> -->
+      <el-table-column align="center" label="集装箱号" prop="containerNo" />
       <el-table-column align="center" label="客户编号" prop="customerNo" />
+      <el-table-column
+        align="center"
+        label="快递公司"
+        prop="courierServicesCompany"
+      />
       <el-table-column align="center" label="已收到单号" prop="receivedNo" />
       <el-table-column align="center" label="内件明细" prop="internalDetails" />
       <el-table-column align="center" label="实重" prop="weight" />
@@ -79,32 +90,44 @@
       <el-table-column align="center" label="包裹数" prop="count" />
       <el-table-column align="center" label="人民币" prop="rmb" />
       <el-table-column align="center" label="欧元" prop="euro" />
-      <el-table-column align="center" label="操作" class-name="small-padding" width="200px">
+      <el-table-column
+        align="center"
+        label="操作"
+        class-name="small-padding"
+        width="200px"
+      >
         <template slot-scope="scope">
           <el-button
-            v-permission="['maritimeAdministration:maritimeadministration:edit']"
+            v-permission="[
+              'maritimeAdministration:maritimeadministration:edit',
+            ]"
             type="primary"
             size="mini"
             @click="handleUpdate(scope.row)"
-          >编辑</el-button>
+          >编辑</el-button
+          >
           <el-button
-            v-permission="['maritimeAdministration:maritimeadministration:delete']"
+            v-permission="[
+              'maritimeAdministration:maritimeadministration:delete',
+            ]"
             type="danger"
             size="mini"
             @click="handleDelete(scope.row)"
-          >删除</el-button>
+          >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
 
     <el-pagination
       :current-page="currentPage"
-      :page-sizes="[100, 200, 300, 400,1000,1500,2000]"
+      :page-sizes="[100, 200, 300, 400, 1000, 1500, 2000]"
       :page-size="100"
       :total="total"
       layout="total, sizes, prev, pager, next, jumper"
       @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"/>
+      @current-change="handleCurrentChange"
+    />
 
     <!-- 添加或修改对话框 -->
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
@@ -125,13 +148,21 @@
         <el-form-item label="客户编号" prop="customerNo" class="item-style">
           <el-input v-model="dataForm.customerNo" />
         </el-form-item>
-        <el-form-item label="快递公司" prop="courierServicesCompany" class="item-style">
+        <el-form-item
+          label="快递公司"
+          prop="courierServicesCompany"
+          class="item-style"
+        >
           <el-input v-model="dataForm.courierServicesCompany" />
         </el-form-item>
         <el-form-item label="已收到单号" prop="receivedNo" class="item-style">
           <el-input v-model="dataForm.receivedNo" />
         </el-form-item>
-        <el-form-item label="内件明细" prop="internalDetails" class="item-style">
+        <el-form-item
+          label="内件明细"
+          prop="internalDetails"
+          class="item-style"
+        >
           <el-input v-model="dataForm.internalDetails" />
         </el-form-item>
         <el-form-item label="实重" prop="weight" class="item-style">
@@ -162,12 +193,19 @@
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogFormVisible = false">取消</el-button>
         <el-button
-          v-if="dialogStatus=='create'"
+          v-if="dialogStatus == 'create'"
           :loading="submiting"
           type="primary"
           @click="createData"
-        >确定</el-button>
-        <el-button v-else :loading="submiting" type="primary" @click="updateData">确定</el-button>
+        >确定</el-button
+        >
+        <el-button
+          v-else
+          :loading="submiting"
+          type="primary"
+          @click="updateData"
+        >确定</el-button
+        >
       </div>
     </el-dialog>
   </div>
@@ -179,6 +217,7 @@ import {
   createMaritimeAdministration,
   updateMaritimeAdministration,
   deleteMaritimeAdministration,
+  deleteMaritimeAdministrationLi,
   exportXlsx,
   importWord
 } from '@/api/MaritimeAdministration'
@@ -188,6 +227,8 @@ export default {
   components: { Pagination },
   data() {
     return {
+      tableSelection: [],
+      tableSelectIndex: '',
       modification: [],
       currentPage: 1,
       tableList: [],
@@ -223,23 +264,14 @@ export default {
     selectInit(row) {
       return true
     },
-    async exportlist() { debugger
-      if (this.modification.length == 0) {
-        this.$message.warning('请选择要导出的条目!')
-      } else {
-        console.log('导出数据', this.modification)
-        const _data = {
-          maritimeDetailDTOS: this.modification
+    async exportlist() {
+      debugger
+      const { data } = await exportXlsx(this.listQuery).then((response) => {
+        debugger
+        this.download(response.data.data)
+        if (response.status == '200') {
         }
-        const {
-          data
-        } = await exportXlsx(_data).then((response) => {
-          this.download(response.data.data)
-          if (response.status == '200') {
-
-          }
-        })
-      }
+      })
     },
     importClick(file, fileList) {
       this.fileTemp = file.raw
@@ -280,6 +312,7 @@ export default {
         var wb // 读取完成的数据
         var outdata
         var reader = new FileReader()
+        const importWordData = null
         reader.onload = function (e) {
           var bytes = new Uint8Array(reader.result)
           var length = bytes.byteLength
@@ -288,7 +321,8 @@ export default {
           }
           var XLSX = require('xlsx')
           if (rABS) {
-            wb = XLSX.read(btoa(fixdata(binary)), { // 手动转化
+            wb = XLSX.read(btoa(fixdata(binary)), {
+              // 手动转化
               type: 'base64',
               cellDates: true
             })
@@ -301,60 +335,77 @@ export default {
           outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]])
           // excel 数据再处理
           const arr = []
-          outdata.map(v => {
+          outdata.map((v) => {
             // let jsonString = JSON.stringify(v).replace(/\*/g, '').replace(/\s/ig,'');
-            const jsonString = JSON.stringify(v).replace(/\//g, '').replace(/\s/ig, '')
+            const jsonString = JSON.stringify(v)
+              .replace(/\//g, '')
+              .replace(/\s/gi, '')
             v = JSON.parse(jsonString)
             const obj = {}
             // xxx代表列名
-            obj.receiptPaymentDate = v.收款日期
-            obj.receivingWithdrawingRegion = v.收款地
-            obj.receivingWithdrawingPeople = v.付款人
-            obj.deductionEuro = v.金额EUR
-            obj.deductionRmb = v.金额RMB
-            obj.businessType = 1
-            obj.remarks = v.备注1
-            obj.remark = v.备注2
-            obj.updatePeople = _this.$store.getters.name
-            if (!obj.deductionEuro) {
-              obj.deductionEuro = 0
-            }
-            if (!obj.deductionRmb) {
-              obj.deductionRmb = 0
-            }
-            for (let i = 0; i < _this.placeList.length; i++) {
-              _this.countryList.push(_this.placeList[i].country)
-            }
-            if (!_this.countryList.includes(obj.receivingWithdrawingRegion)) {
-              _this.isAllowExport = false
-              _this.$notify({
-                title: '失败',
-                message: '导入失败,导入数据中收款地在系统中不存在,请重新编辑',
-                type: 'error'
-              })
-              return
-            } else {
-              _this.excelFreightspace.push(obj)
-              _this.isAllowExport = true
-            }
-            for (let i = 0; i < _this.khList.length; i++) {
-              _this.khList1.push(_this.khList[i].receivingWithdrawingPeople)
-            }
-            if (!_this.khList1.includes(obj.receivingWithdrawingPeople)) {
-              _this.isAllowExport = false
-              _this.$notify({
-                title: '失败',
-                message: '导入失败,导入数据中客户不存在,请重新编辑',
-                type: 'error'
-              })
-              return
-            } else {
-              _this.excelFreightspace.push(obj)
-              _this.isAllowExport = true
-            }
+            obj.containerNo = v.集装箱号
+            obj.customerNo = v.客户编号
+            obj.courierServicesCompany = v.快递公司
+            obj.receivedNo = v.已收到单号
+            obj.internalDetails = v.内件明细
+            obj.weight = v.实重
+            obj.long1 = v.长
+            obj.wide = v.宽
+            obj.height = v.高
+            obj.bulkWeight = v.体积重
+            obj.count = v.包裹数
+            obj.rmb = v.人民币
+            obj.euro = v.欧元
+            // obj.updatePeople = _this.$store.getters.name
+            // if (!obj.deductionEuro) {
+            //   obj.deductionEuro = 0
+            // }
+            // if (!obj.deductionRmb) {
+            //   obj.deductionRmb = 0
+            // }
+            // for (let i = 0; i < _this.placeList.length; i++) {
+            //   _this.countryList.push(_this.placeList[i].country)
+            // }
+            // if (!_this.countryList.includes(obj.receivingWithdrawingRegion)) {
+            //   _this.isAllowExport = false
+            //   _this.$notify({
+            //     title: '失败',
+            //     message: '导入失败,导入数据中收款地在系统中不存在,请重新编辑',
+            //     type: 'error'
+            //   })
+            //   return
+            // } else {
+            //   _this.excelFreightspace.push(obj)
+            //   _this.isAllowExport = true
+            // }
+            // for (let i = 0; i < _this.khList.length; i++) {
+            //   _this.khList1.push(_this.khList[i].receivingWithdrawingPeople)
+            // }
+            // if (!_this.khList1.includes(obj.receivingWithdrawingPeople)) {
+            //   _this.isAllowExport = false
+            //   _this.$notify({
+            //     title: '失败',
+            //     message: '导入失败,导入数据中客户不存在,请重新编辑',
+            //     type: 'error'
+            //   })
+            //   return
+            // } else {
+            //   _this.excelFreightspace.push(obj)
+            //   _this.isAllowExport = true
+            // }
+            _this.excelFreightspace.push(obj)
+            // importWordData = _this.makeImportData()
           })
-          if (_this.excelFreightspace && _this.isAllowExport) {
-            importWord(_this.excelFreightspace).then((response) => {
+          debugger
+          const results = _this.makeGroupData(
+            _this.excelFreightspace,
+            function (item) {
+              return [item.customerNo]
+            }
+          )
+          console.log(results)
+          if (_this.excelFreightspace) {
+            importWord(results).then((response) => {
               if (response.status == '200') {
                 _this.$notify({
                   title: '成功',
@@ -374,6 +425,51 @@ export default {
         reader.readAsBinaryString(f)
       }
     },
+    makeGroupData(array) {
+      debugger
+      const _name=[]
+      const returnList = []
+      const itemList = []
+      for (let i = 0; i < array.length; i++) {
+        if (_name.includes(array[i].customerNo)) continue
+        const _obj = {}
+        _obj.containerNo = array[i].containerNo
+        _obj.count = array[i].count
+        _obj.customerNo = array[i].customerNo
+        _obj.euro = array[i].euro
+        _obj.remark = array[i].remark
+        _obj.rmb = array[i].rmb
+        _obj.courierServicesCompany = array[i].courierServicesCompany
+        _obj.internalDetails = array[i].internalDetails
+        _name.push(array[i].customerNo)
+        for (let k=0; k<array.length; k++) {
+          if (array[i].customerNo==array[k].customerNo) {
+            itemList.push(array[k])
+          } else {
+            continue
+          }
+        }
+        _obj.maritimeDetailDTOS = itemList
+        if (i==0||array[i-1].customerNo!=array[i].customerNo) {
+          returnList.push(_obj)
+        }
+      }
+      for (let i = 0; i<returnList.length; i++) {
+        const _list = []
+        for (let k = 0; k<returnList[i].maritimeDetailDTOS.length; k++) {
+          if (returnList[i].customerNo==returnList[i].maritimeDetailDTOS[k].customerNo) {
+            delete returnList[i].maritimeDetailDTOS[k].containerNo
+            delete returnList[i].maritimeDetailDTOS[k].rmb
+            delete returnList[i].maritimeDetailDTOS[k].euro
+            delete returnList[i].maritimeDetailDTOS[k].count
+            _list.push(returnList[i].maritimeDetailDTOS[k])
+          }
+        }
+        returnList[i].maritimeDetailDTOS = _list
+      }
+      console.log(returnList)
+      return returnList
+    },
     handleSizeChange(val) {
       console.log(`每页 ${val} 条`)
       this.listQuery.limit = val
@@ -384,16 +480,42 @@ export default {
       console.log(`当前页: ${val}`)
       this.getList()
     },
-    handleSelectionChange(val) {
-      this.modification = val
-    },
-    makeList(targetList) {
+    // handleSelectionChange(selection) {
+    //   // this.modification = val
+    //   if (!selection.length) {
+    //     this.tableSelection = []
+    //   } else if (selection.length === this.list.length) {
+    //     this.tableSelection = selection
+    //   }
+    //   console.log(this.tableSelection)
+    // },
+    // handleSelect(selection, row) {
+    //   let index =0
+    //   this.list.forEach((v, i) => {
+    //     // id 是每一行的数据id
+    //     if (row.id == v.id) {
+    //       index = i
+    //       console.log(index)
+    //     }
+    //   })
+    //   const tableSelectIndex = this.tableSelection.map(item => item.id)
+    //   if (!tableSelectIndex.includes(index)) {
+    //     // 如果未勾选
+    //     const nextRow = this.list[index+1]
+    //     this.tableSelection.push(row, nextRow)
+    //   } else {
+    //     // 如果已经勾选
+    //     this.tableSelection = this.tableSelection.filter(item => item.id !== index && item.id !== index+1)
+    //   }
+    //   console.log(this.tableSelection)
+    // },
+    makeList(targetList) { debugger
       this.list = targetList
       console.log(targetList)
       const data = this.list
       const arr = [] // 存放格式后的数据
       const rowspan = [] // 存放数组每行的 合并row 数据
-      data.forEach(item => {
+      data.forEach((item) => {
         // debugger
         for (let i = 0; i < item.maritimeDetailDOS.length; i++) {
           const params = { ...item, ...item.maritimeDetailDOS[i] } // 合并数据item与item.data[i]的数据,构成新的行数据
@@ -417,7 +539,7 @@ export default {
     // 单元格合并
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       // 行,列,行下标,列下标( 控制要合并的列 )
-      if ([2, 3, 11, 12].includes(columnIndex)) {
+      if ([0, 1, 10, 11, 12, 13].includes(columnIndex)) {
         const _row = this.rowspan[rowIndex]
         const _col = _row > 0 ? 1 : 0 // 如果这一行隐藏了,这列也隐藏
         return {
@@ -429,7 +551,7 @@ export default {
     getList() {
       this.listLoading = true
       listMaritimeAdministration(this.listQuery)
-        .then(response => {
+        .then((response) => {
           this.makeList(response.data.data.items)
           // this.list = response.data.data.items
           this.total = response.data.data.total
@@ -462,11 +584,11 @@ export default {
       // })
     },
     createData() {
-      this.$refs['dataForm'].validate(valid => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           this.submiting = true
           createMaritimeAdministration(this.dataForm)
-            .then(response => {
+            .then((response) => {
               this.list.unshift(response.data.data)
               this.dialogFormVisible = false
               this.$notify.success({
@@ -475,7 +597,7 @@ export default {
               })
               this.submiting = false
             })
-            .catch(response => {
+            .catch((response) => {
               this.$notify.error({
                 title: '失败',
                 message: response.data.errmsg
@@ -501,7 +623,7 @@ export default {
       // })
     },
     updateData() {
-      this.$refs['dataForm'].validate(valid => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           this.submiting = true
           updateMaritimeAdministration(this.dataForm)
@@ -520,7 +642,7 @@ export default {
                 message: '更新成功'
               })
             })
-            .catch(response => {
+            .catch((response) => {
               this.$notify.error({
                 title: '失败',
                 message: response.data.errmsg
@@ -532,7 +654,7 @@ export default {
     },
     handleDelete(row) {
       this.$confirm(
-        '此操作将永久删除该记录---' + row.id + '---, 是否继续?',
+        '此操作将永久删除该记录---' + row.infoId + '---, 是否继续?',
         '提示',
         {
           confirmButtonText: '确定',
@@ -541,16 +663,17 @@ export default {
         }
       )
         .then(() => {
-          deleteMaritimeAdministration(row.id)
-            .then(response => {
+          deleteMaritimeAdministration(row.infoId)
+            .then((response) => {
               this.$notify.success({
                 title: '成功',
                 message: '删除成功'
               })
               const index = this.list.indexOf(row)
-              this.list.splice(index, 1)
+              // this.list.splice(index, 1)
+              this.getList()
             })
-            .catch(response => {
+            .catch((response) => {
               this.$notify.error({
                 title: '失败',
                 message: response.data.errmsg

+ 4 - 4
unimall-admin/src/views/maritimeAdministration/MaritimeAdministrationadd.vue

@@ -38,9 +38,9 @@
         <el-form-item label="欧元:" prop="euro" style="margin-right:50px">
           <el-input v-model="dataForm.euro" class="input-width" />
         </el-form-item>
-        <el-form-item label="备注:" prop="remark" style="margin-right:50px">
+        <!-- <el-form-item label="备注:" prop="remark" style="margin-right:50px">
           <el-input v-model="dataForm.remark" class="input-width" />
-        </el-form-item>
+        </el-form-item> -->
 
       </div>
       <div class="small-title" style="font-size: 16px">详情</div>
@@ -118,11 +118,11 @@
             <el-input v-model="scope.row.bulkWeight" />
           </template>
         </el-table-column>
-        <el-table-column align="center" label="备注" prop="remark">
+        <!-- <el-table-column align="center" label="备注" prop="remark">
           <template slot-scope="scope">
             <el-input v-model="scope.row.remark" />
           </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
           <template slot-scope="scope">
             <el-button

+ 4 - 4
unimall-admin/src/views/maritimeAdministration/MaritimeAdministrationedit.vue

@@ -38,9 +38,9 @@
         <el-form-item label="欧元:" prop="euro" style="margin-right:50px">
           <el-input v-model="dataForm.euro" class="input-width" />
         </el-form-item>
-        <el-form-item label="备注:" prop="remark" style="margin-right:50px">
+        <!-- <el-form-item label="备注:" prop="remark" style="margin-right:50px">
           <el-input v-model="dataForm.remark" class="input-width" />
-        </el-form-item>
+        </el-form-item> -->
 
       </div>
       <div class="small-title" style="font-size: 16px">详情</div>
@@ -117,11 +117,11 @@
             <el-input v-model="scope.row.bulkWeight" />
           </template>
         </el-table-column>
-        <el-table-column align="center" label="备注" prop="remark">
+        <!-- <el-table-column align="center" label="备注" prop="remark">
           <template slot-scope="scope">
             <el-input v-model="scope.row.remark" />
           </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
           <template slot-scope="scope">
             <el-button