Merge branch 'fix_foton_20231213' into 'master'

Fix foton 20231213

See merge request laws-foton-slrs/foton-laws-system-front!141
This commit is contained in:
高嵩
2024-01-05 09:58:44 +00:00
2 changed files with 2347 additions and 2005 deletions
+183 -92
View File
@@ -10,17 +10,17 @@
:key="opt.value"
:value="opt.value"
:label="opt.label"
></el-option>
/>
</el-select>
</el-form-item>
<el-form-item class="el-form-item search-item" label="标准号">
<el-input v-model="questionSerach.standardEncdoing" placeholder="根据标准号查询"></el-input>
<el-input v-model="questionSerach.standardEncdoing" placeholder="根据标准号查询" />
</el-form-item>
<el-form-item class="el-form-item search-item" label="标准名称">
<el-input v-model="questionSerach.standardName" placeholder="根据标准名称查询"></el-input>
<el-input v-model="questionSerach.standardName" placeholder="根据标准名称查询" />
</el-form-item>
<el-form-item class="el-form-item search-item" label="关键词">
<el-input v-model="questionSerach.problemDescription" placeholder="根据关键词查询"></el-input>
<el-input v-model="questionSerach.problemDescription" placeholder="根据关键词查询" />
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="searchBtn">查询</el-button>
@@ -34,7 +34,6 @@
</el-form>
</div>
<div class="tab-box">
<el-table
ref="selections"
tooltip-effect="dark"
@@ -52,19 +51,45 @@
fixed="left"
width="55"
label="序号"
align="center">
align="center"
>
<template slot-scope="{scope, column, $index}">
{{ ($index + 1) + (questionSerach.page - 1) * questionSerach.pageSize }}
</template>
</el-table-column>
<el-table-column show-overflow-tooltip label="分类" prop="classification" align="center" min-width="50" :formatter="formatClassification"></el-table-column>
<el-table-column show-overflow-tooltip label="标准号/问题分类" width="150" align="center" prop="standardEncdoing"></el-table-column>
<el-table-column show-overflow-tooltip label="标准名称" prop="standardName" align="center" min-width="100"></el-table-column>
<el-table-column show-overflow-tooltip label="问题描述" prop="problemDescription" align="center" min-width="300"></el-table-column>
<el-table-column prop="questionTime" width="150" align="center" label="提问日期"></el-table-column>
<el-table-column
show-overflow-tooltip
label="分类"
prop="classification"
align="center"
min-width="50"
:formatter="formatClassification"
/>
<el-table-column
show-overflow-tooltip
label="标准号/问题分类"
width="150"
align="center"
prop="standardEncdoing"
/>
<el-table-column
show-overflow-tooltip
label="标准名称"
prop="standardName"
align="center"
min-width="100"
/>
<el-table-column
show-overflow-tooltip
label="问题描述"
prop="problemDescription"
align="center"
min-width="300"
/>
<el-table-column prop="questionTime" width="150" align="center" label="提问日期" />
<el-table-column label="操作" align="center" width="50" fixed="right">
<template slot-scope="scope">
<div @click.stop style="display: inline-block">
<div style="display: inline-block" @click.stop>
<el-dropdown trigger="click" @command="handleCommand2">
<i class="iconfont">&#xe61e;</i>
<el-dropdown-menu slot="dropdown">
@@ -83,16 +108,24 @@
:page="questionSerach.page"
:total="questionSerach.total"
@pageChange="pageChangeFun"
@pageSizeChange="pageSizeChangeFun"></pagination>
@pageSizeChange="pageSizeChangeFun"
/>
</div>
<!--提问弹窗 -->
<el-dialog
title="提交问题"
:visible.sync="dialogVisible"
width="650px"
:before-close="handleClose">
:before-close="handleClose"
>
<div>
<el-form ref="queForm" :rules="queRules" class="label-input-form" label-width="80px" :model="questionForm">
<el-form
ref="queForm"
:rules="queRules"
class="label-input-form"
label-width="80px"
:model="questionForm"
>
<el-form-item label-width="30px">
<el-radio-group v-model="standType" @change="standTypeChange">
<el-radio label="INLAND">国内标准</el-radio>
@@ -100,17 +133,25 @@
<el-radio label="BUSINESS_STAND">企业标准</el-radio>
<el-radio label="OTHER">公共</el-radio>
</el-radio-group>
<div style="display: inline-block; margin-left: 20px" v-if="standType === 'OTHER'">
<div v-if="standType === 'OTHER'" style="display: inline-block; margin-left: 20px">
<el-select v-model="questionForm.pubQue" placeholder="请选择公共问题">
<el-option
v-for="item in pubOptions"
:key="item.label"
:label="item.label"
:value="item.label">
</el-option>
:value="item.label"
/>
</el-select>
</div>
<el-button v-else size="mini" style="margin-left: 30px;" type="primary" @click="addList">选择标准</el-button>
<el-button
v-else
size="mini"
style="margin-left: 30px;"
type="primary"
@click="addList"
>
选择标准
</el-button>
</el-form-item>
<el-form-item label="标准号" class="serch-form-item">
{{ questionForm.standSortShow }} {{ questionForm.standNumber }}{{ questionForm.standYear === '' ? '' : '-' }}{{ questionForm.standYear }}
@@ -119,7 +160,7 @@
{{ questionForm.standardName }}
</el-form-item>
<el-form-item label="问题" prop="problemDescription" class="serch-form-item">
<el-input v-model="questionForm.problemDescription" @input="changeInput"></el-input>
<el-input v-model="questionForm.problemDescription" @input="changeInput" />
</el-form-item>
<el-form-item label="附件">
<el-upload
@@ -131,9 +172,10 @@
:before-upload="beforeUploadTheme"
:before-remove="beforeRemoveTheme"
:on-success="onsuccessTheme"
multiple>
multiple
>
<div style="margin-top: 10px">
<i class="el-icon-upload" style="margin: 0"></i>
<i class="el-icon-upload" style="margin: 0" />
<div class="el-upload__text" style="margin-top: -15px">将文件拖到此处,或<em>点击上传</em></div>
</div>
</el-upload>
@@ -149,7 +191,13 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button class="common-button-default" size="mini" @click="dialogVisible = false">取 消</el-button>
<el-button class="common-button-primary" size="mini" :loading="isSubmit" type="primary" @click="queSubmit">提 交</el-button>
<el-button
class="common-button-primary"
size="mini"
:loading="isSubmit"
type="primary"
@click="queSubmit"
>提 交</el-button>
</span>
</el-dialog>
<!-- 选择标准抽屉-->
@@ -172,28 +220,31 @@
<el-form-item label="标准/政策来源" class="search-item">
<el-select
v-model="handleSelectForm.dataSource"
@change="dataSourceChange"
:popper-append-to-body="false"
placeholder="请选择标准来源">
<el-option value="INLAND" label="国内标准库"></el-option>
<el-option value="FOREIGN" label="海外标准库"></el-option>
<el-option value="BUSINESS_STAND" label="企业标准库"></el-option>
placeholder="请选择标准来源"
@change="dataSourceChange"
>
<el-option value="INLAND" label="国内标准库" />
<el-option value="FOREIGN" label="海外标准库" />
<el-option value="BUSINESS_STAND" label="企业标准库" />
</el-select>
</el-form-item>
<el-form-item label="标准号/标准名称" class="search-item">
<el-input
v-model="handleSelectForm.lawNumber"
@change="lawNumberSearch"
placeholder="根据标准号/标准名称查找"
clearable
:maxlength="100"></el-input>
:maxlength="100"
@change="lawNumberSearch"
/>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
size="small"
type="primary"
class="common-button-primary"
@click="searchLawBtn">
@click="searchLawBtn"
>
查询
</el-button>
</el-form-item>
@@ -202,7 +253,8 @@
class="common-button-default"
size="small"
type="default"
@click="clearLawBtn">
@click="clearLawBtn"
>
清空
</el-button>
</el-form-item>
@@ -220,19 +272,19 @@
fontWeight: 'bold', height: '48px'}"
@selection-change="handleSelectTableChange"
>
<el-table-column
fixed="left"
type="selection"
width="55"
align="center">
</el-table-column>
align="center"
/>
<el-table-column
type="index"
fixed="left"
width="55"
label="序号"
align="center">
align="center"
>
<template slot-scope="{scope, column, $index}">
{{ ($index + 1) + (handleSelectForm.page - 1) * handleSelectForm.pageSize }}
</template>
@@ -243,15 +295,23 @@
width="150"
>
<template slot-scope="scope">
<a v-if="scope.row.standYear && textStatusMap[scope.row.textStatus] === '废止' " class="table-jump" style="color: #F56C6C"
@click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{
<a
v-if="scope.row.standYear && textStatusMap[scope.row.textStatus] === '废止' "
class="table-jump"
style="color: #F56C6C"
@click="handlePreview(scope.row)"
>{{ scope.row.standSortShow }} {{
scope.row.standNumber
}}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else-if="scope.row.standYear" class="table-jump" style="color: #333333"
@click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{
<a
v-else-if="scope.row.standYear"
class="table-jump"
style="color: #333333"
@click="handlePreview(scope.row)"
>{{ scope.row.standSortShow }} {{
scope.row.standNumber
}}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else @click="handlePreview(scope.row)" class="table-jump" style="color: #333333">
<a v-else class="table-jump" style="color: #333333" @click="handlePreview(scope.row)">
{{ scope.row.standSortShow }}
{{ scope.row.standNumber }}</a>
</template>
@@ -263,14 +323,15 @@
min-width="300"
>
<template slot-scope="scope">
<a v-if="textStatusMap[scope.row.textStatus] === '废止' " @click="handlePreview(scope.row)" class="table-jump" style="color: #F56C6C">{{ scope.row.standName }}</a>
<a v-else @click="handlePreview(scope.row)" style="color: #333333" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="textStatusMap[scope.row.textStatus] === '废止' " class="table-jump" style="color: #F56C6C" @click="handlePreview(scope.row)">{{ scope.row.standName }}</a>
<a v-else style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standName }}</a>
</template>
</el-table-column>
<el-table-column
prop="issueTime"
width="120"
label="发布日期">
label="发布日期"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止'" style="color: #F56C6C">{{ formatIssueDate(scope.row.issueTime) }}</span>
<span v-else>{{ formatIssueDate(scope.row.issueTime) }}</span>
@@ -279,19 +340,20 @@
<el-table-column
prop="ssrq"
width="120"
label="实施日期">
label="实施日期"
>
<template slot-scope="scope">
<!-- {{ formatIssueDate(scope.row.putTime) }}-->
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{ scope.row.SSRQ ? scope.row.SSRQ.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.ssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="xcxssrq"
width="150"
label="新车型实施日期">
label="新车型实施日期"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{ scope.row.xcxssrq ? scope.row.xcxssrq.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.xcxssrq }}</span>
@@ -300,7 +362,8 @@
<el-table-column
prop="zccssrq"
width="150"
label="在产车实施日期">
label="在产车实施日期"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{ scope.row.zccssrq ? scope.row.zccssrq.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.zccssrq }}</span>
@@ -309,7 +372,8 @@
<el-table-column
prop="textStatus"
width="110"
label="标准状态">
label="标准状态"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{
textStatusMap[scope.row.textStatus]
@@ -330,7 +394,7 @@
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else-if="scope.row.standYear" style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">
<a v-else style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}</a>
</template>
</el-table-column>
@@ -341,13 +405,13 @@
min-width="300"
>
<template slot-scope="scope">
<a v-if="textStatusMap[scope.row.textStatus] === '废止'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{
<a v-if="textStatusMap[scope.row.textStatus] === '废止'" style="color: #F56C6C" class="table-jump" @click="handlePreview(scope.row)">{{
scope.row.standName
}}</a>
<a v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF" @click="handlePreview(scope.row)" class="table-jump">{{
<a v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF" class="table-jump" @click="handlePreview(scope.row)">{{
scope.row.standName
}}</a>
<a v-else style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{
<a v-else style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">{{
scope.row.standName
}}</a>
</template>
@@ -355,7 +419,8 @@
<el-table-column
prop="issueTime"
width="120"
label="发布日期">
label="发布日期"
>
<template slot-scope="scope">
<div v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">
{{ formatIssueDate(scope.row.issueTime) }}
@@ -371,7 +436,8 @@
<el-table-column
prop="ssrq"
width="120"
label="实施日期">
label="实施日期"
>
<template slot-scope="scope">
<!-- {{ formatIssueDate(scope.row.putTime) }}-->
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{
@@ -381,13 +447,13 @@
scope.row.ssrq
}}</span>
<span v-else style="color: #333333">{{ scope.row.ssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="xcxssrq"
width="150"
label="新车型实施日期">
label="新车型实施日期"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止'" style="color: #F56C6C">{{
scope.row.xcxssrq
@@ -403,7 +469,8 @@
<el-table-column
prop="zccssrq"
width="150"
label="在产车实施日期">
label="在产车实施日期"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{
scope.row.zccssrq
@@ -419,7 +486,8 @@
<el-table-column
prop="textStatus"
width="110"
label="标准状态">
label="标准状态"
>
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' " style="color: #F56C6C">{{
textStatusMap[scope.row.textStatus]
@@ -439,9 +507,9 @@
>
<template slot-scope="scope">
<!-- <a v-if="scope.row.standYear" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{ scope.row.standNumber }}-{{ scope.row.standYear }}</a>-->
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standCode }}</a>
</template>
</el-table-column>
<el-table-column
@@ -451,9 +519,9 @@
min-width="300"
>
<template slot-scope="scope">
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow === '参考' " style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow === '参考' " style="color: #E6A23C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standName }}</a>
</template>
</el-table-column>
<el-table-column
@@ -463,9 +531,9 @@
min-width="300"
>
<template slot-scope="scope">
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standEnName }}</a>
</template>
</el-table-column>
<el-table-column
@@ -509,7 +577,6 @@
</template>
</el-table-column>
</div>
</el-table>
<!--分页-->
<pagination
@@ -520,10 +587,19 @@
:page="handleSelectForm.page"
:total="handleSelectForm.total"
@pageChange="handleSelectPageChange"
@pageSizeChange="handleSelectPageSizeChange"></pagination>
@pageSizeChange="handleSelectPageSizeChange"
/>
<div slot="footer" class="demo-drawer-footer">
<el-button class="common-button-default" size="mini" @click="standModel = false">取消</el-button>
<el-button type="primary" size="mini" class="common-button-primary" @click="handleSelectConfirm" v-show="lawInfoTableLoading === false">确定</el-button>
<el-button
v-show="lawInfoTableLoading === false"
type="primary"
size="mini"
class="common-button-primary"
@click="handleSelectConfirm"
>
确定
</el-button>
</div>
</div>
</el-drawer>
@@ -535,6 +611,7 @@
:visible.sync="answerListDrawer"
size="900px"
custom-class="demo-drawer"
:before-close="beforeClose"
>
<div class="demo-drawer-content">
<!-- <loading :loading="lawInfoTableLoading">数据获取中</loading>-->
@@ -542,13 +619,13 @@
<template v-for="(item, index) in answerList">
<div class="clearfix">
<div class="answer-box">
<question-item-info :answer="item"></question-item-info>
<question-item-info :answer="item" />
</div>
</div>
</template>
</div>
<div slot="footer" class="demo-drawer-footer">
<el-button class="common-button-default" size="mini" @click="answerListDrawer = false">取消</el-button>
<el-button class="common-button-default" size="mini" @click="close">取消</el-button>
</div>
</div>
</el-drawer>
@@ -557,8 +634,8 @@
<script>
import questionsItem from './components/questions-item'
import answerItem from "./components/answerItem";
import questionItemInfo from "./components/questionItemInfo";
import answerItem from './components/answerItem';
import questionItemInfo from './components/questionItemInfo';
import standItem from './components/stand-item'
function debounce (func, wait = 500) {
@@ -571,7 +648,7 @@ function debounce(func, wait = 500){
}
}
export default {
name: "standQA",
name: 'StandQA',
components: {
questionItemInfo,
questionsItem,
@@ -676,9 +753,9 @@ export default {
this.questionSerach.classification = this.$route.query.standType
this.searchBtn()
// 查询各下拉框数据
this.$http.get("sys/dictype/getDicTypeListCode", "", {
this.$http.get('sys/dictype/getDicTypeListCode', '', {
_this: this,
loading: "loading"
loading: 'loading'
}, res => {
this.setMap(res.data.WBZTCLASS);// 标准状态
this.textState = res.data.WBZTCLASS // 标准状态
@@ -689,6 +766,20 @@ export default {
this.toAnswer()
},
methods: {
close () {
this.$router.push({
name: 'StandQA',
query: {}
})
this.answerListDrawer = false
},
beforeClose (done) {
this.$router.push({
name: 'StandQA',
query: {}
})
done()
},
toAnswer () {
if (this.$route.query && this.$route.query.id) {
this.$http._getData('/lawss/AskQuestions/askQuestionById', {
@@ -766,7 +857,7 @@ export default {
// 点击跳转问题详情
historyJump (item) {
this.$router.push({
path: "/questionDetail",
path: '/questionDetail',
query: {
id: item.id
}
@@ -785,14 +876,14 @@ export default {
},
// 点击查看
handlePreview (item) {
let routeUrl = this.$router.resolve({
name: "OtherStandardDetails",
const routeUrl = this.$router.resolve({
name: 'OtherStandardDetails',
params: {
id: item.id || item.standId,
pageType: item.standType + '_STAND'
}
});
window.open(routeUrl.href, "_blank");
window.open(routeUrl.href, '_blank');
},
// 将标准状态的id与name对应
setMap (data) {
@@ -975,7 +1066,7 @@ export default {
const selectedStand = this.activestand == '0' || this.activeType === 'INLAND' ? this.standList[0] : this.standMap.get(this.activestand)
this.standType = selectedStand.classification
this.questionForm = {
pubQue : selectedStand.classification === "OTHER" ? selectedStand.standardId : '',//公共问题
pubQue: selectedStand.classification === 'OTHER' ? selectedStand.standardId : '', // 公共问题
classification: selectedStand.classification, // 标准类型
problemDescription: '', // 问题
questioner: this.$store.getters.userInfo.userId, // 提问人
@@ -1027,26 +1118,26 @@ export default {
// 文件上传前
beforeUploadTheme (file) {
console.log(file);
var filename = file.name;
var index1 = filename.lastIndexOf('.')
var index2 = filename.length
var fileSuffix = filename.substring(index1, index2)
const filename = file.name;
const index1 = filename.lastIndexOf('.')
const index2 = filename.length
let fileSuffix = filename.substring(index1, index2)
// 把后缀转大写
if(fileSuffix) {
fileSuffix = fileSuffix.toUpperCase()
}
// 判断上传文件格式
if (fileSuffix === ".PDF" || fileSuffix === ".DOC" || fileSuffix === ".DOCX" || fileSuffix === ".PPT"
|| fileSuffix === ".PPTX" || fileSuffix === ".XLS" || fileSuffix === ".XLSX"
|| fileSuffix === ".PNG" || fileSuffix === ".JPG" || fileSuffix === ".JPEG") {
if (fileSuffix === '.PDF' || fileSuffix === '.DOC' || fileSuffix === '.DOCX' || fileSuffix === '.PPT'
|| fileSuffix === '.PPTX' || fileSuffix === '.XLS' || fileSuffix === '.XLSX'
|| fileSuffix === '.PNG' || fileSuffix === '.JPG' || fileSuffix === '.JPEG') {
return true;
} else {
this.$message.error("文件" + file.name + "格式不正确,请上传pdf、doc、docx、ppt、pptx、xls、xlsx、png、jpg、jpeg等文件");
this.$message.error('文件' + file.name + '格式不正确,请上传pdf、doc、docx、ppt、pptx、xls、xlsx、png、jpg、jpeg等文件');
return false;
}
// 判断文件上传大小
if (file.size / 1024 / 1024 > 300) {
this.$message.warning("文件" + file.name + "大小不能超过300M");
this.$message.warning('文件' + file.name + '大小不能超过300M');
return false;
}
return true;