From c50a874feed1ceceb18e0d42f95e4094eef98128 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期四, 27 十一月 2025 23:32:56 +0800
Subject: [PATCH] 修改了代码
---
src/views/archiveManager/index.vue | 1432 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 1,342 insertions(+), 90 deletions(-)
diff --git a/src/views/archiveManager/index.vue b/src/views/archiveManager/index.vue
index 51f93be..dcb1fb4 100644
--- a/src/views/archiveManager/index.vue
+++ b/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="妗f绠�(瀹�)鍙�" prop="archiveRoomNumber">
<el-input
@@ -242,7 +307,7 @@
>鎵归噺鎻愪氦</el-button>
</el-col>
- <el-col :span="1.5">
+ <el-col v-if="userId==1" :span="1.5">
<el-button
type="warning"
plain
@@ -252,8 +317,17 @@
v-hasPermi="['system:materials:edit']"
>瀵煎叆妯℃澘涓嬭浇</el-button>
</el-col>
-
- <el-col :span="1.5">
+ <el-col v-if="userId!=1" :span="1.5">
+ <el-button
+ type="warning"
+ plain
+ icon="el-icon-download"
+ size="mini"
+ @click="handleExportTemplateOther"
+ v-hasPermi="['system:materials:edit']"
+ >瀵煎叆妯℃澘涓嬭浇</el-button>
+ </el-col>
+ <el-col :span="1.5">
<el-upload
action=""
@@ -278,12 +352,84 @@
<el-table v-loading="loading" :data="recordsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
+
+
+
+ <el-table-column label="鎿嶄綔" align="center" width="190" class-name="small-padding fixed-width">
+ <template slot-scope="scope">
+ <el-button
+ v-if="scope.row.ownData"
+
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
+ @click="handleInfo(scope.row)"
+ v-hasPermi="['system:records:edit']"
+ >缂栬緫鍗峰唴鐩綍</el-button>
+
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
+ @click="handleCheck(scope.row)"
+ >鏌ョ湅</el-button>
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-printer"
+ @click="viewAndPrintExcel(scope.row)"
+ title="鏌ョ湅骞舵墦鍗癊xcel鏂囦欢"
+ >鎵撳嵃棰勬暣鐞嗘竻鍗�</el-button>
+ <el-button
+ v-if="userId!==1&&scope.row.ownData"
+
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
+ @click="handleSubmit(scope.row)"
+ v-hasPermi="['system:records:edit']"
+ >鎻愪氦妗堝嵎</el-button>
+ <el-button
+ v-if="scope.row.ownData||userId===1"
+
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
+ @click="handleUpdate(scope.row)"
+ v-hasPermi="['system:records:edit']"
+ >淇敼</el-button>
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-delete"
+ @click="handleDelete(scope.row)"
+ v-hasPermi="['system:records:remove']"
+ >鍒犻櫎</el-button>
+ <el-dropdown size="mini" v-hasPermi="['system:records:remove']" @command="(command) => handleCommand(command, scope.row)">
+ <el-button size="mini" type="text" icon="el-icon-d-arrow-right">鏇村</el-button>
+ <el-dropdown-menu slot="dropdown">
+
+ <el-dropdown-item command="handleAuthUser" icon="el-icon-user"
+ >鍒嗛厤鐢ㄦ埛</el-dropdown-item>
+ </el-dropdown-menu>
+ </el-dropdown>
+ </template>
+ </el-table-column>
+
+ <el-table-column label="鐘舵��" align="center" prop="recordStatus" width="120">
+ <template slot-scope="scope">
+ <el-button :type="scope.row.recordStatus === '鏈綍鍏�' ? 'danger' : 'success'" size="mini">
+ {{ scope.row.recordStatus }}
+ </el-button>
+ </template>
+ </el-table-column>
+
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
<el-table-column label="妗f鍙�" align="center" prop="recordId" />
<el-table-column label="鍙戞枃鍙�" align="center" prop="inquiryNumber" />
- <el-table-column label="椤圭洰鍚嶇О" align="center" prop="everyProjectName" />
- <el-table-column label="妗堝嵎棰樺悕" align="center" prop="caseTitle" show-overflow-tooltip />
+
+ <el-table-column label="妗堝嵎棰樺悕" align="center" prop="caseTitle" />
<el-table-column label="鍏紑灞炴��" align="center" prop="publicAttribute" />
<el-table-column label="缂栧埗鍗曚綅" align="center" prop="preparationUnit" />
<el-table-column label="缂栧埗鏃ユ湡" align="center" prop="preparationDate" width="180">
@@ -304,69 +450,7 @@
<el-table-column label="缂╁井鍙�" align="center" prop="microfilmNumber" />
<el-table-column label="澶囨敞" align="center" prop="remarks" />
<el-table-column label="鍘嗗彶鐩稿叧鍙戞枃鍙�" align="center" prop="historicalReferenceNumber" />
-
- <el-table-column label="鐘舵��" align="center" prop="recordStatus">
- <template slot-scope="scope">
- <el-button :type="scope.row.recordStatus === '鏈綍鍏�' ? 'danger' : 'success'" size="mini">
- {{ scope.row.recordStatus }}
- </el-button>
- </template>
-</el-table-column>
-
-
- <el-table-column label="鎿嶄綔" align="center" width="190" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- v-if="scope.row.ownData"
-
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleInfo(scope.row)"
- v-hasPermi="['system:records:edit']"
- >妗堝嵎璇︾粏淇℃伅</el-button>
-
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleCheck(scope.row)"
- >鏌ョ湅</el-button>
- <el-button
- v-if="userId!==1&&scope.row.ownData"
-
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleSubmit(scope.row)"
- v-hasPermi="['system:records:edit']"
- >鎻愪氦妗堝嵎</el-button>
- <el-button
- v-if="scope.row.ownData||userId===1"
-
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['system:records:edit']"
- >淇敼</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['system:records:remove']"
- >鍒犻櫎</el-button>
- <el-dropdown size="mini" v-hasPermi="['system:records:remove']" @command="(command) => handleCommand(command, scope.row)">
- <el-button size="mini" type="text" icon="el-icon-d-arrow-right">鏇村</el-button>
- <el-dropdown-menu slot="dropdown">
-
- <el-dropdown-item command="handleAuthUser" icon="el-icon-user"
- >鍒嗛厤鐢ㄦ埛</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
+<el-table-column label="椤圭洰鍚嶇О" align="center" prop="everyProjectName" />
</el-table>
<pagination
@@ -376,6 +460,91 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
+ <!-- Excel鎿嶄綔寮圭獥 -->
+ <el-dialog :visible.sync="excelDialogVisible" class="excel-dialog-overlay" @click="closeExcelDialog">
+ <div class="excel-dialog" @click.stop>
+ <div class="excel-dialog-header">
+ <h3>Excel鎿嶄綔</h3>
+ <p class="excel-dialog-tip">璇烽�夋嫨浠ヤ笅鎿嶄綔澶勭悊Excel鏂囦欢</p>
+
+ <!-- <button class="excel-dialog-close" @click="closeExcelDialog">脳</button> -->
+ </div>
+ <div class="excel-dialog-body">
+ <!-- 閫夋嫨妗嗗尯鍩� -->
+ <div class="excel-options-section">
+ <!-- 浜岀淮鐮侀�夋嫨 -->
+ <div class="option-group">
+ <label class="option-label">
+ <input type="checkbox" v-model="excelOptions.includeQrCode">
+ <span>鍖呭惈鏉″舰鐮�</span>
+ </label>
+ </div>
+
+ <!-- 娉ㄨВ閫夋嫨 -->
+ <div class="option-group">
+ <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="index">
+ <span>{{ annotation }}
+ </span>
+ </label>
+ </div>
+ </div>
+
+ <!-- 绛惧悕鏍忛�夋嫨 -->
+ <div class="option-group">
+ <div class="option-label">绛惧悕鏍忚缃�:</div>
+ <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="index">
+ <span>{{ signature }}</span>
+ </label>
+
+
+
+ </div>
+<!-- <p v-if="excelOptions.selectedSignatures.length === 0" class="option-tip">璇烽�夋嫨鑷冲皯涓�涓鍚嶆爮</p> -->
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 浼樺寲鐨凟xcel棰勮缁勪欢 -->
+ <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"
+ :src="currentExcelUrl"
+ style="width: 100%; height: 500px;"
+ @rendered="renderedHandler"
+ @error="handleExcelRenderError"
+ />
+
+ <!-- 閿欒鎻愮ず -->
+ <div v-if="excelRenderError" class="excel-error-message">
+ <h3>Excel娓叉煋澶辫触</h3>
+ <p>{{ excelRenderError }}</p>
+ <p>璇峰皾璇曚互涓嬭В鍐虫柟妗堬細</p>
+ <ul>
+ <li>涓嬭浇鏂囦欢鍚庝娇鐢‥xcel杞欢鎵撳紑</li>
+ <li>纭鏂囦欢鏍煎紡鏄惁涓烘敮鎸佺殑.xls鎴�.xlsx</li>
+ </ul>
+ <button class="excel-dialog-btn download-btn" @click="handleDownloadClick">涓嬭浇Excel鏂囦欢</button>
+ </div>
+ </div>
+</el-dialog>
+ <div class="excel-dialog-footer">
+ <button class="excel-dialog-btn preview-btn" @click="handlePreviewClick">棰勮</button>
+ <button class="excel-dialog-btn print-btn" @click="handlePrintClick">鎵撳嵃</button>
+ <button class="excel-dialog-btn download-btn" @click="handleDownloadClick">涓嬭浇</button>
+ </div>
+ </div>
+
+
+
+ </el-dialog>
<!-- 鏌ョ湅鏁版嵁鎸夐挳 -->
<el-dialog :title="title" :visible.sync="open_check" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
@@ -406,7 +575,8 @@
v-model="form.recordZone"
placeholder="閫夋嫨鍦板尯"
@change="handleRecordTypeChange"
- :disabled="userId!=1" >
+ disabled
+ >
<el-option
v-for="item in zoneTypeOptions"
:key="item.value"
@@ -661,7 +831,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="妗f绠�(瀹�)鍙�" prop="archiveRoomNumber">
<el-input v-model="form.archiveRoomNumber" placeholder="璇疯緭鍏ユ。妗堢(瀹�)鍙�" />
@@ -686,14 +863,25 @@
</template>
<script>
-import { batchSubmitRecords,updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records"
+import VueOfficeExcel from '@vue-office/excel'
+import '@vue-office/excel/lib/index.css'
+
+import axios from 'axios'
+import { getToken } from '@/utils/auth'
+import { enload, batchSubmitRecords,updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records"
import { listAllCategory } from "@/api/system/category"
import { listAllProjectName } from "@/api/system/projectName"
import { listPlaceName, listAllPlaceName } from "@/api/system/placeName"
export default {
+ components: {
+ VueOfficeExcel
+ },
name: "Records",
data() {
return {
+ showExcelPreview: false,
+ excel: 'http://localhost:8080/profile/upload/12.xls', //璁剧疆鏂囨。缃戠粶鍦板潃锛屽彲浠ユ槸鐩稿鍦板潃
+
open_check: false,
securityLevelOptions: [
{ value: '绉樺瘑', label: '绉樺瘑' },
@@ -702,6 +890,8 @@
maxId: 0,
// 椤圭洰鍚嶇О閫夐」
projectOptions: [],
+ // 椤圭洰绠$悊鍏徃閫夐」
+ projectCompanyOptions: [],
// 妗f绫诲瀷閫夐」
recordTypeOptions: [],
//鍦板尯绫诲瀷
@@ -745,6 +935,11 @@
pageSize: 10,
recordId: null,
inquiryNumber: null,
+ categoryType: null, // 绫诲埆绫诲瀷
+ categoryZone: null, // 绫诲埆鍦板尯
+ categoryYear: null, // 绫诲埆骞翠唤
+ categorySeq: null, // 寮�濮嬪簭鍙�
+ categorySeqEnd: null, // 缁撴潫搴忓彿
everyProjectName: null,
caseTitle: null,
publicAttribute: null,
@@ -764,6 +959,28 @@
remarks: null,
historicalReferenceNumber: null
},
+ // Excel寮圭獥鐩稿叧鏁版嵁
+ excelDialogVisible: false,
+ currentExcelUrl: '',
+ currentExcelBlob: null,
+ currentExcelId: '',
+ excelLoading: false,
+ excelPreviewTimeout: null,
+ excelRenderError: '', // Excel娓叉煋閿欒淇℃伅
+ // Excel閫夐」閰嶇疆
+ excelOptions: {
+ includeQrCode: false, // 鏄惁鍖呭惈浜岀淮鐮�
+ selectedAnnotations: ["鏈竻鍗曠敱妗f褰㈡垚閮ㄩ棬瀹屾垚",
+ "鏂囦欢绫诲瀷蹇呴』褰曞叆锛屽寘鎷粨璁烘潗鏂欍�佽繃绋嬫潗鏂欍�佺敵璇锋潗鏂欙紝鍏朵粬鏉愭枡",
+ "鍏紑灞炴�у繀椤诲綍鍏ワ紝涓诲姩鍏紑銆佷緷鐢宠鍏紑銆佸厤浜堝叕寮�",
+ "淇濈鏈熼檺:30骞存垨姘镐箙",
+ "椤靛彿鎸夌収姝e紡褰曞叆椤电爜涓哄噯"], // 閫変腑鐨勬敞瑙e垪琛�
+ includeSignature: false, // 鏄惁鍖呭惈绛惧悕鏍�
+ selectedSignatures: ['涓氬姟绉戝绉讳氦浜�:', '瀹℃壒绉戠Щ浜や汉:', '妗f鏁寸悊鍏徃:'], // 閫変腑鐨勭鍚嶆爮鍒楄〃
+ subselectedSignatures: [],
+ subselectedAnnotations: [],
+ signaturePosition: 'bottom' // 绛惧悕鏍忎綅缃細top/bottom
+ },
// 琛ㄥ崟鍙傛暟
form: {
recordSeq: '',
@@ -792,7 +1009,8 @@
}
},
created() {
-
+ // 鐩戝惉ESC閿叧闂脊绐�
+ document.addEventListener('keydown', this.handleKeyDown);
this.userId = this.$store.state.user.id;
// 鑾峰彇鐢ㄦ埛瑙掕壊
@@ -800,6 +1018,7 @@
this.getRecordTypes()
this.getZoneOptions()
this.fetchProjectOptions()
+ this.fetchProjectCompanyOptions()
this.getList()
},
watch: {
@@ -822,7 +1041,42 @@
immediate: true
}
},
+ beforeDestroy() {
+ // 娓呯悊浜嬩欢鐩戝惉鍣ㄥ拰瀹氭椂鍣�
+ document.removeEventListener('keydown', this.handleKeyDown);
+ if (this.excelPreviewTimeout) {
+ clearTimeout(this.excelPreviewTimeout);
+ }
+ if (this.currentExcelUrl) {
+ URL.revokeObjectURL(this.currentExcelUrl);
+ }
+ },
methods: {
+ /** Excel娓叉煋瀹屾垚澶勭悊 */
+ renderedHandler() {
+ console.log("Excel娓叉煋瀹屾垚");
+ this.excelLoading = false;
+ this.excelRenderError = '';
+ },
+ /** Excel娓叉煋閿欒澶勭悊 */
+ handleExcelRenderError(error) {
+ console.error("Excel娓叉煋澶辫触:", error);
+ this.excelLoading = false;
+
+ // 璁剧疆鍙嬪ソ鐨勯敊璇俊鎭�
+ if (error && error.message) {
+ this.excelRenderError = error.message;
+ } else {
+ this.excelRenderError = '鏃犳硶娓叉煋姝xcel鏂囦欢锛屽彲鑳芥槸鏂囦欢鏍煎紡涓嶅吋瀹规垨宸叉崯鍧忋��';
+ }
+
+ // 灏濊瘯澶囬�夋柟妗�
+ this.tryAlternativePreview();
+ },
+ /** 灏濊瘯澶囬�夐瑙堟柟妗� */
+ tryAlternativePreview() {
+ console.log('灏濊瘯澶囬�夐瑙堟柟妗�...');
+ },
getId()
{
var _this = this;
@@ -839,19 +1093,19 @@
// 鐢熸垚妗堝嵎棰樺悕
generateCaseTitle() {
let titleParts = [];
-
+
if (this.form.constructionUnit) {
titleParts.push(this.form.constructionUnit);
}
-
+
if (this.form.constructionAddress) {
titleParts.push(this.form.constructionAddress);
}
-
+
if (this.form.projectName) {
titleParts.push(this.form.projectName);
}
-
+
this.form.caseTitle = titleParts.join('');
},
async getZoneOptions()
@@ -861,7 +1115,7 @@
console.log("1111111333333",response.data)
this.zoneTypeOptions = response.data.data.map(item => ({
value: item.nnumber,
- label: item.name
+ label: item.nnumber
}))
} catch (error) {
console.error('鑾峰彇椤圭洰鍚嶇О鍒楄〃澶辫触:', error)
@@ -879,13 +1133,30 @@
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)
+ }
+ },
/** 鑾峰彇妗f绫诲瀷鍒楄〃 */
getRecordTypes() {
return new Promise((resolve) => {
listAllCategory().then(response => {
this.recordTypeOptions = response.data.map(item => ({
value: item.numb,
- label: item.nname
+ label: item.numb
}))
resolve()
})
@@ -916,7 +1187,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
@@ -965,6 +1270,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()
},
// 澶氶�夋閫変腑鏁版嵁
@@ -996,9 +1307,10 @@
//
handleSubmit(row)
{
- // alert(row.id)
+ //alert(row.id)
var id = row.id
- updateStatusById(id).then(response=>{
+ var status = '褰曞叆瀹屾垚'
+ updateStatusById(status, id).then(response=>{
this.$modal.msgSuccess("鎻愪氦鎴愬姛")
this.getList()
})
@@ -1018,10 +1330,18 @@
if(this.recordTypeOptions.length > 0) {
const recordParts = response.data.recordId.split('-')
this.$set(this.form, 'recordType', recordParts[0])
- this.$set(this.form, 'recordZone', recordParts[1])
+ if(this.recordTypeOptions.length==4)
+ {
+ this.$set(this.form, 'recordZone', recordParts[1])
this.$set(this.form, 'recordYear', recordParts[2])
this.$set(this.form, 'recordSeq', recordParts[3])
+ }
+ else
+ {
+ this.$set(this.form, 'recordYear', recordParts[1])
+ this.$set(this.form, 'recordSeq', recordParts[2])
+ }
}
this.open = true
this.title = "淇敼妗f璁板綍"
@@ -1039,7 +1359,7 @@
.map(item => item.id);
// 妫�鏌ラ�変腑鐨処D鏄惁鍏ㄩ儴灞炰簬鑷繁
const invalidIds = this.ids.filter(id => !myValidIds.includes(id));
-
+
if (invalidIds.length > 0) {
this.$message.error(`鍖呭惈鏃犳潈鎿嶄綔鐨処D: ${invalidIds.join(',')}`);
return false;
@@ -1067,10 +1387,18 @@
if(this.recordTypeOptions.length > 0) {
const recordParts = response.data.recordId.split('-')
this.$set(this.form, 'recordType', recordParts[0])
+ if(this.recordTypeOptions.length==4)
+ {
this.$set(this.form, 'recordZone', recordParts[1])
this.$set(this.form, 'recordYear', recordParts[2])
this.$set(this.form, 'recordSeq', recordParts[3])
+ }
+ else
+ {
+ this.$set(this.form, 'recordYear', recordParts[1])
+ this.$set(this.form, 'recordSeq', recordParts[2])
+ }
}
this.open_check = true
this.title = "鏌ョ湅妗f璁板綍"
@@ -1079,6 +1407,7 @@
/** 鎻愪氦鎸夐挳 */
submitForm() {
+ console.log(this.form)
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
@@ -1124,7 +1453,7 @@
handleAuthUser: function(row) {
const roleId = 2
var archiveRecordsId = row.recordId
- // alert(roleId)
+
this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+archiveRecordsId)
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
@@ -1139,10 +1468,628 @@
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- this.download('system/records/export', {
- ...this.queryParams
+ // 妫�鏌ユ槸鍚︽湁閫変腑鐨勮褰�
+ //alert(234)
+ // alert(this.ids.length)
+ if (this.ids && this.ids.length > 0) {
+ // 鍙鍑洪�変腑鐨勮褰�
+ this.download('system/records/export', {
+ ids: this.ids.join(',') // 灏嗛�変腑鐨処D鏁扮粍杞崲涓洪�楀彿鍒嗛殧鐨勫瓧绗︿覆
+ }, `records_${new Date().getTime()}.xlsx`)
+ } else {
+ // 娌℃湁閫変腑璁板綍鏃讹紝瀵煎嚭绗﹀悎鏌ヨ鏉′欢鐨勬墍鏈夎褰�
+ this.download('system/records/export', {
+ ...this.queryParams
+ }, `records_${new Date().getTime()}.xlsx`)
+ }
+ },
+
+ /** 鏌ョ湅骞舵墦鍗癊xcel鏂囦欢 */
+ viewAndPrintExcel(row) {
+ const id = row.id || this.ids;
+ // alert(id)
+ this.recordId = id;
+ this.$modal.loading('姝e湪鑾峰彇Excel鏂囦欢锛岃绋嶅��...');
+
+ // 浠庡悗绔幏鍙朎xcel鏂囦欢
+ this.getExcelFile(id).then(blob => {
+ this.$modal.closeLoading();
+ // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+ this.currentExcelUrl = URL.createObjectURL(blob);
+ 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鏂囦欢澶辫触锛岃绋嶅悗閲嶈瘯');
+ });
+ },
+
+ /** 澶勭悊閿洏浜嬩欢 - ESC閿叧闂脊绐� */
+ handleKeyDown(e) {
+ if (e.key === 'Escape' && this.excelDialogVisible) {
+ this.closeExcelDialog();
+ }
+ },
+
+ /** 鍏抽棴Excel寮圭獥骞舵竻鐞嗚祫婧� */
+ closeExcelDialog() {
+ this.excelDialogVisible = false;
+ // alert(this.excelDialogVisible)
+ if (this.excelPreviewTimeout) {
+ clearTimeout(this.excelPreviewTimeout);
+ this.excelPreviewTimeout = null;
+ }
+ if (this.currentExcelUrl) {
+ URL.revokeObjectURL(this.currentExcelUrl);
+ this.currentExcelUrl = '';
+ }
+ this.currentExcelBlob = null;
+ },
+closeExcelPreviewDialog()
+{
+
+ this.showExcelPreview = false;
+},
+ /** 澶勭悊棰勮鎸夐挳鐐瑰嚮 */
+ handlePreviewClick() {
+ this.showExcelPreview = true;
+ this.excelRenderError = '';
+ var id = this.recordId ;
+ this.$modal.loading('姝e湪鑾峰彇Excel鏂囦欢锛岃绋嶅��...');
+
+ // 浠庡悗绔幏鍙朎xcel鏂囦欢
+ this.getExcelFile(id).then(blob => {
+ this.$modal.closeLoading();
+ // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+ this.currentExcelUrl = URL.createObjectURL(blob);
+ 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鏂囦欢澶辫触锛岃绋嶅悗閲嶈瘯');
+ });
+ // 閲嶇疆vue-office-excel缁勪欢
+ if (this.currentExcelUrl) {
+ const tempUrl = this.currentExcelUrl;
+ this.currentExcelUrl = '';
+ this.$nextTick(() => {
+ this.currentExcelUrl = tempUrl;
+ });
+ }
+
+ const previewContainer = this.$refs.excelPreviewContainer;
+
+ // 娓呯┖棰勮瀹瑰櫒
+ if (previewContainer) {
+ previewContainer.innerHTML = '';
+
+ // 灏濊瘯浣跨敤寰蒋Office Online棰勮鏈嶅姟浣滀负澶囬��
+ const officeOnlineUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(this.currentExcelUrl)}`;
+
+ // 鍒涘缓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鏂囦欢棰勮';
+
+ // 鍒涘缓鍔犺浇鎸囩ず鍣�
+ const loadingIndicator = document.createElement('div');
+ loadingIndicator.className = 'loading-indicator';
+ loadingIndicator.innerHTML = `
+ <div class="loading-spinner"></div>
+ <p>姝e湪鍔犺浇Excel鏂囦欢锛岃绋嶅��...</p>
+ `;
+ previewContainer.style.position = 'relative';
+ previewContainer.appendChild(iframe);
+ previewContainer.appendChild(loadingIndicator);
+
+ // 鐩戝惉iframe鍔犺浇瀹屾垚
+ iframe.onload = () => {
+ this.excelLoading = false;
+ if (loadingIndicator && loadingIndicator.parentNode) {
+ loadingIndicator.parentNode.removeChild(loadingIndicator);
+ }
+ };
+
+ // 璁剧疆瓒呮椂澶勭悊
+ this.excelPreviewTimeout = setTimeout(() => {
+ this.excelLoading = false;
+ if (loadingIndicator && loadingIndicator.parentNode) {
+ loadingIndicator.parentNode.removeChild(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;
+
+ 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;
+ `;
+
+ 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;">鏃犳硶鍦ㄦ祻瑙堝櫒涓瑙圗xcel鏂囦欢锛岃鐐瑰嚮涓嬫柟鎸夐挳涓嬭浇鏂囦欢鍚庢煡鐪嬨��</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);
+ }
+ },
+
+ /** 澶勭悊鎵撳嵃鎸夐挳鐐瑰嚮 */
+ handlePrintClick() {
+ if (this.currentExcelUrl) {
+ // 鍒涘缓涓�涓复鏃秈frame鐢ㄤ簬鎵撳嵃
+ const iframe = document.createElement('iframe');
+ iframe.style.position = 'absolute';
+ iframe.style.left = '-9999px';
+ iframe.style.top = '-9999px';
+ iframe.style.width = '210mm';
+ iframe.style.height = '297mm';
+ document.body.appendChild(iframe);
+
+ // 鐩戝惉iframe鍔犺浇瀹屾垚
+ iframe.onload = () => {
+ try {
+ // 鎵ц鎵撳嵃
+ iframe.contentWindow.print();
+
+ // 璁剧疆瓒呮椂绉婚櫎iframe
+ setTimeout(() => {
+ if (iframe && iframe.parentNode) {
+ iframe.parentNode.removeChild(iframe);
+ }
+ }, 1000);
+ } catch (error) {
+ console.error('Print error:', error);
+ // 鎵撳嵃澶辫触鏃讹紝鎻愮ず鐢ㄦ埛涓嬭浇
+ this.$confirm('鎵撳嵃澶辫触锛屾槸鍚︿笅杞芥枃浠讹紵', '鎻愮ず', {
+ confirmButtonText: '涓嬭浇',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ this.handleDownloadClick();
+ });
+
+ // 绉婚櫎iframe
+ if (iframe && iframe.parentNode) {
+ iframe.parentNode.removeChild(iframe);
+ }
+ }
+ };
+
+ // 璁剧疆iframe鐨剆rc
+ iframe.src = this.currentExcelUrl;
+ }
+ },
+
+ /** 澶勭悊涓嬭浇鎸夐挳鐐瑰嚮 */
+ handleDownloadClick() {
+ if (this.currentExcelUrl) {
+ // 鑾峰彇鐢ㄦ埛閫夋嫨鐨勯�夐」
+ const { includeQrCode, selectedAnnotations } = this.excelOptions;
+ console.log('涓嬭浇閫夐」:', { includeQrCode, selectedAnnotations });
+
+ // 鍒涘缓涓嬭浇閾炬帴锛屾枃浠跺悕鍖呭惈閫夐」淇℃伅
+ 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鏂囦欢涓嬭浇鎴愬姛');
+ }
+ },
+
+ /** 妫�鏌ユ祻瑙堝櫒鏄惁鍙兘鏀寔鐩存帴棰勮Excel */
+ canPreviewExcelInBrowser() {
+ // 鐜板湪鎴戜滑浣跨敤寰蒋Office Online鏈嶅姟锛屽鎵�鏈夌幇浠f祻瑙堝櫒閮芥敮鎸侀瑙�
+ return true;
+ },
+
+ /** 澶勭悊Excel棰勮瓒呮椂鎯呭喌 */
+ handleExcelPreviewTimeout(url, iframe) {
+ // 瓒呮椂鍚庯紝鎻愪緵鍦ㄦ柊绐楀彛鎵撳紑鐨勯�夐」
+ this.$confirm('Excel鏂囦欢鍔犺浇瓒呮椂锛屾槸鍚﹀湪鏂扮獥鍙d腑鎵撳紑锛�', '鎻愮ず', {
+ confirmButtonText: '鎵撳紑',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ window.open(url, '_blank');
+ }).finally(() => {
+ // 娓呯悊锛氱Щ闄frame骞堕噴鏀綰RL瀵硅薄
+ this.cleanupExcelPreview(iframe, url);
+ });
+ },
+
+ /** 娓呯悊Excel棰勮鐩稿叧璧勬簮骞跺叧闂璇濇 */
+ cleanupExcelPreview(iframe, url) {
+ setTimeout(() => {
+ if (iframe && iframe.parentNode) {
+ document.body.removeChild(iframe);
+ }
+ if (url) {
+ URL.revokeObjectURL(url);
+ }
+ this.excelRenderError = '';
+ this.showExcelPreview = false; // 鍏抽棴棰勮瀵硅瘽妗�
+ }, 1000);
+ },
+
+ /** 浠庡悗绔幏鍙朎xcel鏂囦欢 */
+ 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
+ }
+ if(this.excelOptions.subselectedAnnotations.length!=0)
+ {
+ var selectedAnnotations = this.excelOptions.subselectedAnnotations
+ urls = urls+"/"+selectedAnnotations
+ }
+
+ return new Promise((resolve, reject) => {
+ // 棣栧厛灏濊瘯浣跨敤axios锛堥」鐩凡鏈夌殑HTTP瀹㈡埛绔級
+ try {
+ // 鑾峰彇鐢ㄦ埛閫夋嫨鐨勬敞瑙�
+ const { selectedAnnotations } = this.excelOptions;
+
+ // 鏋勫缓鍙傛暟锛屽寘鍚敞瑙e唴瀹�
+ const params = {
+ recordId: id,
+
+ };
+
+ axios({
+ method: 'Post',
+ url: urls,
+ params: params,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(response => {
+ resolve(response.data);
+ }).catch(error => {
+ // 濡傛灉axios澶辫触锛屽洖閫�鍒癤MLHttpRequest
+ console.warn('Axios璇锋眰澶辫触锛屽皾璇曚娇鐢╔MLHttpRequest:', error);
+ this.fallbackGetExcelFile(id, resolve, reject);
+ });
+ } catch (e) {
+ // 鎹曡幏浠讳綍鎰忓閿欒
+ reject(new Error('鑾峰彇Excel鏂囦欢鏃跺彂鐢熼敊璇�: ' + e.message));
+ }
+ });
+ },
+
+ /** 澶囩敤鐨刋MLHttpRequest鑾峰彇Excel鏂囦欢鏂规硶 */
+ fallbackGetExcelFile(id, resolve, reject) {
+ try {
+ const xhr = new XMLHttpRequest();
+
+ // 鏋勫缓鏌ヨ鍙傛暟锛屽寘鍚敞瑙e唴瀹�
+ const queryParams = new URLSearchParams({
+ id: id,
+ annotation1: "鏈竻鍗曠敱妗f褰㈡垚閮ㄩ棬瀹屾垚",
+ annotation2: "鏂囦欢绫诲瀷蹇呴』褰曞叆锛屽寘鎷粨璁烘潗鏂欍�佽繃绋嬫潗鏂欍�佺敵璇锋潗鏂欙紝鍏朵粬鏉愭枡",
+ annotation3: "鍏紑灞炴�у繀椤诲綍鍏ワ紝涓诲姩鍏紑銆佷緷鐢宠鍏紑銆佸厤浜堝叕寮�",
+ annotation4: "淇濈鏈熼檺:30骞存垨姘镐箙",
+ annotation5: "椤靛彿鎸夌収姝e紡褰曞叆椤电爜涓哄噯"
+ }).toString();
+
+ // 灏濊瘯涓嶅悓鐨凙PI璺緞锛屼互閫傚簲鍙兘鐨勫悗绔疄鐜�
+ const apiUrls = [
+ `${process.env.VUE_APP_BASE_API}/system/records/model?${queryParams}`,
+ `${process.env.VUE_APP_BASE_API}/system/records/model`
+ ];
+
+ let currentUrlIndex = 0;
+
+ const tryNextUrl = () => {
+ if (currentUrlIndex >= apiUrls.length) {
+ reject(new Error('鎵�鏈堿PI璺緞閮借姹傚け璐�'));
+ return;
+ }
+
+ const url = apiUrls[currentUrlIndex];
+ currentUrlIndex++;
+
+ xhr.open('GET', url, true);
+ xhr.setRequestHeader('Authorization', 'Bearer ' + getToken());
+ xhr.responseType = 'blob';
+
+ xhr.onload = () => {
+ if (xhr.status === 200) {
+ // 楠岃瘉杩斿洖鐨勬槸鍚︿负鏈夋晥鐨凚lob
+ if (xhr.response instanceof Blob && xhr.response.size > 0) {
+ resolve(xhr.response);
+ } else {
+ console.warn('杩斿洖鐨勬暟鎹笉鏄湁鏁堢殑Blob锛屽皾璇曚笅涓�涓猆RL');
+ tryNextUrl();
+ }
+ } else if (currentUrlIndex < apiUrls.length) {
+ console.warn(`URL ${url} 璇锋眰澶辫触 (${xhr.status})锛屽皾璇曚笅涓�涓猆RL`);
+ tryNextUrl();
+ } else {
+ reject(new Error(`璇锋眰澶辫触: ${xhr.status} ${xhr.statusText}`));
+ }
+ };
+
+ xhr.onerror = () => {
+ if (currentUrlIndex < apiUrls.length) {
+ console.warn(`URL ${url} 缃戠粶閿欒锛屽皾璇曚笅涓�涓猆RL`);
+ tryNextUrl();
+ } else {
+ reject(new Error('缃戠粶閿欒锛屾棤娉曡幏鍙朎xcel鏂囦欢'));
+ }
+ };
+
+ // 璁剧疆璇锋眰瓒呮椂
+ xhr.timeout = 30000; // 30绉�
+ xhr.ontimeout = () => {
+ if (currentUrlIndex < apiUrls.length) {
+ console.warn(`URL ${url} 璇锋眰瓒呮椂锛屽皾璇曚笅涓�涓猆RL`);
+ tryNextUrl();
+ } else {
+ reject(new Error('璇锋眰瓒呮椂锛屾棤娉曡幏鍙朎xcel鏂囦欢'));
+ }
+ };
+
+ xhr.send();
+ };
+
+ // 寮�濮嬪皾璇曠涓�涓猆RL
+ tryNextUrl();
+ } catch (e) {
+ reject(new Error('XMLHttpRequest璇锋眰澶辫触: ' + e.message));
+ }
+ },
+
+ /** 鎵归噺鎵撳嵃Excel鏂囦欢 */
+ batchPrintExcel() {
+ if (this.ids.length === 0) {
+ this.$modal.msgWarning('璇烽�夋嫨瑕佹墦鍗扮殑璁板綍');
+ return;
+ }
+
+ this.$confirm(`纭畾瑕佹墦鍗伴�変腑鐨� ${this.ids.length} 鏉¤褰曞悧锛焋, '鎵归噺鎵撳嵃纭', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 瀵逛簬鎵归噺鎿嶄綔锛屾垜浠彲浠ラ�夋嫨锛�
+ // 1. 濡傛灉鍚庣鏀寔鎵归噺瀵煎嚭锛岀洿鎺ヨ皟鐢ㄦ壒閲忓鍑烘帴鍙�
+ this.$modal.loading('姝e湪鍑嗗鎵归噺鎵撳嵃鏂囦欢锛岃绋嶅��...');
+
+ // 灏濊瘯鎵归噺瀵煎嚭API
+ this.getBatchExcelFile(this.ids).then(blob => {
+ this.$modal.closeLoading();
+ this.handleExcelBlobForPrint(blob, 'batch_records');
+ }).catch(error => {
+ this.$modal.closeLoading();
+ console.warn('鎵归噺瀵煎嚭澶辫触锛屽皾璇曢�愪釜澶勭悊:', error);
+
+ // 2. 濡傛灉鎵归噺瀵煎嚭澶辫触锛屾彁绀虹敤鎴烽�愪釜鎵撳嵃鎴栦笅杞�
+ this.$confirm('鎵归噺鎵撳嵃澶辫触锛屾槸鍚︿笅杞芥墍鏈夋枃浠讹紵', '鎻愮ず', {
+ confirmButtonText: '涓嬭浇',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 閫愪釜涓嬭浇鏂囦欢
+ this.downloadMultipleExcelFiles(this.ids);
+ }).catch(() => {});
+ });
+ }).catch(() => {});
+ },
+
+ /** 鑾峰彇鎵归噺Excel鏂囦欢 */
+ getBatchExcelFile(ids) {
+ return new Promise((resolve, reject) => {
+ try {
+ if (typeof axios !== 'undefined') {
+ axios({
+ method: 'get',
+ url: `${process.env.VUE_APP_BASE_API}/system/records/batchExport`,
+ params: { ids: ids.join(',') },
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + this.getToken() }
+ }).then(response => {
+ resolve(response.data);
+ }).catch(reject);
+ } else {
+ reject(new Error('鎵归噺瀵煎嚭鍔熻兘涓嶅彲鐢�'));
+ }
+ } catch (e) {
+ reject(e);
+ }
+ });
+ },
+
+ /** 澶勭悊Excel Blob鐢ㄤ簬鎵撳嵃 */
+ handleExcelBlobForPrint(blob, prefix = 'record') {
+ const url = URL.createObjectURL(blob);
+
+ if (this.canPreviewExcelInBrowser()) {
+ const iframe = document.createElement('iframe');
+ iframe.style.display = 'none';
+ document.body.appendChild(iframe);
+
+ iframe.src = url;
+
+ const timeoutId = setTimeout(() => {
+ this.handleExcelPreviewTimeout(url, iframe);
+ }, 5000);
+
+ iframe.onload = () => {
+ clearTimeout(timeoutId);
+ this.$confirm('Excel鏂囦欢宸插噯澶囧ソ锛屾槸鍚︽墦鍗帮紵', '鎵撳嵃纭', {
+ confirmButtonText: '鎵撳嵃',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ try {
+ iframe.contentWindow.print();
+ } catch (e) {
+ this.$modal.msgWarning('鎵撳嵃澶辫触锛屽皢鍦ㄦ柊绐楀彛鎵撳紑鏂囦欢');
+ window.open(url, '_blank');
+ } finally {
+ this.cleanupExcelPreview(iframe, url);
+ }
+ }).catch(() => {
+ window.open(url, '_blank');
+ this.cleanupExcelPreview(iframe, url);
+ });
+ };
+ } else {
+ // 鐩存帴涓嬭浇
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = `${prefix}_${new Date().getTime()}.xlsx`;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ URL.revokeObjectURL(url);
+ }
+ },
+
+ /** 涓嬭浇澶氫釜Excel鏂囦欢 */
+ downloadMultipleExcelFiles(ids) {
+ // 杩欓噷绠�鍗曞鐞嗕负閫愪釜涓嬭浇
+ // 瀹為檯搴旂敤涓彲鑳介渶瑕佽�冭檻鎬ц兘浼樺寲鎴栦娇鐢ㄥ帇缂╁寘
+ ids.forEach((id, index) => {
+ // 浣跨敤setTimeout閬垮厤娴忚鍣ㄩ檺鍒跺悓鏃朵笅杞�
+ setTimeout(() => {
+ this.getExcelFile(id).then(blob => {
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = `record_${id}_${new Date().getTime()}.xlsx`;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ URL.revokeObjectURL(url);
+ });
+ }, index * 1000); // 姣忎釜鏂囦欢闂撮殧1绉掍笅杞�
+ });
+ },
+
+ // /** 鑾峰彇Token鐨勮緟鍔╂柟娉� */
+ // getToken() {
+ // return localStorage.getItem('token') || '';
+ // },
+ /** 瀵煎叆妯℃澘涓嬭浇鎿嶄綔*/
+ handleExportTemplate()
+ {
+ this.download('/system/records/model', {
+
}, `records_${new Date().getTime()}.xlsx`)
+ },
+ handleExportTemplateOther()
+ {
+ this.download('/system/records/modelOther', {
+
+ }, `records_${new Date().getTime()}.xlsx`)
+ },
+ /** 瀵煎叆鎿嶄綔*/
+ async handleImportData({file}){
+ // 妫�鏌ユ枃浠剁被鍨嬫槸鍚︿负xlsx
+ // if (!params.file.name.endsWith('.xlsx')) {
+ // this.$message.error('璇蜂笂浼�.xlsx鏍煎紡鐨勬枃浠�');
+ // return;
+ // }
+ const formData = new FormData();
+ formData.append('excelImport', file);
+ // formData.append('recordId', this.recordId)
+ // alert(this.recordId)
+ console.log(file)
+
+ // 鏄剧ず鍔犺浇涓姸鎬�
+ const loading = this.$loading({
+ lock: true,
+ text: '涓婁紶涓�...',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
+
+ enload(formData, {
+ headers: {
+ 'Content-Type': 'multipart/form-data'
}
+ }).then(response => {
+ loading.close();
+ this.$message.success('瀵煎叆鎴愬姛');
+ this.getList();
+ }).catch(error => {
+ loading.close();
+ this.$message.error('瀵煎叆澶辫触: ' + (error.message || '鏈煡閿欒'));
+ });
+
+ }
+
+
+
}
}
</script>
@@ -1169,4 +2116,309 @@
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
background: #2f91ec;
}
+
+/* Excel鎿嶄綔寮圭獥鏍峰紡 */
+.excel-dialog-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+}
+
+/* Excel棰勮鍖呰鍣ㄦ牱寮� */
+.excel-preview-wrapper {
+ width: 100%;
+ height: 100%;
+ min-height: 500px;
+ display: flex;
+ flex-direction: column;
+ background: #f9f9f9;
+ border-radius: 8px;
+ padding: 10px;
+ margin-bottom: 20px;
+}
+
+/* Excel閿欒鎻愮ず鏍峰紡 */
+.excel-error-message {
+ background: #fff2f0;
+ border: 1px solid #ffccc7;
+ border-radius: 8px;
+ padding: 20px;
+ margin: 10px 0;
+ color: #f56c6c;
+}
+
+.excel-error-message h3 {
+ margin-top: 0;
+ margin-bottom: 10px;
+ color: #f56c6c;
+ font-size: 16px;
+}
+
+.excel-error-message p {
+ margin: 8px 0;
+ line-height: 1.5;
+}
+
+.excel-error-message ul {
+ text-align: left;
+ margin: 10px 0;
+}
+
+.excel-error-message li {
+ margin: 5px 0;
+ padding-left: 5px;
+}
+
+/* 浼樺寲鎸夐挳鏍峰紡 */
+.excel-dialog-btn.download-btn {
+ background: #67c23a;
+ border-color: #67c23a;
+ color: white;
+ margin-top: 10px;
+}
+
+.excel-dialog-btn.download-btn:hover {
+ background: #85ce61;
+ border-color: #85ce61;
+}
+
+/* 閫夋嫨妗嗗尯鍩熸牱寮� */
+.excel-options-section {
+ background: #f5f7fa;
+ border-radius: 8px;
+ padding: 20px;
+ margin-bottom: 20px;
+}
+
+/* 閫夐」缁勬牱寮� */
+.option-group {
+ margin-bottom: 15px;
+}
+
+.option-group:last-child {
+ margin-bottom: 0;
+}
+
+/* 閫夐」鏍囩鏍峰紡 */
+.option-label {
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ color: #303133;
+ cursor: pointer;
+ margin-bottom: 10px;
+}
+
+/* 澶嶉�夋鏍峰紡 */
+.option-label input[type="checkbox"] {
+ width: 16px;
+ height: 16px;
+ margin-right: 8px;
+ cursor: pointer;
+}
+
+/* 娉ㄨВ閫夐」瀹瑰櫒 */
+.annotation-options {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 15px;
+ margin-top: 10px;
+}
+
+/* 娉ㄨВ澶嶉�夋鏍峰紡 */
+.annotation-checkbox {
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ color: #303133;
+ cursor: pointer;
+ background: white;
+ padding: 8px 12px;
+ border-radius: 4px;
+ border: 1px solid #dcdfe6;
+ transition: all 0.3s;
+}
+
+.annotation-checkbox:hover {
+ border-color: #c0c4cc;
+ background: #fafafa;
+}
+
+.annotation-checkbox input[type="checkbox"] {
+ width: 14px;
+ height: 14px;
+ margin-right: 6px;
+ cursor: pointer;
+}
+.excel-dialog {
+ background-color: white;
+ border-radius: 8px;
+ width: 96%;
+ max-width: 900px;
+ max-height: 100vh;
+ overflow: hidden;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
+ animation: slideUp 0.3s ease;
+ display: flex;
+ flex-direction: column;
+}
+
+.excel-dialog-header {
+ padding: 20px 24px;
+ border-bottom: 1px solid #e9ecef;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background-color: #f8f9fa;
+}
+
+.excel-dialog-header h3 {
+ margin: 0;
+ font-size: 18px;
+ font-weight: 600;
+ color: #333;
+}
+
+.excel-dialog-close {
+ background: none;
+ border: none;
+ font-size: 24px;
+ cursor: pointer;
+ color: #666;
+ width: 32px;
+ height: 32px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 4px;
+ transition: all 0.2s;
+}
+
+.excel-dialog-close:hover {
+ background-color: #e9ecef;
+ color: #333;
+}
+
+.excel-dialog-body {
+ padding: 24px;
+ flex: 1;
+ overflow-y: auto;
+}
+
+.excel-preview-container {
+ width: 100%;
+ height: 400px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ margin-bottom: 16px;
+ position: relative;
+ background-color: #f8f9fa;
+ overflow: hidden;
+}
+
+.loading-indicator {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ background-color: rgba(255, 255, 255, 0.9);
+ color: #666;
+ z-index: 10;
+}
+
+.loading-spinner {
+ width: 40px;
+ height: 40px;
+ border: 3px solid #f3f3f3;
+ border-top: 3px solid #2f91ec;
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+ margin-bottom: 10px;
+}
+
+.excel-dialog-tip {
+ margin: 0;
+ color: #666;
+ text-align: center;
+ font-size: 14px;
+}
+
+.excel-dialog-footer {
+ padding: 16px 24px;
+ border-top: 1px solid #e9ecef;
+ display: flex;
+ justify-content: center;
+ gap: 16px;
+ background-color: #f8f9fa;
+}
+
+.excel-dialog-btn {
+ padding: 10px 24px;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 14px;
+ font-weight: 500;
+ transition: all 0.2s;
+ min-width: 100px;
+}
+
+.preview-btn {
+ background-color: #2f91ec;
+ color: white;
+}
+
+.preview-btn:hover {
+ background-color: #1c7ed6;
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(47, 145, 236, 0.3);
+}
+
+.print-btn {
+ background-color: #20c997;
+ color: white;
+}
+
+.print-btn:hover {
+ background-color: #17a589;
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(32, 201, 151, 0.3);
+}
+
+.download-btn {
+ background-color: #6c757d;
+ color: white;
+}
+
+.download-btn:hover {
+ background-color: #5a6268;
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
+}
+
+@keyframes fadeIn {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+
+@keyframes slideUp {
+ from {
+ opacity: 0;
+ transform: translateY(20px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
</style>
--
Gitblit v1.9.1