fei
5 天以前 0c6b2eb953f5ed4df00a77a5f7b14b9ff6c563fe
src/views/archiveManager/index.vue
@@ -17,6 +17,64 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="类别号" prop="categoryNumber">
        <el-row :gutter="8">
          <el-col :span="6">
            <el-select
              v-model="queryParams.categoryType"
              placeholder="选择类别类型"
              clearable
              @change="handleQuery"
            >
              <el-option
                v-for="item in recordTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-select
              v-model="queryParams.categoryZone"
              placeholder="选择地区"
              clearable
              @change="handleQuery"
            >
              <el-option
                v-for="item in zoneTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categoryYear"
              placeholder="年份"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categorySeq"
              placeholder="开始序号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categorySeqEnd"
              placeholder="结束序号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="案卷题名" prop="caseTitle">
        <el-input
          v-model="queryParams.caseTitle"
@@ -150,12 +208,19 @@
        />
      </el-form-item>
      <el-form-item label="扫描加工公司" prop="scanningCompany">
        <el-input
        <el-select
          v-model="queryParams.scanningCompany"
          placeholder="请输入扫描加工公司"
          placeholder="请选择扫描加工公司"
          clearable
          @keyup.enter.native="handleQuery"
        />
          @change="handleQuery"
        >
          <el-option
            v-for="item in projectCompanyOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="档案管(室)号" prop="archiveRoomNumber">
        <el-input
@@ -241,7 +306,16 @@
          v-hasPermi="['system:records:export']"
        >批量提交</el-button>
      </el-col>
   <el-col v-if="userId==1" :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleGivePermission"
          v-hasPermi="['system:materials:edit']"
        >批量授权</el-button>
      </el-col>
        <el-col v-if="userId==1" :span="1.5">
        <el-button
          type="warning"
@@ -285,7 +359,7 @@
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="recordsList" @selection-change="handleSelectionChange">
    <el-table v-loading="loading" :data="recordsList" @selection-change="handleSelectionChange" @sort-change="handleSortChange">
      <el-table-column type="selection" width="55" align="center" />
@@ -300,8 +374,46 @@
                  icon="el-icon-edit"
                  @click="handleInfo(scope.row)"
                  v-hasPermi="['system:records:edit']"
                >案卷详细信息</el-button>
                >编辑卷内目录</el-button>
          <el-button
                v-if="userId===1"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="CheckInfo(scope.row)"
                  v-hasPermi="['system:records:edit']"
                >查看卷内目录</el-button>
                <el-button
                      v-if="userId===1"
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        @click="backInfo(scope.row)"
                        v-hasPermi="['system:records:edit']"
                      >导出备考表</el-button>
                <el-button
                      v-if="userId===1"
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        @click="JuanInfo(scope.row)"
                        v-hasPermi="['system:records:edit']"
                      >导出卷内目录</el-button>
                      <el-button
                            v-if="userId===1"
                              size="mini"
                              type="text"
                              icon="el-icon-edit"
                              @click="pageInfo(scope.row)"
                              v-hasPermi="['system:records:edit']"
                            >导出案卷封面</el-button>
                <el-button
                  size="mini"
                  type="text"
@@ -324,6 +436,7 @@
                  @click="handleSubmit(scope.row)"
                  v-hasPermi="['system:records:edit']"
                >提交案卷</el-button>
                <el-button
                v-if="scope.row.ownData||userId===1"
@@ -351,7 +464,7 @@
              </template>
            </el-table-column>
            <el-table-column label="状态" align="center" prop="recordStatus" width="120">
            <el-table-column label="状态" align="center"  sortable="custom" prop="recordStatus" width="120">
              <template slot-scope="scope">
                <el-button :type="scope.row.recordStatus === '未录入' ? 'danger' : 'success'" size="mini">
                  {{ scope.row.recordStatus }}
@@ -360,7 +473,7 @@
            </el-table-column>
<!--      <el-table-column label="${comment}" align="center" prop="id" /> -->
      <el-table-column label="档案号" align="center" prop="recordId" />
      <el-table-column label="档案号" align="center" sortable="custom" prop="recordId" width="120"/>
      <el-table-column label="发文号" align="center" prop="inquiryNumber" />
@@ -411,7 +524,7 @@
            <div class="option-group">
              <label class="option-label">
                <input type="checkbox" v-model="excelOptions.includeQrCode">
                <span>包含二维码</span>
                <span>包含条形码</span>
              </label>
            </div>
@@ -420,7 +533,7 @@
              <div class="option-label">选择注解:</div>
              <div class="annotation-options">
              <label v-for="(annotation, index) in excelOptions.selectedAnnotations" :key="index" class="signature-checkbox">
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="annotation">
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="index">
                              <span>{{ annotation }}
                              </span>
              </label>
@@ -433,7 +546,7 @@
              <div class="signature-options">
                <div class="signature-checkboxes">
                 <label v-for="(signature, index) in excelOptions.selectedSignatures" :key="index" class="signature-checkbox">
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="signature">
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="index">
                                 <span>{{ signature }}</span>
                  </label>
@@ -446,9 +559,8 @@
          </div>
        </div>
    <!-- 优化的Excel预览组件 -->
     <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%">
    <div  >
     <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%" :show-close="true" @click="closeExcelPreviewDialog">
    <div  @click.stop>
      <!-- 主要预览组件 -->
      <vue-office-excel
        v-if="currentExcelUrl"
@@ -767,7 +879,14 @@
          <el-input v-model="form.projectNumber" placeholder="请输入项目编号" />
        </el-form-item>
        <el-form-item label="扫描加工公司" prop="scanningCompany">
          <el-input v-model="form.scanningCompany" placeholder="请输入扫描加工公司" />
          <el-select v-model="form.scanningCompany" placeholder="请选择扫描加工公司">
            <el-option
              v-for="item in projectCompanyOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="档案管(室)号" prop="archiveRoomNumber">
          <el-input v-model="form.archiveRoomNumber" placeholder="请输入档案管(室)号" />
@@ -788,6 +907,45 @@
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 授权用户 -->
     <el-dialog title="选择用户" :visible.sync="visibleUser" width="800px" top="5vh" append-to-body>
       <el-row>
         <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSingleSelection"
    height="260px">
           <el-table-column type="selection" width="55"></el-table-column>
           <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
           <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
           <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
           <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
      <!--     <el-table-column label="状态" align="center" prop="status">
             <template slot-scope="scope">
               <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
             </template>
           </el-table-column> -->
           <el-table-column label="创建时间" align="center" prop="createTime" width="180">
             <template slot-scope="scope">
               <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
           </el-table-column>
         </el-table>
         <pagination
           v-show="totalUser>0"
           :total="totalUser"
           :page.sync="queryParamsUser.pageNum"
           :limit.sync="queryParamsUser.pageSize"
           @pagination="getUserList"
         />
       </el-row>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="handleSelectUser">确 定</el-button>
         <el-button @click="visibleUser = false">取 消</el-button>
       </div>
     </el-dialog>
  </div>
</template>
@@ -801,6 +959,10 @@
import { listAllCategory } from "@/api/system/category"
import { listAllProjectName } from "@/api/system/projectName"
import { listPlaceName, listAllPlaceName } from "@/api/system/placeName"
import { judge } from "@/api/system/materials"
import { UserRoleIdList,unallocatedUserList, authUserSelectAll } from "@/api/system/role"
import {authManyRecordsToUsers}  from "@/api/system/archiverecordstouser"
export default {
     components: {
        VueOfficeExcel
@@ -808,6 +970,19 @@
  name: "Records",
  data() {
    return {
      totalUser: 0,
      visibleUser:false,
      userList:[],
      // 选中数组值
      userIds: [],
      queryParamsUser: {
        pageNum: 1,
        pageSize: 10,
        roleId: undefined,
        archiveRecordsId: undefined,
      },
      showExcelPreview: false,
                  excel: 'http://localhost:8080/profile/upload/12.xls', //设置文档网络地址,可以是相对地址
      open_check: false,
@@ -818,6 +993,8 @@
      maxId: 0,
      // 项目名称选项
      projectOptions: [],
      // 项目管理公司选项
      projectCompanyOptions: [],
      // 档案类型选项
      recordTypeOptions: [],
      //地区类型
@@ -861,6 +1038,11 @@
        pageSize: 10,
        recordId: null,
        inquiryNumber: null,
        categoryType: null, // 类别类型
        categoryZone: null, // 类别地区
        categoryYear: null, // 类别年份
        categorySeq: null, // 开始序号
        categorySeqEnd: null, // 结束序号
        everyProjectName: null,
        caseTitle: null,
        publicAttribute: null,
@@ -878,7 +1060,10 @@
        archiveRoomNumber: null,
        microfilmNumber: null,
        remarks: null,
        historicalReferenceNumber: null
        historicalReferenceNumber: null,
                orderByColumn: null,
                isAsc: null
      },
    // Excel弹窗相关数据
    excelDialogVisible: false,
@@ -925,6 +1110,9 @@
        ],
        projectName: [
          { required: true, message: "建设项目名称不能为空", trigger: "blur" }
        ],
        pageCount: [
          { required: true, message: "案卷页数不能为空", trigger: "blur" }
        ]
      }
    }
@@ -939,7 +1127,9 @@
    this.getRecordTypes()
    this.getZoneOptions()
    this.fetchProjectOptions()
    this.fetchProjectCompanyOptions()
this.getList()
  },
  watch: {
    'form.constructionUnit': {
@@ -964,14 +1154,70 @@
  beforeDestroy() {
    // 清理事件监听器和定时器
    document.removeEventListener('keydown', this.handleKeyDown);
    if (this.excelPreviewTimeout) {
      clearTimeout(this.excelPreviewTimeout);
    }
    // if (this.excelPreviewTimeout) {
    //   clearTimeout(this.excelPreviewTimeout);
    // }
    if (this.currentExcelUrl) {
      URL.revokeObjectURL(this.currentExcelUrl);
    }
  },
  methods: {
    /** 选择授权用户操作 */
    handleSelectUser() {
    //  const archiveRecordsId = this.queryParams.archiveRecordsId
      const userIds = this.userIds.join(",")
     // const aids = this.ids.join(",")
    //  alert(aids)
      if (userIds == "") {
        this.$modal.msgError("请选择要分配的用户")
        return
      }
      // 创建转换后的参数,确保recordId是数字类型
     // const convertedRecordId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
    const convertedRecordId = this.ids.join(",")
    if (convertedRecordId == "") {
      this.$modal.msgError("请选择相应的案卷")
      return
    }
      authManyRecordsToUsers({ recordIds: convertedRecordId, userIds: userIds }).then(res => {
        if(res.code === 200) {
          this.$modal.msgSuccess(res.msg)
          this.visibleUser = false
        //  this.$emit("ok")
        } else {
          this.$modal.msgError(res.msg || "授权失败,已经授权过了")
        }
      })
    },
    clickRow(row) {
      this.$refs.table.clearSelection();
    this.$refs.table.toggleRowSelection(row);
    },
    // 替换原有的handleSelectionChange方法
    handleSingleSelection(selection) {
      if (selection.length > 1) {
        this.$refs.table.clearSelection();
        this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
      }
      else
      this.userIds = selection.map(item => item.userId);
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.userIds = selection.map(item => item.userId)
    },
    // 查询表数据
    getUserList() {
      this.queryParamsUser.roleId = 2
      UserRoleIdList(this.queryParamsUser).then(res => {
        console.log("=------00000000009")
        console.log(res)
        this.userList = res.rows
        this.totalUser = res.total
      })
    },
      /** Excel渲染完成处理 */
        renderedHandler() {
            console.log("Excel渲染完成");
@@ -1053,6 +1299,23 @@
        console.error('获取项目名称列表失败:', error)
      }
    },
    async fetchProjectCompanyOptions() {
      try {
        const response = await listAllProjectName()
        console.log("项目管理公司数据:", response)
        // 从项目数据中提取管理公司信息
        const companies = [...new Set(response.data.data.map(item => item.companyName).filter(Boolean))]
               console.log("项目管理公司数据:", companies)
        this.projectCompanyOptions = companies.map(company => ({
          value: company,
          label: company
        }))
      } catch (error) {
        console.error('获取项目管理公司列表失败:', error)
      }
    },
       /** 获取档案类型列表 */
       getRecordTypes() {
        return new Promise((resolve) => {
@@ -1090,7 +1353,41 @@
      this.loading = true
      console.log(this.queryParams)
      console.log("--------------")
      listRecords(this.queryParams).then(response => {
      // 创建queryParams的副本,避免直接修改原对象
      const queryParams = { ...this.queryParams }
      // 处理类别号搜索
      if ((queryParams.categoryType || queryParams.categoryZone || queryParams.categoryYear) && (queryParams.categorySeq || queryParams.categorySeqEnd)) {
        // 构建基础部分(前三个字段保持一致)
        const baseParts = []
        if (queryParams.categoryType) baseParts.push(queryParams.categoryType)
        if (queryParams.categoryZone) baseParts.push(queryParams.categoryZone)
        if (queryParams.categoryYear) baseParts.push(queryParams.categoryYear)
        const baseCategory = baseParts.join('-')
        // 构建开始类别号
        if (queryParams.categorySeq) {
          queryParams.categoryNumberStart = baseCategory + '-' + queryParams.categorySeq
        }
        // 构建结束类别号
        if (queryParams.categorySeqEnd) {
          queryParams.categoryNumberEnd = baseCategory + '-' + queryParams.categorySeqEnd
        } else if (queryParams.categorySeq) {
          // 如果没有结束序号,则结束类别号与开始类别号相同
          queryParams.categoryNumberEnd = queryParams.categoryNumberStart
        }
        console.log(queryParams)
        console.log("9999999999999999999")
        // 删除单独的字段,避免重复搜索
        delete queryParams.categoryType
        delete queryParams.categoryZone
        delete queryParams.categoryYear
        delete queryParams.categorySeq
        delete queryParams.categorySeqEnd
      }
      listRecords(queryParams).then(response => {
        console.log(response)
        this.recordsList = response.data.data
@@ -1098,6 +1395,24 @@
        this.loading = false
      })
    },
    // 排序处理方法
      // 添加handleSortChange方法
          handleSortChange({ column, prop, order }) {
           // alert(23)
            if (order === 'ascending') {
              this.queryParams.orderByColumn = prop;
              this.queryParams.isAsc = 'asc';
            } else if (order === 'descending') {
              this.queryParams.orderByColumn = prop;
              this.queryParams.isAsc = 'desc';
            } else {
              this.queryParams.orderByColumn = null;
              this.queryParams.isAsc = null;
            }
            this.getList();
          },
    // 取消按钮
    cancel() {
      this.open = false
@@ -1139,6 +1454,12 @@
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      // 确保类别号相关字段被完全重置
      this.queryParams.categoryType = null
      this.queryParams.categoryZone = null
      this.queryParams.categoryYear = null
      this.queryParams.categorySeq = null
      this.queryParams.categorySeqEnd = null
      this.handleQuery()
    },
    // 多选框选中数据
@@ -1155,26 +1476,107 @@
      this.vis = false;
      this.title = "添加档案记录"
    },
    /*查看详情*/
    handleInfo(row)
    CheckInfo(row)
    {
      var mid = row.id
      const roleId = 2
   //   alert(mid)
      var recordId = mid
      var pageCount = row.pageCount
      var sho = false
    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
    },
    /*导出备考表*/
    backInfo(row)
     {
       var id = row.id
             id = Number(id)
       var recordId = row.recordId
   this.download('/system/materials/exportBack/'+id+'/'+recordId, {
   }, `备考表_${new Date().getTime()}.pdf`)
     },
     /*导出卷内目录*/
     JuanInfo(row)
     {
       var id = row.id
                 id = Number(id)
           var recordId = row.recordId
       this.download('/system/materials/exportJuan/'+id, {
       }, `卷内目录_${new Date().getTime()}.xls`)
     },
     /*导出案卷封面*/
     pageInfo(row)
     {
       var id = row.id
                 id = Number(id)
           var recordId = row.recordId
       this.download('/system/materials/exportPageInfo/'+id+'/'+recordId, {
       }, `案卷封面_${new Date().getTime()}.xls`)
     },
    handleInfo(row)
    {
        //判断必须修改的字段是否补充完整了
       var valid = false;
      var pageCount = row.pageCount
      if(row.projectName!=null&&row.pageCount!=null&&row.caseTitle!=null&&row.constructionUnit)
       valid = true;
        if (valid) {
      var mid = row.id
      const roleId = 2
   //   alert(mid)
      var recordId = mid
      var sho = true
    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
      }else
      {
        this.$modal.msgWarning("请补充页号等相关信息,再编辑卷内目录!")
      }
    },
    //
    handleSubmit(row)
    {
   //   alert(row.id)
     //alert(row.id)
      var id = row.id
      updateStatusById(id).then(response=>{
        this.$modal.msgSuccess("提交成功")
        this.getList()
      // 在提交之前,调用后端接口检查是否已经上传附件
      judge(id).then(response => {
        // console.log(response)
        // alert(response.data)
        if (response.data===undefined||response.data === false) {
          // 如果文件数量为0,提示用户先上传附件
          this.$modal.msgWarning('请先上传附件,再进行提交操作')
        } else {
          // 如果已经上传了附件,继续提交操作
          var status = '录入完成'
          updateStatusById(status, id).then(response=>{
            this.$modal.msgSuccess("提交成功")
            this.getList()
          })
        }
      }).catch(error => {
        console.error('检查附件数量失败:', error)
        this.$modal.msgError('检查附件数量失败,请稍后重试')
      })
    },
    /** 修改按钮操作 */
@@ -1192,7 +1594,7 @@
  if(this.recordTypeOptions.length > 0) {
      const recordParts = response.data.recordId.split('-')
      this.$set(this.form, 'recordType', recordParts[0])
      if(this.recordTypeOptions.length==4)
      if(recordParts.length==4)
      {
        this.$set(this.form, 'recordZone', recordParts[1])
@@ -1208,6 +1610,16 @@
        this.open = true
        this.title = "修改档案记录"
      })
    },
    /*批量授权*/
    handleGivePermission()
    {
      if (this.ids.length === 0) {
        this.$modal.msgWarning('请选择要授权的档案记录')
        return
      }
      this.visibleUser = true
      this.getUserList()
    },
    /** 批量提交 */
    handleBatchSubmit() {
@@ -1248,8 +1660,9 @@
  this.form = response.data
  if(this.recordTypeOptions.length > 0) {
      const recordParts = response.data.recordId.split('-')
      this.$set(this.form, 'recordType', recordParts[0])
      if(this.recordTypeOptions.length==4)
      if(recordParts.length==4)
      {
            this.$set(this.form, 'recordZone', recordParts[1])
@@ -1314,8 +1727,7 @@
    /** 分配用户操作 */
    handleAuthUser: function(row) {
      const roleId = 2
      var archiveRecordsId = row.recordId
      var archiveRecordsId = row.id
      this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+archiveRecordsId)
    },
    /** 删除按钮操作 */
@@ -1337,25 +1749,29 @@
        // 只导出选中的记录
        this.download('system/records/export', {
          ids: this.ids.join(',') // 将选中的ID数组转换为逗号分隔的字符串
        }, `records_${new Date().getTime()}.xlsx`)
        }, `records_${new Date().getTime()}.xls`)
      } else {
        // 没有选中记录时,导出符合查询条件的所有记录
        this.download('system/records/export', {
          ...this.queryParams
        }, `records_${new Date().getTime()}.xlsx`)
        }, `records_${new Date().getTime()}.xls`)
      }
    },
    /** 查看并打印Excel文件 */
    viewAndPrintExcel(row) {
      const id = row.id || this.ids;
     // alert(id)
      this.recordId = id;
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 从后端获取Excel文件
      this.getExcelFile(id).then(blob => {
        this.$modal.closeLoading();
        // 保存文件信息并显示静态弹窗
        this.currentExcelUrl = URL.createObjectURL(blob);
        this.currentExcelBlob = blob;
        this.currentExcelId = id;
        this.excelDialogVisible = true;
@@ -1377,6 +1793,7 @@
    /** 关闭Excel弹窗并清理资源 */
    closeExcelDialog() {
      this.excelDialogVisible = false;
    //  alert(this.excelDialogVisible)
      if (this.excelPreviewTimeout) {
        clearTimeout(this.excelPreviewTimeout);
        this.excelPreviewTimeout = null;
@@ -1387,118 +1804,143 @@
      }
      this.currentExcelBlob = null;
    },
closeExcelPreviewDialog()
{
  this.showExcelPreview = false;
},
    /** 处理预览按钮点击 */
    handlePreviewClick() {
      this.showExcelPreview = true;
      this.excelRenderError = '';
      var id = this.recordId ;
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 重置vue-office-excel组件
      if (this.currentExcelUrl) {
        const tempUrl = this.currentExcelUrl;
        this.currentExcelUrl = '';
        this.$nextTick(() => {
          this.currentExcelUrl = tempUrl;
        });
      }
      // 从后端获取Excel文件
      this.getExcelFile(id).then(blob => {
        this.$modal.closeLoading();
        // 保存文件信息并显示静态弹窗
     //   alert(23)
        this.currentExcelUrl = URL.createObjectURL(blob);
       // alert(this.currentExcelUrl)
        this.currentExcelBlob = blob;
        this.currentExcelId = id;
        this.excelDialogVisible = true;
        this.excelLoading = false;
      }).catch(error => {
        this.$modal.closeLoading();
        console.error('获取Excel文件失败:', error);
        this.$modal.msgError('获取Excel文件失败,请稍后重试');
      const previewContainer = this.$refs.excelPreviewContainer;
      // 清空预览容器
      if (previewContainer) {
        previewContainer.innerHTML = '';
            this.showExcelPreview = false;
      });
      // // 重置vue-office-excel组件
      // if (this.currentExcelUrl) {
      //   const tempUrl = this.currentExcelUrl;
      //   this.currentExcelUrl = '';
      //   this.$nextTick(() => {
      //     this.currentExcelUrl = tempUrl;
      //   });
      // }
        // 尝试使用微软Office Online预览服务作为备选
        const officeOnlineUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(this.currentExcelUrl)}`;
      // const previewContainer = this.$refs.excelPreviewContainer;
        // 创建iframe用于预览
        const iframe = document.createElement('iframe');
        iframe.style.width = '100%';
        iframe.style.height = '100%';
        iframe.style.border = 'none';
        iframe.style.minHeight = '600px';
        iframe.src = officeOnlineUrl;
        iframe.title = 'Excel文件预览';
      // // 清空预览容器
      // if (previewContainer) {
      //   previewContainer.innerHTML = '';
        // 创建加载指示器
        const loadingIndicator = document.createElement('div');
        loadingIndicator.className = 'loading-indicator';
        loadingIndicator.innerHTML = `
          <div class="loading-spinner"></div>
          <p>正在加载Excel文件,请稍候...</p>
        `;
        previewContainer.style.position = 'relative';
        previewContainer.appendChild(iframe);
        previewContainer.appendChild(loadingIndicator);
      //   // 尝试使用微软Office Online预览服务作为备选
      //   const officeOnlineUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(this.currentExcelUrl)}`;
        // 监听iframe加载完成
        iframe.onload = () => {
          this.excelLoading = false;
          if (loadingIndicator && loadingIndicator.parentNode) {
            loadingIndicator.parentNode.removeChild(loadingIndicator);
          }
        };
      //   // 创建iframe用于预览
      //   const iframe = document.createElement('iframe');
      //   iframe.style.width = '100%';
      //   iframe.style.height = '100%';
      //   iframe.style.border = 'none';
      //   iframe.style.minHeight = '600px';
      //   iframe.src = officeOnlineUrl;
      //   iframe.title = 'Excel文件预览';
        // 设置超时处理
        this.excelPreviewTimeout = setTimeout(() => {
          this.excelLoading = false;
          if (loadingIndicator && loadingIndicator.parentNode) {
            loadingIndicator.parentNode.removeChild(loadingIndicator);
          }
      //   // 创建加载指示器
      //   const loadingIndicator = document.createElement('div');
      //   loadingIndicator.className = 'loading-indicator';
      //   loadingIndicator.innerHTML = `
      //     <div class="loading-spinner"></div>
      //     <p>正在加载Excel文件,请稍候...</p>
      //   `;
      //   previewContainer.style.position = 'relative';
      //   previewContainer.appendChild(iframe);
      //   previewContainer.appendChild(loadingIndicator);
          // 尝试直接预览作为备选方案
          previewContainer.innerHTML = '';
          const directIframe = document.createElement('iframe');
          directIframe.style.width = '100%';
          directIframe.style.height = '100%';
          directIframe.style.border = 'none';
          directIframe.style.minHeight = '600px';
          directIframe.src = this.currentExcelUrl;
      //   // 监听iframe加载完成
      //   iframe.onload = () => {
      //     this.excelLoading = false;
      //     if (loadingIndicator && loadingIndicator.parentNode) {
      //       loadingIndicator.parentNode.removeChild(loadingIndicator);
      //     }
      //   };
          const fallbackMessage = document.createElement('div');
          fallbackMessage.textContent = 'Office预览服务加载超时,正在尝试直接预览...';
          fallbackMessage.style.cssText = `
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            padding: 10px;
            background-color: #f56c6c;
            color: white;
            text-align: center;
            font-size: 14px;
            z-index: 10;
          `;
      //   // 设置超时处理
      //   this.excelPreviewTimeout = setTimeout(() => {
      //     this.excelLoading = false;
      //     if (loadingIndicator && loadingIndicator.parentNode) {
      //       loadingIndicator.parentNode.removeChild(loadingIndicator);
      //     }
          previewContainer.appendChild(directIframe);
          previewContainer.appendChild(fallbackMessage);
      //     // 尝试直接预览作为备选方案
      //     previewContainer.innerHTML = '';
      //     const directIframe = document.createElement('iframe');
      //     directIframe.style.width = '100%';
      //     directIframe.style.height = '100%';
      //     directIframe.style.border = 'none';
      //     directIframe.style.minHeight = '600px';
      //     directIframe.src = this.currentExcelUrl;
          directIframe.onload = () => {
            if (fallbackMessage && fallbackMessage.parentNode) {
              fallbackMessage.parentNode.removeChild(fallbackMessage);
            }
          };
      //     const fallbackMessage = document.createElement('div');
      //     fallbackMessage.textContent = 'Office预览服务加载超时,正在尝试直接预览...';
      //     fallbackMessage.style.cssText = `
      //       position: absolute;
      //       top: 0;
      //       left: 0;
      //       right: 0;
      //       padding: 10px;
      //       background-color: #f56c6c;
      //       color: white;
      //       text-align: center;
      //       font-size: 14px;
      //       z-index: 10;
      //     `;
          // 二次超时处理
          setTimeout(() => {
            if (directIframe && directIframe.parentNode) {
              directIframe.parentNode.removeChild(directIframe);
            }
            const errorMessage = document.createElement('div');
            errorMessage.innerHTML = `
              <div style="text-align: center; padding: 40px;">
                <h3 style="color: #f56c6c; margin-bottom: 20px;">预览失败</h3>
                <p style="color: #666; margin-bottom: 30px;">无法在浏览器中预览Excel文件,请点击下方按钮下载文件后查看。</p>
                <button onclick="this.parentNode.parentNode.querySelector('.download-btn').click()"
                        style="padding: 8px 20px; background: #409EFF; color: white; border: none; border-radius: 4px; cursor: pointer;">
                  下载Excel文件
                </button>
              </div>
            `;
            previewContainer.appendChild(errorMessage);
          }, 20000);
        }, 25000);
      }
      //     previewContainer.appendChild(directIframe);
      //     previewContainer.appendChild(fallbackMessage);
      //     directIframe.onload = () => {
      //       if (fallbackMessage && fallbackMessage.parentNode) {
      //         fallbackMessage.parentNode.removeChild(fallbackMessage);
      //       }
      //     };
      //     // 二次超时处理
      //     setTimeout(() => {
      //       if (directIframe && directIframe.parentNode) {
      //         directIframe.parentNode.removeChild(directIframe);
      //       }
      //       const errorMessage = document.createElement('div');
      //       errorMessage.innerHTML = `
      //         <div style="text-align: center; padding: 40px;">
      //           <h3 style="color: #f56c6c; margin-bottom: 20px;">预览失败</h3>
      //           <p style="color: #666; margin-bottom: 30px;">无法在浏览器中预览Excel文件,请点击下方按钮下载文件后查看。</p>
      //           <button onclick="this.parentNode.parentNode.querySelector('.download-btn').click()"
      //                   style="padding: 8px 20px; background: #409EFF; color: white; border: none; border-radius: 4px; cursor: pointer;">
      //             下载Excel文件
      //           </button>
      //         </div>
      //       `;
      //       previewContainer.appendChild(errorMessage);
      //     }, 20000);
      //   }, 25000);
      // }
    },
    /** 处理打印按钮点击 */
@@ -1554,28 +1996,49 @@
        // 获取用户选择的选项
        const { includeQrCode, selectedAnnotations } = this.excelOptions;
        console.log('下载选项:', { includeQrCode, selectedAnnotations });
     var id = this.recordId ;
        this.getExcelFile(id).then(blob => {
           this.$modal.closeLoading();
           // 保存文件信息并显示静态弹窗
        //   alert(23)
           this.currentExcelUrl = URL.createObjectURL(blob);
           const link = document.createElement('a');
           link.href = this.currentExcelUrl;
           // 构建文件名,包含选项信息
           let filename = `record_${this.currentExcelId}`;
           if (includeQrCode) filename += '_qr';
           // if (selectedAnnotations.length > 0) {
           //   filename += `_anno${selectedAnnotations.join('')}`;x
           // }
           filename += `_${new Date().getTime()}.xls`;
           link.download = filename;
           // 触发下载
           document.body.appendChild(link);
           link.click();
           document.body.removeChild(link);
           // 提示下载成功
           this.$modal.msgSuccess('Excel文件下载成功');
          // alert(this.currentExcelUrl)
           // this.currentExcelBlob = blob;
           // this.currentExcelId = id;
           // this.excelDialogVisible = true;
           // this.excelLoading = false;
         }).catch(error => {
           this.$modal.closeLoading();
           console.error('获取Excel文件失败:', error);
           this.$modal.msgError('获取Excel文件失败,请稍后重试');
               this.showExcelPreview = false;
         });
       // alert(this.excelOptions.includeQrCode)
        // 创建下载链接,文件名包含选项信息
        const link = document.createElement('a');
        link.href = this.currentExcelUrl;
        // 构建文件名,包含选项信息
        let filename = `record_${this.currentExcelId}`;
        if (includeQrCode) filename += '_qr';
        if (selectedAnnotations.length > 0) {
          filename += `_anno${selectedAnnotations.join('')}`;
        }
        filename += `_${new Date().getTime()}.xlsx`;
        link.download = filename;
        // 触发下载
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        // 提示下载成功
        this.$modal.msgSuccess('Excel文件下载成功');
      }
    },
@@ -1600,7 +2063,7 @@
      });
    },
    /** 清理Excel预览相关资源 */
    /** 清理Excel预览相关资源并关闭对话框 */
    cleanupExcelPreview(iframe, url) {
      setTimeout(() => {
        if (iframe && iframe.parentNode) {
@@ -1610,12 +2073,32 @@
          URL.revokeObjectURL(url);
        }
        this.excelRenderError = '';
        this.showExcelPreview = false; // 关闭预览对话框
      }, 1000);
    },
    /** 从后端获取Excel文件 */
    getExcelFile(id) {
      var includeQrCode = this.excelOptions.includeQrCode;
      var urls = `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`
      //+"/"+includeQrCode;
//       // if(this.excelOptions.subselectedSignatures.length!=0)
//       // {
//       //   var selectedSignatures = this.excelOptions.subselectedSignatures
//       //   urls = urls +'/'+ selectedSignatures
//       //  // alert(urls)
//       //   }
//       console.log(this.excelOptions.subselectedAnnotations)
//       alert(234)
//       if(this.excelOptions.subselectedAnnotations.length!=0)
//       {
//         var selectedAnnotations = this.excelOptions.subselectedAnnotations
//         urls = urls+"/"+selectedAnnotations
//        // alert(urls)
//         }
// alert(urls)
      return new Promise((resolve, reject) => {
        // 首先尝试使用axios(项目已有的HTTP客户端)
        try {
@@ -1625,13 +2108,17 @@
          // 构建参数,包含注解内容
          const params = {
            recordId: id,
            selectedSignatures: this.excelOptions.subselectedSignatures,
            selectedAnnotations: this.excelOptions.subselectedAnnotations,
            includeQrCode: this.excelOptions.includeQrCode
          };
alert(355)
          console.log(params)
          alert(457)
          axios({
            method: 'Post',
            url: `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`+"/"+includeQrCode,
            params: params,
            url: urls,
            data: params,
            responseType: 'blob',
            headers: { 'Authorization': 'Bearer ' + getToken() }
          }).then(response => {
@@ -1830,7 +2317,7 @@
        // 直接下载
        const link = document.createElement('a');
        link.href = url;
        link.download = `${prefix}_${new Date().getTime()}.xlsx`;
        link.download = `${prefix}_${new Date().getTime()}.xls`;
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
@@ -1849,7 +2336,7 @@
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = `record_${id}_${new Date().getTime()}.xlsx`;
            link.download = `record_${id}_${new Date().getTime()}.xls`;
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
@@ -1868,13 +2355,13 @@
    {
      this.download('/system/records/model', {
      }, `records_${new Date().getTime()}.xlsx`)
      }, `records_${new Date().getTime()}.xls`)
    },
    handleExportTemplateOther()
    {
          this.download('/system/records/modelOther', {
      }, `records_${new Date().getTime()}.xlsx`)
      }, `records_${new Date().getTime()}.xls`)
    },
  /** 导入操作*/
    async handleImportData({file}){