13404089107
2025-03-20 97ae9c64cc0e45903844ea63e3f13dc98da61496
调试导入
6个文件已修改
211 ■■■■ 已修改文件
src/api/compensation-standard.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/placement-details.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/placement-batch/applayPerson.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/placement-batch/components/exportMoneyApplay.vue 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/placement-batch/index.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/compensation-standard.js
@@ -8,11 +8,4 @@
  })
}
// 下载安置批次模版
export function downloadTemplate(type) {
  return request({
    url: `/api/placement-batch/download-template/${type}`,
    method: 'post',
  })
}
src/api/placement-details.js
@@ -9,12 +9,20 @@
  })
}
// 补偿标准修改(批量修改)
export function edit(data) {
// 安置批次删除
export function deletePlacementBatch(data) {
  return request({
    url: '/compensate/edit',
      url: '/placement-batch/del',
    method: 'post',
    data
  })
}
  // 安置批次导入
  export function importPlacementBatch(data) {
    return request({
      url: '/placement-batch/imports',
      method: 'post',
      data
    })
  }
src/router/index.js
@@ -72,6 +72,7 @@
  {
    path: '/placement/batch',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'personnel',
@@ -84,6 +85,7 @@
  {
    path: '/placement/batch',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'addResettle',
@@ -97,6 +99,7 @@
  {
    path: '/placement/batch',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'applayPerson',
src/views/placement-batch/applayPerson.vue
@@ -537,6 +537,40 @@
      const secondHand = parseFloat(this.form.secondHandAmount) || 0
      this.form.totalAmount = newBuilding + secondHand
    },
    // 处理文件上传
    handleClickUpload() {
      // 创建文件输入元素
      const fileInput = document.createElement('input')
      fileInput.type = 'file'
      // 设置接受的文件类型
      fileInput.accept = '.jpg,.jpeg,.png,.pdf,.doc,.docx'
      // 监听文件选择事件
      fileInput.addEventListener('change', (event) => {
        const file = event.target.files[0]
        if (!file) return
        // 创建FileReader实例
        const reader = new FileReader()
        // 读取完成后的处理
        reader.onload = (e) => {
          // 获取二进制数据
          const binaryData = e.target.result
          console.log('文件名:', file.name)
          console.log('文件类型:', file.type)
          console.log('文件大小:', file.size, 'bytes')
          // 这里可以将binaryData存储到组件的data中或进行其他处理
          // this.fileData = binaryData
        }
        // 读取文件为二进制数据
        reader.readAsArrayBuffer(file)
      })
      // 触发文件选择
      fileInput.click()
    },
    // 提交表单
    submitForm() {
      this.$refs.form.validate(valid => {
src/views/placement-batch/components/exportMoneyApplay.vue
@@ -1,48 +1,34 @@
<template>
  <el-dialog title="导入人员购房资金申请" :visible.sync="visible" width="600px" :close-on-click-modal="false" append-to-body>
    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
      <el-form-item label="批次号" prop="batchNo">
        <el-input v-model="form.batchNo" placeholder="请输入" clearable></el-input>
      <el-form-item label="批次号" prop="batchNumber">
        <el-input v-model="form.batchNumber" placeholder="请输入" clearable></el-input>
      </el-form-item>
      <div>
      <el-form-item label="导入资金表" prop="moneyFile">
        <el-upload class="upload-container" :action="uploadUrl" :before-upload="beforeUpload"
          :on-success="handleMoneyFileSuccess" :on-error="handleUploadError" :file-list="moneyFileList" :limit="1">
          <div class="upload-area" @click="handleClickUpload">
        <el-form-item label="导入资金表" prop="assetFile">
          <el-upload class="upload-container" action="#" drag :auto-upload="false" accept=".xlsx,.xls"
            :on-change="handlehouseholdFileChangePrice"  :limit="1">
            <div class="upload-area">
            <i class="el-icon-folder"></i>
            <div class="upload-text">点击或将文件文件拖拽到这里上传</div>
            <div class="upload-tip">支持格式:.xlsx、.xls...</div>
          </div>
          <div slot="tip" class="el-upload__tip">
            已上传:
            <template v-if="moneyFileList.length">
              <div v-for="(file, index) in moneyFileList" :key="index" class="file-item">
                <i class="el-icon-document"></i>
                <span class="file-name">{{ file.name }}</span>
                <i class="el-icon-close" @click.stop="handleRemoveFile(file, 'money')"></i>
              </div>
            </template>
          </div>
        </el-upload>
      </el-form-item>
      <el-form-item label="导入购房表" prop="houseFile">
        <el-upload class="upload-container" :action="uploadUrl" :before-upload="beforeUpload"
          :on-success="handleHouseFileSuccess" :on-error="handleUploadError" :file-list="houseFileList" :limit="1">
          <div class="upload-area" @click="handleClickUpload">
        <el-form-item label="导入购房表" prop="householdFile">
          <el-upload class="upload-container" action="#" drag :auto-upload="false" accept=".xlsx,.xls"
            :on-change="handlehouseholdFileChange" :limit="1">
            <div class="upload-area">
            <i class="el-icon-folder"></i>
            <div class="upload-text">点击或将文件文件拖拽到这里上传</div>
            <div class="upload-tip">支持格式:.xlsx、.xls...</div>
          </div>
          <div slot="tip" class="el-upload__tip">
            已上传:
            <template v-if="houseFileList.length">
              <div v-for="(file, index) in houseFileList" :key="index" class="file-item">
                <i class="el-icon-document"></i>
                <span class="file-name">{{ file.name }}</span>
                <i class="el-icon-close" @click.stop="handleRemoveFile(file, 'house')"></i>
              </div>
            </template>
          </div>
        </el-upload>
      </el-form-item>
@@ -69,71 +55,42 @@
      loading: false,
      uploadUrl: '/api/upload', // 上传地址
      form: {
        batchNo: '',
        moneyFile: '',
        houseFile: ''
        batchNumber: '',
        assetFile: '',
        householdFile: ''
      },
      rules: {
        batchNo: [
        batchNumber: [
          { required: true, message: '请输入批次号', trigger: 'blur' }
        ],
        moneyFile: [
        assetFile: [
          { required: true, message: '请上传资金表', trigger: 'change' }
        ],
        houseFile: [
        householdFile: [
          { required: true, message: '请上传购房表', trigger: 'change' }
        ]
      },
      moneyFileList: [],
      houseFileList: []
    }
  },
  methods: {
    // 上传前校验
    beforeUpload(file) {
      const isExcel = file.type === 'application/vnd.ms-excel' ||
        file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
      const isLt10M = file.size / 1024 / 1024 < 10
    handlehouseholdFileChange(file, fileList) {
      this.form.householdFile = file.raw
      this.$refs.form.validateField('householdFile')
      if (!isExcel) {
        this.$message.error('上传文件只能是 Excel 格式!')
        return false
      }
      if (!isLt10M) {
        this.$message.error('上传文件大小不能超过 10MB!')
        return false
      }
      return true
    },
    // 资金表上传成功
    handleMoneyFileSuccess(response, file, fileList) {
      this.moneyFileList = fileList
      this.form.moneyFile = response.data
      this.$message.success('上传成功')
    },
    // 购房表上传成功
    handleHouseFileSuccess(response, file, fileList) {
      this.houseFileList = fileList
      this.form.houseFile = response.data
      this.$message.success('上传成功')
    },
    // 上传失败
    handleUploadError() {
      this.$message.error('上传失败')
    handlehouseholdFileChangePrice(file, fileList) {
      this.form.assetFile = file.raw
      this.$refs.form.validateField('assetFile')
    },
    // 移除文件
    handleRemoveFile(file, type) {
      if (type === 'money') {
        this.moneyFileList = []
        this.form.moneyFile = ''
        this.form.assetFile = ''
        this.$refs.form.validateField('assetFile')
      } else {
        this.houseFileList = []
        this.form.houseFile = ''
        this.form.householdFile = ''
        this.$refs.form.validateField('householdFile')
      }
    },
    // 点击上传区域
    handleClickUpload() {
      // 触发上传
    },
    // 取消
    handleCancel() {
@@ -145,11 +102,9 @@
      this.$refs.form.validate(valid => {
        if (valid) {
          this.loading = true
          // TODO: 调用接口提交数据
            this.$emit('importPrice', this.form)
          setTimeout(() => {
            this.loading = false
            this.$message.success('提交成功')
            this.$emit('update:visible', false)
            this.resetForm()
          }, 1000)
        }
@@ -158,12 +113,10 @@
    // 重置表单
    resetForm() {
      this.form = {
        batchNo: '',
        moneyFile: '',
        houseFile: ''
        batchNumber: '',
        assetFile: '',
        householdFile: ''
      }
      this.moneyFileList = []
      this.houseFileList = []
      this.$refs.form && this.$refs.form.resetFields()
    }
  }
@@ -171,6 +124,10 @@
</script>
<style lang="scss" scoped>
::v-deep .el-upload-dragger {
  width: 100%;
  height: unset !important;
}
.upload-container {
  .upload-area {
    width: 100%;
src/views/placement-batch/index.vue
@@ -62,7 +62,7 @@
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <export-money-applay :visible.sync="dialogVisible" />
    <export-money-applay :visible.sync="dialogVisible" @importPrice="importPrice" />
    <approval-dialog :visible.sync="approvalDialogVisible" />
  </div>
</template>
@@ -70,9 +70,11 @@
<script>
import ExportMoneyApplay from './components/exportMoneyApplay.vue'
import ApprovalDialog from './components/ApprovalDialog.vue'
import { downLoad } from '@/utils'
import {
  getPlacementBatchList,
  downloadTemplate
  deletePlacementBatch,
  importPlacementBatch
} from '@/api/placement-details'
export default {
@@ -87,6 +89,8 @@
      loading: false,
      // 弹窗
      dialogVisible: false,
      // 审核弹窗
      approvalDialogVisible: false,
      // 总条数
      total: 0,
      // 表格数据
@@ -95,7 +99,7 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        batchNo: undefined,
        batchNumber: undefined,
        status: undefined
      },
      dialogVisible: false
@@ -110,7 +114,7 @@
      this.loading = true
      getPlacementBatchList(this.queryParams).then(res => {
        this.tableData = res.data.records || []
        this.total = res.data.total
        this.total = res.data.total || 0
        this.loading = false
      })
@@ -132,15 +136,23 @@
    /** 下载模板 */
    handleExportTemplate() {
      // TODO: 实现下载模板逻辑
      downloadTemplate(3).then(res => {
        window.open(res.data)
      })
      downLoad('/placement-batch/download-template/3', '资金导入模版.xlsx')
    },
    /** 下载临时安置模板 */
    handleImportTemplate() {
      // TODO: 实现下载临时安置模板逻辑
      downLoad('/placement-batch/download-template/4', '购房信息表导入模版.xlsx')
    },
    /** 导入资金批次 */
    importPrice(form) {
      console.log('//////////////',form)
      importPlacementBatch(form).then(res => {
        if(res.code == 200) {
          this.$message.success('导入成功')
          this.dialogVisible = false
          this.getList()
        }
      })
    },
    /** 查看详情按钮操作 */
    handleView(row) {
@@ -153,6 +165,18 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      // TODO: 实现删除逻辑
      this.$confirm('确定删除该安置批次吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deletePlacementBatch({id: row.id}).then(res => {
          if(res.code == 200) {
            this.$message.success('删除成功')
            this.getList()
          }
        })
      })
    }
  }
}