h5给input元素type=file的对象赋值报错

博客探讨了在HTML中,`<input type=file>`标签的value属性无法通过程序进行设置的问题。文章指出,出于安全考虑,file类型的input元素只能由用户手动选择文件,不允许程序直接赋值。作者建议移除尝试设置值的代码,以遵循浏览器的安全规范。

Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string

  <input type="file" class=" form-control hide" placeholder="文件地址" id="filePath" />

$("#filePath").val(path);

  type="file"  标签的类型为file只能手动选择 不能程序设置值。   去掉$("#filePath").val(path);

<template> <div class="app-container"> <!-- 搜索表单 --> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px"> <el-form-item label="客户名称" prop="customerName"> <input type="text" v-model="queryParams.customerName" placeholder="请输入客户名称" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="项目名称" prop="projectName"> <input type="text" v-model="queryParams.projectName" placeholder="请输入项目名称" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="成品料号" prop="batteryFinishedProductMaterialNumber"> <input type="text" v-model="queryParams.batteryFinishedProductMaterialNumber" placeholder="请输入成品料号" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="半成品料号" prop="pcbSemiFinishedProductMaterialNumber"> <input type="text" v-model="queryParams.pcbSemiFinishedProductMaterialNumber" placeholder="请输入半成品料号" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="丝印" prop="pcbSilkScreen"> <input type="text" v-model="queryParams.pcbSilkScreen" placeholder="请输入丝印" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="文档版次" prop="revision"> <input type="text" v-model="queryParams.revision" placeholder="请输入文档版次" clearable size="small" @keyup.enter.native="handleQuery"/> </el-form-item> <el-form-item label="开始时间"> <el-date-picker v-model="queryParams.startTime" type="datetime" placeholder="选择开始日期" size="small" value-format="yyyy-MM-dd HH:mm:ss" style="width: 190px;" ></el-date-picker> </el-form-item> <el-form-item label="结束时间"> <el-date-picker v-model="queryParams.endTime" type="datetime" placeholder="选择结束日期" size="small" value-format="yyyy-MM-dd HH:mm:ss" style="width: 190px;" ></el-date-picker> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <!-- 操作按钮 --> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['cms:productionspecificationdata:add']">新增</el-button> </el-col> <el-col :span="1.5"> <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['cms:productionspecificationdata:remove']">批量删除</el-button> </el-col> <el-col :span="1.5"> <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['cms:productionspecificationdata:export']">批量导出PDF</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"/> </el-row> <!-- 表格 --> <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="30" align="center"/> <el-table-column label="ID" fixed="left" width="50" prop="id" align="center"/> <el-table-column label="项目名称" fixed="left" prop="projectName" align="center" sortable width="130"/> <el-table-column label="电芯品牌" prop="batteryCellBrand" align="center" width="130"/> <el-table-column label="电芯型号" prop="batteryCellModel" align="center"/> <el-table-column label="丝印" prop="pcbSilkScreen" align="center" width="130"/> <el-table-column label="料号" prop="pcbMaterialNumber" align="center" width="100"/> <el-table-column label="客户名称" prop="customerName" align="center"/> <el-table-column label="文档版次" prop="revision" align="center"/> <el-table-column label="更新人" prop="updateBy" align="center" width="100" sortable/> <el-table-column label="更新时间" prop="updateTime" align="center" width="100" sortable> <template slot-scope="scope"> <span>{{ parseTime(scope.row.updateTime || scope.row.createTime) }}</span> </template> </el-table-column> <el-table-column label="PCB顶图" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.pcbSchematicDiagramTop" type="text" icon="el-icon-document" @click="previewFile(scope.row.pcbSchematicDiagramTop)">查看顶图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="PCB底图" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.pcbSchematicDiagramBottom" type="text" icon="el-icon-document" @click="previewFile(scope.row.pcbSchematicDiagramBottom)">查看底图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="PCM端口示意图" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.pcmPortDiagram" type="text" icon="el-icon-document" @click="previewFile(scope.row.pcmPortDiagram)">查看底图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="电池组输出端口图" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.batteryOutputPortDiagram" type="text" icon="el-icon-document" @click="previewFile(scope.row.batteryOutputPortDiagram)">查看底图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="NTC阻值R-T表1" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.ntcResistanceRTTable1" type="text" icon="el-icon-document" @click="previewFile(scope.row.ntcResistanceRTTable1)">查看底图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="NTC阻值R-T表2" align="center" width="150"> <template slot-scope="scope"> <el-button v-if="scope.row.ntcResistanceRTTable2" type="text" icon="el-icon-document" @click="previewFile(scope.row.ntcResistanceRTTable2)">查看底图</el-button> <span v-else>—</span> </template> </el-table-column> <el-table-column label="操作" align="center" fixed="right" width="160" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button size="mini" type="text" icon="el-icon-download" @click="handleExportPDF(scope.row)" v-hasPermi="['cms:productionspecificationdata:export']" >下载PDF</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['cms:productionspecificationdata:edit']" >修改</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['cms:productionspecificationdata:remove']" >删除</el-button> </template> </el-table-column> </el-table> <!-- 分页 --> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/> <!-- 添加/编辑对话框 --> <el-dialog :title="title" :visible.sync="open" :before-close="cancel" :close-on-click-modal="false" width="95%" top="5vh" append-to-body > <el-tabs type="border-card"> <h1 style="text-align: center; margin-bottom: 100px;">生产规格书</h1> <!-- 基本信息 --> <el-row :gutter="20"> <el-col :span="6"> <div class="grid-content"> <label class="label-cell">客户名称:</label> <input type="text" v-model="specForm.customerName" /> </div> </el-col> <el-col :span="6"> <div class="grid-content"> <label class="label-cell">项目名称:</label> <input type="text" v-model="specForm.projectName" /> </div> </el-col> <el-col :span="6"> <div class="grid-content"> <label class="label-cell">电池成品料号:</label> <input type="text" v-model="specForm.batteryFinishedProductMaterialNumber" /> </div> </el-col> <el-col :span="6"> <div class="grid-content"> <label class="label-cell">PCB半成品料号:</label> <input type="text" v-model="specForm.pcbSemiFinishedProductMaterialNumber" /> </div> </el-col> </el-row> <!-- 文件修正记录 --> <h4>文件修正记录</h4> <div id="app"> <table class="spec-table"> <thead> <tr> <th>序号</th> <th>版次</th> <th>变更日期</th> <th>变更内容</th> <th>拟制</th> <th>审核</th> <th>批准</th> <th>操作</th> </tr> </thead> <tbody> <tr v-for="(item, index) in versionRecordList" :key="item.id"> <td>{{ index + 1 }}</td> <td><input type="text" v-model="item.revision" /></td> <td><input type="text" v-model="item.updateTime" /></td> <td><input type="text" v-model="item.changeDescription" /></td> <td><input type="text" v-model="item.updateBy" /></td> <td><input type="text" v-model="item.reviewedBy" /></td> <td><input type="text" v-model="item.approvedBy" /></td> <td><button @click="removeRow(index)">删除</button></td> </tr> </tbody> </table> <div style="text-align: center"> <button @click="addRow">+</button> </div> </div> <hr class="divider"> <h4>硬件版本</h4> <table class="spec-table"> <thead> <tr> <th>序号</th> <th>PCB</th> <th>丝印</th> <th>料号</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>主板</td> <td><input type="text" v-model="specForm.pcbSilkScreen" /></td> <td><input type="text" v-model="specForm.pcbMaterialNumber" /></td> </tr> </tbody> </table> <h5>电芯配组要求</h5> <table class="spec-table"> <thead> <tr> <th>序号</th> <th>检查项</th> <th>要求</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>电芯品牌</td> <td><input type="text" v-model="specForm.batteryCellBrand" /></td> </tr> <tr> <td>2</td> <td>电芯型号</td> <td> <input type="text" v-model="specForm.batteryCellModel" /> </td> </tr> <tr> <td>3</td> <td>最大电芯内阻(mΩ)</td> <td> <input type="text" v-model="specForm.maxBatteryCellInternalResistance" /> </td> </tr> <tr> <td>4</td> <td>电芯配组最大内阻差(mΩ)</td> <td> <input type="text" v-model="specForm.batteryCellGroupMaxInternalResistanceDifference" /> </td> </tr> <tr> <td>5</td> <td>电芯配组最大电压差(mV)</td> <td> <input type="text" v-model="specForm.batteryCellGroupMaxVoltageDifference" /> </td> </tr> <tr> <td>6</td> <td>电芯配组最大容量差(mAh)</td> <td> <input type="text" v-model="specForm.batteryCellGroupMaxCapacityDifference" /> </td> </tr> </tbody> </table> <h5>电芯上电顺序</h5> <div><input type="text" v-model="specForm.batteryCellPowerOnSequencePcb" style="display: inline-block; width: 250px;" /></div> <h5>功能测试及检验标准</h5> <table class="spec-table"> <thead> <tr> <th colspan="2">检验项目</th> <th>性能要求</th> <th>PCM测试</th> <th>半测</th> <th>成测</th> </tr> </thead> <tbody> <tr> <td rowspan="20">功能测试</td> <td>1级充电过压保护(V)</td> <td><input type="text" v-model="specForm.level1ChargeOvervoltageProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>1级充电过压保护延时(S)</td> <td><input type="text" v-model="specForm.level1ChargeOvervoltageProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox2 === true" @click="specForm.checkbox2 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox2 === false" @click="specForm.checkbox2 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox2 === false" @click="specForm.checkbox2 = false" /> </td> </tr> <tr> <td>1级充电过压保护解除(V)</td> <td><input type="text" v-model="specForm.level1ChargeOvervoltageProtectionRelease" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox3 === true" @click="specForm.checkbox3 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox3 === false" @click="specForm.checkbox3 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox3 === false" @click="specForm.checkbox3 = false" /> </td> </tr> <tr> <td>2级充电过压保护(V)</td> <td><input type="text" v-model="specForm.level2ChargeOvervoltageProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox4 === true" @click="specForm.checkbox4 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox4 === false" @click="specForm.checkbox4 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox4 === false" @click="specForm.checkbox4 = false" /> </td> </tr> <tr> <td>2级充电过压保护延时(S)</td> <td><input type="text" v-model="specForm.level2ChargeOvervoltageProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox5 === true" @click="specForm.checkbox5 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox5 === false" @click="specForm.checkbox5 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox5 === false" @click="specForm.checkbox5 = false" /> </td> </tr> <tr> <td>放电欠压保护(V)</td> <td><input type="text" v-model="specForm.dischargeUndervoltageProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox6 === true" @click="specForm.checkbox6 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox6 === false" @click="specForm.checkbox6 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox6 === false" @click="specForm.checkbox6 = false" /> </td> </tr> <tr> <td>放电欠压保护延时(S)</td> <td><input type="text" v-model="specForm.dischargeUndervoltageProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox7 === true" @click="specForm.checkbox7 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox7 === false" @click="specForm.checkbox7 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox7 === false" @click="specForm.checkbox7 = false" /> </td> </tr> <tr> <td>放电欠压保护释放(V)</td> <td><input type="text" v-model="specForm.dischargeUndervoltageProtectionRelease" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox8 === true" @click="specForm.checkbox8 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox8 === false" @click="specForm.checkbox8 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox8 === false" @click="specForm.checkbox8 = false" /> </td> </tr> <tr> <td>充电过流保护(A)</td> <td><input type="text" v-model="specForm.chargeOvercurrentProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox9 === true" @click="specForm.checkbox9 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox9 === false" @click="specForm.checkbox9 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox9 === false" @click="specForm.checkbox9 = false" /> </td> </tr> <tr> <td>充电过流保护延时(S)</td> <td><input type="text" v-model="specForm.chargeOvercurrentProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox10 === true" @click="specForm.checkbox10 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox10 === false" @click="specForm.checkbox10 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox10 === false" @click="specForm.checkbox10 = false" /> </td> </tr> <tr> <td>充电过流解除</td> <td><input type="text" v-model="specForm.chargeOvercurrentRelease" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox11 === true" @click="specForm.checkbox11 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox11 === false" @click="specForm.checkbox11 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox11 === false" @click="specForm.checkbox11 = false" /> </td> </tr> <tr> <td>1级放电过流保护(A)</td> <td><input type="text" v-model="specForm.level1DischargeOvercurrentProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox12 === true" @click="specForm.checkbox12 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox12 === false" @click="specForm.checkbox12 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox12 === false" @click="specForm.checkbox12 = false" /> </td> </tr> <tr> <td>1级放电过流保护延时(S)</td> <td><input type="text" v-model="specForm.level1DischargeOvercurrentProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox13 === true" @click="specForm.checkbox13 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox13 === false" @click="specForm.checkbox13 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox13 === false" @click="specForm.checkbox13 = false" /> </td> </tr> <tr> <td>2级放电过流保护(A)</td> <td><input type="text" v-model="specForm.level2DischargeOvercurrentProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>2级放电过流保护延时(mS)</td> <td><input type="text" v-model="specForm.level2DischargeOvercurrentProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>短路保护(A)</td> <td><input type="text" v-model="specForm.shortCircuitProtection" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>短路保护延时(uS)</td> <td><input type="text" v-model="specForm.shortCircuitProtectionDelay" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>放电过流解除</td> <td><input type="text" v-model="specForm.dischargeOvercurrentRelease" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>PACK 内阻(mΩ)</td> <td><input type="text" v-model="specForm.packInternalResistance" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td>JP点连通性测试(V)</td> <td><input type="text" v-model="specForm.jpPointConnectivityTest" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox14 === true" @click="specForm.checkbox14 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox14 === false" @click="specForm.checkbox14 = false" /> </td> </tr> <tr> <td rowspan="4">阻值测试</td> <td>NTC1阻值测试(kΩ)</td> <td><input type="text" v-model="specForm.ntc1ResistanceTest" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>NTC2阻值测试(kΩ)</td> <td><input type="text" v-model="specForm.ntc2ResistanceTest" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>B-与P-之间阻值(mΩ)</td> <td><input type="text" v-model="specForm.bMinusToPMinusResistance" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>B+与P+之间阻值(mΩ)</td> <td><input type="text" v-model="specForm.bPlusToPPositiveResistance" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td rowspan="2">功耗</td> <td>工作功耗(uA)</td> <td><input type="text" v-model="specForm.operatingPowerConsumption" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>休眠功耗(uA)</td> <td><input type="text" v-model="specForm.sleepPowerConsumption" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td rowspan="2">充放电</td> <td>正常充电</td> <td><input type="text" v-model="specForm.normalCharging" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td>正常放电</td> <td><input type="text" v-model="specForm.normalDischarging" style="width: 250px;" /></td> <td> <input type="checkbox" :checked="specForm.checkbox1 === true" @click="specForm.checkbox1 = true" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> <td> <input type="checkbox" :checked="specForm.checkbox1 === false" @click="specForm.checkbox1 = false" /> </td> </tr> <tr> <td rowspan="5">全程活化</td> <td>CC-CV充电</td> <td colspan="1"><input type="text" v-model="specForm.ccCvCharging" style="width: 250px;" /></td> </tr> <tr> <td>搁置</td> <td colspan="1"><input type="text" v-model="specForm.fullActivationStand" style="width: 250px;" /></td> </tr> <tr> <td>恒流放电</td> <td colspan="1"><input type="text" v-model="specForm.constantCurrentDischarge" style="width: 250px;" /></td> </tr> <tr> <td>搁置</td> <td colspan="1"><input type="text" v-model="specForm.fullActivationStand" style="width: 250px;" /></td> </tr> <tr> <td>充电至出货电压</td> <td colspan="1"><input type="text" v-model="specForm.fullActivationChargeToShipmentVoltage" style="width: 250px;" /></td> </tr> <tr> <td rowspan="2">简易活化</td> <td>充电至出货电压</td> <td colspan="1"><input type="text" v-model="specForm.simpleActivationChargeToShipmentVoltage" style="width: 250px;" /></td> </tr> <tr> <td>搁置</td> <td colspan="1"><input type="text" v-model="specForm.simpleActivationStand" style="width: 250px;" /></td> </tr> <tr> <td>活化标准</td> <td>放电容量</td> <td><input type="text" v-model="specForm.dischargeCapacity" style="width: 250px;" /></td> </tr> </tbody> </table> <hr class="divider"> <h4>附录</h4> <table style="width: 100%; border-collapse: collapse;"> <tr> <td style="width: 50%; padding: 10px;"> <label>PCB贴片图顶面</label> <input type="file" @change="uploadPcbTopImage" ref="pcbSchematicDiagramTop" /> <span v-if="pcbTopFileSelected" class="delete-icon" @click="removeUploadPcbTopImage">❌</span> </td> <td style="width: 50%; padding: 10px;"> <label>PCB贴片图底面</label> <input type="file" @change="uploadPcbBottomImage" ref="pcbSchematicDiagramBottom" /> <span v-if="pcbBottomFileSelected" class="delete-icon" @click="removeUploadPcbBottomImage">❌</span> </td> </tr> <tr> <td style="width: 50%; padding: 10px;"> <label>PCM端口示意图</label> <input type="file" @change="uploadPcmPortImage" ref="pcmPortDiagram"/> <span v-if="pcbPcmPortFileSelected" class="delete-icon" @click="removeUploadPcmPortImage">❌</span> </td> <td style="width: 50%; padding: 10px;"> <label>电池组输出端口图</label> <input type="file" @change="uploadBatteryPackOutputPortDiagramImg" ref="batteryOutputPortDiagram"/> <span v-if="batteryPackOutputPortDiagramFileSelected" class="delete-icon" @click="removeUploadBatteryPackOutputPortDiagramImg">❌</span> </td> </tr> <tr> <td style="width: 50%; padding: 10px;"> <label>NTC阻值R-T表1</label> <input type="file" @change="uploadNtcTable1" ref="ntcResistanceRTTable1"/> <span v-if="ntcTable1FileSelected" class="delete-icon" @click="removeUploadNtcTable1Image">❌</span> </td> <td style="width: 50%; padding: 10px;"> <label>NTC阻值R-T表2</label> <input type="file" @change="uploadNtcTable2" ref="ntcResistanceRTTable2"/> <span v-if="ntcTable2FileSelected" class="delete-icon" @click="removeUploadNtcTable2Image">❌</span> </td> </tr> </table> </el-tabs> <div style="text-align: right; margin-top: 20px;"> <el-button @click="cancel">取消</el-button> <el-button type="primary" @click="submitForm">提交</el-button> </div> </el-dialog> </div> </template> <script> import { listData, getData, delData, addData, updateData } from "@/api/cms/productionSpecificationData"; import { parseTime } from "@/utils"; import { getToken } from "@/utils/auth"; export default { name: "ProductionSpecificationData", data() { return { nextId: 1, // 新增一个 ID 计数器 // 遮罩层 loading: true, // 显示搜索 showSearch: true, // 多选框是否选中 multiple: true, // 总条数 total: 0, // 表格数据 dataList: [], // 查询参数 queryParams: { pageNum: 1, pageSize: 10, customerName: null, projectName: null, batteryFinishedProductMaterialNumber: null, pcbSemiFinishedProductMaterialNumber: null, pcbSilkScreen: null, revision: null, startTime: null, endTime: null }, // 对话框标题 title: "", // 是否显示弹出层 open: false, // 表单数据 specForm: { id: null, customerName: null, projectName: null, batteryFinishedProductMaterialNumber: null, pcbSemiFinishedProductMaterialNumber: null, pcbSilkScreen: null, pcbMaterialNumber: null, batteryCellBrand: null, batteryCellModel: null, batteryCellPowerOnSequencePcb: null, maxBatteryCellInternalResistance: null, batteryCellGroupMaxInternalResistanceDifference: null, batteryCellGroupMaxVoltageDifference: null, batteryCellGroupMaxCapacityDifference: null, level1ChargeOvervoltageProtection: null, level1ChargeOvervoltageProtectionDelay: null, level1ChargeOvervoltageProtectionRelease: null, level2ChargeOvervoltageProtection: null, level2ChargeOvervoltageProtectionDelay: null, dischargeUndervoltageProtection: null, dischargeUndervoltageProtectionDelay: null, dischargeUndervoltageProtectionRelease: null, chargeOvercurrentProtection: null, chargeOvercurrentProtectionDelay: null, chargeOvercurrentRelease: null, level1DischargeOvercurrentProtection: null, level1DischargeOvercurrentProtectionDelay: null, level2DischargeOvercurrentProtection: null, level2DischargeOvercurrentProtectionDelay: null, shortCircuitProtection: null, shortCircuitProtectionDelay: null, dischargeOvercurrentRelease: null, packInternalResistance: null, jpPointConnectivityTest: null, ntc1ResistanceTest: null, ntc2ResistanceTest: null, bMinusToPMinusResistance: null, bPlusToPPositiveResistance: null, operatingPowerConsumption: null, sleepPowerConsumption: null, normalCharging: null, normalDischarging: null, ccCvCharging: null, fullActivationStand: null, constantCurrentDischarge: null, fullActivationChargeToShipmentVoltage: null, simpleActivationChargeToShipmentVoltage: null, simpleActivationStand: null, dischargeCapacity: null, checkbox1: null, checkbox2: null, checkbox3: null, checkbox4: null, checkbox5: null, checkbox6: null, checkbox7: null, checkbox8: null, checkbox9: null, checkbox10: null, checkbox11: null, checkbox12: null, checkbox13: null, checkbox14: null }, // 版本记录数据 versionRecordList: [ { id: 1, serialNumber: 1, revision: "", updateTime: "", changeDescription: "", updateBy: "", reviewedBy: "", approvedBy: "" } ], // 文件上传状态 pcbTopFileSelected: false, pcbBottomFileSelected: false, pcbPcmPortFileSelected: false, batteryPackOutputPortDiagramFileSelected: false, ntcTable1FileSelected: false, ntcTable2FileSelected: false }; }, created() { this.getList(); }, methods: { parseTime, // 获取数据列表 getList() { this.loading = true; listData(this.queryParams).then(response => { this.dataList = response.rows; this.total = response.total; this.loading = false; }); }, // 搜索 handleQuery() { this.queryParams.pageNum = 1; this.getList(); }, // 重置搜索 resetQuery() { this.$refs.queryForm.resetFields(); this.queryParams.startTime = null; this.queryParams.endTime = null; this.handleQuery(); }, // 多选框变化 handleSelectionChange(selection) { this.ids = selection.map(item => item.id); this.multiple = !selection.length; }, // 新增 handleAdd() { this.resetForm(); this.open = true; this.title = "新增生产规格书"; }, // 修改 handleUpdate(row) { this.resetForm(); this.open = true; this.title = "修改生产规格书"; this.specForm = Object.assign({}, row); }, // 删除 handleDelete(row) { const ids = row.id || this.ids; this.$confirm('是否确认删除?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(() => { deleteData(ids).then(() => { this.getList(); this.$message.success("删除成功"); }); }); }, // 导出PDF handleExportPDF(row) { // 导出逻辑 }, // 批量导出PDF handleExport() { // 批量导出逻辑 }, // 文件预览 previewFile(file) { // 文件预览逻辑 }, // 上传文件 uploadPcbTopImage(event) { this.pcbTopFileSelected = event.target.files.length > 0; }, removeUploadPcbTopImage() { this.pcbTopFileSelected = false; this.$refs.pcbSchematicDiagramTop.value = ""; }, // 其他文件上传逻辑类似... // 提交表单 submitForm() { if (this.specForm.id) { updateData(this.specForm).then(() => { this.$message.success("修改成功"); this.open = false; this.getList(); }); } else { addData(this.specForm).then(() => { this.$message.success("新增成功"); this.open = false; this.getList(); }); } }, // 取消对话框 cancel() { this.open = false; }, // 重置表单 resetForm() { this.specForm = { id: null, customerName: null, projectName: null, batteryFinishedProductMaterialNumber: null, pcbSemiFinishedProductMaterialNumber: null, pcbSilkScreen: null, pcbMaterialNumber: null, batteryCellBrand: null, batteryCellModel: null, batteryCellPowerOnSequencePcb: null, maxBatteryCellInternalResistance: null, batteryCellGroupMaxInternalResistanceDifference: null, batteryCellGroupMaxVoltageDifference: null, batteryCellGroupMaxCapacityDifference: null, level1ChargeOvervoltageProtection: null, level1ChargeOvervoltageProtectionDelay: null, level1ChargeOvervoltageProtectionRelease: null, level2ChargeOvervoltageProtection: null, level2ChargeOvervoltageProtectionDelay: null, dischargeUndervoltageProtection: null, dischargeUndervoltageProtectionDelay: null, dischargeUndervoltageProtectionRelease: null, chargeOvercurrentProtection: null, chargeOvercurrentProtectionDelay: null, chargeOvercurrentRelease: null, level1DischargeOvercurrentProtection: null, level1DischargeOvercurrentProtectionDelay: null, level2DischargeOvercurrentProtection: null, level2DischargeOvercurrentProtectionDelay: null, shortCircuitProtection: null, shortCircuitProtectionDelay: null, dischargeOvercurrentRelease: null, packInternalResistance: null, jpPointConnectivityTest: null, ntc1ResistanceTest: null, ntc2ResistanceTest: null, bMinusToPMinusResistance: null, bPlusToPPositiveResistance: null, operatingPowerConsumption: null, sleepPowerConsumption: null, normalCharging: null, normalDischarging: null, ccCvCharging: null, fullActivationStand: null, constantCurrentDischarge: null, fullActivationChargeToShipmentVoltage: null, simpleActivationChargeToShipmentVoltage: null, simpleActivationStand: null, dischargeCapacity: null, checkbox1: null, checkbox2: null, checkbox3: null, checkbox4: null, checkbox5: null, checkbox6: null, checkbox7: null, checkbox8: null, checkbox9: null, checkbox10: null, checkbox11: null, checkbox12: null, checkbox13: null, checkbox14: null }; this.versionRecordList = [ { revision: "", updateTime: "", changeDescription: "", updateBy: "", reviewedBy: "", approvedBy: "" } ]; }, // 添加版本记录行 addRow() { const newSerialNumber = this.specForm.versionRecordList.length + 1; this.specForm.versionRecordList.push({ id: this.nextId++, serialNumber: newSerialNumber, revision: '', updateTime: '', changeDescription: '', updateBy: '', reviewedBy: '', approvedBy: '' }); }, // 删除版本记录行 removeRow(index) { if (this.versionRecordList.length > 1) { this.versionRecordList.splice(index, 1); } else { alert('至少保留一行'); } }, removeUploadPcbTopImage() { this.$refs.pcbSchematicDiagramTop.value = ''; this.pcbTopFileSelected = false; }, removeUploadPcbBottomImage() { this.$refs.pcbSchematicDiagramBottom.value = ''; this.pcbBottomFileSelected = false; }, removeUploadPcmPortImage(){ this.$refs.pcmPortDiagram.value = ''; this.pcbPcmPortFileSelected = false; }, removeUploadBatteryPackOutputPortDiagramImg(){ this.$refs.batteryOutputPortDiagram.value = ''; this.batteryPackOutputPortDiagramFileSelected = false; }, removeUploadNtcTable1Image(){ this.$refs.ntcResistanceRTTable1.value = ''; this.ntcTable1FileSelected = false; }, removeUploadNtcTable2Image(){ this.$refs.ntcResistanceRTTable2.value = ''; this.ntcTable2FileSelected = false; } } }; </script> <style lang="scss" scoped> $app-main-bg: #f9f9f9; $app-border-color: #ebeef5; $app-primary-color: #409EFF; $app-success-color: #67c23a; $app-danger-color: #f56c6c; $app-warning-color: #e6a23c; $app-font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; .app-container { padding: 20px; font-family: $app-font-family; background-color: $app-main-bg; } // 表单区域优化 .el-form { background-color: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); margin-bottom: 20px; transition: all 0.3s ease-in-out; } .el-form-item { margin-bottom: 20px; } .el-input, .el-select { width: 100%; max-width: 250px; } .el-input__inner { border-radius: 6px; height: 36px; font-size: 14px; } // 按钮组样式 .mb8 { margin-bottom: 12px; } // 表格区域优化 .el-table { width: 100%; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); margin-bottom: 20px; } .el-table-column { text-align: center; } .el-table__header-wrapper th { background-color: $app-primary-color; color: #fff; font-weight: bold; border-bottom: none; } .el-table__row:hover { background-color: #f5f7fa; } .el-table__row { transition: background-color 0.3s ease; } // 分页样式 .pagination-container { margin-top: 20px; display: flex; justify-content: center; } // 弹出层样式 .el-dialog { border-radius: 10px; overflow: hidden; .el-dialog__header { background-color: $app-primary-color; color: #fff; padding: 15px 20px; font-size: 16px; font-weight: bold; } .el-dialog__body { padding: 20px; background-color: #fcfdff; border-top: 1px solid $app-border-color; border-bottom: 1px solid $app-border-color; } } .el-tabs { border: none; } // 表格样式(用于规格书内容) .spec-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; th, td { border: 1px solid $app-border-color; padding: 10px; text-align: center; } th { background-color: lighten($app-primary-color, 30%); color: #333; font-weight: bold; } td { background-color: #fff; } } // 分界线 .divider { border: 0; height: 1px; background: #eee; margin: 30px 0; } // 目录样式 .directory-container { max-width: 600px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; } .directory-container h2 { text-align: center; margin-bottom: 16px; color: $app-primary-color; } .spec-directory { list-style: none; padding: 0; margin: 0; line-height: 1.6; } .spec-directory li { text-align: left; margin: 6px 0; padding-left: 45%; position: relative; font-weight: 500; &::before { padding-left: 43%; content: "•"; position: absolute; left: 0; top: 0; color: $app-primary-color; font-size: 16px; } } // 按钮样式 .el-button--primary { background-color: $app-primary-color; border-color: $app-primary-color; color: #fff; } .el-button--success { background-color: $app-success-color; border-color: $app-success-color; color: #fff; } .el-button--danger { background-color: $app-danger-color; border-color: $app-danger-color; color: #fff; } .el-button--warning { background-color: $app-warning-color; border-color: $app-warning-color; color: #fff; } .el-button { border-radius: 6px; padding: 9px 15px; font-size: 13px; transition: all 0.3s ease-in-out; &:hover { opacity: 0.9; } i { margin-right: 5px; } } // 响应式布局 @media (max-width: 768px) { .el-input, .el-select { width: 100%; } .el-form-item__content { width: 100%; } .spec-directory li { padding-left: 10px; margin: 8px 0; &::before { display: none; } } } </style> 新增版本没反应
最新发布
11-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值