| | |
| | | </el-col> |
| | | <el-col :span="5" v-if="ismanager == true"> |
| | | <el-form-item label="申请金额" prop="pretaxcost"> |
| | | <el-input v-model="form.pretaxcost" placeholder="税前金额合计" :disabled="true" /> |
| | | <el-input :value="formatMoneyValue(form.pretaxcost)" class="money-input" placeholder="税前金额合计" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | |
| | | <el-form-item label="捐献案例" prop="name"> |
| | | <el-input :disabled="true" v-model="form.donorname" placeholder="请输入捐献者姓名" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <div style="margin-left: 10px;"> |
| | | <dict-tag |
| | | :options="dict.type.sys_DonationStatus" |
| | | :value="form.invoicecount" |
| | | /> |
| | | </div> |
| | | </el-col> |
| | | </el-col> |
| | | <el-col :span="10"> |
| | | <el-form-item label="申请说明" prop="remark"> |
| | | <el-input v-model="form.remark" placeholder="申请说明" /> |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-table :data="rbDetails" v-loading="loading" max-height="800" border highlight-current-row> |
| | | <el-table-column prop="orderno" align="center" label="序号" width="88"> |
| | | <el-table-column prop="orderno" align="center" label="序号" width="75"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.orderno" placeholder="序号" /> |
| | | </template> |
| | |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="price" align="center" label="单价" width="120" v-if="businessType == 4"> |
| | | <el-table-column prop="price" align="right" header-align="right" label="单价" width="120" v-if="businessType == 4" class-name="money-column" :formatter="formatMoney"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.price" placeholder="单价" @blur=" |
| | | val => { |
| | |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="amount" align="center" :label="amountlabel" width="120"> |
| | | <el-table-column prop="amount" align="right" header-align="right" class-name="money-column" :label="amountlabel" width="120" :formatter="formatMoney"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.amount" placeholder="金额" /> |
| | | <el-input v-model="scope.row.amount" class="money-input" placeholder="金额" @blur="normalizeMoney(scope.row, 'amount')" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="taxamount" align="center" label="扣税金额" width="120" v-if=" |
| | | <el-table-column prop="vatAmount" align="right" header-align="right" class-name="money-column" label="增值税" width="110" :formatter="formatMoney" |
| | | v-if="businessType == '1'" /> |
| | | <el-table-column prop="cityTaxAmount" align="right" header-align="right" class-name="money-column" label="城建税" width="110" :formatter="formatMoney" |
| | | v-if="businessType == '1'" /> |
| | | <el-table-column prop="laborPretaxAmount" align="right" header-align="right" class-name="money-column" label="劳务税前" width="120" :formatter="formatMoney" |
| | | v-if="businessType == '1'" /> |
| | | <el-table-column prop="taxamount" align="right" header-align="right" class-name="money-column" label="劳务个税" width="120" v-if=" |
| | | ismanager == true && |
| | | (businessType == '1' || businessType == '2') |
| | | "> |
| | | " :formatter="formatMoney"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.taxamount" placeholder="扣税金额" /> |
| | | <el-input v-model="scope.row.taxamount" class="money-input" placeholder="劳务个税" @blur="normalizeMoney(scope.row, 'taxamount')" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="taxedamount" align="center" label="税后金额" width="120" |
| | | v-if="businessType == '1' || businessType == '2'"> |
| | | <el-table-column prop="taxedamount" align="right" header-align="right" class-name="money-column" label="劳务税后" width="120" |
| | | v-if="businessType == '1' || businessType == '2'" :formatter="formatMoney"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.taxedamount" placeholder="税后金额" /> |
| | | <el-input v-model="scope.row.taxedamount" class="money-input" placeholder="劳务税后" @blur="normalizeMoney(scope.row, 'taxedamount')" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="beneficiaryname" column-key="sdad" align="center" :label="beneficiarylabel" |
| | |
| | | <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto" |
| | | :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) => |
| | | uploadSccess(response, file, fileList) |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck" |
| | | :on-remove="remove" accept="image/*,.pdf"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text"> |
| | |
| | | <em><el-button :disabled="operationType == 'detail'" size="small" type="primary">点击上传</el-button></em> |
| | | </div> |
| | | </el-upload> |
| | | <el-table :data="fileListto" @row-click="downFile" style="width: 100%" height="400"> |
| | | <div |
| | | v-if="operationType == 'detail'" |
| | | class="upload-disabled-tip" |
| | | > |
| | | <i class="el-icon-warning-outline" /> |
| | | 当前为查看模式,不能上传附件 |
| | | </div> |
| | | <el-table ref="annexTable" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400"> |
| | | <el-table-column prop="name" :show-overflow-tooltip="true" label="名称"> |
| | | <template slot-scope="scope"> |
| | | <i style="color:#409EFF" class=" el-icon-s-order" />{{ |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog v-dialogDrags :modal="false" :close-on-click-modal="false" :title="pdftitle" :visible.sync="pdfVisible" |
| | | width="60%"> |
| | | :fullscreen="pdfFullscreen" width="60%" custom-class="pdf-resize-dialog" @closed="pdfFullscreen = false"> |
| | | <template slot="title"> |
| | | <span>{{ pdftitle }}</span> |
| | | <el-button class="pdf-fullscreen-btn" size="mini" |
| | | :icon="pdfFullscreen ? 'el-icon-close' : 'el-icon-full-screen'" |
| | | @click="pdfFullscreen = !pdfFullscreen">{{ pdfFullscreen ? "还原" : "全屏" }}</el-button> |
| | | </template> |
| | | <el-alert |
| | | :title=" |
| | | activeName == 'invoice' |
| | | ? '当前正在操作:发票文件(请确认票据属于发票)' |
| | | : '当前正在操作:普通附件(请勿在此上传发票)' |
| | | " |
| | | :type="activeName == 'invoice' ? 'success' : 'warning'" |
| | | :closable="false" |
| | | show-icon |
| | | style="margin-bottom: 10px;" |
| | | /> |
| | | <div style="margin-bottom: 10px;"> |
| | | <el-table :data="tableDatatop" style="width: 100%"> |
| | | <el-table-column v-if="businessType == 4" prop="price" align="center" label="单价"> |
| | | <el-table-column v-if="businessType == 4" prop="price" align="right" header-align="right" class-name="money-column" label="单价" :formatter="formatMoney"> |
| | | </el-table-column> |
| | | <el-table-column prop="quantity" align="center" label="数量" v-if="businessType == 4"> |
| | | </el-table-column> |
| | | <el-table-column prop="amount" align="center" :label="amountlabel"> |
| | | <el-table-column prop="amount" align="right" header-align="right" class-name="money-column" :label="amountlabel" :formatter="formatMoney"> |
| | | </el-table-column> |
| | | <el-table-column prop="taxedamount" align="center" label="税后金额" v-if=" |
| | | <el-table-column prop="taxedamount" align="right" header-align="right" class-name="money-column" label="劳务税后" :formatter="formatMoney" v-if=" |
| | | (this.ismanager == true) & |
| | | (form.applytype == '1' || form.applytype == '2') |
| | | "> |
| | |
| | | <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto" |
| | | :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) => |
| | | uploadSccess(response, file, fileList) |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck" |
| | | :on-remove="remove" accept="image/*,.pdf"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text"> |
| | |
| | | type="primary">点击上传</el-button></em> |
| | | </div> |
| | | </el-upload> |
| | | <el-table :data="fileListto" @row-click="downFile" style="width: 100%" height="400"> |
| | | <div |
| | | v-if="operationType == 'detail'" |
| | | class="upload-disabled-tip" |
| | | > |
| | | <i class="el-icon-warning-outline" /> |
| | | 当前为查看模式,不能上传附件 |
| | | </div> |
| | | <el-table ref="annexTable2" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400"> |
| | | <el-table-column prop="name" :show-overflow-tooltip="true" label="名称"> |
| | | <template slot-scope="scope"> |
| | | <i style="color:#409EFF" class=" el-icon-s-order" /> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-if="this.previewpdf && pdfimgsrcList.length" class="pdfimgmin"> |
| | | <!-- <img :src="pdfimg" /> --> |
| | | <el-image ref="imagePreview" style="width: 95%; height: 90%" :src="pdfimg" |
| | | @click="handleImageClick(initialIndex)"> |
| | | <!-- <div slot="error" class="image-slot"> |
| | | <i class="el-icon-picture-outline"></i> |
| | | </div> --> |
| | | </el-image> |
| | | <custom-image-viewer :url-list="pdfimgsrcList" :initial-index="currentIndex" :visible="viewerVisible" |
| | | @update:visible="viewerVisible = $event" @close="handleViewerClose" /> |
| | | </div> |
| | | <div v-else class="pdfimgmins">{{ hintitle }}</div> |
| | | <attachment-preview-pane :file="embeddedFile" style="flex: 1; min-width: 0;" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="发票文件" name="invoice"> |
| | |
| | | <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="invoicefileList" |
| | | :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) => |
| | | uploadSccess(response, file, fileList) |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" |
| | | " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck" |
| | | :on-remove="remove" accept="image/*,.pdf"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text"> |
| | |
| | | type="primary">点击上传</el-button></em> |
| | | </div> |
| | | </el-upload> |
| | | <el-table :data="invoicefileListto" @row-click="downFile" style="width: 100%" height="400"> |
| | | <div |
| | | v-if="operationType == 'detail'" |
| | | class="upload-disabled-tip" |
| | | > |
| | | <i class="el-icon-warning-outline" /> |
| | | 当前为查看模式,不能上传附件 |
| | | </div> |
| | | <el-table ref="invoiceTable" :data="invoicefileListto" :row-class-name="invoiceRowClass" @row-click="downFile" style="width: 100%" height="400"> |
| | | <el-table-column prop="name" :show-overflow-tooltip="true" label="名称"> |
| | | <template slot-scope="scope"> |
| | | <i style="color:#409EFF" class=" el-icon-s-order" /> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-if="this.previewpdf && invoicepdfimgsrcList.length" class="pdfimgmin"> |
| | | <!-- <img :src="pdfimg" /> --> |
| | | <el-image style="width: 95%; height: 90%" :src="invoicepdfimg" |
| | | @click="invoicehandleImageClick(initialIndex)"> |
| | | <!-- <div slot="error" class="image-slot"> |
| | | <i class="el-icon-picture-outline"></i> |
| | | </div> --> |
| | | </el-image> |
| | | <custom-image-viewer :url-list="invoicepdfimgsrcList" :initial-index="invoicecurrentIndex" |
| | | :visible="invoiceviewerVisible" @update:visible="invoiceviewerVisible = $event" |
| | | @close="invoicehandleViewerClose" /> |
| | | </div> |
| | | <div v-else class="pdfimgmins">{{ hintitle }}</div> |
| | | <attachment-preview-pane :file="invoiceEmbeddedFile" style="flex: 1; min-width: 0;" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | fileListto: [], |
| | | invoicefileList: [], |
| | | invoicefileListto: [], |
| | | // 2026-11-10:新上传附件行高亮用(附件 / 发票) |
| | | flashAnnexName: "", |
| | | flashInvoiceName: "", |
| | | invoicepdfimg: "", |
| | | invoicepdfimgsrcList: [], |
| | | invoDatatop: [], |
| | | activeName: "common", //文件类型 |
| | | activeName: "invoice", //文件类型:默认发票文件 |
| | | //上传附件路径 |
| | | uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", |
| | | ICDtoken: getToken(), |
| | |
| | | //票据文件 |
| | | pdftitle: "", |
| | | pdfimg: "", |
| | | invoiceEmbeddedFile: null, |
| | | pdfimgsrcList: [], |
| | | currentIndex: 0, // 初始索引 |
| | | invoicecurrentIndex: 0, // 初始索引 |
| | |
| | | }, |
| | | // 获取请求头 |
| | | Getnetworkheader() { |
| | | let string = window.location.href; |
| | | if (string.includes("9091")) { |
| | | const index = string.indexOf("9091"); |
| | | this.Networkheader = string.slice(0, index + 4); // 截取9091及其前部字符 |
| | | } else { |
| | | const index = string.indexOf("8032"); |
| | | this.Networkheader = string.slice(0, index + 4); // 截取8032及其前部字符 |
| | | } |
| | | // 以当前页面 origin 为准,兼容 80/8032/9091 及后续端口调整 |
| | | this.Networkheader = window.location.origin; |
| | | }, |
| | | /** 通过参数获取业务类型 */ |
| | | getroute() { |
| | |
| | | } |
| | | this.rbDetails[i] = tempDetail; |
| | | } |
| | | //计算当前行报销内容费用合计,税前金额(amount)、扣税金额(taxamount)、税后金额(taxedamount) |
| | | //计算当前行报销内容费用合计,税前金额(amount)、劳务个税(taxamount)、劳务税后(taxedamount) |
| | | if (this.businessType == "2") { |
| | | for (let j = 0; j < this.rbDetails.length; j++) { |
| | | let tempDetail = this.rbDetails[j]; |
| | |
| | | }); |
| | | }, |
| | | |
| | | //计算个税:type(A:已知税前金额,计算税后金额;B:已知税后金额,计算税前金额) |
| | | //计算个税:type(A:已知税前金额,计算劳务税后;B:已知劳务税后,计算税前金额) |
| | | calculateTax(row, type) { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | if (!this.rbDetails[i].amount) { |
| | |
| | | } |
| | | this.rbDetails[i] = tempDetail; |
| | | } |
| | | //计算当前行报销内容费用合计,税前金额(amount)、扣税金额(taxamount)、税后金额(taxedamount) |
| | | //计算当前行报销内容费用合计,税前金额(amount)、劳务个税(taxamount)、劳务税后(taxedamount) |
| | | if (this.businessType == "2") { |
| | | for (let j = 0; j < this.rbDetails.length; j++) { |
| | | let tempDetail = this.rbDetails[j]; |
| | |
| | | }); |
| | | this.batchdialogVisible = true; |
| | | }, |
| | | /** |
| | | * 明细行是否为「空记录」:服务项目、专家、专家所在单位 是否都为空 |
| | | * 用于批量录入专家时判断"复用最后一行"还是"追加新行" |
| | | */ |
| | | isBlankDetailRow(row) { |
| | | if (!row) { |
| | | return false; |
| | | } |
| | | const isEmpty = v => |
| | | v === null || v === undefined || String(v).trim() === ""; |
| | | return ( |
| | | isEmpty(row.itemid) && |
| | | isEmpty(row.beneficiaryname) && |
| | | isEmpty(row.unitno) && |
| | | isEmpty(row.unitname) |
| | | ); |
| | | }, |
| | | /** 批量录入弹框:姓名/单位/工号/身份证后4位 命中判断 */ |
| | | personMatchKeyword(item, kw) { |
| | | const idcard = String(item.idcrad || ""); |
| | |
| | | existed[String(row.beneficiaryname).trim()] = true; |
| | | } |
| | | }); |
| | | |
| | | // 2026-10-22:修正"导入后表格多出一行空记录"。 |
| | | // 规则:先看最后一条记录,若它的"服务项目 / 专家 / 专家所在单位"都是空的, |
| | | // 说明是一条空记录,就从这一行开始填;否则追加新行。 |
| | | let writeIndex = this.rbDetails.length; |
| | | if ( |
| | | writeIndex > 0 && |
| | | this.isBlankDetailRow(this.rbDetails[writeIndex - 1]) |
| | | ) { |
| | | writeIndex -= 1; |
| | | } |
| | | |
| | | const duplicated = []; |
| | | this.checkedCities.forEach(item => { |
| | |
| | | annexfiles: null |
| | | }; |
| | | |
| | | this.rbDetails.push(rowData); |
| | | if (writeIndex < this.rbDetails.length) { |
| | | // 复用最后那条空记录 |
| | | this.rbDetails.splice(writeIndex, 1, rowData); |
| | | } else { |
| | | this.rbDetails.push(rowData); |
| | | } |
| | | writeIndex++; |
| | | }); |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | this.rbDetails[i].orderno = i + 1; |
| | |
| | | invoicehandleViewerClose() { |
| | | this.invoiceviewerVisible = false; |
| | | }, |
| | | handleUploadError() { }, |
| | | /** |
| | | * 2026-11-10:上传前置校验(before-upload) |
| | | * 原实现把文件名校验放在 on-success,文件**已经传到服务器**才判断, |
| | | * 不合格就直接丢弃 → 服务器留垃圾文件、界面只闪一下提示,用户感觉"没反应"。 |
| | | * 这里前移到上传前,不合格直接不发请求。 |
| | | * @returns {boolean} false 阻止上传 |
| | | */ |
| | | beforeUploadCheck(file) { |
| | | if (this.operationType === "detail") { |
| | | this.$modal.msgError("当前为查看模式,不能上传附件"); |
| | | return false; |
| | | } |
| | | return this.checkUploadFileName(file); |
| | | }, |
| | | |
| | | /** |
| | | * 2026-11-10:上传结果异常时的统一提示 |
| | | * 后端 /common/upload 出错时返回 HTTP 200 + code 500/401,el-upload 会走 on-success, |
| | | * 必须在这里给出明确提示,否则用户看不到任何反馈。 |
| | | */ |
| | | notifyUploadFail(response) { |
| | | const code = response && response.code; |
| | | const msg = (response && response.msg) || "未知错误"; |
| | | if (code === 401 || code === 403) { |
| | | this.$modal.msgError("登录已过期,请重新登录后再上传附件"); |
| | | return; |
| | | } |
| | | this.$modal.msgError("上传失败:" + msg); |
| | | }, |
| | | |
| | | /** |
| | | * 2026-11-10:上传失败(HTTP 非 2xx / 断网 / 被网关拦截等) |
| | | * 原实现是空函数 `handleUploadError() { }`,失败时完全没有提示。 |
| | | */ |
| | | handleUploadError(err, file, fileList) { |
| | | const status = err && err.status; |
| | | const fileName = (file && file.name) || "文件"; |
| | | if (status === 401 || status === 403) { |
| | | this.$modal.msgError("登录已过期,请重新登录后再上传附件"); |
| | | return; |
| | | } |
| | | let msg = "上传失败"; |
| | | if (status) { |
| | | msg += ":HTTP " + status + "(可能是文件过大或网络异常)"; |
| | | } else if (err && err.message) { |
| | | msg += ":" + err.message; |
| | | } |
| | | this.$modal.msgError(msg + ",文件:" + fileName); |
| | | }, |
| | | |
| | | /** 新上传行高亮:附件表 */ |
| | | annexRowClass({ row }) { |
| | | return row && row.name === this.flashAnnexName ? "row-flash" : ""; |
| | | }, |
| | | |
| | | /** 新上传行高亮:发票表 */ |
| | | invoiceRowClass({ row }) { |
| | | return row && row.name === this.flashInvoiceName ? "row-flash" : ""; |
| | | }, |
| | | |
| | | /** |
| | | * 2026-11-10:新上传附件定位 —— 高亮 + 滚动到表格底部 |
| | | * @param {string} refName 表格 ref |
| | | * @param {string} name 文件名(用于 row-class-name 匹配) |
| | | * @param {string} kind annex | invoice |
| | | */ |
| | | flashTable(refName, name, kind) { |
| | | if (kind === "annex") { |
| | | this.flashAnnexName = name; |
| | | } else { |
| | | this.flashInvoiceName = name; |
| | | } |
| | | this.$nextTick(() => { |
| | | const table = this.$refs[refName]; |
| | | const wrap = |
| | | table && table.$el |
| | | ? table.$el.querySelector(".el-table__body-wrapper") |
| | | : null; |
| | | if (wrap) { |
| | | wrap.scrollTop = wrap.scrollHeight; |
| | | } |
| | | }); |
| | | setTimeout(() => { |
| | | if (kind === "annex") { |
| | | this.flashAnnexName = ""; |
| | | } else { |
| | | this.flashInvoiceName = ""; |
| | | } |
| | | }, 2000); |
| | | }, |
| | | |
| | | remove(file, fileList) { |
| | | const rbDetails = [...this.rbDetails]; |
| | | if (this.activeName == "common") { |
| | |
| | | |
| | | /** |
| | | * 2026-10-15:上传时校验附件文件名(业务要求:不合格立即提示且不加入列表)。 |
| | | * 规则与后端 AttachmentNameValidator 同口径:必须含中文 / 去掉扩展名后主干 ≤20 字 / |
| | | * 规则与后端 AttachmentNameValidator 同口径:不强制含中文 / 去掉扩展名后主干 ≤20 字 / |
| | | * 不含空格及 / \ : * ? " < > | # % 等特殊字符。 |
| | | */ |
| | | checkUploadFileName(file) { |
| | |
| | | const config = { |
| | | headers: { Authorization: "Bearer " + this.ICDtoken } |
| | | }; |
| | | const pdfimg = this.Networkheader + "/prod-api" + response.fileName; |
| | | const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + response.fileName; |
| | | //获取票据信息位置 |
| | | if (this.activeName == "common") { |
| | | if (response.code == 200) { |
| | | this.previewpdf = true; |
| | | |
| | | fetch(pdfimg, config) |
| | | .then(response => response.blob()) |
| | | .then(blob => { |
| | | // 将获取的数据流转换为URL |
| | | this.pdfimg = URL.createObjectURL(blob); |
| | | this.pdfimgsrcList.push(URL.createObjectURL(blob)); |
| | | this.fileListto.push({ |
| | | name: file.name, |
| | | url: URL.createObjectURL(blob) |
| | | }); |
| | | }) |
| | | .catch(error => { |
| | | console.error("Error loading image", error); |
| | | return; |
| | | }); |
| | | // 新上传文件直接使用浏览器本地 File,避免服务端文件地址/Token |
| | | // 异常时把 JSON 错误响应当成图片或 PDF 预览。 |
| | | const localBlob = file.raw; |
| | | const localUrl = URL.createObjectURL(localBlob); |
| | | this.pdfimg = localUrl; |
| | | this.embeddedFile = { |
| | | name: file.name, |
| | | url: localUrl, |
| | | type: /\.pdf$/i.test(file.name) ? "pdf" : "image" |
| | | }; |
| | | this.pdfimgsrcList.push(localUrl); |
| | | this.fileListto.push({ |
| | | name: file.name, |
| | | url: localUrl |
| | | }); |
| | | |
| | | this.$modal.msgSuccess(response.msg); |
| | | |
| | |
| | | url: response.fileName |
| | | }); |
| | | this.pdftitle = "共" + this.pdfimgsrcList.length + "项"; |
| | | // 2026-11-10:新行高亮并滚动到可见位置,避免"看不出有反应" |
| | | this.flashTable("annexTable", file.name, "annex"); |
| | | this.flashTable("annexTable2", file.name, "annex"); |
| | | } else { |
| | | console.log(response.msg); |
| | | // 2026-11-10:后端返回 HTTP 200 + 非 200 业务码时,原来只 console.log,界面无提示 |
| | | this.notifyUploadFail(response); |
| | | } |
| | | } else { |
| | | if (response.code == 200) { |
| | | this.previewpdf = true; |
| | | fetch(pdfimg, config) |
| | | .then(response => response.blob()) |
| | | .then(blob => { |
| | | // 将获取的数据流转换为URL |
| | | this.invoicepdfimg = URL.createObjectURL(blob); |
| | | this.invoicepdfimgsrcList.push(URL.createObjectURL(blob)); |
| | | this.invoicefileListto.push({ |
| | | name: file.name, |
| | | url: URL.createObjectURL(blob) |
| | | }); |
| | | }) |
| | | .catch(error => { |
| | | console.error("Error loading image", error); |
| | | return; |
| | | }); |
| | | const localBlob = file.raw; |
| | | const localUrl = URL.createObjectURL(localBlob); |
| | | this.invoicepdfimg = localUrl; |
| | | this.invoiceEmbeddedFile = { |
| | | name: file.name, |
| | | url: localUrl, |
| | | type: /\.pdf$/i.test(file.name) ? "pdf" : "image" |
| | | }; |
| | | this.invoicepdfimgsrcList.push(localUrl); |
| | | this.invoicefileListto.push({ |
| | | name: file.name, |
| | | url: localUrl |
| | | }); |
| | | |
| | | this.$modal.msgSuccess(response.msg); |
| | | |
| | |
| | | url: response.fileName |
| | | }); |
| | | this.pdftitle = "共" + this.invoicepdfimgsrcList.length + "项"; |
| | | // 2026-11-10:新行高亮并滚动到可见位置 |
| | | this.flashTable("invoiceTable", file.name, "invoice"); |
| | | } else { |
| | | // 2026-11-10:原来该分支没有 else,失败时完全无提示 |
| | | this.notifyUploadFail(response); |
| | | } |
| | | } |
| | | }, |
| | |
| | | |
| | | if (this.rbDetails[index].annexfilesList) { |
| | | // this.rbDetails[index].annexfilesList.forEach((value, indexson) => { |
| | | // const pdfimg = this.Networkheader + "/prod-api" + value.url; |
| | | // const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url; |
| | | // fetch(pdfimg, config) |
| | | // .then(response => response.blob()) |
| | | // .then(blob => { |
| | |
| | | |
| | | const fetchPromises = this.rbDetails[index].annexfilesList.map( |
| | | (value, indexson) => { |
| | | const pdfimg = this.Networkheader + "/prod-api" + value.url; |
| | | const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url; |
| | | return fetch(pdfimg, config) |
| | | .then(response => response.blob()) |
| | | .then(blob => { |
| | |
| | | if (this.rbDetails[index].invoicefilesList) { |
| | | const fetchPromises = this.rbDetails[index].invoicefilesList.map( |
| | | (value, indexson) => { |
| | | const pdfimg = this.Networkheader + "/prod-api" + value.url; |
| | | const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url; |
| | | return fetch(pdfimg, config) |
| | | .then(response => response.blob()) |
| | | .then(blob => { |
| | |
| | | console.log(this.rbDetails[index].annexfilesList, "annexfilesList"); |
| | | }, |
| | | |
| | | // 点击已上传文件 |
| | | // 费用报销:附件统一使用独立 FilePreview(录入、审批、详情一致) |
| | | downFile(item) { |
| | | if (this.activeName == "common") { |
| | | this.pdftitle = |
| | | "共" + this.pdfimgsrcList.length + "项,当前选中" + item.name; |
| | | let name = item.name.split("."); |
| | | if (name[1] == "pdf") { |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |
| | | this.previewpdf = false; |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | } else if (name[1] == "jpg" || "png") { |
| | | console.log(item, "展示"); |
| | | this.previewpdf = true; |
| | | if (item.url) { |
| | | this.pdfimg = item.url; |
| | | } else { |
| | | this.pdfimg = ""; |
| | | } |
| | | } else { |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |
| | | this.previewpdf = false; |
| | | } |
| | | } else { |
| | | this.pdftitle = |
| | | "共" + this.invoicepdfimgsrcList.length + "项,当前选中" + item.name; |
| | | let name = item.name.split("."); |
| | | if (name[1] == "pdf") { |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |
| | | this.previewpdf = false; |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | } else if (name[1] == "jpg" || "png") { |
| | | this.previewpdf = true; |
| | | if (item.url) { |
| | | this.invoicepdfimg = item.url; |
| | | } else { |
| | | this.invoicepdfimg = ""; |
| | | } |
| | | } else { |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |
| | | this.previewpdf = false; |
| | | } |
| | | const source = |
| | | this.activeName == "common" ? this.fileListto : this.invoicefileListto; |
| | | let list = (source || []).map(f => ({ name: f.name, url: f.url })); |
| | | let index = list.findIndex(f => f.url === item.url); |
| | | if (index < 0 && item && item.url) { |
| | | list = [{ name: item.name, url: item.url }]; |
| | | index = 0; |
| | | } |
| | | this.$previewFile(list, index > -1 ? index : 0); |
| | | }, |
| | | getIndexInArray(arr, obj) { |
| | | return arr.indexOf(obj); |
| | |
| | | text-align: center; |
| | | } |
| | | |
| | | /* 2026-11-10:查看模式下上传区的说明 + 新上传行高亮 */ |
| | | .upload-disabled-tip { |
| | | margin-top: 6px; |
| | | font-size: 13px; |
| | | color: #e6a23c; |
| | | text-align: center; |
| | | } |
| | | |
| | | ::v-deep .el-table .row-flash td { |
| | | background-color: #e7f1f4 !important; |
| | | transition: background-color 0.3s ease; |
| | | } |
| | | |
| | | .pdfimg { |
| | | display: flex; // text-align: center; |
| | | width: 100%; |