瀏覽代碼

附件报错处理

duy 2 年之前
父節點
當前提交
7afa38b5c2
共有 1 個文件被更改,包括 207 次插入170 次删除
  1. 207 170
      src/views/tentative/material/approach.vue

+ 207 - 170
src/views/tentative/material/approach.vue

@@ -4,38 +4,40 @@
             <template #header>
                 <HcTooltip keys="tentative_material_approach_add">
                     <el-button hc-btn type="primary" @click="addFormModalClick">
-                        <HcIcon name="add-circle"/>
+                        <HcIcon name="add-circle" />
                         <span>新增</span>
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="tentative_material_approach_edit">
                     <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="editFormModalClick">
-                        <HcIcon name="edit"/>
+                        <HcIcon name="edit" />
                         <span>编辑</span>
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="tentative_material_approach_copy">
                     <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="copyTableModalClick">
-                        <HcIcon name="file-copy-2"/>
+                        <HcIcon name="file-copy-2" />
                         <span>复制</span>
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="tentative_material_approach_del">
                     <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="delModalClick">
-                        <HcIcon name="delete-bin-2"/>
+                        <HcIcon name="delete-bin-2" />
                         <span>删除</span>
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="tentative_material_approach_printer">
-                    <el-button :disabled="tableCheckedKeys.length <= 0" :loading="printerLoading" hc-btn
-                               @click="printerClick">
-                        <HcIcon name="printer"/>
+                    <el-button
+                        :disabled="tableCheckedKeys.length <= 0" :loading="printerLoading" hc-btn
+                        @click="printerClick"
+                    >
+                        <HcIcon name="printer" />
                         <span>打印</span>
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="tentative_material_approach_import">
                     <el-button hc-btn @click="importModalClick">
-                        <HcIcon name="folder-upload"/>
+                        <HcIcon name="folder-upload" />
                         <span>导入</span>
                     </el-button>
                 </HcTooltip>
@@ -43,171 +45,200 @@
             <template #search>
                 <div class="w-40">
                     <el-select v-model="searchForm.materialType" clearable placeholder="请选择材料类型">
-                        <el-option v-for="item in typeData" :key="item.value" :label="item['dictValue']"
-                                   :value="item['dictKey']"/>
+                        <el-option
+                            v-for="item in typeData" :key="item.value" :label="item.dictValue"
+                            :value="item.dictKey"
+                        />
                     </el-select>
                 </div>
                 <div class="w-64 ml-2">
-                    <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate"/>
+                    <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
                 </div>
                 <div class="w-72 ml-2">
-                    <el-input v-model="searchForm.queryValue" clearable placeholder="请输入名称、规格、材料编号进行查询"
-                              @keyup="keyUpEvent"/>
+                    <el-input
+                        v-model="searchForm.queryValue" clearable placeholder="请输入名称、规格、材料编号进行查询"
+                        @keyup="keyUpEvent"
+                    />
                 </div>
                 <div class="ml-2">
                     <el-button type="primary" @click="searchClick">
-                        <HcIcon name="search-2"/>
+                        <HcIcon name="search-2" />
                         <span>搜索</span>
                     </el-button>
                 </div>
             </template>
-            <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck
-                     @selection-change="tableSelection">
-                <template #materialType="{row}">{{ getRowTableMaterialType(row['materialType']) }}</template>
-                <template #materialCount="{row}">{{ row.materialCount === -1 ? "" : row.materialCount }}</template>
-                <template #materialPrice="{row}">{{ row.materialPrice === -1 ? "" : row.materialPrice }}</template>
-                <template #action="{row}">
+            <HcTable
+                ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
+                @selection-change="tableSelection"
+            >
+                <template #materialType="{ row }">{{ getRowTableMaterialType(row.materialType) }}</template>
+                <template #materialCount="{ row }">{{ row.materialCount === -1 ? "" : row.materialCount }}</template>
+                <template #materialPrice="{ row }">{{ row.materialPrice === -1 ? "" : row.materialPrice }}</template>
+                <template #action="{ row }">
                     <HcTooltip keys="tentative_material_approach_annex">
-                        <el-button plain size="small" type="primary" @click="viewAttachmentModalClick(row)">附件
+                        <el-button plain size="small" type="primary" @click="viewAttachmentModalClick(row)">
+                            附件
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_material_approach_sampling">
-                        <el-button plain size="small" type="primary" @click="samplingRecordModalClick(row)">取样记录
+                        <el-button plain size="small" type="primary" @click="samplingRecordModalClick(row)">
+                            取样记录
                         </el-button>
                     </HcTooltip>
                 </template>
             </HcTable>
             <template #action>
-                <HcPages :pages="searchForm" @change="pageChange"/>
+                <HcPages :pages="searchForm" @change="pageChange" />
             </template>
         </HcCard>
 
-        <!--新增/编辑-->
-        <HcDialog :loading="addEditFormLoading" :show="addEditFormModal" :title="`${addEditFormModel.id?'编辑':'新增'}材料进场`"
-                  widths="45rem" @close="addEditFormModalClose" @save="addEditFormClick">
-            <el-form ref="addEditFormRef" :model="addEditFormModel" :rules="addEditFormRules" label-width="auto"
-                     size="large">
+        <!-- 新增/编辑 -->
+        <HcDialog
+            :loading="addEditFormLoading" :show="addEditFormModal" :title="`${addEditFormModel.id ? '编辑' : '新增'}材料进场`"
+            widths="45rem" @close="addEditFormModalClose" @save="addEditFormClick"
+        >
+            <el-form
+                ref="addEditFormRef" :model="addEditFormModel" :rules="addEditFormRules" label-width="auto"
+                size="large"
+            >
                 <div class="hc-form-item">
                     <el-form-item label="材料类型" prop="materialType">
                         <el-select v-model="addEditFormModel.materialType" block>
-                            <el-option v-for="item in typeData" :label="item['dictValue']" :value="item['dictKey']"/>
+                            <el-option v-for="item in typeData" :label="item.dictValue" :value="item.dictKey" />
                         </el-select>
                     </el-form-item>
                     <el-form-item label="材料单价" prop="materialPrice">
-                        <el-input v-model="addEditFormModel.materialPrice"/>
+                        <el-input v-model="addEditFormModel.materialPrice" />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
                     <el-form-item label="材料名称" prop="materialName">
-                        <el-input v-model="addEditFormModel.materialName"/>
+                        <el-input v-model="addEditFormModel.materialName" />
                     </el-form-item>
                     <el-form-item label="材料数量" prop="materialCount">
-                        <el-input v-model="addEditFormModel.materialCount"
-                                  onkeyup="value = value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g,'$1')"/>
+                        <el-input
+                            v-model="addEditFormModel.materialCount"
+                            onkeyup="value = value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g,'$1')"
+                        />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
                     <el-form-item label="规格型号" prop="specificationModel">
-                        <el-input v-model="addEditFormModel.specificationModel"/>
+                        <el-input v-model="addEditFormModel.specificationModel" />
                     </el-form-item>
                     <el-form-item label="计算单位">
-                        <el-input v-model="addEditFormModel.calculationUnit"/>
+                        <el-input v-model="addEditFormModel.calculationUnit" />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
                     <el-form-item label="材料编号" prop="materialNumber">
-                        <el-input v-model="addEditFormModel.materialNumber"/>
+                        <el-input v-model="addEditFormModel.materialNumber" />
                     </el-form-item>
                     <el-form-item label="生产批号">
-                        <el-input v-model="addEditFormModel.batchNumber"/>
+                        <el-input v-model="addEditFormModel.batchNumber" />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
                     <el-form-item label="进场日期">
-                        <el-date-picker v-model="addEditFormModel.mobilizationDate" :clearable="false" class="block"
-                                        type="date" value-format="YYYY-MM-DD"/>
+                        <el-date-picker
+                            v-model="addEditFormModel.mobilizationDate" :clearable="false" class="block"
+                            type="date" value-format="YYYY-MM-DD"
+                        />
                     </el-form-item>
                     <el-form-item label="拟用部位">
-                        <el-input v-model="addEditFormModel.proposedPosition"/>
+                        <el-input v-model="addEditFormModel.proposedPosition" />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
                     <el-form-item label="供应商单位">
-                        <el-input v-model="addEditFormModel.supplierUnit"/>
+                        <el-input v-model="addEditFormModel.supplierUnit" />
                     </el-form-item>
                     <el-form-item label="生产地/厂家">
-                        <el-input v-model="addEditFormModel.placeOfProduction"/>
+                        <el-input v-model="addEditFormModel.placeOfProduction" />
                     </el-form-item>
                 </div>
                 <el-form-item label="生产合格证">
-                    <FormItemUpload v-model="addEditFormModel.productionCertificate" :fileName="productionCertificateName"/>
+                    <FormItemUpload v-model="addEditFormModel.productionCertificate" :file-name="productionCertificateName" />
                 </el-form-item>
                 <el-form-item label="厂家质检报告">
-                    <FormItemUpload v-model="addEditFormModel.qualityInspectionReport" :fileName="qualityInspectionReportName"/>
+                    <FormItemUpload v-model="addEditFormModel.qualityInspectionReport" :file-name="qualityInspectionReportName" />
                 </el-form-item>
                 <el-form-item label="其他附件">
-                    <FormItemUpload v-model="addEditFormModel.otherAccessories" :fileName="otherAccessoriesName"/>
+                    <FormItemUpload v-model="addEditFormModel.otherAccessories" :file-name="otherAccessoriesName" />
                 </el-form-item>
             </el-form>
         </HcDialog>
 
-        <!--复制材料登记信息-->
-        <HcDialog :loading="copyTableLoading" :show="copyTableModal" isTable title="复制材料登记信息" widths="60rem"
-                  @close="copyTableModalClose" @save="copyTableClick">
+        <!-- 复制材料登记信息 -->
+        <HcDialog
+            :loading="copyTableLoading" :show="copyTableModal" is-table title="复制材料登记信息" widths="60rem"
+            @close="copyTableModalClose" @save="copyTableClick"
+        >
             <HcTable :column="copyTableColumn" :datas="copyTableData">
-                <template #materialNumber="{row}">
-                    <el-input v-model="row.materialNumber" :class="row.isMaterialNumber?'is-error':''"
-                              placeholder="请输入材料编号" @blur="materialNumberBlur(row)"/>
+                <template #materialNumber="{ row }">
+                    <el-input
+                        v-model="row.materialNumber" :class="row.isMaterialNumber ? 'is-error' : ''"
+                        placeholder="请输入材料编号" @blur="materialNumberBlur(row)"
+                    />
                 </template>
-                <template #action="{index}">
+                <template #action="{ index }">
                     <el-button plain size="small" type="danger" @click="materialNumberDel(index)">删除</el-button>
                 </template>
             </HcTable>
         </HcDialog>
 
-        <!--导入-->
-        <HcDialog :show="importModal" isRowFooter title="导入" widths="38rem" @close="importModalClose" >
-            <HcDragUpload ref="uploadRef" :api="'/api/blade-business/material/'" :datas="uploadData" action="mobilization/import"
-                          @finished="uploadFinished" @progress="uploadprogress"/>
+        <!-- 导入 -->
+        <HcDialog :show="importModal" is-row-footer title="导入" widths="38rem" @close="importModalClose">
+            <HcDragUpload
+                ref="uploadRef" api="/api/blade-business/material/" :datas="uploadData" action="mobilization/import"
+                @finished="uploadFinished" @progress="uploadprogress"
+            />
             <template #leftRowFooter>
                 <el-button size="large" @click="downloadImportClick">
-                    <HcIcon name="download-2"/>
+                    <HcIcon name="download-2" />
                     <span>下载模板</span>
                 </el-button>
             </template>
             <template #rightRowFooter>
                 <el-button size="large" @click="importModalClose">
-                    <HcIcon name="close"/>
+                    <HcIcon name="close" />
                     <span>取消导入</span>
                 </el-button>
                 <el-button :loading="importModalLoading" hc-btn type="primary" @click="importModalYesClick">
-                    <HcIcon name="folder-upload"/>
+                    <HcIcon name="folder-upload" />
                     <span>确认导入</span>
                 </el-button>
             </template>
         </HcDialog>
 
-        <!--查看附件-->
-        <HcDialog  :show="viewAttachmentModal" isTable title="查看附件" widths="70rem" isRowFooter
-                  @close="viewAttachmentModalClose">
+        <!-- 查看附件 -->
+        <HcDialog
+            :show="viewAttachmentModal" is-table title="查看附件" widths="70rem" is-row-footer
+            @close="viewAttachmentModalClose"
+        >
             <template #extra>
-                <HcNewSwitch :datas="tabTypeTab" :disabled="tableRowPdfDisabled" :keys="tabTypeKey"
-                             @change="tabTypeChange"/>
+                <HcNewSwitch
+                    :datas="tabTypeTab" :disabled="tableRowPdfDisabled" :keys="tabTypeKey"
+                    @change="tabTypeChange"
+                />
             </template>
             <div class="hc-switch-tab-content">
                 <div class="h-full w-full">
                     <div v-if="tableRowData[tabTypeKey]" style="text-align:center;height:100%">
-                        <iframe v-if="tableRowData[tabTypeKey]&&ispdf!==-1" :src="tableRowData[tabTypeKey]" allow="display-capture" frameborder='1'
-                                height='100%' style="height: 100%;"
-                                width='100%'/>
-                        <div v-if="ispdf==-1" class="hc-no-table-form">
+                        <iframe
+                            v-if="tableRowData[tabTypeKey] && ispdf !== -1" :src="tableRowData[tabTypeKey]" allow="display-capture" frameborder="1"
+                            height="100%" style="height: 100%;"
+                            width="100%"
+                        />
+                        <div v-if="ispdf == -1" class="hc-no-table-form">
                             <div class="table-form-no" style="margin-top:100px">
                                 <!-- <img :src="notableform" alt=""/>
                                 <div class="desc">暂无 PDF 数据,请上传</div> -->
-                                <HcDragUpload :accept="'image/png,image/jpg,image/jpeg,application/pdf,.doc,.docx,application/msword'" :action="'endpoint/put-file-attach'" :formatTip="':jpg/png/pdf/excel/word.pdf'"
-                                              autoUpload
-                                              @finished="tableRowPdfFinished"
-                                              @progress="tableRowPdfProgress"
+                                <HcDragUpload
+                                    accept="image/png,image/jpg,image/jpeg,application/pdf,.doc,.docx,application/msword" action="endpoint/put-file-attach" format-tip=":jpg/png/pdf/excel/word.pdf"
+                                    auto-upload
+                                    @finished="tableRowPdfFinished"
+                                    @progress="tableRowPdfProgress"
                                 />
                                 <el-link :href="tableRowData[tabTypeKey]" style="margin-top:10px" type="primary">
                                     {{ splitFileName(tableRowData[tabTypeKey]) }}
@@ -218,55 +249,59 @@
 
                     <div v-else class="hc-no-table-form">
                         <div class="table-form-no">
-                            <img :src="notableform" alt=""/>
+                            <img :src="notableform" alt="">
                             <div class="desc">暂无 文件 数据,请上传</div>
-                            <HcDragUpload :accept="'image/png,image/jpg,image/jpeg,application/pdf,.doc,.docx,application/msword'" :action="'endpoint/put-file-attach'" :formatTip="':jpg/png/pdf/excel/word.pdf'"
-                                          autoUpload
-                                          @finished="tableRowPdfFinished"
-                                          @progress="tableRowPdfProgress"
+                            <HcDragUpload
+                                accept="image/png,image/jpg,image/jpeg,application/pdf,.doc,.docx,application/msword" action="endpoint/put-file-attach" format-tip=":jpg/png/pdf/excel/word.pdf"
+                                auto-upload
+                                @finished="tableRowPdfFinished"
+                                @progress="tableRowPdfProgress"
                             />
                         </div>
                     </div>
                 </div>
             </div>
-            <template #rightRowFooter >
-                <el-button hc-btn size="large" type="primary" @click="deleteFile" v-if="tableRowData[tabTypeKey]">
-                                    <HcIcon name="delete-bin-2"/>
-                                    <span>删除</span>
+            <template #rightRowFooter>
+                <el-button v-if="tableRowData[tabTypeKey]" hc-btn size="large" type="primary" @click="deleteFile">
+                    <HcIcon name="delete-bin-2" />
+                    <span>删除</span>
                 </el-button>
             </template>
         </HcDialog>
 
-        <!--取样记录-->
-        <HcDialog :footer="false" :show="samplingRecordModal" isTable title="取样记录" widths="60%"
-                  @close="samplingRecordModalClose">
-            <HcTable :column="samplingTableColumn" :datas="samplingTableData" :isIndex="false"
-                     :loading="samplingTableLoading">
-                <template #isOutsourcing="{row}">
+        <!-- 取样记录 -->
+        <HcDialog
+            :footer="false" :show="samplingRecordModal" is-table title="取样记录" widths="60%"
+            @close="samplingRecordModalClose"
+        >
+            <HcTable
+                :column="samplingTableColumn" :datas="samplingTableData" :is-index="false"
+                :loading="samplingTableLoading"
+            >
+                <template #isOutsourcing="{ row }">
                     <span>{{ row.isOutsourcing === 1 ? '是' : '否' }}</span>
                 </template>
             </HcTable>
         </HcDialog>
-
     </div>
 </template>
 
 <script setup>
-import {ref, onMounted} from "vue";
-import {useAppStore} from "~src/store";
-import HcDragUpload from "./components/HcDragUpload.vue"
-import FormItemUpload from "./components/FormItemUpload.vue"
-import notableform from '~src/assets/view/notableform.svg';
-import approachApi from "~api/tentative/material/approach"
-import {formValidate, getArrValue, arrIndex, deepClone, arrToId} from "js-fast-way"
-import {getDictionary} from "~api/other";
+import { onMounted, ref } from 'vue'
+import { useAppStore } from '~src/store'
+import HcDragUpload from './components/HcDragUpload.vue'
+import FormItemUpload from './components/FormItemUpload.vue'
+import notableform from '~src/assets/view/notableform.svg'
+import approachApi from '~api/tentative/material/approach'
+import { arrIndex, arrToId, deepClone, formValidate, getArrValue } from 'js-fast-way'
+import { getDictionary } from '~api/other'
 
 //初始变量
 const useAppState = useAppStore()
 
 //全局变量
-const projectId = ref(useAppState.getProjectId);
-const contractId = ref(useAppState.getContractId);
+const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.getContractId)
 
 //渲染完成
 onMounted(() => {
@@ -277,8 +312,8 @@ onMounted(() => {
 //获取材料类型
 const typeData = ref([])
 const getMaterialType = async () => {
-    const {data} = await getDictionary({
-        code: 'material_type'
+    const { data } = await getDictionary({
+        code: 'material_type',
     })
     typeData.value = getArrValue(data)
     //dictValue, dictKey
@@ -298,12 +333,12 @@ const getRowTableMaterialType = (type) => {
 //搜索表单
 const searchForm = ref({
     materialType: null, startTime: null, endTime: null, queryValue: null,
-    current: 1, size: 20, total: 0
+    current: 1, size: 20, total: 0,
 })
 
 //日期时间被选择
 const betweenTime = ref(null)
-const betweenTimeUpdate = ({arr}) => {
+const betweenTimeUpdate = ({ arr }) => {
     betweenTime.value = arr
     if (arr.length > 0) {
         searchForm.value.startTime = arr[0]
@@ -316,20 +351,20 @@ const betweenTimeUpdate = ({arr}) => {
 
 //回车搜索
 const keyUpEvent = (e) => {
-    if (e.key === "Enter") {
-        searchForm.value.current = 1;
+    if (e.key === 'Enter') {
+        searchForm.value.current = 1
         getTableData()
     }
 }
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
+    searchForm.value.current = 1
     getTableData()
 }
 
 //分页被点击
-const pageChange = ({current, size}) => {
+const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
     getTableData()
@@ -338,20 +373,20 @@ const pageChange = ({current, size}) => {
 //表格数据
 const tableRef = ref(null)
 const tableColumn = ref([
-    {key: 'materialNumber', name: '材料编号'},
-    {key: 'mobilizationDate', name: '进场日期'},
-    {key: 'materialName', name: '材料名称'},
-    {key: 'materialType', name: '材料类型'},
-    {key: 'specificationModel', name: '规格型号'},
-    {key: 'supplierUnit', name: '供应商单位'},
-    {key: 'materialPrice', name: '材料单价'},
-    {key: 'materialCount', name: '材料数量'},
-    {key: 'calculationUnit', name: '计算单位'},
-    {key: 'batchNumber', name: '生产批号'},
-    {key: 'placeOfProduction', name: '生产地/厂家'},
-    {key: 'proposedPosition', name: '拟用部位'},
-    {key: 'userName', name: '记录人'},
-    {key: 'action', name: '操作', width: 150, fixed: 'right', align: 'center'},
+    { key: 'materialNumber', name: '材料编号' },
+    { key: 'mobilizationDate', name: '进场日期' },
+    { key: 'materialName', name: '材料名称' },
+    { key: 'materialType', name: '材料类型' },
+    { key: 'specificationModel', name: '规格型号' },
+    { key: 'supplierUnit', name: '供应商单位' },
+    { key: 'materialPrice', name: '材料单价' },
+    { key: 'materialCount', name: '材料数量' },
+    { key: 'calculationUnit', name: '计算单位' },
+    { key: 'batchNumber', name: '生产批号' },
+    { key: 'placeOfProduction', name: '生产地/厂家' },
+    { key: 'proposedPosition', name: '拟用部位' },
+    { key: 'userName', name: '记录人' },
+    { key: 'action', name: '操作', width: 150, fixed: 'right', align: 'center' },
 ])
 const tableRowData = ref({})
 
@@ -360,7 +395,7 @@ const tableLoading = ref(false)
 const tableData = ref([])
 const getTableData = async () => {
     tableLoading.value = true
-    const {error, code, data} = await approachApi.queryPage({
+    const { error, code, data } = await approachApi.queryPage({
         projectId: projectId.value,
         contractId: contractId.value,
         ...searchForm.value,
@@ -377,10 +412,10 @@ const getTableData = async () => {
 }
 
 //多选
-const tableCheckedKeys = ref([]);
+const tableCheckedKeys = ref([])
 const tableSelection = (rows) => {
     tableCheckedKeys.value = rows.filter((item) => {
-        return (item ?? '') !== '';
+        return (item ?? '') !== ''
     })
 }
 
@@ -398,9 +433,9 @@ const editFormModalClick = () => {
         addEditFormModel.value.materialType = addEditFormModel.value.materialType + ''
         addEditFormModel.value.materialCount = addEditFormModel.value.materialCount === -1 ? '' : addEditFormModel.value.materialCount
         addEditFormModel.value.materialPrice = addEditFormModel.value.materialPrice === -1 ? '' : addEditFormModel.value.materialPrice
-        productionCertificateName.value=addEditFormModel.value.productionCertificateName
-        otherAccessoriesName.value=addEditFormModel.value.otherAccessoriesName
-        qualityInspectionReportName.value=addEditFormModel.value.qualityInspectionReportName
+        productionCertificateName.value = addEditFormModel.value.productionCertificateName
+        otherAccessoriesName.value = addEditFormModel.value.otherAccessoriesName
+        qualityInspectionReportName.value = addEditFormModel.value.qualityInspectionReportName
 
         addEditFormModal.value = true
     } else if (keys.length > 1) {
@@ -415,24 +450,24 @@ const addEditFormModalClose = () => {
 //新增/编辑 表单
 const addEditFormRef = ref(null)
 const addEditFormModel = ref({})
-const otherAccessoriesName=ref('')
-const productionCertificateName=ref('')
-const qualityInspectionReportName=ref('')
+const otherAccessoriesName = ref('')
+const productionCertificateName = ref('')
+const qualityInspectionReportName = ref('')
 const addEditFormRules = {
     materialType: {
         required: true,
         trigger: 'change',
-        message: "请选择材料类型"
+        message: '请选择材料类型',
     },
     materialName: {
         required: true,
         trigger: 'blur',
-        message: "请输入材料名称"
+        message: '请输入材料名称',
     },
     specificationModel: {
         required: true,
         trigger: 'blur',
-        message: "请输入规格型号"
+        message: '请输入规格型号',
     },
     materialNumber: {
         required: false,
@@ -448,7 +483,7 @@ const addEditFormRules = {
                 }
             }
         },
-        trigger: 'blur'
+        trigger: 'blur',
     },
     materialPrice: {
         required: false,
@@ -459,7 +494,7 @@ const addEditFormRules = {
                 callback(new Error('材料单价长度不能超过八位数'))
             }
         },
-        trigger: 'blur'
+        trigger: 'blur',
     },
     materialCount: {
         required: false,
@@ -470,18 +505,18 @@ const addEditFormRules = {
                 callback(new Error('材料数量长度不能超过10位数'))
             }
         },
-        trigger: 'blur'
-    }
+        trigger: 'blur',
+    },
 
 }
 
 //校验材料编号是否唯一
 const verification = async (val) => {
-    const {error, code, data} = await approachApi.verification({
+    const { error, code, data } = await approachApi.verification({
         projectId: projectId.value,
         contractId: contractId.value,
         materialNumber: val,
-        id: addEditFormModel.value.id ?? ''
+        id: addEditFormModel.value.id ?? '',
     })
     if (!error && code === 200) {
         return !data
@@ -497,10 +532,10 @@ const addEditFormClick = async () => {
     if (validate) {
         addEditFormLoading.value = true
         addEditFormModel.value.materialCount = Number(addEditFormModel.value.materialCount)
-        const {error, code} = await approachApi.submitForm({
+        const { error, code } = await approachApi.submitForm({
             ...addEditFormModel.value,
             projectId: projectId.value,
-            contractId: contractId.value
+            contractId: contractId.value,
         })
         //处理数据
 
@@ -517,9 +552,9 @@ const addEditFormClick = async () => {
 
 //复制表格
 const copyTableColumn = ref([
-    {key: 'materialName', name: '材料名称'},
-    {key: 'materialNumber', name: '材料编号'},
-    {key: 'action', name: '操作', width: 100},
+    { key: 'materialName', name: '材料名称' },
+    { key: 'materialNumber', name: '材料编号' },
+    { key: 'action', name: '操作', width: 100 },
 ])
 const copyTableData = ref([])
 
@@ -543,7 +578,7 @@ const materialNumberBlur = async (row) => {
 
 //删除
 const materialNumberDel = (index) => {
-    copyTableData.value.splice(index, 1);
+    copyTableData.value.splice(index, 1)
     const rows = copyTableData.value
     if (rows.length <= 0) {
         copyTableModal.value = false
@@ -560,7 +595,7 @@ const copyTableClick = () => {
     const rows = copyTableData.value
     if (rows.length > 0) {
         //判断是否满足条件
-        const result = rows.every(({isMaterialNumber}) => {
+        const result = rows.every(({ isMaterialNumber }) => {
             return isMaterialNumber === false
         })
         //判断状态
@@ -581,7 +616,7 @@ const copyTableClick = () => {
 //复制数据请求
 const tableCopyData = async (rows) => {
     copyTableLoading.value = true
-    const {error, code} = await approachApi.copyData(rows)
+    const { error, code } = await approachApi.copyData(rows)
     //处理数据
     copyTableLoading.value = false
     if (!error && code === 200) {
@@ -602,7 +637,7 @@ const delModalClick = () => {
             if (action === 'confirm') {
                 tableRemoveData()
             }
-        }
+        },
     })
 }
 
@@ -612,7 +647,7 @@ const tableRemoveData = async () => {
     if (rows.length > 0) {
         const ids = arrToId(rows)
         //删除请求
-        const {error, code} = await approachApi.removeData({
+        const { error, code } = await approachApi.removeData({
             projectId: projectId.value,
             contractId: contractId.value,
             ids: ids,
@@ -633,7 +668,7 @@ const printerClick = async () => {
         printerLoading.value = true
         const ids = arrToId(rows)
         //删除请求
-        const {error, code, data} = await approachApi.exportPdf({
+        const { error, code, data } = await approachApi.exportPdf({
             projectId: projectId.value,
             contractId: contractId.value,
             ids: ids,
@@ -656,7 +691,7 @@ const importModalClick = () => {
     importModal.value = true
     uploadData.value = {
         contractId: contractId.value,
-        isCovered: 1
+        isCovered: 1,
     }
 }
 
@@ -699,20 +734,21 @@ const tabTypeKey = ref('')
 const tabTypeKeyType = ref(1)
 const ispdf = ref(-1)
 const tabTypeTab = ref([
-    {key: 'productionCertificate', name: '生产合格证', type: 1},
-    {key: 'qualityInspectionReport', name: '厂家质检报告', type: 2},
-    {key: 'otherAccessories', name: '其他文件', type: 3},
-]);
+    { key: 'productionCertificate', name: '生产合格证', type: 1 },
+    { key: 'qualityInspectionReport', name: '厂家质检报告', type: 2 },
+    { key: 'otherAccessories', name: '其他文件', type: 3 },
+])
 const tabTypeChange = (item) => {
     tabTypeKey.value = item?.key
     tabTypeKeyType.value = item?.type
     const row = tableRowData.value, key = tabTypeKey.value
     ispdf.value = getCaption(row[key])
+
 }
 //截取文件名称
 const splitFileName = (str) => {
     // if(str.indexOf("https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload") != -1){
-    if (str.indexOf("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload") != -1) {
+    if (str.indexOf('https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload') != -1) {
         let a = str.split('//')[2].split('/')[2]
         return a
     } else {
@@ -728,11 +764,10 @@ const tableRowPdfProgress = (res) => {
 
 //上传完成
 const tableRowPdfFinished = async (data1) => {
-    console.log(data1, 'data');
+    console.log(data1, 'data')
     tableRowPdfDisabled.value = true
     const row = tableRowData.value, key = tabTypeKey.value
     row[key] = data1?.link
-    console.log(row, 'row');
     ispdf.value = getCaption(row[key])
     // //保存请求
     // const { error, code } = await approachApi.submitForm({
@@ -747,7 +782,7 @@ const tableRowPdfFinished = async (data1) => {
     //     window?.$message?.success('操作成功')
     //     await getTableData()
     // }
-    const {error, code, data} = await approachApi.updateMobilizationFile(
+    const { error, code, data } = await approachApi.updateMobilizationFile(
         {
             id: row.id,
             type: tabTypeKeyType.value,
@@ -763,15 +798,18 @@ const tableRowPdfFinished = async (data1) => {
     }
 }
 const getCaption = (obj) => {
-    const index = obj.lastIndexOf("pdf")
+    if (obj) {
+        const index = obj.lastIndexOf('pdf')
 
-    return index
+        return index
+    }
+   
 }
 
 //删除上传附件
 const deleteFile = () => {
-    console.log('删除');
-    console.log(tableRowData.value[tabTypeKey]);
+    console.log('删除')
+    console.log(tableRowData.value[tabTypeKey])
     tableRowData.value[tabTypeKey.value] = ''
 }
 //关闭查看附件
@@ -785,7 +823,7 @@ const samplingRecordModal = ref(false)
 const samplingRecordModalClick = async (row) => {
     samplingRecordModal.value = true
     samplingTableLoading.value = true
-    const {data} = await approachApi.samplingRecord({
+    const { data } = await approachApi.samplingRecord({
         projectId: projectId.value,
         contractId: contractId.value,
         id: row.id,
@@ -796,12 +834,12 @@ const samplingRecordModalClick = async (row) => {
 
 //取样记录数据
 const samplingTableColumn = ref([
-    {key: 'specificationNumber', name: '样品编号'},
-    {key: 'materialName', name: '样品名称'},
-    {key: 'samplingDate', name: '取样日期'},
-    {key: 'userName', name: '取样人'},
-    {key: 'materialCount', name: '试样数量'},
-    {key: 'isOutsourcing', name: '是否外委'},
+    { key: 'specificationNumber', name: '样品编号' },
+    { key: 'materialName', name: '样品名称' },
+    { key: 'samplingDate', name: '取样日期' },
+    { key: 'userName', name: '取样人' },
+    { key: 'materialCount', name: '试样数量' },
+    { key: 'isOutsourcing', name: '是否外委' },
 ])
 const samplingTableData = ref([])
 const samplingTableLoading = ref(false)
@@ -815,7 +853,6 @@ const samplingRecordModalClose = () => {
 const downloadImportClick = () => {
     window.open('https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20221109/fea12aaee9d964d2d9f894cc6bf4a2f6.xlsx', '_blank')
 }
-
 </script>
 
 <style lang="scss" scoped>